@vectoriox/iox-ui 5.205.0 → 5.206.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/data-core/index.d.ts +13 -4
  2. package/design-core/index.d.ts +269 -6
  3. package/fesm2022/vectoriox-iox-ui-data-core.mjs +23 -4
  4. package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-design-core.mjs +3064 -2682
  6. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1184 -173
  8. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +71 -19
  10. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-scene-core.mjs +32 -4
  12. package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
  13. package/generation-core/index.d.ts +421 -34
  14. package/harness-core/index.d.ts +52 -12
  15. package/package.json +1 -1
  16. package/scene-core/index.d.ts +16 -2
  17. package/src/data-core/placeholder-rows.ts +24 -3
  18. package/src/design-core/colour-eval.ts +22 -0
  19. package/src/design-core/contrast-audit.ts +96 -2
  20. package/src/design-core/design-token.model.ts +2 -0
  21. package/src/design-core/flavor-spec.generated.ts +184 -0
  22. package/src/design-core/font-metrics.ts +14 -1
  23. package/src/design-core/font-vertical.ts +80 -0
  24. package/src/design-core/public-api.ts +1 -0
  25. package/src/design-core/style-presets.ts +20 -1
  26. package/src/design-core/token-css.ts +3 -1
  27. package/src/generation-core/audit-site.ts +5 -3
  28. package/src/generation-core/compose-free.ts +1 -1
  29. package/src/generation-core/compose-layout.ts +197 -23
  30. package/src/generation-core/critic-calibration.ts +26 -9
  31. package/src/generation-core/critic-numbers.ts +259 -0
  32. package/src/generation-core/critic-prompt.ts +53 -6
  33. package/src/generation-core/critic-rubric.generated.ts +6 -6
  34. package/src/generation-core/critic-sheet.ts +112 -1
  35. package/src/generation-core/layout-render-check.ts +35 -2
  36. package/src/generation-core/layout-space.ts +2 -1
  37. package/src/generation-core/nav-shape.ts +67 -8
  38. package/src/generation-core/opening-mix.ts +61 -17
  39. package/src/generation-core/public-api.ts +2 -0
  40. package/src/generation-core/social-links.ts +47 -8
  41. package/src/generation-core/stock-photos.ts +149 -14
  42. package/src/generation-core/stock-search.ts +108 -19
  43. package/src/generation-core/stock-subjects.ts +204 -0
  44. package/src/harness-core/business-types.ts +3 -0
  45. package/src/harness-core/harness-spec.generated.ts +54 -15
  46. package/src/harness-core/intake.ts +18 -5
  47. package/src/scene-core/scene.ts +34 -3
  48. package/styles/iox-design.css +41 -2
  49. package/styles/iox-forms.css +7 -6
@@ -5,7 +5,7 @@ import {
5
5
  } from '@vectoriox/iox-ui/composite-core';
6
6
 
7
7
  import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
8
- import { SCENE_LAND_TRIGGER, SCENE_TRACK_EASE, SceneEase, SceneProp, SceneRange, SceneRevealFrom, TextRevealBy } from '@vectoriox/iox-ui/scene-core';
8
+ import { mergeSceneTracks, SCENE_LAND_TRIGGER, SCENE_TRACK_EASE, SceneEase, SceneProp, SceneRange, SceneRevealFrom, TextRevealBy } from '@vectoriox/iox-ui/scene-core';
9
9
  import { FORM_AFTER_SEND_TRAIT, FormAfterSend, FormPresetId } from '@vectoriox/iox-ui/forms-core';
10
10
  import { composeNavHeader, composePresetForm } from './compose-site';
11
11
  import { drawnHeaderMix, headerMixOfNavKind } from './header-mix';
@@ -17,7 +17,7 @@ import {
17
17
  LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_EASING, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHOTO_ASPECT, LAYOUT_TOOLTIP_TRAIT,
18
18
  LAYOUT_PHONE_PADDING, LAYOUT_RISE, LAYOUT_TEXT_KINDS, LayoutBleed, LayoutColour, LayoutEase, LayoutEnter, LayoutForm, LayoutGallery, LayoutLayer,
19
19
  LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListHow, LayoutListItem, LayoutListMix, LayoutListMove, LayoutListPhone, LayoutListWho,
20
- LayoutLayerKind, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutRole, LayoutSection, LayoutSide, LayoutSite, LayoutTrack, LayoutTrackProp, LayoutTransition, phoneGapBefore,
20
+ LayoutLayerKind, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutRole, LayoutSection, LayoutSectionKind, LayoutSide, LayoutSite, LayoutTrack, LayoutTrackProp, LayoutTransition, phoneGapBefore,
21
21
  screenFontSize,
22
22
  } from './layout-language';
23
23
  import { layoutGlideDepth } from './layout-drift';
@@ -251,6 +251,8 @@ const ZERO = '0px';
251
251
  const RULE_PX = '1px';
252
252
  const PHONE_GROUND_BRIGHTNESS = '0.75';
253
253
  const GALLERY_BAR_TOP = '12px';
254
+ /** How a list the section's rows are sized by stands in them (iox-ui#207). */
255
+ const CONTENT_SIZED_ALIGN = 'start';
254
256
  const STRETCH_KINDS: ReadonlySet<string> = new Set([LayoutLayerKind.Photo, LayoutLayerKind.Shape, LayoutLayerKind.Gallery, LayoutLayerKind.Form]);
255
257
  const STACKED_EFFECTS: ReadonlySet<string> = new Set(['fade', 'cube', 'flip', 'cards']);
256
258
  const SHADOW_UNDER_LIGHT = '0 1px 2px rgba(0,0,0,.55), 0 6px 34px rgba(0,0,0,.6)';
@@ -404,20 +406,129 @@ function isLight(colour: string | undefined, mode: LayoutColourMode): boolean {
404
406
  return mode === LayoutColourMode.Light ? ground : !ground;
405
407
  }
406
408
 
407
- const gridTemplate = (count: number) => `repeat(${count}, minmax(0, 1fr))`;
409
+ /** The plan's equal row. */
410
+ const EQUAL_ROW = 'minmax(0, 1fr)';
411
+ const gridTemplate = (count: number) => `repeat(${count}, ${EQUAL_ROW})`;
408
412
 
409
413
  /** The grid a section's layers are placed on: 12 columns per screen between an outer track a side (the page's column,
410
- * award §0c CW2 — `layoutGridColumns`), its rows. No inline padding: a bleed spans into an outer track. */
411
- function gridLayout(rows: number, track: number): Record<string, string> {
414
+ * award §0c CW2 — `layoutGridColumns`), its rows (`sectionRows`, or the plan's equal rows). No inline padding: a bleed
415
+ * spans into an outer track. */
416
+ function gridLayout(rows: number | string, track: number): Record<string, string> {
412
417
  return {
413
418
  display: 'grid',
414
419
  gridTemplateColumns: layoutGridColumns(track),
415
- gridTemplateRows: gridTemplate(rows),
420
+ gridTemplateRows: typeof rows === 'number' ? gridTemplate(rows) : rows,
416
421
  gap: `${ZERO} ${LAYOUT_COLUMN_GAP}`,
417
422
  padding: ZERO,
418
423
  };
419
424
  }
420
425
 
426
+ /** The rows [first, end) the section's content-sized lists stand in, or null when it holds none. */
427
+ export function contentSizedBand(layers: ReadonlyArray<Pick<LayoutLayer, 'row'>>): [number, number] | null {
428
+ if (!layers.length) return null;
429
+ return [Math.min(...layers.map(l => l.row[0])), Math.max(...layers.map(l => l.row[1]))];
430
+ }
431
+
432
+ /**
433
+ * iox-ui#207: a laid section that holds a list grid is sized by its content. A list's height is its DATA's (how many
434
+ * items, at the card's aspect), never the plan's: the café's four dishes ended 1105 px above the bottom of a two-screen
435
+ * section, two empty screens at rest. So the rows the lists stand in are `auto` (as tall as the list), every other row
436
+ * keeps its planned share of the plan's screens, and the section is as tall as its rows (`height: auto`, min-height 0):
437
+ * a list of three is short, a list of twelve grows the section instead of being clipped. Null: the plan's equal rows.
438
+ */
439
+ export function sectionRows(rows: number, screens: number, band: readonly [number, number] | null): string | null {
440
+ if (!band) return null;
441
+ const planned = plannedRow(screens, rows);
442
+ return joinTracks(Array.from({ length: rows }, (_, i) => (i + 1 >= band[0] && i + 1 < band[1] ? AUTO_ROW : planned)));
443
+ }
444
+
445
+ /**
446
+ * iox-ui#220: an inhale — the page's one breath, a word in the quiet — is laid with its words in the MIDDLE of its screens.
447
+ * The model places a breath's line where it likes (every stored Pro plan put it in row 2 of 4), and laid on the plan's
448
+ * equal rows that left 0.6 of a screen of flat ground under it: the café's "We save you a seat." (iox-ui#207 blank 2),
449
+ * which the render judge (`RENDER_CHECK.emptyBelow`) now rightly refuses — so every Pro Home with an inhale fell back to
450
+ * sections. The rows its layers stand in keep their planned share of the screens, the empty rows above and below take
451
+ * no height, and the section centres what is left (`alignContent: center`): the quiet is shared above and below the word,
452
+ * never a screen of it at rest. Null when the layers cover every row (the plan's equal rows already) or there are none.
453
+ */
454
+ export function inhaleRows(rows: number, screens: number, band: readonly [number, number] | null): string | null {
455
+ if (!band || (band[0] <= 1 && band[1] > rows)) return null;
456
+ const planned = plannedRow(screens, rows);
457
+ return joinTracks(Array.from({ length: rows }, (_, i) => (i + 1 >= band[0] && i + 1 < band[1] ? planned : EMPTY_ROW)));
458
+ }
459
+
460
+ /** An inhale's empty row (`inhaleRows`), and how its rows stand in its screens. */
461
+ const EMPTY_ROW = '0px';
462
+ const INHALE_ALIGN = 'center';
463
+
464
+ const AUTO_ROW = 'auto';
465
+ /** A row's planned share of the section's screens. */
466
+ const plannedRow = (screens: number, rows: number): string => `calc(${screens * 100}svh / ${rows})`;
467
+
468
+ /** Tracks as a `grid-template-rows` value, a run of equal tracks as one `repeat()`. */
469
+ function joinTracks(tracks: ReadonlyArray<string>): string {
470
+ const runs: Array<{ track: string; n: number }> = [];
471
+ for (const track of tracks) {
472
+ const last = runs[runs.length - 1];
473
+ if (last?.track === track) last.n++;
474
+ else runs.push({ track, n: 1 });
475
+ }
476
+ return runs.map(({ track, n }) => (n === 1 ? track : `repeat(${n}, ${track})`)).join(' ');
477
+ }
478
+
479
+ /** A `grid-template-rows` value as one track per row (`repeat(n, x)` expanded); null when it is not a list of tracks
480
+ * this composer writes (`none`, a named area, a nested repeat). */
481
+ function splitTracks(value: string): string[] | null {
482
+ const tokens: string[] = [];
483
+ let depth = 0, buf = '';
484
+ for (const ch of value.trim()) {
485
+ if (ch === '(') depth++;
486
+ if (ch === ')') depth--;
487
+ if (/\s/.test(ch) && depth === 0) { if (buf) tokens.push(buf); buf = ''; continue; }
488
+ buf += ch;
489
+ }
490
+ if (buf) tokens.push(buf);
491
+ const out: string[] = [];
492
+ for (const t of tokens) {
493
+ const rep = /^repeat\(\s*(\d+)\s*,\s*(.+)\)$/.exec(t);
494
+ if (rep) { if (rep[2].includes('repeat(')) return null; for (let i = 0; i < Number(rep[1]); i++) out.push(rep[2].trim()); }
495
+ else if (t === 'none' || t.startsWith('[')) return null;
496
+ else out.push(t);
497
+ }
498
+ return out.length ? out : null;
499
+ }
500
+
501
+ const GRID_ROW = /^\s*(\d+)\s*\/\s*(\d+)\s*$/;
502
+ const SCREENS_HEIGHT = /^(\d+(?:\.\d+)?)svh$/;
503
+
504
+ /**
505
+ * iox-ui#216: the section a recomposed list frame stands in, sized for it — the half of `composeListFrame` that is not the
506
+ * frame. A list re-mixed from a row slider to a grid (a Repeater, as tall as its data) needs the rows it stands in `auto`
507
+ * and the section `height: auto`, exactly as `composeLayout` lays a section composed with that grid (`sectionRows`); every
508
+ * other row keeps its planned share of the section's screens (an equal `1fr` row becomes `calc(<screens>svh / rows)`).
509
+ * `section` is the laid section (its grid is itself or its transition body); `frameId` the frame's id. A frame that is
510
+ * not content-sized, not in a grid cell, or a grid this composer did not write → the section unchanged. Pure.
511
+ */
512
+ export function listSectionRows(section: SerializedNode, frameId: string, contentSized: boolean): SerializedNode {
513
+ if (!contentSized) return section;
514
+ const out = structuredClone(section);
515
+ const grid = [out, ...(out.children ?? [])].find(n => (n.children ?? []).some(c => c.id === frameId));
516
+ const frame = grid?.children?.find(c => c.id === frameId);
517
+ const cell = GRID_ROW.exec(String(frame?.styleProps?.['gridRow'] ?? ''));
518
+ const tracks = splitTracks(String(grid?.styleProps?.['gridTemplateRows'] ?? ''));
519
+ if (!grid || !frame || !cell || !tracks) return section;
520
+ const screens = SCREENS_HEIGHT.exec(String(out.styleProps?.['height'] ?? ''));
521
+ const share = screens ? plannedRow(Number(screens[1]) / 100, tracks.length) : null;
522
+ const [from, to] = [Number(cell[1]), Number(cell[2])];
523
+ const sized = tracks.map((t, i) => (i + 1 >= from && i + 1 < to ? AUTO_ROW : t === EQUAL_ROW && share ? share : t));
524
+ if (sized.some(t => t === EQUAL_ROW)) return section; // a 1fr row of a section with no screens to share: leave it
525
+ setStyleProps(grid, { gridTemplateRows: joinTracks(sized) });
526
+ setStyleProps(out, { height: 'auto' });
527
+ setStyleProps(frame, { alignSelf: CONTENT_SIZED_ALIGN });
528
+ return out;
529
+ }
530
+
531
+
421
532
  /** The same grid on a phone: one column, in the section's `phone` order, with the M1.3 padding. */
422
533
  function phoneStack(first: boolean): Record<string, string> {
423
534
  return {
@@ -639,15 +750,23 @@ interface LayerCtx {
639
750
  phoneAlign: string;
640
751
  /** A drawer's word: it arrives as its step lands (`drawerArrival`), never by the layout's own entrance. */
641
752
  arrivesOnLanding?: boolean;
753
+ /** The layer stands in normal flow (a free section's slot), not in a grid cell that gives it a height: what would
754
+ * fill its cell (a row's slider, a deck's holder) sits in flow at every width, as tall as its items (iox-ui#197). */
755
+ flow?: boolean;
756
+ /** Set by the list composer: the layer is a list laid as a Repeater (a grid, a wall, a round-two arrangement) — as
757
+ * tall as its DATA, so its rows are sized by it (iox-ui#207, `sectionRows`). */
758
+ contentSized?: boolean;
642
759
  }
643
760
 
644
761
  /** The node that sits on the grid: its cell, its stacking, its bleed and its tilt — and on a phone, its place in the stack. */
645
762
  function place(node: SerializedNode, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): void {
646
- const stretch = STRETCH_KINDS.has(l.kind);
763
+ // iox-ui#207: a list as tall as its data stands at the top of its rows and takes no height from them — what a
764
+ // recompose reads as "in flow" (`listFrameInFlow`), so a grid re-mixed to a row keeps its height in the auto rows.
765
+ const stretch = STRETCH_KINDS.has(l.kind) && !lc.contentSized;
647
766
  const values: Record<string, unknown> = {
648
767
  gridColumn: gridColumnOf(l),
649
768
  gridRow: `${l.row[0]} / ${l.row[1]}`,
650
- alignSelf: stretch ? 'stretch' : 'center',
769
+ alignSelf: lc.contentSized ? CONTENT_SIZED_ALIGN : stretch ? 'stretch' : 'center',
651
770
  zIndex: String(1 + (l.z ?? 0)),
652
771
  position: 'relative',
653
772
  minWidth: ZERO,
@@ -1062,6 +1181,10 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1062
1181
  }
1063
1182
  const masonry = arrange === LayoutListArrange.Masonry || arrange === LayoutListArrange.Hang;
1064
1183
  const item = listItem(`${id}-item`, mix, source, list, masonry, lc.path, ctx, strips);
1184
+ // iox-ui#207: a list laid as a Repeater (strips, a grid, a wall, a round-two arrangement) is as tall as its rows of
1185
+ // DATA — the section sizes the rows it stands in by it. A slider or a deck fills the cell it is given.
1186
+ const slides = arrange === LayoutListArrange.Row || deck || (arrange === LayoutListArrange.Fan && mix.move.includes(LayoutListMove.Drag));
1187
+ if (!slides) lc.contentSized = true;
1065
1188
  if (strips) return composeStrips(id, frame, item, mix, source, ctx, listItemRadius(mix));
1066
1189
  // AW11-D16: drifting picture rows — the Marquee holding the list's pictures, twice.
1067
1190
  if (mix.move.includes(LayoutListMove.Rows) && arrange === LayoutListArrange.Row && !lc.held) return composeDriftRows(id, frame, item, source, l);
@@ -1077,7 +1200,7 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1077
1200
  const shown = standout && !standWait && !deck ? standWrap(`${id}-stand`, item, standout) : item;
1078
1201
 
1079
1202
  const fanDragged = arrange === LayoutListArrange.Fan && mix.move.includes(LayoutListMove.Drag);
1080
- if (arrange === LayoutListArrange.Row || deck || fanDragged) {
1203
+ if (slides) {
1081
1204
  const scrollPlays = mix.move.includes(LayoutListMove.Page) && !lc.held;
1082
1205
  const played = scrollPlays || lc.held;
1083
1206
  const drag = mix.move.includes(LayoutListMove.Drag);
@@ -1096,6 +1219,9 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1096
1219
  setStyleProps(slider, scrollPlays ? { width: FULL, height: FULL, minHeight: ZERO } : deck ? {
1097
1220
  // A deck fills its holder (below); the cards behind show past its edges.
1098
1221
  width: FULL, height: FULL, minHeight: ZERO, display: 'flex', flexDirection: 'column', overflow: 'visible',
1222
+ } : lc.flow ? {
1223
+ // iox-ui#197: in flow there is no cell to fill — `inset: 0` in a frame of no height drew the row 0 px tall.
1224
+ position: 'relative', width: FULL, height: 'auto', minHeight: ZERO, display: 'flex', flexDirection: 'column',
1099
1225
  } : {
1100
1226
  position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: FULL, height: FULL, minHeight: ZERO,
1101
1227
  display: 'flex', flexDirection: 'column',
@@ -1118,7 +1244,7 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1118
1244
  walkSerialized([slider], node => {
1119
1245
  if (node.role === SliderRole.Prev || node.role === SliderRole.Next) node.props[LAYOUT_TOOLTIP_TRAIT] = node.props['ariaLabel'];
1120
1246
  });
1121
- frame.children = [oneWide ? deckHolder(`${id}-deck`, slider) : slider];
1247
+ frame.children = [oneWide ? deckHolder(`${id}-deck`, slider, !!lc.flow) : slider];
1122
1248
  return frame;
1123
1249
  }
1124
1250
 
@@ -1186,6 +1312,9 @@ export interface ListFrameInput {
1186
1312
  readonly was?: LayoutListMix | null;
1187
1313
  /** The id a NEW frame is made under (a free page's slot, FS3); default `list`. A recompose keeps `previous`'s. */
1188
1314
  readonly id?: string;
1315
+ /** The frame stands in normal flow (a free section's slot), not in a layout's grid cell (iox-ui#197). Absent: a NEW
1316
+ * frame is a cell's; a recompose reads it from `previous` (`listFrameInFlow`). */
1317
+ readonly flow?: boolean;
1189
1318
  }
1190
1319
 
1191
1320
  /** A recomposed list frame, and what the composer said while composing it (a word drawn as its stand-in…). */
@@ -1195,6 +1324,9 @@ export interface ListFrame {
1195
1324
  /** vectoriox/iox-ui#122 (BL-D8): every part of the card the owner changed — kept on the new card, or redrawn (said
1196
1325
  * before Apply). Empty with no frame on the page. */
1197
1326
  readonly edits: ReadonlyArray<ListPartEdit>;
1327
+ /** iox-ui#216: the new arrangement is as tall as its data (a Repeater: a grid, a wall, strips…) — the section it stands
1328
+ * in must size the rows it stands in by it (`listSectionRows`; `composeListInSection` does both). */
1329
+ readonly contentSized: boolean;
1198
1330
  }
1199
1331
 
1200
1332
  /** The frame styles the list composer owns (laptop and phone) beyond a new Container's own: a recompose replaces them
@@ -1211,17 +1343,33 @@ const LIST_FRAME_PROPS: ReadonlyArray<string> = [LIST_MIX_PROP, 'colorScheme'];
1211
1343
  * arrangement, role, room and classes. Pure.
1212
1344
  */
1213
1345
  export function composeListFrame(input: ListFrameInput, previous?: SerializedNode | null): ListFrame {
1346
+ if (input.flow === undefined && previous) input = { ...input, flow: listFrameInFlow(previous) };
1214
1347
  const composed = composeListOnly(input, previous?.id ?? input.id ?? 'list');
1215
- if (!previous) return { frame: composed.frame, gaps: composed.gaps, edits: [] };
1348
+ if (!previous) return { frame: composed.frame, gaps: composed.gaps, edits: [], contentSized: composed.contentSized };
1216
1349
  // What the composer draws for the mix the frame wears now: anything else on the page is the owner's (#122).
1217
1350
  const was = input.was ?? listMixOfFrame(previous, input.list);
1218
1351
  const baseline = was ? composeListOnly({ ...input, mix: was }, previous.id).frame : null;
1219
1352
  const kept = keepListParts(previous, baseline, composed.frame);
1220
- return { frame: keepPlace(previous, { ...composed.frame, children: kept.children }), gaps: composed.gaps, edits: kept.edits };
1353
+ return { frame: keepPlace(previous, { ...composed.frame, children: kept.children }), gaps: composed.gaps, edits: kept.edits, contentSized: composed.contentSized };
1354
+ }
1355
+
1356
+ /**
1357
+ * iox-ui#216: recompose the list frame `frameId` INSIDE its laid section — the frame (`composeListFrame`) and the section's
1358
+ * rows for it (`listSectionRows`), the one call a re-mix applies, so a row slider re-mixed to a grid gets the rows a
1359
+ * section composed with that grid has. `list` is null (and the section unchanged) when the section holds no such frame.
1360
+ */
1361
+ export function composeListInSection(section: SerializedNode, frameId: string, input: ListFrameInput): { section: SerializedNode; list: ListFrame | null } {
1362
+ let previous: SerializedNode | null = null;
1363
+ walkSerialized([section], n => { if (!previous && n.id === frameId) previous = n; });
1364
+ if (!previous) return { section, list: null };
1365
+ const list = composeListFrame(input, previous);
1366
+ const replaced = structuredClone(section);
1367
+ walkSerialized([replaced], n => { if (n.children) n.children = n.children.map(c => (c.id === frameId ? list.frame : c)); });
1368
+ return { section: listSectionRows(replaced, frameId, list.contentSized), list };
1221
1369
  }
1222
1370
 
1223
1371
  /** `composeList` for one frame under an id. */
1224
- function composeListOnly(input: ListFrameInput, id: string): { frame: SerializedNode; gaps: ReadonlyArray<LayoutGap> } {
1372
+ function composeListOnly(input: ListFrameInput, id: string): { frame: SerializedNode; gaps: ReadonlyArray<LayoutGap>; contentSized: boolean } {
1225
1373
  const pace = LAYOUT_PACE[(input.motion?.pace ?? LayoutPace.Normal) as LayoutPace] ?? LAYOUT_PACE[LayoutPace.Normal];
1226
1374
  const site = { locale: input.locale, sections: [], motion: input.motion } as unknown as LayoutSite;
1227
1375
  const ctx = {
@@ -1234,8 +1382,9 @@ function composeListOnly(input: ListFrameInput, id: string): { frame: Serialized
1234
1382
  const col = input.col ?? [1, 13];
1235
1383
  const layer = { kind: LayoutLayerKind.Gallery, col: [col[0], col[1]], row: [1, 2], text: input.label, gallery: { slides: [], source: input.source, list: input.mix } } as unknown as LayoutLayer;
1236
1384
  const path = input.path ?? 'list';
1237
- const lc = { section: { ground: input.ground } as LayoutSection, si: 0, li: 0, path, held: !!input.held, track: 1, order: 0, phoneGap: 0, phoneAlign: 'start' } as LayerCtx;
1238
- return { frame: composeList(id, layer, input.mix, input.source, input.list, lc, ctx), gaps: ctx.gaps };
1385
+ const lc = { section: { ground: input.ground } as LayoutSection, si: 0, li: 0, path, held: !!input.held, track: 1, order: 0, phoneGap: 0, phoneAlign: 'start', flow: !!input.flow } as LayerCtx;
1386
+ const frame = composeList(id, layer, input.mix, input.source, input.list, lc, ctx);
1387
+ return { frame, gaps: ctx.gaps, contentSized: !!lc.contentSized };
1239
1388
  }
1240
1389
 
1241
1390
  /** The props a part's field is bound to when the card SHOWS it (an image's alt and an item's page link only follow). */
@@ -1280,6 +1429,14 @@ function keepPlace(previous: SerializedNode, composed: SerializedNode): Serializ
1280
1429
  return frame;
1281
1430
  }
1282
1431
 
1432
+ /** A list frame on the page stands in flow when no layout placed it in a grid cell (`place` writes its `gridRow`): a free
1433
+ * section's slot (iox-ui#197) — or when its cell gives it no height: a list the section's rows are sized by stands at
1434
+ * their top (iox-ui#207, `place`). A Container's own `gridRow` is `auto`. */
1435
+ export function listFrameInFlow(frame: SerializedNode): boolean {
1436
+ const row = frame.styleProps?.['gridRow'];
1437
+ return !row || row === 'auto' || frame.styleProps?.['alignSelf'] === CONTENT_SIZED_ALIGN;
1438
+ }
1439
+
1283
1440
  /** The page that shows one item, as a composed list frame links to it (`linkToDetail`) — so a recompose keeps the link.
1284
1441
  * Undefined when its items link nowhere (or to an address of their own). */
1285
1442
  export function listDetailOf(frame: SerializedNode | null | undefined): LayoutListBinding['detail'] {
@@ -1304,9 +1461,13 @@ function listItemRadius(mix: LayoutListMix): string {
1304
1461
  * scoped `.swiper { width: 100% }` out-ranks a node's width class. On a phone the holder is the cell's width and the
1305
1462
  * shared `.swiper.swiper-cards` rule (iox-design.css) makes the deck a centred card with its neighbours peeking.
1306
1463
  */
1307
- function deckHolder(id: string, slider: SerializedNode): SerializedNode {
1464
+ function deckHolder(id: string, slider: SerializedNode, flow: boolean): SerializedNode {
1308
1465
  const holder = create(id, T.Container, {}, NO_ELEMENT_STYLE);
1309
- setStyleProps(holder, {
1466
+ // In flow (a free section's slot, iox-ui#197) the deck stands as tall as its cards; in a cell it fills the cell.
1467
+ setStyleProps(holder, flow ? {
1468
+ position: 'relative', width: LIST_DECK_WIDTH, maxWidth: FULL, height: 'auto', minHeight: ZERO, margin: '0px auto',
1469
+ display: 'flex', flexDirection: 'column',
1470
+ } : {
1310
1471
  position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: LIST_DECK_WIDTH, maxWidth: FULL, height: FULL,
1311
1472
  minHeight: ZERO, margin: '0px auto', display: 'flex', flexDirection: 'column',
1312
1473
  });
@@ -1589,8 +1750,10 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
1589
1750
  if (framed) tracks.push({ ...WINDOW_SINK, keys: WINDOW_SINK.keys.map(([at, v]): [number, number] => [at, v]) });
1590
1751
  if (l.kinetic && textual) tracks.push({ prop: 'words', keys: [[0, 0], [KINETIC_ALL_LIT, 100]] });
1591
1752
  if (tracks.length) {
1592
- outer.sceneTracks = tracks;
1593
- outer.scenePhoneTracks = restingTracks(tracks);
1753
+ // A step's in and out are one timeline (iox-ui#195): stamped as one track, as the editor and both renderers read it.
1754
+ const merged = mergeSceneTracks(tracks);
1755
+ outer.sceneTracks = merged;
1756
+ outer.scenePhoneTracks = restingTracks(merged);
1594
1757
  gap(ctx, LayoutGapCode.PhoneRest, lc.path, 'stands at rest on a phone');
1595
1758
  }
1596
1759
  } else if (l.motion?.length) {
@@ -1672,6 +1835,7 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
1672
1835
  const order = Array.isArray(s.phone) && s.phone.length ? s.phone : s.layers.map((_, i) => i);
1673
1836
  const textKinds = s.layers.filter(x => LAYOUT_TEXT_KINDS.has(x.kind) || x.kind === LayoutLayerKind.Button);
1674
1837
  const phoneAlign = textKinds.length && textKinds.every(x => x.align === 'center') ? 'center' : 'start';
1838
+ const contentSized: LayoutLayer[] = [];
1675
1839
  const layers = s.layers.map((l, li) => {
1676
1840
  const at = order.indexOf(li);
1677
1841
  const prevIdx = at > 0 ? order[at - 1] : -1;
@@ -1680,8 +1844,18 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
1680
1844
  section: s, si, li, path: `sections[${si}].layers[${li}]`, held, track: held ? track : 1,
1681
1845
  order: at < 0 ? s.layers.length + li : at, phoneGap: phoneGapBefore(visiblePrev, l), phoneAlign,
1682
1846
  };
1683
- return composeLayer(l, lc, ctx);
1847
+ const node = composeLayer(l, lc, ctx);
1848
+ if (lc.contentSized) contentSized.push(l);
1849
+ return node;
1684
1850
  });
1851
+ // iox-ui#207: a section holding a list grid is as tall as what it holds (a held stage is one screen — never).
1852
+ const rowsByContent = held ? null : sectionRows(s.rows, s.screens, contentSizedBand(contentSized));
1853
+ const sized = rowsByContent ? { height: 'auto' } : {};
1854
+ // iox-ui#220: an inhale's words stand in the middle of its screens (a held inhale is a stage — never).
1855
+ const breath = held || rowsByContent || s.kind !== LayoutSectionKind.Inhale ? null
1856
+ : inhaleRows(s.rows, s.screens, contentSizedBand(s.layers.filter(l => Array.isArray(l.row))));
1857
+ const rowsOf = rowsByContent ?? breath ?? s.rows;
1858
+ const centred = breath ? { alignContent: INHALE_ALIGN } : {};
1685
1859
 
1686
1860
  const root = create(id, T.Section, {}, NO_ELEMENT_STYLE);
1687
1861
  root.label = s.id;
@@ -1696,11 +1870,11 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
1696
1870
 
1697
1871
  if (!held && transition) {
1698
1872
  // The previous ground behind; the section's own ground and layers in its body, opened together.
1699
- setStyleProps(root, { ...base, backgroundColor: transition.under, display: 'block', padding: ZERO, overflow: 'clip' });
1873
+ setStyleProps(root, { ...base, ...sized, backgroundColor: transition.under, display: 'block', padding: ZERO, overflow: 'clip' });
1700
1874
  phone(root, { height: 'auto', backgroundColor: veilPaint(ground) });
1701
1875
  const body = create(`${id}-body`, T.Container, {}, NO_ELEMENT_STYLE);
1702
1876
  body.label = `${s.id} · ${s.transition}`;
1703
- setStyleProps(body, { position: 'relative', width: FULL, height: FULL, minHeight: ZERO, backgroundColor: veilPaint(ground), ...gridLayout(s.rows, 1) });
1877
+ setStyleProps(body, { position: 'relative', width: FULL, height: FULL, minHeight: ZERO, backgroundColor: veilPaint(ground), ...gridLayout(rowsOf, 1), ...centred });
1704
1878
  phone(body, phoneStack(si === 0));
1705
1879
  body.interactions = [transition.clip];
1706
1880
  body.children = layers;
@@ -1708,7 +1882,7 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
1708
1882
  return root;
1709
1883
  }
1710
1884
  if (!held) {
1711
- setStyleProps(root, { ...base, ...gridLayout(s.rows, 1), overflow: 'clip' });
1885
+ setStyleProps(root, { ...base, ...sized, ...gridLayout(rowsOf, 1), ...centred, overflow: 'clip' });
1712
1886
  phone(root, phoneStack(si === 0));
1713
1887
  root.children = [...behind, ...layers];
1714
1888
  return root;
@@ -14,6 +14,9 @@ import { CRITIC_DESIGN_DIMENSIONS, CRITIC_DIMENSIONS, CriticAnswer, criticAnswer
14
14
  export const CALIBRATION_MAX_ERROR = 0.5;
15
15
  /** AD-D3: how close the cheaper critic must stay to the dearer one for a round to switch to it. */
16
16
  export const CRITIC_SWITCH_WITHIN = 0.3;
17
+ /** R-H22 (AD-D28): on the mean over the copy/distinct pairs, the copy may score at most this much above the distinct pages —
18
+ * one half point on one dimension moves a design mean by 0.07, so a strict ≤ failed on a tie the tester scored alike. */
19
+ export const R_H22_TOLERANCE = 0.25;
17
20
 
18
21
  export enum CalibrationKind {
19
22
  /** A page of the designer-loop proof (law, hotel). */
@@ -81,14 +84,25 @@ export interface LikenessProbe {
81
84
  distinct: string;
82
85
  }
83
86
 
87
+ /** R-H22 for one model: each pair's design means, their means, and the verdict (AD-D28). */
88
+ export interface LikenessVerdict {
89
+ model: string;
90
+ pairs: Array<LikenessProbe & { copyMean: number | null; distinctMean: number | null }>;
91
+ copyMean: number | null;
92
+ distinctMean: number | null;
93
+ passes: boolean;
94
+ }
95
+
84
96
  export interface CalibrationReport {
85
97
  models: ModelCalibration[];
86
98
  /** AD-D3: the cheaper critic against the dearer, page by page (absent unless both were asked). */
87
99
  agreement?: { dearer: string; cheaper: string; meanDifference: number | null; within: boolean };
88
- /** R-H22, per model: the copy's design mean no higher than the distinct page's. The design mean, not the headline: a
89
- * broken bug caps a headline at 5 whatever the page resembles, so a capped distinct page would fail the probe on
90
- * polish, not on likeness (AD3 calibration: every R-H22 failure was law-services' 5.0 cap). */
91
- likeness: Array<{ model: string; copy: string; distinct: string; copyMean: number | null; distinctMean: number | null; passes: boolean }>;
100
+ /** R-H22, per model (AD-D28): over every copy/distinct pair, the copies' mean design mean at most `R_H22_TOLERANCE`
101
+ * above the distinct pages' — every pair answered, else it fails. The design mean, not the headline: a broken bug caps
102
+ * a headline at 5 whatever the page resembles, so a capped distinct page would fail the probe on polish, not on
103
+ * likeness (AD3 calibration: every R-H22 failure was law-services' 5.0 cap). The calibration set gains a pair each
104
+ * time AD4 produces a copy. */
105
+ likeness: LikenessVerdict[];
92
106
  }
93
107
 
94
108
  export interface CalibrationOptions {
@@ -168,11 +182,14 @@ export function calibrationReport(pages: ReadonlyArray<CalibrationPage>, answers
168
182
  const meanDifference = both.length === pages.length ? mean(both) : null;
169
183
  agreement = { ...options.compare, meanDifference, within: meanDifference !== null && meanDifference <= CRITIC_SWITCH_WITHIN };
170
184
  }
171
- const likeness = models.flatMap(m => (options.likenessProbes ?? []).map(probe => {
185
+ const probes = options.likenessProbes ?? [];
186
+ const likeness: LikenessVerdict[] = probes.length ? models.map(m => {
172
187
  const designMean = (id: string) => m.rows.find(r => r.pageId === id)?.criticMean ?? null;
173
- const copyMean = designMean(probe.copy);
174
- const distinctMean = designMean(probe.distinct);
175
- return { model: m.model, ...probe, copyMean, distinctMean, passes: copyMean !== null && distinctMean !== null && copyMean <= distinctMean };
176
- }));
188
+ const pairs = probes.map(probe => ({ ...probe, copyMean: designMean(probe.copy), distinctMean: designMean(probe.distinct) }));
189
+ const answered = pairs.every(p => p.copyMean !== null && p.distinctMean !== null);
190
+ const copyMean = answered ? mean(pairs.map(p => p.copyMean!)) : null;
191
+ const distinctMean = answered ? mean(pairs.map(p => p.distinctMean!)) : null;
192
+ return { model: m.model, pairs, copyMean, distinctMean, passes: copyMean !== null && distinctMean !== null && copyMean <= distinctMean + R_H22_TOLERANCE };
193
+ }) : [];
177
194
  return { models, agreement, likeness };
178
195
  }