@vectoriox/iox-ui 5.147.0 → 5.149.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 (32) hide show
  1. package/composite-core/index.d.ts +15 -1
  2. package/design-core/index.d.ts +70 -6
  3. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +31 -2
  4. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-design-core.mjs +101 -12
  6. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1215 -970
  8. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  10. package/generation-core/index.d.ts +116 -39
  11. package/harness-core/index.d.ts +8 -1
  12. package/package.json +1 -1
  13. package/src/composite-core/slider.ts +33 -2
  14. package/src/design-core/design-apply.ts +6 -0
  15. package/src/design-core/flavor-spec.generated.ts +48 -0
  16. package/src/design-core/flavor-tokens.ts +6 -2
  17. package/src/design-core/header-behaviour.ts +25 -8
  18. package/src/design-core/node-classes.ts +15 -0
  19. package/src/design-core/token-css.ts +6 -3
  20. package/src/generation-core/audit-site.ts +19 -3
  21. package/src/generation-core/check-layout.ts +34 -6
  22. package/src/generation-core/compose-layout.ts +64 -41
  23. package/src/generation-core/compose-site.ts +57 -11
  24. package/src/generation-core/footer-mix.ts +7 -2
  25. package/src/generation-core/layout-column.ts +120 -0
  26. package/src/generation-core/layout-language.ts +66 -12
  27. package/src/generation-core/layout-space.ts +6 -5
  28. package/src/generation-core/layout-type.ts +6 -3
  29. package/src/generation-core/layout-wire.ts +27 -5
  30. package/src/generation-core/site-spec.generated.ts +11 -23
  31. package/src/harness-core/business-types.ts +8 -0
  32. package/styles/iox-design.css +14 -3
@@ -6,7 +6,7 @@ import {
6
6
  DesignChoices, DesignTokenRow, FlavorPackV2, FlavorSpecToken, flavorSourceStamp, PRE_MOTION, USER_TOKEN_SOURCE,
7
7
  } from './design-token.model';
8
8
  import { motionCurve, motionLanguageOf } from './motion-language';
9
- import { CONTENT_WIDTH_TOKEN, contentWidthOf } from './node-classes';
9
+ import { CONTENT_CAP_TOKEN, CONTENT_WIDTH_TOKEN, contentCapOf, contentWidthOf } from './node-classes';
10
10
  import { stylePresetOfChoices } from './style-presets';
11
11
 
12
12
  /**
@@ -95,8 +95,12 @@ export function buildFlavorTokens(pack: FlavorPackV2, choices: DesignChoices): D
95
95
  ]) set(name, value);
96
96
 
97
97
  // Award §0c: the column in force, as the literal the chosen density gives its word (wide = the whole page).
98
- const content = contentWidthOf(choices.column ?? pack.defaults.column, name => byName.get(name)?.value);
98
+ const word = choices.column ?? pack.defaults.column;
99
+ const content = contentWidthOf(word, name => byName.get(name)?.value);
99
100
  if (content) set(CONTENT_WIDTH_TOKEN, content);
101
+ // …and as a length a font-size can read (`content-cap`, iox-ui#117) — only where the pack holds the row.
102
+ const cap = contentCapOf(word, name => byName.get(name)?.value);
103
+ if (cap && byName.has(CONTENT_CAP_TOKEN)) set(CONTENT_CAP_TOKEN, cap);
100
104
 
101
105
  // AW3 (MB-D1, MB-D5): the look's own arrival and leave — every entrance, dialog and menu moves on them.
102
106
  const language = motionLanguageOf(choices, stylePresetOfChoices(choices)?.id);
@@ -110,17 +110,34 @@ export enum BrandNameLength {
110
110
  Long = 'long',
111
111
  /** Wears `size-body` on a phone. */
112
112
  Longer = 'longer',
113
+ /** Wears `size-small` on a phone (vectoriox/iox-ui#120: a name that took three lines at `size-body`). */
114
+ Longest = 'longest',
113
115
  }
114
116
 
115
- /** From this many characters a name is `long`, then `longer`. Below it the name keeps its own size (a phone bar holds a
116
- * 16-character name in two lines at the largest heading size the looks give a brand). */
117
+ /** From this many characters a name is `long`, then `longer`, then `longest`. Below it the name keeps its own size (a
118
+ * phone bar holds a 16-character name in two lines at the largest heading size the looks give a brand). */
117
119
  export const BRAND_NAME_LONG_AT = 17;
118
120
  export const BRAND_NAME_LONGER_AT = 29;
119
-
120
- /** The name's attributes: `{}` for a name that keeps its size. Never shortens the words — the type steps down. */
121
+ export const BRAND_NAME_LONGEST_AT = 36;
122
+
123
+ /** vectoriox/iox-ui#120: a line never breaks inside a word, so the LONGEST WORD decides too — a word from this many
124
+ * letters does not fit one line of the bar at the size the name's length alone would give it ("Neighbourhoo|d Café"). */
125
+ export const BRAND_WORD_LONG_AT = 10;
126
+ export const BRAND_WORD_LONGER_AT = 12;
127
+ export const BRAND_WORD_LONGEST_AT = 15;
128
+
129
+ const BRAND_STEPS: ReadonlyArray<{ length: BrandNameLength; name: number; word: number }> = [
130
+ { length: BrandNameLength.Longest, name: BRAND_NAME_LONGEST_AT, word: BRAND_WORD_LONGEST_AT },
131
+ { length: BrandNameLength.Longer, name: BRAND_NAME_LONGER_AT, word: BRAND_WORD_LONGER_AT },
132
+ { length: BrandNameLength.Long, name: BRAND_NAME_LONG_AT, word: BRAND_WORD_LONG_AT },
133
+ ];
134
+
135
+ /** The name's attributes: `{}` for a name that keeps its size. Never shortens the words — the type steps down, by the
136
+ * name's length and by its longest word, whichever asks for the smaller step. */
121
137
  export function brandNameAttributes(words: string): Record<string, string> {
122
- const n = [...words.replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim()].length;
123
- if (n >= BRAND_NAME_LONGER_AT) return { [BRAND_NAME_ATTRIBUTE]: BrandNameLength.Longer };
124
- if (n >= BRAND_NAME_LONG_AT) return { [BRAND_NAME_ATTRIBUTE]: BrandNameLength.Long };
125
- return {};
138
+ const text = words.replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim();
139
+ const n = [...text].length;
140
+ const word = Math.max(0, ...text.split(' ').map(w => [...w].length));
141
+ const step = BRAND_STEPS.find(s => n >= s.name || word >= s.word);
142
+ return step ? { [BRAND_NAME_ATTRIBUTE]: step.length } : {};
126
143
  }
@@ -92,6 +92,14 @@ export const COLUMN_SETTING = 'column';
92
92
  export const CONTENT_WIDTH_TOKEN = 'content-width';
93
93
  /** What `content-width` holds for Wide: the whole page, so the inset is the one gutter (`space-edge`). */
94
94
  export const WIDE_CONTENT_WIDTH = '100%';
95
+ /**
96
+ * Award §0c CW2 (iox-ui#117): the column in force as a LENGTH a `font-size` can read — a `%` there is the parent's
97
+ * font size, so `content-width` (100% in wide) cannot be read by a screen word. The column's px, `100vw` in wide;
98
+ * re-declared beside `content-width` by a page's word, so a global footer's closing name fits the page it is on.
99
+ */
100
+ export const CONTENT_CAP_TOKEN = 'content-cap';
101
+ /** What `content-cap` holds for Wide: the window. */
102
+ export const WIDE_CONTENT_CAP = '100vw';
95
103
 
96
104
  type ColumnWord = keyof typeof SPEC_AXES.columns;
97
105
  const COLUMN_WORDS = SPEC_AXES.columns as Readonly<Record<string, { readonly column: string | null }>>;
@@ -113,6 +121,13 @@ export function contentWidthOf(column: unknown, rowValue: (name: string) => stri
113
121
  return row ? rowValue(row) ?? null : WIDE_CONTENT_WIDTH;
114
122
  }
115
123
 
124
+ /** The literal `content-cap` holds for a column word: the column's px (the same row `content-width` reads), `100vw` in
125
+ * wide. Null for an unknown word or a column row the set lacks. */
126
+ export function contentCapOf(column: unknown, rowValue: (name: string) => string | undefined): string | null {
127
+ const width = contentWidthOf(column, rowValue);
128
+ return width === WIDE_CONTENT_WIDTH ? WIDE_CONTENT_CAP : width;
129
+ }
130
+
116
131
  /** The selector a column word's block is declared on, inside `scope` (the builder's token scope — the attribute sits on
117
132
  * the scope element itself) or anywhere (the engine's `<body>`). */
118
133
  export function columnSelector(word: string, scope?: string): string {
@@ -1,6 +1,6 @@
1
1
  import { DesignMode } from './design-token.model';
2
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';
3
+ import { columnSelector, CONTENT_CAP_TOKEN, CONTENT_WIDTH_TOKEN, contentCapOf, contentWidthOf, openingFollowerSelector, SCHEME_INK } from './node-classes';
4
4
  import { specTokenNames } from './token-names';
5
5
 
6
6
  /**
@@ -13,7 +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
+ * columns `[data-iox-column="<word>"] { --iox-content-width: <literal>; --iox-content-cap: <length>; every token reading it }` (award §0c)
17
17
  * 3. reduced motion `@media (prefers-reduced-motion: reduce)`
18
18
  * 4. reduced transparency `@media (prefers-reduced-transparency: reduce)`
19
19
  * 5. dark — LAST `@media (prefers-color-scheme: dark)`
@@ -351,9 +351,12 @@ function columnCss(rows: ReadonlyArray<DesignTokenLike>, scope?: string): { base
351
351
  .map(word => [word, contentWidthOf(word, value)] as const)
352
352
  .filter((w): w is readonly [string, string] => w[1] !== null);
353
353
  const darkDependents = dependents.map((t): [string, string | null] => [t.name, darkOf(t)]).filter((e): e is [string, string] => e[1] !== null);
354
+ // iox-ui#117: `content-cap` (the column as a length) moves with the word — only where the rows hold it.
355
+ const capped = rows.some(t => t.name === CONTENT_CAP_TOKEN);
354
356
  return {
355
357
  base: words.map(([word, width]) => rule(columnSelector(word, scope), [
356
- [CONTENT_WIDTH_TOKEN, width], ...dependents.map((t): [string, string] => [t.name, t.value]),
358
+ [CONTENT_WIDTH_TOKEN, width], ...(capped ? [[CONTENT_CAP_TOKEN, contentCapOf(word, value)!] as [string, string]] : []),
359
+ ...dependents.filter(t => t.name !== CONTENT_CAP_TOKEN).map((t): [string, string] => [t.name, t.value]),
357
360
  ])).filter(Boolean).join('\n'),
358
361
  // A dependent with a dark value would keep its LIGHT value under the word's block in a dark visit.
359
362
  dark: darkDependents.length ? words.map(([word]) => rule(columnSelector(word, scope), darkDependents, ' ')).join('\n') : '',
@@ -293,6 +293,20 @@ export function siteSells(snapshot: Pick<SiteAuditSnapshot, 'pages' | 'globals'>
293
293
  return sells;
294
294
  }
295
295
 
296
+ /** The parts that make a PAGE the shop's — a product's price, or what puts it in the bag or opens the checkout. The
297
+ * header's bag and drawer are the site's chrome: they make a site sell (`siteSells`), never the café's Home a shop. */
298
+ const PAGE_SHOP_ROLES: ReadonlySet<string> = new Set([ShopRole.Price, ShopRole.Add, ShopRole.BuyNow, ShopRole.Checkout]);
299
+
300
+ /**
301
+ * iox-cms#98: the page shows the shop's products for sale — what a store fact (`store-fact`) and an unpriced or
302
+ * unstocked sample product (`sample-price`, `sample-stock`) hold. Every other page goes live whatever the shop lacks.
303
+ */
304
+ export function pageShowsShop(page: Pick<AuditPage, 'layout'>): boolean {
305
+ let shows = false;
306
+ walkSerialized(page.layout, n => { if (!shows && !!n.role && PAGE_SHOP_ROLES.has(n.role)) shows = true; });
307
+ return shows;
308
+ }
309
+
296
310
  /** A route pattern (`/work/:slug`) matches a concrete path (`/work/blue-bowl`). */
297
311
  export function routeMatches(pattern: string, path: string): boolean {
298
312
  const a = pattern.split('/').filter(Boolean);
@@ -445,9 +459,11 @@ function checkFacts(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArray<
445
459
  else if (p.kind === PlaceholderKind.Copy) add(ctx, SiteFindingCode.CopyPlaceholder, 'Some words are still the template\'s.', where);
446
460
  }
447
461
  for (const s of snapshot.samples ?? []) add(ctx, SiteFindingCode.SampleItems, `"${s.label ?? s.id}" is a sample — replace or remove it.`, { nodeId: s.id });
448
- for (const s of snapshot.unpricedSamples ?? []) add(ctx, SiteFindingCode.SamplePrice, `"${s.label ?? s.id}" has no price yet — set yours, or remove the sample.`, { nodeId: s.id });
449
- for (const s of snapshot.unstockedSamples ?? []) add(ctx, SiteFindingCode.SampleStock, `"${s.label ?? s.id}" has no stock yet — say how many you have, or remove the sample.`, { nodeId: s.id });
450
- if (snapshot.store?.refusals.length && siteSells(snapshot)) {
462
+ // iox-cms#98: what the shop lacks holds only the pages that show the shop — never the Home of a site that also sells.
463
+ const shopShown = pages.some(pageShowsShop);
464
+ for (const s of shopShown ? snapshot.unpricedSamples ?? [] : []) add(ctx, SiteFindingCode.SamplePrice, `"${s.label ?? s.id}" has no price yet — set yours, or remove the sample.`, { nodeId: s.id });
465
+ for (const s of shopShown ? snapshot.unstockedSamples ?? [] : []) add(ctx, SiteFindingCode.SampleStock, `"${s.label ?? s.id}" has no stock yet — say how many you have, or remove the sample.`, { nodeId: s.id });
466
+ if (snapshot.store?.refusals.length && shopShown && siteSells(snapshot)) {
451
467
  for (const r of snapshot.store.refusals) {
452
468
  const code = STORE_CONTACT_CODES.has(r.code) ? SiteFindingCode.StoreContact : SiteFindingCode.StoreFact;
453
469
  add(ctx, code, labelIn(r.label, snapshot.store.lang), { fact: r.code });
@@ -1,12 +1,14 @@
1
- import { DesignChoices, designTokenRows, parseCssColour, presetChoices, relativeLuminance, resolveTokenValues, ScrubId, scrubOfChoices, toHexColor } from '@vectoriox/iox-ui/design-core';
1
+ import { columnWordOf, DesignChoices, designTokenRows, parseCssColour, presetChoices, relativeLuminance, resolveTokenValues, ScrubId, scrubOfChoices, SPEC_AXES, toHexColor } from '@vectoriox/iox-ui/design-core';
2
2
  import { ParallaxDepth } from '@vectoriox/iox-ui/scene-core';
3
3
 
4
4
  import {
5
- LAYOUT_HIDDEN_OPACITY, LAYOUT_OPERATED, LAYOUT_TEXT_KINDS, LayoutBandMove, LayoutColour, LayoutDepth, LayoutDial, LayoutEnter, LayoutGalleryList, LayoutIssue, LayoutListShape, LayoutIssueCode, LayoutLayer, LayoutLayerKind, LayoutMend, LayoutMendKind,
5
+ LAYOUT_COLUMN_MENDED, LAYOUT_HIDDEN_OPACITY, LAYOUT_OPERATED, LAYOUT_TEXT_KINDS, LayoutBandMove, LayoutColour, LayoutDepth, LayoutDial, LayoutEnter, LayoutGalleryList, LayoutIssue, LayoutListShape, LayoutIssueCode, LayoutLayer, LayoutLayerKind, LayoutMend, LayoutMendKind,
6
6
  LayoutGivenAway, LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutPage, LayoutPhotoSource,
7
7
  LayoutRole, LayoutScrubRefusal, LayoutSection, LayoutSectionKind, LayoutSourceChoice, LayoutTrackProp, parseLayoutPhotoId,
8
8
  } from './layout-language';
9
9
  import { layoutScrubTakes } from './text-scroll';
10
+ import { layoutColumnsOffered } from './layout-wire';
11
+ import { layoutColumnWord, layoutJudgeColumnPx } from './layout-column';
10
12
  import { DriftBox, driftOverlap, layoutGlideDepth } from './layout-drift';
11
13
  import { layoutLookOf } from './layout-look';
12
14
  import { patternById, SCENE_LEVEL } from './patterns';
@@ -80,6 +82,9 @@ export interface CheckLayoutContext {
80
82
  rhythm?: string | null;
81
83
  /** AW6: how the footer's ground reads — the `tail` rhythm's last sections wear it. Absent: the tail is not judged. */
82
84
  footerTone?: GroundTone | null;
85
+ /** Award §0c CW2 (AW-D34): the column words this business type never wears (harness-core `BusinessType.column.never`):
86
+ * a page asking one is mended to the first word it may wear (`column-mended`). */
87
+ columnNever?: ReadonlyArray<string>;
83
88
  }
84
89
 
85
90
  /** The look's composition notes, read as one shape (the contract's looks differ in which limits they set). */
@@ -127,6 +132,21 @@ function presetPaint(presetId: string, mode: 'light' | 'dark'): { colours: Layou
127
132
  return { colours, accentText: hex(ACCENT_TEXT_TOKEN) ?? colours[LayoutColour.Accent] };
128
133
  }
129
134
 
135
+ /**
136
+ * Award §0c CW2 (AW-D34, R-H25): the page's column word — a word outside the axis is dropped (the page wears the site's);
137
+ * a word the business type never wears (a formal type's `wide`) takes the first it may (`contained`). Both mend alone.
138
+ */
139
+ export function columnIssues(page: Pick<LayoutPage, 'column'>, ctx: Pick<CheckLayoutContext, 'columnNever'>): LayoutIssue[] {
140
+ if (page?.column === undefined || page.column === null) return [];
141
+ const offered = layoutColumnsOffered(ctx.columnNever);
142
+ if (!columnWordOf(page.column)) {
143
+ return [{ code: LayoutIssueCode.Value, path: 'column', message: `${Object.keys(SPEC_AXES.columns).join(' | ')} — "${page.column}" is no column: the page wears the site's`, mend: { kind: LayoutMendKind.Column, column: null } }];
144
+ }
145
+ if (offered.includes(page.column)) return [];
146
+ const column = offered.includes(SPEC_AXES.columnChoices.new) ? SPEC_AXES.columnChoices.new : offered[0] ?? null;
147
+ return [{ code: LayoutIssueCode.Value, path: 'column', message: `${LAYOUT_COLUMN_MENDED}: this business never wears "${page.column}" — composed ${column ?? "in the site's column"}`, mend: { kind: LayoutMendKind.Column, column } }];
148
+ }
149
+
130
150
  /** A preset's five colours in a mode as `#rrggbb` (the prototype's `presetColours`), or null when it does not wear that mode. */
131
151
  export function layoutPresetColours(presetId: string, mode: 'light' | 'dark'): LayoutColours | null {
132
152
  return presetPaint(presetId, mode)?.colours ?? null;
@@ -319,6 +339,10 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
319
339
  const limits = look?.limits ?? {};
320
340
  const daring = page.dial === LayoutDial.Daring;
321
341
  if (!inList(V.dials, page.dial)) add(LayoutIssueCode.Value, 'dial', V.dials.join(' | '));
342
+ for (const issue of columnIssues(page, ctx)) issues.push(issue);
343
+ // Award §0c CW2 (AW-D38): the px judges read the page's column — its own word, else the design's when one is given.
344
+ const columnWord = layoutColumnWord(columnWordOf(page.column) ? page.column : undefined, ctx.design);
345
+ const judgeColumnPx = layoutJudgeColumnPx(columnWord, design.density, LAYOUT_CHECK_VIEWPORT.width);
322
346
  const facts = String(ctx.facts ?? '');
323
347
  const factKeys = ctx.factKeys ?? Object.keys(SPEC_SITE_FACTS);
324
348
  const routes = ctx.routes ?? [];
@@ -468,14 +492,14 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
468
492
  if ((l.size === 'm' || l.size === 's') && text.length > LIM.longTextChars && span(l.col) > LIM.longTextColumns) {
469
493
  add(LayoutIssueCode.Reading, `${lp}.col`, `long text is never wider than ${LIM.longTextColumns} columns`);
470
494
  }
471
- if (placed && isText(l) && l.size && l.size !== 'screen' && text && !layoutTextFits(l, s)) {
472
- const lines = Math.floor(boxPx(l.col, l.row, s).h / (L.sizePx[l.size] * LAYOUT_LINE_HEIGHT));
495
+ if (placed && isText(l) && l.size && l.size !== 'screen' && text && !layoutTextFits(l, s, l.size, judgeColumnPx)) {
496
+ const lines = Math.floor(boxPx(l.col, l.row, s, judgeColumnPx).h / (L.sizePx[l.size] * LAYOUT_LINE_HEIGHT));
473
497
  add(LayoutIssueCode.Reading, `${lp}.row`, `${text.length} characters at ${l.size} do not fit a box of ${span(l.col)} columns × ${span(l.row)} rows (about ${Math.max(0, lines)} line${lines === 1 ? '' : 's'}) — give it more rows or columns, or fewer words`);
474
498
  }
475
499
  if (l.size === 'screen' || l.size === 'xxl') huge++;
476
500
  if (l.size === 'screen') {
477
501
  screenWords++;
478
- const misfit = text ? screenWordMisfit(l, design) : null;
502
+ const misfit = text ? screenWordMisfit(l, design, columnWord) : null;
479
503
  if (misfit) add(LayoutIssueCode.Reading, `${lp}.text`, `"${text}" is ${misfit.px}px too wide for ${misfit.phone ? `a ${misfit.width}px phone` : 'its columns'} even at the smallest screen size — fewer letters, ${misfit.phone ? '' : 'more columns, '}or size xxl`);
480
504
  }
481
505
  if (l.bleed && l.bleed !== 'none') bleeds++;
@@ -642,7 +666,7 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
642
666
  if (placed && (isText(l) || l.kind === LayoutLayerKind.Button)) {
643
667
  const under: PhotoUnder[] = layers
644
668
  .filter(o => o !== l && o.kind === LayoutLayerKind.Photo && (o.z ?? 0) < (l.z ?? 0) && overlaps(o, l) && o.photo?.id)
645
- .map(o => ({ id: o.photo!.id, frame: boxPx(o.col, o.row, s), region: regionInLayer(o, l) }));
669
+ .map(o => ({ id: o.photo!.id, frame: boxPx(o.col, o.row, s, judgeColumnPx), region: regionInLayer(o, l) }));
646
670
  if (groundPhoto) under.push({ id: groundPhoto, frame: { w: LAYOUT_CHECK_VIEWPORT.width, h: s.screens * LAYOUT_CHECK_VIEWPORT.height }, region: regionOnGround(s, l) });
647
671
  const fgHex = isText(l) ? colourHex(l.color, true) : null;
648
672
  const fg = fgHex ? lumOf(fgHex) : null;
@@ -1177,6 +1201,10 @@ export function mendLayout(page: LayoutPage, issues: ReadonlyArray<LayoutIssue>)
1177
1201
  if (mend.sections.some(m => !next.sections?.[m.section])) continue;
1178
1202
  for (const m of mend.sections) next.sections[m.section].screens = m.screens;
1179
1203
  mended.push(issue);
1204
+ } else if (mend?.kind === LayoutMendKind.Column) {
1205
+ if (mend.column) next.column = mend.column;
1206
+ else delete next.column;
1207
+ mended.push(issue);
1180
1208
  } else if (mend?.kind === LayoutMendKind.Drop && layerAt(mend.layer)) {
1181
1209
  drops.push(issue);
1182
1210
  }
@@ -4,22 +4,27 @@ import {
4
4
  SLIDER_PLACEMENT_TRAIT, SliderPlacement, SliderRole, syncSliderParts, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget,
5
5
  } from '@vectoriox/iox-ui/composite-core';
6
6
 
7
- import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme } from '@vectoriox/iox-ui/design-core';
7
+ import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
8
8
  import { 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';
12
12
  import { LIST_RULES, LIST_RHYTHMS, listWait } from './list-table';
13
+ import { SPEC_SITE_LAYOUT } from './site-spec.generated';
13
14
  import { listMixWords } from './layout-wire';
14
15
  import {
15
- LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_EASING, LAYOUT_GUTTER, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHOTO_ASPECT, LAYOUT_TOOLTIP_TRAIT,
16
+ 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,
16
17
  LAYOUT_PHONE_PADDING, LAYOUT_RISE, LAYOUT_TEXT_KINDS, LayoutBleed, LayoutColour, LayoutEase, LayoutEnter, LayoutForm, LayoutGallery, LayoutLayer,
17
18
  LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListHow, LayoutListItem, LayoutListMix, LayoutListMove, LayoutListPhone, LayoutListWho,
18
19
  LayoutLayerKind, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutRole, LayoutSection, LayoutSide, LayoutSite, LayoutTrack, LayoutTrackProp, LayoutTransition, phoneGapBefore,
19
20
  screenFontSize,
20
21
  } from './layout-language';
21
22
  import { layoutGlideDepth } from './layout-drift';
22
- import { isLayoutRule, layoutRuleEdge } from './layout-space';
23
+ import {
24
+ LAYOUT_BLEED_END_LINE, LAYOUT_BLEED_START_LINE, LAYOUT_INSET, layoutBledBarInset, layoutColumnPx, layoutColumnStart, layoutColumnWord, layoutGapPx,
25
+ layoutGridColumns, layoutGridLine, layoutGridPx,
26
+ } from './layout-column';
27
+ import { isLayoutRule, LAYOUT_CHECK_VIEWPORT, layoutRuleEdge } from './layout-space';
23
28
  import { LIST_DECK_MAX_PX, LIST_DECK_SHARE, listOverhang } from './list-space';
24
29
  import { layoutDesignOf, layoutElementStyle, layoutTextWidthEm, screenWordColumns } from './layout-type';
25
30
  import { ComposeError, createSerializedNode, SerializedNode, setStyleProps, assertStyleSlots, walkSerialized } from './serialized-node';
@@ -257,6 +262,9 @@ interface Ctx {
257
262
  sections: Record<string, string>;
258
263
  gaps: LayoutGap[];
259
264
  design: DesignChoices;
265
+ /** Award §0c CW2: the page's content column in px at its density, or null (wide): what a `screen` word, a bled
266
+ * gallery's bar and a list's item count are stamped for (`layout-column.ts`). */
267
+ columnPx: number | null;
260
268
  photoSrc: (id: string) => string;
261
269
  photoAlt: (id: string) => string;
262
270
  photoAspect: (id: string) => string;
@@ -388,14 +396,15 @@ function isLight(colour: string | undefined, mode: LayoutColourMode): boolean {
388
396
 
389
397
  const gridTemplate = (count: number) => `repeat(${count}, minmax(0, 1fr))`;
390
398
 
391
- /** The grid a section's layers are placed on: 12 columns per screen, its rows, the page's gutter. */
399
+ /** The grid a section's layers are placed on: 12 columns per screen between an outer track a side (the page's column,
400
+ * award §0c CW2 — `layoutGridColumns`), its rows. No inline padding: a bleed spans into an outer track. */
392
401
  function gridLayout(rows: number, track: number): Record<string, string> {
393
402
  return {
394
403
  display: 'grid',
395
- gridTemplateColumns: gridTemplate(GRID_COLUMNS * track),
404
+ gridTemplateColumns: layoutGridColumns(track),
396
405
  gridTemplateRows: gridTemplate(rows),
397
406
  gap: `${ZERO} ${LAYOUT_COLUMN_GAP}`,
398
- padding: `${ZERO} ${LAYOUT_GUTTER}`,
407
+ padding: ZERO,
399
408
  };
400
409
  }
401
410
 
@@ -406,16 +415,10 @@ function phoneStack(first: boolean): Record<string, string> {
406
415
  flexDirection: 'column',
407
416
  height: 'auto',
408
417
  gap: ZERO,
409
- padding: `${first ? PHONE_FIRST_TOP : LAYOUT_PHONE_PADDING} ${LAYOUT_GUTTER} ${LAYOUT_PHONE_PADDING} ${LAYOUT_GUTTER}`,
418
+ padding: `${first ? PHONE_FIRST_TOP : LAYOUT_PHONE_PADDING} ${LAYOUT_INSET} ${LAYOUT_PHONE_PADDING} ${LAYOUT_INSET}`,
410
419
  };
411
420
  }
412
421
 
413
- /** A bleed's width: its cell and the gutters it runs into (a negative margin alone moves a box that holds its width). */
414
- function bleedWidth(bleed: string | undefined): string | null {
415
- if (!bleed || bleed === LayoutBleed.None) return null;
416
- return bleed === LayoutBleed.Both ? `calc(100% + 2 * ${LAYOUT_GUTTER})` : `calc(100% + ${LAYOUT_GUTTER})`;
417
- }
418
-
419
422
  /** The physical sides a bleed runs into, from the page's direction. */
420
423
  function bleedSides(bleed: string | undefined, rtl: boolean): { left: boolean; right: boolean } | null {
421
424
  if (!bleed || bleed === LayoutBleed.None) return null;
@@ -424,12 +427,16 @@ function bleedSides(bleed: string | undefined, rtl: boolean): { left: boolean; r
424
427
  return rtl ? { left: end, right: start } : { left: start, right: end };
425
428
  }
426
429
 
427
- /** A bleed: the layer runs into the gutter on that side. */
428
- function bleedMargin(bleed: string | undefined, rtl: boolean): string | null {
429
- const sides = bleedSides(bleed, rtl);
430
- if (!sides) return null;
431
- const out = `calc(-1 * ${LAYOUT_GUTTER})`;
432
- return `${ZERO} ${sides.right ? out : ZERO} ${ZERO} ${sides.left ? out : ZERO}`;
430
+ /**
431
+ * A layer's columns on the grid (award §0c CW2): its layout lines past the outer track — and a bleed spans into the outer
432
+ * track on its side, to the window's edge (grid lines are logical, so a start bleed is the right edge in Hebrew). Never a
433
+ * negative margin: inside a cell a `%` is the cell's (T-CW2).
434
+ */
435
+ function gridColumnOf(l: LayoutLayer): string {
436
+ const bleed = l.bleed && l.bleed !== LayoutBleed.None ? l.bleed : null;
437
+ const start = bleed === LayoutBleed.Start || bleed === LayoutBleed.Both ? LAYOUT_BLEED_START_LINE : layoutGridLine(l.col[0]);
438
+ const end = bleed === LayoutBleed.End || bleed === LayoutBleed.Both ? LAYOUT_BLEED_END_LINE : layoutGridLine(l.col[1]);
439
+ return `${start} / ${end}`;
433
440
  }
434
441
 
435
442
  // ── Motion ──────────────────────────────────────────────────────────────────────────────────────────────
@@ -552,17 +559,13 @@ interface LayerCtx {
552
559
  function place(node: SerializedNode, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): void {
553
560
  const stretch = STRETCH_KINDS.has(l.kind);
554
561
  const values: Record<string, unknown> = {
555
- gridColumn: `${l.col[0]} / ${l.col[1]}`,
562
+ gridColumn: gridColumnOf(l),
556
563
  gridRow: `${l.row[0]} / ${l.row[1]}`,
557
564
  alignSelf: stretch ? 'stretch' : 'center',
558
565
  zIndex: String(1 + (l.z ?? 0)),
559
566
  position: 'relative',
560
567
  minWidth: ZERO,
561
568
  };
562
- const margin = bleedMargin(l.bleed, ctx.rtl);
563
- if (margin) values['margin'] = margin;
564
- const width = l.kind === LayoutLayerKind.Button ? null : bleedWidth(l.bleed);
565
- if (width) values['width'] = width;
566
569
  if (l.rotate) values['rotate'] = `${l.rotate}deg`;
567
570
  if (l.kind === LayoutLayerKind.Button) values['justifySelf'] = l.align === 'center' ? 'center' : l.align === 'end' ? 'end' : 'start';
568
571
  else if (l.kind !== LayoutLayerKind.Photo && l.kind !== LayoutLayerKind.Gallery && l.kind !== LayoutLayerKind.Shape) values['textAlign'] = l.align ?? 'start';
@@ -571,7 +574,6 @@ function place(node: SerializedNode, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): vo
571
574
  gridColumn: 'auto', gridRow: 'auto', alignSelf: l.kind === LayoutLayerKind.Button ? 'flex-start' : 'stretch', order: String(lc.order),
572
575
  margin: `${lc.phoneGap}px ${ZERO} ${ZERO} ${ZERO}`,
573
576
  };
574
- if (width) onPhone['width'] = FULL;
575
577
  if (l.kind === LayoutLayerKind.Button && lc.phoneAlign === 'center') onPhone['alignSelf'] = 'center';
576
578
  if (values['textAlign']) onPhone['textAlign'] = lc.phoneAlign;
577
579
  if (l.kind === LayoutLayerKind.Shape) onPhone['display'] = 'none';
@@ -633,7 +635,7 @@ function textLayer(id: string, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): Serializ
633
635
  const rows = l.row[1] - l.row[0];
634
636
  const em = layoutTextWidthEm(l, ctx.design);
635
637
  const screens = lc.held ? 1 : lc.section.screens;
636
- setStyleProps(node, { fontSize: screenFontSize(em, screenWordColumns(l), rows, lc.section.rows, screens) });
638
+ setStyleProps(node, { fontSize: screenFontSize(em, screenWordColumns(l), rows, lc.section.rows, screens, ctx.columnPx) });
637
639
  phone(node, { fontSize: screenFontSize(em, GRID_COLUMNS, 0, 0, 0) });
638
640
  gap(ctx, LayoutGapCode.ScreenFit, lc.path, 'sized from its face\'s measured letters (no kerning), not fitted in the browser');
639
641
  }
@@ -758,7 +760,8 @@ function galleryLayer(id: string, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): Seria
758
760
  const sides = bleedSides(l.bleed, ctx.rtl);
759
761
  const bar = (slider.children ?? []).find(c => c.role === SliderRole.Bar);
760
762
  if (sides && bar) {
761
- setStyleProps(bar, { padding: `${GALLERY_BAR_TOP} ${sides.right ? LAYOUT_GUTTER : ZERO} ${ZERO} ${sides.left ? LAYOUT_GUTTER : ZERO}` });
763
+ const inset = layoutBledBarInset(ctx.columnPx);
764
+ setStyleProps(bar, { padding: `${GALLERY_BAR_TOP} ${sides.right ? inset : ZERO} ${ZERO} ${sides.left ? inset : ZERO}` });
762
765
  phone(bar, { padding: `${GALLERY_BAR_TOP} ${ZERO} ${ZERO} ${ZERO}` });
763
766
  }
764
767
  if (lc.held) gap(ctx, LayoutGapCode.StageSlider, lc.path, 'played by the Scene\'s driver, which plays any slider on its stage (vectoriox/iox-ui#54)');
@@ -797,9 +800,30 @@ function listOfLayer(l: LayoutLayer, ctx: Ctx): LayoutListBinding | null {
797
800
  return g?.list && g.source ? ctx.listOf(g.source) : null;
798
801
  }
799
802
 
800
- /** How many columns a grid of items takes in a cell `span` columns wide: three across most of the page, fewer in less room. */
801
- function listColumns(span: number): number {
802
- return span >= 9 ? 3 : span >= 5 ? 2 : 1;
803
+ /** Award §0c CW2 (AW-D38, amended 2026-11-23 — Doron: half the contained column holds TWO pictures, not one): the least an
804
+ * item of a grid may stand at the check's laptop — a picture item, a words-only one. The ONE table: the contract's
805
+ * `layout.limits.listItemMinPx` (layout.mjs LIMITS), which build-spec's column gate holds every look to. */
806
+ export const LIST_ITEM_MIN_PX: Readonly<{ picture: number; words: number }> = SPEC_SITE_LAYOUT.limits.listItemMinPx;
807
+ const pxOf = (value: unknown): number => parseFloat(String(value ?? '')) || 0;
808
+
809
+ /**
810
+ * How many columns a grid of items takes in a cell `span` columns wide: three across most of the page, fewer in less
811
+ * room. On a page in a column (award §0c CW2, AW-D38) the count is also judged in px of the COLUMN at the check's laptop
812
+ * (1440): the most items that each keep their least (`LIST_ITEM_MIN_PX`: 280px a picture item, 240px words only) — contained keeps three
813
+ * across, narrow gives two pictures. Wide stays as it was (the span alone).
814
+ */
815
+ export function listColumns(span: number, columnPx: number | null = null, picture = true, density?: string): number {
816
+ const most = span >= 9 ? 3 : span >= 5 ? 2 : 1;
817
+ if (columnPx === null) return most;
818
+ const width = LAYOUT_CHECK_VIEWPORT.width;
819
+ const room = (SPEC_AXES.densities as Readonly<Record<string, Readonly<Record<string, string>>>>)[String(density)] ?? SPEC_AXES.densities.regular;
820
+ const grid = layoutGridPx(width, columnPx, pxOf(room['space-gutter']));
821
+ const g = layoutGapPx(width);
822
+ const cell = (span * (grid - (GRID_COLUMNS - 1) * g)) / GRID_COLUMNS + Math.max(0, span - 1) * g;
823
+ const gap = pxOf(room['space-gap']);
824
+ const least = picture ? LIST_ITEM_MIN_PX.picture : LIST_ITEM_MIN_PX.words;
825
+ for (let n = most; n > 1; n--) if ((cell - (n - 1) * gap) / n >= least) return n;
826
+ return 1;
803
827
  }
804
828
 
805
829
  /** An item's way in, as the ONE interaction runtime plays it: together, one after another, or sliding in from the side
@@ -1020,7 +1044,7 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
1020
1044
 
1021
1045
  const items = create(`${id}-items`, 'Repeater', {}, 'box');
1022
1046
  items.bindings.push({ prop: 'source', source, path: '' });
1023
- const columns = listColumns((l.col?.[1] ?? 13) - (l.col?.[0] ?? 1));
1047
+ const columns = listColumns((l.col?.[1] ?? 13) - (l.col?.[0] ?? 1), ctx.columnPx, !!list.roles['image'], ctx.design?.density);
1024
1048
  if (masonry) {
1025
1049
  // A wall: CSS columns over the rows (iox-design.css), as many as the room holds — never a breakpoint, so the
1026
1050
  // canvas's frame and the live page agree; `two-up` keeps two on a phone.
@@ -1060,6 +1084,10 @@ export interface ListFrameInput {
1060
1084
  readonly col?: readonly [number, number];
1061
1085
  /** Where the gaps are said (`sections[i].layers[j]`). */
1062
1086
  readonly path?: string;
1087
+ /** Award §0c CW2: the page's column word and the look's Spacing — a grid's item count is judged in px of the column
1088
+ * (`listColumns`). Absent: wide, as before. */
1089
+ readonly column?: string;
1090
+ readonly density?: string;
1063
1091
  }
1064
1092
 
1065
1093
  /** A recomposed list frame, and what the composer said while composing it (a word drawn as its stand-in…). */
@@ -1089,6 +1117,7 @@ export function composeListFrame(input: ListFrameInput, previous?: SerializedNod
1089
1117
  p: id, site, rtl: layoutRtl(input.locale), mode: LayoutColourMode.Light, pace,
1090
1118
  ease: LAYOUT_EASING[(input.motion?.ease ?? LayoutEase.Out) as LayoutEase] ?? LAYOUT_EASING[LayoutEase.Out],
1091
1119
  sections: {}, gaps: [], links: [], headingSeen: false, carry: new Map(), keptArrangement: [],
1120
+ columnPx: layoutColumnPx(input.column, input.density), design: input.density ? { density: input.density } : undefined,
1092
1121
  listOf: () => input.list, sourceFields: () => null, photoSrc: () => '', photoAlt: () => '', photoAspect: () => LAYOUT_PHOTO_ASPECT[LayoutPhotoShape.Landscape],
1093
1122
  } as unknown as Ctx;
1094
1123
  const col = input.col ?? [1, 13];
@@ -1675,14 +1704,6 @@ export function readyMadeColumn(neighbour: LayoutSection | null): number {
1675
1704
  return Math.min(READY_MADE_MAX_COLUMN, Math.max(1, starts.length ? Math.min(...starts) : 1));
1676
1705
  }
1677
1706
 
1678
- /** Where column `n` starts from the page's edge, on the composed sections' own grid (`gridLayout`): the gutter, then
1679
- * n - 1 columns and their gaps. */
1680
- function columnInset(n: number): string {
1681
- if (n <= 1) return LAYOUT_GUTTER;
1682
- const column = `((100% - 2 * ${LAYOUT_GUTTER} - ${GRID_COLUMNS - 1} * ${LAYOUT_COLUMN_GAP}) / ${GRID_COLUMNS} + ${LAYOUT_COLUMN_GAP})`;
1683
- return `calc(${LAYOUT_GUTTER} + ${n - 1} * ${column})`;
1684
- }
1685
-
1686
1707
  /** A pattern that paints its own ground — a Scene, or a picture behind its words — keeps its colours. */
1687
1708
  function paintsItsOwnGround(root: SerializedNode): boolean {
1688
1709
  return root.role === SceneRole.Scene || (root.children ?? []).some(c => c.styleProps?.['position'] === 'absolute');
@@ -1697,8 +1718,8 @@ function paintsItsOwnGround(root: SerializedNode): boolean {
1697
1718
  */
1698
1719
  function dressReadyMade(root: SerializedNode, ground: string | null, column: number): void {
1699
1720
  if (root.styleProps?.['padding'] === PATTERN_SECTION_PAD) {
1700
- setStyleProps(root, { padding: `${PATTERN_SECTION_SPACE} ${columnInset(column)}` });
1701
- phone(root, { padding: `${PATTERN_SECTION_SPACE} ${LAYOUT_GUTTER}` });
1721
+ setStyleProps(root, { padding: `${PATTERN_SECTION_SPACE} ${layoutColumnStart(column)}` });
1722
+ phone(root, { padding: `${PATTERN_SECTION_SPACE} ${LAYOUT_INSET}` });
1702
1723
  }
1703
1724
  if (ground === null || paintsItsOwnGround(root)) return;
1704
1725
  setColorScheme(root, ColorScheme.Default);
@@ -1770,6 +1791,8 @@ export function composeLayout(site: LayoutSite, options: ComposeLayoutOptions):
1770
1791
  sections: {},
1771
1792
  gaps: [],
1772
1793
  design: options.design ?? layoutDesignOf(site.look?.preset, options.mode),
1794
+ // The page's word, else the design's when one is given (a layout composed with no design keeps today's wide).
1795
+ columnPx: layoutColumnPx(layoutColumnWord(site.column, options.design), options.design?.density),
1773
1796
  photoSrc: options.photoSrc,
1774
1797
  photoAlt: options.photoAlt ?? (() => ''),
1775
1798
  photoAspect: id => LAYOUT_PHOTO_ASPECT[(options.photoShape?.(id) ?? LayoutPhotoShape.Landscape) as LayoutPhotoShape] ?? LAYOUT_PHOTO_ASPECT[LayoutPhotoShape.Landscape],