@vectoriox/iox-ui 5.165.0 → 5.166.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.
@@ -19,7 +19,7 @@ import { ConsentCategory } from '@vectoriox/iox-ui/consent-core';
19
19
  import { EntranceMark, EntrancePart, planEntrances } from './entrances';
20
20
  import { scrubEntranceStamps } from './text-scroll';
21
21
  import { filmOfPlan } from './film';
22
- import { checkFooter, FooterArrange, footerMixOfPlan, footerPattern } from './footer-mix';
22
+ import { checkFooter, FooterArrange, footerMixOfPlan, FooterNever, footerPattern, FooterRole, stampFooterMix } from './footer-mix';
23
23
  import {
24
24
  countryLegalFacts, FOOTER_LEGAL_ROLE, FORM_LEGAL_ROLE, formAsksPersonalData, formLegalFacts, LEGAL_PAGE_SETTING, LegalContext, LegalFact, LegalFacts,
25
25
  legalFormLine, LegalKind, legalKindsFor, legalLabel, legalRoute, legalTitle,
@@ -164,6 +164,11 @@ export interface ComposeContext {
164
164
  * body never wears a torn or dripping edge (`checkBody` mends it to a wave, said). The business type is the
165
165
  * generation's (the reading), never the plan's — the caller knows it. Absent = not calm. */
166
166
  calm?: boolean;
167
+ /** AW12: the kind of business (the reading's, as `calm`) — it chooses the footer's call word (`footerCallWord`). */
168
+ businessType?: string;
169
+ /** AW12-D10: what that kind of business's footer never wears (harness-core `BusinessType.footer`) — `checkFooter`
170
+ * mends it, said. Absent = nothing refused. */
171
+ footerNever?: FooterNever;
167
172
  /** AW1: what the studio holds that decides its legal pages and banner (country, trackers, its own legal pages, its
168
173
  * routes, a banner it keeps). Absent = only what the plan and the composed pages say (no tracker, no country). */
169
174
  legal?: LegalContext;
@@ -829,8 +834,12 @@ function composeChildren(pn: PatternNode, id: string, repeater: RepeaterScope |
829
834
  return;
830
835
  }
831
836
  if (child.each !== PatternDirective.NavPages) throw new ComposeError(`${childId}: "each" stamps "${PatternDirective.NavPages}" only`);
832
- for (const page of ctx.plan.pages.filter(p => p.inNav)) {
833
- const node = composeNode(child, `${childId}-${page.key}`, repeater, { ...ctx, navPage: page });
837
+ // AW12: `skip` / `limit` choose a run of the navigation pages (name-and-action's two, list-big's large five);
838
+ // they belong to the stamping, not to the stamped Link.
839
+ const { skip, limit, ...each } = child;
840
+ const navPages = ctx.plan.pages.filter(p => p.inNav).slice(skip ?? 0, limit === undefined ? undefined : (skip ?? 0) + limit);
841
+ for (const page of navPages) {
842
+ const node = composeNode(each, `${childId}-${page.key}`, repeater, { ...ctx, navPage: page });
834
843
  if (node) out.push(node);
835
844
  }
836
845
  });
@@ -1895,14 +1904,20 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
1895
1904
 
1896
1905
  // LI5: the footer is the plan's footer MIX (a stored pattern id is read as one), checked and arranged from the
1897
1906
  // contract's footer parts; each mend is said.
1898
- const footer = checkFooter(footerMixOfPlan(plan), { name: plan.business.name, design });
1907
+ // AW12: the footer judges what it holds against the site — the tagline (a statement), the navigation's length (list-big).
1908
+ // AW12-D10/D15: the kind of business (the caller's reading) chooses the call word and what the footer never wears.
1909
+ const footerContext = {
1910
+ name: plan.business.name, design, tagline: plan.business.tagline, locale: plan.locale, pages: plan.pages.filter(p => p.inNav).length,
1911
+ ...(context?.businessType ? { type: context.businessType } : {}), ...(context?.footerNever ? { never: context.footerNever } : {}),
1912
+ };
1913
+ const footer = checkFooter(footerMixOfPlan(plan), footerContext);
1899
1914
  for (const r of footer.repairs) issues.push({ code: ComposeIssueCode.FooterMended, nodeId: GlobalSlot.Footer, owner: GlobalSlot.Footer, detail: r.said });
1900
1915
  // HI1: the header is the plan's header MIX (a stored pattern id is read as one), drawn as the product draws it, checked
1901
1916
  // against the site and arranged from the contract's header parts; each mend is said.
1902
1917
  const header = planHeader(plan);
1903
1918
  for (const said of header.said) issues.push({ code: ComposeIssueCode.HeaderMended, nodeId: GlobalSlot.Header, owner: GlobalSlot.Header, detail: said });
1904
1919
  const patternOf = (slot: GlobalSlot): SitePattern => slot === GlobalSlot.Footer
1905
- ? footerPattern(footer.mix, { name: plan.business.name, design, tagline: plan.business.tagline })
1920
+ ? footerPattern(footer.mix, footerContext)
1906
1921
  : header.recipe.pattern;
1907
1922
  const slotPatterns = Object.values(GlobalSlot).map(slot => [slot, patternOf(slot)] as const);
1908
1923
  let globals = slotPatterns.map(([slot, pattern]) => {
@@ -1928,6 +1943,9 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
1928
1943
  if (headerRoot) stampHeaderMix(headerRoot, header.recipe.mix);
1929
1944
  // AW6 (AW6-D10): a header whose ink follows the sections says so (the renderers' header ink runtime reads it).
1930
1945
  if (headerRoot) setHeaderInk(headerRoot as unknown as CompositeNode, headerInkOf(header.recipe.mix[HeaderIngredient.Ink]));
1946
+ // AW12: the footer root says the mix it was composed as (the classes iox-design.css draws from); an inset one is a card.
1947
+ const footerRoot = globals.find(g => g.id === GlobalSlot.Footer);
1948
+ if (footerRoot) stampFooterMix(footerRoot as unknown as { props: Record<string, unknown>; styleProps?: Record<string, unknown> }, footer.mix);
1931
1949
  if (planSells(plan)) globals = withStore(globals, plan.locale ?? DEFAULT_SITE_LOCALE);
1932
1950
  // AW1: the law, derived from facts and never asked — the legal pages, the banner when a tracker is connected, the
1933
1951
  // footer's legal row and the line beside every form that asks for personal details.
@@ -2107,7 +2125,17 @@ function composeLegal(plan: SitePlan, context: LegalContext, pages: ReadonlyArra
2107
2125
  }
2108
2126
  const footer = out.find(g => g.id === GlobalSlot.Footer);
2109
2127
  const row = footer ? legalRow(routes, settings, footerArrange, locale) : null;
2110
- if (footer && row) (footer.children ?? (footer.children = [])).push(row);
2128
+ // AW12-D3: a name-and-action footer keeps its legal row in its end block, above the thank-you line — the name stays last,
2129
+ // standing on the window's bottom.
2130
+ let endBlock: SerializedNode | null = null;
2131
+ if (footer) walkSerialized([footer], n => { if (!endBlock && n.role === FooterRole.EndBlock) endBlock = n; });
2132
+ if (footer && row) {
2133
+ if (endBlock) {
2134
+ row.styleProps['justifyContent'] = 'flex-end';
2135
+ ((endBlock as SerializedNode).children ?? ((endBlock as SerializedNode).children = [])).unshift(row);
2136
+ }
2137
+ else (footer.children ?? (footer.children = [])).push(row);
2138
+ }
2111
2139
 
2112
2140
  walkSerialized([...pages.flatMap(p => p.layout), ...out, ...stamped.flatMap(p => p.layout)], n => {
2113
2141
  if (n.type !== FORM || !formAsksPersonalData(n)) return;
@@ -1,7 +1,7 @@
1
- import { DesignChoices, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
1
+ import { DesignChoices, designTokenRows, elementStyleFace, FOOTER_MIX_PROP, resolveDesignChoices, SECTION_SHAPE_TRAIT, SectionShape, textWidthEm } from '@vectoriox/iox-ui/design-core';
2
2
 
3
3
  import { layoutColumnPx, layoutGutterPx } from './layout-column';
4
- import { screenFontSize, screenWordOverflowPx } from './layout-language';
4
+ import { layoutRoomPx, screenFontSize, screenWordOverflowPx } from './layout-language';
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
 
@@ -23,6 +23,8 @@ export enum FooterIngredient {
23
23
  Holds = 'holds',
24
24
  Closing = 'closing',
25
25
  Ground = 'ground',
26
+ /** AW12 (AW12-D12): how the closing name is worn. Not in the fingerprint (AW12-D14). */
27
+ NameStyle = 'nameStyle',
26
28
  }
27
29
 
28
30
  /** The words, by the table (a word that waits for its phase too — `footerWords` offers only the drawn ones). */
@@ -69,20 +71,45 @@ export enum FooterGround {
69
71
  Inset = 'inset',
70
72
  }
71
73
 
74
+ export enum FooterNameStyle {
75
+ Plain = 'plain',
76
+ Gradient = 'gradient',
77
+ Emboss = 'emboss',
78
+ Offset = 'offset',
79
+ }
80
+
72
81
  /** The roles a footer's parts carry — the contract's (`site.footerParts` and the stored footers), written to the node's
73
82
  * `role`, a class `iox-role-<role>` both renderers emit. */
74
83
  export enum FooterRole {
75
84
  /** The footer's page list (the Pages block, or the page row of a line or centred footer): a navigation list — its
76
85
  * links rest with no line (vectoriox/iox-ui#87/#97, iox-design.css), as a header's do. */
77
86
  Links = 'footer.links',
87
+ /** The closing name (`closing.name`, `closing.name-and-action`): iox-design.css fits, cuts and wears it. */
88
+ Name = 'footer.name',
89
+ /** AW12-D12: a gradient or embossed closing name is a decorative COPY of the name the brand block already says — hidden
90
+ * from assistive technology (`nodeA11yAttributes`). */
91
+ NameCopy = 'footer.name-copy',
92
+ /** AW12 `closing.word`: the call word that is the contact link. */
93
+ Word = 'footer.word',
94
+ /** AW12 name-and-action: the row above the name, and its end block (the thank-you line, the action, the legal row). */
95
+ End = 'footer.end',
96
+ EndBlock = 'footer.endblock',
97
+ /** AW12 `arrange.ruled`: the grid whose cells are divided by hairlines. */
98
+ Ruled = 'footer.ruled',
99
+ /** AW12 `arrange.list-big`: the pages stacked large. */
100
+ ListBig = 'footer.list-big',
78
101
  }
79
102
 
103
+
104
+
80
105
  /** One word per ingredient; `holds` several, in the table's order. */
81
106
  export interface FooterMix {
82
107
  readonly arrange: string;
83
108
  readonly holds: ReadonlyArray<string>;
84
109
  readonly closing: string;
85
110
  readonly ground: string;
111
+ /** AW12: absent = plain (a stored or hand-made mix written before the name had a style). */
112
+ readonly nameStyle?: string;
86
113
  }
87
114
 
88
115
  export class FooterMixError extends Error {}
@@ -144,16 +171,23 @@ export function namedFooterMix(patternId: string): FooterMix | null {
144
171
 
145
172
  /** The stored footer pattern a mix is exactly, else null. */
146
173
  export function footerPatternIdOf(mix: FooterMix): string | null {
147
- const key = footerTokenOf(mix) + JSON.stringify(mix.holds);
174
+ const key = footerTokenOf(mix) + JSON.stringify(mix.holds) + nameStyleOf(mix);
148
175
  return Object.keys(F.named).find(id => {
149
176
  const m = namedFooterMix(id)!;
150
- return footerTokenOf(m) + JSON.stringify(m.holds) === key;
177
+ return footerTokenOf(m) + JSON.stringify(m.holds) + nameStyleOf(m) === key;
151
178
  }) ?? null;
152
179
  }
153
180
 
154
- /** A mix on the wire: ONE list of `<ingredient>:<word>` words (the list wire's encoding), `holds` once per block. */
181
+ /** The name's style of a mix (absent = plain). */
182
+ export const nameStyleOf = (mix: Pick<FooterMix, 'nameStyle'>): string => mix.nameStyle ?? FooterNameStyle.Plain;
183
+
184
+ /** A mix on the wire: ONE list of `<ingredient>:<word>` words (the list wire's encoding), `holds` once per block. A plain
185
+ * name says nothing (`nameStyle:plain` is every mix's), so a mix stored before AW12 reads and writes the same words. */
155
186
  export function footerMixWords(mix: FooterMix): string[] {
156
- return Object.values(FooterIngredient).flatMap(k => (MANY.includes(k) ? mix[k] as ReadonlyArray<string> : [mix[k] as string]).map(w => `${k}:${w}`));
187
+ return Object.values(FooterIngredient).flatMap(k => {
188
+ if (k === FooterIngredient.NameStyle) return nameStyleOf(mix) === FooterNameStyle.Plain ? [] : [`${k}:${nameStyleOf(mix)}`];
189
+ return (MANY.includes(k) ? mix[k] as ReadonlyArray<string> : [mix[k] as string]).map(w => `${k}:${w}`);
190
+ });
157
191
  }
158
192
 
159
193
  /** Every `<ingredient>:<word>` the wire may carry: the drawn words only. */
@@ -171,11 +205,12 @@ export function drawnFooterMix(mix: FooterMix): { mix: FooterMix; waited: Array<
171
205
  waited.push({ ingredient: k, word: w, ...wait });
172
206
  return wait.drawnAs;
173
207
  };
174
- const one = (k: FooterIngredient): string => drawn(k, mix[k] as string) ?? (F.defaults as unknown as FooterMix)[k] as string;
208
+ const one = (k: FooterIngredient): string => drawn(k, (mix[k as keyof FooterMix] ?? (F.defaults as unknown as FooterMix)[k as keyof FooterMix]) as string)
209
+ ?? (F.defaults as unknown as FooterMix)[k as keyof FooterMix] as string;
175
210
  // In the table's order, so the words that waited are said as the table reads.
176
211
  const arrange = one(FooterIngredient.Arrange);
177
212
  const holds = inOrder(FooterIngredient.Holds, mix.holds.map(h => drawn(FooterIngredient.Holds, h)).filter((h): h is string => !!h));
178
- const out = { arrange, holds, closing: one(FooterIngredient.Closing), ground: one(FooterIngredient.Ground) };
213
+ const out = { arrange, holds, closing: one(FooterIngredient.Closing), ground: one(FooterIngredient.Ground), nameStyle: one(FooterIngredient.NameStyle) };
179
214
  return { mix: waited.length ? out : mix, waited };
180
215
  }
181
216
 
@@ -225,12 +260,32 @@ export enum FooterRepairCode {
225
260
  LineHolds = 'line-holds',
226
261
  /** A footer that holds nothing and closes with nothing: it holds the pages. */
227
262
  Empty = 'empty',
228
- /** The name is too long to stand across a phone's width at the smallest size: no closing name. */
263
+ /** The name is too long to stand across a phone's width at the smallest size: no closing name (name-and-action keeps
264
+ * its action and leaves the name out — AW12-D4). */
229
265
  NameTooLong = 'name-too-long',
230
266
  /** Another site already wears this footer: the nearest free one (`distinctFooter`). */
231
267
  Worn = 'worn',
232
268
  /** A word the product draws in a later phase: drawn as its stand-in meanwhile (the table's `waits`). */
233
269
  Waits = 'waits',
270
+ /** AW12: a statement is the owner's tagline — none given, the footer closes with the call. */
271
+ StatementWithoutWords = 'statement-without-words',
272
+ /** AW12: the tagline stands more lines on a phone than a statement may: the call. */
273
+ StatementTooLong = 'statement-too-long',
274
+ /** AW12: the call word is too wide for a phone even on two lines: the call. */
275
+ WordTooLong = 'word-too-long',
276
+ /** AW12: a block name-and-action has no place for is left out (it keeps the pages and the legal row). */
277
+ LeftOut = 'left-out',
278
+ /** AW12: ruled cells need company — fewer blocks are drawn as columns. */
279
+ RuledFewBlocks = 'ruled-few-blocks',
280
+ /** AW12: more pages than a large list holds — the first ones large, the rest small. */
281
+ ListBigLong = 'list-big-long',
282
+ /** AW12: a name style with no closing name to wear it: plain. */
283
+ NameStyleWithoutName = 'name-style-without-name',
284
+ /** AW12-D12: an embossed or gradient name is a decorative copy — only beside the brand block that says the name. */
285
+ EmbossNeedsBrand = 'emboss-needs-brand',
286
+ /** AW12-D10 (H1): a word the kind of business never closes with or stands on (harness FOOTER_NEVER): the call · the
287
+ * dark band. */
288
+ TypeNever = 'type-never',
234
289
  }
235
290
 
236
291
  export interface FooterRepair {
@@ -239,6 +294,17 @@ export interface FooterRepair {
239
294
  said: string;
240
295
  }
241
296
 
297
+ /** AW12-D10: what a kind of business's footer never closes with or stands on (contract harness
298
+ * `businessTypes[].footer`, from harness.mjs FOOTER_NEVER; harness-core `BusinessType.footer`). */
299
+ export interface FooterNever {
300
+ readonly closings: ReadonlyArray<string>;
301
+ readonly grounds: ReadonlyArray<string>;
302
+ /** Why, in the owner's words — said with the mend. */
303
+ readonly say: ReadonlyArray<string>;
304
+ /** One Hebrew sentence for each English one. */
305
+ readonly sayHe?: ReadonlyArray<string>;
306
+ }
307
+
242
308
  /** What the check needs of the site: the business name and the look it wears. */
243
309
  export interface FooterContext {
244
310
  name: string;
@@ -246,13 +312,67 @@ export interface FooterContext {
246
312
  /** The business's tagline: absent or blank, the brand block holds the name alone — never the Text's default words
247
313
  * (a copy placeholder never blocks publishing, so an empty one would go live as "Enter text here"). */
248
314
  tagline?: string;
315
+ /** AW12: the kind of business (harness), which chooses the call word (`footerCallWord`); absent = everyone's word. */
316
+ type?: string;
317
+ /** AW12: how many pages the site's navigation lists (list-big holds a few large); absent = not judged. */
318
+ pages?: number;
319
+ /** AW12: the site's language — the call word's and the closed copy's. */
320
+ locale?: string;
321
+ /** AW12-D10: what this kind of business's footer never wears (absent = nothing refused). */
322
+ never?: FooterNever | null;
249
323
  }
250
324
 
251
325
  /** The phone the closing name must fit (the render check's). */
252
326
  const PHONE_WIDTH = 390;
327
+ const RULES = F.rules as unknown as Readonly<Record<string, number | ReadonlyArray<string>>>;
328
+ const rule = (k: string): number => Number(RULES[k]);
253
329
 
330
+ /** How wide `text` stands at 1em in an element style's face. */
331
+ const widthEm = (text: string, ctx: FooterContext, style = 'display'): number => textWidthEm(text, elementStyleFace(ctx.design, style));
254
332
  /** How wide the name stands at 1em in the look's display face. */
255
- const nameWidthEm = (ctx: FooterContext): number => textWidthEm(ctx.name, elementStyleFace(ctx.design, 'display'));
333
+ const nameWidthEm = (ctx: FooterContext): number => widthEm(ctx.name, ctx);
334
+ /** True when a word `em` wide runs past a phone's room at the smallest screen size. */
335
+ const overflowsPhone = (em: number, ctx: FooterContext): boolean =>
336
+ screenWordOverflowPx(em, 12, PHONE_WIDTH, true, { gutter: layoutGutterPx(ctx.design.density) }) > 0;
337
+ /** The closings that set the name large. */
338
+ const NAME_CLOSINGS: ReadonlyArray<string> = [FooterClosing.Name, FooterClosing.NameAndAction];
339
+ /** What name-and-action holds (the rest has no place — AW12-D3). */
340
+ const END_HOLDS: ReadonlyArray<string> = [FooterHold.Pages, FooterHold.Legal];
341
+ /** True when the footer's body says the business name in its brand block. */
342
+ const holdsBrand = (mix: FooterMix): boolean => mix.arrange !== FooterArrange.Line && mix.closing !== FooterClosing.NameAndAction;
343
+
344
+ /** AW12-D15: the call word for a kind of business — closed copy (the contract's `FOOTER.callWords`), in the site's
345
+ * language. */
346
+ export function footerCallWord(type?: string, locale?: string): string {
347
+ const rows = F.callWords as unknown as ReadonlyArray<{ text: string; he: string; types: ReadonlyArray<string> }>;
348
+ const row = rows.find(r => type && r.types.includes(type)) ?? rows[rows.length - 1];
349
+ return locale === 'he' ? row.he : row.text;
350
+ }
351
+
352
+ /** The smallest px a token's size reaches (`clamp(28px, …)` → 28, `40px` → 40), or null. */
353
+ function smallestPx(value: string | undefined): number | null {
354
+ const m = /^\s*(?:clamp\(\s*)?([\d.]+)px/.exec(value ?? '');
355
+ return m ? Number(m[1]) : null;
356
+ }
357
+
358
+ /** How many lines the tagline stands on a phone at the statement's size (the display size at its smallest). */
359
+ function statementPhoneLines(tagline: string, ctx: FooterContext): number {
360
+ const rows = new Map(designTokenRows(ctx.design).map(r => [r.name, r.value]));
361
+ const size = smallestPx(rows.get('size-display')) ?? 36;
362
+ const room = layoutRoomPx(12, PHONE_WIDTH, true, { gutter: layoutGutterPx(ctx.design.density) });
363
+ return Math.ceil((widthEm(tagline, ctx) * size) / room);
364
+ }
365
+
366
+ /** True when the call word cannot stand on a phone even split over two balanced lines. */
367
+ function wordTooWide(word: string, ctx: FooterContext): boolean {
368
+ const halves = word.split(/\s+/);
369
+ const longest = Math.max(widthEm(halves.slice(0, Math.ceil(halves.length / 2)).join(' '), ctx, 'link-display'),
370
+ widthEm(halves.slice(Math.ceil(halves.length / 2)).join(' '), ctx, 'link-display'));
371
+ return overflowsPhone(widthEm(word, ctx, 'link-display'), ctx) && overflowsPhone(longest, ctx);
372
+ }
373
+
374
+ /** True when the business name stands across a phone at the smallest screen size. */
375
+ export const footerNameFits = (ctx: FooterContext): boolean => !overflowsPhone(nameWidthEm(ctx), ctx);
256
376
 
257
377
  /**
258
378
  * 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
@@ -260,27 +380,76 @@ const nameWidthEm = (ctx: FooterContext): number => textWidthEm(ctx.name, elemen
260
380
  */
261
381
  export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: FooterMix; repairs: FooterRepair[] } {
262
382
  const repairs: FooterRepair[] = [];
383
+ const say = (code: FooterRepairCode, said: string) => repairs.push({ code, said });
263
384
  const { mix, waited } = drawnFooterMix(given);
264
385
  if (waited.length) {
265
- repairs.push({ code: FooterRepairCode.Waits, said: waited.map(w => `the footer's ${w.ingredient} "${w.word}" is drawn in ${w.phase}: ${w.drawnAs ? `"${w.drawnAs}" meanwhile` : 'left out meanwhile'}`).join('; ') });
386
+ say(FooterRepairCode.Waits, waited.map(w => `the footer's ${w.ingredient} "${w.word}" is drawn in ${w.phase}: ${w.drawnAs ? `"${w.drawnAs}" meanwhile` : 'left out meanwhile'}`).join('; '));
266
387
  }
267
388
  let holds = inOrder(FooterIngredient.Holds, mix.holds);
268
389
  let closing = mix.closing;
269
- if (mix.arrange === FooterArrange.Line) {
390
+ let arrange = mix.arrange;
391
+ let nameStyle = nameStyleOf(mix);
392
+ let ground = mix.ground;
393
+ const why = ctx.never?.say?.length ? ` — ${(ctx.locale === 'he' && ctx.never.sayHe?.length ? ctx.never.sayHe : ctx.never.say).join(' ')}` : '';
394
+ if (ctx.never?.closings.includes(closing)) {
395
+ say(FooterRepairCode.TypeNever, `this kind of business never closes its footer with a ${closing}: the call${why}`);
396
+ closing = FooterClosing.Call;
397
+ }
398
+ if (ctx.never?.grounds.includes(ground)) {
399
+ say(FooterRepairCode.TypeNever, `this kind of business never stands its footer on a ${ground}: the dark band${why}`);
400
+ ground = FooterGround.Inverse;
401
+ }
402
+ if (arrange === FooterArrange.Line) {
270
403
  const kept = holds.filter(h => (F.rules.lineHolds as ReadonlyArray<string>).includes(h));
271
404
  const left = holds.filter(h => !kept.includes(h));
272
- if (left.length) repairs.push({ code: FooterRepairCode.LineHolds, said: `a one-line footer holds only ${F.rules.lineHolds.join(' and ')}: ${left.join(' and ')} left out` });
405
+ if (left.length) say(FooterRepairCode.LineHolds, `a one-line footer holds only ${F.rules.lineHolds.join(' and ')}: ${left.join(' and ')} left out`);
273
406
  holds = kept;
274
407
  }
275
- if (closing === FooterClosing.Name && screenWordOverflowPx(nameWidthEm(ctx), 12, PHONE_WIDTH, true, { gutter: layoutGutterPx(ctx.design.density) }) > 0) {
276
- repairs.push({ code: FooterRepairCode.NameTooLong, said: `"${ctx.name}" is too long to stand across a phone: the footer closes with nothing` });
408
+ if (closing === FooterClosing.Statement) {
409
+ const tagline = ctx.tagline?.trim();
410
+ if (!tagline) {
411
+ say(FooterRepairCode.StatementWithoutWords, 'a statement is the business\'s own line and it has none yet: the footer closes with a call');
412
+ closing = FooterClosing.Call;
413
+ } else if (statementPhoneLines(tagline, ctx) > rule('statementPhoneLines')) {
414
+ say(FooterRepairCode.StatementTooLong, `"${tagline}" stands more than ${rule('statementPhoneLines')} lines on a phone: the footer closes with a call`);
415
+ closing = FooterClosing.Call;
416
+ }
417
+ }
418
+ if (closing === FooterClosing.Word && wordTooWide(footerCallWord(ctx.type, ctx.locale), ctx)) {
419
+ say(FooterRepairCode.WordTooLong, `"${footerCallWord(ctx.type, ctx.locale)}" is too wide for a phone even on two lines: the footer closes with a call`);
420
+ closing = FooterClosing.Call;
421
+ }
422
+ if (closing === FooterClosing.Name && !footerNameFits(ctx)) {
423
+ say(FooterRepairCode.NameTooLong, `"${ctx.name}" is too long to stand across a phone: the footer closes with nothing`);
277
424
  closing = FooterClosing.None;
278
425
  }
426
+ if (closing === FooterClosing.NameAndAction) {
427
+ const left = holds.filter(h => !END_HOLDS.includes(h));
428
+ if (left.length) say(FooterRepairCode.LeftOut, `a name-and-action footer holds the pages and the legal row: ${left.join(' and ')} left out`);
429
+ holds = holds.filter(h => END_HOLDS.includes(h));
430
+ if (!footerNameFits(ctx)) say(FooterRepairCode.NameTooLong, `"${ctx.name}" is too long to stand across a phone: the action stays, the name is left out`);
431
+ }
432
+ if (arrange === FooterArrange.Ruled && holds.length + 1 < rule('ruledMinBlocks')) {
433
+ say(FooterRepairCode.RuledFewBlocks, `ruled cells need company and the footer holds ${holds.length + 1} block${holds.length ? 's' : ''}: drawn as columns`);
434
+ arrange = FooterArrange.Columns;
435
+ }
436
+ if (arrange === FooterArrange.ListBig && ctx.pages !== undefined && ctx.pages > rule('listBigPages')) {
437
+ say(FooterRepairCode.ListBigLong, `${ctx.pages} pages are more than a large list holds: the first ${rule('listBigLarge')} large, the rest small`);
438
+ }
439
+ if (nameStyle !== FooterNameStyle.Plain && !NAME_CLOSINGS.includes(closing)) {
440
+ say(FooterRepairCode.NameStyleWithoutName, `the footer sets no name large, so it wears no "${nameStyle}" name`);
441
+ nameStyle = FooterNameStyle.Plain;
442
+ }
443
+ const kept = { ...mix, holds, closing, arrange, nameStyle, ground };
444
+ if ((nameStyle === FooterNameStyle.Gradient || nameStyle === FooterNameStyle.Emboss) && !holdsBrand(kept)) {
445
+ say(FooterRepairCode.EmbossNeedsBrand, `a ${nameStyle} name is a copy of the name the brand block says, and this footer has none: plain`);
446
+ nameStyle = FooterNameStyle.Plain;
447
+ }
279
448
  if (holds.length < F.rules.minHolds && closing === FooterClosing.None) {
280
- repairs.push({ code: FooterRepairCode.Empty, said: 'a footer that holds nothing holds the pages' });
449
+ say(FooterRepairCode.Empty, 'a footer that holds nothing holds the pages');
281
450
  holds = [FooterHold.Pages];
282
451
  }
283
- return { mix: { ...mix, holds, closing }, repairs };
452
+ return { mix: { ...mix, holds, closing, arrange, nameStyle, ground }, repairs };
284
453
  }
285
454
 
286
455
  // ── The recipe: the mix arranged from the contract's parts ─────────────────────────────────────────────────────────
@@ -298,10 +467,11 @@ const centred = (node: PatternNode): PatternNode => ({
298
467
  ...laid(node, WORDS.has(node.t) ? { textAlign: 'center' } : CENTRED),
299
468
  ...(node.c ? { c: node.c.map(centred) } : {}),
300
469
  });
301
- /** The brand block: the name, and the tagline only when the business has one. */
302
- const brandPart = (ctx: FooterContext): PatternNode => {
470
+ /** The brand block: the name, and the tagline only when the business has one and no statement says it already. */
471
+ const brandPart = (ctx: FooterContext, mix?: FooterMix): PatternNode => {
303
472
  const node = part('brand');
304
- return ctx.tagline?.trim() ? node : { ...node, c: (node.c ?? []).filter(n => n.fromBusiness !== 'tagline') };
473
+ const tagline = ctx.tagline?.trim() && mix?.closing !== FooterClosing.Statement;
474
+ return tagline ? node : { ...node, c: (node.c ?? []).filter(n => n.fromBusiness !== 'tagline') };
305
475
  };
306
476
 
307
477
  /** The columns of a footer's grid: the name's block wider, one column per block it holds. */
@@ -313,14 +483,27 @@ function columnsOf(count: number): Pick<PatternNode, 'lay' | 'resp'> {
313
483
  return { lay, resp };
314
484
  }
315
485
 
316
- /** The closing name: the business name across the width — fitted to the name in the look's display face as a layout's
317
- * screen word is (`screenFontSize`, the 12-column room), never under the smallest or over the largest screen word. */
318
- function closingName(ctx: FooterContext): PatternNode {
319
- // Award §0c CW2: in a column the name never runs past it — the site's word stamped as px (a `%` in font-size is the
320
- // parent's size). A page that wears a narrower word of its own is not known here (the footer is the site's).
321
- // iox-ui#117: the name reads the column of the PAGE it is on (`content-cap`, re-declared by a page's word), the site's
322
- // word only its fallback — a global footer fits a narrow page of a contained site.
323
- return laid(part('name'), { fontSize: screenFontSize(nameWidthEm(ctx), 12, 0, 0, 0, layoutColumnPx(ctx.design.column, ctx.design.density), true) });
486
+ /** A word fitted to the column as a layout's screen word is (`screenFontSize`, the 12-column room), never under the
487
+ * smallest or over the largest screen word. Award §0c CW2 / iox-ui#117: the column of the PAGE it is on (`content-cap`),
488
+ * the site's word only its fallback — a global footer fits a narrow page of a contained site. */
489
+ const columnSize = (em: number, ctx: FooterContext, cols = 12): string =>
490
+ screenFontSize(em, cols, 0, 0, 0, layoutColumnPx(ctx.design.column, ctx.design.density), true);
491
+
492
+ /** The closing name: the business name across the width, fitted to the name in the look's display face. A gradient or an
493
+ * embossed name is the decorative copy (AW12-D12). */
494
+ function closingName(ctx: FooterContext, mix: FooterMix): PatternNode {
495
+ const style = nameStyleOf(mix);
496
+ const copy = style === FooterNameStyle.Gradient || style === FooterNameStyle.Emboss;
497
+ // An offset name starts at the second of twelve columns (iox-design.css), so it is fitted to eleven.
498
+ const cols = style === FooterNameStyle.Offset ? 11 : 12;
499
+ return { ...laid(part('name'), { fontSize: columnSize(nameWidthEm(ctx), ctx, cols) }), ...(copy ? { role: FooterRole.NameCopy } : {}) };
500
+ }
501
+
502
+ /** The call word (AW12 `closing.word`): closed copy for the business, fitted to the column. */
503
+ function callWord(ctx: FooterContext): PatternNode {
504
+ const text = footerCallWord(ctx.type);
505
+ const node = part('word');
506
+ return { ...laid(node, { fontSize: columnSize(widthEm(text, ctx, 'link-display'), ctx) }), text, textHe: footerCallWord(ctx.type, 'he') };
324
507
  }
325
508
 
326
509
  /** A block it holds: how to reach the business leaves its city to the visit block when the footer holds both. */
@@ -330,6 +513,19 @@ function holdPart(hold: string, mix: FooterMix): PatternNode {
330
513
  return { ...node, c: (node.c ?? []).filter(n => n.ph !== 'city') };
331
514
  }
332
515
 
516
+ /** list-big's pages (AW12): stacked large in the display face; past `listBigPages` the first `listBigLarge` large and the
517
+ * rest in a small row. */
518
+ function bigPages(ctx: FooterContext): PatternNode[] {
519
+ const many = ctx.pages !== undefined && ctx.pages > rule('listBigPages');
520
+ const link = (part('pages').c ?? []).find(n => n.each)!;
521
+ const big: PatternNode = { t: 'Container', es: 'box', role: FooterRole.ListBig, lay: { display: 'flex', flexDirection: 'column', gap: '4px' }, c: [
522
+ { ...link, es: 'link-display', lay: { fontSize: 'var(--iox-size-h1)', lineHeight: '1.1', width: 'auto' }, ...(many ? { limit: rule('listBigLarge') } : {}) },
523
+ ] };
524
+ if (!many) return [big];
525
+ const rest = part('pageRow');
526
+ return [big, { ...rest, c: (rest.c ?? []).map(n => (n.each ? { ...n, skip: rule('listBigLarge') } : n)) }];
527
+ }
528
+
333
529
  /** The body: the blocks it holds, arranged. */
334
530
  function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
335
531
  const holds = mix.holds.map(h => holdPart(h, mix));
@@ -344,26 +540,68 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
344
540
  case FooterArrange.Centred: {
345
541
  const blocks = mix.holds.map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : centred(holdPart(h, mix))));
346
542
  return [
347
- { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: '28px', ...CENTRED }, c: [centred(brandPart(ctx)), ...blocks] },
543
+ { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: '28px', ...CENTRED }, c: [centred(brandPart(ctx, mix)), ...blocks] },
348
544
  part('rule'),
349
545
  laid(part('copyright'), { textAlign: 'center' }),
350
546
  ];
351
547
  }
548
+ case FooterArrange.Ruled: {
549
+ // Cells divided by hairlines (iox-design.css, `border-inline-start` — RTL mirrors): up to `ruledCells` in a row,
550
+ // a block past them under the row.
551
+ const cells = [brandPart(ctx, mix), ...holds];
552
+ const n = Math.min(cells.length, rule('ruledCells'));
553
+ return [{ t: 'Container', es: 'box', role: FooterRole.Ruled, lay: { display: 'grid', gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))`, gap: `${GAP} 0px` },
554
+ resp: { tablet: { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' }, mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: cells }, part('rule'), part('copyright')];
555
+ }
556
+ case FooterArrange.ListBig: {
557
+ const others = mix.holds.filter(h => h !== FooterHold.Pages).map(h => holdPart(h, mix));
558
+ const pages = mix.holds.includes(FooterHold.Pages) ? bigPages(ctx) : [];
559
+ return [{ t: 'Container', es: 'box', lay: { display: 'grid', gridTemplateColumns: 'minmax(0, 3fr) minmax(0, 2fr)', gap: GAP, alignItems: 'end' },
560
+ resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: [
561
+ { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: GAP }, c: pages },
562
+ { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: GAP }, c: [brandPart(ctx, mix), ...others] },
563
+ ] }, part('rule'), part('copyright')];
564
+ }
352
565
  default:
353
- return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [brandPart(ctx), ...holds] }, part('rule'), part('copyright')];
566
+ return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [brandPart(ctx, mix), ...holds] }, part('rule'), part('copyright')];
354
567
  }
355
568
  }
356
569
 
570
+ /** name-and-action (AW12-D3): the pages at the start and the end block (the copyright, the thank-you line, the action set
571
+ * large) above the name, which stands on the window's bottom; a name too long for a phone is left out (AW12-D4). */
572
+ function endOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
573
+ const end = part('name-and-action');
574
+ const kids = (end.c ?? []).map(n => {
575
+ if (n.role === FooterRole.Links) return mix.holds.includes(FooterHold.Pages) ? n : null;
576
+ if (n.role === FooterRole.EndBlock) return { ...n, c: [laid(part('copyright'), { textAlign: 'end' }), ...(n.c ?? [])] };
577
+ return n;
578
+ }).filter((n): n is PatternNode => !!n);
579
+ return [{ ...end, c: kids }, ...(footerNameFits(ctx) ? [closingName(ctx, mix)] : [])];
580
+ }
581
+
582
+ /** What a ground draws as the footer's scheme (an inset card is the inverse band, shaped — `stampFooterMix`). */
583
+ const GROUND_SCHEME: Readonly<Record<string, string | null>> = {
584
+ [FooterGround.Inverse]: 'inverse', [FooterGround.Subtle]: 'subtle', [FooterGround.Accent]: 'accent', [FooterGround.Plain]: null,
585
+ [FooterGround.Inset]: 'inverse',
586
+ };
587
+
357
588
  /** A footer mix as a pattern: what the composer stamps as the site's footer (global, after the page). Check it first. */
358
589
  export function footerPattern(given: FooterMix, ctx: FooterContext): SitePattern {
359
590
  const mix = drawnFooterMix(given).mix;
360
591
  const plain = mix.ground === FooterGround.Plain;
361
- const call = mix.closing === FooterClosing.Call ? [mix.arrange === FooterArrange.Columns ? part('call') : centred(part('call'))] : [];
362
- const name = mix.closing === FooterClosing.Name ? [closingName(ctx)] : [];
363
- const c = [...(plain ? [part('rule')] : []), ...call, ...bodyOf(mix, ctx), ...name];
592
+ const opens = {
593
+ [FooterClosing.Call]: () => [mix.arrange === FooterArrange.Columns ? part('call') : centred(part('call'))],
594
+ [FooterClosing.Statement]: () => [part('statement')],
595
+ [FooterClosing.Word]: () => [callWord(ctx)],
596
+ } as Readonly<Record<string, () => PatternNode[]>>;
597
+ const before = opens[mix.closing]?.() ?? [];
598
+ const body = mix.closing === FooterClosing.NameAndAction ? endOf(mix, ctx) : bodyOf(mix, ctx);
599
+ const name = mix.closing === FooterClosing.Name ? [closingName(ctx, mix)] : [];
600
+ const c = [...(plain ? [part('rule')] : []), ...before, ...body, ...name];
364
601
  // The contract's shell; a Section with one child does not stack it (the patterns' rule, build-spec "more than one child").
365
602
  const { lay, ...shell } = part('section');
366
- const node: PatternNode = { ...shell, ...(c.length > 1 && lay ? { lay } : {}), ...(plain ? {} : { scheme: mix.ground }), c };
603
+ const scheme = GROUND_SCHEME[mix.ground] ?? null;
604
+ const node: PatternNode = { ...shell, ...(c.length > 1 && lay ? { lay } : {}), ...(scheme ? { scheme } : {}), c };
367
605
  // A stored footer keeps its own name and intent (the composed root is labelled with it).
368
606
  const stored = SITE_PATTERNS[footerPatternIdOf(mix) ?? ''];
369
607
  return {
@@ -375,6 +613,26 @@ export function footerPattern(given: FooterMix, ctx: FooterContext): SitePattern
375
613
  };
376
614
  }
377
615
 
616
+ /** The margin an inset footer stands at (AW12-D11): a card's padding outside the column, never closer than half the gutter
617
+ * to the window; its words pad back onto the column (both resolve against the page). */
618
+ export const FOOTER_INSET_STYLES: Readonly<Record<string, string>> = {
619
+ margin: '0px max(calc(var(--iox-space-gutter) / 2), calc(var(--iox-space-inline) - var(--iox-card-pad))) var(--iox-space-gutter) max(calc(var(--iox-space-gutter) / 2), calc(var(--iox-space-inline) - var(--iox-card-pad)))',
620
+ paddingLeft: 'calc(var(--iox-space-inline) - max(calc(var(--iox-space-gutter) / 2), calc(var(--iox-space-inline) - var(--iox-card-pad))))',
621
+ paddingRight: 'calc(var(--iox-space-inline) - max(calc(var(--iox-space-gutter) / 2), calc(var(--iox-space-inline) - var(--iox-card-pad))))',
622
+ borderRadius: 'var(--iox-radius-xl)',
623
+ };
624
+
625
+ /**
626
+ * The composed footer's root says the mix it was composed as (`FOOTER_MIX_PROP` — the classes iox-design.css draws from),
627
+ * and an inset footer wears the card shape (AW6's trait) at the footer's own margin. Pure on the node it is given.
628
+ */
629
+ export function stampFooterMix(root: { props: Record<string, unknown>; styleProps?: Record<string, unknown> }, mix: FooterMix): void {
630
+ root.props = { ...root.props, [FOOTER_MIX_PROP]: footerMixWords({ ...mix, holds: [] }).filter(w => !w.startsWith(`${FooterIngredient.Holds}:`)).join(' ') };
631
+ if (mix.ground !== FooterGround.Inset) return;
632
+ root.props = { ...root.props, [SECTION_SHAPE_TRAIT]: SectionShape.Card };
633
+ root.styleProps = { ...(root.styleProps ?? {}), ...FOOTER_INSET_STYLES };
634
+ }
635
+
378
636
  // ── No sameness: another site's footer is never worn again ─────────────────────────────────────────────────────────
379
637
 
380
638
  /** The ingredients `distinctFooter` may change, in the order it tries them: how it closes and what it stands on before the
@@ -1891,6 +1891,7 @@ export const NODE_BASELINES: Readonly<Record<string, NodeBaseline>> = {
1891
1891
  "traits": [
1892
1892
  "colorScheme",
1893
1893
  "openingMix",
1894
+ "footerMix",
1894
1895
  "seam",
1895
1896
  "sectionShape"
1896
1897
  ],
@@ -4967,7 +4968,19 @@ export const NODE_BASELINES: Readonly<Record<string, NodeBaseline>> = {
4967
4968
  "menuForm",
4968
4969
  "menuReveal",
4969
4970
  "menuHover",
4970
- "menuPhone"
4971
+ "menuPhone",
4972
+ "popupKind",
4973
+ "popupForm",
4974
+ "popupArrive",
4975
+ "popupScreens",
4976
+ "popupPageShare",
4977
+ "popupSeconds",
4978
+ "popupAgain",
4979
+ "popupDays",
4980
+ "popupFrom",
4981
+ "popupUntil",
4982
+ "popupVersion",
4983
+ "modal"
4971
4984
  ],
4972
4985
  "styleTraits": [
4973
4986
  "position",
@@ -101,8 +101,11 @@ export interface PatternNode {
101
101
  readonly phoneTracks?: ReadonlyArray<PatternTrack>;
102
102
  /** SC6b: the Video a film pattern plays the owner's film in (its `frames`). */
103
103
  readonly film?: boolean;
104
- /** Commerce G1: a Repeater shows at most this many rows of its source (`commerce.featured`: the newest one). */
104
+ /** Commerce G1: a Repeater shows at most this many rows of its source (`commerce.featured`: the newest one). AW12: on an
105
+ * `each: $navPages` node, at most this many navigation pages are stamped. */
105
106
  readonly limit?: number;
107
+ /** AW12: an `each: $navPages` node skips this many navigation pages first (list-big's small rest). */
108
+ readonly skip?: number;
106
109
  }
107
110
 
108
111
  /**