@vectoriox/iox-ui 5.196.0 → 5.197.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 +3 -0
  2. package/data-core/index.d.ts +101 -2
  3. package/design-core/index.d.ts +24 -3
  4. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +15 -8
  5. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  6. package/fesm2022/vectoriox-iox-ui-data-core.mjs +192 -2
  7. package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
  8. package/fesm2022/vectoriox-iox-ui-design-core.mjs +41 -3
  9. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  10. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +445 -135
  11. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  12. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +3 -1
  13. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  14. package/fesm2022/vectoriox-iox-ui.mjs +30 -0
  15. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  16. package/generation-core/index.d.ts +170 -18
  17. package/harness-core/index.d.ts +1 -1
  18. package/package.json +1 -1
  19. package/src/composite-core/slider-runtime.ts +16 -8
  20. package/src/data-core/placeholder-rows.ts +220 -0
  21. package/src/data-core/public-api.ts +2 -1
  22. package/src/design-core/header-behaviour.ts +10 -2
  23. package/src/design-core/node-links.ts +34 -0
  24. package/src/generation-core/audit-site.ts +10 -1
  25. package/src/generation-core/audit-words.ts +5 -0
  26. package/src/generation-core/check-free.ts +21 -3
  27. package/src/generation-core/compose-site.ts +32 -9
  28. package/src/generation-core/free-opening.ts +57 -0
  29. package/src/generation-core/header-mix.ts +84 -4
  30. package/src/generation-core/item-fill.ts +42 -0
  31. package/src/generation-core/nav-shape.ts +45 -16
  32. package/src/generation-core/node-baselines.generated.ts +1 -0
  33. package/src/generation-core/opening-mix.ts +10 -0
  34. package/src/generation-core/public-api.ts +2 -0
  35. package/src/generation-core/site-build-run.ts +4 -0
  36. package/src/generation-core/stock-search.ts +106 -18
  37. package/src/generation-core/type-led.ts +19 -4
  38. package/src/harness-core/run-compose-context.ts +3 -1
  39. package/styles/iox-design.css +5 -4
@@ -1,10 +1,10 @@
1
1
  import {
2
- DesignChoices, elementStyleFace, HeaderGround, headerGroundIsGlass, headerGroundIsOver, HeaderTrait, MenuForm, menuButtonOf, menuFormOf, menuHoverOf, MenuLook, MenuPhoneForm,
3
- menuRevealOf, parseHexColor, resolveDesignChoices, textWidthEm, wcagContrastRatio,
2
+ DesignChoices, designTokenRows, elementStyleFace, HeaderGround, headerGroundIsGlass, headerGroundIsOver, HeaderTrait, MenuForm, menuButtonOf, menuFormOf, menuHoverOf, MenuLook, MenuPhoneForm,
3
+ menuRevealOf, parseHexColor, resolveDesignChoices, resolveSchemeTokenValues, resolveTokenValues, ResolvedMode, textWidthEm, wcagContrastRatio,
4
4
  } from '@vectoriox/iox-ui/design-core';
5
5
 
6
6
  import { MenuSide, NavRole, NavShape } from './nav-shape';
7
- import { OpeningMixError, openingMixOfPlan } from './opening-mix';
7
+ import { OpeningMixError, openingMixOfPlan, OpeningRole } from './opening-mix';
8
8
  import { calmUnder, PhotoInventory } from './photo-inventory';
9
9
  import { PatternGlobalPosition, PatternNode, SITE_PATTERNS, SitePattern } from './patterns';
10
10
  import { planSells, ShopSourceRole, shopSourceAliases } from './shop-plan';
@@ -407,6 +407,12 @@ export function opensOnPicture(opening: HeaderOpening | null | undefined): boole
407
407
  return !!opening && RULES.overFrames.includes(opening.frame) && RULES.overMedia.includes(opening.media);
408
408
  }
409
409
 
410
+ /** HI3-D5: what an over header stands on when its words do not read over the opening — the look's glass from the top,
411
+ * or its own solid bar in a look with no glass (Pop). The ONE answer `checkHeader` and a build's late mend share. */
412
+ export function headerGroundWhenUnreadable(design: Pick<DesignChoices, 'flavorId'>): HeaderGround {
413
+ return lookHasGlass(design) ? HeaderGround.Glass : HeaderGround.Solid;
414
+ }
415
+
410
416
  /** HI3-D2: does the look carry a header glass set (Pop draws its own solid bar). */
411
417
  export function lookHasGlass(design: Pick<DesignChoices, 'flavorId'>): boolean {
412
418
  return RULES.glassFlavors.includes(design.flavorId);
@@ -426,7 +432,7 @@ function mendGround(m: HeaderMix, ctx: HeaderContext, say: (code: HeaderRepairCo
426
432
  say(HeaderRepairCode.OverPlain, 'the home page does not open on a full picture the header can stand over: it keeps its own ground');
427
433
  }
428
434
  if (headerGroundIsOver(m.ground) && ctx.readableAtRest === false) {
429
- m.ground = glass ? HeaderGround.Glass : HeaderGround.Solid;
435
+ m.ground = headerGroundWhenUnreadable(ctx.design);
430
436
  say(HeaderRepairCode.OverUnreadable, glass ? "the header's words do not read over the opening's picture: it stands on its glass from the top"
431
437
  : "the header's words do not read over the opening's picture: it keeps its own ground");
432
438
  }
@@ -489,6 +495,80 @@ export function headerReadsAtRest(inv: PhotoInventory, frame: { w: number; h: nu
489
495
  return true;
490
496
  }
491
497
 
498
+ /** The frames the words at rest are judged in (HI3-D5): a laptop's first screen under its 80px bar, a phone's under 64px
499
+ * (the shared CSS's bar fallbacks, iox-design.css). */
500
+ export const HEADER_REST_FRAMES: ReadonlyArray<{ readonly w: number; readonly h: number; readonly barPx: number }> = [
501
+ { w: 1440, h: 900, barPx: HEADER_BAR_PX },
502
+ { w: 390, h: 760, barPx: 64 },
503
+ ];
504
+ const DEFAULT_SCHEME = 'default';
505
+ const MODES_OF: Readonly<Record<string, ReadonlyArray<ResolvedMode>>> = { light: ['light'], dark: ['dark'], auto: ['light', 'dark'] };
506
+
507
+ /**
508
+ * HI3-D5: the header's words at rest, one per mode the look offers — the opening scheme's `text` (what an over header
509
+ * wears at rest, HI3-D8) over a veil of its `bg` — resolved from the look's own token rows. A scheme the rows lack reads
510
+ * as the page's. Pure.
511
+ */
512
+ export function headerRestInks(design: DesignChoices, scheme?: string | null): HeaderRestInk[] {
513
+ const rows = designTokenRows(design);
514
+ return (MODES_OF[design.mode] ?? MODES_OF['light']).map(mode => {
515
+ const values = scheme && scheme !== DEFAULT_SCHEME ? resolveSchemeTokenValues(rows, mode, scheme) : resolveTokenValues(rows, mode);
516
+ return { ink: values['text'] ?? '', veilGround: values['bg'] ?? '' };
517
+ });
518
+ }
519
+
520
+ /** A node as the readable check walks it (a composed page's SerializedNode). */
521
+ export interface HeaderRestNode {
522
+ readonly role?: string | null;
523
+ readonly type?: string;
524
+ readonly props?: Readonly<Record<string, unknown>> | null;
525
+ readonly children?: ReadonlyArray<HeaderRestNode> | null;
526
+ }
527
+ /** A composed page as the readable check reads it. */
528
+ export interface HeaderRestPage {
529
+ readonly isHome?: boolean;
530
+ readonly route?: { readonly path?: string } | string | null;
531
+ readonly pageSettings?: { readonly opening?: string | null } | null;
532
+ readonly layout?: ReadonlyArray<HeaderRestNode> | null;
533
+ }
534
+
535
+ const PICTURE_ROLES: ReadonlySet<string> = new Set([OpeningRole.Media, OpeningRole.MediaZooms, OpeningRole.Slides, OpeningRole.Film]);
536
+
537
+ /** The address of the picture the home opening shows first: its picture, the first slide, a film's poster — or null. */
538
+ export function openingPictureSrc(opening: HeaderRestNode | null | undefined): string | null {
539
+ let found: string | null = null;
540
+ const walk = (n: HeaderRestNode, inside: boolean): void => {
541
+ if (found) return;
542
+ const here = inside || PICTURE_ROLES.has(n.role ?? '');
543
+ if (here) {
544
+ const src = n.type === 'Video' ? n.props?.['poster'] : n.type === 'Image' ? n.props?.['src'] : null;
545
+ if (typeof src === 'string' && src.trim()) { found = src; return; }
546
+ }
547
+ for (const c of n.children ?? []) walk(c, here);
548
+ };
549
+ if (opening?.role === OpeningRole.Root) walk(opening, false);
550
+ return found;
551
+ }
552
+
553
+ /**
554
+ * HI3-D5 on a COMPOSED site: whether its header's words read at rest over the home opening's picture — the picture's pixels
555
+ * (`inventoryOf` its address: the caller holds them, the reading), the opening's scheme, in every mode the look offers
556
+ * and in both frames (`HEADER_REST_FRAMES`). Null — not judged — when the home page opens on no composed picture or its
557
+ * pixels are unknown (a placeholder, a stock picture not read yet). The ONE judgement the build (iox-cms, which then
558
+ * composes with `headerReadable`) and the Header studio's advice share. Pure.
559
+ */
560
+ export function headerReadableOfSite(
561
+ site: { readonly pages: ReadonlyArray<HeaderRestPage>; readonly design: DesignChoices },
562
+ inventoryOf: (src: string) => PhotoInventory | null | undefined,
563
+ ): boolean | null {
564
+ const home = site.pages.find(p => p.isHome === true) ?? site.pages.find(p => (typeof p.route === 'string' ? p.route : p.route?.path) === '/');
565
+ const src = openingPictureSrc(home?.layout?.[0]);
566
+ const inv = src ? inventoryOf(src) : null;
567
+ if (!inv) return null;
568
+ const inks = headerRestInks(site.design, home?.pageSettings?.opening ?? null);
569
+ return HEADER_REST_FRAMES.every(f => headerReadsAtRest(inv, f, inks, f.barPx));
570
+ }
571
+
492
572
  // ── The recipe: the mix arranged from the contract's parts (§4 — ONE recipe for the palette and the generator) ────
493
573
 
494
574
  const clone = <T>(v: T): T => JSON.parse(JSON.stringify(v));
@@ -0,0 +1,42 @@
1
+ import { ContentTypePlan, SitePlan, SitePlanSourceKind } from './site-plan.model';
2
+
3
+ /**
4
+ * WHICH SAMPLE ITEMS ARE THE PLAN'S OWN, AND WHICH ARE NUMBERED PLACEHOLDERS (vectoriox/iox-ui#178). A generated site
5
+ * showed "Piece 2", "Product 2", "Room 2": the sample items of a content type whose plan gave no words for each item
6
+ * (the business's own products, rooms, team — neutral by `SAMPLE_CONTENT_RULE`, Doron 2026-11-01), every title its seed
7
+ * template (`"Product {n}"`) with the number filled in. Doron, 2026-11-28 — GHOST CARDS: those items stay in the data and
8
+ * every page and section stays; the builder draws such a row as an owner prompt ("Add your first room"), the live site
9
+ * never shows a list made only of them, and the Publishable gate ASKS about one still titled like a placeholder.
10
+ *
11
+ * This file is the reading both halves share: which items the PLAN fills (the composer, the proof) and how a stored item
12
+ * is recognised as a numbered placeholder (the gate, the renderers). Pure.
13
+ */
14
+
15
+ /** The rule is about a plan the model wrote — a template's samples are its structure, an import's items are real. */
16
+ export function itemFillApplies(plan: Pick<SitePlan, 'source'>): boolean {
17
+ return plan.source?.kind === SitePlanSourceKind.Ai;
18
+ }
19
+
20
+ const TEMPLATE_NUMBER = /\{n\}/;
21
+
22
+ /** Whether the plan gives item `n` (1-based) of `type` its own title: a real item, or a sample with its own words. */
23
+ export function isFilledItem(type: ContentTypePlan, n: number): boolean {
24
+ const seed = type.seed;
25
+ if (!seed || n < 1 || n > seed.count) return false;
26
+ if (!seed.sample) return true;
27
+ const own = seed.perItem?.[type.roles.title]?.[n - 1];
28
+ return typeof own === 'string' && own.trim() !== '' && !TEMPLATE_NUMBER.test(own);
29
+ }
30
+
31
+ /** The numbers (1-based) of the items of `type` the plan fills. */
32
+ export function filledItemNumbers(type: ContentTypePlan): number[] {
33
+ const out: number[] = [];
34
+ for (let n = 1; n <= (type.seed?.count ?? 0); n++) if (isFilledItem(type, n)) out.push(n);
35
+ return out;
36
+ }
37
+
38
+ /** The content types of an AI plan whose samples are all numbered placeholders — the lists that start as ghost cards. */
39
+ export function placeholderContentTypes(plan: SitePlan): Set<string> {
40
+ if (!itemFillApplies(plan)) return new Set();
41
+ return new Set(plan.contentTypes.filter(t => t.seed?.sample && t.seed.count > 0 && !filledItemNumbers(t).length).map(t => t.name));
42
+ }
@@ -145,8 +145,39 @@ const MENU_WORDS: Readonly<Record<string, MenuWords>> = {
145
145
  he: { menu: 'תפריט', close: 'סגירה', closeMenu: 'סגירת התפריט', more: 'עוד', home: 'בית' },
146
146
  };
147
147
 
148
- export function menuWords(locale: string | undefined): MenuWords {
149
- return MENU_WORDS[commerceLanguage(locale)] ?? MENU_WORDS['en'];
148
+ /** vectoriox/iox-ui#177: the words a menu button may be named, in order — the next is taken while a page of the site is
149
+ * called like the one before (a café's "Menu" page beside a "Menu" button: a visitor cannot tell which gives the food).
150
+ * Its Close is named with it. */
151
+ const MENU_BUTTON_LADDER: Readonly<Record<string, ReadonlyArray<Pick<MenuWords, 'menu' | 'closeMenu'>>>> = {
152
+ en: [{ menu: 'Menu', closeMenu: 'Close menu' }, { menu: 'Pages', closeMenu: 'Close pages' }, { menu: 'Navigation', closeMenu: 'Close navigation' }],
153
+ he: [{ menu: 'תפריט', closeMenu: 'סגירת התפריט' }, { menu: 'עמודים', closeMenu: 'סגירת העמודים' }, { menu: 'ניווט', closeMenu: 'סגירת הניווט' }],
154
+ };
155
+ /** The same for the bottom bar's More (a page called "More"). */
156
+ const MORE_LADDER: Readonly<Record<string, ReadonlyArray<string>>> = {
157
+ en: ['More', 'Other pages'],
158
+ he: ['עוד', 'עמודים נוספים'],
159
+ };
160
+ /** An article a page name may start with that does not make it another word ("The menu", "התפריט"). */
161
+ const LEADING_ARTICLE: Readonly<Record<string, RegExp>> = { en: /^(?:the|our)\s+/u, he: /^ה(?=\p{L}{2})/u };
162
+
163
+ /** One word of the navigation said the same way: case, stops and a leading article aside. */
164
+ function navWordKey(words: string, lang: string): string {
165
+ const plain = words.normalize('NFC').toLocaleLowerCase().replace(/[^\p{L}\p{N}\s]/gu, '').replace(/\s+/g, ' ').trim();
166
+ return plain.replace(LEADING_ARTICLE[lang] ?? /^$/u, '');
167
+ }
168
+
169
+ /** The words of the menu's parts in the site's language. Given the labels of the pages it links to (iox-ui#177), the
170
+ * menu button (and its drawer and Close) and the bar's More never say a word a page is called: each takes the next word
171
+ * of its ladder. */
172
+ export function menuWords(locale: string | undefined, labels: ReadonlyArray<string> = []): MenuWords {
173
+ const lang = MENU_WORDS[commerceLanguage(locale)] ? commerceLanguage(locale) : 'en';
174
+ const base = MENU_WORDS[lang];
175
+ if (!labels.length) return base;
176
+ const taken = new Set(labels.map(l => navWordKey(l, lang)));
177
+ const free = (w: string) => !taken.has(navWordKey(w, lang));
178
+ const buttons = MENU_BUTTON_LADDER[lang];
179
+ const mores = MORE_LADDER[lang];
180
+ return { ...base, ...(buttons.find(b => free(b.menu)) ?? buttons[buttons.length - 1]), more: mores.find(free) ?? mores[mores.length - 1] };
150
181
  }
151
182
 
152
183
  /** The layer names of the parts (R2: the tree, the breadcrumb and the toolbar read them). */
@@ -467,12 +498,9 @@ const WORD_BUTTON_LAY = { width: 'auto', minWidth: '48px' };
467
498
 
468
499
  /** What a menu button shows for its kind — closed (the menu button) or open (the drawer's Close, which lands where the
469
500
  * menu button is): the list icon and an X, the nine dots and an X (the shared CSS draws both as dots), or the word. */
470
- function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolean, locale: string | undefined): SerializedNode[] {
501
+ function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolean, words: MenuWords): SerializedNode[] {
471
502
  switch (kind) {
472
- case MenuButtonKind.Word: {
473
- const words = menuWords(locale);
474
- return [labelText(kit, `${suffix}-word`, open ? words.close : words.menu)];
475
- }
503
+ case MenuButtonKind.Word: return [labelText(kit, `${suffix}-word`, open ? words.close : words.menu)];
476
504
  case MenuButtonKind.Dots: return [iconNode(kit, `${suffix}-dots`, open ? CLOSE_ICON : DOTS_ICON)];
477
505
  default: return [iconNode(kit, `${suffix}-icon`, open ? CLOSE_ICON : MENU_ICON)];
478
506
  }
@@ -480,12 +508,12 @@ function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolea
480
508
 
481
509
  /** Give a menu button (or the drawer's Close) a kind. The same kind keeps the author's children; another kind gets that
482
510
  * kind's face and size. */
483
- function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuButtonKind, open: boolean, locale: string | undefined): void {
511
+ function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuButtonKind, open: boolean, words: MenuWords): void {
484
512
  const was = menuButtonOf(btn.props?.[MenuTrait.Button]);
485
513
  const { [MenuTrait.Button]: _drop, ...props } = btn.props ?? {};
486
514
  btn.props = { ...props, ...menuButtonProps(kind) };
487
515
  if (was === kind) return;
488
- btn.children = buttonFace(kit, suffix, kind, open, locale);
516
+ btn.children = buttonFace(kit, suffix, kind, open, words);
489
517
  if (kind === MenuButtonKind.Word) Object.assign(btn.styleProps, WORD_BUTTON_LAY);
490
518
  else if (was === MenuButtonKind.Word) Object.assign(btn.styleProps, { width: MENU_BUTTON_LAY.width, minWidth: ICON_BUTTON_MIN_WIDTH });
491
519
  }
@@ -494,12 +522,12 @@ function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuBu
494
522
  const ICON_BUTTON_MIN_WIDTH = String(createSerializedNode('min-width', BUTTON, { tag: 'button' }, 'button-ghost', COMPOSED).styleProps['minWidth'] ?? '0px');
495
523
 
496
524
  /** Put a look on a header's menu: the drawer's traits, and the menu button's and the Close's kind. */
497
- function dressMenu(kit: Kit, dr: SerializedNode | null, menu: SerializedNode | null, look: Partial<MenuLook>, locale: string | undefined): void {
525
+ function dressMenu(kit: Kit, dr: SerializedNode | null, menu: SerializedNode | null, look: Partial<MenuLook>, words: MenuWords): void {
498
526
  if (dr) dressDrawer(dr, look);
499
527
  if (!look.button) return;
500
- if (menu) dressButton(kit, menu, 'menu', look.button, false, locale);
528
+ if (menu) dressButton(kit, menu, 'menu', look.button, false, words);
501
529
  const close = dr ? find([dr], NavRole.DrawerClose) : null;
502
- if (close) dressButton(kit, close, 'drawer-close', look.button, true, locale);
530
+ if (close) dressButton(kit, close, 'drawer-close', look.button, true, words);
503
531
  }
504
532
 
505
533
  function barItem(kit: Kit, i: number, page: NavPage): SerializedNode {
@@ -655,10 +683,10 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
655
683
  const everyWidth = shape === NavShape.Drawer && (options.everyWidth ?? wasEveryWidth);
656
684
  if (options.everyWidth && shape !== NavShape.Drawer) throw new NavShapeError('only a drawer menu shows at every width');
657
685
  const kit = makeKit(out, root.id, options.newId);
658
- const words = menuWords(options.locale);
659
686
 
660
687
  adoptRoles(root);
661
688
  const { pages } = phoneMenuPages(root, options.pages);
689
+ const words = menuWords(options.locale, pages.map(p => p.label));
662
690
  const wantDrawer = shape !== NavShape.Bar;
663
691
  const wantBar = shape !== NavShape.Drawer;
664
692
  const wantMenuButton = shape === NavShape.Drawer;
@@ -704,7 +732,7 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
704
732
  placeMenu(root, menu, (options.menuSide as MenuSide | undefined) ?? null, was);
705
733
  }
706
734
  // HI2a: the menu's look, when one is asked (the composer's header recipe; the Header studio later).
707
- if (options.look) dressMenu(kit, dr, menu, options.look, options.locale);
735
+ if (options.look) dressMenu(kit, dr, menu, options.look, words);
708
736
  if (dr && shape === NavShape.Drawer) kids.push(dr);
709
737
  if (dr && shape === NavShape.Both) {
710
738
  dr.isGlobal = true;
@@ -789,8 +817,9 @@ export function addBarItem(globals: ReadonlyArray<SerializedNode>, options: Pick
789
817
  const kids = b.children ?? (b.children = []);
790
818
  if (kids.length >= BAR_ITEMS_MAX) return { globals: out, added: false };
791
819
  const linked = new Set(kids.filter(c => c.role === NavRole.BarItem).map(c => prop(c, 'pageRoute')));
792
- const words = menuWords(options.locale);
793
- const page = barPages(root, phoneMenuPages(root, options.pages).pages, BAR_ITEMS_MAX + 1, words).find(p => !linked.has(p.route))
820
+ const sitePages = phoneMenuPages(root, options.pages).pages;
821
+ const words = menuWords(options.locale, sitePages.map(p => p.label));
822
+ const page = barPages(root, sitePages, BAR_ITEMS_MAX + 1, words).find(p => !linked.has(p.route))
794
823
  ?? { label: words.home, route: HOME_ROUTE };
795
824
  const item = barItem(makeKit(out, root.id, options.newId), kids.length, page);
796
825
  const more = kids.findIndex(c => c.role === NavRole.More);
@@ -701,6 +701,7 @@ export const NODE_BASELINES: Readonly<Record<string, NodeBaseline>> = {
701
701
  "headerEdge",
702
702
  "headerMix",
703
703
  "headerInk",
704
+ "headerGround",
704
705
  "marqueeSpeed",
705
706
  "marqueeDirection",
706
707
  "marqueeFade",
@@ -456,6 +456,9 @@ export enum OpeningRepairCode {
456
456
  ProOnly = 'pro-only',
457
457
  /** The name behind the subject needs a cut-out picture: the name, large. */
458
458
  NeedsCutOut = 'needs-cut-out',
459
+ /** J10 lever (b): a looping film is the owner's own clip — a build with none draws a picture there, which the owner's
460
+ * photo, a made picture or stock can fill (an empty Video was never offered to any of them). */
461
+ FilmIsTheOwners = 'film-is-the-owners',
459
462
  /** "The film is the message" needs a film or pictures that move: a heading. */
460
463
  NoneNeedsFilm = 'none-needs-film',
461
464
  /** Words placed apart need two or three of them. */
@@ -489,6 +492,9 @@ export interface OpeningContext {
489
492
  readonly tier?: `${GenerationTier}`;
490
493
  /** The owner gives a cut-out picture (a transparent background) for the name behind the subject. */
491
494
  readonly cutOut?: boolean;
495
+ /** J10 lever (b): the owner's own clip plays in the first screen. `false` = none (a build: its film is drawn as a
496
+ * picture, said), absent = a placeholder the owner fills (the builder). */
497
+ readonly film?: boolean;
492
498
  /** The owner's own badge words; `null` = none given (the generator: left out), absent = a placeholder (the builder). */
493
499
  readonly badge?: string | null;
494
500
  }
@@ -552,6 +558,10 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
552
558
  say(OpeningRepairCode.ProOnly, `"${openingMeaning(k, word)}" comes with the award plan: ${openingMeaning(k, tierStandIn(k))} instead`);
553
559
  }
554
560
  }
561
+ if (m.media === OpeningMedia.Film && ctx.film === false) {
562
+ m.media = OpeningMedia.Photo;
563
+ say(OpeningRepairCode.FilmIsTheOwners, 'a looping film is the owner\'s own clip, and there is none yet: a picture stands in, filled by their photo or one that fits the business');
564
+ }
555
565
  if (m.words === OpeningWords.Behind && !ctx.cutOut) {
556
566
  m.words = OpeningWords.Wordmark;
557
567
  say(OpeningRepairCode.NeedsCutOut, 'the name behind the subject needs a cut-out picture: the name, large, until there is one');
@@ -28,6 +28,7 @@ export * from './validate-site-plan';
28
28
  export * from './compose-site';
29
29
  export * from './contact-facts';
30
30
  export * from './nav-shape';
31
+ export * from './item-fill';
31
32
  export * from './entrances';
32
33
  export * from './text-scroll';
33
34
  export * from './plan-data';
@@ -71,6 +72,7 @@ export * from './free-fallback';
71
72
  export * from './free-slots';
72
73
  export * from './compose-free';
73
74
  export * from './free-render-check';
75
+ export * from './free-opening';
74
76
  export * from './prompt-limits';
75
77
  export * from './layout-photos';
76
78
  export * from './photo-inventory';
@@ -338,6 +338,10 @@ export interface BuildComposeDecisions {
338
338
  legal?: LegalContext | null;
339
339
  /** The reading's kind of business (harness-core id): calm (AW6), the footer's call word and what it never wears (AW12). */
340
340
  businessType?: string | null;
341
+ /** HI3-D5: the preflight's judgement of the header's words at rest over the home opening's picture
342
+ * (`headerReadableOfSite`, where the picture's pixels are known) — every compose of the run takes the same answer.
343
+ * Absent or null: not judged. */
344
+ headerReadable?: boolean | null;
341
345
  }
342
346
 
343
347
  /** The run as `GET …/site-builds/:id` (and `?latest=1`) answers it. */
@@ -14,11 +14,15 @@ import type { StockTarget } from './stock-photos';
14
14
  * picture; a stranger, or a street at night, under a person's name is a made-up fact about the business.
15
15
  * - WHAT is asked (`stockSearchQuery`): closed English words only (LS-D3) — the business type's own keyword and at most one
16
16
  * subject word for the place. Nothing the owner typed (a name, a phone, an address) ever reaches the provider.
17
- * - WHAT is never taken (`stockPhotoFits`): a photo whose words speak of crime, injury, ruin or a joke (`STOCK_NEVER_WORDS`,
18
- * `STOCK_NEVER_PHRASES`), or — for a trade people trust with their money, health or rights — of what that trade fears
19
- * (`STOCK_TRADE_NEVER_WORDS`); and an OPENING (an atmosphere place: a hero, a page header, a call to action) takes an
20
- * unreviewed photo only when its words name the business twice (`STOCK_OPENING_TYPE_WORDS` of the type's vocabulary):
21
- * "salon" alone is a drawing room, "salon" + "hair" is a hair salon.
17
+ * - WHAT is never taken (`stockPhotoFits`): a photo whose words speak of crime, injury, ruin, a joke or a state's emblem
18
+ * (`STOCK_NEVER_WORDS`, `STOCK_NEVER_PHRASES`), or — for a trade people trust with their money, health or rights — of what
19
+ * that trade fears (`STOCK_TRADE_NEVER_WORDS`); and an unreviewed photo that does not show the business: an OPENING (an
20
+ * atmosphere place: a hero, a page header, a call to action) names it twice (`STOCK_OPENING_TYPE_WORDS` of the type's
21
+ * vocabulary — "salon" alone is a drawing room, "salon" + "hair" is a hair salon), every other place at least once
22
+ * (`STOCK_PLACE_TYPE_WORDS`, iox-ui#175 — a law firm's About never shows a clothing boutique, a salon's service never a
23
+ * street at night). The vocabulary is the type's own words and what its photos are tagged with (`STOCK_TRADE_WORDS`); an
24
+ * item's own name vouches too. A word that names ANOTHER trade's place (`STOCK_TRADE_PLACE_WORDS`: a boutique, a bar) is
25
+ * never asked for and never vouches — "Boutique law firm" asked Pixabay for "law boutique" and got a clothes shop.
22
26
  *
23
27
  * The provider side (Pixabay) already asks `image_type=photo` and `safesearch=true` and drops people, brands and generated
24
28
  * pictures by their tags; this is what the PLATFORM decides on top, the same for every provider.
@@ -49,10 +53,12 @@ export const STOCK_NEVER_WORDS: ReadonlySet<string> = new Set([
49
53
  'cocaine', 'abandoned', 'derelict', 'ruin', 'decay', 'decayed', 'dilapidated', 'demolition', 'rotten', 'trash',
50
54
  'garbage', 'rubbish', 'dirty', 'homeless', 'riot', 'caricature', 'cartoon', 'figurine', 'clipart', 'illustration', 'vector',
51
55
  'meme', 'joke', 'funny', 'humor', 'humour', 'halloween', 'horror', 'creepy', 'zombie',
56
+ // iox-ui#175: a state's emblem says the business speaks for a state (the Pro law firm's "imperial eagle").
57
+ 'emblem', 'imperial',
52
58
  ].map(stockWord));
53
59
 
54
60
  /** Phrases that say the same where no one word does ("lost places" — the photography of abandoned buildings). */
55
- export const STOCK_NEVER_PHRASES: ReadonlyArray<string> = ['lost place', 'lost places', 'tax evasion', 'urban exploration', 'urbex'];
61
+ export const STOCK_NEVER_PHRASES: ReadonlyArray<string> = ['lost place', 'lost places', 'tax evasion', 'urban exploration', 'urbex', 'coat of arms'];
56
62
 
57
63
  /**
58
64
  * Per business type (harness-core id), what a trade people trust with their rights, money or health never shows on its
@@ -60,7 +66,8 @@ export const STOCK_NEVER_PHRASES: ReadonlyArray<string> = ['lost place', 'lost p
60
66
  * sells by (an accountant's tax, a lawyer's court) — the universal list already keeps the joke about it out.
61
67
  */
62
68
  export const STOCK_TRADE_NEVER_WORDS: Readonly<Record<string, ReadonlyArray<string>>> = {
63
- 'law-accounting': ['debt', 'bankruptcy', 'bankrupt', 'guilty', 'crisis', 'stress', 'eviction', 'divorce'],
69
+ // iox-ui#175: another country's law ("The basic law, germany") is not the law this firm practises.
70
+ 'law-accounting': ['debt', 'bankruptcy', 'bankrupt', 'guilty', 'crisis', 'stress', 'eviction', 'divorce', 'germany', 'german', 'constitution'],
64
71
  consultant: ['debt', 'bankruptcy', 'bankrupt', 'crisis', 'stress'],
65
72
  coach: ['crisis', 'stress', 'depression', 'sad', 'lonely'],
66
73
  therapist: ['depression', 'sad', 'lonely', 'suicide', 'crying', 'tear', 'anxiety', 'stress'],
@@ -69,8 +76,61 @@ export const STOCK_TRADE_NEVER_WORDS: Readonly<Record<string, ReadonlyArray<stri
69
76
  vet: ['sick', 'injured', 'pain', 'syringe', 'needle', 'injection', 'surgery', 'stray', 'cage'],
70
77
  };
71
78
 
79
+ /**
80
+ * iox-ui#175 — per business type (harness-core id), the words a stock photo of that trade is tagged with when it does not
81
+ * say the trade's own name: a hairdresser, a manicure, a barbershop are a salon's; a gavel, a contract, a notary a law
82
+ * firm's. With the type's label, keywords and imagery they are its VOCABULARY (`stockFitFor`) — what a photo must name to
83
+ * show the business. Every type that may show stock has a row (spec). English only (the provider's tags), compared as
84
+ * `stockWord`s, and a word of four letters or more counts in its longer forms (`hair` → `hairdressing`).
85
+ */
86
+ export const STOCK_TRADE_WORDS: Readonly<Record<string, ReadonlyArray<string>>> = {
87
+ spa: ['sauna', 'towel', 'aromatherapy', 'relaxation', 'relax', 'treatment', 'jacuzzi', 'hammam', 'pool', 'stones'],
88
+ salon: ['hairdresser', 'barber', 'barbershop', 'manicure', 'manicurist', 'pedicure', 'fingernail', 'beautician', 'cosmetic', 'cosmetics', 'makeup', 'lash', 'eyelash', 'shampoo', 'scissors', 'comb', 'polish'],
89
+ yoga: ['mat', 'asana', 'lotus', 'pose', 'stretching', 'zen', 'mindfulness'],
90
+ fitness: ['workout', 'exercise', 'dumbbell', 'barbell', 'kettlebell', 'treadmill', 'weights', 'sport', 'athlete'],
91
+ therapist: ['couch', 'armchair', 'counseling', 'counselling', 'psychotherapy', 'mindfulness'],
92
+ clinic: ['health', 'healthcare', 'medicine', 'stethoscope', 'rehabilitation', 'wellbeing'],
93
+ dental: ['tooth', 'teeth', 'dentistry', 'toothbrush', 'orthodontic', 'braces', 'smile'],
94
+ vet: ['cat', 'puppy', 'kitten', 'veterinarian', 'paw', 'animal'],
95
+ restaurant: ['dining', 'dinner', 'dish', 'meal', 'plate', 'cuisine', 'cooking', 'gourmet', 'table'],
96
+ 'cafe-bakery': ['espresso', 'cappuccino', 'latte', 'barista', 'croissant', 'pastry', 'cake', 'bread', 'muffin', 'dessert', 'breakfast', 'brunch', 'cookie'],
97
+ 'bar-winery': ['beer', 'whiskey', 'whisky', 'vineyard', 'grape', 'barrel', 'pub', 'bartender', 'glass'],
98
+ boutique: ['dress', 'apparel', 'garment', 'outfit', 'shoe', 'handbag', 'textile', 'wardrobe'],
99
+ florist: ['rose', 'tulip', 'blossom', 'floral', 'peony', 'orchid', 'succulent', 'greenery', 'vase'],
100
+ 'home-goods': ['sofa', 'chair', 'table', 'lamp', 'interior', 'cushion', 'armchair', 'shelf', 'vase'],
101
+ consultant: ['meeting', 'business', 'planning', 'presentation', 'chart', 'office', 'desk', 'teamwork'],
102
+ coach: ['meeting', 'conversation', 'notebook', 'goal', 'growth', 'motivation'],
103
+ 'law-accounting': ['justice', 'court', 'judge', 'gavel', 'contract', 'notary', 'tax', 'finance', 'paperwork', 'document', 'signature', 'desk', 'agreement'],
104
+ nonprofit: ['donation', 'solidarity', 'fundraising', 'charity'],
105
+ 'venue-events': ['banquet', 'ballroom', 'celebration', 'reception', 'ceremony', 'catering', 'party'],
106
+ 'hotel-bnb': ['bedroom', 'bed', 'suite', 'resort', 'hospitality', 'lobby', 'pillow', 'accommodation', 'villa', 'inn', 'hostel'],
107
+ classes: ['classroom', 'education', 'learning', 'student', 'study', 'piano', 'guitar', 'blackboard'],
108
+ };
109
+
110
+ /**
111
+ * iox-ui#175 — words that name a KIND of business by its place (compared as `stockWord`s). For a type whose vocabulary
112
+ * does not hold one, it is another trade: never the query's subject word (Pixabay answers "law boutique" with a clothes
113
+ * shop) and never a word that vouches for a photo.
114
+ */
115
+ export const STOCK_TRADE_PLACE_WORDS: ReadonlySet<string> = new Set([
116
+ 'salon', 'shop', 'store', 'boutique', 'restaurant', 'cafe', 'bar', 'pub', 'bistro', 'bakery', 'cellar', 'winery', 'brewery',
117
+ 'gym', 'clinic', 'spa', 'sauna', 'hotel', 'studio', 'workshop', 'market', 'vineyard', 'barbershop', 'office',
118
+ ].map(stockWord));
119
+
120
+ /** Words of an imagery line that say how a picture is TAKEN or who gives it, never what it shows ("Real people (with
121
+ * permission)", "never stock", "on plain grounds") — left out of the vocabulary (iox-ui#175). */
122
+ const IMAGERY_NOISE: ReadonlySet<string> = new Set([
123
+ 'real', 'people', 'permission', 'needed', 'stock', 'plain', 'ground', 'close', 'treat', 'help', 'working', 'before', 'after',
124
+ 'face', 'own', 'never', 'large', 'uncropped', 'clean', 'healed', 'true', 'flat', 'natural', 'light', 'daylight', 'calm',
125
+ 'portrait', 'good', 'piece', 'wearing', 'need',
126
+ ].map(stockWord));
127
+
72
128
  /** An opening's unreviewed photo names the business this many times (distinct words of the type's vocabulary). */
73
129
  export const STOCK_OPENING_TYPE_WORDS = 2;
130
+ /** iox-ui#175: every other place's unreviewed photo names it at least this many times. */
131
+ export const STOCK_PLACE_TYPE_WORDS = 1;
132
+ /** A vocabulary word this long counts in its longer forms (`hair` → `hairdresser`); a shorter one only whole (`law`). */
133
+ const STEM_MIN = 4;
74
134
 
75
135
  /** The intents an opening stands as — wide places the visitor reads as "this is the business". */
76
136
  const OPENING_INTENTS: ReadonlySet<string> = new Set([StockIntent.Atmosphere]);
@@ -140,8 +200,10 @@ const SUBJECT_VOCABULARY: ReadonlyMap<StockSubject, ReadonlyMap<string, string>>
140
200
  * first, then the words around the place, then the type's imagery line — the first that names a subject its intent takes,
141
201
  * its best subject first. None: the base query.
142
202
  */
143
- export function stockSearchFocus(slot: StockTarget, type: Pick<StockSearchType, 'imagery'>, term: string): string | null {
144
- const words = [...(slot.kind === 'item' ? slot.subject ?? [] : []), ...slot.words, ...stockWords(type.imagery)];
203
+ export function stockSearchFocus(slot: StockTarget, type: StockSearchType | Pick<StockSearchType, 'imagery'>, term: string): string | null {
204
+ // iox-ui#175: another trade's place word is never the subject ("Boutique law firm" → never "law boutique").
205
+ const vocabulary = 'label' in type ? stockFitFor(type).vocabulary : new Set<string>();
206
+ const words = [...(slot.kind === 'item' ? slot.subject ?? [] : []), ...slot.words, ...stockWords(type.imagery)].filter(w => !foreignTrade(w, vocabulary));
145
207
  const asked = new Set(term.split(' ').map(stockWord));
146
208
  for (const subject of STOCK_INTENT_SUBJECTS[slot.intent as StockIntent] ?? []) {
147
209
  const vocabulary = SUBJECT_VOCABULARY.get(subject)!;
@@ -173,32 +235,58 @@ export const STOCK_FIT_ANY: StockFit = { never: STOCK_NEVER_WORDS, vocabulary: n
173
235
  /** What a photo is held to on a site of `type`. */
174
236
  export function stockFitFor(type: StockSearchType | null | undefined): StockFit {
175
237
  if (!type) return STOCK_FIT_ANY;
176
- const trade = (type.id ? STOCK_TRADE_NEVER_WORDS[type.id] : undefined) ?? [];
238
+ const fears = (type.id ? STOCK_TRADE_NEVER_WORDS[type.id] : undefined) ?? [];
239
+ const tagged = (type.id ? STOCK_TRADE_WORDS[type.id] : undefined) ?? [];
177
240
  const latin = (type.match ?? []).map(plain).filter(k => LATIN_KEYWORD.test(k));
178
241
  return {
179
- never: new Set([...STOCK_NEVER_WORDS, ...trade.map(stockWord)]),
180
- vocabulary: new Set(stockWords(type.label, ...latin, type.imagery)),
242
+ never: new Set([...STOCK_NEVER_WORDS, ...fears.map(stockWord)]),
243
+ vocabulary: new Set([...stockWords(type.label, ...latin, ...tagged), ...stockWords(type.imagery).filter(w => !IMAGERY_NOISE.has(w))]),
181
244
  };
182
245
  }
183
246
 
247
+ /** Does `word` name one of `words` — whole, or in a longer form of a word of `STEM_MIN` letters or more? */
248
+ function namesOneOf(word: string, words: ReadonlySet<string>): boolean {
249
+ if (words.has(word)) return true;
250
+ for (const w of words) if (w.length >= STEM_MIN && word.length > w.length && word.startsWith(w)) return true;
251
+ return false;
252
+ }
253
+
254
+ /** A word that names another trade's place, for a type whose vocabulary is `vocabulary`. */
255
+ const foreignTrade = (word: string, vocabulary: ReadonlySet<string>) => STOCK_TRADE_PLACE_WORDS.has(word) && !namesOneOf(word, vocabulary);
256
+
184
257
  /** A photo's tags (else its alt, split at commas) and the reviewer's notes, each as plain words between spaces. */
185
258
  function photoPhrases(photo: Pick<StockPhotoTraits, 'alt' | 'tags' | 'review'>): string[] {
186
259
  const tags = photo.tags?.length ? photo.tags : String(photo.alt ?? '').split(',');
187
260
  return [...tags, photo.review?.notes ?? ''].map(t => ` ${plain(String(t ?? '')).replace(/[^\p{L}\p{N}]+/gu, ' ').trim()} `);
188
261
  }
189
262
 
263
+ /** What a place is, as the fit reads it: its intent, and — an item — its own name's words. */
264
+ export interface StockFitPlace {
265
+ readonly intent: string;
266
+ /** A sample item's own name (`StockItemSlot.subject`): a photo that names it shows the item. */
267
+ readonly subject?: ReadonlyArray<string>;
268
+ }
269
+
190
270
  /**
191
- * Whether a photo may stand in a place on a site held to `fit`: none of its words is a never-word or phrase, and — in an
192
- * opening — a photo no operator approved names the business at least `STOCK_OPENING_TYPE_WORDS` times. An approved library
193
- * photo was seen for its type and needs no second word.
271
+ * Whether a photo may stand in a place on a site held to `fit`: none of its words is a never-word or phrase, and a photo no
272
+ * operator approved SHOWS THE BUSINESS — it names the type's vocabulary `STOCK_OPENING_TYPE_WORDS` times in an opening and
273
+ * `STOCK_PLACE_TYPE_WORDS` times anywhere else (iox-ui#175); an item's own name counts as the business's there (a
274
+ * "Bridal makeup" service, a makeup photo). Another trade's place word never counts. An approved library photo was seen for
275
+ * its type and needs no word. No type known (`STOCK_FIT_ANY`): the never-words only.
194
276
  */
195
- export function stockPhotoFits(photo: Pick<StockPhotoTraits, 'alt' | 'tags' | 'review'>, slot: { readonly intent: string }, fit: StockFit = STOCK_FIT_ANY): boolean {
277
+ export function stockPhotoFits(photo: Pick<StockPhotoTraits, 'alt' | 'tags' | 'review'>, slot: StockFitPlace, fit: StockFit = STOCK_FIT_ANY): boolean {
196
278
  const words = stockPhotoWords(photo);
197
279
  if (words.some(w => fit.never.has(w))) return false;
198
280
  const phrases = photoPhrases(photo);
199
281
  if (STOCK_NEVER_PHRASES.some(phrase => phrases.some(p => p.includes(` ${phrase} `)))) return false;
200
- if (!OPENING_INTENTS.has(slot.intent) || photo.review?.verdict === StockReviewVerdict.Approved || !fit.vocabulary.size) return true;
201
- return words.filter(w => fit.vocabulary.has(w)).length >= STOCK_OPENING_TYPE_WORDS;
282
+ if (photo.review?.verdict === StockReviewVerdict.Approved || !fit.vocabulary.size) return true;
283
+ return businessWordsOf(words, slot, fit) >= (OPENING_INTENTS.has(slot.intent) ? STOCK_OPENING_TYPE_WORDS : STOCK_PLACE_TYPE_WORDS);
284
+ }
285
+
286
+ /** How many distinct words of a photo name the business (the opening: its vocabulary; elsewhere an item's name too). */
287
+ function businessWordsOf(words: ReadonlyArray<string>, slot: StockFitPlace, fit: StockFit): number {
288
+ const own = OPENING_INTENTS.has(slot.intent) ? null : new Set((slot.subject ?? []).filter(w => !foreignTrade(w, fit.vocabulary)));
289
+ return words.filter(w => !foreignTrade(w, fit.vocabulary) && (namesOneOf(w, fit.vocabulary) || (!!own && own.has(w)))).length;
202
290
  }
203
291
 
204
292
  const intentRank = (intent: string) => STOCK_INTENT_ORDER.indexOf(intent as StockIntent);
@@ -1,4 +1,5 @@
1
1
  import { ComposedItem, ComposedPlaceholder, ComposedSite, openingContextOf, PlaceholderKind } from './compose-site';
2
+ import { FreeNode, FreeNodeType } from './free-wire';
2
3
  import { FingerprintedPage, wornOpenings } from './layout-fingerprint';
3
4
  import { LAYOUT_TEXT_KINDS, LayoutColour, LayoutLayer, LayoutLayerKind, LayoutRole, LayoutSection, LayoutSize } from './layout-language';
4
5
  import {
@@ -423,13 +424,18 @@ const isHome = (page: PagePlan) => page.isHome === true || page.route === '/';
423
424
  /**
424
425
  * The type-led first screen for a home page: the plan's own frame and words first, then the contract's ways
425
426
  * (`typeLedOpeningWays`), the first the site carries unmended (its tier, the business name's fit) that no OTHER site of
426
- * the studio opens on — else the first it carries, said as worn. Pure.
427
+ * the studio opens on — else the first it carries, said as worn. J10 lever (b): the plan's own way is tried first only
428
+ * when it is a COMPOSED way — never the bare band (the contract's last way: a heading, a line and one action on a full
429
+ * plain ground), which stays every site's last resort. Pure.
427
430
  */
428
431
  export function chooseTypeLedOpening(plan: SitePlan, context: TypeLedRoundContext = {}): { mix: OpeningMix; token: string; worn: boolean; ground: OpeningGround } {
429
432
  const own = openingMixOfPlan(plan);
433
+ const contract = typeLedOpeningWays();
434
+ const bare = contract[contract.length - 1];
435
+ const isBare = (m: Pick<OpeningMix, 'frame' | 'words'>) => m.frame === bare.frame && m.words === bare.words;
430
436
  // The plan's own frame and words, on no picture (a slow zoom has nothing to move: it goes with the picture).
431
- const mine = own ? [{ ...own, media: OpeningMedia.None, extras: [...own.extras], motion: own.motion.filter(m => m !== OpeningMotion.SlowZoom) }] : [];
432
- const ways = [...mine, ...typeLedOpeningWays()];
437
+ const mine = own && !isBare(own) ? [{ ...own, media: OpeningMedia.None, extras: [...own.extras], motion: own.motion.filter(m => m !== OpeningMotion.SlowZoom) }] : [];
438
+ const ways = [...mine, ...contract];
433
439
  const site = openingContextOf({ business: plan.business, design: plan.design, tier: context.tier ?? BASIC, badge: null, cutOut: false });
434
440
  const carried = ways.map(m => drawnOpeningMix(m).drawn).filter(m => !checkOpening(m, site).repairs.length);
435
441
  const worn = [...wornOpenings(context.studio ?? [])].map(openingTokenParts);
@@ -543,6 +549,13 @@ export function typeLedRound(
543
549
  });
544
550
  if (plated) next = { ...next, layout: { ...page.layout, sections: laidSections } };
545
551
  }
552
+ // iox-ui#180: a free Home whose opening holds a picture nothing fills gives its opening back to the plan's (the
553
+ // ready-made place a fall back would give) — then it opens type-led below, like every Home; the rest stays free.
554
+ const opening = next.free?.sections[0];
555
+ if (first && opening && !opening.readyMade && next.sections[0]) {
556
+ const given: FreeNode = { id: opening.id, type: FreeNodeType.Section, styleProps: {}, readyMade: { at: 0, pattern: next.sections[0].pattern } };
557
+ next = { ...next, free: { ...next.free!, sections: [given, ...next.free!.sections.slice(1)] } };
558
+ }
546
559
  if (first) { firstScreen = next; homeAt = p; }
547
560
  return next;
548
561
  });
@@ -560,7 +573,9 @@ export function typeLedRound(
560
573
  const hero = at >= 0 ? sections[at] : undefined;
561
574
  const takes = !!hero && !!typeLedOpeningSection(chosen.mix, hero);
562
575
  const nextPages = [...pages];
563
- nextPages[homeAt] = { ...home, sections };
576
+ // A free Home's ready-made places name their plan section by its pattern — the swapped one when it was swapped.
577
+ const free = home.free ? { ...home.free, sections: home.free.sections.map(s => (s.readyMade && sections[s.readyMade.at] ? { ...s, readyMade: { ...s.readyMade, pattern: sections[s.readyMade.at].pattern } } : s)) } : undefined;
578
+ nextPages[homeAt] = { ...home, sections, ...(free ? { free } : {}) };
564
579
  next = { ...next, pages: nextPages };
565
580
  if (takes) {
566
581
  const words = openingMixWords(chosen.mix);
@@ -40,7 +40,7 @@ export function businessComposeContext(typeId: string | null | undefined): Pick<
40
40
  * layouts' photos, its tier, the legal context its preflight read (AW1), whether its business is calm (AW6 — the body
41
41
  * takes no shaped edge), its kind of business for the footer (AW12), and — once the stock step has placed the pictures —
42
42
  * what fills them (iox-ui#129: a section nothing fills is composed type-led, an empty photo on a composed page a ground
43
- * plate). ONE reading, so every compose of a run's plan — each step, a resumed step, a redesign, the builder's Re-fit —
43
+ * plate), and whether the header's words read at rest over the home opening (HI3-D5, judged at preflight). ONE reading, so every compose of a run's plan — each step, a resumed step, a redesign, the builder's Re-fit —
44
44
  * composes the same site. Pure.
45
45
  */
46
46
  export function runComposeContext(run: ComposeRun): ComposeContext {
@@ -48,6 +48,8 @@ export function runComposeContext(run: ComposeRun): ComposeContext {
48
48
  const context: ComposeContext = {
49
49
  ...composeContextOf(run.year, decisions?.layoutPhotos, run.tier ?? undefined, decisions?.legal ?? null, isCalmBusinessType(decisions?.businessType)),
50
50
  ...businessComposeContext(decisions?.businessType),
51
+ // HI3-D5: the preflight judged the words at rest once, on the pixels it held; every step composes with that answer.
52
+ ...(typeof decisions?.headerReadable === 'boolean' ? { headerReadable: decisions.headerReadable } : {}),
51
53
  };
52
54
  return run.pictures ? { ...context, pictures: run.pictures } : context;
53
55
  }