Flex containers item-ize their inline children - #80
Conversation
…e row) The mapper's anonymous-box normalization merged consecutive inline children into ONE Text node — correct for block containers, wrong for display:flex, where CSS makes each in-flow child element its own flex item and wraps only contiguous BARE TEXT in an anonymous item. So <div style="display:flex; justify-content:space-between"> <span>Label</span><span>$1,234</span></div> — the label/figure row in any document — silently fused: no spread, no independent alignment, and the line box sized by whichever font came first (the Northmoor amount-due row put a 25.5pt figure inside an 11.25pt line). Each inline element child of a flex parent now becomes its own Text item CARRYING ITS OWN computed style (the node-level font size is what sizes the item's line box); contiguous bare text still groups; <br> stays with the text run it breaks; whitespace-only runs produce no item. Items are top-aligned until align-items: baseline lands (the documented engine gap — next). Template hygiene riding along: flex-shrink: 0 on .mark and .cln — the design's flex:none, which is outside the subset and was silently dropped in the port (the masthead square rendered 25.9pt wide; a full sweep of the design's flex:none classes found these two, .page/.label being prototype chrome). The mark is 33x33 again. Pins (failed before the fix): a space-between flex row with two spans yields two items spread to the box edges, the big run carrying its own line box; bare text + element = two items. Impact survey: fixture wall 6/6 IDENTICAL; 11 of 30 Northmoor templates change (due rows, clause columns, mastheads), all warning-free, page counts stable, chains hold; docs images + MDX regenerated from the new renders. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019eLgo72VYmQp3kNz9PZDHs
🟡 Changes detected — review pending9 documents changed structurally · 0 errors, 9 warnings, 3 info 9 documents changed, none blocking
31 documents unchanged:
Forme Review · 40 runs · powered by pdf-testkit 0.3.0 |
📄 pdf-testkit —
|
The .mark/.cln flex-shrink guards (the design's flex:none) turned out to sit on a stack of intrinsic-measurement bugs — with the guard, the masthead's inner row goes over-full (its own intrinsic width is under-measured: gaps omitted, letter-spacing lost) and termination- letter overflowed to a second page. The guard is correct in intent and wrong to ship before the measurement is: it moves the shrink error from the mark (visibly narrow) to the page count (visibly worse). Reverted here; the guards land with the measurement fixes, separately pinned. This PR is the mapper item-ization alone again. Docs images regenerated from the mapper-only engine (the previous regen had captured the guard-era renders, including the overflowed termination letter). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019eLgo72VYmQp3kNz9PZDHs
|
Descoped by a follow-up commit: the .mark/.cln shrink guards are OUT (they sit on intrinsic-measurement bugs — gap-less and letter-spacing-blind intrinsic widths — and overflowed termination-letter to two pages; they return with the measurement fixes, separately pinned). This PR is the mapper item-ization alone; docs images regenerated to match. |
The mapper merged consecutive inline children into one Text node — correct for block containers, wrong for
display: flex, where CSS makes each in-flow child element its own flex item and wraps only contiguous bare text anonymously.<div style="display:flex; justify-content:space-between"><span>Label</span><span>$1,234</span></div>— one of the most common document patterns — silently fused into one line: no spread, no independent alignment, line box sized by whichever font came first.<br>stays with its run; whitespace-only runs produce no item.align-items: baselinelands (documented gap, next PR per the agreed order — this is visibly better and not wrong, just not complete).flex-shrink: 0on.markand.cln— the design'sflex:none(outside the subset, silently dropped in the port; the masthead square rendered 25.9pt wide). Sweep of allflex:noneclasses in the design found exactly these two;.page/.labelare prototype chrome.Targeted for 0.21.0 — release PR #79 gets updated with main after this merges.