@vectoriox/iox-ui 5.197.0 → 5.198.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.
- package/composite-core/index.d.ts +16 -2
- package/design-core/index.d.ts +160 -28
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +34 -2
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +259 -72
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1845 -396
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +2 -2
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1286 -184
- package/package.json +1 -1
- package/src/composite-core/header.ts +34 -1
- package/src/design-core/brand.ts +58 -5
- package/src/design-core/contrast-audit.ts +49 -22
- package/src/design-core/design-apply.ts +34 -3
- package/src/design-core/flavor-fixtures.generated.ts +123 -123
- package/src/design-core/flavor-spec.generated.ts +44 -4
- package/src/design-core/flavor-tokens.ts +1 -1
- package/src/design-core/header-behaviour.ts +72 -13
- package/src/design-core/motion-language.ts +5 -14
- package/src/design-core/preloader.ts +4 -5
- package/src/generation-core/body-mix.ts +40 -102
- package/src/generation-core/check-free.ts +5 -2
- package/src/generation-core/check-layout.ts +10 -4
- package/src/generation-core/check-list.ts +3 -25
- package/src/generation-core/colour-mix.ts +296 -0
- package/src/generation-core/compose-free.ts +40 -18
- package/src/generation-core/compose-site.ts +92 -13
- package/src/generation-core/footer-mix.ts +102 -54
- package/src/generation-core/free-fallback.ts +6 -4
- package/src/generation-core/free-parts.ts +87 -0
- package/src/generation-core/free-slot-words.ts +30 -0
- package/src/generation-core/generation-tier.ts +6 -17
- package/src/generation-core/header-mix.ts +42 -1
- package/src/generation-core/layout-drawers.ts +3 -2
- package/src/generation-core/layout-wire.ts +10 -16
- package/src/generation-core/list-panel.ts +3 -3
- package/src/generation-core/list-table.ts +5 -14
- package/src/generation-core/list-words.ts +2 -1
- package/src/generation-core/opening-mix.ts +7 -34
- package/src/generation-core/part-tier.ts +14 -0
- package/src/generation-core/plan-wire.ts +31 -43
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/site-spec.generated.ts +1127 -93
- package/src/generation-core/validate-site-plan.ts +4 -5
- package/styles/iox-design.css +137 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { carryInto, swapParts, type PageCarry } from './carry';
|
|
2
2
|
import {
|
|
3
|
-
AnimateId, COLOR_SCHEME_TRAIT, COLOR_SCHEMES, ColorScheme, colorSchemeClass, DEFAULT_MENU_LOOK, DesignChoices, LinkType, MenuLook, motionLanguageForPlan, resolveDesignChoices, setColorScheme, headerGroundOf, headerInkOf,
|
|
3
|
+
AnimateId, COLOR_SCHEME_TRAIT, COLOR_SCHEMES, ColorScheme, colorSchemeClass, DEFAULT_MENU_LOOK, DesignChoices, LinkType, MenuLook, motionLanguageForPlan, resolveDesignChoices, setColorScheme, headerBrandOf, headerGroundOf, headerInkOf, headerShapeOf,
|
|
4
4
|
columnWordOf,
|
|
5
5
|
} from '@vectoriox/iox-ui/design-core';
|
|
6
6
|
import { fitSeoText, SEO_DESCRIPTION_MAX, SEO_TITLE_MAX, SeoRawDoc } from '@vectoriox/iox-ui/seo-core';
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
AccordionAutoBinds, CompositeNodeSpec, findByRole, LIGHTBOX_LABEL, SLIDE_TO_ROW, SLIDE_TYPE, buildTabsRecipe, tabLabelNodeOf,
|
|
12
12
|
tabPanelImageOf, tabPanelTextOf, tabsListOf, tabsPanels, tabsPanelsOf, tabsTriggers, TABS_CONTENT_LIMIT, TABS_IMAGE_BIND_PROP, TABS_LABEL_BIND_PROP,
|
|
13
13
|
TABS_TEXT_BIND_PROP, tabsWords, TabsAutoBinds, BadgeTone, BADGE_TONES, buildSegmentedRecipe, CardWords, ITEM_OPEN_STATE, segmentedOptions,
|
|
14
|
-
setHeaderBehaviour, setHeaderGround, setHeaderInk, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget, ACCOUNT_RECIPES, AccountRecipe, AccountRole,
|
|
15
|
-
buildConsentRecipe, ConsentActionType, CarouselFrom, carouselQuoteLabel, CAROUSEL_QUOTE_LABELS, pickCarouselAutoBinds,
|
|
14
|
+
setHeaderBehaviour, setHeaderBrand, setHeaderGround, setHeaderInk, setHeaderShape, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget, ACCOUNT_RECIPES, AccountRecipe, AccountRole,
|
|
15
|
+
buildConsentRecipe, canOpenAtClickedItem, ConsentActionType, ContentFieldLike, CarouselFrom, carouselQuoteLabel, CAROUSEL_QUOTE_LABELS, pickCarouselAutoBinds,
|
|
16
16
|
} from '@vectoriox/iox-ui/composite-core';
|
|
17
17
|
import { ConsentCategory } from '@vectoriox/iox-ui/consent-core';
|
|
18
18
|
|
|
@@ -1199,12 +1199,17 @@ function composeSegmented(pn: PatternNode, id: string, ctx: Ctx): SerializedNode
|
|
|
1199
1199
|
|
|
1200
1200
|
/** The content type a section binding lists, through its data source. */
|
|
1201
1201
|
function boundContentType(binding: string, ctx: Ctx): ContentTypePlan | undefined {
|
|
1202
|
-
|
|
1203
|
-
|
|
1202
|
+
return listedContentType(binding, ctx.plan);
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
/** The content type a list (a data source's alias) lists, in a plan. */
|
|
1206
|
+
export function listedContentType(alias: string, plan: Pick<SitePlan, 'dataSources' | 'contentTypes'>): ContentTypePlan | undefined {
|
|
1207
|
+
const source = plan.dataSources.find(d => d.alias === alias);
|
|
1208
|
+
return source && 'contentType' in source ? plan.contentTypes.find(t => t.name === source.contentType) : undefined;
|
|
1204
1209
|
}
|
|
1205
1210
|
|
|
1206
1211
|
/** A type's fields as composite-core's pickers read them. */
|
|
1207
|
-
const fieldsOf = (type: ContentTypePlan | undefined) => (type?.fields ?? []).map(f => ({ name: f.name, type: f.type, controller: f.controller }));
|
|
1212
|
+
export const fieldsOf = (type: ContentTypePlan | undefined): ContentFieldLike[] => (type?.fields ?? []).map(f => ({ name: f.name, type: f.type, controller: f.controller }));
|
|
1208
1213
|
|
|
1209
1214
|
/**
|
|
1210
1215
|
* An Accordion (CC2) — the composite-core recipe stamped with this composer's factory. Manual (no section
|
|
@@ -1232,7 +1237,13 @@ function composeAccordion(pn: PatternNode, id: string, ctx: Ctx): SerializedNode
|
|
|
1232
1237
|
}
|
|
1233
1238
|
return root;
|
|
1234
1239
|
}
|
|
1235
|
-
|
|
1240
|
+
return bindAccordion(root, id, binding, fieldsOf(boundContentType(binding, ctx)));
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
/** From content: the Accordion's root repeats `binding`, its one template item's question and answer bound to the type's
|
|
1244
|
+
* first short-text and long-text fields (`recipeListBinds`), limit 20. */
|
|
1245
|
+
function bindAccordion(root: SerializedNode, id: string, binding: string, fields: ReadonlyArray<ContentFieldLike>): SerializedNode {
|
|
1246
|
+
const { picks, gap } = recipeListBinds<AccordionAutoBinds>(PatternRecipe.Accordion, fields);
|
|
1236
1247
|
if (gap) throw new ComposeError(`${id}: "${binding}" has no ${gap}`);
|
|
1237
1248
|
addBinding(root, { prop: 'source', source: binding, path: '' });
|
|
1238
1249
|
setProp(root, 'limit', ACCORDION_CONTENT_LIMIT);
|
|
@@ -1243,6 +1254,18 @@ function composeAccordion(pn: PatternNode, id: string, ctx: Ctx): SerializedNode
|
|
|
1243
1254
|
return root;
|
|
1244
1255
|
}
|
|
1245
1256
|
|
|
1257
|
+
/**
|
|
1258
|
+
* The Accordion over a list, From content — THE same recipe and binding a pattern's `faq.accordion` stamps (CC2, R3's AI
|
|
1259
|
+
* path), for any caller that places it by name (a free page's `accordion:<alias>` slot). Its rows are the list's own
|
|
1260
|
+
* items: no question or answer is written here. Pure.
|
|
1261
|
+
*/
|
|
1262
|
+
export function composeListAccordion(id: string, alias: string, fields: ReadonlyArray<ContentFieldLike>, locale?: string): SerializedNode {
|
|
1263
|
+
const factory = (spec: CompositeNodeSpec): CompositeNode =>
|
|
1264
|
+
create(spec.key === AccordionRole.Accordion ? id : `${id}-${spec.key}`, spec.key === AccordionRole.Accordion ? REPEATER : spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode;
|
|
1265
|
+
const root = buildAccordionRecipe(factory, { items: accordionWords(locale).slice(0, 1) }) as SerializedNode;
|
|
1266
|
+
return bindAccordion(root, id, alias, fields);
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1246
1269
|
|
|
1247
1270
|
const TABS_ROOT_KEY = 'tabs';
|
|
1248
1271
|
const TABS_HOLDER_KEYS: ReadonlySet<string> = new Set(['list', 'panels']);
|
|
@@ -1279,7 +1302,14 @@ function composeTabs(pn: PatternNode, id: string, ctx: Ctx): SerializedNode {
|
|
|
1279
1302
|
}
|
|
1280
1303
|
return root;
|
|
1281
1304
|
}
|
|
1282
|
-
|
|
1305
|
+
return bindTabs(root, id, binding, fieldsOf(boundContentType(binding, ctx)));
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/** From content: the tab list and the panels holder BOTH repeat `binding`, each holding its one template, the tab's
|
|
1309
|
+
* words, the panel's words and picture bound to the type's fields (`recipeListBinds`), limit 6. */
|
|
1310
|
+
function bindTabs(root: SerializedNode, id: string, binding: string, fields: ReadonlyArray<ContentFieldLike>): SerializedNode {
|
|
1311
|
+
const tree = root as CompositeNode;
|
|
1312
|
+
const { picks, gap } = recipeListBinds<TabsAutoBinds>(PatternRecipe.Tabs, fields);
|
|
1283
1313
|
if (gap) throw new ComposeError(`${id}: "${binding}" has no ${gap}`);
|
|
1284
1314
|
for (const holder of [tabsListOf(tree), tabsPanelsOf(tree)] as SerializedNode[]) {
|
|
1285
1315
|
addBinding(holder, { prop: 'source', source: binding, path: '' });
|
|
@@ -1299,6 +1329,17 @@ function composeTabs(pn: PatternNode, id: string, ctx: Ctx): SerializedNode {
|
|
|
1299
1329
|
return root;
|
|
1300
1330
|
}
|
|
1301
1331
|
|
|
1332
|
+
/**
|
|
1333
|
+
* Tabs over a list, From content — THE same recipe and binding a pattern's tabs stamp (CC4a, R3's AI path), for any
|
|
1334
|
+
* caller that places it by name (a free page's `tabs:<alias>` slot). Its tabs are the list's own items. Pure.
|
|
1335
|
+
*/
|
|
1336
|
+
export function composeListTabs(id: string, alias: string, fields: ReadonlyArray<ContentFieldLike>, locale?: string, label?: string): SerializedNode {
|
|
1337
|
+
const factory = (spec: CompositeNodeSpec): CompositeNode =>
|
|
1338
|
+
create(spec.key === TABS_ROOT_KEY ? id : `${id}-${spec.key}`, TABS_HOLDER_KEYS.has(spec.key) ? REPEATER : spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode;
|
|
1339
|
+
const root = buildTabsRecipe(factory, { tabs: tabsWords(locale).slice(0, 1), ...(label ? { label } : {}), lang: locale }) as SerializedNode;
|
|
1340
|
+
return bindTabs(root, id, alias, fields);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1302
1343
|
/** A recipe's node factory for this composer: ids derive from the recipe's keys (`<id>-<key>`, the root `<id>`). */
|
|
1303
1344
|
/** Commerce G1: a pattern's shop recipes, each E1c's `SHOP_RECIPES` entry and the key its root is built with. */
|
|
1304
1345
|
const SHOP_PATTERN_RECIPES: ReadonlyMap<PatternRecipe, { recipe: ShopRecipe; rootKey: string }> = new Map([
|
|
@@ -1495,6 +1536,36 @@ function composeCarousel(pn: PatternNode, id: string, ctx: Ctx): SerializedNode
|
|
|
1495
1536
|
return slider;
|
|
1496
1537
|
}
|
|
1497
1538
|
|
|
1539
|
+
/**
|
|
1540
|
+
* The testimonial carousel over a list of REAL quotes (`quoteListOf`) — THE recipe `composeCarousel` stamps, for any
|
|
1541
|
+
* caller that places it by name (a free page's `quotes:<alias>` slot). Pure.
|
|
1542
|
+
*/
|
|
1543
|
+
export function composeQuoteCarousel(id: string, from: CarouselFrom, locale?: string): SerializedNode {
|
|
1544
|
+
return buildCarouselRecipe(recipeFactory(id, 'carousel'), { lang: locale, from }) as SerializedNode;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* CC3: a Lightbox over a list's pictures, opened at the clicked item — the recipe `composeLightbox` stamps (a Dialog
|
|
1549
|
+
* holding a Slider bound to the list), and every picture of `frame` bound to that list's `imageField` opens it at its own
|
|
1550
|
+
* row (`canOpenAtClickedItem` — the same rule the Interactions panel offers it by). Returns the Lightbox, or null when no
|
|
1551
|
+
* picture in the frame sits in a row of that list. Mutates the frame's pictures' interactions; pure otherwise.
|
|
1552
|
+
*/
|
|
1553
|
+
export function composeListLightbox(id: string, frame: SerializedNode, alias: string, imageField: string, locale?: string, altField?: string): SerializedNode | null {
|
|
1554
|
+
const lightbox = buildLightboxRecipe(recipeFactory(id, 'lightbox'), { source: alias, imageField, ...(altField ? { altField } : {}), lang: locale }) as SerializedNode;
|
|
1555
|
+
let wired = 0;
|
|
1556
|
+
const visit = (n: SerializedNode, path: SerializedNode[]) => {
|
|
1557
|
+
const here = [...path, n];
|
|
1558
|
+
if (n.type === IMAGE && n.bindings.some(b => b.prop === 'src' && b.path === imageField)
|
|
1559
|
+
&& canOpenAtClickedItem(here as unknown as CompositeNode[], lightbox as unknown as CompositeNode)) {
|
|
1560
|
+
n.interactions = [...n.interactions, { id: `${n.id}-opens`, trigger: 'click', actions: [{ type: 'openDialog', target: lightbox.id, params: { slideTo: SLIDE_TO_ROW }, duration: 0, delay: 0, easing: 'ease' }] }];
|
|
1561
|
+
wired++;
|
|
1562
|
+
}
|
|
1563
|
+
for (const c of n.children ?? []) visit(c, here);
|
|
1564
|
+
};
|
|
1565
|
+
visit(frame, []);
|
|
1566
|
+
return wired ? lightbox : null;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1498
1569
|
/** The first item of a list, as a binding path (`resolvePath` reads `0.<field>` on the list the source resolves to). */
|
|
1499
1570
|
const FIRST_ITEM_PATH = '0';
|
|
1500
1571
|
|
|
@@ -1812,6 +1883,8 @@ function freeOptionsOf(
|
|
|
1812
1883
|
// iox-ui#180: a picture box is an empty picture (the build fills it), never an address.
|
|
1813
1884
|
photoSrc: id => (isFreeBox(id) ? '' : context.photoSrc?.(id) ?? ''), photoAlt: id => (isFreeBox(id) ? '' : context.photoAlt?.(id) ?? ''),
|
|
1814
1885
|
listOf: alias => pageListOf(alias, plan, pictureless),
|
|
1886
|
+
listFields: alias => fieldsOf(listedContentType(alias, plan)),
|
|
1887
|
+
quotes: quoteListOf(plan),
|
|
1815
1888
|
...(readyMade ? {
|
|
1816
1889
|
readyMade: (at: number, id: string) => {
|
|
1817
1890
|
const section = page.sections[at];
|
|
@@ -1903,14 +1976,13 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
1903
1976
|
const email = nonEmpty(plan.business.facts?.email) ? plan.business.facts!.email!.trim() : null;
|
|
1904
1977
|
const base = { plan, placeholders, issues, routes, year: context.year, email, navPage: null, pictureless };
|
|
1905
1978
|
|
|
1906
|
-
// AW-
|
|
1907
|
-
|
|
1908
|
-
const design = motionLanguageForPlan(resolveDesignChoices(clone(plan.design)), context?.tier === GenerationTier.Award);
|
|
1979
|
+
// AW-D42: every plan wears the look's whole motion language (a lower plan's Pro words were drawn as its own, AW-D23).
|
|
1980
|
+
const design = motionLanguageForPlan(resolveDesignChoices(clone(plan.design)));
|
|
1909
1981
|
const locale = plan.locale ?? DEFAULT_SITE_LOCALE;
|
|
1910
1982
|
const rtl = isRtlLocale(locale);
|
|
1911
|
-
// AW6: the plan's body (seams, inset cards) as the
|
|
1983
|
+
// AW6: the plan's body (seams, inset cards) as the site may carry it — every mend said (`body-mended`).
|
|
1912
1984
|
const bodyMixAsked = bodyMixOfPlan(plan);
|
|
1913
|
-
const bodyChecked = bodyMixAsked ? checkBody(drawnBodyMix(bodyMixAsked).drawn, {
|
|
1985
|
+
const bodyChecked = bodyMixAsked ? checkBody(drawnBodyMix(bodyMixAsked).drawn, { calm: !!context?.calm }) : null;
|
|
1914
1986
|
for (const r of bodyChecked?.repairs ?? []) issues.push({ code: ComposeIssueCode.BodyMended, nodeId: 'body', owner: 'body', detail: r.said });
|
|
1915
1987
|
const body = bodyChecked?.mix ?? null;
|
|
1916
1988
|
const pages: ComposedPage[] = plan.pages.map(page => {
|
|
@@ -1981,6 +2053,8 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
1981
2053
|
// AW12-D10/D15: the kind of business (the caller's reading) chooses the call word and what the footer never wears.
|
|
1982
2054
|
const footerContext = {
|
|
1983
2055
|
name: plan.business.name, design, tagline: plan.business.tagline, locale: plan.locale, pages: plan.pages.filter(p => p.inNav).length,
|
|
2056
|
+
// FV1 `closing.email`: the owner's address, the fact the email line shows (none given, no such closing — said).
|
|
2057
|
+
...(plan.business.facts?.email?.trim() ? { email: plan.business.facts.email.trim() } : {}),
|
|
1984
2058
|
...(context?.businessType ? { type: context.businessType } : {}), ...(context?.footerNever ? { never: context.footerNever } : {}),
|
|
1985
2059
|
// AW12-D13 (iox-ui#153): the build's tier — absent, Basic, as the body's — never wears an award word.
|
|
1986
2060
|
tier: context?.tier ?? GenerationTier.Basic,
|
|
@@ -2023,6 +2097,9 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
2023
2097
|
if (headerRoot) setHeaderInk(headerRoot as unknown as CompositeNode, headerInkOf(header.recipe.mix[HeaderIngredient.Ink]));
|
|
2024
2098
|
// HI3 (HI3-D1): what the header stands on — over the opening, glass, or its own ground — the same edit the Header section makes.
|
|
2025
2099
|
if (headerRoot) setHeaderGround(headerRoot as unknown as CompositeNode, headerGroundOf(header.recipe.mix[HeaderIngredient.Ground]));
|
|
2100
|
+
// HI3 slice 2: its outline (pill · islands) and its name (hangs · later) — the same edits the Header studio makes.
|
|
2101
|
+
if (headerRoot) setHeaderShape(headerRoot as unknown as CompositeNode, headerShapeOf(header.recipe.mix[HeaderIngredient.Shape]));
|
|
2102
|
+
if (headerRoot) setHeaderBrand(headerRoot as unknown as CompositeNode, headerBrandOf(header.recipe.mix[HeaderIngredient.Brand]));
|
|
2026
2103
|
// AW12: the footer root says the mix it was composed as (the classes iox-design.css draws from); an inset one is a card.
|
|
2027
2104
|
const footerRoot = globals.find(g => g.id === GlobalSlot.Footer);
|
|
2028
2105
|
if (footerRoot) stampFooterMix(footerRoot as unknown as { props: Record<string, unknown>; styleProps?: Record<string, unknown> }, footer.mix);
|
|
@@ -2440,6 +2517,8 @@ export function composeNavHeader(input: NavHeaderInput, options: NavHeaderOption
|
|
|
2440
2517
|
stampHeaderMix(header, recipe.mix);
|
|
2441
2518
|
setHeaderInk(header as unknown as CompositeNode, headerInkOf(recipe.mix[HeaderIngredient.Ink]));
|
|
2442
2519
|
setHeaderGround(header as unknown as CompositeNode, headerGroundOf(recipe.mix[HeaderIngredient.Ground]));
|
|
2520
|
+
setHeaderShape(header as unknown as CompositeNode, headerShapeOf(recipe.mix[HeaderIngredient.Shape]));
|
|
2521
|
+
setHeaderBrand(header as unknown as CompositeNode, headerBrandOf(recipe.mix[HeaderIngredient.Brand]));
|
|
2443
2522
|
if (input.storeSlots) withStoreSlots(header, input.locale ?? DEFAULT_SITE_LOCALE);
|
|
2444
2523
|
return { header, issues, mix: checked.mix, companions };
|
|
2445
2524
|
}
|
|
@@ -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
|
|
@@ -35,6 +36,10 @@ export enum FooterArrange {
|
|
|
35
36
|
Line = 'line',
|
|
36
37
|
Ruled = 'ruled',
|
|
37
38
|
ListBig = 'list-big',
|
|
39
|
+
/** FV0 (footer-v2 §4): laid by the model from the parts as a free section (waits for FV2). */
|
|
40
|
+
Free = 'free',
|
|
41
|
+
/** FV0: two zones divided by a vertical hairline (allerstudio, thepopuphotel; waits for FV1). */
|
|
42
|
+
Halves = 'halves',
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export enum FooterHold {
|
|
@@ -49,6 +54,12 @@ export enum FooterHold {
|
|
|
49
54
|
Badges = 'badges',
|
|
50
55
|
Region = 'region',
|
|
51
56
|
Search = 'search',
|
|
57
|
+
/** FV0: the owner's social links (waits for FV1 and the reading's links, FV-D10). */
|
|
58
|
+
Social = 'social',
|
|
59
|
+
/** FV0: a round back-to-top button (waits for FV1). */
|
|
60
|
+
Top = 'top',
|
|
61
|
+
/** FV0: the owner's picture and a chat button (waits for FV1). */
|
|
62
|
+
Chat = 'chat',
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
export enum FooterClosing {
|
|
@@ -59,6 +70,10 @@ export enum FooterClosing {
|
|
|
59
70
|
Word = 'word',
|
|
60
71
|
Newsletter = 'newsletter',
|
|
61
72
|
NameAndAction = 'name-and-action',
|
|
73
|
+
/** FV0: the email set large as the footer's opening line (mdscollective; waits for FV1). */
|
|
74
|
+
Email = 'email',
|
|
75
|
+
/** FV0: the name or a farewell line huge and faint behind the blocks (haven; waits for FV3). */
|
|
76
|
+
Behind = 'behind',
|
|
62
77
|
}
|
|
63
78
|
|
|
64
79
|
export enum FooterGround {
|
|
@@ -70,6 +85,12 @@ export enum FooterGround {
|
|
|
70
85
|
Scene = 'scene',
|
|
71
86
|
Pattern = 'pattern',
|
|
72
87
|
Inset = 'inset',
|
|
88
|
+
/** FV0: the owner's photo, dimmed (waits for FV3). */
|
|
89
|
+
Photo = 'photo',
|
|
90
|
+
/** FV0: the colour's gradient wash (waits for FV3 with colour-v2 CV3). */
|
|
91
|
+
Gradient = 'gradient',
|
|
92
|
+
/** FV0: a ruled box inside the page frame (damaria; waits for FV1). */
|
|
93
|
+
Framed = 'framed',
|
|
73
94
|
}
|
|
74
95
|
|
|
75
96
|
export enum FooterNameStyle {
|
|
@@ -77,6 +98,8 @@ export enum FooterNameStyle {
|
|
|
77
98
|
Gradient = 'gradient',
|
|
78
99
|
Emboss = 'emboss',
|
|
79
100
|
Offset = 'offset',
|
|
101
|
+
/** FV0: the closing name in the look's script face (waits for TYPE's third family, AW13). */
|
|
102
|
+
Script = 'script',
|
|
80
103
|
}
|
|
81
104
|
|
|
82
105
|
/** The roles a footer's parts carry — the contract's (`site.footerParts` and the stored footers), written to the node's
|
|
@@ -99,6 +122,10 @@ export enum FooterRole {
|
|
|
99
122
|
Ruled = 'footer.ruled',
|
|
100
123
|
/** AW12 `arrange.list-big`: the pages stacked large. */
|
|
101
124
|
ListBig = 'footer.list-big',
|
|
125
|
+
/** FV1 `arrange.halves`: two zones (the brand · the blocks) divided by a vertical hairline (iox-design.css). */
|
|
126
|
+
Halves = 'footer.halves',
|
|
127
|
+
/** FV1 `closing.email`: the owner's email set large, the contact link. */
|
|
128
|
+
Email = 'footer.email',
|
|
102
129
|
}
|
|
103
130
|
|
|
104
131
|
|
|
@@ -136,10 +163,20 @@ export function footerWait(ingredient: `${FooterIngredient}`, word: string): Foo
|
|
|
136
163
|
return WAITS[`${ingredient}.${word}`] ?? null;
|
|
137
164
|
}
|
|
138
165
|
|
|
166
|
+
/**
|
|
167
|
+
* FV0 (FV-D9, vectoriox/iox-ai-guidance#2): blocks a footer holds that are no part of it — the legal row is stamped after
|
|
168
|
+
* EVERY footer by compose-site `legalRow` (`rules.legalAlways`), whether a mix names it or not. A mix may name it (stored
|
|
169
|
+
* mixes, the references); the recipe never looks for its part and the wire never offers it (there is no choice to make).
|
|
170
|
+
*/
|
|
171
|
+
export const FOOTER_ROW_HOLDS: ReadonlySet<string> = new Set(F.rules.legalAlways ? [FooterHold.Legal] : []);
|
|
172
|
+
/** The blocks of a mix the recipe lays as parts (the legal row is compose-site's). */
|
|
173
|
+
const partHolds = (holds: ReadonlyArray<string>): string[] => holds.filter(h => !FOOTER_ROW_HOLDS.has(h));
|
|
174
|
+
|
|
139
175
|
/** 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).
|
|
176
|
+
* (ingredients.md §3.3: offering a waiting word would put its stand-in on every site that asked for it). The legal row
|
|
177
|
+
* is drawn on every footer, so it is never offered as a choice (`FOOTER_ROW_HOLDS`). */
|
|
141
178
|
export function footerWords(ingredient: `${FooterIngredient}`): ReadonlyArray<string> {
|
|
142
|
-
return footerTableWords(ingredient).filter(w => !footerWait(ingredient, w));
|
|
179
|
+
return footerTableWords(ingredient).filter(w => !footerWait(ingredient, w) && !(ingredient === FooterIngredient.Holds && FOOTER_ROW_HOLDS.has(w)));
|
|
143
180
|
}
|
|
144
181
|
|
|
145
182
|
/** What a word means, as the brief and the builder say it. */
|
|
@@ -257,17 +294,14 @@ export function footerFaceOf(footer: FooterMix | string): string {
|
|
|
257
294
|
return `${FOOTER_TOKEN}:${at(FooterIngredient.Arrange)}/${at(FooterIngredient.Closing)}`;
|
|
258
295
|
}
|
|
259
296
|
|
|
260
|
-
/**
|
|
297
|
+
/** The tier a word was first drawn for (`all`, or `pro` — AW-D23 / AW12-D13); since AW-D42 every tier wears both. */
|
|
261
298
|
export function footerWordTier(ingredient: `${FooterIngredient}`, word: string): 'all' | 'pro' {
|
|
262
299
|
return (F.tiers as Readonly<Record<string, string>>)[`${ingredient}.${word}`] === 'pro' ? 'pro' : 'all';
|
|
263
300
|
}
|
|
264
301
|
|
|
265
|
-
/**
|
|
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). */
|
|
302
|
+
/** May a footer at `tier` wear this word? Every tier wears every drawn word (AW-D42, `tierOffers`). */
|
|
269
303
|
export function footerWordOffered(ingredient: `${FooterIngredient}`, word: string, tier?: `${GenerationTier}`): boolean {
|
|
270
|
-
return
|
|
304
|
+
return tierOffers(footerWordTier(ingredient, word), tier);
|
|
271
305
|
}
|
|
272
306
|
|
|
273
307
|
/** A footer token in words: `footer:columns/none/inverse` → "columns · none · inverse". */
|
|
@@ -312,9 +346,11 @@ export enum FooterRepairCode {
|
|
|
312
346
|
/** AW12-D10 (H1): a word the kind of business never closes with or stands on (harness FOOTER_NEVER): the call · the
|
|
313
347
|
* dark band. */
|
|
314
348
|
TypeNever = 'type-never',
|
|
315
|
-
/**
|
|
316
|
-
|
|
317
|
-
|
|
349
|
+
/** FV1: the email closing is the owner's own address — none given (or too wide for a phone): no closing. */
|
|
350
|
+
EmailWithoutAddress = 'email-without-address',
|
|
351
|
+
EmailTooLong = 'email-too-long',
|
|
352
|
+
/** FV1: halves need a block in the end zone — none held: drawn as columns. */
|
|
353
|
+
HalvesEmpty = 'halves-empty',
|
|
318
354
|
}
|
|
319
355
|
|
|
320
356
|
export interface FooterRepair {
|
|
@@ -349,8 +385,10 @@ export interface FooterContext {
|
|
|
349
385
|
locale?: string;
|
|
350
386
|
/** AW12-D10: what this kind of business's footer never wears (absent = nothing refused). */
|
|
351
387
|
never?: FooterNever | null;
|
|
352
|
-
/**
|
|
353
|
-
|
|
388
|
+
/** FV1 `closing.email`: the owner's email (the plan's `facts.email`) — none given, the footer never closes with one. */
|
|
389
|
+
email?: string;
|
|
390
|
+
/** The tier the site is built at. Since AW-D42 it mends no word (every tier wears every drawn word); kept so its
|
|
391
|
+
* callers still read. */
|
|
354
392
|
tier?: `${GenerationTier}`;
|
|
355
393
|
}
|
|
356
394
|
|
|
@@ -426,32 +464,6 @@ export const footerNameFits = (ctx: FooterContext): boolean => !overflowsPhone(n
|
|
|
426
464
|
const an = (word: string): string => `${/^[aeiou]/.test(word) ? 'an' : 'a'} ${word}`;
|
|
427
465
|
const capital = (said: string): string => said.charAt(0).toUpperCase() + said.slice(1);
|
|
428
466
|
|
|
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
467
|
/**
|
|
456
468
|
* 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
469
|
* is said. Never throws on a well-formed mix. Pure.
|
|
@@ -463,10 +475,7 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
463
475
|
if (drawn.waited.length) {
|
|
464
476
|
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
477
|
}
|
|
466
|
-
|
|
467
|
-
const atTier = footerAtTier(drawn.mix, ctx.tier);
|
|
468
|
-
for (const said of atTier.said) say(FooterRepairCode.ProOnly, said);
|
|
469
|
-
const mix = atTier.mix;
|
|
478
|
+
const mix = drawn.mix;
|
|
470
479
|
let holds = inOrder(FooterIngredient.Holds, mix.holds);
|
|
471
480
|
let closing = mix.closing;
|
|
472
481
|
let arrange = mix.arrange;
|
|
@@ -501,6 +510,17 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
501
510
|
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
511
|
closing = FooterClosing.Call;
|
|
503
512
|
}
|
|
513
|
+
if (closing === FooterClosing.Email) {
|
|
514
|
+
// FV1 (rule 3, footer-v2 §4): the address is the owner's fact, never made up and never a placeholder.
|
|
515
|
+
const email = ctx.email?.trim();
|
|
516
|
+
if (!email) {
|
|
517
|
+
say(FooterRepairCode.EmailWithoutAddress, 'the email closing is the owner\'s own address and none was given: no closing');
|
|
518
|
+
closing = FooterClosing.None;
|
|
519
|
+
} else if (overflowsPhone(widthEm(email, ctx, 'link-display'), ctx)) {
|
|
520
|
+
say(FooterRepairCode.EmailTooLong, `"${email}" does not fit a phone even at the smallest size: no closing`);
|
|
521
|
+
closing = FooterClosing.None;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
504
524
|
if (closing === FooterClosing.Name && !footerNameFits(ctx)) {
|
|
505
525
|
say(FooterRepairCode.NameTooLong, `"${ctx.name}" is too long to stand across a phone: the footer closes with nothing`);
|
|
506
526
|
closing = FooterClosing.None;
|
|
@@ -511,8 +531,8 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
511
531
|
holds = holds.filter(h => END_HOLDS.includes(h));
|
|
512
532
|
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
533
|
}
|
|
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`);
|
|
534
|
+
if (arrange === FooterArrange.Ruled && partHolds(holds).length + 1 < rule('ruledMinBlocks')) {
|
|
535
|
+
say(FooterRepairCode.RuledFewBlocks, `ruled cells need company and the footer holds ${partHolds(holds).length + 1} block${partHolds(holds).length ? 's' : ''}: drawn as columns`);
|
|
516
536
|
arrange = FooterArrange.Columns;
|
|
517
537
|
}
|
|
518
538
|
if (arrange === FooterArrange.ListBig && ctx.pages !== undefined && ctx.pages > rule('listBigPages')) {
|
|
@@ -527,9 +547,13 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
527
547
|
say(FooterRepairCode.EmbossNeedsBrand, `${capital(an(nameStyle))} name is a copy of the name the brand block says, and this footer has none: plain`);
|
|
528
548
|
nameStyle = FooterNameStyle.Plain;
|
|
529
549
|
}
|
|
530
|
-
if (
|
|
550
|
+
if (arrange === FooterArrange.Halves && !partHolds(holds).length) {
|
|
551
|
+
say(FooterRepairCode.HalvesEmpty, 'halves need a block beside the name and the footer holds none: drawn as columns');
|
|
552
|
+
arrange = FooterArrange.Columns;
|
|
553
|
+
}
|
|
554
|
+
if (partHolds(holds).length < F.rules.minHolds && closing === FooterClosing.None) {
|
|
531
555
|
say(FooterRepairCode.Empty, 'a footer that holds nothing holds the pages');
|
|
532
|
-
holds = [FooterHold.Pages];
|
|
556
|
+
holds = inOrder(FooterIngredient.Holds, [FooterHold.Pages, ...holds]);
|
|
533
557
|
}
|
|
534
558
|
return { mix: { ...mix, holds, closing, arrange, nameStyle, ground }, repairs };
|
|
535
559
|
}
|
|
@@ -600,6 +624,12 @@ function callPart(ctx: FooterContext): PatternNode {
|
|
|
600
624
|
return { ...node, c: (node.c ?? []).map(n => (n.slot === 'closing' ? { ...n, text: line, ...(lineHe ? { textHe: lineHe } : {}) } : n)) };
|
|
601
625
|
}
|
|
602
626
|
|
|
627
|
+
/** The email closing (FV1 `closing.email`): the part's link, its words the owner's address (the fact), fitted to the
|
|
628
|
+
* column as the call word is. */
|
|
629
|
+
function emailLine(email: string, ctx: FooterContext): PatternNode {
|
|
630
|
+
return laid(part('email'), { fontSize: columnSize(widthEm(email, ctx, 'link-display'), ctx) });
|
|
631
|
+
}
|
|
632
|
+
|
|
603
633
|
/** A block it holds: how to reach the business leaves its city to the visit block when the footer holds both. */
|
|
604
634
|
function holdPart(hold: string, mix: FooterMix): PatternNode {
|
|
605
635
|
const node = part(hold);
|
|
@@ -622,7 +652,7 @@ function bigPages(ctx: FooterContext): PatternNode[] {
|
|
|
622
652
|
|
|
623
653
|
/** The body: the blocks it holds, arranged. */
|
|
624
654
|
function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
625
|
-
const holds = mix.holds.map(h => holdPart(h, mix));
|
|
655
|
+
const holds = partHolds(mix.holds).map(h => holdPart(h, mix));
|
|
626
656
|
switch (mix.arrange) {
|
|
627
657
|
case FooterArrange.Line: {
|
|
628
658
|
const row: PatternNode = { t: 'Container', es: 'box', lay: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'space-between', gap: GAP }, c: [
|
|
@@ -632,7 +662,7 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
632
662
|
return [row];
|
|
633
663
|
}
|
|
634
664
|
case FooterArrange.Centred: {
|
|
635
|
-
const blocks = mix.holds.map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : centred(holdPart(h, mix))));
|
|
665
|
+
const blocks = partHolds(mix.holds).map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : centred(holdPart(h, mix))));
|
|
636
666
|
return [
|
|
637
667
|
{ t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: '28px', ...CENTRED }, c: [centred(brandPart(ctx, mix)), ...blocks] },
|
|
638
668
|
part('rule'),
|
|
@@ -648,7 +678,7 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
648
678
|
resp: { tablet: { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' }, mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: cells }, part('rule'), part('copyright')];
|
|
649
679
|
}
|
|
650
680
|
case FooterArrange.ListBig: {
|
|
651
|
-
const others = mix.holds.filter(h => h !== FooterHold.Pages).map(h => holdPart(h, mix));
|
|
681
|
+
const others = partHolds(mix.holds).filter(h => h !== FooterHold.Pages).map(h => holdPart(h, mix));
|
|
652
682
|
const pages = mix.holds.includes(FooterHold.Pages) ? bigPages(ctx) : [];
|
|
653
683
|
return [{ t: 'Container', es: 'box', lay: { display: 'grid', gridTemplateColumns: 'minmax(0, 3fr) minmax(0, 2fr)', gap: GAP, alignItems: 'end' },
|
|
654
684
|
resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: [
|
|
@@ -656,6 +686,14 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
656
686
|
{ t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: GAP }, c: [brandPart(ctx, mix), ...others] },
|
|
657
687
|
] }, part('rule'), part('copyright')];
|
|
658
688
|
}
|
|
689
|
+
case FooterArrange.Halves: {
|
|
690
|
+
// FV1 (footer-v2 §2, after thepopuphotel and allerstudio): the brand at the start, the blocks in columns at the
|
|
691
|
+
// end, a vertical hairline between them (iox-design.css `footer.halves`); one under another on a phone.
|
|
692
|
+
const end: PatternNode = { t: 'Container', es: 'box', lay: { display: 'grid', gridTemplateColumns: `repeat(${Math.max(holds.length, 1)}, minmax(0, 1fr))`, gap: GAP },
|
|
693
|
+
resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: holds };
|
|
694
|
+
return [{ t: 'Container', es: 'box', role: FooterRole.Halves, lay: { display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1fr)', gap: '0px' },
|
|
695
|
+
resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: [brandPart(ctx, mix), end] }, part('rule'), part('copyright')];
|
|
696
|
+
}
|
|
659
697
|
default:
|
|
660
698
|
return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [brandPart(ctx, mix), ...holds] }, part('rule'), part('copyright')];
|
|
661
699
|
}
|
|
@@ -677,6 +715,8 @@ function endOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
677
715
|
const GROUND_SCHEME: Readonly<Record<string, string | null>> = {
|
|
678
716
|
[FooterGround.Inverse]: 'inverse', [FooterGround.Subtle]: 'subtle', [FooterGround.Accent]: 'accent', [FooterGround.Plain]: null,
|
|
679
717
|
[FooterGround.Inset]: 'inverse',
|
|
718
|
+
// FV1: a framed footer stands on the page's own ground, in a ruled box (stampFooterMix + iox-design.css).
|
|
719
|
+
[FooterGround.Framed]: null,
|
|
680
720
|
};
|
|
681
721
|
|
|
682
722
|
/** A footer mix as a pattern: what the composer stamps as the site's footer (global, after the page). Check it first. */
|
|
@@ -687,6 +727,7 @@ export function footerPattern(given: FooterMix, ctx: FooterContext): SitePattern
|
|
|
687
727
|
[FooterClosing.Call]: () => [mix.arrange === FooterArrange.Columns ? callPart(ctx) : centred(callPart(ctx))],
|
|
688
728
|
[FooterClosing.Statement]: () => [part('statement')],
|
|
689
729
|
[FooterClosing.Word]: () => [callWord(ctx)],
|
|
730
|
+
[FooterClosing.Email]: () => (ctx.email?.trim() ? [emailLine(ctx.email.trim(), ctx)] : []),
|
|
690
731
|
} as Readonly<Record<string, () => PatternNode[]>>;
|
|
691
732
|
const before = opens[mix.closing]?.() ?? [];
|
|
692
733
|
const body = mix.closing === FooterClosing.NameAndAction ? endOf(mix, ctx) : bodyOf(mix, ctx);
|
|
@@ -716,12 +757,22 @@ export const FOOTER_INSET_STYLES: Readonly<Record<string, string>> = {
|
|
|
716
757
|
borderRadius: 'var(--iox-radius-xl)',
|
|
717
758
|
};
|
|
718
759
|
|
|
760
|
+
/** FV1 `ground.framed`: the box stands at an inset footer's margin (inside the page frame) and pads its words back onto the
|
|
761
|
+
* column; its rule is iox-design.css's (`iox-footer-ground-framed`). */
|
|
762
|
+
export const FOOTER_FRAMED_STYLES: Readonly<Record<string, string>> = {
|
|
763
|
+
margin: FOOTER_INSET_STYLES['margin'], paddingLeft: FOOTER_INSET_STYLES['paddingLeft'], paddingRight: FOOTER_INSET_STYLES['paddingRight'],
|
|
764
|
+
};
|
|
765
|
+
|
|
719
766
|
/**
|
|
720
767
|
* The composed footer's root says the mix it was composed as (`FOOTER_MIX_PROP` — the classes iox-design.css draws from),
|
|
721
768
|
* 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
769
|
*/
|
|
723
770
|
export function stampFooterMix(root: { props: Record<string, unknown>; styleProps?: Record<string, unknown> }, mix: FooterMix): void {
|
|
724
771
|
root.props = { ...root.props, [FOOTER_MIX_PROP]: footerMixWords({ ...mix, holds: [] }).filter(w => !w.startsWith(`${FooterIngredient.Holds}:`)).join(' ') };
|
|
772
|
+
if (mix.ground === FooterGround.Framed) {
|
|
773
|
+
root.styleProps = { ...(root.styleProps ?? {}), ...FOOTER_FRAMED_STYLES };
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
725
776
|
if (mix.ground !== FooterGround.Inset) return;
|
|
726
777
|
root.props = { ...root.props, [SECTION_SHAPE_TRAIT]: SectionShape.Card };
|
|
727
778
|
root.styleProps = { ...(root.styleProps ?? {}), ...FOOTER_INSET_STYLES };
|
|
@@ -738,17 +789,14 @@ const MEND_ORDER: ReadonlyArray<FooterIngredient.Closing | FooterIngredient.Grou
|
|
|
738
789
|
/**
|
|
739
790
|
* A footer no other site wears (R-H10): the mix when no other site's footer READS like it (`footerFaceOf` — the same
|
|
740
791
|
* 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` (
|
|
742
|
-
* award word) — checked again (`checkFooter`), and said. When every face is worn, a free token is enough (the plan's own,
|
|
792
|
+
* 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
793
|
* else the nearest); when every footer is worn, the mix as it is. Pure, deterministic.
|
|
744
794
|
*/
|
|
745
795
|
export function distinctFooter(mix: FooterMix, taken: ReadonlyArray<string>, ctx: FooterContext, tier?: `${GenerationTier}`): { mix: FooterMix; repairs: FooterRepair[] } {
|
|
746
796
|
const used = new Set(taken);
|
|
747
797
|
const faces = new Set(taken.map(footerFaceOf));
|
|
748
798
|
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
799
|
const asked = mix;
|
|
751
|
-
mix = footerAtTier(mix, tier).mix;
|
|
752
800
|
if (free(mix, true)) return { mix: asked, repairs: [] };
|
|
753
801
|
const words = (k: FooterIngredient) => footerWords(k).filter(w => footerWordOffered(k, w, tier));
|
|
754
802
|
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
|
|
50
|
-
if (
|
|
51
|
-
if (kind ===
|
|
52
|
-
|
|
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). */
|