@vectoriox/iox-ui 5.156.0 → 5.158.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.
@@ -436,7 +436,9 @@ export enum LayoutMendKind {
436
436
  /** Words over a busy or too-light part of a photo, in a look that allows scrims: the layer gets one. */
437
437
  Scrim = 'scrim',
438
438
  /** The accent on more layers than the look allows: the least important words go back to the ink, then — where words
439
- * cannot give enough back — the least important accent bands take the ground nearest the accent their words read on. */
439
+ * cannot give enough back — the least important accent bands take the ground nearest the accent their words read on,
440
+ * then the least important primary buttons step to secondary (never the main call to action — iox-ui#131: a page whose
441
+ * accent was on its buttons fell back whole). */
440
442
  Accent = 'accent',
441
443
  /** Words too faint on their ground, where the ink holds there: they go back to the ink. */
442
444
  Ink = 'ink',
@@ -485,6 +487,11 @@ export enum LayoutMendKind {
485
487
  * the column the type is offered first (`contained`) — said to the owner as `column-mended`. A word outside the
486
488
  * axis is dropped (the page wears the site's). */
487
489
  Column = 'column',
490
+ /** iox-ui#131: words a few characters too many for their box (a near miss): one size step down, where they then fit
491
+ * and the smaller size still holds them — never below a heading's reading size, never the opening's display. */
492
+ Size = 'size',
493
+ /** iox-ui#131: a form a column or two narrower than a form needs: it widens into empty cells of its own rows. */
494
+ Widen = 'widen',
488
495
  }
489
496
 
490
497
  /** What the build says when the column a page asked for was mended (award §0c CW2). */
@@ -543,7 +550,9 @@ export interface LayoutBandMove {
543
550
  export type LayoutMend =
544
551
  | { kind: LayoutMendKind.Scrim | LayoutMendKind.Ink | LayoutMendKind.Fade; layer: string }
545
552
  | { kind: LayoutMendKind.Scrub; layer: string; why: `${LayoutScrubRefusal}` }
546
- | { kind: LayoutMendKind.Accent; over: number; bands?: ReadonlyArray<LayoutBandMove> }
553
+ | { kind: LayoutMendKind.Accent; over: number; bands?: ReadonlyArray<LayoutBandMove>; buttons?: ReadonlyArray<string> }
554
+ | { kind: LayoutMendKind.Size; layer: string; size: `${LayoutSize}` }
555
+ | { kind: LayoutMendKind.Widen; layer: string; col: [number, number] }
547
556
  | { kind: LayoutMendKind.Depth; layers: ReadonlyArray<string> }
548
557
  | { kind: LayoutMendKind.Source; layer: string; source: string; by: `${LayoutSourceChoice}` }
549
558
  | { kind: LayoutMendKind.Words | LayoutMendKind.Drop | LayoutMendKind.Drift; layer: string }
@@ -36,6 +36,8 @@ const ROW_ROLES: Readonly<Record<OpeningIngredient, ReadonlyArray<string>>> = {
36
36
  [OpeningIngredient.Words]: [OpeningRole.Words, OpeningRole.Title, OpeningRole.Lead, OpeningRole.Action, OpeningRole.Apart, OpeningRole.ApartWord, OpeningRole.Aside, OpeningRole.Cutout, OpeningRole.Scrim],
37
37
  [OpeningIngredient.Extras]: [OpeningRole.Card, OpeningRole.Badge, OpeningRole.Cue],
38
38
  [OpeningIngredient.Motion]: [],
39
+ // iox-ui#131: a type-led first screen's ground is its frame's scheme.
40
+ [OpeningIngredient.Ground]: [OpeningRole.Frame, OpeningRole.FrameSettles],
39
41
  };
40
42
 
41
43
  /** The props that are the owner's CONTENT (words, pictures, a film, a form's identity) — never a sign of a hand edit. */
@@ -1,5 +1,6 @@
1
1
  import { DesignChoices, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
2
2
 
3
+ import { LAYOUT_INSET } from './layout-column';
3
4
  import { GenerationTier } from './site-plan.model';
4
5
  import { PatternNode, PatternPlaceholder, PatternRecipe, SitePattern } from './patterns';
5
6
  import { SerializedNode, walkSerialized } from './serialized-node';
@@ -49,6 +50,8 @@ interface OpeningTable {
49
50
  typeLed?: ReadonlyArray<{ frame: string; words: string }>;
50
51
  /** AW-D23 amended (2026-11-24): a type-led way is worn at every tier. */
51
52
  typeLedEveryTier?: boolean;
53
+ /** iox-ui#131: the grounds a type-led first screen may stand on, in the order tried (`inverse` first, no word). */
54
+ typeLedGrounds?: ReadonlyArray<string>;
52
55
  }
53
56
 
54
57
  /** The ingredients, by the contract's keys (held equal to it by opening-mix.spec). */
@@ -58,6 +61,8 @@ export enum OpeningIngredient {
58
61
  Words = 'words',
59
62
  Extras = 'extras',
60
63
  Motion = 'motion',
64
+ /** iox-ui#131: what a type-led first screen stands on (none named: the inverse scheme). The harness's alone. */
65
+ Ground = 'ground',
61
66
  }
62
67
 
63
68
  export enum OpeningFrame { Full = 'full', Inset = 'inset', Shrinks = 'shrinks', Grows = 'grows' }
@@ -65,6 +70,8 @@ export enum OpeningMedia { Photo = 'photo', Film = 'film', Slideshow = 'slidesho
65
70
  export enum OpeningWords { Headline = 'headline', OnEdge = 'on-edge', Apart = 'apart', Wordmark = 'wordmark', Behind = 'behind', None = 'none' }
66
71
  export enum OpeningExtra { Card = 'card', Badge = 'badge', Cue = 'cue' }
67
72
  export enum OpeningMotion { SlowZoom = 'slow-zoom', CopyOut = 'copy-out', PinnedCovered = 'pinned-covered' }
73
+ /** iox-ui#131: a type-led first screen's ground — `inverse` is the default and no word (the contract's `typeLedGrounds`). */
74
+ export enum OpeningGround { Inverse = 'inverse', Accent = 'accent', Subtle = 'subtle' }
68
75
 
69
76
  /** One word for each of frame, media and words; a list (in the table's order) for extras and motion. */
70
77
  export interface OpeningMix {
@@ -73,6 +80,8 @@ export interface OpeningMix {
73
80
  words: string;
74
81
  extras: string[];
75
82
  motion: string[];
83
+ /** iox-ui#131: at most one word; empty — the inverse scheme. Worn by a type-led first screen only. */
84
+ ground: string[];
76
85
  }
77
86
 
78
87
  export class OpeningMixError extends Error {}
@@ -122,7 +131,7 @@ const MANY: ReadonlySet<string> = new Set(O.many);
122
131
  const WAITS = O.waits;
123
132
  const ORDER: ReadonlyArray<OpeningIngredient> = Object.values(OpeningIngredient);
124
133
 
125
- const isMany = (k: string): k is OpeningIngredient.Extras | OpeningIngredient.Motion => MANY.has(k);
134
+ const isMany = (k: string): k is OpeningIngredient.Extras | OpeningIngredient.Motion | OpeningIngredient.Ground => MANY.has(k);
126
135
 
127
136
  /** The words an ingredient may take, in the table's order. */
128
137
  export function openingWords(ingredient: `${OpeningIngredient}`): ReadonlyArray<string> {
@@ -164,13 +173,14 @@ const ordered = (k: string, words: ReadonlyArray<string>): string[] => openingWo
164
173
  export function openingMix(partial: Partial<Record<string, string | ReadonlyArray<string>>> = {}): OpeningMix {
165
174
  const mix: OpeningMix = {
166
175
  frame: O.defaults['frame'] as string, media: O.defaults['media'] as string, words: O.defaults['words'] as string,
167
- extras: listOf(O.defaults['extras']), motion: listOf(O.defaults['motion']),
176
+ extras: listOf(O.defaults['extras']), motion: listOf(O.defaults['motion']), ground: listOf(O.defaults['ground']),
168
177
  };
169
178
  for (const [k, v] of Object.entries(partial)) {
170
179
  if (v === undefined) continue;
171
180
  if (!INGREDIENTS[k]) throw new OpeningMixError(`no opening ingredient "${k}"`);
172
181
  const words = listOf(v);
173
182
  for (const w of words) if (!INGREDIENTS[k].includes(w)) throw new OpeningMixError(`an opening's ${k} cannot be "${w}" (${INGREDIENTS[k].join(' · ')})`);
183
+ if (k === OpeningIngredient.Ground && words.length > 1) throw new OpeningMixError(`an opening stands on one ground ("${words.join('" and "')}")`);
174
184
  if (isMany(k)) mix[k] = ordered(k, words);
175
185
  else if (words.length !== 1) throw new OpeningMixError(`an opening has one ${k}`);
176
186
  else (mix as unknown as Record<string, string>)[k] = words[0];
@@ -331,9 +341,26 @@ export function drawnOpeningMix(mix: OpeningMix): { drawn: OpeningMix; gaps: Ope
331
341
  /** The fingerprint's prefix for an opening. */
332
342
  export const OPENING_TOKEN = 'opening';
333
343
 
334
- /** An opening as the fingerprint sees it: `opening:<frame>/<media>/<words>` — what a visitor takes in at once. */
344
+ /** What a type-led token says its ground is (`+<ground>`, iox-ui#131). */
345
+ const GROUND_MARK = '+';
346
+
347
+ /** An opening as the fingerprint sees it: `opening:<frame>/<media>/<words>` — what a visitor takes in at once; a type-led
348
+ * first screen on a ground other than the inverse adds it (`opening:full/none/wordmark+accent`, iox-ui#131). */
335
349
  export function openingTokenOf(mix: OpeningMix): string {
336
- return `${OPENING_TOKEN}:${O.fingerprint.map(k => (mix as unknown as Record<string, string>)[k]).join('/')}`;
350
+ const way = `${OPENING_TOKEN}:${O.fingerprint.map(k => (mix as unknown as Record<string, string>)[k]).join('/')}`;
351
+ const ground = mix.media === OpeningMedia.None ? mix.ground?.[0] : undefined;
352
+ return ground ? `${way}${GROUND_MARK}${ground}` : way;
353
+ }
354
+
355
+ /** iox-ui#131: a token's way (frame, media, words) and its ground — `inverse` when it names none. */
356
+ export function openingTokenParts(token: string): { way: string; ground: string } {
357
+ const [way, ground] = token.split(GROUND_MARK);
358
+ return { way, ground: ground || OpeningGround.Inverse };
359
+ }
360
+
361
+ /** iox-ui#131: the grounds a type-led first screen may stand on, in the order tried; a calm look never takes the accent. */
362
+ export function typeLedGrounds(calm = false): OpeningGround[] {
363
+ return ((O.typeLedGrounds ?? [OpeningGround.Inverse]) as OpeningGround[]).filter(g => !(calm && g === OpeningGround.Accent));
337
364
  }
338
365
 
339
366
  /** Every `<ingredient>:<word>` the generator's wire may carry at `tier`: drawn words only (a waiting word is never
@@ -493,6 +520,7 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
493
520
  m.extras = m.extras.filter(w => w !== OpeningExtra.Card);
494
521
  say(OpeningRepairCode.OneCard, 'the form is the first screen\'s card: the small card is left out');
495
522
  }
523
+ if (m.ground.length && m.media !== OpeningMedia.None) m.ground = [];
496
524
  const still = m.media === OpeningMedia.Photo || m.media === OpeningMedia.Diptych || m.media === OpeningMedia.Live;
497
525
  if (m.motion.includes(OpeningMotion.SlowZoom) && !still) {
498
526
  m.motion = m.motion.filter(w => w !== OpeningMotion.SlowZoom);
@@ -521,6 +549,9 @@ const ABS_FILL: Readonly<Record<string, string>> = { position: 'absolute', top:
521
549
  const MEDIA_FILL: Readonly<Record<string, string>> = { ...ABS_FILL, aspectRatio: 'auto', borderRadius: '0px', objectFit: 'cover' };
522
550
  const OVER = (z: number): Readonly<Record<string, string>> => ({ position: 'relative', zIndex: String(z) });
523
551
  const FRAME_PAD = 'clamp(20px, 4vw, 56px)';
552
+ /** iox-ui#133 (AW-D41, one edge): a frame's words start on the content column every other section starts on — its inline
553
+ * padding is never less than `space-inline`; the frame itself may bleed, its words do not. */
554
+ const framePadding = (block: string): string => `${block} max(${block}, ${LAYOUT_INSET})`;
524
555
  /** A display line is sized a little under its measured width, so a rounding never wraps it. */
525
556
  const FIT = 0.95;
526
557
 
@@ -544,17 +575,17 @@ function frameNode(mix: OpeningMix, children: PatternNode[]): PatternNode {
544
575
  const inset = mix.frame === OpeningFrame.Inset || mix.frame === OpeningFrame.Shrinks;
545
576
  const height = mix.media === OpeningMedia.None ? typeLedHeights(mix) : { laptop: OPENING_HEIGHT };
546
577
  const phone = {
547
- ...(inset ? { clipPath: insetClip(openingPhoneInset()), padding: phoneFramePad(mix) } : {}),
578
+ ...(inset ? { clipPath: insetClip(openingPhoneInset()), padding: framePadding(phoneFramePad(mix)) } : {}),
548
579
  ...(height.phone ? { minHeight: height.phone } : {}),
549
580
  };
550
581
  return {
551
582
  // A pictured frame is a box its picture fills; a type-led one (no picture) paints its scheme's own ground — a
552
583
  // box paints nothing, and the scheme's light words stood on the page's light ground (the #129 proof's shots).
553
- t: 'Container', es: mix.media === OpeningMedia.None ? 'section' : 'box', scheme: 'inverse',
584
+ t: 'Container', es: mix.media === OpeningMedia.None ? 'section' : 'box', scheme: mix.media === OpeningMedia.None ? (mix.ground?.[0] ?? OpeningGround.Inverse) : OpeningGround.Inverse,
554
585
  role: mix.frame === OpeningFrame.Shrinks ? OpeningRole.FrameSettles : OpeningRole.Frame,
555
586
  lay: {
556
587
  position: 'relative', overflow: 'hidden', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', gap: 'var(--iox-space-gap)',
557
- minHeight: height.laptop, padding: inset ? `calc(${INSET_LAPTOP} + ${FRAME_PAD})` : FRAME_PAD, borderRadius: '0px',
588
+ minHeight: height.laptop, padding: framePadding(inset ? `calc(${INSET_LAPTOP} + ${FRAME_PAD})` : FRAME_PAD), borderRadius: '0px',
558
589
  ...(inset ? { clipPath: insetClip(INSET_LAPTOP) } : {}),
559
590
  },
560
591
  ...(Object.keys(phone).length ? { resp: { mobile: phone } } : {}),
@@ -749,7 +780,7 @@ function wordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[] {
749
780
  : { t: 'Heading', es: 'display', level: 'h2', text: w, role: OpeningRole.ApartWord, lay: { fontSize: size, lineHeight: '0.9', margin: '0px', ...place[i] } });
750
781
  return [scrim(), {
751
782
  t: 'Container', es: 'box', role: OpeningRole.Apart,
752
- lay: { ...ABS_FILL, zIndex: '1', display: 'grid', gridTemplateRows: 'repeat(3, minmax(0, 1fr))', padding: FRAME_PAD },
783
+ lay: { ...ABS_FILL, zIndex: '1', display: 'grid', gridTemplateRows: 'repeat(3, minmax(0, 1fr))', padding: framePadding(FRAME_PAD) },
753
784
  c: words.map(word),
754
785
  }, aside('bottom')];
755
786
  }
@@ -29,6 +29,17 @@ export interface PlanWordContext {
29
29
  * they are editing — a phone number on their own page is theirs to move or keep. Never a model's earlier answer.
30
30
  */
31
31
  known?: ReadonlyArray<string>;
32
+ /**
33
+ * Judge bare numbers too (a free section, award plan §11.4 FS3 gate 1): "since 1998", "1,200 clients", "320 m²" — any
34
+ * number of three digits or more that is not part of an email, phone, price or time and that no owner text holds.
35
+ * Off for the plan's words, whose slots carry counts the composer owns.
36
+ */
37
+ numbers?: boolean;
38
+ /**
39
+ * Judge quotes too (a free section, FS3): words in quotation marks — three words or more — that no owner text holds
40
+ * are a testimonial or a saying the model made up, and a quote is a fact (R-H6).
41
+ */
42
+ quotes?: boolean;
32
43
  }
33
44
 
34
45
  /** A text a model wrote, and where. */
@@ -94,6 +105,23 @@ const FACT_SHAPES: ReadonlyArray<{ kind: string; pattern: RegExp; key: (match: s
94
105
  { kind: 'time', pattern: /(?<!\d)\d{1,2}[:.]\d{2}(?!\d)/g, key: m => m.replace(/\D/g, '') },
95
106
  ];
96
107
 
108
+ /** A bare number of three digits or more (`numbers` only); a phone, a price or a time is judged as one first. */
109
+ const NUMBER_SHAPE = { kind: 'number', pattern: /(?<![\p{L}\p{N}])\d[\d,.]*\d(?![\p{L}\p{N}])/gu, key: (m: string) => m.replace(/\D/g, '') };
110
+ const MIN_NUMBER_DIGITS = 3;
111
+
112
+ /** A quotation: three words or more between quotation marks that stand outside a word (a Hebrew gershayim inside one —
113
+ * ש״ח, צה״ל — is not a quote mark). */
114
+ const QUOTE = /(?<![\p{L}\p{N}])["“„«״]([^"“”„«»״\n]+?)["”»״](?![\p{L}\p{N}])/gu;
115
+ const MIN_QUOTE_WORDS = 3;
116
+ const QUOTE_WORDS = /[\p{L}\p{N}]+/gu;
117
+ /** A text's words, lower case, one space apart — what a quote is found in. */
118
+ const plainWords = (text: string): string => ` ${(normalise(text).match(QUOTE_WORDS) ?? []).join(' ')} `;
119
+
120
+ /** Every quotation in `text` of three words or more, as written between its marks. */
121
+ export function quotesIn(text: string): string[] {
122
+ return [...String(text ?? '').matchAll(QUOTE)].map(m => m[1].trim()).filter(q => (q.match(QUOTE_WORDS) ?? []).length >= MIN_QUOTE_WORDS);
123
+ }
124
+
97
125
  /** Every price written in `text` (commerce C-D21: what a business sells never carries one — the owner sets prices). */
98
126
  export function pricesIn(text: string): string[] {
99
127
  return (text.match(PRICE_SHAPE.pattern) ?? []).map(m => m.trim());
@@ -103,15 +131,22 @@ const MIN_PHONE_DIGITS = 8;
103
131
  /** "2019 – 2024" is two years, not a phone number. */
104
132
  const YEAR_RANGE = /^\s*\d{4}\s*[-–]\s*\d{4}\s*$/;
105
133
 
106
- function ownedKeys(facts: PlanWordContext['facts'], known: ReadonlyArray<string> = []): Set<string> {
134
+ function ownedKeys(facts: PlanWordContext['facts'], known: ReadonlyArray<string> = [], numbers = false): Set<string> {
107
135
  const keys = new Set<string>();
136
+ const shapes = numbers ? [...FACT_SHAPES, NUMBER_SHAPE] : FACT_SHAPES;
108
137
  for (const value of [...Object.values(facts), ...known]) {
109
138
  if (typeof value !== 'string') continue;
110
- for (const shape of FACT_SHAPES) for (const m of value.match(shape.pattern) ?? []) keys.add(`${shape.kind}:${shape.key(m)}`);
139
+ for (const shape of shapes) for (const m of value.match(shape.pattern) ?? []) keys.add(`${shape.kind}:${shape.key(m)}`);
111
140
  }
112
141
  return keys;
113
142
  }
114
143
 
144
+ /** `text` with every email, real phone, price and time blanked — what is left for the bare-number shape. */
145
+ function withoutFactShapes(text: string): string {
146
+ return FACT_SHAPES.reduce((rest, shape) => rest.replace(shape.pattern, m =>
147
+ (shape.kind === 'phone' && (shape.key(m).length < MIN_PHONE_DIGITS || YEAR_RANGE.test(m)) ? m : ' ')), text);
148
+ }
149
+
115
150
  /**
116
151
  * The words to avoid and the facts never given, in any texts a model wrote — the plan's (`planWordIssues`) and an AI
117
152
  * Assist turn's field values (assist-core, R-H2): ONE judge of what a model may write.
@@ -119,7 +154,7 @@ function ownedKeys(facts: PlanWordContext['facts'], known: ReadonlyArray<string>
119
154
  export function factIssues(texts: ReadonlyArray<WrittenText>, ctx: PlanWordContext): PlanWordIssue[] {
120
155
  const issues: PlanWordIssue[] = [];
121
156
  const avoid = [...new Set(ctx.avoidWords.map(w => w.trim()).filter(Boolean))].map(w => ({ word: w, pattern: wordPattern(w) }));
122
- const owned = ownedKeys(ctx.facts, ctx.known);
157
+ const owned = ownedKeys(ctx.facts, ctx.known, ctx.numbers);
123
158
  for (const { path, text } of texts) {
124
159
  const words = normalise(text);
125
160
  for (const a of avoid) if (a.pattern.test(words)) issues.push({ code: PlanWordIssueCode.AvoidWord, path, message: `uses "${a.word}" — a word this site must not use` });
@@ -130,6 +165,18 @@ export function factIssues(texts: ReadonlyArray<WrittenText>, ctx: PlanWordConte
130
165
  if (!owned.has(`${shape.kind}:${key}`)) issues.push({ code: PlanWordIssueCode.InventedFact, path, message: `"${m.trim()}" looks like a ${shape.kind} the owner never gave — leave it out` });
131
166
  }
132
167
  }
168
+ if (ctx.quotes) {
169
+ const owners = [...Object.values(ctx.facts), ...(ctx.known ?? [])].filter((v): v is string => typeof v === 'string').map(plainWords);
170
+ for (const q of quotesIn(text)) {
171
+ if (!owners.some(o => o.includes(plainWords(q)))) issues.push({ code: PlanWordIssueCode.InventedFact, path, message: `"${q}" reads as a quote the owner never gave — a quote is a fact: leave it out` });
172
+ }
173
+ }
174
+ if (ctx.numbers) {
175
+ for (const m of withoutFactShapes(text).match(NUMBER_SHAPE.pattern) ?? []) {
176
+ const key = NUMBER_SHAPE.key(m);
177
+ if (key.length >= MIN_NUMBER_DIGITS && !owned.has(`number:${key}`)) issues.push({ code: PlanWordIssueCode.InventedFact, path, message: `"${m.trim()}" looks like a number the owner never gave — leave it out` });
178
+ }
179
+ }
133
180
  }
134
181
  return issues;
135
182
  }
@@ -0,0 +1,96 @@
1
+ import { patternById, PatternNode } from './patterns';
2
+ import { wordPattern } from './plan-words';
3
+ import { PageSectionPlan } from './site-plan.model';
4
+
5
+ /**
6
+ * WHAT THE OWNER'S PROMPT RULED OUT, AS A READY-MADE SECTION CAN BREAK IT (award plan FS-D47, R-H20). The reading keeps
7
+ * the owner's refused and asked words as they wrote them (§11.4a); a ready-made section can only break the few of them
8
+ * that a pattern decides by its parts — pictures, a video, motion. Those are read here, in English and Hebrew, from the
9
+ * reading's own lists (never guessed from taste words), and judged against a plan section's pattern as it would be
10
+ * stamped (its `without` parts left out). The fall back picks only among sections that honour them; when it cannot, the
11
+ * followed line SAYS which of the owner's words the page no longer follows. Pure.
12
+ */
13
+
14
+ export enum PromptLimit {
15
+ /** "no pictures", "only the names", "mostly words". */
16
+ NoPictures = 'no-pictures',
17
+ NoVideo = 'no-video',
18
+ /** "nothing moving", "no animation". */
19
+ NoMotion = 'no-motion',
20
+ }
21
+
22
+ /** A refused entry that IS one of these words rules the thing out ("pictures"; never "stock photos", which refuses stock). */
23
+ const REFUSED_WORDS: Readonly<Record<PromptLimit, ReadonlyArray<string>>> = {
24
+ [PromptLimit.NoPictures]: ['pictures', 'photos', 'photographs', 'images', 'תמונות', 'צילומים'],
25
+ [PromptLimit.NoVideo]: ['video', 'videos', 'film', 'films', 'וידאו', 'סרטון', 'סרטונים'],
26
+ [PromptLimit.NoMotion]: ['motion', 'animation', 'animations', 'movement', 'תנועה', 'אנימציה', 'אנימציות'],
27
+ };
28
+ /** A phrase that rules the thing out wherever the reading kept it (asked, said or refused). */
29
+ const RULING_PHRASES: Readonly<Record<PromptLimit, ReadonlyArray<string>>> = {
30
+ [PromptLimit.NoPictures]: ['no pictures', 'no photos', 'no images', 'without pictures', 'without photos', 'mostly words', 'only words', 'just words', 'בלי תמונות', 'ללא תמונות', 'רק מילים', 'בלי צילומים'],
31
+ [PromptLimit.NoVideo]: ['no video', 'no videos', 'without video', 'בלי וידאו', 'בלי סרטונים', 'ללא וידאו', 'ללא סרטונים'],
32
+ [PromptLimit.NoMotion]: ['no motion', 'no animation', 'no animations', 'nothing moving', 'without motion', 'בלי תנועה', 'בלי אנימציה', 'בלי אנימציות', 'ללא תנועה'],
33
+ };
34
+
35
+ /** The reading's lists as the free-page brief keeps them (§11.4a). */
36
+ export interface PromptReading {
37
+ readonly refused?: ReadonlyArray<string>;
38
+ readonly asked?: ReadonlyArray<string>;
39
+ readonly said?: ReadonlyArray<string>;
40
+ }
41
+
42
+ const plain = (s: string) => String(s ?? '').normalize('NFKC').toLowerCase().replace(/^(any|no|בלי|ללא)\s+/, '').trim();
43
+
44
+ /** What the owner's words rule out that a ready-made section could break. */
45
+ export function promptLimitsOf(reading: PromptReading | null | undefined): PromptLimit[] {
46
+ const refused = (reading?.refused ?? []).map(plain);
47
+ const all = [...(reading?.refused ?? []), ...(reading?.asked ?? []), ...(reading?.said ?? [])].map(s => String(s ?? ''));
48
+ return Object.values(PromptLimit).filter(limit =>
49
+ refused.some(r => REFUSED_WORDS[limit].includes(r))
50
+ || RULING_PHRASES[limit].some(phrase => all.some(text => wordPattern(phrase).test(text.normalize('NFKC').toLowerCase()))));
51
+ }
52
+
53
+ const PICTURE_TYPES: ReadonlyArray<string> = ['Image', 'Gallery'];
54
+ const CARD_RECIPE = 'card';
55
+ const CARD_MEDIA = 'media';
56
+ const IMAGE_BIND = 'image';
57
+
58
+ function shows(node: PatternNode, without: ReadonlySet<string>, out: Set<PromptLimit>): void {
59
+ if (node.optional && without.has(node.optional)) return;
60
+ // a picture node, or a recipe that draws one: a card keeps its media part unless switched off, a bound image
61
+ if (PICTURE_TYPES.includes(node.t) || (node.recipe === CARD_RECIPE && node.parts?.[CARD_MEDIA] !== false) || node.binds?.[IMAGE_BIND]) out.add(PromptLimit.NoPictures);
62
+ if (node.t === 'Video') out.add(PromptLimit.NoVideo);
63
+ if (node.tracks?.length) out.add(PromptLimit.NoMotion);
64
+ for (const child of node.c ?? []) shows(child, without, out);
65
+ }
66
+
67
+ /** The owner's limits a plan section would break, stamped as planned (an unknown pattern breaks none it can be judged on). */
68
+ export function sectionBreaks(section: PageSectionPlan, limits: ReadonlyArray<PromptLimit>): PromptLimit[] {
69
+ const pattern = patternById(section.pattern);
70
+ if (!pattern || !limits.length) return [];
71
+ const found = new Set<PromptLimit>();
72
+ if (pattern.scene || pattern.film) found.add(PromptLimit.NoMotion);
73
+ shows(pattern.node, new Set(section.without ?? []), found);
74
+ return limits.filter(l => found.has(l));
75
+ }
76
+
77
+ /** One sentence per limit broken, in the site's language: n sections are ready-made and do what the owner ruled out. */
78
+ const UNFOLLOWED: Readonly<Record<'en' | 'he', Readonly<Record<PromptLimit, (n: number) => string>>>> = {
79
+ en: {
80
+ [PromptLimit.NoPictures]: n => `${n === 1 ? 'One section is' : `${n} sections are`} ready-made and ${n === 1 ? 'shows' : 'show'} pictures, which you asked to leave out.`,
81
+ [PromptLimit.NoVideo]: n => `${n === 1 ? 'One section is' : `${n} sections are`} ready-made and ${n === 1 ? 'plays a video' : 'play videos'}, which you asked to leave out.`,
82
+ [PromptLimit.NoMotion]: n => `${n === 1 ? 'One section is' : `${n} sections are`} ready-made and ${n === 1 ? 'moves' : 'move'} as the page scrolls, which you asked to leave out.`,
83
+ },
84
+ he: {
85
+ [PromptLimit.NoPictures]: n => `${n === 1 ? 'חלק אחד מוכן מראש ומציג' : `${n} חלקים מוכנים מראש ומציגים`} תמונות, אף שביקשת בלי תמונות.`,
86
+ [PromptLimit.NoVideo]: n => `${n === 1 ? 'חלק אחד מוכן מראש ומציג סרטון' : `${n} חלקים מוכנים מראש ומציגים סרטונים`}, אף שביקשת בלי סרטונים.`,
87
+ [PromptLimit.NoMotion]: n => `${n === 1 ? 'חלק אחד מוכן מראש וזז' : `${n} חלקים מוכנים מראש וזזים`} עם הגלילה, אף שביקשת בלי תנועה.`,
88
+ },
89
+ };
90
+
91
+ /** The followed line after a fall back: the model's line, then what the page no longer follows (never a claim kept). */
92
+ export function followedAfter(line: string, broken: ReadonlyMap<PromptLimit, number>, language: string | null | undefined): string {
93
+ const words = UNFOLLOWED[language === 'he' ? 'he' : 'en'];
94
+ const said = Object.values(PromptLimit).filter(l => (broken.get(l) ?? 0) > 0).map(l => words[l](broken.get(l)!));
95
+ return [String(line ?? '').trim(), ...said].filter(Boolean).join(' ');
96
+ }
@@ -60,6 +60,10 @@ export * from './layout-render-check';
60
60
  export * from './layout-drift';
61
61
  export * from './layout-type';
62
62
  export * from './layout-section-fallback';
63
+ export * from './free-wire';
64
+ export * from './check-free';
65
+ export * from './free-fallback';
66
+ export * from './prompt-limits';
63
67
  export * from './layout-photos';
64
68
  export * from './photo-inventory';
65
69
  export * from './check-layout';
@@ -9003,11 +9003,16 @@ export const SPEC_SITE_LAYOUT = {
9003
9003
  "slow-zoom",
9004
9004
  "copy-out",
9005
9005
  "pinned-covered"
9006
+ ],
9007
+ "ground": [
9008
+ "accent",
9009
+ "subtle"
9006
9010
  ]
9007
9011
  },
9008
9012
  "many": [
9009
9013
  "extras",
9010
- "motion"
9014
+ "motion",
9015
+ "ground"
9011
9016
  ],
9012
9017
  "meanings": {
9013
9018
  "frame.full": "edge to edge",
@@ -9033,7 +9038,9 @@ export const SPEC_SITE_LAYOUT = {
9033
9038
  "extras.cue": "a quiet scroll cue",
9034
9039
  "motion.slow-zoom": "the picture slowly zooms (15 s or longer), still under reduced motion",
9035
9040
  "motion.copy-out": "the first screen's words fade as the page leaves it, following the scroll",
9036
- "motion.pinned-covered": "the first screen holds while the next section slides over it"
9041
+ "motion.pinned-covered": "the first screen holds while the next section slides over it",
9042
+ "ground.accent": "a type-led first screen on the look's accent",
9043
+ "ground.subtle": "a type-led first screen on the look's quiet tint"
9037
9044
  },
9038
9045
  "meaningsHe": {
9039
9046
  "frame.full": "מקצה לקצה",
@@ -9059,7 +9066,9 @@ export const SPEC_SITE_LAYOUT = {
9059
9066
  "extras.cue": "סימן גלילה שקט",
9060
9067
  "motion.slow-zoom": "התמונה מתקרבת לאט (15 שניות ויותר), ונשארת דוממת כשמבקשים פחות תנועה",
9061
9068
  "motion.copy-out": "המילים של המסך הראשון נמוגות כשהדף עוזב אותו, עם הגלילה",
9062
- "motion.pinned-covered": "המסך הראשון נשאר במקומו והחלק הבא מחליק מעליו"
9069
+ "motion.pinned-covered": "המסך הראשון נשאר במקומו והחלק הבא מחליק מעליו",
9070
+ "ground.accent": "מסך ראשון של מילים, על צבע ההדגשה של המראה",
9071
+ "ground.subtle": "מסך ראשון של מילים, על הגוון השקט של המראה"
9063
9072
  },
9064
9073
  "waits": {
9065
9074
  "frame.grows": {
@@ -9080,10 +9089,13 @@ export const SPEC_SITE_LAYOUT = {
9080
9089
  "media": "photo",
9081
9090
  "words": "headline",
9082
9091
  "extras": [],
9083
- "motion": []
9092
+ "motion": [],
9093
+ "ground": []
9084
9094
  },
9085
9095
  "harness": [
9086
- "media.none"
9096
+ "media.none",
9097
+ "ground.accent",
9098
+ "ground.subtle"
9087
9099
  ],
9088
9100
  "typeLed": [
9089
9101
  {
@@ -9124,6 +9136,11 @@ export const SPEC_SITE_LAYOUT = {
9124
9136
  }
9125
9137
  ],
9126
9138
  "typeLedEveryTier": true,
9139
+ "typeLedGrounds": [
9140
+ "inverse",
9141
+ "subtle",
9142
+ "accent"
9143
+ ],
9127
9144
  "named": {
9128
9145
  "hero.split": {},
9129
9146
  "hero.full-bleed-media": {
@@ -9261,6 +9278,8 @@ export const SPEC_SITE_LAYOUT = {
9261
9278
  "media.object": "all",
9262
9279
  "media.none": "all",
9263
9280
  "words.headline": "all",
9281
+ "ground.accent": "all",
9282
+ "ground.subtle": "all",
9264
9283
  "rules.wordsNeverCut": "all",
9265
9284
  "rules.badgeOwnersOnly": "all",
9266
9285
  "rules.neverHoldsScroll": "all",
@@ -3,8 +3,8 @@ import { FingerprintedPage, wornOpenings } from './layout-fingerprint';
3
3
  import { LayoutIssue, LayoutIssueCode, LayoutLayerKind, LayoutPage, LayoutSection } from './layout-language';
4
4
  import { fallBackBySection, SectionFallbackLastResort, SectionSwapAction } from './layout-section-fallback';
5
5
  import {
6
- checkOpening, drawnOpeningMix, OPENING_MIX_PROP, OpeningMedia, OpeningMix, OpeningMotion, openingMixOfPlan, openingMixWords, openingTokenOf, typeLedOpeningSection,
7
- typeLedOpeningWays,
6
+ checkOpening, drawnOpeningMix, OPENING_MIX_PROP, OpeningGround, OpeningMedia, OpeningMix, openingMixOfPlan, openingMixWords, OpeningMotion,
7
+ openingTokenOf, openingTokenParts, typeLedGrounds, typeLedOpeningSection, typeLedOpeningWays,
8
8
  } from './opening-mix';
9
9
  import type { GenerationTier } from './site-plan.model';
10
10
  import { patternById, patternLinkSlots, patternOptionalParts, patternSlots, slotBudget } from './patterns';
@@ -107,8 +107,10 @@ export interface TypeLedChange {
107
107
  export interface TypeLedOpening {
108
108
  /** The mix's words, as `plan.mixes.opening` holds them. */
109
109
  words: string[];
110
- /** `opening:<frame>/none/<words>` — what the memory records and compares (`openingTokenOf`). */
110
+ /** `opening:<frame>/none/<words>[+<ground>]` — what the memory records and compares (`openingTokenOf`). */
111
111
  token: string;
112
+ /** iox-ui#131: what the first screen stands on (`inverse` when the token names none). */
113
+ ground: `${OpeningGround}`;
112
114
  /** Set when every way the site can carry is already another site's: it opens on the first of them anyway. */
113
115
  worn?: true;
114
116
  }
@@ -291,18 +293,38 @@ const isHome = (page: PagePlan) => page.isHome === true || page.route === '/';
291
293
  * (`typeLedOpeningWays`), the first the site carries unmended (its tier, the business name's fit) that no OTHER site of
292
294
  * the studio opens on — else the first it carries, said as worn. Pure.
293
295
  */
294
- export function chooseTypeLedOpening(plan: SitePlan, context: TypeLedRoundContext = {}): { mix: OpeningMix; token: string; worn: boolean } {
296
+ export function chooseTypeLedOpening(plan: SitePlan, context: TypeLedRoundContext = {}): { mix: OpeningMix; token: string; worn: boolean; ground: OpeningGround } {
295
297
  const own = openingMixOfPlan(plan);
296
298
  // The plan's own frame and words, on no picture (a slow zoom has nothing to move: it goes with the picture).
297
299
  const mine = own ? [{ ...own, media: OpeningMedia.None, extras: [...own.extras], motion: own.motion.filter(m => m !== OpeningMotion.SlowZoom) }] : [];
298
300
  const ways = [...mine, ...typeLedOpeningWays()];
299
301
  const site = openingContextOf({ business: plan.business, design: plan.design, tier: context.tier ?? BASIC, badge: null, cutOut: false });
300
302
  const carried = ways.map(m => drawnOpeningMix(m).drawn).filter(m => !checkOpening(m, site).repairs.length);
301
- const worn = wornOpenings(context.studio ?? []);
302
- const free = carried.find(m => !worn.has(openingTokenOf(m)));
303
+ const worn = [...wornOpenings(context.studio ?? [])].map(openingTokenParts);
304
+ const wornWays = new Set(worn.map(w => w.way));
305
+ const wayOf = (m: OpeningMix) => openingTokenOf({ ...m, ground: [] });
306
+ const free = carried.find(m => !wornWays.has(wayOf(m)));
303
307
  // The contract's last way is every tier's and fits any name (a heading): there is always one.
304
- const mix = free ?? carried[0] ?? checkOpening(ways[ways.length - 1], site).mix;
305
- return { mix, token: openingTokenOf(mix), worn: !free };
308
+ const way = free ?? carried[0] ?? checkOpening(ways[ways.length - 1], site).mix;
309
+ const ground = typeLedGroundFor(worn.filter(w => w.way.includes(TYPE_LED_MEDIA)), plan);
310
+ const mix: OpeningMix = { ...way, ground: ground === OpeningGround.Inverse ? [] : [ground] };
311
+ return { mix, token: openingTokenOf(mix), worn: !free, ground };
312
+ }
313
+
314
+ /** A token's media part when the first screen holds no picture (`opening:<frame>/none/<words>`). */
315
+ const TYPE_LED_MEDIA = `/${OpeningMedia.None}/`;
316
+ /** How animated, at which a look is calm: its type-led first screen never stands on the accent. */
317
+ const CALM_ANIMATE: ReadonlySet<string> = new Set(['still', 'subtle']);
318
+
319
+ /**
320
+ * iox-ui#131: what a type-led first screen stands on — the ground the studio's OTHER type-led sites wear least (the
321
+ * contract's `typeLedGrounds` order breaks a tie, `inverse` first), so six type-led Homes do not all open dark. A calm
322
+ * look never takes the accent. Pure.
323
+ */
324
+ export function typeLedGroundFor(others: ReadonlyArray<{ ground: string }>, plan: Pick<SitePlan, 'design'>): OpeningGround {
325
+ const grounds = typeLedGrounds(CALM_ANIMATE.has(String(plan.design?.animate ?? '')));
326
+ const count = (g: string) => others.filter(o => o.ground === g).length;
327
+ return grounds.reduce((best, g) => (count(g) < count(best) ? g : best), grounds[0]);
306
328
  }
307
329
 
308
330
  /**
@@ -417,7 +439,7 @@ export function typeLedRound(
417
439
  if (takes) {
418
440
  const words = openingMixWords(chosen.mix);
419
441
  next = { ...next, mixes: { ...next.mixes, opening: words } };
420
- opening = { words, token: chosen.token, ...(chosen.worn ? { worn: true as const } : {}) };
442
+ opening = { words, token: chosen.token, ground: chosen.ground, ...(chosen.worn ? { worn: true as const } : {}) };
421
443
  const was = plan.mixes?.opening?.join(' ');
422
444
  if (was !== words.join(' ')) {
423
445
  changes.push({