Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
GridBox
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\HtmlToPdf\Box;
6
7/**
8 * A box that establishes a grid formatting context — `display: grid`
9 * (block-level) per CSS Grid Layout 2 §3.
10 *
11 * Phase-2 MVP: explicit-placement layout with `<length>` track lists.
12 * `fr` units, `auto` track sizing, `repeat()`, `auto-fill` /
13 * `auto-fit`, `grid-template-areas`, `grid-auto-{columns,rows}`,
14 * `span N` syntax, subgrid, and `justify-self` / `align-self` are
15 * intentional follow-ups.
16 */
17final class GridBox extends Box
18{
19    /**
20     * CSS Grid Layout 3 — this box is a GRID LANES container
21     * (`display: grid-lanes`), i.e. it establishes tracks in one axis
22     * only and packs items freely in the other.
23     */
24    public bool $lanes = false;
25
26    /**
27     * CSS Grid Layout 3 §2.3 — which axis carries the tracks. `true`
28     * (the default orientation) means the inline axis is the grid axis
29     * and the lanes are columns; `false` means the block axis is, and
30     * the lanes are rows. Only meaningful when {@see $lanes} is set.
31     */
32    public bool $lanesGridAxisIsInline = true;
33
34    /**
35     * CSS Grid Layout 3 — `grid-lanes-direction: … fill-reverse`. Items
36     * fill each lane from the END of the stacking axis rather than its
37     * start. Only meaningful when {@see $lanes} is set.
38     */
39    public bool $lanesFillReverse = false;
40
41    /**
42     * CSS Grid Layout 3 — `grid-lanes-direction: … track-reverse`. The
43     * grid axis runs in the reverse direction, so the first lane the
44     * placement algorithm fills sits at the grid axis' END edge — the
45     * same relationship `direction: rtl` has with a column grid axis.
46     * Only meaningful when {@see $lanes} is set.
47     */
48    public bool $lanesTrackReverse = false;
49
50    /**
51     * CSS Gaps 1 §2–§4 — resolved `column-rule` / `row-rule` gap-decoration
52     * segments in top-down layout coordinates. Each entry carries the rule
53     * prefix (`'column-rule'` or `'row-rule'`, which selects the `-width` /
54     * `-style` / `-color` longhands) and the two endpoints of the
55     * centre-line to stroke. Breaks (`*-rule-break`), per-item visibility
56     * (`*-rule-visibility-items`) and endpoint insets (`*-rule-inset-*`)
57     * are already applied. Populated by
58     * {@see \Phpdftk\HtmlToPdf\Layout\BlockLayout::computeGridGapRuleSegments()}
59     * and consumed by
60     * {@see \Phpdftk\HtmlToPdf\Painter\Painter::paintGridGapRules()}.
61     * Empty when the grid paints no gap decorations.
62     *
63     * @var list<array{prefix: string, x1: float, y1: float, x2: float, y2: float}>
64     */
65    public array $gapRuleSegments = [];
66}