Honor sizing-probe verdicts in height emission; pin lottie mount heights

- heightFlows() bails when the capture probe proved a height authored-
  explicit (hAuto=false, hFill=false), so circular parent/child flow
  reasoning can no longer drop 100vh heroes to 0px; the probe verdict now
  vetoes the drop through both OR'd paths at the call site
- Space-distributing flex columns (space-between/around/evenly, center,
  flex-end) disqualify the content-driven read - the box height is load-
  bearing for the distribution
- Lottie mounts pin their captured per-viewport height like other replaced
  content, so aspect-fit runtime svgs can't inflate past the captured box
- DittoLottie forwards the placeholder's data-cid onto the runtime svg/
  canvas so the media stays addressable after the swap

240 tests pass (9 new), typecheck clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samraaj Bath
2026-07-03 23:43:36 -07:00
co-authored by Claude Fable 5
parent 6a930d57b1
commit d5a713d31f
6 changed files with 209 additions and 7 deletions
+14
View File
@@ -36,6 +36,20 @@ describe("DittoLottie placeholder retention", () => {
it("handles a failed load without leaving a broken mount stacked over the placeholder", () => {
assert.match(DITTO_LOTTIE_TSX, /data_failed/);
});
// The player creates its <svg>/<canvas> at runtime WITHOUT a data-cid, so the DOM/media gate can't
// map it back to the captured node. The reveal must forward the discarded placeholder's data-cid
// onto the runtime-rendered element (validation-agnostic; no gate special-casing).
it("forwards the placeholder's data-cid onto the runtime-rendered svg/canvas before the swap", () => {
// reads the placeholder cid, then reassigns it to the rendered svg/canvas inside the mount
assert.match(DITTO_LOTTIE_TSX, /getAttribute\(\s*["']data-cid["']\s*\)/);
assert.match(DITTO_LOTTIE_TSX, /mount\.querySelector\(\s*["']svg,\s*canvas["']\s*\)/);
assert.match(DITTO_LOTTIE_TSX, /setAttribute\(\s*["']data-cid["']\s*,/);
// the cid capture must precede its removal so the placeholder is still in the DOM when read
const readIdx = DITTO_LOTTIE_TSX.indexOf('getAttribute("data-cid")');
const removeIdx = DITTO_LOTTIE_TSX.indexOf("removeChild");
assert.ok(readIdx >= 0 && removeIdx >= 0 && readIdx < removeIdx, "must read the placeholder cid before removing it");
});
});
describe("identity-transform canonicalization (isIdentityTransform)", () => {