@vectoriox/iox-ui 5.197.0 → 5.199.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 (73) hide show
  1. package/actions-core/index.d.ts +7 -1
  2. package/composite-core/index.d.ts +16 -2
  3. package/data-core/index.d.ts +11 -3
  4. package/design-core/index.d.ts +185 -28
  5. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +6 -1
  6. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +34 -2
  8. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-data-core.mjs +30 -4
  10. package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-design-core.mjs +323 -72
  12. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  13. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +17351 -15175
  14. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  15. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +243 -38
  16. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  17. package/fesm2022/vectoriox-iox-ui.mjs +2 -2
  18. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  19. package/generation-core/index.d.ts +1703 -264
  20. package/harness-core/index.d.ts +93 -6
  21. package/package.json +1 -1
  22. package/src/actions-core/element-actions.ts +6 -0
  23. package/src/composite-core/header.ts +34 -1
  24. package/src/data-core/placeholder-rows.ts +29 -4
  25. package/src/design-core/brand.ts +58 -5
  26. package/src/design-core/contrast-audit.ts +49 -22
  27. package/src/design-core/design-apply.ts +34 -3
  28. package/src/design-core/flavor-fixtures.generated.ts +123 -123
  29. package/src/design-core/flavor-spec.generated.ts +44 -4
  30. package/src/design-core/flavor-tokens.ts +1 -1
  31. package/src/design-core/header-behaviour.ts +72 -13
  32. package/src/design-core/menu-look.ts +23 -0
  33. package/src/design-core/motion-language.ts +5 -14
  34. package/src/design-core/node-classes.ts +39 -0
  35. package/src/design-core/preloader.ts +4 -5
  36. package/src/generation-core/body-mix.ts +40 -102
  37. package/src/generation-core/check-free.ts +22 -11
  38. package/src/generation-core/check-layout.ts +10 -4
  39. package/src/generation-core/check-list.ts +3 -25
  40. package/src/generation-core/colour-mix.ts +296 -0
  41. package/src/generation-core/compose-free.ts +47 -20
  42. package/src/generation-core/compose-site.ts +259 -59
  43. package/src/generation-core/footer-mix.ts +258 -64
  44. package/src/generation-core/free-fallback.ts +6 -4
  45. package/src/generation-core/free-opening.ts +13 -2
  46. package/src/generation-core/free-parts.ts +87 -0
  47. package/src/generation-core/free-slot-words.ts +30 -0
  48. package/src/generation-core/free-wire.ts +8 -0
  49. package/src/generation-core/generation-tier.ts +6 -17
  50. package/src/generation-core/header-mix.ts +73 -3
  51. package/src/generation-core/layout-drawers.ts +3 -2
  52. package/src/generation-core/layout-wire.ts +10 -16
  53. package/src/generation-core/legal.ts +24 -0
  54. package/src/generation-core/list-panel.ts +3 -3
  55. package/src/generation-core/list-table.ts +5 -14
  56. package/src/generation-core/list-words.ts +2 -1
  57. package/src/generation-core/menu-shelves.ts +138 -0
  58. package/src/generation-core/nav-shape.ts +138 -15
  59. package/src/generation-core/node-baselines.generated.ts +1 -0
  60. package/src/generation-core/opening-mix.ts +7 -34
  61. package/src/generation-core/part-tier.ts +14 -0
  62. package/src/generation-core/patterns.ts +7 -0
  63. package/src/generation-core/plan-wire.ts +32 -43
  64. package/src/generation-core/public-api.ts +3 -0
  65. package/src/generation-core/site-build-run.ts +8 -0
  66. package/src/generation-core/site-plan.model.ts +3 -0
  67. package/src/generation-core/site-spec.generated.ts +1383 -189
  68. package/src/generation-core/validate-site-plan.ts +6 -5
  69. package/src/harness-core/business-types.ts +4 -0
  70. package/src/harness-core/harness-spec.generated.ts +189 -30
  71. package/src/harness-core/popup-stance.ts +56 -3
  72. package/src/harness-core/run-compose-context.ts +25 -5
  73. package/styles/iox-design.css +162 -3
@@ -5,6 +5,7 @@ import { layoutRoomPx, screenFontSize, screenWordOverflowPx } from './layout-lan
5
5
  import { PatternGlobalPosition, PatternNode, SITE_PATTERNS, SitePattern } from './patterns';
6
6
  import { SPEC_SITE_FOOTER_PARTS, SPEC_SITE_LAYOUT } from './site-spec.generated';
7
7
  import type { GenerationTier } from './site-plan.model';
8
+ import { tierOffers } from './part-tier';
8
9
 
9
10
  /**
10
11
  * FOOTER INGREDIENTS (list-ingredients-plan.md LI5): a site's footer is a MIX — an arrangement, the blocks it holds, how
@@ -26,6 +27,10 @@ export enum FooterIngredient {
26
27
  Ground = 'ground',
27
28
  /** AW12 (AW12-D12): how the closing name is worn. Not in the fingerprint (AW12-D14). */
28
29
  NameStyle = 'nameStyle',
30
+ /** FV1b (FV-D8, FV-D11): a block just before the footer's own that belongs to it — on every page, undone with it. */
31
+ Before = 'before',
32
+ /** FV1b: how the footer folds on a phone. */
33
+ Phone = 'phone',
29
34
  }
30
35
 
31
36
  /** The words, by the table (a word that waits for its phase too — `footerWords` offers only the drawn ones). */
@@ -35,6 +40,10 @@ export enum FooterArrange {
35
40
  Line = 'line',
36
41
  Ruled = 'ruled',
37
42
  ListBig = 'list-big',
43
+ /** FV0 (footer-v2 §4): laid by the model from the parts as a free section (waits for FV2). */
44
+ Free = 'free',
45
+ /** FV0: two zones divided by a vertical hairline (allerstudio, thepopuphotel; waits for FV1). */
46
+ Halves = 'halves',
38
47
  }
39
48
 
40
49
  export enum FooterHold {
@@ -49,6 +58,12 @@ export enum FooterHold {
49
58
  Badges = 'badges',
50
59
  Region = 'region',
51
60
  Search = 'search',
61
+ /** FV0: the owner's social links (waits for FV1 and the reading's links, FV-D10). */
62
+ Social = 'social',
63
+ /** FV0: a round back-to-top button (waits for FV1). */
64
+ Top = 'top',
65
+ /** FV0: the owner's picture and a chat button (waits for FV1). */
66
+ Chat = 'chat',
52
67
  }
53
68
 
54
69
  export enum FooterClosing {
@@ -59,6 +74,10 @@ export enum FooterClosing {
59
74
  Word = 'word',
60
75
  Newsletter = 'newsletter',
61
76
  NameAndAction = 'name-and-action',
77
+ /** FV0: the email set large as the footer's opening line (mdscollective; waits for FV1). */
78
+ Email = 'email',
79
+ /** FV0: the name or a farewell line huge and faint behind the blocks (haven; waits for FV3). */
80
+ Behind = 'behind',
62
81
  }
63
82
 
64
83
  export enum FooterGround {
@@ -70,6 +89,12 @@ export enum FooterGround {
70
89
  Scene = 'scene',
71
90
  Pattern = 'pattern',
72
91
  Inset = 'inset',
92
+ /** FV0: the owner's photo, dimmed (waits for FV3). */
93
+ Photo = 'photo',
94
+ /** FV0: the colour's gradient wash (waits for FV3 with colour-v2 CV3). */
95
+ Gradient = 'gradient',
96
+ /** FV0: a ruled box inside the page frame (damaria; waits for FV1). */
97
+ Framed = 'framed',
73
98
  }
74
99
 
75
100
  export enum FooterNameStyle {
@@ -77,6 +102,28 @@ export enum FooterNameStyle {
77
102
  Gradient = 'gradient',
78
103
  Emboss = 'emboss',
79
104
  Offset = 'offset',
105
+ /** FV0: the closing name in the look's script face (waits for TYPE's third family, AW13). */
106
+ Script = 'script',
107
+ }
108
+
109
+ /** FV1b: what opens the footer before its own blocks. */
110
+ export enum FooterBefore {
111
+ None = 'none',
112
+ /** A contact-form area (FV-D11, mdscollective · mooov). */
113
+ ContactForm = 'contact-form',
114
+ /** A sign-up band (cancan; waits for the newsletter, AW12). */
115
+ NewsletterBand = 'newsletter-band',
116
+ /** Where and when to visit, as a band. */
117
+ Visit = 'visit',
118
+ }
119
+
120
+ /** FV1b: how the footer folds on a phone. */
121
+ export enum FooterPhone {
122
+ Stack = 'stack',
123
+ /** The link columns fold into accordions (stroms, schlosshotel; waits — a fold only a phone wears). */
124
+ Accordion = 'accordion',
125
+ /** The sign-up comes first (8pm; waits for the newsletter, AW12). */
126
+ First = 'first',
80
127
  }
81
128
 
82
129
  /** The roles a footer's parts carry — the contract's (`site.footerParts` and the stored footers), written to the node's
@@ -99,6 +146,17 @@ export enum FooterRole {
99
146
  Ruled = 'footer.ruled',
100
147
  /** AW12 `arrange.list-big`: the pages stacked large. */
101
148
  ListBig = 'footer.list-big',
149
+ /** FV1 `arrange.halves`: two zones (the brand · the blocks) divided by a vertical hairline (iox-design.css). */
150
+ Halves = 'footer.halves',
151
+ /** FV1 `closing.email`: the owner's email set large, the contact link. */
152
+ Email = 'footer.email',
153
+ /** FV1b `holds.social`: the block, and each of its links (the contract part's template). */
154
+ Social = 'footer.social',
155
+ SocialLink = 'footer.social-link',
156
+ /** FV1b `holds.top`: the round button that scrolls to the page's top, at the end of the copyright row. */
157
+ Top = 'footer.top',
158
+ /** FV1b `before`: the block that opens the footer (the contact-form area, the visit band). */
159
+ Before = 'footer.before',
102
160
  }
103
161
 
104
162
 
@@ -111,6 +169,9 @@ export interface FooterMix {
111
169
  readonly ground: string;
112
170
  /** AW12: absent = plain (a stored or hand-made mix written before the name had a style). */
113
171
  readonly nameStyle?: string;
172
+ /** FV1b: absent = none / stack (every mix written before FV1b). */
173
+ readonly before?: string;
174
+ readonly phone?: string;
114
175
  }
115
176
 
116
177
  export class FooterMixError extends Error {}
@@ -136,10 +197,22 @@ export function footerWait(ingredient: `${FooterIngredient}`, word: string): Foo
136
197
  return WAITS[`${ingredient}.${word}`] ?? null;
137
198
  }
138
199
 
200
+ /**
201
+ * FV0 (FV-D9, vectoriox/iox-ai-guidance#2): blocks a footer holds that are no part of it — the legal row is stamped after
202
+ * EVERY footer by compose-site `legalRow` (`rules.legalAlways`), whether a mix names it or not. A mix may name it (stored
203
+ * mixes, the references); the recipe never looks for its part and the wire never offers it (there is no choice to make).
204
+ */
205
+ export const FOOTER_ROW_HOLDS: ReadonlySet<string> = new Set(F.rules.legalAlways ? [FooterHold.Legal] : []);
206
+ /** The blocks of a mix the recipe lays as parts (the legal row is compose-site's). */
207
+ /** FV1b: a hold the copyright row carries at its end (the back-to-top button) — never a column of its own. */
208
+ const BOTTOM_HOLDS: ReadonlySet<string> = new Set([FooterHold.Top]);
209
+ const partHolds = (holds: ReadonlyArray<string>): string[] => holds.filter(h => !FOOTER_ROW_HOLDS.has(h) && !BOTTOM_HOLDS.has(h));
210
+
139
211
  /** The words an ingredient may take — the DRAWN ones, the only ones the wire, the brief and the mender offer
140
- * (ingredients.md §3.3: offering a waiting word would put its stand-in on every site that asked for it). */
212
+ * (ingredients.md §3.3: offering a waiting word would put its stand-in on every site that asked for it). The legal row
213
+ * is drawn on every footer, so it is never offered as a choice (`FOOTER_ROW_HOLDS`). */
141
214
  export function footerWords(ingredient: `${FooterIngredient}`): ReadonlyArray<string> {
142
- return footerTableWords(ingredient).filter(w => !footerWait(ingredient, w));
215
+ return footerTableWords(ingredient).filter(w => !footerWait(ingredient, w) && !(ingredient === FooterIngredient.Holds && FOOTER_ROW_HOLDS.has(w)));
143
216
  }
144
217
 
145
218
  /** What a word means, as the brief and the builder say it. */
@@ -172,21 +245,27 @@ export function namedFooterMix(patternId: string): FooterMix | null {
172
245
 
173
246
  /** The stored footer pattern a mix is exactly, else null. */
174
247
  export function footerPatternIdOf(mix: FooterMix): string | null {
175
- const key = footerTokenOf(mix) + JSON.stringify(mix.holds) + nameStyleOf(mix);
248
+ const key = footerTokenOf(mix) + JSON.stringify(mix.holds) + nameStyleOf(mix) + beforeOf(mix) + phoneOf(mix);
176
249
  return Object.keys(F.named).find(id => {
177
250
  const m = namedFooterMix(id)!;
178
- return footerTokenOf(m) + JSON.stringify(m.holds) + nameStyleOf(m) === key;
251
+ return footerTokenOf(m) + JSON.stringify(m.holds) + nameStyleOf(m) + beforeOf(m) + phoneOf(m) === key;
179
252
  }) ?? null;
180
253
  }
181
254
 
182
255
  /** The name's style of a mix (absent = plain). */
183
256
  export const nameStyleOf = (mix: Pick<FooterMix, 'nameStyle'>): string => mix.nameStyle ?? FooterNameStyle.Plain;
257
+ /** FV1b: what opens the footer (absent = none) and how it folds on a phone (absent = stack). */
258
+ export const beforeOf = (mix: Pick<FooterMix, 'before'>): string => mix.before ?? FooterBefore.None;
259
+ export const phoneOf = (mix: Pick<FooterMix, 'phone'>): string => mix.phone ?? FooterPhone.Stack;
184
260
 
185
261
  /** A mix on the wire: ONE list of `<ingredient>:<word>` words (the list wire's encoding), `holds` once per block. A plain
186
262
  * name says nothing (`nameStyle:plain` is every mix's), so a mix stored before AW12 reads and writes the same words. */
187
263
  export function footerMixWords(mix: FooterMix): string[] {
188
264
  return Object.values(FooterIngredient).flatMap(k => {
189
265
  if (k === FooterIngredient.NameStyle) return nameStyleOf(mix) === FooterNameStyle.Plain ? [] : [`${k}:${nameStyleOf(mix)}`];
266
+ // FV1b: nothing before and a stacked phone are every mix's, so a mix stored before FV1b reads and writes the same words.
267
+ if (k === FooterIngredient.Before) return beforeOf(mix) === FooterBefore.None ? [] : [`${k}:${beforeOf(mix)}`];
268
+ if (k === FooterIngredient.Phone) return phoneOf(mix) === FooterPhone.Stack ? [] : [`${k}:${phoneOf(mix)}`];
190
269
  return (MANY.includes(k) ? mix[k] as ReadonlyArray<string> : [mix[k] as string]).map(w => `${k}:${w}`);
191
270
  });
192
271
  }
@@ -211,7 +290,8 @@ export function drawnFooterMix(mix: FooterMix): { mix: FooterMix; waited: Array<
211
290
  // In the table's order, so the words that waited are said as the table reads.
212
291
  const arrange = one(FooterIngredient.Arrange);
213
292
  const holds = inOrder(FooterIngredient.Holds, mix.holds.map(h => drawn(FooterIngredient.Holds, h)).filter((h): h is string => !!h));
214
- const out = { arrange, holds, closing: one(FooterIngredient.Closing), ground: one(FooterIngredient.Ground), nameStyle: one(FooterIngredient.NameStyle) };
293
+ const out = { arrange, holds, closing: one(FooterIngredient.Closing), ground: one(FooterIngredient.Ground), nameStyle: one(FooterIngredient.NameStyle),
294
+ before: one(FooterIngredient.Before), phone: one(FooterIngredient.Phone) };
215
295
  return { mix: waited.length ? out : mix, waited };
216
296
  }
217
297
 
@@ -257,17 +337,14 @@ export function footerFaceOf(footer: FooterMix | string): string {
257
337
  return `${FOOTER_TOKEN}:${at(FooterIngredient.Arrange)}/${at(FooterIngredient.Closing)}`;
258
338
  }
259
339
 
260
- /** AW-D23 / AW12-D13: a word every plan wears (`all`) or one the award tier alone is offered (`pro`). */
340
+ /** The tier a word was first drawn for (`all`, or `pro` — AW-D23 / AW12-D13); since AW-D42 every tier wears both. */
261
341
  export function footerWordTier(ingredient: `${FooterIngredient}`, word: string): 'all' | 'pro' {
262
342
  return (F.tiers as Readonly<Record<string, string>>)[`${ingredient}.${word}`] === 'pro' ? 'pro' : 'all';
263
343
  }
264
344
 
265
- /** The award tier (a value import of site-plan.model here reorders the generation-core load). */
266
- const AWARD = 'award' as `${GenerationTier}`;
267
-
268
- /** May a footer at `tier` wear this word? No tier named: every drawn word (as before the tier was asked). */
345
+ /** May a footer at `tier` wear this word? Every tier wears every drawn word (AW-D42, `tierOffers`). */
269
346
  export function footerWordOffered(ingredient: `${FooterIngredient}`, word: string, tier?: `${GenerationTier}`): boolean {
270
- return !tier || tier === AWARD || footerWordTier(ingredient, word) === 'all';
347
+ return tierOffers(footerWordTier(ingredient, word), tier);
271
348
  }
272
349
 
273
350
  /** A footer token in words: `footer:columns/none/inverse` → "columns · none · inverse". */
@@ -312,9 +389,17 @@ export enum FooterRepairCode {
312
389
  /** AW12-D10 (H1): a word the kind of business never closes with or stands on (harness FOOTER_NEVER): the call · the
313
390
  * dark band. */
314
391
  TypeNever = 'type-never',
315
- /** AW12-D13 / SJ-D5 (iox-ui#153): a word the award tier alone wears, on a site built below it — the table's default
316
- * (a held block: left out). */
317
- ProOnly = 'pro-only',
392
+ /** FV1: the email closing is the owner's own address — none given (or too wide for a phone): no closing. */
393
+ EmailWithoutAddress = 'email-without-address',
394
+ EmailTooLong = 'email-too-long',
395
+ /** FV1: halves need a block in the end zone — none held: drawn as columns. */
396
+ HalvesEmpty = 'halves-empty',
397
+ /** FV1b: the social block lists the owner's stated links on a network it can name — none: left out; past
398
+ * `socialMax`, or on no known network: those left out. */
399
+ SocialWithoutLinks = 'social-without-links',
400
+ SocialLeftOut = 'social-left-out',
401
+ /** FV1b: a visit band before the footer says where and when — the visit block is not said twice. */
402
+ VisitBeforeTwice = 'visit-before-twice',
318
403
  }
319
404
 
320
405
  export interface FooterRepair {
@@ -349,8 +434,12 @@ export interface FooterContext {
349
434
  locale?: string;
350
435
  /** AW12-D10: what this kind of business's footer never wears (absent = nothing refused). */
351
436
  never?: FooterNever | null;
352
- /** AW12-D13: the tier the site is built at — a word above it is mended (`pro-only`). Absent: every word (the owner's
353
- * choice in the builder). */
437
+ /** FV1 `closing.email`: the owner's email (the plan's `facts.email`) — none given, the footer never closes with one. */
438
+ email?: string;
439
+ /** FV1b `holds.social`: the owner's social links as stated (the plan's `business.social`) — none, no social block. */
440
+ social?: ReadonlyArray<string>;
441
+ /** The tier the site is built at. Since AW-D42 it mends no word (every tier wears every drawn word); kept so its
442
+ * callers still read. */
354
443
  tier?: `${GenerationTier}`;
355
444
  }
356
445
 
@@ -411,6 +500,49 @@ function statementPhoneLines(tagline: string, ctx: FooterContext): number {
411
500
  return Math.ceil((widthEm(tagline, ctx) * size) / room);
412
501
  }
413
502
 
503
+ /** FV1b (FV-D10): a network the footer can name a social link by — the contract's `FOOTER.socialNetworks`. */
504
+ export interface FooterSocialNetwork { readonly id: string; readonly name: string; readonly hosts: ReadonlyArray<string> }
505
+ export const FOOTER_SOCIAL_NETWORKS = (F as unknown as { socialNetworks: ReadonlyArray<FooterSocialNetwork> }).socialNetworks;
506
+
507
+ /** One social link the footer shows: the network's name and the owner's address (https). */
508
+ export interface FooterSocialLink { readonly network: string; readonly name: string; readonly url: string }
509
+
510
+ /** The host an address is on, bare (no `www.` / `m.`), or null when it is no http(s) address. */
511
+ function socialAddress(raw: string): URL | null {
512
+ const word = raw.trim().replace(/[.,;:!?)\]]+$/, '').replace(/^[(\[<]+/, '');
513
+ if (!word) return null;
514
+ const scheme = /^[a-z][a-z0-9+.-]*:/i.exec(word)?.[0].toLowerCase();
515
+ if (scheme && scheme !== 'http:' && scheme !== 'https:') return null;
516
+ try {
517
+ const url = new URL(scheme ? word : `https://${word}`);
518
+ url.protocol = 'https:';
519
+ return url;
520
+ } catch {
521
+ return null;
522
+ }
523
+ }
524
+
525
+ /**
526
+ * FV1b (FV-D10, rule 3 + 4): the owner's stated social addresses as the links a footer shows — each on a network the
527
+ * footer can name (by its host), a profile (a path past the host), once per network, in the table's order, at most
528
+ * `socialMax`. Everything else is `leftOut` (and said): the footer never shows a link it cannot name, and never one the
529
+ * owner did not state. An entry may hold several addresses (a stated line, space- or comma-separated). Pure.
530
+ */
531
+ export function footerSocialLinks(addresses?: ReadonlyArray<string> | null): { links: FooterSocialLink[]; leftOut: string[] } {
532
+ const found = new Map<string, FooterSocialLink>();
533
+ const leftOut: string[] = [];
534
+ for (const raw of (addresses ?? []).flatMap(a => String(a).split(/[\s,]+/)).filter(Boolean)) {
535
+ const url = socialAddress(raw);
536
+ const host = url?.hostname.toLowerCase().replace(/^(www|m)\./, '');
537
+ const network = host ? FOOTER_SOCIAL_NETWORKS.find(n => n.hosts.some(h => host === h || host.endsWith(`.${h}`))) : undefined;
538
+ if (!url || !network || url.pathname.replace(/\/+$/, '') === '' || found.has(network.id)) { leftOut.push(raw); continue; }
539
+ found.set(network.id, { network: network.id, name: network.name, url: url.href });
540
+ }
541
+ const links = FOOTER_SOCIAL_NETWORKS.map(n => found.get(n.id)).filter((l): l is FooterSocialLink => !!l);
542
+ const max = rule('socialMax');
543
+ return { links: links.slice(0, max), leftOut: [...leftOut, ...links.slice(max).map(l => l.url)] };
544
+ }
545
+
414
546
  /** True when the call word cannot stand on a phone even split over two balanced lines. */
415
547
  function wordTooWide(word: string, ctx: FooterContext): boolean {
416
548
  const halves = word.split(/\s+/);
@@ -426,32 +558,6 @@ export const footerNameFits = (ctx: FooterContext): boolean => !overflowsPhone(n
426
558
  const an = (word: string): string => `${/^[aeiou]/.test(word) ? 'an' : 'a'} ${word}`;
427
559
  const capital = (said: string): string => said.charAt(0).toUpperCase() + said.slice(1);
428
560
 
429
- /** The ingredients a footer wears one word of — the ones a tier may mend to the table's default. */
430
- const ONE_WORD: ReadonlyArray<FooterIngredient> = [FooterIngredient.Arrange, FooterIngredient.Closing, FooterIngredient.Ground, FooterIngredient.NameStyle];
431
-
432
- /**
433
- * AW12-D13 (iox-ui#153): the mix as `tier` may wear it — a word the award tier alone wears becomes the table's default
434
- * (a held block is left out), each said. No tier, or the award tier: the mix as it is. Pure.
435
- */
436
- export function footerAtTier(mix: FooterMix, tier?: `${GenerationTier}`): { mix: FooterMix; said: string[] } {
437
- if (!tier || tier === AWARD) return { mix, said: [] };
438
- const said: string[] = [];
439
- const out: Record<string, string | ReadonlyArray<string>> = { ...mix };
440
- const defaults = F.defaults as unknown as Readonly<Record<string, string>>;
441
- for (const k of ONE_WORD) {
442
- const word = mix[k as keyof FooterMix] as string | undefined;
443
- if (!word || footerWordOffered(k, word, tier)) continue;
444
- out[k] = defaults[k];
445
- said.push(`"${footerMeaning(k, word)}" comes with the award plan: ${footerMeaning(k, defaults[k])} instead`);
446
- }
447
- const left = mix.holds.filter(h => !footerWordOffered(FooterIngredient.Holds, h, tier));
448
- if (left.length) {
449
- out[FooterIngredient.Holds] = mix.holds.filter(h => !left.includes(h));
450
- said.push(`${left.map(h => `"${footerMeaning(FooterIngredient.Holds, h)}"`).join(' and ')} ${left.length > 1 ? 'come' : 'comes'} with the award plan: left out`);
451
- }
452
- return { mix: out as unknown as FooterMix, said };
453
- }
454
-
455
561
  /**
456
562
  * The ONE judge of a footer mix: what the table's rules refuse is mended to the nearest mix that keeps them, and each mend
457
563
  * is said. Never throws on a well-formed mix. Pure.
@@ -463,10 +569,7 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
463
569
  if (drawn.waited.length) {
464
570
  say(FooterRepairCode.Waits, drawn.waited.map(w => `the footer's ${w.ingredient} "${w.word}" is drawn in ${w.phase}: ${w.drawnAs ? `"${w.drawnAs}" meanwhile` : 'left out meanwhile'}`).join('; '));
465
571
  }
466
- // AW12-D13: below the award tier, an award word is the table's default — before every other rule judges the mix.
467
- const atTier = footerAtTier(drawn.mix, ctx.tier);
468
- for (const said of atTier.said) say(FooterRepairCode.ProOnly, said);
469
- const mix = atTier.mix;
572
+ const mix = drawn.mix;
470
573
  let holds = inOrder(FooterIngredient.Holds, mix.holds);
471
574
  let closing = mix.closing;
472
575
  let arrange = mix.arrange;
@@ -482,7 +585,7 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
482
585
  ground = FooterGround.Inverse;
483
586
  }
484
587
  if (arrange === FooterArrange.Line) {
485
- const kept = holds.filter(h => (F.rules.lineHolds as ReadonlyArray<string>).includes(h));
588
+ const kept = holds.filter(h => (F.rules.lineHolds as ReadonlyArray<string>).includes(h) || BOTTOM_HOLDS.has(h));
486
589
  const left = holds.filter(h => !kept.includes(h));
487
590
  if (left.length) say(FooterRepairCode.LineHolds, `a one-line footer holds only ${F.rules.lineHolds.join(' and ')}: ${left.join(' and ')} left out`);
488
591
  holds = kept;
@@ -501,6 +604,17 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
501
604
  say(FooterRepairCode.WordTooLong, `"${footerCallWord(ctx.type, ctx.locale)}" is too wide for a phone even on two lines: the footer closes with a call`);
502
605
  closing = FooterClosing.Call;
503
606
  }
607
+ if (closing === FooterClosing.Email) {
608
+ // FV1 (rule 3, footer-v2 §4): the address is the owner's fact, never made up and never a placeholder.
609
+ const email = ctx.email?.trim();
610
+ if (!email) {
611
+ say(FooterRepairCode.EmailWithoutAddress, 'the email closing is the owner\'s own address and none was given: no closing');
612
+ closing = FooterClosing.None;
613
+ } else if (overflowsPhone(widthEm(email, ctx, 'link-display'), ctx)) {
614
+ say(FooterRepairCode.EmailTooLong, `"${email}" does not fit a phone even at the smallest size: no closing`);
615
+ closing = FooterClosing.None;
616
+ }
617
+ }
504
618
  if (closing === FooterClosing.Name && !footerNameFits(ctx)) {
505
619
  say(FooterRepairCode.NameTooLong, `"${ctx.name}" is too long to stand across a phone: the footer closes with nothing`);
506
620
  closing = FooterClosing.None;
@@ -511,8 +625,8 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
511
625
  holds = holds.filter(h => END_HOLDS.includes(h));
512
626
  if (!footerNameFits(ctx)) say(FooterRepairCode.NameTooLong, `"${ctx.name}" is too long to stand across a phone: the action stays, the name is left out`);
513
627
  }
514
- if (arrange === FooterArrange.Ruled && holds.length + 1 < rule('ruledMinBlocks')) {
515
- say(FooterRepairCode.RuledFewBlocks, `ruled cells need company and the footer holds ${holds.length + 1} block${holds.length ? 's' : ''}: drawn as columns`);
628
+ if (arrange === FooterArrange.Ruled && partHolds(holds).length + 1 < rule('ruledMinBlocks')) {
629
+ say(FooterRepairCode.RuledFewBlocks, `ruled cells need company and the footer holds ${partHolds(holds).length + 1} block${partHolds(holds).length ? 's' : ''}: drawn as columns`);
516
630
  arrange = FooterArrange.Columns;
517
631
  }
518
632
  if (arrange === FooterArrange.ListBig && ctx.pages !== undefined && ctx.pages > rule('listBigPages')) {
@@ -527,9 +641,26 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
527
641
  say(FooterRepairCode.EmbossNeedsBrand, `${capital(an(nameStyle))} name is a copy of the name the brand block says, and this footer has none: plain`);
528
642
  nameStyle = FooterNameStyle.Plain;
529
643
  }
530
- if (holds.length < F.rules.minHolds && closing === FooterClosing.None) {
644
+ if (holds.includes(FooterHold.Social)) {
645
+ // FV1b (rule 3 + 4, FV-D10): only the links the owner stated, each on a network the footer can name.
646
+ const links = footerSocialLinks(ctx.social);
647
+ if (!links.links.length) {
648
+ say(FooterRepairCode.SocialWithoutLinks, 'the social block lists the owner\'s own links and none was stated: left out');
649
+ holds = holds.filter(h => h !== FooterHold.Social);
650
+ }
651
+ if (links.leftOut.length) say(FooterRepairCode.SocialLeftOut, `${links.leftOut.map(a => `"${a}"`).join(', ')} left out of the social links (${links.links.length ? `past ${rule('socialMax')} or ` : ''}on no network the footer can name)`);
652
+ }
653
+ if (beforeOf(mix) === FooterBefore.Visit && holds.includes(FooterHold.Visit)) {
654
+ say(FooterRepairCode.VisitBeforeTwice, 'the band before the footer says where and when: the visit block is not said twice');
655
+ holds = holds.filter(h => h !== FooterHold.Visit);
656
+ }
657
+ if (arrange === FooterArrange.Halves && !partHolds(holds).length) {
658
+ say(FooterRepairCode.HalvesEmpty, 'halves need a block beside the name and the footer holds none: drawn as columns');
659
+ arrange = FooterArrange.Columns;
660
+ }
661
+ if (partHolds(holds).length < F.rules.minHolds && closing === FooterClosing.None) {
531
662
  say(FooterRepairCode.Empty, 'a footer that holds nothing holds the pages');
532
- holds = [FooterHold.Pages];
663
+ holds = inOrder(FooterIngredient.Holds, [FooterHold.Pages, ...holds]);
533
664
  }
534
665
  return { mix: { ...mix, holds, closing, arrange, nameStyle, ground }, repairs };
535
666
  }
@@ -600,8 +731,26 @@ function callPart(ctx: FooterContext): PatternNode {
600
731
  return { ...node, c: (node.c ?? []).map(n => (n.slot === 'closing' ? { ...n, text: line, ...(lineHe ? { textHe: lineHe } : {}) } : n)) };
601
732
  }
602
733
 
734
+ /** The email closing (FV1 `closing.email`): the part's link, its words the owner's address (the fact), fitted to the
735
+ * column as the call word is. */
736
+ function emailLine(email: string, ctx: FooterContext): PatternNode {
737
+ return laid(part('email'), { fontSize: columnSize(widthEm(email, ctx, 'link-display'), ctx) });
738
+ }
739
+
740
+ /** FV1b `holds.social`: the part's template link once per stated link — the network's name, the owner's address. */
741
+ function socialPart(ctx: FooterContext): PatternNode {
742
+ const links = footerSocialLinks(ctx.social).links;
743
+ const fill = (n: PatternNode): PatternNode => {
744
+ const template = (n.c ?? []).find(k => k.role === FooterRole.SocialLink);
745
+ if (template) return { ...n, c: links.map(l => ({ ...template, text: l.name, href: l.url })) };
746
+ return n.c ? { ...n, c: n.c.map(fill) } : n;
747
+ };
748
+ return fill(part(FooterHold.Social));
749
+ }
750
+
603
751
  /** A block it holds: how to reach the business leaves its city to the visit block when the footer holds both. */
604
- function holdPart(hold: string, mix: FooterMix): PatternNode {
752
+ function holdPart(hold: string, mix: FooterMix, ctx: FooterContext): PatternNode {
753
+ if (hold === FooterHold.Social) return socialPart(ctx);
605
754
  const node = part(hold);
606
755
  if (hold !== FooterHold.Contact || !mix.holds.includes(FooterHold.Visit)) return node;
607
756
  return { ...node, c: (node.c ?? []).filter(n => n.ph !== 'city') };
@@ -620,23 +769,50 @@ function bigPages(ctx: FooterContext): PatternNode[] {
620
769
  return [big, { ...rest, c: (rest.c ?? []).map(n => (n.each ? { ...n, skip: rule('listBigLarge') } : n)) }];
621
770
  }
622
771
 
772
+ /** FV1b `holds.top`: the copyright row — the back-to-top button at its end when the footer holds it (never a column). */
773
+ function bottomRow(mix: FooterMix, copyright: PatternNode, justify = 'space-between'): PatternNode {
774
+ if (!mix.holds.includes(FooterHold.Top)) return copyright;
775
+ return { t: 'Container', es: 'box', lay: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: justify, gap: GAP },
776
+ c: [laid(copyright, { width: 'auto' }), part(FooterHold.Top)] };
777
+ }
778
+
779
+ /** FV1b `before` (FV-D11): the block that opens the footer, on every page with it — the contact-form area under the kind of
780
+ * business's call line, or where and when as a band — and a rule under it. */
781
+ function beforeBlock(mix: FooterMix, ctx: FooterContext): PatternNode[] {
782
+ switch (beforeOf(mix)) {
783
+ case FooterBefore.ContactForm: {
784
+ const node = part('contact-form');
785
+ const line = footerCallLine(ctx.type);
786
+ const lineHe = footerCallLine(ctx.type, 'he');
787
+ const c = (node.c ?? []).map(n => (n.slot === 'beforeTitle' && line ? { ...n, text: line, ...(lineHe ? { textHe: lineHe } : {}) } : n));
788
+ return [{ ...node, c }, part('rule')];
789
+ }
790
+ case FooterBefore.Visit:
791
+ return [{ t: 'Container', es: 'box', role: FooterRole.Before, lay: { display: 'flex', flexWrap: 'wrap', alignItems: 'baseline', justifyContent: 'space-between', gap: GAP },
792
+ c: part(FooterHold.Visit).c ?? [] }, part('rule')];
793
+ default:
794
+ return [];
795
+ }
796
+ }
797
+
623
798
  /** The body: the blocks it holds, arranged. */
624
799
  function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
625
- const holds = mix.holds.map(h => holdPart(h, mix));
800
+ const holds = partHolds(mix.holds).map(h => holdPart(h, mix, ctx));
626
801
  switch (mix.arrange) {
627
802
  case FooterArrange.Line: {
628
803
  const row: PatternNode = { t: 'Container', es: 'box', lay: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'space-between', gap: GAP }, c: [
629
804
  laid(part('copyright'), { width: 'auto' }),
630
805
  ...(mix.holds.includes(FooterHold.Pages) ? [part('pageRow')] : []),
806
+ ...(mix.holds.includes(FooterHold.Top) ? [part(FooterHold.Top)] : []),
631
807
  ] };
632
808
  return [row];
633
809
  }
634
810
  case FooterArrange.Centred: {
635
- const blocks = mix.holds.map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : centred(holdPart(h, mix))));
811
+ const blocks = partHolds(mix.holds).map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : centred(holdPart(h, mix, ctx))));
636
812
  return [
637
813
  { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: '28px', ...CENTRED }, c: [centred(brandPart(ctx, mix)), ...blocks] },
638
814
  part('rule'),
639
- laid(part('copyright'), { textAlign: 'center' }),
815
+ bottomRow(mix, laid(part('copyright'), { textAlign: 'center' }), 'center'),
640
816
  ];
641
817
  }
642
818
  case FooterArrange.Ruled: {
@@ -645,19 +821,27 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
645
821
  const cells = [brandPart(ctx, mix), ...holds];
646
822
  const n = Math.min(cells.length, rule('ruledCells'));
647
823
  return [{ t: 'Container', es: 'box', role: FooterRole.Ruled, lay: { display: 'grid', gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))`, gap: `${GAP} 0px` },
648
- resp: { tablet: { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' }, mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: cells }, part('rule'), part('copyright')];
824
+ resp: { tablet: { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' }, mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: cells }, part('rule'), bottomRow(mix, part('copyright'))];
649
825
  }
650
826
  case FooterArrange.ListBig: {
651
- const others = mix.holds.filter(h => h !== FooterHold.Pages).map(h => holdPart(h, mix));
827
+ const others = partHolds(mix.holds).filter(h => h !== FooterHold.Pages).map(h => holdPart(h, mix, ctx));
652
828
  const pages = mix.holds.includes(FooterHold.Pages) ? bigPages(ctx) : [];
653
829
  return [{ t: 'Container', es: 'box', lay: { display: 'grid', gridTemplateColumns: 'minmax(0, 3fr) minmax(0, 2fr)', gap: GAP, alignItems: 'end' },
654
830
  resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: [
655
831
  { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: GAP }, c: pages },
656
832
  { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: GAP }, c: [brandPart(ctx, mix), ...others] },
657
- ] }, part('rule'), part('copyright')];
833
+ ] }, part('rule'), bottomRow(mix, part('copyright'))];
834
+ }
835
+ case FooterArrange.Halves: {
836
+ // FV1 (footer-v2 §2, after thepopuphotel and allerstudio): the brand at the start, the blocks in columns at the
837
+ // end, a vertical hairline between them (iox-design.css `footer.halves`); one under another on a phone.
838
+ const end: PatternNode = { t: 'Container', es: 'box', lay: { display: 'grid', gridTemplateColumns: `repeat(${Math.max(holds.length, 1)}, minmax(0, 1fr))`, gap: GAP },
839
+ resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: holds };
840
+ return [{ t: 'Container', es: 'box', role: FooterRole.Halves, lay: { display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1fr)', gap: '0px' },
841
+ resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: [brandPart(ctx, mix), end] }, part('rule'), bottomRow(mix, part('copyright'))];
658
842
  }
659
843
  default:
660
- return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [brandPart(ctx, mix), ...holds] }, part('rule'), part('copyright')];
844
+ return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [brandPart(ctx, mix), ...holds] }, part('rule'), bottomRow(mix, part('copyright'))];
661
845
  }
662
846
  }
663
847
 
@@ -677,6 +861,8 @@ function endOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
677
861
  const GROUND_SCHEME: Readonly<Record<string, string | null>> = {
678
862
  [FooterGround.Inverse]: 'inverse', [FooterGround.Subtle]: 'subtle', [FooterGround.Accent]: 'accent', [FooterGround.Plain]: null,
679
863
  [FooterGround.Inset]: 'inverse',
864
+ // FV1: a framed footer stands on the page's own ground, in a ruled box (stampFooterMix + iox-design.css).
865
+ [FooterGround.Framed]: null,
680
866
  };
681
867
 
682
868
  /** A footer mix as a pattern: what the composer stamps as the site's footer (global, after the page). Check it first. */
@@ -687,11 +873,12 @@ export function footerPattern(given: FooterMix, ctx: FooterContext): SitePattern
687
873
  [FooterClosing.Call]: () => [mix.arrange === FooterArrange.Columns ? callPart(ctx) : centred(callPart(ctx))],
688
874
  [FooterClosing.Statement]: () => [part('statement')],
689
875
  [FooterClosing.Word]: () => [callWord(ctx)],
876
+ [FooterClosing.Email]: () => (ctx.email?.trim() ? [emailLine(ctx.email.trim(), ctx)] : []),
690
877
  } as Readonly<Record<string, () => PatternNode[]>>;
691
878
  const before = opens[mix.closing]?.() ?? [];
692
879
  const body = mix.closing === FooterClosing.NameAndAction ? endOf(mix, ctx) : bodyOf(mix, ctx);
693
880
  const name = mix.closing === FooterClosing.Name ? [closingName(ctx, mix)] : [];
694
- const c = [...(plain ? [part('rule')] : []), ...before, ...body, ...name];
881
+ const c = [...(plain ? [part('rule')] : []), ...beforeBlock(mix, ctx), ...before, ...body, ...name];
695
882
  // The contract's shell; a Section with one child does not stack it (the patterns' rule, build-spec "more than one child").
696
883
  const { lay, ...shell } = part('section');
697
884
  const scheme = GROUND_SCHEME[mix.ground] ?? null;
@@ -716,12 +903,22 @@ export const FOOTER_INSET_STYLES: Readonly<Record<string, string>> = {
716
903
  borderRadius: 'var(--iox-radius-xl)',
717
904
  };
718
905
 
906
+ /** FV1 `ground.framed`: the box stands at an inset footer's margin (inside the page frame) and pads its words back onto the
907
+ * column; its rule is iox-design.css's (`iox-footer-ground-framed`). */
908
+ export const FOOTER_FRAMED_STYLES: Readonly<Record<string, string>> = {
909
+ margin: FOOTER_INSET_STYLES['margin'], paddingLeft: FOOTER_INSET_STYLES['paddingLeft'], paddingRight: FOOTER_INSET_STYLES['paddingRight'],
910
+ };
911
+
719
912
  /**
720
913
  * The composed footer's root says the mix it was composed as (`FOOTER_MIX_PROP` — the classes iox-design.css draws from),
721
914
  * and an inset footer wears the card shape (AW6's trait) at the footer's own margin. Pure on the node it is given.
722
915
  */
723
916
  export function stampFooterMix(root: { props: Record<string, unknown>; styleProps?: Record<string, unknown> }, mix: FooterMix): void {
724
917
  root.props = { ...root.props, [FOOTER_MIX_PROP]: footerMixWords({ ...mix, holds: [] }).filter(w => !w.startsWith(`${FooterIngredient.Holds}:`)).join(' ') };
918
+ if (mix.ground === FooterGround.Framed) {
919
+ root.styleProps = { ...(root.styleProps ?? {}), ...FOOTER_FRAMED_STYLES };
920
+ return;
921
+ }
725
922
  if (mix.ground !== FooterGround.Inset) return;
726
923
  root.props = { ...root.props, [SECTION_SHAPE_TRAIT]: SectionShape.Card };
727
924
  root.styleProps = { ...(root.styleProps ?? {}), ...FOOTER_INSET_STYLES };
@@ -738,17 +935,14 @@ const MEND_ORDER: ReadonlyArray<FooterIngredient.Closing | FooterIngredient.Grou
738
935
  /**
739
936
  * A footer no other site wears (R-H10): the mix when no other site's footer READS like it (`footerFaceOf` — the same
740
937
  * arrangement and closing, whatever the ground), else the nearest mix that reads otherwise — one changed ingredient before
741
- * two, in `MEND_ORDER`, each word in the table's order and offered at `tier` (AW12-D13: a Basic site is never given an
742
- * award word) — checked again (`checkFooter`), and said. When every face is worn, a free token is enough (the plan's own,
938
+ * two, in `MEND_ORDER`, each word in the table's order and offered at `tier` (every tier's since AW-D42) — checked again (`checkFooter`), and said. When every face is worn, a free token is enough (the plan's own,
743
939
  * else the nearest); when every footer is worn, the mix as it is. Pure, deterministic.
744
940
  */
745
941
  export function distinctFooter(mix: FooterMix, taken: ReadonlyArray<string>, ctx: FooterContext, tier?: `${GenerationTier}`): { mix: FooterMix; repairs: FooterRepair[] } {
746
942
  const used = new Set(taken);
747
943
  const faces = new Set(taken.map(footerFaceOf));
748
944
  const free = (m: FooterMix, byFace: boolean) => !used.has(footerTokenOf(m)) && (!byFace || !faces.has(footerFaceOf(m)));
749
- // judged as the tier will draw it (the composer's check says the tier's mends; here they only shape the judgement)
750
945
  const asked = mix;
751
- mix = footerAtTier(mix, tier).mix;
752
946
  if (free(mix, true)) return { mix: asked, repairs: [] };
753
947
  const words = (k: FooterIngredient) => footerWords(k).filter(w => footerWordOffered(k, w, tier));
754
948
  const tries: FooterMix[] = [];
@@ -4,6 +4,7 @@ import { LayoutIssue, LayoutIssueCode, LayoutLayer, LayoutLayerKind, LayoutPage,
4
4
  import { fallBackBySection, SectionFallback, SectionSwap } from './layout-section-fallback';
5
5
  import { followedAfter, PromptLimit, sectionBreaks } from './prompt-limits';
6
6
  import { PageSectionPlan } from './site-plan.model';
7
+ import { freeSlotOf, FreeSlotKind } from './free-slot-words';
7
8
 
8
9
  /**
9
10
  * THE FREE PAGE'S SILENT FALL BACK (award plan §11.4 gate 6, R-H7): a free section that still breaks a rule after the
@@ -46,10 +47,11 @@ function layerOf(node: FreeNode): LayoutLayer | null {
46
47
  if (word) return { kind: word, text: node.text ?? '', ...AT };
47
48
  if (node.type === FreeNodeType.Image) return { kind: LayoutLayerKind.Photo, photo: { id: node.src ?? '' }, ...AT };
48
49
  if (node.type !== FreeNodeType.Slot) return null;
49
- const [kind, ref] = String(node.slot ?? '').split(':');
50
- if (kind === 'list') return { kind: LayoutLayerKind.Gallery, gallery: { slides: [], source: ref }, ...AT };
51
- if (kind === 'form') return { kind: LayoutLayerKind.Form, form: { preset: ref } as LayoutLayer['form'], ...AT };
52
- return null;
50
+ const slot = freeSlotOf(String(node.slot ?? ''));
51
+ if (!slot) return null;
52
+ if (slot.kind === FreeSlotKind.Form) return { kind: LayoutLayerKind.Form, form: { preset: slot.ref } as LayoutLayer['form'], ...AT };
53
+ // A list, or a recipe over one (Accordion, Tabs, the quotes): the fit reads the list it shows.
54
+ return { kind: LayoutLayerKind.Gallery, gallery: { slides: [], source: slot.ref }, ...AT };
53
55
  }
54
56
 
55
57
  /** A free section read as a layout section (for the fit only — never stamped). */
@@ -46,9 +46,20 @@ export interface FreeOpeningOffer {
46
46
 
47
47
  /** What a free page's opening is offered, and whether it must open on a picture. */
48
48
  export function freeOpeningOffer(site: FreeOpeningSite): FreeOpeningOffer {
49
- if (!site.home || promptLimitsOf(site.reading).includes(PromptLimit.NoPictures)) return { boxes: [], opensOnPicture: false };
49
+ const refused = picturesRefusedOf(site.reading);
50
+ if (!site.home || refused === PicturesRefused.All) return { boxes: [], opensOnPicture: false };
50
51
  if (site.ownPhotos > 0) return { boxes: [], opensOnPicture: true };
51
- return site.stockAllowed && !refusesStock(site.reading) ? { boxes: [...FREE_OPENING_BOXES], opensOnPicture: true } : { boxes: [], opensOnPicture: false };
52
+ return site.stockAllowed && refused !== PicturesRefused.Stock ? { boxes: [...FREE_OPENING_BOXES], opensOnPicture: true } : { boxes: [], opensOnPicture: false };
53
+ }
54
+
55
+ /** What the owner ruled out of pictures: every picture, or stock only (their own photos may still stand). */
56
+ export enum PicturesRefused { All = 'all', Stock = 'stock' }
57
+
58
+ /** What the owner refused of pictures, read ONCE (the free offer and the build's opening ask the same): `all` — "no
59
+ * pictures" (`PromptLimit.NoPictures`); `stock` — "no stock photos" (only their own may stand); else null. Pure. */
60
+ export function picturesRefusedOf(reading: PromptReading | null | undefined): PicturesRefused | null {
61
+ if (promptLimitsOf(reading).includes(PromptLimit.NoPictures)) return PicturesRefused.All;
62
+ return refusesStock(reading) ? PicturesRefused.Stock : null;
52
63
  }
53
64
 
54
65
  /** Is a material id a picture box (`box:<shape>`)? */