@vectoriox/iox-ui 5.155.0 → 5.157.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.
@@ -43,6 +43,12 @@ interface OpeningTable {
43
43
  rules: { wordsNeverCut: boolean; phoneInsetPx: readonly [number, number]; slowZoomMinS: number; badgeOwnersOnly: boolean; neverHoldsScroll: boolean };
44
44
  tiers: Readonly<Record<string, 'all' | 'pro'>>;
45
45
  references: ReadonlyArray<{ id: string; after: string; added: string; mix: Partial<Record<string, string | ReadonlyArray<string>>> }>;
46
+ /** #129: `<ingredient>.<word>` the harness alone chooses — never on the model's wire. */
47
+ harness?: ReadonlyArray<string>;
48
+ /** #129: the ways a type-led first screen (`media.none`) may open, best first. */
49
+ typeLed?: ReadonlyArray<{ frame: string; words: string }>;
50
+ /** AW-D23 amended (2026-11-24): a type-led way is worn at every tier. */
51
+ typeLedEveryTier?: boolean;
46
52
  }
47
53
 
48
54
  /** The ingredients, by the contract's keys (held equal to it by opening-mix.spec). */
@@ -55,7 +61,7 @@ export enum OpeningIngredient {
55
61
  }
56
62
 
57
63
  export enum OpeningFrame { Full = 'full', Inset = 'inset', Shrinks = 'shrinks', Grows = 'grows' }
58
- export enum OpeningMedia { Photo = 'photo', Film = 'film', Slideshow = 'slideshow', Object = 'object', Diptych = 'diptych', Material = 'material', Live = 'live' }
64
+ export enum OpeningMedia { Photo = 'photo', Film = 'film', Slideshow = 'slideshow', Object = 'object', Diptych = 'diptych', Material = 'material', Live = 'live', None = 'none' }
59
65
  export enum OpeningWords { Headline = 'headline', OnEdge = 'on-edge', Apart = 'apart', Wordmark = 'wordmark', Behind = 'behind', None = 'none' }
60
66
  export enum OpeningExtra { Card = 'card', Badge = 'badge', Cue = 'cue' }
61
67
  export enum OpeningMotion { SlowZoom = 'slow-zoom', CopyOut = 'copy-out', PinnedCovered = 'pinned-covered' }
@@ -90,6 +96,12 @@ export enum OpeningRole {
90
96
  Title = 'opening.title',
91
97
  Lead = 'opening.lead',
92
98
  Action = 'opening.action',
99
+ /** #129, a type-led first screen only: the line above the title, the hero's headline beside a display-size name, the
100
+ * second action and the row that holds the actions — every part the hero it replaces says, so no word is lost. */
101
+ Eyebrow = 'opening.eyebrow',
102
+ Line = 'opening.line',
103
+ SecondAction = 'opening.action-2',
104
+ Actions = 'opening.actions',
93
105
  Apart = 'opening.apart',
94
106
  /** The second and third of the words placed apart. */
95
107
  ApartWord = 'opening.apart-word',
@@ -330,6 +342,26 @@ export function openingWireWords(tier: `${GenerationTier}` = GenerationTier.Basi
330
342
  return ORDER.flatMap(k => openingWords(k).filter(w => openingWordDrawn(k, w) && openingWordOffered(k, w, tier)).map(w => `${k}:${w}`));
331
343
  }
332
344
 
345
+ /** #129: a word the harness alone chooses (`media:none` — no picture fills the first screen), never offered to a model. */
346
+ export function openingHarnessWord(ingredient: `${OpeningIngredient}`, word: string): boolean {
347
+ return (O.harness ?? []).includes(`${ingredient}.${word}`);
348
+ }
349
+
350
+ /** #129: the ways a type-led first screen may open, best first, each a whole mix on no picture (the contract's
351
+ * `opening.typeLed`). */
352
+ export function typeLedOpeningWays(): OpeningMix[] {
353
+ return (O.typeLed ?? []).map(w => openingMix({ frame: w.frame, words: w.words, media: OpeningMedia.None }));
354
+ }
355
+
356
+ /** AW-D23 amended (2026-11-24): a type-led first screen's frame and words are worn at every tier when they are one of
357
+ * the contract's type-led ways — with no picture they are all the screen has. */
358
+ function typeLedWayEveryTier(mix: OpeningMix): boolean {
359
+ return !!O.typeLedEveryTier && mix.media === OpeningMedia.None && (O.typeLed ?? []).some(w => w.frame === mix.frame && w.words === mix.words);
360
+ }
361
+
362
+ /** #129: is the mix a type-led first screen (nothing to show but its words)? */
363
+ export const openingIsTypeLed = (mix: Pick<OpeningMix, 'media'>): boolean => mix.media === OpeningMedia.None;
364
+
333
365
  // ── The check: a mix judged against the site, mended where the site cannot carry it, each mend said ──────────────────
334
366
 
335
367
  export enum OpeningRepairCode {
@@ -414,7 +446,9 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
414
446
  const repairs: OpeningRepair[] = [];
415
447
  const say = (code: OpeningRepairCode, said: string) => repairs.push({ code, said });
416
448
  if (ctx.tier && ctx.tier !== GenerationTier.Award) {
449
+ const everyTier = typeLedWayEveryTier(m);
417
450
  for (const k of ORDER) {
451
+ if (everyTier && (k === OpeningIngredient.Frame || k === OpeningIngredient.Words)) continue;
418
452
  if (isMany(k)) {
419
453
  const kept = m[k].filter(w => openingWordTier(k, w) === 'all');
420
454
  for (const w of m[k].filter(x => !kept.includes(x))) say(OpeningRepairCode.ProOnly, `"${openingMeaning(k, w)}" comes with the award plan: left out`);
@@ -462,7 +496,8 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
462
496
  const still = m.media === OpeningMedia.Photo || m.media === OpeningMedia.Diptych || m.media === OpeningMedia.Live;
463
497
  if (m.motion.includes(OpeningMotion.SlowZoom) && !still) {
464
498
  m.motion = m.motion.filter(w => w !== OpeningMotion.SlowZoom);
465
- say(OpeningRepairCode.ZoomOnAPicture, 'a slow zoom moves a still picture: left out on moving pictures');
499
+ say(OpeningRepairCode.ZoomOnAPicture, m.media === OpeningMedia.None ? 'a slow zoom moves a picture, and this first screen has none: left out'
500
+ : 'a slow zoom moves a still picture: left out on moving pictures');
466
501
  }
467
502
  return { mix: m, repairs };
468
503
  }
@@ -475,6 +510,12 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
475
510
 
476
511
  /** How tall the first screen stands: a little less than the window, so the next section's edge says "there is more". */
477
512
  export const OPENING_HEIGHT = '88svh';
513
+ /** #129: a type-led first screen holds only words, so it is as tall as they need — a picture's 88svh left a dark field
514
+ * above them (the proof's shots: law, ceramics, the salon's phone). Words apart keep the full height: they spread over it.
515
+ * On a phone the frame hugs its words; the name on the edge then follows them in flow. */
516
+ const TYPE_LED_HEIGHT = 'min(64svh, 600px)';
517
+ const typeLedHeights = (mix: OpeningMix): { laptop: string; phone?: string } =>
518
+ mix.words === OpeningWords.Apart ? { laptop: OPENING_HEIGHT } : { laptop: TYPE_LED_HEIGHT, phone: '0px' };
478
519
  const INSET_LAPTOP = '24px';
479
520
  const ABS_FILL: Readonly<Record<string, string>> = { position: 'absolute', top: '0px', left: '0px', width: '100%', height: '100%', zIndex: '0' };
480
521
  const MEDIA_FILL: Readonly<Record<string, string>> = { ...ABS_FILL, aspectRatio: 'auto', borderRadius: '0px', objectFit: 'cover' };
@@ -492,20 +533,31 @@ export function openingPhoneInset(): string {
492
533
  const insetClip = (inset: string): string => `inset(${inset} round var(--iox-card-radius))`;
493
534
 
494
535
  /** A display size that keeps `em` of text within the width (`side` px kept per side), never above `cap`. */
536
+ /** The frame's padding on a phone: an inset frame adds its inset. */
537
+ const phoneFramePad = (mix: OpeningMix): string =>
538
+ (mix.frame === OpeningFrame.Inset || mix.frame === OpeningFrame.Shrinks ? `calc(${openingPhoneInset()} + 20px)` : FRAME_PAD);
539
+
495
540
  const sizedPx = (em: number, side: number, cap: string): string =>
496
541
  `min(calc((100vw - ${2 * side}px) * ${FIT} / ${Math.max(em, 1).toFixed(3)}), ${cap})`;
497
542
 
498
543
  function frameNode(mix: OpeningMix, children: PatternNode[]): PatternNode {
499
544
  const inset = mix.frame === OpeningFrame.Inset || mix.frame === OpeningFrame.Shrinks;
545
+ const height = mix.media === OpeningMedia.None ? typeLedHeights(mix) : { laptop: OPENING_HEIGHT };
546
+ const phone = {
547
+ ...(inset ? { clipPath: insetClip(openingPhoneInset()), padding: phoneFramePad(mix) } : {}),
548
+ ...(height.phone ? { minHeight: height.phone } : {}),
549
+ };
500
550
  return {
501
- t: 'Container', es: 'box', scheme: 'inverse',
551
+ // A pictured frame is a box its picture fills; a type-led one (no picture) paints its scheme's own ground — a
552
+ // 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',
502
554
  role: mix.frame === OpeningFrame.Shrinks ? OpeningRole.FrameSettles : OpeningRole.Frame,
503
555
  lay: {
504
556
  position: 'relative', overflow: 'hidden', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', gap: 'var(--iox-space-gap)',
505
- minHeight: OPENING_HEIGHT, padding: inset ? `calc(${INSET_LAPTOP} + ${FRAME_PAD})` : FRAME_PAD, borderRadius: '0px',
557
+ minHeight: height.laptop, padding: inset ? `calc(${INSET_LAPTOP} + ${FRAME_PAD})` : FRAME_PAD, borderRadius: '0px',
506
558
  ...(inset ? { clipPath: insetClip(INSET_LAPTOP) } : {}),
507
559
  },
508
- ...(inset ? { resp: { mobile: { clipPath: insetClip(openingPhoneInset()), padding: `calc(${openingPhoneInset()} + 20px)` } } } : {}),
560
+ ...(Object.keys(phone).length ? { resp: { mobile: phone } } : {}),
509
561
  c: children,
510
562
  };
511
563
  }
@@ -532,6 +584,8 @@ function mediaNodes(mix: OpeningMix): PatternNode[] {
532
584
  { ...picture(OpeningRole.Second, CELL_PICTURE), resp: { mobile: { display: 'none' } } },
533
585
  ],
534
586
  }];
587
+ case OpeningMedia.None:
588
+ return [];
535
589
  default:
536
590
  return [picture(zooms ? OpeningRole.MediaZooms : OpeningRole.Media)];
537
591
  }
@@ -554,9 +608,112 @@ const aside = (at: 'top' | 'bottom' = 'top'): PatternNode => ({
554
608
  c: [lead(), action()],
555
609
  });
556
610
 
611
+ // ── #129: a type-led first screen — no picture, the words carry it. It holds every part a hero says (the line above,
612
+ // the headline, the lead, two actions), each optional but the title, so the hero it replaces gives it its words slot by
613
+ // slot (`TYPE_LED_OPENING_SLOTS`) and nothing it said is lost; a part the hero did not say is left out (`without`).
614
+
615
+ /** The type-led parts a page may leave out, and what a composition with no hero to carry leaves out (the builder). */
616
+ export const TYPE_LED_OPTIONAL_PARTS: ReadonlyArray<string> = ['eyebrow', 'line', 'cta2'];
617
+
618
+ const eyebrowPart = (lay: Readonly<Record<string, string>> = {}): PatternNode => ({
619
+ t: 'Text', es: 'eyebrow', slot: 'eyebrow', optional: 'eyebrow', max: 32, ph: PatternPlaceholder.Copy, text: 'What you do · where', textHe: 'מה אתם עושים · איפה',
620
+ role: OpeningRole.Eyebrow, lay,
621
+ });
622
+ /** The hero's headline beside a display-size name (an h2: the name is the page's h1). */
623
+ const linePart = (lay: Readonly<Record<string, string>> = {}): PatternNode => ({
624
+ t: 'Heading', es: 'h2', level: 'h2', slot: 'line', optional: 'line', max: 56, ph: PatternPlaceholder.Copy, text: 'What you do, in a few words',
625
+ textHe: 'מה אתם עושים, בכמה מילים', role: OpeningRole.Line, lay: { margin: '0px', ...lay },
626
+ });
627
+ const actionsPart = (centred = false): PatternNode => ({
628
+ t: 'Container', es: 'box', role: OpeningRole.Actions,
629
+ lay: { display: 'flex', flexWrap: 'wrap', gap: '12px', alignItems: 'center', ...(centred ? { justifyContent: 'center' } : {}) },
630
+ c: [action(), { t: 'ButtonBlock', es: 'button-secondary', href: '/contact', slot: 'cta2', optional: 'cta2', max: 24, text: 'Learn more', textHe: 'למידע נוסף', role: OpeningRole.SecondAction }],
631
+ });
632
+ /** A hero's lead, as long as the hero's own (hero.centered: 180). */
633
+ const TYPE_LED_LEAD_MAX = 180;
634
+ const typeLedLead = (lay: Readonly<Record<string, string>> = {}): PatternNode => ({ ...lead(lay), max: TYPE_LED_LEAD_MAX });
635
+ /** What sits beside a display-size name: the line above, the headline, the lead and the actions. */
636
+ const typeLedAside = (at: 'top' | 'bottom'): PatternNode => ({
637
+ t: 'Container', es: 'box', role: OpeningRole.Aside,
638
+ lay: { ...OVER(1), display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: '14px', maxWidth: '560px', margin: at === 'top' ? '0px 0px auto 0px' : 'auto 0px 0px 0px' },
639
+ c: [eyebrowPart(), linePart(), typeLedLead(), actionsPart()],
640
+ });
641
+
642
+ /** Where each slot of a type-led hero goes in a type-led first screen; `headline` is the title, or the line beside a
643
+ * display-size name (the name is then the title). Only patterns every one of whose slots has a place. */
644
+ const TYPE_LED_OPENING_FROM: Readonly<Record<string, Readonly<Record<string, string>>>> = {
645
+ 'hero.centered': { eyebrow: 'eyebrow', headline: 'headline', lead: 'lead', primary: 'cta', secondary: 'cta2' },
646
+ };
647
+ const DISPLAY_WORDS: ReadonlySet<string> = new Set([OpeningWords.OnEdge, OpeningWords.Wordmark, OpeningWords.Behind, OpeningWords.Apart]);
648
+
649
+ /** What a type-led first screen is composed from, given the hero section it takes the place of: the hero's words and
650
+ * links slot by slot, and every optional part the hero did not say left out — or null when the hero is not one whose
651
+ * every slot has a place (it is then carried part by part, as any opening). Pure. */
652
+ export function typeLedOpeningSection(
653
+ mix: OpeningMix, hero: { readonly pattern: string; readonly slots?: Readonly<Record<string, string>>; readonly links?: Readonly<Record<string, string>> },
654
+ ): { slots: Record<string, string>; links: Record<string, string>; without: string[] } | null {
655
+ const from = TYPE_LED_OPENING_FROM[hero.pattern];
656
+ if (!from || mix.media !== OpeningMedia.None) return null;
657
+ const display = DISPLAY_WORDS.has(mix.words);
658
+ const to = (slot: string): string | undefined => (from[slot] === 'headline' ? (display ? 'line' : 'title') : from[slot]);
659
+ const slots: Record<string, string> = {};
660
+ const links: Record<string, string> = {};
661
+ for (const [slot, value] of Object.entries(hero.slots ?? {})) {
662
+ const at = to(slot);
663
+ if (!at) return null;
664
+ if (value.trim()) slots[at] = value;
665
+ }
666
+ for (const [slot, route] of Object.entries(hero.links ?? {})) {
667
+ const at = to(slot);
668
+ if (at) links[at] = route;
669
+ }
670
+ return { slots, links, without: TYPE_LED_OPTIONAL_PARTS.filter(part => !slots[part]) };
671
+ }
672
+
673
+ /** The words of a type-led first screen, as the mix places them — the same measured display sizes as a pictured one
674
+ * (R-H6), no scrim (nothing is under the words). */
675
+ function typeLedWordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[] {
676
+ const { line, longest } = nameEm(ctx);
677
+ const phoneSize = sizedPx(longest, PHONE_SIDE_PX, '22vw');
678
+ switch (mix.words) {
679
+ case OpeningWords.OnEdge:
680
+ // On a phone the frame hugs its words, so the name follows them in flow and sits on the edge by a margin as
681
+ // deep as the frame's padding (an absolute name would overlap them).
682
+ return [typeLedAside('top'), {
683
+ t: 'Container', es: 'box', role: OpeningRole.Words,
684
+ lay: { position: 'absolute', left: '0px', bottom: '0px', width: '100%', zIndex: '1', padding: `0px ${LAPTOP_SIDE_PX}px`, overflow: 'visible' },
685
+ resp: { mobile: { position: 'relative', left: 'auto', bottom: 'auto', padding: '0px', margin: `auto 0px calc(-1 * ${phoneFramePad(mix)}) 0px` } },
686
+ c: [title({ fontSize: sizedPx(line, LAPTOP_SIDE_PX, '50svh'), lineHeight: '0.82', margin: '0px', translateY: '0.16em' }, { resp: { mobile: { fontSize: phoneSize } } })],
687
+ }];
688
+ case OpeningWords.Wordmark:
689
+ case OpeningWords.Behind:
690
+ return [{
691
+ t: 'Container', es: 'box', role: OpeningRole.Words,
692
+ lay: { ...OVER(1), display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '18px', textAlign: 'center', margin: 'auto 0px auto 0px', width: '100%' },
693
+ c: [
694
+ eyebrowPart({ textAlign: 'center' }),
695
+ title({ fontSize: sizedPx(line, LAPTOP_SIDE_PX + 24, '40svh'), lineHeight: '0.9', margin: '0px', textAlign: 'center' }, { resp: { mobile: { fontSize: phoneSize } } }),
696
+ linePart({ textAlign: 'center' }), typeLedLead({ textAlign: 'center' }), actionsPart(true),
697
+ ],
698
+ }];
699
+ case OpeningWords.Apart: {
700
+ const [apart] = wordsNodes({ ...mix, media: OpeningMedia.Photo }, ctx).filter(n => n.role === OpeningRole.Apart);
701
+ return [apart, typeLedAside('bottom')];
702
+ }
703
+ default:
704
+ return [{
705
+ t: 'Container', es: 'box', role: OpeningRole.Words,
706
+ lay: { ...OVER(1), display: 'flex', flexDirection: 'column', gap: '14px', maxWidth: '760px' },
707
+ enter: 'heroText',
708
+ c: [eyebrowPart(), title({}), typeLedLead(), actionsPart()],
709
+ }];
710
+ }
711
+ }
712
+
557
713
  /** The words, as the mix places them. Display sizes are measured on the look's own face (never a guess — R-H6): a laptop
558
714
  * line by the whole name, a phone by its longest word, so a word is never cut by the screen. */
559
715
  function wordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[] {
716
+ if (mix.media === OpeningMedia.None) return typeLedWordsNodes(mix, ctx);
560
717
  const { line, longest } = nameEm(ctx);
561
718
  const phoneSize = sizedPx(longest, PHONE_SIDE_PX, '22vw');
562
719
  switch (mix.words) {
@@ -6,7 +6,7 @@ import { patternLinkSlots, patternOptionalParts, patternSlots, SITE_PATTERNS } f
6
6
  import { withDerivedSources } from './plan-derived';
7
7
  import { DEFAULT_HEADER_PATTERN, HeaderIngredient, headerMeaning, headerMix, headerMixFromWords, headerMixOfPlan, headerMixWords, headerPatternIdOf, headerWireWords } from './header-mix';
8
8
  import { DEFAULT_FOOTER_PATTERN, FooterIngredient, footerMeaning, footerMix, footerMixFromWords, footerMixOfPlan, footerMixWords, footerPatternIdOf, footerWireWords, footerWords } from './footer-mix';
9
- import { OpeningIngredient, openingMeaning, openingWireWords, openingWordTier } from './opening-mix';
9
+ import { openingHarnessWord, OpeningIngredient, openingMeaning, openingWireWords, openingWordTier } from './opening-mix';
10
10
  import { BodyIngredient, bodyMeaning, bodyMix, bodyMixWords, bodyWireWords } from './body-mix';
11
11
  import { shopCategoriesOf } from './shop-plan';
12
12
  import { ContentFieldControl, FIELD_TYPE_OF_CONTROL,
@@ -118,7 +118,7 @@ const OPENING_WIRE_TEXT = "string[] — the home page's opening (its first scree
118
118
  + "section as written. The opening takes the place of the home page's first section when that is a hero (its words and pictures carried in); "
119
119
  + 'a word marked (award) is worn by an award build only — elsewhere it is mended. '
120
120
  + Object.values(OpeningIngredient).map(k => `${k}: ${openingWireWords(GenerationTier.Award).filter(w => w.startsWith(`${k}:`)).map(w => w.slice(k.length + 1))
121
- .map(w => `${w} (${openingMeaning(k, w)}${openingWordTier(k, w) === 'pro' ? ', award' : ''})`).join(' | ')}`).join('; ');
121
+ .map(w => `${w} (${openingMeaning(k, w)}${openingWordTier(k, w) === 'pro' ? ', award' : ''}${openingHarnessWord(k, w) ? ', the build\'s own — keep it where the plan has it, never choose it' : ''})`).join(' | ')}`).join('; ');
122
122
 
123
123
  /** The header's words as the model reads them (HI1): each ingredient, the words the product draws and their meanings,
124
124
  * from the contract's header table. */
@@ -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
+ }
@@ -51,6 +51,7 @@ export * from './stock-photos';
51
51
  export * from './film';
52
52
  export * from './art-direction';
53
53
  export * from './pictures';
54
+ export * from './type-led';
54
55
  export * from './layout-language';
55
56
  export * from './compose-layout';
56
57
  export * from './layout-look';
@@ -59,6 +60,10 @@ export * from './layout-render-check';
59
60
  export * from './layout-drift';
60
61
  export * from './layout-type';
61
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';
62
67
  export * from './layout-photos';
63
68
  export * from './photo-inventory';
64
69
  export * from './check-layout';
@@ -8983,7 +8983,8 @@ export const SPEC_SITE_LAYOUT = {
8983
8983
  "object",
8984
8984
  "diptych",
8985
8985
  "material",
8986
- "live"
8986
+ "live",
8987
+ "none"
8987
8988
  ],
8988
8989
  "words": [
8989
8990
  "headline",
@@ -9020,6 +9021,7 @@ export const SPEC_SITE_LAYOUT = {
9020
9021
  "media.diptych": "two full-height pictures side by side; a phone keeps the first",
9021
9022
  "media.material": "an ambient ground drawn from the look's tokens (a glow behind ribs, a dotted grid, a slow light)",
9022
9023
  "media.live": "a working form of the site's own in the first screen (a lead form, a booking)",
9024
+ "media.none": "no picture: the look's own ground, and the words carry the first screen",
9023
9025
  "words.headline": "a heading, a line and one action",
9024
9026
  "words.on-edge": "one display line at screen size sitting on the bottom edge, cropped by it",
9025
9027
  "words.apart": "two or three giant words placed apart across the screen",
@@ -9045,6 +9047,7 @@ export const SPEC_SITE_LAYOUT = {
9045
9047
  "media.diptych": "שתי תמונות בגובה מלא זו לצד זו; בטלפון נשארת הראשונה",
9046
9048
  "media.material": "רקע מהמראה של האתר (זוהר מאחורי פסים, רשת נקודות, אור איטי)",
9047
9049
  "media.live": "טופס אמיתי של האתר במסך הראשון (פנייה, הזמנה)",
9050
+ "media.none": "בלי תמונה: הרקע של המראה, והמילים נושאות את המסך הראשון",
9048
9051
  "words.headline": "כותרת, שורה ופעולה אחת",
9049
9052
  "words.on-edge": "שורה אחת בגודל המסך שיושבת על הקצה התחתון, חתוכה בו",
9050
9053
  "words.apart": "שתיים או שלוש מילים ענקיות, מפוזרות על המסך",
@@ -9079,6 +9082,48 @@ export const SPEC_SITE_LAYOUT = {
9079
9082
  "extras": [],
9080
9083
  "motion": []
9081
9084
  },
9085
+ "harness": [
9086
+ "media.none"
9087
+ ],
9088
+ "typeLed": [
9089
+ {
9090
+ "frame": "full",
9091
+ "words": "wordmark"
9092
+ },
9093
+ {
9094
+ "frame": "inset",
9095
+ "words": "headline"
9096
+ },
9097
+ {
9098
+ "frame": "full",
9099
+ "words": "on-edge"
9100
+ },
9101
+ {
9102
+ "frame": "shrinks",
9103
+ "words": "headline"
9104
+ },
9105
+ {
9106
+ "frame": "inset",
9107
+ "words": "wordmark"
9108
+ },
9109
+ {
9110
+ "frame": "full",
9111
+ "words": "apart"
9112
+ },
9113
+ {
9114
+ "frame": "inset",
9115
+ "words": "on-edge"
9116
+ },
9117
+ {
9118
+ "frame": "shrinks",
9119
+ "words": "wordmark"
9120
+ },
9121
+ {
9122
+ "frame": "full",
9123
+ "words": "headline"
9124
+ }
9125
+ ],
9126
+ "typeLedEveryTier": true,
9082
9127
  "named": {
9083
9128
  "hero.split": {},
9084
9129
  "hero.full-bleed-media": {
@@ -9214,6 +9259,7 @@ export const SPEC_SITE_LAYOUT = {
9214
9259
  "media.film": "all",
9215
9260
  "media.slideshow": "all",
9216
9261
  "media.object": "all",
9262
+ "media.none": "all",
9217
9263
  "words.headline": "all",
9218
9264
  "rules.wordsNeverCut": "all",
9219
9265
  "rules.badgeOwnersOnly": "all",