@vectoriox/iox-ui 5.202.1 → 5.204.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 (55) hide show
  1. package/actions-core/index.d.ts +8 -1
  2. package/design-core/index.d.ts +62 -2
  3. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +8 -1
  4. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-design-core.mjs +121 -11
  6. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +5443 -293
  8. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui.mjs +381 -32
  10. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  11. package/generation-core/index.d.ts +2368 -5
  12. package/index.d.ts +117 -12
  13. package/package.json +1 -1
  14. package/src/actions-core/element-actions.ts +9 -0
  15. package/src/design-core/contrast-audit.ts +93 -11
  16. package/src/design-core/flavor-spec.generated.ts +19 -0
  17. package/src/design-core/image-alt.ts +27 -0
  18. package/src/design-core/public-api.ts +1 -0
  19. package/src/generation-core/audit-site.ts +17 -3
  20. package/src/generation-core/baseline-roles.ts +10 -6
  21. package/src/generation-core/check-free.ts +12 -2
  22. package/src/generation-core/check-layout.ts +3 -2
  23. package/src/generation-core/compose-free.ts +3 -1
  24. package/src/generation-core/compose-layout.ts +1 -1
  25. package/src/generation-core/compose-site.ts +29 -11
  26. package/src/generation-core/critic-calibration.ts +175 -0
  27. package/src/generation-core/critic-prompt.ts +153 -0
  28. package/src/generation-core/critic-rubric.generated.ts +24 -0
  29. package/src/generation-core/critic-sheet.ts +203 -0
  30. package/src/generation-core/critic.ts +175 -0
  31. package/src/generation-core/design-doc-index.ts +58 -0
  32. package/src/generation-core/design-motion.ts +247 -0
  33. package/src/generation-core/design-ops-check.ts +370 -0
  34. package/src/generation-core/design-ops-of.ts +200 -0
  35. package/src/generation-core/design-ops.model.ts +239 -0
  36. package/src/generation-core/design-ops.schema.ts +122 -0
  37. package/src/generation-core/design-ops.ts +361 -0
  38. package/src/generation-core/design-recipes.ts +58 -0
  39. package/src/generation-core/designer-brief.ts +81 -0
  40. package/src/generation-core/designer-direction.ts +248 -0
  41. package/src/generation-core/designer-estimate.ts +171 -0
  42. package/src/generation-core/designer-lessons.generated.ts +653 -0
  43. package/src/generation-core/designer-lessons.ts +153 -0
  44. package/src/generation-core/designer-stop.ts +94 -0
  45. package/src/generation-core/footer-free.ts +23 -2
  46. package/src/generation-core/footer-mix.ts +60 -14
  47. package/src/generation-core/layout-language.ts +2 -0
  48. package/src/generation-core/node-baselines.generated.ts +953 -10
  49. package/src/generation-core/public-api.ts +21 -0
  50. package/src/generation-core/site-spec.generated.ts +82 -10
  51. package/src/generation-core/social-links.ts +370 -0
  52. package/src/generation-core/structure-fingerprint.ts +565 -0
  53. package/src/generation-core/templates.ts +39 -3
  54. package/styles/iox-design.css +26 -1
  55. package/styles/iox-forms.css +22 -0
@@ -0,0 +1,153 @@
1
+ import { CRITIC_DIMENSIONS, CriticDimension } from './critic';
2
+ import { DESIGNER_LESSONS_SEED } from './designer-lessons.generated';
3
+ import { isPlainObject, PathIssue } from './shape-check';
4
+
5
+ /**
6
+ * THE AI DESIGNER'S LESSONS (ai-designer-plan §3a, AD-D7, R-H11): rules a designer applies while WRITING round 1, each
7
+ * one a critique that moved a score. Seeded from the designer-loop proof (law HARNESS §4b + §4c, hotel HARNESS §4),
8
+ * kept as data in iox-ai-guidance `architecture/ai/designer-lessons.json` and ported by `gen:designer-lessons` until the
9
+ * control-plane store (AD5) holds them.
10
+ * - APPLIED by `lessonsForPrompt`: the approved lessons for the site's kind (and language), ordered by
11
+ * `weight × score moved`, cut at a token budget — the lowest-ranked drop out first.
12
+ * - WEIGHT follows the source: the critic's own 1, the tester's 2, Doron's 3.
13
+ * - RETIRED when the gap behind it ships (`retiresWith` names it) or when Doron marks it wrong — `status: 'retired'`.
14
+ * Pure.
15
+ */
16
+
17
+ export enum LessonSource {
18
+ Critic = 'critic',
19
+ Tester = 'tester',
20
+ Doron = 'doron',
21
+ }
22
+ export const LESSON_WEIGHT: Readonly<Record<LessonSource, number>> = {
23
+ [LessonSource.Critic]: 1,
24
+ [LessonSource.Tester]: 2,
25
+ [LessonSource.Doron]: 3,
26
+ };
27
+ export enum LessonStatus {
28
+ /** Proposed by the critic, waiting for the weekly approval (AD-D7). */
29
+ Proposed = 'proposed',
30
+ Approved = 'approved',
31
+ Retired = 'retired',
32
+ }
33
+ /** The kinds a lesson is for: every kind, or the named business kinds. */
34
+ export const LESSON_ALL_KINDS = 'all';
35
+ /** §3a: a lesson is written when a round moved a dimension by at least this much. */
36
+ export const LESSON_MIN_MOVE = 0.5;
37
+ /** A lesson's floor in the ranking, so one whose round held the score (a rule kept) still ranks by its weight. */
38
+ const LESSON_MOVE_FLOOR = 0.1;
39
+ /** About this many characters to a token (a budget, not a bill). */
40
+ const CHARS_PER_TOKEN = 4;
41
+
42
+ export interface DesignerLesson {
43
+ readonly id: string;
44
+ /** One sentence a designer applies while writing round 1. */
45
+ readonly rule: string;
46
+ readonly kinds: ReadonlyArray<string>;
47
+ /** Only for these site languages (absent = every language). */
48
+ readonly locales?: ReadonlyArray<string>;
49
+ readonly dimension: `${CriticDimension}`;
50
+ /** The round it came from: the score before and after (the dimension's, else the page's mean). */
51
+ readonly evidence: { readonly build: string; readonly round: string; readonly scoreBefore: number; readonly scoreAfter: number; readonly ref?: string };
52
+ readonly source: `${LessonSource}`;
53
+ readonly weight: number;
54
+ readonly status: `${LessonStatus}`;
55
+ /** The builder gap whose fix retires it (§3a). */
56
+ readonly retiresWith?: string;
57
+ }
58
+
59
+ /** The seed, checked against this type at compile time. */
60
+ export const DESIGNER_LESSONS: ReadonlyArray<DesignerLesson> = DESIGNER_LESSONS_SEED;
61
+
62
+ export enum LessonIssueCode {
63
+ Shape = 'shape',
64
+ Duplicate = 'duplicate',
65
+ Dimension = 'dimension',
66
+ Weight = 'weight',
67
+ Evidence = 'evidence',
68
+ }
69
+ export type LessonIssue = PathIssue<LessonIssueCode>;
70
+
71
+ const filled = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;
72
+ const SOURCES: ReadonlySet<string> = new Set(Object.values(LessonSource));
73
+ const STATUSES: ReadonlySet<string> = new Set(Object.values(LessonStatus));
74
+ const DIMENSIONS: ReadonlySet<string> = new Set(CRITIC_DIMENSIONS);
75
+
76
+ /** A lesson list, judged: each a rule, kinds, a known dimension, evidence with both scores, the source's weight; ids unique. */
77
+ export function designerLessonsIssues(lessons: unknown): LessonIssue[] {
78
+ const out: LessonIssue[] = [];
79
+ const say = (code: LessonIssueCode, path: string, message: string) => out.push({ code, path, message });
80
+ if (!Array.isArray(lessons)) { say(LessonIssueCode.Shape, '', 'a list of lessons'); return out; }
81
+ const ids = new Set<string>();
82
+ lessons.forEach((l: unknown, i) => {
83
+ const path = `[${i}]`;
84
+ if (!isPlainObject(l) || !filled(l['id']) || !filled(l['rule']) || !Array.isArray(l['kinds']) || l['kinds'].length === 0
85
+ || !l['kinds'].every(filled) || !SOURCES.has(l['source'] as string) || !STATUSES.has(l['status'] as string)) {
86
+ say(LessonIssueCode.Shape, path, 'a lesson is { id, rule, kinds (≥ 1), dimension, evidence, source, weight, status }');
87
+ return;
88
+ }
89
+ if (ids.has(l['id'] as string)) say(LessonIssueCode.Duplicate, `${path}.id`, `"${l['id']}" twice`);
90
+ ids.add(l['id'] as string);
91
+ if (!DIMENSIONS.has(l['dimension'] as string)) say(LessonIssueCode.Dimension, `${path}.dimension`, `one of ${CRITIC_DIMENSIONS.join(', ')}`);
92
+ if (l['weight'] !== LESSON_WEIGHT[l['source'] as LessonSource]) say(LessonIssueCode.Weight, `${path}.weight`, `a ${l['source']} lesson weighs ${LESSON_WEIGHT[l['source'] as LessonSource]}`);
93
+ const e = l['evidence'];
94
+ if (!isPlainObject(e) || !filled(e['build']) || !filled(e['round']) || typeof e['scoreBefore'] !== 'number' || typeof e['scoreAfter'] !== 'number') {
95
+ say(LessonIssueCode.Evidence, `${path}.evidence`, 'the round it came from: { build, round, scoreBefore, scoreAfter }');
96
+ }
97
+ });
98
+ return out;
99
+ }
100
+
101
+ /** What a lesson is worth in the prompt: its weight times the score it moved (floored, so a held score still ranks). */
102
+ export function lessonRank(lesson: DesignerLesson): number {
103
+ return lesson.weight * Math.max(LESSON_MOVE_FLOOR, lesson.evidence.scoreAfter - lesson.evidence.scoreBefore);
104
+ }
105
+
106
+ /** A lesson as the prompt reads it: one line. */
107
+ export function lessonLine(lesson: DesignerLesson): string {
108
+ return `- [${lesson.dimension}] ${lesson.rule}`;
109
+ }
110
+
111
+ /** Roughly how many tokens a text costs (a budget, not a bill). */
112
+ export function roughTokens(text: string): number {
113
+ return Math.ceil(text.length / CHARS_PER_TOKEN);
114
+ }
115
+
116
+ export interface LessonsForPrompt {
117
+ /** The lines, best first, one per lesson. */
118
+ text: string;
119
+ used: string[];
120
+ /** Approved lessons for this kind and language that did not fit the budget, best first. */
121
+ dropped: string[];
122
+ tokens: number;
123
+ }
124
+
125
+ /**
126
+ * The lessons the designer's (cached) system prompt carries for a site of `kind` in `locale`: approved, for every kind
127
+ * or this one, for every language or this one; best first by `weight × score moved`; cut at `budget` tokens — the
128
+ * lowest-ranked drop first (a prefix of the ranking, so a short lesson never jumps a better long one).
129
+ */
130
+ export function lessonsForPrompt(kind: string, budget: number, options: { locale?: string; lessons?: ReadonlyArray<DesignerLesson> } = {}): LessonsForPrompt {
131
+ const lessons = options.lessons ?? DESIGNER_LESSONS;
132
+ const ranked = lessons
133
+ .filter(l => l.status === LessonStatus.Approved)
134
+ .filter(l => l.kinds.includes(LESSON_ALL_KINDS) || l.kinds.includes(kind))
135
+ .filter(l => !l.locales || (options.locale !== undefined && l.locales.includes(options.locale)))
136
+ .map((l, at) => ({ l, at, rank: lessonRank(l) }))
137
+ .sort((a, b) => b.rank - a.rank || a.at - b.at)
138
+ .map(r => r.l);
139
+ const used: DesignerLesson[] = [];
140
+ let tokens = 0;
141
+ for (const l of ranked) {
142
+ const cost = roughTokens(`${lessonLine(l)}\n`);
143
+ if (tokens + cost > budget) break;
144
+ used.push(l);
145
+ tokens += cost;
146
+ }
147
+ return {
148
+ text: used.map(lessonLine).join('\n'),
149
+ used: used.map(l => l.id),
150
+ dropped: ranked.slice(used.length).map(l => l.id),
151
+ tokens,
152
+ };
153
+ }
@@ -0,0 +1,94 @@
1
+ import { CRITIC_DIMENSIONS, CriticAnswer, criticVerdict } from './critic';
2
+ import { CRITIC_RUBRIC_POLISH } from './critic-rubric.generated';
3
+ import { FreedomIssue } from './structure-fingerprint';
4
+
5
+ /**
6
+ * THE STOP RULE (ai-designer-plan §2g, AD-D6, R-H10), as code. A page stops at the first of:
7
+ * 1. DONE — the calibrated mean ≥ 8, no dimension under 7.5, nothing capping it (a broken bug, a copy, a repeat), the
8
+ * gate 0 blocking / 0 asking;
9
+ * 2. FLAT — two rounds in a row that moved the score less than +0.2;
10
+ * 3. BUDGET — the page's round cap (Home 6, an inner page 4, a language pass 1, a legal page 1), or the build's credits
11
+ * (`designerSpendGate`) said stop.
12
+ * The round that is written is the BEST one, not necessarily the last: the highest score, the later on a tie (it holds
13
+ * more of the fixes for the same score). Pure.
14
+ */
15
+
16
+ export const DESIGNER_DONE = { mean: 8, floor: 7.5 } as const;
17
+ /** FLAT: a round moved the score less than this… */
18
+ export const DESIGNER_FLAT_STEP = 0.2;
19
+ /** …this many rounds in a row. */
20
+ export const DESIGNER_FLAT_ROUNDS = 2;
21
+
22
+ /** What a page is, to the stop rule (§2g's caps). */
23
+ export enum DesignerPageRole {
24
+ Home = 'home',
25
+ Inner = 'inner',
26
+ /** A second language's pass over a page already stopped (§2h). */
27
+ Language = 'language',
28
+ Legal = 'legal',
29
+ }
30
+ export const DESIGNER_ROUND_CAPS: Readonly<Record<DesignerPageRole, number>> = {
31
+ [DesignerPageRole.Home]: 6,
32
+ [DesignerPageRole.Inner]: 4,
33
+ [DesignerPageRole.Language]: 1,
34
+ [DesignerPageRole.Legal]: 1,
35
+ };
36
+
37
+ export enum DesignerStop {
38
+ Done = 'done',
39
+ Flat = 'flat',
40
+ Budget = 'budget',
41
+ }
42
+
43
+ /** One round, as the stop rule reads it: the critic's (calibrated) answer, the gate's counts, the fingerprint's findings. */
44
+ export interface DesignerRound {
45
+ critique: CriticAnswer;
46
+ gate: { blocking: number; asking: number };
47
+ /** A copy or a repeat (designFreedomIssues) — it caps the page like a broken bug (AD-D19). */
48
+ freedom?: ReadonlyArray<FreedomIssue>;
49
+ }
50
+
51
+ /** A round's score: the critic's headline, capped at the broken cap when the page copies or repeats (AD-D19). */
52
+ export interface DesignerRoundScore {
53
+ headline: number;
54
+ designMean: number;
55
+ lowest: number;
56
+ capped: boolean;
57
+ done: boolean;
58
+ }
59
+
60
+ export function designerRoundScore(round: DesignerRound): DesignerRoundScore {
61
+ const verdict = criticVerdict(round.critique);
62
+ const freedom = (round.freedom?.length ?? 0) > 0;
63
+ const capped = verdict.capped || verdict.broken > 0 || freedom;
64
+ const headline = freedom ? Math.min(verdict.headline, CRITIC_RUBRIC_POLISH.brokenCap) : verdict.headline;
65
+ const lowest = Math.min(...CRITIC_DIMENSIONS.map(d => round.critique.scores[d].score));
66
+ const done = verdict.designMean >= DESIGNER_DONE.mean && lowest >= DESIGNER_DONE.floor && !capped
67
+ && round.gate.blocking === 0 && round.gate.asking === 0;
68
+ return { headline, designMean: verdict.designMean, lowest, capped, done };
69
+ }
70
+
71
+ export interface DesignerStopDecision {
72
+ /** Null while the page goes on. */
73
+ stop: DesignerStop | null;
74
+ /** The round to write (the best so far); null before any round. */
75
+ best: number | null;
76
+ scores: DesignerRoundScore[];
77
+ }
78
+
79
+ /**
80
+ * After each round: stop or go on, and which round is the best. `outOfCredits` is the build's spend gate saying stop
81
+ * (`designerSpendGate`) — a Budget stop like the page's cap.
82
+ */
83
+ export function designerStopDecision(rounds: ReadonlyArray<DesignerRound>, role: DesignerPageRole, outOfCredits = false): DesignerStopDecision {
84
+ const scores = rounds.map(designerRoundScore);
85
+ let best: number | null = null;
86
+ scores.forEach((s, i) => { if (best === null || s.headline >= scores[best].headline) best = i; });
87
+ const last = scores.length - 1;
88
+ let stop: DesignerStop | null = null;
89
+ if (last >= 0 && scores[last].done) stop = DesignerStop.Done;
90
+ else if (last >= DESIGNER_FLAT_ROUNDS
91
+ && Array.from({ length: DESIGNER_FLAT_ROUNDS }, (_, k) => scores[last - k].headline - scores[last - k - 1].headline).every(step => step < DESIGNER_FLAT_STEP)) stop = DesignerStop.Flat;
92
+ else if (scores.length >= DESIGNER_ROUND_CAPS[role] || outOfCredits) stop = DesignerStop.Budget;
93
+ return { stop, best, scores };
94
+ }
@@ -4,7 +4,7 @@ import { FreeIssue, FreeIssueCode, freeNodeStyleIssues, freePhoneNeeds, FreeSlot
4
4
  import {
5
5
  checkFooter, FOOTER_GROUND_SCHEME, FooterArrange, FooterBefore, FooterClosing, FooterContext, FooterGround, FooterHold, FooterIngredient,
6
6
  footerMeaning, FooterMix, footerMix, FooterNameStyle, footerPart, footerPartNode, footerPattern, FooterRepair, FooterRepairCode, FooterRole, footerTableWords,
7
- footerWait, footerWordOffered, footerWords,
7
+ footerWait, footerWordOffered, footerWords, holdsStatedSocial,
8
8
  } from './footer-mix';
9
9
  import { freeSlotOf, FreeSlotKind, freeSlotWord } from './free-slot-words';
10
10
  import { freeStyleToSlots } from './free-slots';
@@ -340,7 +340,7 @@ export function expandFreeFooter(footer: FreeNode, ctx: FooterContext, stamp: Fr
340
340
  return { t: 'Container', es: n.elementStyle || 'box', ...layOf(n, rtl, CONTAINER_HELD), ...(scheme ? { scheme } : {}), ...(c.length ? { c } : {}) };
341
341
  };
342
342
  const shell = footerPart('section');
343
- const kids = (footer.children ?? []).map(nodeOf).filter((x): x is PatternNode => !!x);
343
+ const kids = withStatedSocial((footer.children ?? []).map(nodeOf).filter((x): x is PatternNode => !!x), footer, ctx, said);
344
344
  const ground = groundOf(footer);
345
345
  const scheme = FOOTER_GROUND_SCHEME[ground] ?? null;
346
346
  const own = layOf(footer, rtl, {});
@@ -361,6 +361,26 @@ export function expandFreeFooter(footer: FreeNode, ctx: FooterContext, stamp: Fr
361
361
  };
362
362
  }
363
363
 
364
+ /** True when a pattern node (or one inside it) is the legal row's place or the © line. */
365
+ const holdsLastRow = (n: PatternNode): boolean => n.role === FooterRole.LegalPlace || n.slot === COPYRIGHT_SLOT || (n.c ?? []).some(holdsLastRow);
366
+ /** The © line's slot (the contract's `copyright` part). */
367
+ const COPYRIGHT_SLOT = 'copyright';
368
+
369
+ /**
370
+ * Social links (Doron 2026-11-29, FV-D10 completion): the links the owner stated are always in the footer. A free footer
371
+ * that did not place `footer:social` gets THE part (`footerPartNode`) before its © line / legal row (else at its end), said
372
+ * `social-stated`. None stated: nothing is added.
373
+ */
374
+ function withStatedSocial(kids: PatternNode[], footer: FreeNode, ctx: FooterContext, said: FooterRepair[]): PatternNode[] {
375
+ if (!holdsStatedSocial(ctx) || partsOf(footer).includes(FreeFooterPart.Social)) return kids;
376
+ const made = footerPartNode(FreeFooterPart.Social, ctx).node;
377
+ if (!made) return kids;
378
+ said.push({ code: FooterRepairCode.SocialStated, said: 'the owner gave their social links and the footer laid freely placed none: they are listed before its last row' });
379
+ const end = kids.findIndex(holdsLastRow);
380
+ const at = end < 0 ? kids.length : end;
381
+ return [...kids.slice(0, at), { t: 'Container', es: 'box', c: [made] }, ...kids.slice(at)];
382
+ }
383
+
364
384
  // ── The free footer, or the nearest mix (R-H-FV3) ─────────────────────────────────────────────────────────────────────
365
385
 
366
386
  /** The footer a site is built with: the free one when it keeps the rules, else the nearest mix footer — and what was said. */
@@ -434,6 +454,7 @@ export function freeFooterBrief(ctx: FooterContext, worn: ReadonlyArray<string>
434
454
  'word and the email stand in the Section itself at the column\'s full width; the contact-form area, when placed, comes',
435
455
  'first. The Section keeps the page\'s column and air (no width, margin, padding or colour on it); no colour, opacity,',
436
456
  'filter, move or hover anywhere in the footer; a grid of two or more columns carries its phone layer.',
457
+ ...(holdsStatedSocial(ctx) ? ['The owner gave their social links: place "footer:social" (it is added before the last row when you do not).'] : []),
437
458
  ...(worn.length ? [`The studio's last sites wore these footers — lay a different one: ${worn.join(' · ')}.`] : []),
438
459
  ].join('\n');
439
460
  }
@@ -410,6 +410,9 @@ export enum FooterRepairCode {
410
410
  * `socialMax`, or on no known network: those left out. */
411
411
  SocialWithoutLinks = 'social-without-links',
412
412
  SocialLeftOut = 'social-left-out',
413
+ /** Social links (Doron 2026-11-29, FV-D10 completion): the owner stated their links, so the footer holds them — also when
414
+ * its mix did not ask for the block (a one-line or name-and-action footer keeps them too). */
415
+ SocialStated = 'social-stated',
413
416
  /** FV1b: a visit band before the footer says where and when — the visit block is not said twice. */
414
417
  VisitBeforeTwice = 'visit-before-twice',
415
418
  /** AW12-D6 (H1): a sign-up only where the site has a reason to write (a journal, events, a shop, a kind of business
@@ -532,7 +535,9 @@ function statementPhoneLines(tagline: string, ctx: FooterContext): number {
532
535
  }
533
536
 
534
537
  /** FV1b (FV-D10): a network the footer can name a social link by — the contract's `FOOTER.socialNetworks`. */
535
- export interface FooterSocialNetwork { readonly id: string; readonly name: string; readonly hosts: ReadonlyArray<string> }
538
+ /** A network the footer names (`FOOTER.socialNetworks`): its id, its brand name, the hosts an address is recognised by and
539
+ * its Phosphor glyph (`ph-instagram-logo` — a follow row whose link the owner made an icon wears it; iox-ui#201). */
540
+ export interface FooterSocialNetwork { readonly id: string; readonly name: string; readonly hosts: ReadonlyArray<string>; readonly icon?: string }
536
541
  export const FOOTER_SOCIAL_NETWORKS = (F as unknown as { socialNetworks: ReadonlyArray<FooterSocialNetwork> }).socialNetworks;
537
542
 
538
543
  /** One social link the footer shows: the network's name and the owner's address (https). */
@@ -560,20 +565,37 @@ function socialAddress(raw: string): URL | null {
560
565
  * owner did not state. An entry may hold several addresses (a stated line, space- or comma-separated). Pure.
561
566
  */
562
567
  export function footerSocialLinks(addresses?: ReadonlyArray<string> | null): { links: FooterSocialLink[]; leftOut: string[] } {
568
+ const { links, leftOut } = recognisedSocialLinks(addresses);
569
+ const max = rule('socialMax');
570
+ return { links: links.slice(0, max), leftOut: [...leftOut, ...links.slice(max).map(l => l.url)] };
571
+ }
572
+
573
+ /** One address as a social link the footer can name — its network by its host, a profile path, written https — or null
574
+ * (no http(s) address, on no network of the table, or a bare host). Pure. */
575
+ export function socialLinkOf(raw: string): FooterSocialLink | null {
576
+ const url = socialAddress(raw);
577
+ const host = url?.hostname.toLowerCase().replace(/^(www|m)\./, '');
578
+ const network = host ? FOOTER_SOCIAL_NETWORKS.find(n => n.hosts.some(h => host === h || host.endsWith(`.${h}`))) : undefined;
579
+ if (!url || !network || url.pathname.replace(/\/+$/, '') === '') return null;
580
+ return { network: network.id, name: network.name, url: url.href };
581
+ }
582
+
583
+ /** `footerSocialLinks` without the footer's `socialMax`: every recognised link, once per network (the first stated wins), in
584
+ * the table's order — what the owner's own list (the wizard, Site settings) holds. Pure. */
585
+ export function recognisedSocialLinks(addresses?: ReadonlyArray<string> | null): { links: FooterSocialLink[]; leftOut: string[] } {
563
586
  const found = new Map<string, FooterSocialLink>();
564
587
  const leftOut: string[] = [];
565
588
  for (const raw of (addresses ?? []).flatMap(a => String(a).split(/[\s,]+/)).filter(Boolean)) {
566
- const url = socialAddress(raw);
567
- const host = url?.hostname.toLowerCase().replace(/^(www|m)\./, '');
568
- const network = host ? FOOTER_SOCIAL_NETWORKS.find(n => n.hosts.some(h => host === h || host.endsWith(`.${h}`))) : undefined;
569
- if (!url || !network || url.pathname.replace(/\/+$/, '') === '' || found.has(network.id)) { leftOut.push(raw); continue; }
570
- found.set(network.id, { network: network.id, name: network.name, url: url.href });
589
+ const link = socialLinkOf(raw);
590
+ if (!link || found.has(link.network)) { leftOut.push(raw); continue; }
591
+ found.set(link.network, link);
571
592
  }
572
- const links = FOOTER_SOCIAL_NETWORKS.map(n => found.get(n.id)).filter((l): l is FooterSocialLink => !!l);
573
- const max = rule('socialMax');
574
- return { links: links.slice(0, max), leftOut: [...leftOut, ...links.slice(max).map(l => l.url)] };
593
+ return { links: FOOTER_SOCIAL_NETWORKS.map(n => found.get(n.id)).filter((l): l is FooterSocialLink => !!l), leftOut };
575
594
  }
576
595
 
596
+ /** True when the owner stated at least one social link the footer can name — the footer then always holds them. */
597
+ export const holdsStatedSocial = (ctx: Pick<FooterContext, 'social'>): boolean => footerSocialLinks(ctx.social).links.length > 0;
598
+
577
599
  /** True when the call word cannot stand on a phone even split over two balanced lines. */
578
600
  function wordTooWide(word: string, ctx: FooterContext): boolean {
579
601
  const halves = word.split(/\s+/);
@@ -641,6 +663,14 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
641
663
  let arrange = mix.arrange;
642
664
  let nameStyle = nameStyleOf(mix);
643
665
  let ground = mix.ground;
666
+ // Social links (Doron 2026-11-29, FV-D10 completion): the links the owner stated are always in the footer — whatever the
667
+ // mix asked for, a one-line and a name-and-action footer too. None stated: nothing is drawn (the check below says so).
668
+ const stated = holdsStatedSocial(ctx);
669
+ if (stated && !holds.includes(FooterHold.Social)) {
670
+ say(FooterRepairCode.SocialStated, 'the owner gave their social links: the footer lists them');
671
+ holds = inOrder(FooterIngredient.Holds, [...holds, FooterHold.Social]);
672
+ }
673
+ const keepsSocial = (h: string): boolean => stated && h === FooterHold.Social;
644
674
  const why = ctx.never?.say?.length ? ` — ${(ctx.locale === 'he' && ctx.never.sayHe?.length ? ctx.never.sayHe : ctx.never.say).join(' ')}` : '';
645
675
  if (ctx.never?.closings.includes(closing)) {
646
676
  say(FooterRepairCode.TypeNever, `this kind of business never closes its footer with ${an(closing)}: the call${why}`);
@@ -655,7 +685,7 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
655
685
  arrange = FooterArrange.Columns;
656
686
  }
657
687
  if (arrange === FooterArrange.Line) {
658
- const kept = holds.filter(h => (F.rules.lineHolds as ReadonlyArray<string>).includes(h) || BOTTOM_HOLDS.has(h));
688
+ const kept = holds.filter(h => (F.rules.lineHolds as ReadonlyArray<string>).includes(h) || BOTTOM_HOLDS.has(h) || keepsSocial(h));
659
689
  const left = holds.filter(h => !kept.includes(h));
660
690
  if (left.length) say(FooterRepairCode.LineHolds, `a one-line footer holds only ${F.rules.lineHolds.join(' and ')}: ${left.join(' and ')} left out`);
661
691
  holds = kept;
@@ -666,9 +696,9 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
666
696
  closing = refused.instead;
667
697
  }
668
698
  if (closing === FooterClosing.NameAndAction) {
669
- const left = holds.filter(h => !END_HOLDS.includes(h));
699
+ const left = holds.filter(h => !END_HOLDS.includes(h) && !keepsSocial(h));
670
700
  if (left.length) say(FooterRepairCode.LeftOut, `a name-and-action footer holds the pages and the legal row: ${left.join(' and ')} left out`);
671
- holds = holds.filter(h => END_HOLDS.includes(h));
701
+ holds = holds.filter(h => END_HOLDS.includes(h) || keepsSocial(h));
672
702
  if (!footerNameFits(ctx)) say(FooterRepairCode.NameTooLong, `"${ctx.name}" is too long to stand across a phone: the action stays, the name is left out`);
673
703
  }
674
704
  if (arrange === FooterArrange.Ruled && partHolds(holds).length + 1 < rule('ruledMinBlocks')) {
@@ -806,7 +836,15 @@ function emailLine(email: string, ctx: FooterContext): PatternNode {
806
836
 
807
837
  /** FV1b `holds.social`: the part's template link once per stated link — the network's name, the owner's address. */
808
838
  function socialPart(ctx: FooterContext): PatternNode {
809
- const links = footerSocialLinks(ctx.social).links;
839
+ return socialLinksPart(ctx.social);
840
+ }
841
+
842
+ /**
843
+ * The owner's stated social links as THE part (`footer.social`: its "Follow" label and one link per network, the contract's
844
+ * template) — the footer's block, and the "follow" row a contact section carries (compose-site), one recipe. Pure.
845
+ */
846
+ export function socialLinksPart(social?: ReadonlyArray<string> | null): PatternNode {
847
+ const links = footerSocialLinks(social).links;
810
848
  const fill = (n: PatternNode): PatternNode => {
811
849
  const template = (n.c ?? []).find(k => k.role === FooterRole.SocialLink);
812
850
  if (template) return { ...n, c: links.map(l => ({ ...template, text: l.name, href: l.url })) };
@@ -815,6 +853,10 @@ function socialPart(ctx: FooterContext): PatternNode {
815
853
  return fill(part(FooterHold.Social));
816
854
  }
817
855
 
856
+ /** The social part's links alone (no label) — a one-line footer's and name-and-action's end block. */
857
+ const socialLinksRow = (ctx: FooterContext): PatternNode[] =>
858
+ (socialPart(ctx).c ?? []).filter(n => n.role === FooterRole.Links).map(n => laid(n, { width: 'auto' }));
859
+
818
860
  /** A block it holds: how to reach the business leaves its city to the visit block when the footer holds both. */
819
861
  function holdPart(hold: string, mix: FooterMix, ctx: FooterContext): PatternNode {
820
862
  if (hold === FooterHold.Social) return socialPart(ctx);
@@ -875,6 +917,7 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
875
917
  const row: PatternNode = { t: 'Container', es: 'box', lay: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'space-between', gap: GAP }, c: [
876
918
  laid(part('copyright'), { width: 'auto' }),
877
919
  ...(mix.holds.includes(FooterHold.Pages) ? [part('pageRow')] : []),
920
+ ...(mix.holds.includes(FooterHold.Social) ? socialLinksRow(ctx) : []),
878
921
  ...(mix.holds.includes(FooterHold.Top) ? [part(FooterHold.Top)] : []),
879
922
  ] };
880
923
  return [row];
@@ -923,7 +966,10 @@ function endOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
923
966
  const end = part('name-and-action');
924
967
  const kids = (end.c ?? []).map(n => {
925
968
  if (n.role === FooterRole.Links) return mix.holds.includes(FooterHold.Pages) ? n : null;
926
- if (n.role === FooterRole.EndBlock) return { ...n, c: [laid(part('copyright'), { textAlign: 'end' }), ...(n.c ?? [])] };
969
+ if (n.role === FooterRole.EndBlock) {
970
+ const social = mix.holds.includes(FooterHold.Social) ? socialLinksRow(ctx) : [];
971
+ return { ...n, c: [laid(part('copyright'), { textAlign: 'end' }), ...social, ...(n.c ?? [])] };
972
+ }
927
973
  return n;
928
974
  }).filter((n): n is PatternNode => !!n);
929
975
  return [{ ...end, c: kids }, ...(footerNameFits(ctx) ? [closingName(ctx, mix)] : [])];
@@ -610,6 +610,8 @@ export interface LayoutSite {
610
610
  sections: LayoutSection[];
611
611
  /** Award §0c CW2: the page's own column word (`LayoutPage.column`); absent = the design's (`ComposeLayoutOptions.design`). */
612
612
  column?: string;
613
+ /** Social links (FV-D10): the owner's stated WhatsApp as a contact form's channel address (`statedWhatsAppHref`). */
614
+ whatsApp?: string;
613
615
  }
614
616
 
615
617
  // ── The tables the composer reads (the prototype renderer v4's values, `code/renderer-round4.src.html`) ──────────────