@vectoriox/iox-ui 5.144.0 → 5.146.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 (39) hide show
  1. package/composite-core/index.d.ts +10 -1
  2. package/design-core/index.d.ts +386 -44
  3. package/fesm2022/vectoriox-iox-ui-assist-core.mjs +2 -1
  4. package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +9 -6
  6. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-design-core.mjs +523 -80
  8. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +158 -28
  10. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +108 -0
  12. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  13. package/fesm2022/vectoriox-iox-ui.mjs +33 -11
  14. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  15. package/generation-core/index.d.ts +85 -7
  16. package/harness-core/index.d.ts +91 -1
  17. package/index.d.ts +11 -4
  18. package/package.json +1 -1
  19. package/src/assist-core/site-look.ts +2 -1
  20. package/src/composite-core/shop.ts +1 -1
  21. package/src/composite-core/slider.ts +7 -4
  22. package/src/design-core/design-apply.ts +19 -2
  23. package/src/design-core/design-settings.ts +18 -7
  24. package/src/design-core/design-token.model.ts +11 -0
  25. package/src/design-core/flavor-spec.generated.ts +303 -25
  26. package/src/design-core/flavor-tokens.ts +7 -1
  27. package/src/design-core/list-classes.ts +14 -3
  28. package/src/design-core/locale-direction.ts +28 -0
  29. package/src/design-core/node-classes.ts +66 -1
  30. package/src/design-core/section-edge.ts +17 -19
  31. package/src/design-core/token-css.ts +48 -3
  32. package/src/generation-core/adjustments.ts +7 -3
  33. package/src/generation-core/compose-layout.ts +116 -3
  34. package/src/generation-core/compose-site.ts +50 -20
  35. package/src/generation-core/site-spec.generated.ts +26 -0
  36. package/src/generation-core/validate-site-plan.ts +1 -0
  37. package/src/harness-core/harness-spec.generated.ts +108 -0
  38. package/src/harness-core/starting-design.ts +1 -1
  39. package/styles/iox-design.css +38 -8
@@ -1,5 +1,5 @@
1
1
  import { ELEMENT_STYLE_MARKER_CLASS, elementStyleClass } from './element-styles';
2
- import { SPEC_SCHEME_INK, SPEC_SCHEMES } from './flavor-spec.generated';
2
+ import { SPEC_AXES, SPEC_SCHEME_INK, SPEC_SCHEMES } from './flavor-spec.generated';
3
3
  import { isListMixClass, listMixClasses } from './list-classes';
4
4
  import { isSectionDesignClass, sectionDesignClasses } from './section-edge';
5
5
 
@@ -78,6 +78,71 @@ export function openingFollowerSelector(id: string, scope?: string): string {
78
78
  return `${scope ? `${scope} ` : ''}[${OPENING_ATTRIBUTE}="${id}"] .${roleClass(OPENING_FOLLOWER_ROLE)}:not([class*="${SCHEME_PREFIX}"])`;
79
79
  }
80
80
 
81
+ /**
82
+ * The page's CONTENT COLUMN (award plan §0c, AW-D33…AW-D41): every section, the header and the footer inset their words
83
+ * by `space-inline`, which reads `content-width`. A page stores its own word (`pageSettings.column`, CW2 — absent = the
84
+ * site's); the renderer puts the word in force on the element around the page AND its globals (the engine's `<body>`, in
85
+ * the RAW SSR — T-CW5; the canvas's token scopes) as `data-iox-column`, and `compileTokenCss` re-declares `content-width`
86
+ * (and every token reading it) there per word. Never `pageSettings.style.maxWidth` (an author's px, not a look's word).
87
+ */
88
+ export const COLUMN_ATTRIBUTE = 'data-iox-column';
89
+ /** The `pageSettings` key a page's own column word is stored under. */
90
+ export const COLUMN_SETTING = 'column';
91
+ /** The token a column word sets — the column in force, read by `space-inline`. */
92
+ export const CONTENT_WIDTH_TOKEN = 'content-width';
93
+ /** What `content-width` holds for Wide: the whole page, so the inset is the one gutter (`space-edge`). */
94
+ export const WIDE_CONTENT_WIDTH = '100%';
95
+
96
+ type ColumnWord = keyof typeof SPEC_AXES.columns;
97
+ const COLUMN_WORDS = SPEC_AXES.columns as Readonly<Record<string, { readonly column: string | null }>>;
98
+
99
+ /** A known column word, else null — an unknown value never reaches an attribute. */
100
+ export function columnWordOf(value: unknown): ColumnWord | null {
101
+ return typeof value === 'string' && Object.prototype.hasOwnProperty.call(COLUMN_WORDS, value) ? value as ColumnWord : null;
102
+ }
103
+
104
+ /**
105
+ * The literal `content-width` holds for a column word, read from the rows that hold the density's columns
106
+ * (`column-contained` / `column-narrow`) — a literal, never a `var()` chain (DS1.1); Wide is `100%`. Null for an
107
+ * unknown word or a column row the set lacks. `buildFlavorTokens` and the per-word blocks of `compileTokenCss` use it.
108
+ */
109
+ export function contentWidthOf(column: unknown, rowValue: (name: string) => string | undefined): string | null {
110
+ const word = columnWordOf(column);
111
+ if (!word) return null;
112
+ const row = COLUMN_WORDS[word].column;
113
+ return row ? rowValue(row) ?? null : WIDE_CONTENT_WIDTH;
114
+ }
115
+
116
+ /** The selector a column word's block is declared on, inside `scope` (the builder's token scope — the attribute sits on
117
+ * the scope element itself) or anywhere (the engine's `<body>`). */
118
+ export function columnSelector(word: string, scope?: string): string {
119
+ const attr = `[${COLUMN_ATTRIBUTE}="${word}"]`;
120
+ return scope ? `${scope}${attr}, ${scope} ${attr}` : attr;
121
+ }
122
+
123
+ /**
124
+ * The SITE's column word, read from the token rows the renderer already holds: the word whose literal `content-width`
125
+ * holds (`100%` = wide, else the `column-*` row it equals). Null when the rows hold no `content-width` (a studio not yet
126
+ * topped up) or a width the author typed — then no word is claimed and `content-width` stays as declared.
127
+ */
128
+ export function siteColumnOf(tokens: ReadonlyArray<{ name?: string; value?: unknown }> | null | undefined): ColumnWord | null {
129
+ const value = (name: string) => {
130
+ const row = (tokens ?? []).find(t => t?.name === name);
131
+ return typeof row?.value === 'string' ? row.value.trim() : undefined;
132
+ };
133
+ const width = value(CONTENT_WIDTH_TOKEN);
134
+ if (!width) return null;
135
+ return (Object.keys(COLUMN_WORDS) as ColumnWord[]).find(word => contentWidthOf(word, value) === width) ?? null;
136
+ }
137
+
138
+ /** The column word in force on a page: its own (`pageSettings.column`), else the site's (from its token rows), else null. */
139
+ export function pageColumn(
140
+ pageSettings: Readonly<Record<string, unknown>> | null | undefined,
141
+ tokens?: ReadonlyArray<{ name?: string; value?: unknown }> | null,
142
+ ): ColumnWord | null {
143
+ return columnWordOf(pageSettings?.[COLUMN_SETTING]) ?? siteColumnOf(tokens);
144
+ }
145
+
81
146
  /** `iox-role-<role>` for a well-formed composite role, else null. */
82
147
  export function roleClass(role: unknown): string | null {
83
148
  return typeof role === 'string' && ROLE_SHAPE.test(role) ? `${ROLE_PREFIX}${role.replace(/\./g, '-')}` : null;
@@ -1,4 +1,5 @@
1
1
  import { colorSchemeClass } from './node-classes';
2
+ import { nodeIsRtl } from './locale-direction';
2
3
 
3
4
  /**
4
5
  * A section's EDGE into the section above it, and its SHAPE (award-ingredients plan §7.1d, AW6 — board award-body,
@@ -98,22 +99,9 @@ export function sectionEdgeClass(edge: unknown): string | null {
98
99
  return typeof edge === 'string' && edge !== SectionEdge.Straight && EDGE_IDS.has(edge) ? `${SEAM_CLASS_PREFIX}${edge}` : null;
99
100
  }
100
101
 
101
- const RTL = 'rtl';
102
- /** The Text Direction trait and where it used to live (style-compiler `TEXT_DIRECTION_KEY` / `LEGACY_DIRECTION_KEY`). */
103
- const DIRECTION_KEYS = ['textDirection', 'direction'];
104
-
105
- /** True when the section's OWN Text Direction is right-to-left (a saved node's styleProps, a builder node's style
106
- * traits). A section with no direction of its own reads left-to-right. */
102
+ /** True when the section's OWN Text Direction is right-to-left — `nodeIsRtl`, the one answer (locale-direction). */
107
103
  export function sectionIsRtl(node: SectionEdgeSource | null | undefined): boolean {
108
- if (!node) return false;
109
- for (const key of DIRECTION_KEYS) {
110
- if (node.styleProps && key in node.styleProps) return node.styleProps[key] === RTL;
111
- }
112
- for (const group of node.styleTraits ?? []) {
113
- const t = group?.traits?.find(x => x?.name === DIRECTION_KEYS[0]);
114
- if (t) return t.default === RTL;
115
- }
116
- return false;
104
+ return nodeIsRtl(node);
117
105
  }
118
106
 
119
107
  /**
@@ -157,12 +145,22 @@ export function setSectionEdge(node: WritableNode | null | undefined, edge: stri
157
145
  return writeTrait(node, SECTION_EDGE_TRAIT, edge);
158
146
  }
159
147
 
160
- /** The style props a card shape writes (the look's gutter either side, the card's radius — token references, so a
161
- * re-theme reaches it), and what Full width puts back. */
148
+ /**
149
+ * The style props a card shape writes (the page's inset either side, the card's radius — token references, so a
150
+ * re-theme reaches it), and what Full width puts back. The inset is `space-inline` (award §0c.8, AW-D41): the card's
151
+ * ground IS the content column — its edges on the header's words at every width, the one gutter in Wide — and its words
152
+ * pad inside it by `section-pad`, whose `%` is then the card's own width. The margin's `%` resolves against the page.
153
+ */
162
154
  export const SECTION_CARD_STYLES: Readonly<Record<string, string>> = {
163
- margin: '0px var(--iox-space-gutter) 0px var(--iox-space-gutter)',
155
+ margin: '0px var(--iox-space-inline) 0px var(--iox-space-inline)',
164
156
  borderRadius: 'var(--iox-card-radius)',
165
157
  };
158
+ /** What a card shape wrote before the content column (AW6 → CW1): a card saved then still reads as the card's own
159
+ * margin, so Full width takes it back like today's. */
160
+ export const SECTION_CARD_SUPERSEDED: Readonly<Record<string, ReadonlyArray<string>>> = {
161
+ margin: ['0px var(--iox-space-gutter) 0px var(--iox-space-gutter)'],
162
+ };
163
+ const isCardValue = (k: string, v: unknown) => v === SECTION_CARD_STYLES[k] || (SECTION_CARD_SUPERSEDED[k] ?? []).includes(v as string);
166
164
  export const SECTION_FULL_STYLES: Readonly<Record<string, string>> = {
167
165
  margin: '0px 0px 0px 0px',
168
166
  borderRadius: '0px',
@@ -179,7 +177,7 @@ export function planSectionShape(shape: string, current: Readonly<Record<string,
179
177
  if (shape === SectionShape.Card) {
180
178
  for (const [k, v] of Object.entries(SECTION_CARD_STYLES)) if (current[k] !== v) styles[k] = v;
181
179
  } else {
182
- for (const [k, v] of Object.entries(SECTION_FULL_STYLES)) if (current[k] === SECTION_CARD_STYLES[k]) styles[k] = v;
180
+ for (const [k, v] of Object.entries(SECTION_FULL_STYLES)) if (isCardValue(k, current[k])) styles[k] = v;
183
181
  }
184
182
  return { shape: shape as SectionShape, styles };
185
183
  }
@@ -1,6 +1,6 @@
1
1
  import { DesignMode } from './design-token.model';
2
- import { SPEC_A11Y, SPEC_SCHEMES } from './flavor-spec.generated';
3
- import { openingFollowerSelector, SCHEME_INK } from './node-classes';
2
+ import { SPEC_A11Y, SPEC_AXES, SPEC_SCHEMES } from './flavor-spec.generated';
3
+ import { columnSelector, CONTENT_WIDTH_TOKEN, contentWidthOf, openingFollowerSelector, SCHEME_INK } from './node-classes';
4
4
  import { specTokenNames } from './token-names';
5
5
 
6
6
  /**
@@ -13,6 +13,7 @@ import { specTokenNames } from './token-names';
13
13
  * 1. base `:root { --iox-*: … }`
14
14
  * 2. schemes `.iox-scheme-<id> { overrides; every var()-referencing token re-declared }`, then the
15
15
  * ONE scheme-ink rule `.iox-scheme-subtle, … { color: var(--iox-text) }` (iox-ui#15)
16
+ * columns `[data-iox-column="<word>"] { --iox-content-width: <literal>; every token reading it }` (award §0c)
16
17
  * 3. reduced motion `@media (prefers-reduced-motion: reduce)`
17
18
  * 4. reduced transparency `@media (prefers-reduced-transparency: reduce)`
18
19
  * 5. dark — LAST `@media (prefers-color-scheme: dark)`
@@ -317,6 +318,48 @@ function presentOverrides(rows: ReadonlyArray<DesignTokenLike>, overrides: Reado
317
318
  return Object.entries(overrides).filter(([name]) => rows.some(t => t.name === name && (!onlyWithDark || darkOf(t) !== null)));
318
319
  }
319
320
 
321
+ /** The names a value reads through `var(--iox-…)`. */
322
+ const referencedNames = (value: string | null): string[] => [...(value ?? '').matchAll(TOKEN_REF)].map(m => m[1]);
323
+
324
+ /** The rows whose value (light or dark) reads `content-width`, directly or through another token — `space-inline`,
325
+ * `section-pad`, `nav-pad`… — in row order. */
326
+ function columnDependents(rows: ReadonlyArray<DesignTokenLike>): DesignTokenLike[] {
327
+ const reads = new Map(rows.map(t => [t.name, [...referencedNames(t.value), ...referencedNames(darkOf(t))]]));
328
+ const dependent = new Set<string>([CONTENT_WIDTH_TOKEN]);
329
+ for (let grew = true; grew;) {
330
+ grew = false;
331
+ for (const [name, names] of reads) {
332
+ if (!dependent.has(name) && names.some(n => dependent.has(n))) { dependent.add(name); grew = true; }
333
+ }
334
+ }
335
+ return rows.filter(t => t.name !== CONTENT_WIDTH_TOKEN && dependent.has(t.name));
336
+ }
337
+
338
+ /**
339
+ * The content column's words (award plan §0c, AW-D33/AW-D36): one block per word on the element carrying
340
+ * `data-iox-column` — the engine's `<body>`, the canvas's token scopes — that re-declares `content-width` as the word's
341
+ * literal at the studio's density (read from its own `column-*` rows) and every token that reads it, re-declared
342
+ * verbatim. ⚠️ A custom property resolves where it is DECLARED (the §3c rule schemes follow): `space-inline` declared
343
+ * on the root keeps the root's `content-width`, so a page's word would change nothing without the re-declaration. Rows
344
+ * with no `content-width` (a studio not yet topped up) emit nothing — their CSS is exactly as before.
345
+ */
346
+ function columnCss(rows: ReadonlyArray<DesignTokenLike>, scope?: string): { base: string; dark: string } {
347
+ if (!rows.some(t => t.name === CONTENT_WIDTH_TOKEN)) return { base: '', dark: '' };
348
+ const value = (name: string) => rows.find(t => t.name === name)?.value;
349
+ const dependents = columnDependents(rows);
350
+ const words = Object.keys(SPEC_AXES.columns)
351
+ .map(word => [word, contentWidthOf(word, value)] as const)
352
+ .filter((w): w is readonly [string, string] => w[1] !== null);
353
+ const darkDependents = dependents.map((t): [string, string | null] => [t.name, darkOf(t)]).filter((e): e is [string, string] => e[1] !== null);
354
+ return {
355
+ base: words.map(([word, width]) => rule(columnSelector(word, scope), [
356
+ [CONTENT_WIDTH_TOKEN, width], ...dependents.map((t): [string, string] => [t.name, t.value]),
357
+ ])).filter(Boolean).join('\n'),
358
+ // A dependent with a dark value would keep its LIGHT value under the word's block in a dark visit.
359
+ dark: darkDependents.length ? words.map(([word]) => rule(columnSelector(word, scope), darkDependents, ' ')).join('\n') : '',
360
+ };
361
+ }
362
+
320
363
  /** The token CSS as the two halves a renderer places around its node rules. */
321
364
  export function compileTokenCssBlocks(
322
365
  tokens: ReadonlyArray<DesignTokenLike> | null | undefined,
@@ -331,9 +374,11 @@ export function compileTokenCssBlocks(
331
374
  const unset: Array<[string, string]> = opts.isolate
332
375
  ? [...specTokenNames()].filter(name => !present.has(name)).map((name): [string, string] => [name, 'initial'])
333
376
  : [];
377
+ const columns = columnCss(rows, opts.scope);
334
378
  const base = [
335
379
  rule(root, [...unset, ...rows.map((t): [string, string] => [t.name, t.value])]),
336
380
  compileSchemeCss(rows, opts.scope, opposite),
381
+ columns.base,
337
382
  ...ACCESSIBILITY_MEDIA.map(({ query, overrides }) =>
338
383
  media(query, [rule(root, presentOverrides(rows, overrides, false), ' ')])),
339
384
  ].filter(Boolean).join('\n');
@@ -341,7 +386,7 @@ export function compileTokenCssBlocks(
341
386
  const darkRows = rows.map((t): [string, string | null] => [t.name, darkOf(t)])
342
387
  .filter((e): e is [string, string] => e[1] !== null);
343
388
  const dark = darkRows.length ? [
344
- media(MEDIA_DARK, [rule(root, darkRows, ' '), ...darkSchemeRules(rows, opts.scope)]),
389
+ media(MEDIA_DARK, [rule(root, darkRows, ' '), ...darkSchemeRules(rows, opts.scope), columns.dark]),
345
390
  // Glass carries dark glass values; without this the dark block (LAST) would out-rank the
346
391
  // reduced-transparency swap and keep dark surfaces translucent.
347
392
  ...ACCESSIBILITY_MEDIA.map(({ query, overrides }) =>
@@ -62,9 +62,13 @@ export const ADJUST_AXIS_LABELS: Readonly<Record<AdjustAxis, string>> = {
62
62
 
63
63
  const SECTION_SPACE = 'var(--iox-space-section)';
64
64
  const BOX_PAD = 'var(--iox-space-pad)';
65
- /** The section style's padding (`--iox-section-pad` = `var(--iox-space-section) var(--iox-space-gutter)`). */
65
+ /** The section style's padding (`--iox-section-pad` = `var(--iox-space-section) var(--iox-space-inline)` since award
66
+ * §0c): a spacing step keeps the sides as the column's inset, never the bare gutter, or "more space" would drop the
67
+ * page's column (T-CW4). */
66
68
  const SECTION_PAD = 'var(--iox-section-pad)';
67
- const SECTION_GUTTER = 'var(--iox-space-gutter)';
69
+ const SECTION_GUTTER = 'var(--iox-space-inline)';
70
+ /** The sides an AI2c step wrote before award §0c (CW1): read as the column's inset, so the next step heals them. */
71
+ const SECTION_GUTTER_BEFORE_CW1 = 'var(--iox-space-gutter)';
68
72
 
69
73
  const scaled = (token: string, by: number) => by === 1 ? token : `calc(${token} * ${by})`;
70
74
 
@@ -120,7 +124,7 @@ function paddingSides(value: unknown): [string, string, string, string] {
120
124
  const raw = typeof value === 'string' ? value.trim() : '';
121
125
  if (!raw) return ['0px', '0px', '0px', '0px'];
122
126
  if (raw === SECTION_PAD) return [SECTION_SPACE, SECTION_GUTTER, SECTION_SPACE, SECTION_GUTTER];
123
- const p = splitCssValue(raw);
127
+ const p = splitCssValue(raw).map(side => side === SECTION_GUTTER_BEFORE_CW1 ? SECTION_GUTTER : side);
124
128
  if (p.length === 1) return [p[0], p[0], p[0], p[0]];
125
129
  if (p.length === 2) return [p[0], p[1], p[0], p[1]];
126
130
  if (p.length === 3) return [p[0], p[1], p[2], p[1]];
@@ -920,6 +920,9 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
920
920
  // AW11: the mix rides on the frame (design-core LIST_MIX_PROP) — the shared CSS draws its item and hover words from
921
921
  // the classes it becomes, and Bindings ▸ List reads it back.
922
922
  frame.props[LIST_MIX_PROP] = listMixWords(mix).join(' ');
923
+ // A Hebrew list reads its own direction (design-core `nodeIsRtl` → `iox-list-mirrored`, AW6's answer): what leans
924
+ // and fans turns the other way (R-H-AW11-8, #116) — `:dir(rtl)` never sees a section's CSS `direction`.
925
+ if (ctx.rtl) setStyleProps(frame, { textDirection: 'rtl' });
923
926
  // AW11 rule 2 (never cut): what leans, hangs or turns keeps its room inside the frame — its section clips.
924
927
  const room = listOverhang(mix);
925
928
  if (room.blockStart || room.blockEnd || room.inline) {
@@ -946,8 +949,14 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
946
949
  if (strips) return composeStrips(id, frame, item, mix, source, ctx, listItemRadius(mix));
947
950
  // AW11-D16: drifting picture rows — the Marquee holding the list's pictures, twice.
948
951
  if (mix.move.includes(LayoutListMove.Rows) && arrange === LayoutListArrange.Row && !lc.held) return composeDriftRows(id, frame, item, source, l);
949
- item.interactions = [...item.interactions, listArriveInteraction(item.id, mix.arrive, ctx)];
950
- if (mix.arrive === LayoutListArrive.ClipUp) riseInside(item, ctx);
952
+ if (arrange === LayoutListArrange.Stage) {
953
+ // A stage's rows and cards draw no box (`display: contents`, iox-design.css): an arrival on them plays nothing,
954
+ // so the stage arrives as one (#116).
955
+ frame.interactions = [...frame.interactions, listArriveInteraction(frame.id, mix.arrive, ctx)];
956
+ } else {
957
+ item.interactions = [...item.interactions, listArriveInteraction(item.id, mix.arrive, ctx)];
958
+ if (mix.arrive === LayoutListArrive.ClipUp) riseInside(item, ctx);
959
+ }
951
960
  // LI4: the one that stands out — a deck's top card IS its standing out; strips draw their own (wider).
952
961
  const shown = standout && !standWait && !deck ? standWrap(`${id}-stand`, item, standout) : item;
953
962
 
@@ -1027,6 +1036,107 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1027
1036
  return frame;
1028
1037
  }
1029
1038
 
1039
+ // ── Bindings ▸ List (AW11 P5): ONE list frame recomposed by the SAME composer ───────────────────────────────────────
1040
+
1041
+ /** What a list frame is recomposed from: its mix, the list it shows, and the place it stands in. */
1042
+ export interface ListFrameInput {
1043
+ /** The mix to compose (Bindings ▸ List's pick, `withListWord`). */
1044
+ readonly mix: LayoutListMix;
1045
+ /** The data source the list repeats. */
1046
+ readonly source: string;
1047
+ /** How its items are read (`listBindingOfType`, the item's own page from `listDetailOf`). */
1048
+ readonly list: LayoutListBinding;
1049
+ /** The page's language — a right-to-left one mirrors what leans and fans. */
1050
+ readonly locale?: string;
1051
+ /** The page's motion (pace, easing) — the arrival's timing. Default: normal, ease-out. */
1052
+ readonly motion?: LayoutSite['motion'];
1053
+ /** The section's ground (a band's colour scheme follows it). */
1054
+ readonly ground?: string;
1055
+ /** The section is held (a Scene, a pinned section): the scroll plays it, nothing drags or turns by itself. */
1056
+ readonly held?: boolean;
1057
+ /** The list's name (a slider's carousel name). */
1058
+ readonly label?: string;
1059
+ /** The cell it stands in, in the section's 12 columns (`[from, to)`); default the whole width. */
1060
+ readonly col?: readonly [number, number];
1061
+ /** Where the gaps are said (`sections[i].layers[j]`). */
1062
+ readonly path?: string;
1063
+ }
1064
+
1065
+ /** A recomposed list frame, and what the composer said while composing it (a word drawn as its stand-in…). */
1066
+ export interface ListFrame {
1067
+ readonly frame: SerializedNode;
1068
+ readonly gaps: ReadonlyArray<LayoutGap>;
1069
+ }
1070
+
1071
+ /** The frame styles the list composer owns (laptop and phone) beyond a new Container's own: a recompose replaces them
1072
+ * and keeps the rest — the frame's place in its section (`place`), its entrance, the author's own. Held to
1073
+ * `composeList` by compose-list-frame.spec. */
1074
+ export const LIST_FRAME_STYLE_KEYS: ReadonlyArray<string> = ['position', 'padding', 'textDirection', 'display', 'flexDirection', 'gap', 'height'];
1075
+ /** The frame props the list composer owns. */
1076
+ const LIST_FRAME_PROPS: ReadonlyArray<string> = [LIST_MIX_PROP, 'colorScheme'];
1077
+
1078
+ /**
1079
+ * Recompose ONE list frame (Bindings ▸ List, AW11 board P5): `composeList` — the very function `composeLayout` stamps a
1080
+ * list with, never a copy — run for one frame. Given the frame on the page (`previous`), the result keeps its id, its
1081
+ * place in the section, its entrance and every style the composer does not own, and takes the new mix's items,
1082
+ * arrangement, role, room and classes. Pure.
1083
+ */
1084
+ export function composeListFrame(input: ListFrameInput, previous?: SerializedNode | null): ListFrame {
1085
+ const id = previous?.id ?? 'list';
1086
+ const pace = LAYOUT_PACE[(input.motion?.pace ?? LayoutPace.Normal) as LayoutPace] ?? LAYOUT_PACE[LayoutPace.Normal];
1087
+ const site = { locale: input.locale, sections: [], motion: input.motion } as unknown as LayoutSite;
1088
+ const ctx = {
1089
+ p: id, site, rtl: layoutRtl(input.locale), mode: LayoutColourMode.Light, pace,
1090
+ ease: LAYOUT_EASING[(input.motion?.ease ?? LayoutEase.Out) as LayoutEase] ?? LAYOUT_EASING[LayoutEase.Out],
1091
+ sections: {}, gaps: [], links: [], headingSeen: false, carry: new Map(), keptArrangement: [],
1092
+ listOf: () => input.list, sourceFields: () => null, photoSrc: () => '', photoAlt: () => '', photoAspect: () => LAYOUT_PHOTO_ASPECT[LayoutPhotoShape.Landscape],
1093
+ } as unknown as Ctx;
1094
+ const col = input.col ?? [1, 13];
1095
+ 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;
1096
+ const path = input.path ?? 'list';
1097
+ 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;
1098
+ const composed = composeList(id, layer, input.mix, input.source, input.list, lc, ctx);
1099
+ return { frame: previous ? keepPlace(previous, composed) : composed, gaps: ctx.gaps };
1100
+ }
1101
+
1102
+ /** The recomposed frame on the previous one's place: what the composer owns is the new composition's (a key it no longer
1103
+ * writes is dropped), everything else — its place, its entrance, the author's own — the previous frame's. */
1104
+ function keepPlace(previous: SerializedNode, composed: SerializedNode): SerializedNode {
1105
+ const frame = structuredClone(previous);
1106
+ const owned = (prev: Readonly<Record<string, unknown>> | undefined, next: Readonly<Record<string, unknown>> | undefined, keys: ReadonlyArray<string>) => ({
1107
+ ...Object.fromEntries(Object.entries(prev ?? {}).filter(([k]) => !keys.includes(k))),
1108
+ ...Object.fromEntries(keys.filter(k => next && k in next).map(k => [k, next![k]])),
1109
+ });
1110
+ frame.role = composed.role;
1111
+ frame.props = owned(frame.props, composed.props, LIST_FRAME_PROPS);
1112
+ frame.styleProps = owned(frame.styleProps, composed.styleProps, LIST_FRAME_STYLE_KEYS);
1113
+ const was = frame.responsive?.[LAYOUT_PHONE_BREAKPOINT];
1114
+ const now = composed.responsive?.[LAYOUT_PHONE_BREAKPOINT];
1115
+ if (was || now) {
1116
+ frame.responsive ??= {};
1117
+ frame.responsive[LAYOUT_PHONE_BREAKPOINT] = { ...(was ?? {}), styleProps: owned(was?.styleProps, now?.styleProps, LIST_FRAME_STYLE_KEYS) };
1118
+ }
1119
+ // The frame's own arrival (a stage's) is the composer's; any other interaction the author's.
1120
+ const arrival = `${previous.id}-enter`;
1121
+ frame.interactions = [...(frame.interactions ?? []).filter(ix => (ix as { id?: unknown })?.id !== arrival), ...(composed.interactions ?? [])];
1122
+ frame.children = composed.children;
1123
+ return frame;
1124
+ }
1125
+
1126
+ /** The page that shows one item, as a composed list frame links to it (`linkToDetail`) — so a recompose keeps the link.
1127
+ * Undefined when its items link nowhere (or to an address of their own). */
1128
+ export function listDetailOf(frame: SerializedNode | null | undefined): LayoutListBinding['detail'] {
1129
+ let found: LayoutListBinding['detail'];
1130
+ if (!frame) return undefined;
1131
+ walkSerialized([frame], node => {
1132
+ if (found) return;
1133
+ const route = node.props?.['pageRoute'];
1134
+ const param = (node.bindings ?? []).find(b => typeof b.prop === 'string' && b.prop.startsWith(ROUTE_PARAM_PROP));
1135
+ if (typeof route === 'string' && route && param) found = { route, param: param.prop.slice(ROUTE_PARAM_PROP.length), field: param.path };
1136
+ });
1137
+ return found;
1138
+ }
1139
+
1030
1140
  /** The corner a list's items wear (LI7). */
1031
1141
  function listItemRadius(mix: LayoutListMix): string {
1032
1142
  return mix.item === LayoutListItem.Card ? LIST_CARD_RADIUS : LIST_PHOTO_RADIUS;
@@ -1644,13 +1754,16 @@ function carriedCell(id: string, node: SerializedNode, s: LayoutSection): Serial
1644
1754
  * Refuses (ComposeError) a link to a section the layout does not have; everything the product cannot say comes back in
1645
1755
  * `gaps`.
1646
1756
  */
1757
+ /** A layout reads right to left in Hebrew — the ONE rule `composeLayout` and `composeListFrame` read. */
1758
+ const layoutRtl = (locale: string | undefined): boolean => locale === 'he';
1759
+
1647
1760
  export function composeLayout(site: LayoutSite, options: ComposeLayoutOptions): ComposedLayout {
1648
1761
  if (!site?.sections?.length) throw new ComposeError('a layout needs at least one section');
1649
1762
  const pace = LAYOUT_PACE[(site.motion?.pace ?? LayoutPace.Normal) as LayoutPace] ?? LAYOUT_PACE[LayoutPace.Normal];
1650
1763
  const ctx: Ctx = {
1651
1764
  p: options.id ?? 'cl',
1652
1765
  site,
1653
- rtl: site.locale === 'he',
1766
+ rtl: layoutRtl(site.locale),
1654
1767
  mode: (options.mode ?? LayoutColourMode.Light) as LayoutColourMode,
1655
1768
  pace,
1656
1769
  ease: LAYOUT_EASING[(site.motion?.ease ?? LayoutEase.Out) as LayoutEase] ?? LAYOUT_EASING[LayoutEase.Out],
@@ -556,25 +556,49 @@ export function layoutListShapes(plan: SitePlan): LayoutListShape[] {
556
556
  .filter(isLayoutListSource)
557
557
  .map(d => {
558
558
  const type = contentTypeOfSource(d.alias, plan);
559
- const played = (Object.values(ContentRole) as `${ContentRole}`[]).filter(role => !!roleField(type, role));
560
- const perItem = type?.seed?.perItem ?? {};
561
- const long = LIST_TEXT_ROLES.filter(role => {
562
- const field = roleField(type, role);
563
- const samples = field ? (perItem[field] ?? []).filter(s => typeof s === 'string') : [];
564
- return samples.length > 0 && median(samples.map(wordCount)) > LIST_LONG_WORDS;
565
- });
566
559
  // A shop list holds the plan's sample products (the build writes them unless the shop has its own).
567
- const count = d.type === PlanDataSourceType.Shop ? plan.shop?.products?.length : type?.seed?.count;
568
- // AW11: how long the planned names run (a long one is not set on its picture).
569
- const titleField = roleField(type, ContentRole.Title);
570
- const titles = titleField ? (perItem[titleField] ?? []).filter(s => typeof s === 'string') : [];
571
- return {
572
- alias: d.alias, label: type?.label ?? d.alias, items: typeof count === 'number' && count > 0 ? count : null, roles: played, long,
573
- ...(titles.length ? { titleWords: median(titles.map(wordCount)) } : {}),
574
- };
560
+ return listShapeOfType(d.alias, type, d.type === PlanDataSourceType.Shop ? { items: plan.shop?.products?.length ?? null } : {});
575
561
  });
576
562
  }
577
563
 
564
+ /** What is known of a list's items beyond its type: their count, or the items themselves (a studio's real rows). */
565
+ export interface ListShapeReading {
566
+ /** How many items it holds (absent: the type's planned sample count). */
567
+ readonly items?: number | null;
568
+ /** The items themselves, by field — their words are measured instead of the planned samples'. */
569
+ readonly rows?: ReadonlyArray<Readonly<Record<string, unknown>>>;
570
+ /** AW11-D9: every picture stands on a plain ground (measured at upload). */
571
+ readonly plainPictures?: boolean | null;
572
+ }
573
+
574
+ /**
575
+ * The shape of ONE list from its content type — what the layout check, the wire and Bindings ▸ List judge a list by:
576
+ * the roles its items play, which text roles run long, the names' length, how many items. From the plan's planned
577
+ * samples (`type.seed`) or, given `rows`, from the studio's real items. `layoutListShapes` is this, per plan source.
578
+ */
579
+ export function listShapeOfType(alias: string, type: Pick<ContentTypePlan, 'label' | 'roles' | 'seed'> | null | undefined,
580
+ reading: ListShapeReading = {}): LayoutListShape {
581
+ const played = (Object.values(ContentRole) as `${ContentRole}`[]).filter(role => !!roleField(type, role));
582
+ const perItem = type?.seed?.perItem ?? {};
583
+ const samples = (field: string | undefined): string[] => {
584
+ if (!field) return [];
585
+ const raw = reading.rows ? reading.rows.map(r => r[field]) : (perItem[field] ?? []);
586
+ return raw.filter((s): s is string => typeof s === 'string');
587
+ };
588
+ const long = LIST_TEXT_ROLES.filter(role => {
589
+ const words = samples(roleField(type, role));
590
+ return words.length > 0 && median(words.map(wordCount)) > LIST_LONG_WORDS;
591
+ });
592
+ const count = reading.items !== undefined ? reading.items : reading.rows ? reading.rows.length : type?.seed?.count;
593
+ // AW11: how long the names run (a long one is not set on its picture).
594
+ const titles = samples(roleField(type, ContentRole.Title));
595
+ return {
596
+ alias, label: type?.label ?? alias, items: typeof count === 'number' && count > 0 ? count : null, roles: played, long,
597
+ ...(titles.length ? { titleWords: median(titles.map(wordCount)) } : {}),
598
+ ...(reading.plainPictures !== undefined ? { plainPictures: reading.plainPictures } : {}),
599
+ };
600
+ }
601
+
578
602
  /**
579
603
  * How the list composer reads one list (LI1, `ComposeLayoutOptions.listOf`): the field that plays each role, and the
580
604
  * plan's page that shows one item — its route, its param and the item's field that fills it. Null for an alias that is
@@ -584,16 +608,22 @@ export function layoutListBinding(alias: string, plan: SitePlan): LayoutListBind
584
608
  const ds = plan.dataSources.find(d => d.alias === alias);
585
609
  if (!ds || !isLayoutListSource(ds)) return null;
586
610
  const type = contentTypeOfSource(alias, plan);
611
+ const page = type ? plan.pages.find(p => p.template === type.name && !!p.routeSource) : undefined;
612
+ const byRoute = page ? plan.dataSources.find(d => d.alias === page.routeSource) : undefined;
613
+ const filter = byRoute && byRoute.type !== PlanDataSourceType.Relative ? byRoute.filterByRouteParam : undefined;
614
+ const [param] = page ? routeParams(page.route) : [];
615
+ return listBindingOfType(type, page && filter && param ? { route: page.route, param, field: filter.field } : undefined);
616
+ }
617
+
618
+ /** How the list composer reads a list of `type` — the field playing each role — and, when there is one, the page that
619
+ * shows one item. The ONE reading `layoutListBinding` and Bindings ▸ List (`composeListFrame`) hand the composer. */
620
+ export function listBindingOfType(type: Pick<ContentTypePlan, 'roles'> | null | undefined, detail?: LayoutListBinding['detail']): LayoutListBinding {
587
621
  const roles: Record<string, string> = {};
588
622
  for (const role of Object.values(ContentRole) as `${ContentRole}`[]) {
589
623
  const field = roleField(type, role);
590
624
  if (field) roles[role] = field;
591
625
  }
592
- const page = type ? plan.pages.find(p => p.template === type.name && !!p.routeSource) : undefined;
593
- const byRoute = page ? plan.dataSources.find(d => d.alias === page.routeSource) : undefined;
594
- const filter = byRoute && byRoute.type !== PlanDataSourceType.Relative ? byRoute.filterByRouteParam : undefined;
595
- const [param] = page ? routeParams(page.route) : [];
596
- return { roles, ...(page && filter && param ? { detail: { route: page.route, param, field: filter.field } } : {}) };
626
+ return { roles, ...(detail ? { detail } : {}) };
597
627
  }
598
628
 
599
629
  /** One line of the brief: `works (Works): 6 items · name, picture, detail, quote (long)`. */
@@ -72,6 +72,7 @@ export const SPEC_SITE_PLAN_SHAPE = {
72
72
  "mode": "'light' | 'dark' | 'auto'",
73
73
  "tint?": "string — axes.tints (DS9 neutral tint)",
74
74
  "fonts?": "object — uploaded font families per role (DS5)",
75
+ "column?": "string — axes.columns: the content column every section, the header and the footer share (award §0c; absent = the pack's defaults.column)",
75
76
  "scroll?": "string — axes.scrolls: how the site scrolls (rev 3.1; absent = axes.motionChoices.pre)",
76
77
  "animate?": "string — axes.animations: how much the sections move in as they scroll into view",
77
78
  "between?": "string — axes.betweens: what plays between pages",
@@ -11297,6 +11298,10 @@ export const SPEC_SITE_LAYOUT = {
11297
11298
  "shop": {
11298
11299
  "built": [],
11299
11300
  "where": "commerce track G (C-D21) — the shop's parts, handed over as words (AW-D19)"
11301
+ },
11302
+ "pageColumn": {
11303
+ "built": [],
11304
+ "where": "award §0c CW2: `LayoutPage.column` on the layout wire (one enum, offered per type — harness COLUMN_NEVER); until then a composed page wears the site's word (design ▸ content width)"
11300
11305
  }
11301
11306
  },
11302
11307
  "rows": [
@@ -11411,6 +11416,27 @@ export const SPEC_SITE_LAYOUT = {
11411
11416
  "drawnAs": null,
11412
11417
  "tier": "pro",
11413
11418
  "meaning": "an out-of-season card with notify me"
11419
+ },
11420
+ {
11421
+ "key": "pageColumn.wide",
11422
+ "phase": "CW2",
11423
+ "drawnAs": null,
11424
+ "tier": "all",
11425
+ "meaning": "the page runs the window minus the one gutter (a gallery, a bold page) — never a formal type"
11426
+ },
11427
+ {
11428
+ "key": "pageColumn.contained",
11429
+ "phase": "CW2",
11430
+ "drawnAs": null,
11431
+ "tier": "all",
11432
+ "meaning": "the page's words sit in one centred column; grounds keep the window"
11433
+ },
11434
+ {
11435
+ "key": "pageColumn.narrow",
11436
+ "phase": "CW2",
11437
+ "drawnAs": null,
11438
+ "tier": "all",
11439
+ "meaning": "a reading column — a story, a case study, a long page of words"
11414
11440
  }
11415
11441
  ]
11416
11442
  }
@@ -247,6 +247,7 @@ function validateDesign(c: Collector, design: unknown): void {
247
247
  axis('density', SPEC_AXES.densities);
248
248
  axis('motion', SPEC_AXES.motions);
249
249
  axis('tint', SPEC_AXES.tints);
250
+ axis('column', SPEC_AXES.columns);
250
251
  axis('scroll', SPEC_AXES.scrolls);
251
252
  axis('animate', SPEC_AXES.animations);
252
253
  axis('between', SPEC_AXES.betweens);