@vectoriox/iox-ui 5.205.0 → 5.206.0

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 (48) 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 +1159 -172
  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 +411 -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 +172 -22
  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/nav-shape.ts +67 -8
  37. package/src/generation-core/opening-mix.ts +61 -17
  38. package/src/generation-core/public-api.ts +2 -0
  39. package/src/generation-core/social-links.ts +47 -8
  40. package/src/generation-core/stock-photos.ts +149 -14
  41. package/src/generation-core/stock-search.ts +108 -19
  42. package/src/generation-core/stock-subjects.ts +204 -0
  43. package/src/harness-core/business-types.ts +3 -0
  44. package/src/harness-core/harness-spec.generated.ts +54 -15
  45. package/src/harness-core/intake.ts +18 -5
  46. package/src/scene-core/scene.ts +34 -3
  47. package/styles/iox-design.css +41 -2
  48. 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';
@@ -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,110 @@ 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
+ const AUTO_ROW = 'auto';
446
+ /** A row's planned share of the section's screens. */
447
+ const plannedRow = (screens: number, rows: number): string => `calc(${screens * 100}svh / ${rows})`;
448
+
449
+ /** Tracks as a `grid-template-rows` value, a run of equal tracks as one `repeat()`. */
450
+ function joinTracks(tracks: ReadonlyArray<string>): string {
451
+ const runs: Array<{ track: string; n: number }> = [];
452
+ for (const track of tracks) {
453
+ const last = runs[runs.length - 1];
454
+ if (last?.track === track) last.n++;
455
+ else runs.push({ track, n: 1 });
456
+ }
457
+ return runs.map(({ track, n }) => (n === 1 ? track : `repeat(${n}, ${track})`)).join(' ');
458
+ }
459
+
460
+ /** A `grid-template-rows` value as one track per row (`repeat(n, x)` expanded); null when it is not a list of tracks
461
+ * this composer writes (`none`, a named area, a nested repeat). */
462
+ function splitTracks(value: string): string[] | null {
463
+ const tokens: string[] = [];
464
+ let depth = 0, buf = '';
465
+ for (const ch of value.trim()) {
466
+ if (ch === '(') depth++;
467
+ if (ch === ')') depth--;
468
+ if (/\s/.test(ch) && depth === 0) { if (buf) tokens.push(buf); buf = ''; continue; }
469
+ buf += ch;
470
+ }
471
+ if (buf) tokens.push(buf);
472
+ const out: string[] = [];
473
+ for (const t of tokens) {
474
+ const rep = /^repeat\(\s*(\d+)\s*,\s*(.+)\)$/.exec(t);
475
+ if (rep) { if (rep[2].includes('repeat(')) return null; for (let i = 0; i < Number(rep[1]); i++) out.push(rep[2].trim()); }
476
+ else if (t === 'none' || t.startsWith('[')) return null;
477
+ else out.push(t);
478
+ }
479
+ return out.length ? out : null;
480
+ }
481
+
482
+ const GRID_ROW = /^\s*(\d+)\s*\/\s*(\d+)\s*$/;
483
+ const SCREENS_HEIGHT = /^(\d+(?:\.\d+)?)svh$/;
484
+
485
+ /**
486
+ * iox-ui#216: the section a recomposed list frame stands in, sized for it — the half of `composeListFrame` that is not the
487
+ * 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`
488
+ * and the section `height: auto`, exactly as `composeLayout` lays a section composed with that grid (`sectionRows`); every
489
+ * other row keeps its planned share of the section's screens (an equal `1fr` row becomes `calc(<screens>svh / rows)`).
490
+ * `section` is the laid section (its grid is itself or its transition body); `frameId` the frame's id. A frame that is
491
+ * not content-sized, not in a grid cell, or a grid this composer did not write → the section unchanged. Pure.
492
+ */
493
+ export function listSectionRows(section: SerializedNode, frameId: string, contentSized: boolean): SerializedNode {
494
+ if (!contentSized) return section;
495
+ const out = structuredClone(section);
496
+ const grid = [out, ...(out.children ?? [])].find(n => (n.children ?? []).some(c => c.id === frameId));
497
+ const frame = grid?.children?.find(c => c.id === frameId);
498
+ const cell = GRID_ROW.exec(String(frame?.styleProps?.['gridRow'] ?? ''));
499
+ const tracks = splitTracks(String(grid?.styleProps?.['gridTemplateRows'] ?? ''));
500
+ if (!grid || !frame || !cell || !tracks) return section;
501
+ const screens = SCREENS_HEIGHT.exec(String(out.styleProps?.['height'] ?? ''));
502
+ const share = screens ? plannedRow(Number(screens[1]) / 100, tracks.length) : null;
503
+ const [from, to] = [Number(cell[1]), Number(cell[2])];
504
+ const sized = tracks.map((t, i) => (i + 1 >= from && i + 1 < to ? AUTO_ROW : t === EQUAL_ROW && share ? share : t));
505
+ if (sized.some(t => t === EQUAL_ROW)) return section; // a 1fr row of a section with no screens to share: leave it
506
+ setStyleProps(grid, { gridTemplateRows: joinTracks(sized) });
507
+ setStyleProps(out, { height: 'auto' });
508
+ setStyleProps(frame, { alignSelf: CONTENT_SIZED_ALIGN });
509
+ return out;
510
+ }
511
+
512
+
421
513
  /** The same grid on a phone: one column, in the section's `phone` order, with the M1.3 padding. */
422
514
  function phoneStack(first: boolean): Record<string, string> {
423
515
  return {
@@ -639,15 +731,23 @@ interface LayerCtx {
639
731
  phoneAlign: string;
640
732
  /** A drawer's word: it arrives as its step lands (`drawerArrival`), never by the layout's own entrance. */
641
733
  arrivesOnLanding?: boolean;
734
+ /** The layer stands in normal flow (a free section's slot), not in a grid cell that gives it a height: what would
735
+ * 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). */
736
+ flow?: boolean;
737
+ /** Set by the list composer: the layer is a list laid as a Repeater (a grid, a wall, a round-two arrangement) — as
738
+ * tall as its DATA, so its rows are sized by it (iox-ui#207, `sectionRows`). */
739
+ contentSized?: boolean;
642
740
  }
643
741
 
644
742
  /** 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
743
  function place(node: SerializedNode, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): void {
646
- const stretch = STRETCH_KINDS.has(l.kind);
744
+ // 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
745
+ // recompose reads as "in flow" (`listFrameInFlow`), so a grid re-mixed to a row keeps its height in the auto rows.
746
+ const stretch = STRETCH_KINDS.has(l.kind) && !lc.contentSized;
647
747
  const values: Record<string, unknown> = {
648
748
  gridColumn: gridColumnOf(l),
649
749
  gridRow: `${l.row[0]} / ${l.row[1]}`,
650
- alignSelf: stretch ? 'stretch' : 'center',
750
+ alignSelf: lc.contentSized ? CONTENT_SIZED_ALIGN : stretch ? 'stretch' : 'center',
651
751
  zIndex: String(1 + (l.z ?? 0)),
652
752
  position: 'relative',
653
753
  minWidth: ZERO,
@@ -1062,6 +1162,10 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1062
1162
  }
1063
1163
  const masonry = arrange === LayoutListArrange.Masonry || arrange === LayoutListArrange.Hang;
1064
1164
  const item = listItem(`${id}-item`, mix, source, list, masonry, lc.path, ctx, strips);
1165
+ // 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
1166
+ // DATA — the section sizes the rows it stands in by it. A slider or a deck fills the cell it is given.
1167
+ const slides = arrange === LayoutListArrange.Row || deck || (arrange === LayoutListArrange.Fan && mix.move.includes(LayoutListMove.Drag));
1168
+ if (!slides) lc.contentSized = true;
1065
1169
  if (strips) return composeStrips(id, frame, item, mix, source, ctx, listItemRadius(mix));
1066
1170
  // AW11-D16: drifting picture rows — the Marquee holding the list's pictures, twice.
1067
1171
  if (mix.move.includes(LayoutListMove.Rows) && arrange === LayoutListArrange.Row && !lc.held) return composeDriftRows(id, frame, item, source, l);
@@ -1077,7 +1181,7 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1077
1181
  const shown = standout && !standWait && !deck ? standWrap(`${id}-stand`, item, standout) : item;
1078
1182
 
1079
1183
  const fanDragged = arrange === LayoutListArrange.Fan && mix.move.includes(LayoutListMove.Drag);
1080
- if (arrange === LayoutListArrange.Row || deck || fanDragged) {
1184
+ if (slides) {
1081
1185
  const scrollPlays = mix.move.includes(LayoutListMove.Page) && !lc.held;
1082
1186
  const played = scrollPlays || lc.held;
1083
1187
  const drag = mix.move.includes(LayoutListMove.Drag);
@@ -1096,6 +1200,9 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1096
1200
  setStyleProps(slider, scrollPlays ? { width: FULL, height: FULL, minHeight: ZERO } : deck ? {
1097
1201
  // A deck fills its holder (below); the cards behind show past its edges.
1098
1202
  width: FULL, height: FULL, minHeight: ZERO, display: 'flex', flexDirection: 'column', overflow: 'visible',
1203
+ } : lc.flow ? {
1204
+ // 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.
1205
+ position: 'relative', width: FULL, height: 'auto', minHeight: ZERO, display: 'flex', flexDirection: 'column',
1099
1206
  } : {
1100
1207
  position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: FULL, height: FULL, minHeight: ZERO,
1101
1208
  display: 'flex', flexDirection: 'column',
@@ -1118,7 +1225,7 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1118
1225
  walkSerialized([slider], node => {
1119
1226
  if (node.role === SliderRole.Prev || node.role === SliderRole.Next) node.props[LAYOUT_TOOLTIP_TRAIT] = node.props['ariaLabel'];
1120
1227
  });
1121
- frame.children = [oneWide ? deckHolder(`${id}-deck`, slider) : slider];
1228
+ frame.children = [oneWide ? deckHolder(`${id}-deck`, slider, !!lc.flow) : slider];
1122
1229
  return frame;
1123
1230
  }
1124
1231
 
@@ -1186,6 +1293,9 @@ export interface ListFrameInput {
1186
1293
  readonly was?: LayoutListMix | null;
1187
1294
  /** The id a NEW frame is made under (a free page's slot, FS3); default `list`. A recompose keeps `previous`'s. */
1188
1295
  readonly id?: string;
1296
+ /** The frame stands in normal flow (a free section's slot), not in a layout's grid cell (iox-ui#197). Absent: a NEW
1297
+ * frame is a cell's; a recompose reads it from `previous` (`listFrameInFlow`). */
1298
+ readonly flow?: boolean;
1189
1299
  }
1190
1300
 
1191
1301
  /** A recomposed list frame, and what the composer said while composing it (a word drawn as its stand-in…). */
@@ -1195,6 +1305,9 @@ export interface ListFrame {
1195
1305
  /** vectoriox/iox-ui#122 (BL-D8): every part of the card the owner changed — kept on the new card, or redrawn (said
1196
1306
  * before Apply). Empty with no frame on the page. */
1197
1307
  readonly edits: ReadonlyArray<ListPartEdit>;
1308
+ /** iox-ui#216: the new arrangement is as tall as its data (a Repeater: a grid, a wall, strips…) — the section it stands
1309
+ * in must size the rows it stands in by it (`listSectionRows`; `composeListInSection` does both). */
1310
+ readonly contentSized: boolean;
1198
1311
  }
1199
1312
 
1200
1313
  /** The frame styles the list composer owns (laptop and phone) beyond a new Container's own: a recompose replaces them
@@ -1211,17 +1324,33 @@ const LIST_FRAME_PROPS: ReadonlyArray<string> = [LIST_MIX_PROP, 'colorScheme'];
1211
1324
  * arrangement, role, room and classes. Pure.
1212
1325
  */
1213
1326
  export function composeListFrame(input: ListFrameInput, previous?: SerializedNode | null): ListFrame {
1327
+ if (input.flow === undefined && previous) input = { ...input, flow: listFrameInFlow(previous) };
1214
1328
  const composed = composeListOnly(input, previous?.id ?? input.id ?? 'list');
1215
- if (!previous) return { frame: composed.frame, gaps: composed.gaps, edits: [] };
1329
+ if (!previous) return { frame: composed.frame, gaps: composed.gaps, edits: [], contentSized: composed.contentSized };
1216
1330
  // What the composer draws for the mix the frame wears now: anything else on the page is the owner's (#122).
1217
1331
  const was = input.was ?? listMixOfFrame(previous, input.list);
1218
1332
  const baseline = was ? composeListOnly({ ...input, mix: was }, previous.id).frame : null;
1219
1333
  const kept = keepListParts(previous, baseline, composed.frame);
1220
- return { frame: keepPlace(previous, { ...composed.frame, children: kept.children }), gaps: composed.gaps, edits: kept.edits };
1334
+ return { frame: keepPlace(previous, { ...composed.frame, children: kept.children }), gaps: composed.gaps, edits: kept.edits, contentSized: composed.contentSized };
1335
+ }
1336
+
1337
+ /**
1338
+ * iox-ui#216: recompose the list frame `frameId` INSIDE its laid section — the frame (`composeListFrame`) and the section's
1339
+ * rows for it (`listSectionRows`), the one call a re-mix applies, so a row slider re-mixed to a grid gets the rows a
1340
+ * section composed with that grid has. `list` is null (and the section unchanged) when the section holds no such frame.
1341
+ */
1342
+ export function composeListInSection(section: SerializedNode, frameId: string, input: ListFrameInput): { section: SerializedNode; list: ListFrame | null } {
1343
+ let previous: SerializedNode | null = null;
1344
+ walkSerialized([section], n => { if (!previous && n.id === frameId) previous = n; });
1345
+ if (!previous) return { section, list: null };
1346
+ const list = composeListFrame(input, previous);
1347
+ const replaced = structuredClone(section);
1348
+ walkSerialized([replaced], n => { if (n.children) n.children = n.children.map(c => (c.id === frameId ? list.frame : c)); });
1349
+ return { section: listSectionRows(replaced, frameId, list.contentSized), list };
1221
1350
  }
1222
1351
 
1223
1352
  /** `composeList` for one frame under an id. */
1224
- function composeListOnly(input: ListFrameInput, id: string): { frame: SerializedNode; gaps: ReadonlyArray<LayoutGap> } {
1353
+ function composeListOnly(input: ListFrameInput, id: string): { frame: SerializedNode; gaps: ReadonlyArray<LayoutGap>; contentSized: boolean } {
1225
1354
  const pace = LAYOUT_PACE[(input.motion?.pace ?? LayoutPace.Normal) as LayoutPace] ?? LAYOUT_PACE[LayoutPace.Normal];
1226
1355
  const site = { locale: input.locale, sections: [], motion: input.motion } as unknown as LayoutSite;
1227
1356
  const ctx = {
@@ -1234,8 +1363,9 @@ function composeListOnly(input: ListFrameInput, id: string): { frame: Serialized
1234
1363
  const col = input.col ?? [1, 13];
1235
1364
  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
1365
  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 };
1366
+ 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;
1367
+ const frame = composeList(id, layer, input.mix, input.source, input.list, lc, ctx);
1368
+ return { frame, gaps: ctx.gaps, contentSized: !!lc.contentSized };
1239
1369
  }
1240
1370
 
1241
1371
  /** 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 +1410,14 @@ function keepPlace(previous: SerializedNode, composed: SerializedNode): Serializ
1280
1410
  return frame;
1281
1411
  }
1282
1412
 
1413
+ /** A list frame on the page stands in flow when no layout placed it in a grid cell (`place` writes its `gridRow`): a free
1414
+ * 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
1415
+ * their top (iox-ui#207, `place`). A Container's own `gridRow` is `auto`. */
1416
+ export function listFrameInFlow(frame: SerializedNode): boolean {
1417
+ const row = frame.styleProps?.['gridRow'];
1418
+ return !row || row === 'auto' || frame.styleProps?.['alignSelf'] === CONTENT_SIZED_ALIGN;
1419
+ }
1420
+
1283
1421
  /** The page that shows one item, as a composed list frame links to it (`linkToDetail`) — so a recompose keeps the link.
1284
1422
  * Undefined when its items link nowhere (or to an address of their own). */
1285
1423
  export function listDetailOf(frame: SerializedNode | null | undefined): LayoutListBinding['detail'] {
@@ -1304,9 +1442,13 @@ function listItemRadius(mix: LayoutListMix): string {
1304
1442
  * scoped `.swiper { width: 100% }` out-ranks a node's width class. On a phone the holder is the cell's width and the
1305
1443
  * shared `.swiper.swiper-cards` rule (iox-design.css) makes the deck a centred card with its neighbours peeking.
1306
1444
  */
1307
- function deckHolder(id: string, slider: SerializedNode): SerializedNode {
1445
+ function deckHolder(id: string, slider: SerializedNode, flow: boolean): SerializedNode {
1308
1446
  const holder = create(id, T.Container, {}, NO_ELEMENT_STYLE);
1309
- setStyleProps(holder, {
1447
+ // 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.
1448
+ setStyleProps(holder, flow ? {
1449
+ position: 'relative', width: LIST_DECK_WIDTH, maxWidth: FULL, height: 'auto', minHeight: ZERO, margin: '0px auto',
1450
+ display: 'flex', flexDirection: 'column',
1451
+ } : {
1310
1452
  position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: LIST_DECK_WIDTH, maxWidth: FULL, height: FULL,
1311
1453
  minHeight: ZERO, margin: '0px auto', display: 'flex', flexDirection: 'column',
1312
1454
  });
@@ -1589,8 +1731,10 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
1589
1731
  if (framed) tracks.push({ ...WINDOW_SINK, keys: WINDOW_SINK.keys.map(([at, v]): [number, number] => [at, v]) });
1590
1732
  if (l.kinetic && textual) tracks.push({ prop: 'words', keys: [[0, 0], [KINETIC_ALL_LIT, 100]] });
1591
1733
  if (tracks.length) {
1592
- outer.sceneTracks = tracks;
1593
- outer.scenePhoneTracks = restingTracks(tracks);
1734
+ // A step's in and out are one timeline (iox-ui#195): stamped as one track, as the editor and both renderers read it.
1735
+ const merged = mergeSceneTracks(tracks);
1736
+ outer.sceneTracks = merged;
1737
+ outer.scenePhoneTracks = restingTracks(merged);
1594
1738
  gap(ctx, LayoutGapCode.PhoneRest, lc.path, 'stands at rest on a phone');
1595
1739
  }
1596
1740
  } else if (l.motion?.length) {
@@ -1672,6 +1816,7 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
1672
1816
  const order = Array.isArray(s.phone) && s.phone.length ? s.phone : s.layers.map((_, i) => i);
1673
1817
  const textKinds = s.layers.filter(x => LAYOUT_TEXT_KINDS.has(x.kind) || x.kind === LayoutLayerKind.Button);
1674
1818
  const phoneAlign = textKinds.length && textKinds.every(x => x.align === 'center') ? 'center' : 'start';
1819
+ const contentSized: LayoutLayer[] = [];
1675
1820
  const layers = s.layers.map((l, li) => {
1676
1821
  const at = order.indexOf(li);
1677
1822
  const prevIdx = at > 0 ? order[at - 1] : -1;
@@ -1680,8 +1825,13 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
1680
1825
  section: s, si, li, path: `sections[${si}].layers[${li}]`, held, track: held ? track : 1,
1681
1826
  order: at < 0 ? s.layers.length + li : at, phoneGap: phoneGapBefore(visiblePrev, l), phoneAlign,
1682
1827
  };
1683
- return composeLayer(l, lc, ctx);
1828
+ const node = composeLayer(l, lc, ctx);
1829
+ if (lc.contentSized) contentSized.push(l);
1830
+ return node;
1684
1831
  });
1832
+ // iox-ui#207: a section holding a list grid is as tall as what it holds (a held stage is one screen — never).
1833
+ const rowsByContent = held ? null : sectionRows(s.rows, s.screens, contentSizedBand(contentSized));
1834
+ const sized = rowsByContent ? { height: 'auto' } : {};
1685
1835
 
1686
1836
  const root = create(id, T.Section, {}, NO_ELEMENT_STYLE);
1687
1837
  root.label = s.id;
@@ -1696,11 +1846,11 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
1696
1846
 
1697
1847
  if (!held && transition) {
1698
1848
  // 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' });
1849
+ setStyleProps(root, { ...base, ...sized, backgroundColor: transition.under, display: 'block', padding: ZERO, overflow: 'clip' });
1700
1850
  phone(root, { height: 'auto', backgroundColor: veilPaint(ground) });
1701
1851
  const body = create(`${id}-body`, T.Container, {}, NO_ELEMENT_STYLE);
1702
1852
  body.label = `${s.id} · ${s.transition}`;
1703
- setStyleProps(body, { position: 'relative', width: FULL, height: FULL, minHeight: ZERO, backgroundColor: veilPaint(ground), ...gridLayout(s.rows, 1) });
1853
+ setStyleProps(body, { position: 'relative', width: FULL, height: FULL, minHeight: ZERO, backgroundColor: veilPaint(ground), ...gridLayout(rowsByContent ?? s.rows, 1) });
1704
1854
  phone(body, phoneStack(si === 0));
1705
1855
  body.interactions = [transition.clip];
1706
1856
  body.children = layers;
@@ -1708,7 +1858,7 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
1708
1858
  return root;
1709
1859
  }
1710
1860
  if (!held) {
1711
- setStyleProps(root, { ...base, ...gridLayout(s.rows, 1), overflow: 'clip' });
1861
+ setStyleProps(root, { ...base, ...sized, ...gridLayout(rowsByContent ?? s.rows, 1), overflow: 'clip' });
1712
1862
  phone(root, phoneStack(si === 0));
1713
1863
  root.children = [...behind, ...layers];
1714
1864
  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
  }