@vectoriox/iox-ui 5.199.0 → 5.201.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 (51) hide show
  1. package/design-core/index.d.ts +454 -52
  2. package/fesm2022/vectoriox-iox-ui-design-core.mjs +640 -55
  3. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  4. package/fesm2022/vectoriox-iox-ui-forms-core.mjs +5 -2
  5. package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
  6. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1062 -177
  7. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  8. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +441 -63
  9. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  10. package/fesm2022/vectoriox-iox-ui.mjs +5 -2
  11. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  12. package/generation-core/index.d.ts +473 -124
  13. package/harness-core/index.d.ts +282 -6
  14. package/package.json +1 -1
  15. package/src/design-core/brand-neutrals.ts +125 -3
  16. package/src/design-core/colour-words.ts +48 -0
  17. package/src/design-core/design-settings.ts +24 -5
  18. package/src/design-core/design-token.model.ts +8 -0
  19. package/src/design-core/flavor-fixtures.generated.ts +272 -2
  20. package/src/design-core/flavor-spec.generated.ts +310 -40
  21. package/src/design-core/flavor-tokens.ts +5 -1
  22. package/src/design-core/public-api.ts +2 -0
  23. package/src/design-core/signature-move.ts +107 -0
  24. package/src/design-core/style-presets.ts +9 -3
  25. package/src/design-core/token-css.ts +59 -1
  26. package/src/forms-core/form-presets.ts +5 -2
  27. package/src/generation-core/body-mix.ts +41 -0
  28. package/src/generation-core/check-layout.ts +17 -7
  29. package/src/generation-core/colour-mix.ts +53 -3
  30. package/src/generation-core/compose-site.ts +136 -32
  31. package/src/generation-core/composition.ts +320 -0
  32. package/src/generation-core/footer-mix.ts +43 -3
  33. package/src/generation-core/footer-sign-up.ts +51 -0
  34. package/src/generation-core/header-edit.ts +15 -0
  35. package/src/generation-core/header-mix.ts +128 -19
  36. package/src/generation-core/opening-edit.ts +17 -3
  37. package/src/generation-core/opening-mix.ts +69 -5
  38. package/src/generation-core/plan-wire.ts +22 -5
  39. package/src/generation-core/public-api.ts +2 -0
  40. package/src/generation-core/site-build-run.ts +3 -0
  41. package/src/generation-core/site-plan.model.ts +3 -0
  42. package/src/generation-core/site-spec.generated.ts +250 -104
  43. package/src/generation-core/type-led.ts +4 -2
  44. package/src/generation-core/validate-site-plan.ts +2 -1
  45. package/src/harness-core/business-types.ts +27 -0
  46. package/src/harness-core/harness-spec.generated.ts +405 -56
  47. package/src/harness-core/motion.ts +19 -2
  48. package/src/harness-core/run-compose-context.ts +9 -3
  49. package/src/harness-core/starting-design.ts +15 -7
  50. package/styles/iox-design.css +10 -0
  51. package/styles/iox-forms.css +53 -0
@@ -4,11 +4,12 @@ import {
4
4
  } from '@vectoriox/iox-ui/design-core';
5
5
 
6
6
  import { menuCollectionsOfPlan, ShelfPlan } from './menu-shelves';
7
- import { MenuSide, NavRole, NavShape } from './nav-shape';
7
+ import { BAR_ITEMS_MAX, MenuSide, NavRole, NavShape } from './nav-shape';
8
8
  import { OpeningMixError, openingMixOfPlan, OpeningRole } from './opening-mix';
9
9
  import { calmUnder, PhotoInventory } from './photo-inventory';
10
10
  import { PatternGlobalPosition, PatternNode, SITE_PATTERNS, SitePattern } from './patterns';
11
11
  import { planSells, ShopSourceRole, shopSourceAliases } from './shop-plan';
12
+ import { GenerationTier } from './site-plan.model';
12
13
  import { SPEC_SITE_HEADER_PARTS, SPEC_SITE_LAYOUT } from './site-spec.generated';
13
14
 
14
15
  /**
@@ -296,6 +297,14 @@ export enum HeaderRepairCode {
296
297
  NoLogo = 'no-logo',
297
298
  /** HI3-D25: a kind of business that keeps its header plain never takes islands or a late name. */
298
299
  TypeNeverShape = 'type-never-shape',
300
+ /** HI-D Pro (Doron 2026-11-29): a Pro site's header floats — a pill or islands on the look's glass (`proHeader`). */
301
+ ProFloats = 'pro-floats',
302
+ /** HI-D Pro: a Pro site's phone has the bottom bar (`both` — the bar and a More — when its pages outnumber the bar). */
303
+ ProPhoneBar = 'pro-phone-bar',
304
+ /** HI-D Pro: a Pro site keeps the drawer on a phone only for a stated reason (a shelf menu, pages too many for the bar). */
305
+ ProPhoneMenu = 'pro-phone-menu',
306
+ /** HI-D Pro: a floating header carries one button where the site has a contact page to send it to. */
307
+ ProButton = 'pro-button',
299
308
  /** HI2: pictured cards stand in a top panel, a full screen or a mega panel — never a drawer or a card: the page names. */
300
309
  PicturesForm = 'pictures-form',
301
310
  /** HI2: pictured cards need the site's main collections with pictures (`menuPicturesMin`): the page names. */
@@ -350,6 +359,9 @@ export interface HeaderContext {
350
359
  /** HI2: the site's main collections with pictures (`menuCollectionsOfPlan`), in the navigation's order — what a
351
360
  * `pictures` menu shows a card for. Absent: not judged. */
352
361
  readonly collections?: ReadonlyArray<HeaderPage>;
362
+ /** HI-D Pro (Doron 2026-11-29): the generation's tier. On Pro (`award`) a floating header stands on any home — HI3-D25's
363
+ * "only over a full picture" is the Basic generator's rule. Absent: Basic. */
364
+ readonly tier?: `${GenerationTier}` | null;
353
365
  }
354
366
 
355
367
  const RULES = H.rules as unknown as Readonly<{
@@ -434,10 +446,13 @@ function mendShape(m: HeaderMix, ctx: HeaderContext, say: (code: HeaderRepairCod
434
446
  if (m.brand === HeaderBrand.Later) m.brand = HeaderBrand.Fits;
435
447
  say(HeaderRepairCode.TypeNeverShape, 'this kind of business keeps its header plain: one bar, the name always in it');
436
448
  }
437
- if ((floats() || m.brand === HeaderBrand.Later) && ctx.opening !== undefined && !opensOnPicture(ctx.opening)) {
438
- m.shape = HeaderShape.Bar;
449
+ // HI-D Pro: on Pro a floating header needs no picture under it (it always stands on its ground, R-H-S1); a late name does.
450
+ const floatNeedsPicture = floats() && ctx.tier !== GenerationTier.Award;
451
+ if ((floatNeedsPicture || m.brand === HeaderBrand.Later) && ctx.opening !== undefined && !opensOnPicture(ctx.opening)) {
452
+ if (floatNeedsPicture) m.shape = HeaderShape.Bar;
439
453
  if (m.brand === HeaderBrand.Later) m.brand = HeaderBrand.Fits;
440
- say(HeaderRepairCode.FloatPlain, 'the home page does not open on a full picture: the header is a bar, its name in it from the top');
454
+ say(HeaderRepairCode.FloatPlain, floatNeedsPicture ? 'the home page does not open on a full picture: the header is a bar, its name in it from the top'
455
+ : 'the home page does not open on a full picture: the name is in the bar from the top');
441
456
  }
442
457
  if (m.shape === HeaderShape.Islands && (m.arrange === HeaderArrange.Centred || m.arrange === HeaderArrange.Between)) {
443
458
  m.shape = HeaderShape.Pill;
@@ -475,6 +490,58 @@ export function opensOnPicture(opening: HeaderOpening | null | undefined): boole
475
490
  return !!opening && RULES.overFrames.includes(opening.frame) && RULES.overMedia.includes(opening.media);
476
491
  }
477
492
 
493
+ // ── HI-D Pro: a Pro site's header floats, and its phone has the bottom bar ──────────────────────────────────────────────
494
+
495
+ const CONTACT_ROUTE = '/contact';
496
+
497
+ /**
498
+ * HI-D Pro (Doron, 2026-11-29: "solid header is not for PRO, the floating header with the nice design shall be almost part
499
+ * of every generated pro site" + "I didn't see yet bottom bar navigation on mobile"). A Pro site's header, from its plan's
500
+ * mix (or its stored header), made into a FLOATING one at compose time — so a rebuild from a kept plan wears it, no model
501
+ * call:
502
+ * - the outline: a full-width bar becomes islands where the name stands at the start (split, name-and-menu — daylight's
503
+ * logo tile + pill) and one pill where it is centred (allerstudio's floating pill); a chosen pill or islands is kept;
504
+ * `checkHeader` then makes islands a pill for a kind of business that keeps its header plain (HI3-D18/D25);
505
+ * - the ground: the look's glass (its own outlined bar in Pop, HI3-D2), no scroll edge (HI3-D20) — over a picture opening
506
+ * it gives its height back, so the picture starts at the top of the page (HI3-D7/D17);
507
+ * - one button where the site has a contact page to send it to;
508
+ * - the phone: the BOTTOM BAR — its pages come out of the menu into the bar when they fit on a laptop, the bar holds Home
509
+ * and up to four pages (`bar`) or four and a More (`both`). The drawer alone stays only with its reason said: the menu
510
+ * is a shelf (pictures, big names, words and a card — HI2), or the pages are too many for the bar on a laptop.
511
+ * Each change is said. The Basic tier never asks it (its bar stays the full-width solid one). Pure.
512
+ */
513
+ export function proHeader(mix: HeaderMix, ctx: HeaderContext): { mix: HeaderMix; repairs: HeaderRepair[] } {
514
+ const m = { ...mix };
515
+ const repairs: HeaderRepair[] = [];
516
+ const say = (code: HeaderRepairCode, said: string) => repairs.push({ code, said });
517
+ if (!headerShapeFloats(m.shape)) {
518
+ m.shape = m.arrange === HeaderArrange.Split || m.arrange === HeaderArrange.NameOnly ? HeaderShape.Islands : HeaderShape.Pill;
519
+ if (m.ground === HeaderGround.Solid) m.ground = lookHasGlass(ctx.design) ? HeaderGround.Glass : HeaderGround.Solid;
520
+ m.edge = 'none';
521
+ say(HeaderRepairCode.ProFloats, `a Pro site's header floats: ${m.shape === HeaderShape.Islands ? 'its parts as islands' : 'one pill'} on the look's ${lookHasGlass(ctx.design) ? 'glass' : 'own bar'}`);
522
+ }
523
+ if (m.action === HeaderAction.None && ctx.pages.some(p => p.route === CONTACT_ROUTE)) {
524
+ m.action = HeaderAction.Button;
525
+ say(HeaderRepairCode.ProButton, 'a floating header carries one button, to the contact page');
526
+ }
527
+ if (behindMenu(m) && menuShowsOf(m.menuShows) !== MenuShows.Links) {
528
+ say(HeaderRepairCode.ProPhoneMenu, 'the menu is a shelf: the phone opens it from the menu button');
529
+ return { mix: m, repairs };
530
+ }
531
+ if (behindMenu(m)) {
532
+ const inline = { ...m, pages: HeaderPages.Inline, arrange: m.arrange === HeaderArrange.NameOnly ? HeaderArrange.Split : m.arrange };
533
+ if (barWidthPx(inline, ctx) > RULES.inlineRoomPx) {
534
+ say(HeaderRepairCode.ProPhoneMenu, `${ctx.pages.length} pages do not fit in the bar on a laptop: the phone opens them from the menu`);
535
+ return { mix: m, repairs };
536
+ }
537
+ Object.assign(m, { pages: inline.pages, arrange: inline.arrange });
538
+ }
539
+ // Home and the pages: a bar holds them all, or four and a More (nav-shape BAR_ITEMS_MAX).
540
+ m.phone = ctx.pages.length + 1 <= BAR_ITEMS_MAX ? 'bar' : 'both';
541
+ say(HeaderRepairCode.ProPhoneBar, m.phone === 'bar' ? 'on a phone the pages stand in the bottom bar' : 'on a phone the bottom bar holds four pages and a More');
542
+ return { mix: m, repairs };
543
+ }
544
+
478
545
  /** HI3-D5: what an over header stands on when its words do not read over the opening — the look's glass from the top,
479
546
  * or its own solid bar in a look with no glass (Pop). The ONE answer `checkHeader` and a build's late mend share. */
480
547
  export function headerGroundWhenUnreadable(design: Pick<DesignChoices, 'flavorId'>): HeaderGround {
@@ -766,14 +833,42 @@ export function headerRecipe(mix: HeaderMix, ctx: HeaderContext): HeaderRecipe {
766
833
  // ── No sameness: another site's header is never worn again (§7, R-H2) ──────────────────────────────────────────────
767
834
 
768
835
  /** The ingredients `distinctHeader` may change, in the order it tries them: how the pages are reached before where the
769
- * name sits (the model chose the arrangement; the fingerprint sees both). */
770
- const MEND_ORDER: ReadonlyArray<HeaderIngredient.Pages | HeaderIngredient.Arrange | HeaderIngredient.Reveal | HeaderIngredient.Button> = [
836
+ * name sits (the model chose the arrangement; the fingerprint sees both), then the bar's outline, its ground and its menu
837
+ * (the J10 header proof, 2026-11-29: with only those two before the menu's opening and button, seven of twelve sites came
838
+ * out the same bar at rest, "distinct" by a reveal nobody sees until the menu opens). */
839
+ const MEND_ORDER: ReadonlyArray<HeaderIngredient.Pages | HeaderIngredient.Arrange | HeaderIngredient.Shape | HeaderIngredient.Ground
840
+ | HeaderIngredient.Menu | HeaderIngredient.Reveal | HeaderIngredient.Button> = [
771
841
  HeaderIngredient.Pages, HeaderIngredient.Arrange,
772
- // HB-D6: how the menu opens and its button are in the fingerprint — the least visible change of all, tried after the
773
- // two the model chose with the site in mind.
842
+ // What a visitor sees at rest or on the first tap: the outline (bar · pill · islands), the ground (over the opening,
843
+ // glass) and the menu's form (a full screen, a top panel, a card — a shelf). Each is judged by `checkHeader` as any
844
+ // other: a float only over a full picture, a ground the kind of business allows, glass only in a look that has it.
845
+ HeaderIngredient.Shape, HeaderIngredient.Ground, HeaderIngredient.Menu,
846
+ // HB-D6: how the menu opens and its button are in the fingerprint — the least visible change of all, tried last.
774
847
  HeaderIngredient.Reveal, HeaderIngredient.Button,
775
848
  ];
776
849
 
850
+ /** The fingerprint's ingredients a visitor sees only once the menu opens — two headers that differ in these alone are the
851
+ * same header at rest. */
852
+ const UNSEEN_AT_REST: ReadonlySet<string> = new Set([HeaderIngredient.Reveal, HeaderIngredient.Button]);
853
+
854
+ /** A header token without what is unseen at rest: `header:centred/menu/drawer/solid/bar/none` for every reveal and
855
+ * button — and with its pages in the bar, no menu either (the menu's form is never seen on a laptop). */
856
+ export function headerRestTokenOf(mix: HeaderMix): string {
857
+ return restOfToken(headerTokenOf(mix));
858
+ }
859
+
860
+ /** A token read back at rest (`headerRestTokenOf` on a taken token). */
861
+ function restOfToken(token: string): string {
862
+ const keys = H.fingerprint as ReadonlyArray<string>;
863
+ const words = token.replace(`${HEADER_TOKEN}:`, '').split('/');
864
+ const inline = words[keys.indexOf(HeaderIngredient.Pages)] === HeaderPages.Inline;
865
+ return `${HEADER_TOKEN}:${words.map((w, i) => (inline && keys[i] === HeaderIngredient.Menu ? '-' : w)).filter((_, i) => !UNSEEN_AT_REST.has(keys[i])).join('/')}`;
866
+ }
867
+
868
+ /** What a mend may bring with it and still be the mend it was: a floating or glass header draws no edge under it, and a
869
+ * look whose own bar is glass stands on glass — consequences of the outline or ground chosen, said by `checkHeader`. */
870
+ const MEND_CONSEQUENCES: ReadonlySet<string> = new Set([HeaderRepairCode.FloatEdge, HeaderRepairCode.GlassEdge, HeaderRepairCode.GlassOwnBar]);
871
+
777
872
  /** The words of an ingredient the product draws. */
778
873
  const drawnWords = (k: `${HeaderIngredient}`): string[] => headerWords(k).filter(w => !WAITS[`${k}.${w}`]);
779
874
 
@@ -782,18 +877,22 @@ const drawnWords = (k: `${HeaderIngredient}`): string[] => headerWords(k).filter
782
877
  * ingredient before two, in `MEND_ORDER` — that the site can carry as it is (`checkHeader` mends nothing), and said. When
783
878
  * every header is worn, the mix as it is. Pure, deterministic.
784
879
  */
785
- export function distinctHeader(mix: HeaderMix, taken: ReadonlyArray<string>, ctx: HeaderContext): { mix: HeaderMix; repairs: HeaderRepair[] } {
880
+ export function distinctHeader(mix: HeaderMix, taken: ReadonlyArray<string>, ctx: HeaderContext,
881
+ accept: (m: HeaderMix) => boolean = () => true): { mix: HeaderMix; repairs: HeaderRepair[] } {
786
882
  const used = new Set(taken);
787
- if (!used.has(headerTokenOf(mix))) return { mix, repairs: [] };
883
+ const usedAtRest = new Set(taken.map(restOfToken));
884
+ const free = (m: HeaderMix) => !used.has(headerTokenOf(m));
885
+ const freeAtRest = (m: HeaderMix) => free(m) && !usedAtRest.has(headerRestTokenOf(m));
886
+ if (freeAtRest(mix)) return { mix, repairs: [] };
788
887
  const tries: HeaderMix[] = [];
789
888
  for (const k of MEND_ORDER) for (const w of drawnWords(k)) tries.push({ ...mix, [k]: w });
790
889
  for (const w of drawnWords(HeaderIngredient.Pages)) for (const a of drawnWords(HeaderIngredient.Arrange)) tries.push({ ...mix, pages: w, arrange: a });
791
- for (const t of tries) {
792
- const checked = checkHeader(t, ctx);
793
- if (checked.repairs.length || used.has(headerTokenOf(checked.mix))) continue;
794
- return { mix: checked.mix, repairs: [{ code: HeaderRepairCode.Worn, said: `another site wears ${headerTokenWords(headerTokenOf(mix))}: this one is ${headerTokenWords(headerTokenOf(checked.mix))}` }] };
795
- }
796
- return { mix, repairs: [] };
890
+ const carried = tries.map(t => checkHeader(t, ctx)).filter(c => c.repairs.every(r => MEND_CONSEQUENCES.has(r.code)) && accept(c.mix)).map(c => c.mix);
891
+ // A header no other site wears AT REST first; when every such one is taken (or the site carries none), one that differs
892
+ // at least in how its menu opens — and a mix already free that way stays as the model chose it.
893
+ const found = carried.find(freeAtRest) ?? (free(mix) ? null : carried.find(free));
894
+ if (!found) return { mix, repairs: [] };
895
+ return { mix: found, repairs: [{ code: HeaderRepairCode.Worn, said: `another site wears ${headerTokenWords(headerTokenOf(mix))}: this one is ${headerTokenWords(headerTokenOf(found))}` }] };
797
896
  }
798
897
 
799
898
  type HeaderPlan = ShelfPlan & {
@@ -814,6 +913,8 @@ export function shopPageOfPlan(plan: HeaderPlan): string | null {
814
913
  export interface HeaderFacts {
815
914
  readonly never?: HeaderNever | null;
816
915
  readonly readableAtRest?: boolean | null;
916
+ /** HI-D Pro: the generation's tier (the compose context's) — a Pro site's header floats (`proHeader`). Absent: Basic. */
917
+ readonly tier?: `${GenerationTier}` | null;
817
918
  }
818
919
 
819
920
  /** HI3-D12: the plan's home opening as the header reads it — null when the plan names none (or one the table lacks). */
@@ -839,6 +940,7 @@ export function headerContextOfPlan(plan: HeaderPlan, shop?: string | null, fact
839
940
  collections: menuCollectionsOfPlan(plan).map(c => ({ name: c.label, route: c.route })),
840
941
  ...(facts.never ? { never: facts.never } : {}),
841
942
  ...(facts.readableAtRest !== undefined && facts.readableAtRest !== null ? { readableAtRest: facts.readableAtRest } : {}),
943
+ ...(facts.tier ? { tier: facts.tier } : {}),
842
944
  };
843
945
  }
844
946
 
@@ -851,8 +953,11 @@ export function wornHeaderOfPlan(plan: HeaderPlan & { readonly globals?: Readonl
851
953
  facts: HeaderFacts = {}): { mix: HeaderMix; context: HeaderContext; said: string[] } {
852
954
  const context = headerContextOfPlan(plan, undefined, facts);
853
955
  const { drawn, gaps } = drawnHeaderMix(headerMixOfPlan(plan));
854
- const checked = plan.mixes?.header?.length ? checkHeader(drawn, context) : { mix: drawn, repairs: [] };
855
- const said = [...gaps.map(g => `the header's ${g.ingredient} "${g.word}" is drawn as "${g.drawnAs}" until ${g.phase}`), ...checked.repairs.map(r => r.said)];
956
+ // HI-D Pro: a Pro site's header is a floating mix with the phone's bottom bar — its plan's mix (or stored header) made so.
957
+ const pro = context.tier === GenerationTier.Award ? proHeader(drawn, context) : null;
958
+ const checked = plan.mixes?.header?.length || pro ? checkHeader(pro?.mix ?? drawn, context) : { mix: drawn, repairs: [] };
959
+ const said = [...gaps.map(g => `the header's ${g.ingredient} "${g.word}" is drawn as "${g.drawnAs}" until ${g.phase}`),
960
+ ...(pro?.repairs ?? []).map(r => r.said), ...checked.repairs.map(r => r.said)];
856
961
  return { mix: checked.mix, context, said };
857
962
  }
858
963
 
@@ -862,7 +967,11 @@ export function withDistinctHeader<P extends HeaderPlan & {
862
967
  readonly globals?: Readonly<Record<string, string>>; readonly mixes?: { readonly header?: ReadonlyArray<string>; readonly footer?: ReadonlyArray<string> };
863
968
  }>(plan: P, taken: ReadonlyArray<string>, facts: HeaderFacts = {}): { plan: P; repairs: HeaderRepair[] } {
864
969
  const worn = wornHeaderOfPlan(plan, facts);
865
- const done = distinctHeader(worn.mix, taken, worn.context);
970
+ // HI-D Pro: a Pro site's header is mended within the floating ones — only to a mix the Pro rule wears as it is (so the
971
+ // composer, which asks `proHeader` again, keeps the mend).
972
+ const ctx = worn.context;
973
+ const keptByPro = (m: HeaderMix) => headerTokenOf(checkHeader(proHeader(m, ctx).mix, ctx).mix) === headerTokenOf(m);
974
+ const done = distinctHeader(worn.mix, taken, ctx, ctx.tier === GenerationTier.Award ? keptByPro : undefined);
866
975
  if (!done.repairs.length) return { plan, repairs: [] };
867
976
  return { plan: { ...plan, mixes: { ...(plan.mixes ?? {}), header: headerMixWords(done.mix) } }, repairs: done.repairs };
868
977
  }
@@ -43,11 +43,25 @@ const ROW_ROLES: Readonly<Record<OpeningIngredient, ReadonlyArray<string>>> = {
43
43
  /** The props that are the owner's CONTENT (words, pictures, a film, a form's identity) — never a sign of a hand edit. */
44
44
  const CONTENT_PROPS: ReadonlyArray<string> = [OPENING_MIX_PROP, 'src', 'poster', 'frames', 'formId', 'name'];
45
45
 
46
+ /** A title the composer sets to its words (type scale `openingDisplaySize`, a display name's fit) wears a size the words
47
+ * decide: re-typed words are content, so that size is never a sign of a hand edit. A title at the look's token is read. */
48
+ const WORD_SIZED = /^(clamp|min)\(/;
49
+ function withoutWordSize(n: SerializedNode): SerializedNode {
50
+ if (n.role !== OpeningRole.Title || !WORD_SIZED.test(String(n.styleProps?.['fontSize'] ?? ''))) return n;
51
+ const { fontSize: _size, ...styleProps } = n.styleProps;
52
+ const mobile = (n.responsive as Record<string, { styleProps?: Record<string, unknown> }> | undefined)?.['mobile'];
53
+ const responsive = mobile?.styleProps && 'fontSize' in mobile.styleProps
54
+ ? { ...n.responsive, mobile: { ...mobile, styleProps: Object.fromEntries(Object.entries(mobile.styleProps).filter(([k]) => k !== 'fontSize')) } }
55
+ : n.responsive;
56
+ return { ...n, styleProps, ...(responsive ? { responsive } : {}) } as SerializedNode;
57
+ }
58
+
46
59
  /** A part's shape without its content: what it is made of and what it wears. */
47
60
  function partShape(node: SerializedNode): string {
48
- const strip = (n: SerializedNode): SerializedNode => ({
49
- ...n, props: Object.fromEntries(Object.entries(n.props ?? {}).filter(([k]) => !CONTENT_PROPS.includes(k))), children: (n.children ?? []).map(strip),
50
- });
61
+ const strip = (n: SerializedNode): SerializedNode => {
62
+ const own = withoutWordSize(n);
63
+ return { ...own, props: Object.fromEntries(Object.entries(own.props ?? {}).filter(([k]) => !CONTENT_PROPS.includes(k))), children: (own.children ?? []).map(strip) };
64
+ };
51
65
  return headerShape(strip(node));
52
66
  }
53
67
 
@@ -1,4 +1,4 @@
1
- import { DesignChoices, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
1
+ import { DesignChoices, designTokenRows, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
2
2
 
3
3
  import { LAYOUT_INSET } from './layout-column';
4
4
  import { GenerationTier } from './site-plan.model';
@@ -48,6 +48,8 @@ interface OpeningTable {
48
48
  wordsNeverCut: boolean; phoneInsetPx: readonly [number, number]; slowZoomMinS: number; badgeOwnersOnly: boolean; neverHoldsScroll: boolean;
49
49
  /** AW9 `motion.dissolve`: the picture's last scale, the words' last scale, and the share of the exit the words take. */
50
50
  dissolve: { grow: number; wordsGrow: number; wordsUntil: number };
51
+ /** Type scale: the opening's headline set to its words (`openingDisplaySize`). */
52
+ display: { capBody: number; lines: number; phoneLines: number; roomPx: number; fill: number; screenShare: number; phoneScreenShare: number };
51
53
  };
52
54
  tiers: Readonly<Record<string, 'all' | 'pro'>>;
53
55
  references: ReadonlyArray<{ id: string; after: string; added: string; mix: Partial<Record<string, string | ReadonlyArray<string>>> }>;
@@ -523,6 +525,62 @@ function nameFits(ctx: OpeningContext, oneLine: boolean): boolean {
523
525
  return laptopOk && (PHONE_PX - 2 * PHONE_SIDE_PX) / longest >= MIN_PHONE_DISPLAY_PX;
524
526
  }
525
527
 
528
+ /** The laptop and phone the opening's display is set for (the reference cards' screens). */
529
+ const LAPTOP_SCREEN_H = 900;
530
+ const PHONE_SCREEN_H = 844;
531
+ /** The phone's frame padding beside the words (FRAME_PAD at 375) and a panel's padding when the look names none (px). */
532
+ const PHONE_FRAME_PX = 20;
533
+ const PANEL_PAD_PX = 32;
534
+ const PX = /^(\d+(?:\.\d+)?)px$/;
535
+ const CLAMP_PX = /^clamp\((\d+(?:\.\d+)?)px,.*?,\s*(\d+(?:\.\d+)?)px\)$/;
536
+
537
+ /** The opening's headline set to its words (contract OPENING.rules.display): the size on each screen and its CSS. */
538
+ export interface OpeningDisplaySize {
539
+ laptopPx: number;
540
+ phonePx: number;
541
+ fontSize: string;
542
+ }
543
+
544
+ /**
545
+ * Type scale (the 2026-11-28 reference baseline, gap #3): the opening's headline, set to ITS words on the look's own face
546
+ * rather than the look's one display size — so a short headline stands as the references' do (9–22× the body) and a long
547
+ * one stays inside its lines. The largest size that keeps (contract `rules.display`): ≤ `capBody` × body; ≤ `lines` lines
548
+ * across the words' room (a wrapped line filled to `fill`); the longest word on one line; the lines within `screenShare`
549
+ * of the screen — on a 1440 × 900 laptop, and with the phone's own lines and share on a 375 × 844 phone; fluid between
550
+ * (`cqi`, as the look's display token: the builder canvas reads its simulated width). Never below the look's display token
551
+ * on either screen: null when the words would stand no larger than it (the token stays). `panel` — the words stand in a
552
+ * scrim panel (its padding leaves less room). Pure.
553
+ */
554
+ export function openingDisplaySize(ctx: OpeningContext, panel: boolean): OpeningDisplaySize | null {
555
+ const R = O.rules.display;
556
+ const { line, longest } = nameEm(ctx);
557
+ if (!line || !longest) return null;
558
+ const rows = new Map(designTokenRows(ctx.design ?? resolveDesignChoices({})).map(r => [r.name, r.value]));
559
+ const body = Number(PX.exec(rows.get('size-body') ?? '')?.[1] ?? 16);
560
+ const token = CLAMP_PX.exec(rows.get('size-display') ?? '');
561
+ if (!token) return null;
562
+ const [tokenPhone, tokenLaptop] = [Number(token[1]), Number(token[2])];
563
+ const pad = panel ? Number(PX.exec(rows.get('space-pad') ?? '')?.[1] ?? PANEL_PAD_PX) : 0;
564
+ /** The largest size that keeps the words within `lines` lines of `room`, their longest word on one, the lines within
565
+ * `screen` px — never above the cap. */
566
+ const fitted = (room: number, lines: number, screen: number): number => {
567
+ let size = 0;
568
+ for (let n = 1; n <= lines; n++) {
569
+ const across = (room * n * (n === 1 ? FIT : R.fill)) / line;
570
+ size = Math.max(size, Math.min(R.capBody * body, across, (room * FIT) / longest, screen / n));
571
+ }
572
+ return Math.floor(size);
573
+ };
574
+ const laptop = fitted(Math.min(R.roomPx, LAPTOP_PX - 2 * LAPTOP_SIDE_PX) - 2 * pad, R.lines, R.screenShare * LAPTOP_SCREEN_H);
575
+ const phone = Math.min(laptop, fitted(PHONE_PX - 2 * PHONE_FRAME_PX - 2 * pad, R.phoneLines, R.phoneScreenShare * PHONE_SCREEN_H));
576
+ if (laptop <= tokenLaptop) return null;
577
+ // Never smaller than the token on a phone either: where the words would want less, the token's own size stands.
578
+ const phonePx = Math.max(phone, Math.min(tokenPhone, laptop));
579
+ const slope = ((laptop - phonePx) / (LAPTOP_PX - PHONE_PX)) * 100;
580
+ const intercept = phonePx - (slope / 100) * PHONE_PX;
581
+ return { laptopPx: laptop, phonePx, fontSize: `clamp(${phonePx}px, ${slope.toFixed(2)}cqi + ${intercept.toFixed(1)}px, ${laptop}px)` };
582
+ }
583
+
526
584
  /**
527
585
  * The ONE judge of an opening mix against the site: what the site cannot carry is mended to the nearest mix it can, and
528
586
  * each mend is said. Judges the mix as DRAWN (`drawnOpeningMix` first). Never throws on a well-formed mix. Pure.
@@ -614,6 +672,8 @@ export const SCRIM_WORDS_PAD = 'var(--iox-space-pad)';
614
672
  /** iox-ui#133 (AW-D41, one edge): a frame's words start on the content column every other section starts on — its inline
615
673
  * padding is never less than `space-inline`; the frame itself may bleed, its words do not. */
616
674
  const framePadding = (block: string): string => `${block} max(${block}, ${LAYOUT_INSET})`;
675
+ /** The opening's words column at the look's display size, and the reading measure of the line under a larger one. */
676
+ const WORDS_MAX = '760px';
617
677
  /** A display line is sized a little under its measured width, so a rounding never wraps it. */
618
678
  const FIT = 0.95;
619
679
 
@@ -805,11 +865,12 @@ function typeLedWordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[]
805
865
  return [apart, typeLedAside('bottom')];
806
866
  }
807
867
  default:
868
+ const sized = openingDisplaySize(ctx, false);
808
869
  return [{
809
870
  t: 'Container', es: 'box', role: OpeningRole.Words,
810
- lay: { ...OVER(1), display: 'flex', flexDirection: 'column', gap: '14px', maxWidth: '760px' },
871
+ lay: { ...OVER(1), display: 'flex', flexDirection: 'column', gap: '14px', maxWidth: sized ? `${O.rules.display.roomPx}px` : WORDS_MAX },
811
872
  enter: 'heroText',
812
- c: [eyebrowPart(), title({}), typeLedLead(), actionsPart()],
873
+ c: [eyebrowPart(), title(sized ? { fontSize: sized.fontSize } : {}), typeLedLead(sized ? { maxWidth: WORDS_MAX } : {}), actionsPart()],
813
874
  }];
814
875
  }
815
876
  }
@@ -866,11 +927,14 @@ function wordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[] {
866
927
  // iox-ui#157: the words stand IN a scrim panel (its fill is the scrim the picture made asks for), so the panel
867
928
  // keeps its inner space on every side — the look's own panel padding — and its button its own width (the
868
929
  // asides' rule): the heading, the line and the button touched the panel's edges, the button ran across it.
930
+ // Type scale: the headline set to its words (`openingDisplaySize`); the panel then makes room for it, and the line
931
+ // under it keeps a reading measure.
932
+ const sized = openingDisplaySize(ctx, true);
869
933
  return [{
870
934
  t: 'Container', es: 'media-scrim', role: OpeningRole.Words,
871
- lay: { ...OVER(1), display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: '14px', maxWidth: '760px', padding: SCRIM_WORDS_PAD },
935
+ lay: { ...OVER(1), display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: '14px', maxWidth: sized ? `min(${O.rules.display.roomPx}px, 100%)` : WORDS_MAX, padding: SCRIM_WORDS_PAD },
872
936
  enter: 'heroText',
873
- c: [title({}), lead(), action()],
937
+ c: [title(sized ? { fontSize: sized.fontSize } : {}), lead(sized ? { maxWidth: WORDS_MAX } : {}), action()],
874
938
  }];
875
939
  }
876
940
  }
@@ -8,6 +8,7 @@ import { DEFAULT_HEADER_PATTERN, HeaderIngredient, headerMeaning, headerMix, hea
8
8
  import { DEFAULT_FOOTER_PATTERN, FooterIngredient, footerMeaning, footerMix, footerMixFromWords, footerMixOfPlan, footerMixWords, footerPatternIdOf, footerWireWords, footerWords } from './footer-mix';
9
9
  import { openingHarnessWord, OpeningIngredient, openingMeaning, openingWireWords } from './opening-mix';
10
10
  import { BodyIngredient, bodyMeaning, bodyMix, bodyMixWords, bodyWireWords } from './body-mix';
11
+ import { ColourIngredient, colourMeaning, colourWireWords } from './colour-mix';
11
12
  import { POPUP_LINK_WORD, POPUP_WIRE_INGREDIENTS, popupMeaning, popupWireWords } from './popup-plan';
12
13
  import { shopCategoriesOf } from './shop-plan';
13
14
  import { ContentFieldControl, FIELD_TYPE_OF_CONTROL,
@@ -129,6 +130,8 @@ const HEADER_WIRE_TEXT = 'string[] — the header as ONE list of <ingredient>:<w
129
130
 
130
131
  /** The wire's `globals` key the site's body travels in (AW6) — every tier's since AW-D42. */
131
132
  const BODY_WIRE_KEY = 'body';
133
+ /** The plan's `mixes` key the body list's colour words go to (CV2). */
134
+ const COLOUR_MIX_KEY = 'colour';
132
135
 
133
136
  /** The body's words as the model reads them (AW6): each ingredient, the words a build may wear today and their meanings,
134
137
  * from the contract's body table. */
@@ -138,7 +141,17 @@ const BODY_WIRE_TEXT = "string[] — the site's body as ONE list of <ingredient>
138
141
  + 'sections wear different grounds; a calm business (care, advice) never wears a torn or dripping edge. '
139
142
  + Object.values(BodyIngredient).map(k => [k, bodyWireWords().filter(w => w.startsWith(`${k}:`)).map(w => w.slice(k.length + 1))] as const)
140
143
  .filter(([, words]) => words.length)
141
- .map(([k, words]) => `${k}: ${words.map(w => `${w} (${bodyMeaning(k, w)})`).join(' | ')}`).join('; ');
144
+ .map(([k, words]) => `${k}: ${words.map(w => `${w} (${bodyMeaning(k, w)})`).join(' | ')}`).join('; ')
145
+ // Colour v2 CV2: the site's colours ride the same list (+0 properties) and are split out into `mixes.colour`; one word per
146
+ // ingredient, an ingredient left out is the style preset's own.
147
+ + '. The same list carries the site\'s colours: '
148
+ + Object.values(ColourIngredient).map(k => [k, colourWireWords(GenerationTier.Award).filter(w => w.startsWith(`${k}:`)).map(w => w.slice(k.length + 1))] as const)
149
+ .filter(([, words]) => words.length)
150
+ .map(([k, words]) => `${k}: ${words.map(w => `${w} (${colourMeaning(k, w)})`).join(' | ')}`).join('; ');
151
+
152
+ /** The ingredients whose words ride the body list but are the site's colours (CV2): split out into `mixes.colour`. */
153
+ const COLOUR_INGREDIENTS: ReadonlySet<string> = new Set(Object.values(ColourIngredient));
154
+ const isColourWord = (word: unknown): boolean => typeof word === 'string' && COLOUR_INGREDIENTS.has(word.split(':')[0]);
142
155
 
143
156
  /** The wire's `globals` key the site's popup travels in (popups PU3) — a mix beside the others; [] = no popup. */
144
157
  const POPUP_WIRE_KEY = 'popup';
@@ -259,7 +272,7 @@ const WIRE_KEYS: Readonly<Record<`${PlanWireEntry}`, Readonly<Record<string, Wir
259
272
  opening: { refs: ['plan.mixes', 'mixes.opening'], text: OPENING_WIRE_TEXT },
260
273
  // AW6: the site's body travels as its MIX, ONE list of `<ingredient>:<word>` words (body-mix.ts); [] = none. Every
261
274
  // tier's request carries it since AW-D42 (it was the award tier's alone, AW-D23).
262
- body: { refs: ['plan.mixes', 'mixes.body'], text: BODY_WIRE_TEXT },
275
+ body: { refs: ['plan.mixes', 'mixes.body', 'mixes.colour'], text: BODY_WIRE_TEXT },
263
276
  // PU3: the popup travels as its words, ONE list (popup-plan.ts); [] = none. Stamped only from the owner's lines (plan.popup).
264
277
  popup: { refs: ['plan.mixes', 'mixes.popup'], text: POPUP_WIRE_TEXT },
265
278
  },
@@ -472,7 +485,8 @@ const PLAN_TOP_SCHEMAS: Readonly<Record<string, (options: PlanWireOptions) => Js
472
485
  [GlobalSlot.Header]: jsonListOf(jsonOneOf(headerWireWords())),
473
486
  [GlobalSlot.Footer]: jsonListOf(jsonOneOf(footerWireWords())),
474
487
  [OPENING_WIRE_KEY]: jsonListOf(jsonOneOf(openingWireWords())),
475
- [BODY_WIRE_KEY]: jsonListOf(jsonOneOf(bodyWireWords())),
488
+ // AW-D42: every tier's request is the award request — the colour's Pro words ride it too.
489
+ [BODY_WIRE_KEY]: jsonListOf(jsonOneOf([...bodyWireWords(), ...colourWireWords(GenerationTier.Award)])),
476
490
  [POPUP_WIRE_KEY]: jsonListOf(jsonText()),
477
491
  }, `wire ${PlanWireEntry.Globals}`),
478
492
  direction: () => shaped(PlanWireEntry.Direction, { idea: jsonText(), cliche: jsonText(), flip: jsonText(), rules: jsonListOf(jsonText()) }),
@@ -671,7 +685,10 @@ function expandWireGlobals(globals: unknown): PlainObject {
671
685
  // AW8: the opening is a mix only (no stored pattern stands for it on the wire); [] = none. Not a list: the validator says so.
672
686
  // AW6: so is the body (the award tier's wire alone writes it); [] = none.
673
687
  // PU3: so is the popup ([] = none).
674
- for (const [name, words] of [[OPENING_WIRE_KEY, opening], [BODY_WIRE_KEY, body], [POPUP_WIRE_KEY, popup]] as const) {
688
+ // CV2: the body list's colour words are the site's colours (`mixes.colour`); the rest its body.
689
+ const bodyWords = Array.isArray(body) ? body.filter(w => !isColourWord(w)) : body;
690
+ const colour = Array.isArray(body) ? body.filter(isColourWord) : undefined;
691
+ for (const [name, words] of [[OPENING_WIRE_KEY, opening], [BODY_WIRE_KEY, bodyWords], [POPUP_WIRE_KEY, popup], [COLOUR_MIX_KEY, colour]] as const) {
675
692
  if (words !== undefined && (!Array.isArray(words) || words.length)) mixes[name] = Array.isArray(words) ? [...words] : words;
676
693
  }
677
694
  for (const [slot, readId, fallback] of [
@@ -747,7 +764,7 @@ const PLAN_TO_WIRE: Readonly<Record<string, (plan: SitePlan, options: PlanWireOp
747
764
  ...plan.globals, [GlobalSlot.Header]: headerMixWords(headerMixOfPlan(plan)), [GlobalSlot.Footer]: footerMixWords(footerMixOfPlan(plan)),
748
765
  [OPENING_WIRE_KEY]: [...(plan.mixes?.opening ?? [])],
749
766
  // AW6: the wire writes the body ([] = none) — at every tier since AW-D42.
750
- [BODY_WIRE_KEY]: [...(plan.mixes?.body ?? [])],
767
+ [BODY_WIRE_KEY]: [...(plan.mixes?.body ?? []), ...(plan.mixes?.colour ?? [])],
751
768
  [POPUP_WIRE_KEY]: [...(plan.mixes?.popup ?? [])],
752
769
  }),
753
770
  direction: plan => ({ idea: plan.direction?.idea ?? NONE, cliche: plan.direction?.cliche ?? NONE, flip: plan.direction?.flip ?? NONE, rules: [...(plan.direction?.rules ?? [])] }),
@@ -18,6 +18,7 @@ export * from './patterns';
18
18
  export * from './templates';
19
19
  export * from './serialized-node';
20
20
  export * from './section-stamp';
21
+ export * from './composition';
21
22
  export * from './carry';
22
23
  export * from './check-carry';
23
24
  export * from './carry-fill';
@@ -96,6 +97,7 @@ export * from './colour-mix';
96
97
  export * from './popup-plan';
97
98
  export * from './opening-edit';
98
99
  export * from './footer-mix';
100
+ export * from './footer-sign-up';
99
101
  export * from './layout-edits';
100
102
  export * from './adjustments';
101
103
  export * from './site-tree';
@@ -350,6 +350,9 @@ export interface BuildComposeDecisions {
350
350
  /** The owner's own photos (addresses) the build may place — their count lets a type whose work stock may not show open
351
351
  * on a picture (pictures first). */
352
352
  ownPhotos?: ReadonlyArray<string>;
353
+ /** Motion reach (MR-D1): the owner asked for little movement (the reading's `lots-of-motion` avoid) — the site signs
354
+ * with no move it did not start with. Absent: not asked. */
355
+ littleMovement?: boolean | null;
353
356
  }
354
357
 
355
358
  /** The run as `GET …/site-builds/:id` (and `?latest=1`) answers it. */
@@ -416,6 +416,9 @@ export interface PlanMixes {
416
416
  readonly body?: ReadonlyArray<string>;
417
417
  /** Popups PU3 (popup-plan.ts): the site's popup — kind, form, arrive, `link:<page key>`; stamped only from `SitePlan.popup`. */
418
418
  readonly popup?: ReadonlyArray<string>;
419
+ /** Colour v2 CV2 (colour-mix.ts): the site's colours — ground, dark, accent, button, rhythm, bands. Absent = the style
420
+ * preset's own row (`colourMixOfPlan`). */
421
+ readonly colour?: ReadonlyArray<string>;
419
422
  }
420
423
 
421
424
  /** M8 gate 2: the idea a site's composed pages serve — the usual site for the business, and what this one does instead. */