@vectoriox/iox-ui 5.198.0 → 5.200.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/actions-core/index.d.ts +7 -1
- package/data-core/index.d.ts +11 -3
- package/design-core/index.d.ts +479 -52
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +6 -1
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +30 -4
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +704 -55
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs +5 -2
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +16659 -15146
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +653 -70
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +5 -2
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +883 -235
- package/harness-core/index.d.ts +372 -9
- package/package.json +1 -1
- package/src/actions-core/element-actions.ts +6 -0
- package/src/data-core/placeholder-rows.ts +29 -4
- package/src/design-core/brand-neutrals.ts +125 -3
- package/src/design-core/colour-words.ts +48 -0
- package/src/design-core/design-settings.ts +24 -5
- package/src/design-core/design-token.model.ts +8 -0
- package/src/design-core/flavor-fixtures.generated.ts +272 -2
- package/src/design-core/flavor-spec.generated.ts +310 -40
- package/src/design-core/flavor-tokens.ts +5 -1
- package/src/design-core/menu-look.ts +23 -0
- package/src/design-core/node-classes.ts +39 -0
- package/src/design-core/public-api.ts +2 -0
- package/src/design-core/signature-move.ts +107 -0
- package/src/design-core/style-presets.ts +9 -3
- package/src/design-core/token-css.ts +59 -1
- package/src/forms-core/form-presets.ts +5 -2
- package/src/generation-core/body-mix.ts +41 -0
- package/src/generation-core/check-free.ts +17 -9
- package/src/generation-core/check-layout.ts +17 -7
- package/src/generation-core/colour-mix.ts +53 -3
- package/src/generation-core/compose-free.ts +7 -2
- package/src/generation-core/compose-site.ts +298 -78
- package/src/generation-core/composition.ts +320 -0
- package/src/generation-core/footer-mix.ts +202 -16
- package/src/generation-core/footer-sign-up.ts +51 -0
- package/src/generation-core/free-opening.ts +13 -2
- package/src/generation-core/free-wire.ts +8 -0
- package/src/generation-core/header-edit.ts +15 -0
- package/src/generation-core/header-mix.ts +31 -2
- package/src/generation-core/legal.ts +24 -0
- package/src/generation-core/menu-shelves.ts +138 -0
- package/src/generation-core/nav-shape.ts +138 -15
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/opening-edit.ts +17 -3
- package/src/generation-core/opening-mix.ts +69 -5
- package/src/generation-core/patterns.ts +7 -0
- package/src/generation-core/plan-wire.ts +23 -5
- package/src/generation-core/public-api.ts +3 -0
- package/src/generation-core/site-build-run.ts +11 -0
- package/src/generation-core/site-plan.model.ts +6 -0
- package/src/generation-core/site-spec.generated.ts +472 -166
- package/src/generation-core/type-led.ts +4 -2
- package/src/generation-core/validate-site-plan.ts +4 -1
- package/src/harness-core/business-types.ts +31 -0
- package/src/harness-core/harness-spec.generated.ts +564 -56
- package/src/harness-core/motion.ts +19 -2
- package/src/harness-core/popup-stance.ts +56 -3
- package/src/harness-core/run-compose-context.ts +32 -6
- package/src/harness-core/starting-design.ts +15 -7
- package/styles/iox-design.css +35 -0
- package/styles/iox-forms.css +53 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { MenuTrait } from '@vectoriox/iox-ui/design-core';
|
|
2
|
+
|
|
3
|
+
import { ComposedSite, parseSampleImageRef } from './compose-site';
|
|
4
|
+
import { MENU_SHELF_RULES, NavPage, NavRole } from './nav-shape';
|
|
5
|
+
import { SerializedNode, walkSerialized } from './serialized-node';
|
|
6
|
+
import { ContentTypePlan, DataSourcePlan, PlanDataSourceMode, PlanDataSourceType, roleField, ShopResource } from './site-plan.model';
|
|
7
|
+
import { ShopSourceRole, shopSourceAliases } from './shop-plan';
|
|
8
|
+
import { pictureItemsOf } from './stock-photos';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The menu's shelves and their pictures (header-ingredients-plan.md HI2). A `pictures` menu shows a card for each of the
|
|
12
|
+
* site's main collections and a `words-card` menu one card beside its MORE row (`planNavShape`, nav-shape.ts). A card's
|
|
13
|
+
* picture is NEVER invented: the composer stamps it empty and the build fills it — once the site's own and stock pictures
|
|
14
|
+
* are placed — from the collection's first item that has a real picture, else the first picture on the card's page; a
|
|
15
|
+
* card with neither is taken away, and a shelf left with too few cards draws the page names (plan §6). Pure.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** One collection a menu may show a card for: its page and where its items' pictures are. */
|
|
19
|
+
export interface MenuCollection extends NavPage {
|
|
20
|
+
/** The items (a content type, or the shop's products) and the field holding each one's picture. */
|
|
21
|
+
readonly items: string;
|
|
22
|
+
readonly field: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const SHOP_PICTURE_FIELD = 'mainImage';
|
|
26
|
+
|
|
27
|
+
/** As much of a plan as the shelves read (a studio with no Site Plan has no sources: no collections). */
|
|
28
|
+
export interface ShelfPlan {
|
|
29
|
+
readonly pages?: ReadonlyArray<{ readonly name: string; readonly route: string; readonly inNav?: boolean; readonly isHome?: boolean; readonly sections?: ReadonlyArray<{ readonly binding?: string }> }>;
|
|
30
|
+
readonly dataSources?: ReadonlyArray<DataSourcePlan>;
|
|
31
|
+
readonly contentTypes?: ReadonlyArray<Pick<ContentTypePlan, 'name' | 'roles'>>;
|
|
32
|
+
readonly shop?: unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The site's main collections, in the navigation's order: each page in the navigation (not Home) whose sections list a
|
|
37
|
+
* content type that has pictures (an `image` role) or the shop's products — the page a visitor opens to see them. ONE list
|
|
38
|
+
* for `checkHeader` (how many there are), the composer (the cards it stamps) and `dressMenuPictures` (where their
|
|
39
|
+
* pictures come from).
|
|
40
|
+
*/
|
|
41
|
+
export function menuCollectionsOfPlan(plan: ShelfPlan): MenuCollection[] {
|
|
42
|
+
const sources = new Map((plan.dataSources ?? []).map(s => [s.alias, s]));
|
|
43
|
+
const shopList = plan.shop ? shopSourceAliases(plan)[ShopSourceRole.List] : undefined;
|
|
44
|
+
const out: MenuCollection[] = [];
|
|
45
|
+
for (const page of plan.pages ?? []) {
|
|
46
|
+
if (!page.inNav || page.isHome || page.route === '/') continue;
|
|
47
|
+
for (const section of page.sections ?? []) {
|
|
48
|
+
const source = section.binding ? sources.get(section.binding) : undefined;
|
|
49
|
+
if (!source) continue;
|
|
50
|
+
if (source.alias === shopList) {
|
|
51
|
+
out.push({ label: page.name, route: page.route, items: ShopResource.Products, field: SHOP_PICTURE_FIELD });
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
if (source.type !== PlanDataSourceType.Cms || source.mode !== PlanDataSourceMode.Query) continue;
|
|
55
|
+
const type = (plan.contentTypes ?? []).find(t => t.name === source.contentType);
|
|
56
|
+
const field = roleField(type, 'image');
|
|
57
|
+
if (!type || !field) continue;
|
|
58
|
+
out.push({ label: page.name, route: page.route, items: type.name, field });
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** A value that IS a picture a visitor can see: an address, never a bundled sample's `{sampleImage:k}` or nothing. */
|
|
66
|
+
function realPicture(value: unknown): string | null {
|
|
67
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
68
|
+
return typeof first === 'string' && first.trim() && parseSampleImageRef(first) === null ? first : null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The first picture written on a page (an Image with an address and no binding), in reading order. */
|
|
72
|
+
function pagePicture(page: ComposedSite['pages'][number] | undefined): string | null {
|
|
73
|
+
let found: string | null = null;
|
|
74
|
+
if (page) walkSerialized(page.layout, n => {
|
|
75
|
+
if (!found && n.type === 'Image' && !n.bindings?.length) found = realPicture(n.props?.['src']);
|
|
76
|
+
});
|
|
77
|
+
return found;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Where a card's picture comes from: its collection's first item with a real picture, else its page's first picture. */
|
|
81
|
+
export function menuCardPicture(site: Pick<ComposedSite, 'pages' | 'items'> & Partial<Pick<ComposedSite, 'shop'>>, collections: ReadonlyArray<MenuCollection>, route: string): string | null {
|
|
82
|
+
const collection = collections.find(c => c.route === route);
|
|
83
|
+
const items = collection ? pictureItemsOf(site)[collection.items] ?? [] : [];
|
|
84
|
+
for (const item of items) {
|
|
85
|
+
const url = realPicture(item[collection!.field]);
|
|
86
|
+
if (url) return url;
|
|
87
|
+
}
|
|
88
|
+
return pagePicture(site.pages.find(p => p.route.path === route));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Fill the menu's cards with the site's own or stock pictures (`menuCardPicture`) — run by the build after every picture
|
|
93
|
+
* is placed (iox-cms `dressWithStock`). A card with no picture is taken away; a `pictures` shelf left with fewer cards
|
|
94
|
+
* than the contract's least becomes the page names alone (the shelf's list kept, the menu's trait cleared); a MORE row
|
|
95
|
+
* left empty goes. Returns how many cards were filled. Mutates `site.globals`.
|
|
96
|
+
*/
|
|
97
|
+
export function dressMenuPictures(
|
|
98
|
+
site: Pick<ComposedSite, 'globals' | 'pages' | 'items'> & Partial<Pick<ComposedSite, 'shop'>>,
|
|
99
|
+
plan: ShelfPlan,
|
|
100
|
+
): number {
|
|
101
|
+
const collections = menuCollectionsOfPlan(plan);
|
|
102
|
+
let filled = 0;
|
|
103
|
+
const drawers: SerializedNode[] = [];
|
|
104
|
+
walkSerialized(site.globals, n => { if (n.role === NavRole.Drawer) drawers.push(n); });
|
|
105
|
+
for (const dr of drawers) {
|
|
106
|
+
walkSerialized([dr], parent => {
|
|
107
|
+
const kept = (parent.children ?? []).filter(card => {
|
|
108
|
+
if (card.role !== NavRole.DrawerCard) return true;
|
|
109
|
+
const picture = (card.children ?? []).find(c => c.role === NavRole.DrawerPicture);
|
|
110
|
+
if (!picture) return false;
|
|
111
|
+
const url = realPicture(picture.props?.['src']) ?? menuCardPicture(site, collections, String(card.props?.['pageRoute'] ?? ''));
|
|
112
|
+
if (!url) return false;
|
|
113
|
+
picture.props = { ...picture.props, src: url, alt: '' };
|
|
114
|
+
filled++;
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
if (parent.children) parent.children = kept;
|
|
118
|
+
});
|
|
119
|
+
unshelve(dr, MENU_SHELF_RULES.menuPicturesMin ?? 1);
|
|
120
|
+
}
|
|
121
|
+
return filled;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** A shelf the pictures did not fill: a `pictures` row with too few cards is the page names alone; an empty MORE row goes. */
|
|
125
|
+
function unshelve(dr: SerializedNode, least: number): void {
|
|
126
|
+
const kids = dr.children ?? [];
|
|
127
|
+
dr.children = kids.flatMap(child => {
|
|
128
|
+
if (child.role === NavRole.DrawerShelf) {
|
|
129
|
+
const cards = (child.children ?? []).find(c => c.role === NavRole.DrawerPictures);
|
|
130
|
+
if ((cards?.children?.length ?? 0) >= Math.max(least, 1)) return [child];
|
|
131
|
+
const list = (child.children ?? []).find(c => c.role === NavRole.DrawerLinks);
|
|
132
|
+
if (dr.props) delete dr.props[MenuTrait.Shows];
|
|
133
|
+
return list ? [list] : [];
|
|
134
|
+
}
|
|
135
|
+
if (child.role === NavRole.DrawerMore && !(child.children ?? []).length) return [];
|
|
136
|
+
return [child];
|
|
137
|
+
});
|
|
138
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AccountRole, ShopRole } from '@vectoriox/iox-ui/composite-core';
|
|
2
2
|
import { commerceLanguage } from '@vectoriox/iox-ui/commerce-core';
|
|
3
|
-
import { LinkType, MenuButtonKind, menuButtonOf, menuButtonProps, menuDialogProps, MenuLook, MenuTrait } from '@vectoriox/iox-ui/design-core';
|
|
3
|
+
import { LinkType, MenuButtonKind, menuButtonOf, menuButtonProps, menuDialogProps, MenuLook, MenuShows, menuShowsOf, MenuTrait } from '@vectoriox/iox-ui/design-core';
|
|
4
4
|
|
|
5
5
|
import { PatternGlobalPosition } from './patterns';
|
|
6
6
|
import { createSerializedNode, SerializedNode, walkSerialized } from './serialized-node';
|
|
7
|
+
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* The phone shapes of a navigation bar (complex-components plan CC1, §7a + R1; boards 1–3). ONE pure tree
|
|
@@ -54,6 +55,19 @@ export enum NavRole {
|
|
|
54
55
|
/** HI1: one of the two equal sides of a header whose name is centred (`between`, `centred` behind a menu): its parts
|
|
55
56
|
* are the header's own, hidden on a phone as the root's are. */
|
|
56
57
|
Cell = 'nav.cell',
|
|
58
|
+
/** HI2 shelves (`MenuShows`): the row holding the pictured cards and the page names side by side (`pictures`). */
|
|
59
|
+
DrawerShelf = 'nav.drawer-shelf',
|
|
60
|
+
/** HI2: the pictured cards of the site's main collections (`pictures`). */
|
|
61
|
+
DrawerPictures = 'nav.drawer-pictures',
|
|
62
|
+
/** HI2: one card — a Linked container to its page, holding its picture (and, on the shelf, its name). */
|
|
63
|
+
DrawerCard = 'nav.drawer-card',
|
|
64
|
+
/** HI2: a card's picture — empty when stamped; the build fills it from the site's own or stock pictures
|
|
65
|
+
* (`dressMenuPictures`), else the card is taken away. Never an invented picture. */
|
|
66
|
+
DrawerPicture = 'nav.drawer-picture',
|
|
67
|
+
/** HI2: the words-card's MORE row: the rest of the pages, small, and the card beside them. */
|
|
68
|
+
DrawerMore = 'nav.drawer-more',
|
|
69
|
+
/** HI2: the MORE row's caption and its small page names. */
|
|
70
|
+
DrawerMoreLinks = 'nav.drawer-more-links',
|
|
57
71
|
}
|
|
58
72
|
|
|
59
73
|
/** HI-D15: the side a header's menu button sits on. */
|
|
@@ -95,6 +109,10 @@ export interface NavShapeOptions {
|
|
|
95
109
|
* traits on the drawer, the menu button and the drawer's Close; a default writes nothing (R-H4). Absent: the parts
|
|
96
110
|
* keep what they have. */
|
|
97
111
|
look?: Partial<MenuLook>;
|
|
112
|
+
/** HI2 shelves: the site's main collections (a pictured content type's list page, the shop's), in the navigation's
|
|
113
|
+
* order — the pages a `pictures` shelf shows a card for and the `words-card` card links to. Their pictures are the
|
|
114
|
+
* build's to fill (`dressMenuPictures`). Absent: none (a `pictures` menu draws the page names). */
|
|
115
|
+
collections?: ReadonlyArray<NavPage>;
|
|
98
116
|
/** The site's language, for the words the menu's parts show and are named by (`menuWords`). Default English. */
|
|
99
117
|
locale?: string;
|
|
100
118
|
}
|
|
@@ -118,6 +136,7 @@ const BUTTON = 'ButtonBlock';
|
|
|
118
136
|
const ICON = 'Icon';
|
|
119
137
|
const TEXT = 'Text';
|
|
120
138
|
const HEADING = 'Heading';
|
|
139
|
+
const IMAGE = 'Image';
|
|
121
140
|
const NAV_STYLE = 'nav';
|
|
122
141
|
const DISPLAY = 'display';
|
|
123
142
|
const NONE = 'none';
|
|
@@ -195,6 +214,12 @@ export const NAV_PART_LABELS: Readonly<Record<string, string>> = {
|
|
|
195
214
|
[NavRole.Pinned]: 'Pinned pages',
|
|
196
215
|
[NavRole.Actions]: 'Actions',
|
|
197
216
|
[NavRole.Cell]: 'Side',
|
|
217
|
+
[NavRole.DrawerShelf]: 'Menu shelf',
|
|
218
|
+
[NavRole.DrawerPictures]: 'Menu pictures',
|
|
219
|
+
[NavRole.DrawerCard]: 'Menu card',
|
|
220
|
+
[NavRole.DrawerPicture]: 'Menu picture',
|
|
221
|
+
[NavRole.DrawerMore]: 'More pages',
|
|
222
|
+
[NavRole.DrawerMoreLinks]: 'More links',
|
|
198
223
|
};
|
|
199
224
|
|
|
200
225
|
/** Phosphor icons for the bar's items by route — there is no page icon field (Q6), so the bar starts here and
|
|
@@ -444,7 +469,7 @@ function pageLink(kit: Kit, suffix: string, page: NavPage, role: NavRole, lay: R
|
|
|
444
469
|
return part(kit, suffix, LINK, { label: page.label, linkType: LinkType.Page, pageRoute: page.route }, 'link', role, lay);
|
|
445
470
|
}
|
|
446
471
|
|
|
447
|
-
function drawer(kit: Kit, root: SerializedNode, pages: NavPage[], at: string, words: MenuWords): SerializedNode {
|
|
472
|
+
function drawer(kit: Kit, root: SerializedNode, pages: NavPage[], at: string, words: MenuWords, shows: MenuShows = MenuShows.Links, collections: ReadonlyArray<NavPage> = []): SerializedNode {
|
|
448
473
|
const dr = part(kit, 'drawer', DIALOG, {
|
|
449
474
|
placement: 'end', closeOnBackdrop: true, showCloseButton: false, ariaLabel: words.menu, closeAbove: at,
|
|
450
475
|
}, 'dialog', NavRole.Drawer, { width: '86vw', maxWidth: '360px', display: 'flex', flexDirection: 'column', gap: '20px' });
|
|
@@ -455,15 +480,7 @@ function drawer(kit: Kit, root: SerializedNode, pages: NavPage[], at: string, wo
|
|
|
455
480
|
close.children = [iconNode(kit, 'drawer-close-icon', CLOSE_ICON)];
|
|
456
481
|
close.interactions = [clickTo(kit, 'drawer-close', NavDialogAction.Close, dr.id)];
|
|
457
482
|
head.children = [part(kit, 'drawer-brand', HEADING, { content: brandWords, level: 'h3' }, 'h3'), close];
|
|
458
|
-
|
|
459
|
-
{ display: 'flex', flexDirection: 'column', gap: '4px' });
|
|
460
|
-
// Board 1: every page, Home first, at lead size (on each Link: a Link's own baseline font size would
|
|
461
|
-
// beat one inherited from the list). The links rest at the body weight and the CURRENT page reads by its ink and
|
|
462
|
-
// weight (no line since 2026-11-22) — the shared CSS keys that on the list's role (iox-design.css), so no Link holds
|
|
463
|
-
// a literal over its element style.
|
|
464
|
-
list.children = withHome(root, pages, words).map((p, i) => pageLink(kit, `drawer-link-${i}`, p, NavRole.DrawerLink,
|
|
465
|
-
{ display: 'flex', alignItems: 'center', minHeight: '48px', fontSize: 'var(--iox-size-lead)' }));
|
|
466
|
-
dr.children = [head, list];
|
|
483
|
+
dr.children = [head, ...menuShelf(kit, root, pages, shows, collections, words)];
|
|
467
484
|
const cta = find([root], NavRole.Cta);
|
|
468
485
|
if (cta) {
|
|
469
486
|
const copy = JSON.parse(JSON.stringify(cta)) as SerializedNode;
|
|
@@ -482,7 +499,7 @@ function drawer(kit: Kit, root: SerializedNode, pages: NavPage[], at: string, wo
|
|
|
482
499
|
|
|
483
500
|
/** The menu's own traits (on the drawer); its button's trait is on the menu button and the drawer's Close. */
|
|
484
501
|
const MENU_DIALOG_TRAITS: ReadonlyArray<[keyof MenuLook, MenuTrait]> = [
|
|
485
|
-
['form', MenuTrait.Form], ['reveal', MenuTrait.Reveal], ['hover', MenuTrait.Hover], ['phone', MenuTrait.Phone],
|
|
502
|
+
['form', MenuTrait.Form], ['reveal', MenuTrait.Reveal], ['hover', MenuTrait.Hover], ['phone', MenuTrait.Phone], ['shows', MenuTrait.Shows],
|
|
486
503
|
];
|
|
487
504
|
|
|
488
505
|
/** Write the look's menu traits on the drawer: each one the look names is replaced (a default writes nothing — R-H4);
|
|
@@ -493,6 +510,106 @@ function dressDrawer(dr: SerializedNode, look: Partial<MenuLook>): void {
|
|
|
493
510
|
dr.props = { ...props, ...menuDialogProps(look) };
|
|
494
511
|
}
|
|
495
512
|
|
|
513
|
+
// ── HI2: the menu's shelves (what it shows) ─────────────────────────────────────────────────
|
|
514
|
+
|
|
515
|
+
/** The contract's shelf rules (`HEADER.rules`): the least and most pictured cards a `pictures` menu shows, and how many
|
|
516
|
+
* page names a `words-card` menu shows large. */
|
|
517
|
+
export const MENU_SHELF_RULES = SPEC_SITE_LAYOUT.header.rules as unknown as Readonly<{ menuPicturesMin?: number; menuPicturesMax?: number; menuBigCount?: number }>;
|
|
518
|
+
const SHELF_RULES = MENU_SHELF_RULES;
|
|
519
|
+
|
|
520
|
+
/** What a menu draws for what it was asked to show: `pictures` needs the contract's least number of collections to show
|
|
521
|
+
* (`menuPicturesMin` — Vonder's two category tiles), else it is the page names (plan §6). ONE rule with `checkHeader`. */
|
|
522
|
+
export function drawnMenuShows(shows: MenuShows | `${MenuShows}` | undefined, collections: ReadonlyArray<NavPage> = [],
|
|
523
|
+
least = MENU_SHELF_RULES.menuPicturesMin ?? 1): MenuShows {
|
|
524
|
+
const asked = menuShowsOf(shows);
|
|
525
|
+
return asked === MenuShows.Pictures && collections.length < least ? MenuShows.Links : asked;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/** A page name in a shelf menu, LARGE: the look's display link (font, weight, leading, tracking — `link-display`); its
|
|
529
|
+
* size is the menu's form's (iox-design.css "the menu's shelves"), so no Link holds a literal size. */
|
|
530
|
+
function bigLink(kit: Kit, suffix: string, page: NavPage): SerializedNode {
|
|
531
|
+
return part(kit, suffix, LINK, { label: page.label, linkType: LinkType.Page, pageRoute: page.route }, 'link-display', NavRole.DrawerLink,
|
|
532
|
+
{ display: 'flex', alignItems: 'center', minHeight: '48px', width: 'auto' });
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** A card: a Linked container to its page holding its picture — empty until the build fills it (`dressMenuPictures`),
|
|
536
|
+
* decorative (`alt` empty) because the card is named by its page (its label, or its `ariaLabel`). */
|
|
537
|
+
function shelfCard(kit: Kit, suffix: string, page: NavPage, labelled: boolean, aspectRatio: string, lay: Record<string, unknown>): SerializedNode {
|
|
538
|
+
const card = part(kit, suffix, LINKED, { linkType: LinkType.Page, pageRoute: page.route, target: '_self', ...(labelled ? {} : { ariaLabel: page.label }) },
|
|
539
|
+
'box', NavRole.DrawerCard, { display: 'flex', flexDirection: 'column', gap: '8px', minWidth: '0px', textDecoration: 'none', ...lay });
|
|
540
|
+
const picture = part(kit, `${suffix}-picture`, IMAGE, { src: '', alt: '' }, 'media', NavRole.DrawerPicture, { aspectRatio, height: 'auto' });
|
|
541
|
+
card.children = [picture];
|
|
542
|
+
if (labelled) card.children.push(part(kit, `${suffix}-label`, TEXT, { content: page.label, tag: 'span' }, 'eyebrow', null));
|
|
543
|
+
return card;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Lay the drawer's pages out as the menu shows them (HI2, board v2 "menu contents"; the readings cited in the plan's "HI2
|
|
548
|
+
* as built"): `big` — every page name in the display face (Flyward, Hotel Aurelia); `words-card` — the first
|
|
549
|
+
* `menuBigCount` large, then a MORE row: its caption, the rest small, and one card (Savvia's "MÁS" row and reel tile);
|
|
550
|
+
* `pictures` — a shelf: the collections' pictured cards at the start, the page names at the end (Vonder's top panel).
|
|
551
|
+
* The pages arrive WITH the menu (D1 — one entrance per container): no part has its own entrance. Pure; the drawer's
|
|
552
|
+
* head and its call to action are kept as they are.
|
|
553
|
+
*/
|
|
554
|
+
function menuShelf(kit: Kit, root: SerializedNode, pages: NavPage[], shows: MenuShows, collections: ReadonlyArray<NavPage>, words: MenuWords): SerializedNode[] {
|
|
555
|
+
const all = withHome(root, pages, words);
|
|
556
|
+
const list = part(kit, 'drawer-links', CONTAINER, {}, 'box', NavRole.DrawerLinks, { display: 'flex', flexDirection: 'column', gap: '4px' });
|
|
557
|
+
const plain = (p: NavPage, i: number, lay: Record<string, unknown>) => pageLink(kit, `drawer-link-${i}`, p, NavRole.DrawerLink, lay);
|
|
558
|
+
if (shows === MenuShows.Links) {
|
|
559
|
+
// Board 1: every page, Home first, at lead size (on each Link: a Link's own baseline font size would
|
|
560
|
+
// beat one inherited from the list). The links rest at the body weight and the CURRENT page reads by its ink and
|
|
561
|
+
// weight (no line since 2026-11-22) — the shared CSS keys that on the list's role (iox-design.css), so no Link holds
|
|
562
|
+
// a literal over its element style.
|
|
563
|
+
list.children = all.map((p, i) => plain(p, i, { display: 'flex', alignItems: 'center', minHeight: '48px', fontSize: 'var(--iox-size-lead)' }));
|
|
564
|
+
return [list];
|
|
565
|
+
}
|
|
566
|
+
if (shows === MenuShows.Big) {
|
|
567
|
+
list.children = all.map((p, i) => bigLink(kit, `drawer-link-${i}`, p));
|
|
568
|
+
return [list];
|
|
569
|
+
}
|
|
570
|
+
if (shows === MenuShows.WordsCard) {
|
|
571
|
+
const count = SHELF_RULES.menuBigCount ?? all.length;
|
|
572
|
+
list.children = all.slice(0, count).map((p, i) => bigLink(kit, `drawer-link-${i}`, p));
|
|
573
|
+
const rest = all.slice(count);
|
|
574
|
+
const more = part(kit, 'drawer-more', CONTAINER, {}, 'box', NavRole.DrawerMore, {
|
|
575
|
+
display: 'flex', flexWrap: 'wrap', gap: '16px 24px', alignItems: 'flex-start',
|
|
576
|
+
borderWidth: 'var(--iox-border-width) 0 0', borderStyle: 'solid', borderColor: 'var(--iox-divider-color)', padding: '16px 0 0',
|
|
577
|
+
});
|
|
578
|
+
more.children = [];
|
|
579
|
+
if (rest.length) {
|
|
580
|
+
const column = part(kit, 'drawer-more-links', CONTAINER, {}, 'box', NavRole.DrawerMoreLinks,
|
|
581
|
+
{ display: 'flex', flexDirection: 'column', gap: '2px', flexGrow: '1', flexShrink: '1', flexBasis: '140px', minWidth: '0px' });
|
|
582
|
+
column.children = [
|
|
583
|
+
part(kit, 'drawer-more-caption', TEXT, { content: words.more, tag: 'span' }, 'eyebrow', null),
|
|
584
|
+
...rest.map((p, i) => plain(p, count + i, { display: 'flex', alignItems: 'center', minHeight: '32px', width: 'auto' })),
|
|
585
|
+
];
|
|
586
|
+
more.children.push(column);
|
|
587
|
+
}
|
|
588
|
+
if (collections.length) more.children.push(shelfCard(kit, 'drawer-card-0', collections[0], false, '16 / 9', { flexGrow: '1', flexShrink: '1', flexBasis: '160px' }));
|
|
589
|
+
return more.children.length ? [list, more] : [list];
|
|
590
|
+
}
|
|
591
|
+
list.children = all.map((p, i) => plain(p, i, { display: 'flex', alignItems: 'center', minHeight: '40px' }));
|
|
592
|
+
Object.assign(list.styleProps, { flexGrow: '1', flexShrink: '1', flexBasis: '200px', minWidth: '0px' });
|
|
593
|
+
const row = part(kit, 'drawer-shelf', CONTAINER, {}, 'box', NavRole.DrawerShelf, { display: 'flex', flexWrap: 'wrap', gap: '24px 40px', alignItems: 'flex-start' });
|
|
594
|
+
const cards = part(kit, 'drawer-pictures', CONTAINER, {}, 'box', NavRole.DrawerPictures,
|
|
595
|
+
{ display: 'flex', gap: '16px', flexGrow: '2', flexShrink: '1', flexBasis: '320px', minWidth: '0px' });
|
|
596
|
+
cards.children = collections.slice(0, SHELF_RULES.menuPicturesMax ?? collections.length)
|
|
597
|
+
.map((c, i) => shelfCard(kit, `drawer-card-${i}`, c, true, '4 / 3', { flexGrow: '1', flexShrink: '1', flexBasis: '0px' }));
|
|
598
|
+
row.children = [cards, list];
|
|
599
|
+
return [row];
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/** What a menu shows, on a drawer that already exists (the Header studio's Apply): its pages laid out again, after its head;
|
|
603
|
+
* the rest of it (the head, the call to action) kept. */
|
|
604
|
+
function shelveMenu(kit: Kit, dr: SerializedNode, root: SerializedNode, pages: NavPage[], shows: MenuShows, collections: ReadonlyArray<NavPage>, words: MenuWords): void {
|
|
605
|
+
const kids = (dr.children ?? []).filter(c => !SHELF_ROLES.has(c.role as NavRole));
|
|
606
|
+
kids.splice(kids.findIndex(c => c.role === NavRole.DrawerHead) + 1, 0, ...menuShelf(kit, root, pages, shows, collections, words));
|
|
607
|
+
dr.children = kids;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** The drawer's children a shelf lays out (what `shelveMenu` replaces). */
|
|
611
|
+
const SHELF_ROLES: ReadonlySet<NavRole> = new Set([NavRole.DrawerLinks, NavRole.DrawerShelf, NavRole.DrawerMore]);
|
|
612
|
+
|
|
496
613
|
/** A `word` button is as wide as its word (never narrower than the icon button it replaces). */
|
|
497
614
|
const WORD_BUTTON_LAY = { width: 'auto', minWidth: '48px' };
|
|
498
615
|
|
|
@@ -696,7 +813,10 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
|
|
|
696
813
|
const topIndex = out.findIndex(g => g.role === NavRole.Drawer);
|
|
697
814
|
if (!dr && topIndex >= 0) dr = out.splice(topIndex, 1)[0];
|
|
698
815
|
if (dr) { delete dr.isGlobal; delete dr.globalPosition; }
|
|
699
|
-
|
|
816
|
+
// HI2: what the menu shows, as the site can carry it (`drawnMenuShows`) — a drawer built now is laid out for it.
|
|
817
|
+
const shows = options.look?.shows !== undefined ? drawnMenuShows(options.look.shows, options.collections) : undefined;
|
|
818
|
+
const built = wantDrawer && !dr;
|
|
819
|
+
if (built) dr = drawer(kit, root, pages, at, words, shows, options.collections);
|
|
700
820
|
if (!wantDrawer) dr = null;
|
|
701
821
|
// A drawer reached at every width never closes itself above a breakpoint.
|
|
702
822
|
if (dr) dr.props = { ...dr.props, closeAbove: everyWidth ? '' : at };
|
|
@@ -731,8 +851,11 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
|
|
|
731
851
|
}
|
|
732
852
|
placeMenu(root, menu, (options.menuSide as MenuSide | undefined) ?? null, was);
|
|
733
853
|
}
|
|
734
|
-
// HI2a: the menu's look, when one is asked (the composer's header recipe; the Header studio later).
|
|
735
|
-
|
|
854
|
+
// HI2a: the menu's look, when one is asked (the composer's header recipe; the Header studio later). HI2: what it shows
|
|
855
|
+
// is drawn as the site can carry it (`drawnMenuShows`), and the drawer's pages are laid out for it.
|
|
856
|
+
const look = shows !== undefined ? { ...options.look, shows } : options.look;
|
|
857
|
+
if (look) dressMenu(kit, dr, menu, look, words);
|
|
858
|
+
if (dr && !built && shows !== undefined) shelveMenu(kit, dr, root, pages, shows, options.collections ?? [], words);
|
|
736
859
|
if (dr && shape === NavShape.Drawer) kids.push(dr);
|
|
737
860
|
if (dr && shape === NavShape.Both) {
|
|
738
861
|
dr.isGlobal = true;
|
|
@@ -43,11 +43,25 @@ const ROW_ROLES: Readonly<Record<OpeningIngredient, ReadonlyArray<string>>> = {
|
|
|
43
43
|
/** The props that are the owner's CONTENT (words, pictures, a film, a form's identity) — never a sign of a hand edit. */
|
|
44
44
|
const CONTENT_PROPS: ReadonlyArray<string> = [OPENING_MIX_PROP, 'src', 'poster', 'frames', 'formId', 'name'];
|
|
45
45
|
|
|
46
|
+
/** A title the composer sets to its words (type scale `openingDisplaySize`, a display name's fit) wears a size the words
|
|
47
|
+
* decide: re-typed words are content, so that size is never a sign of a hand edit. A title at the look's token is read. */
|
|
48
|
+
const WORD_SIZED = /^(clamp|min)\(/;
|
|
49
|
+
function withoutWordSize(n: SerializedNode): SerializedNode {
|
|
50
|
+
if (n.role !== OpeningRole.Title || !WORD_SIZED.test(String(n.styleProps?.['fontSize'] ?? ''))) return n;
|
|
51
|
+
const { fontSize: _size, ...styleProps } = n.styleProps;
|
|
52
|
+
const mobile = (n.responsive as Record<string, { styleProps?: Record<string, unknown> }> | undefined)?.['mobile'];
|
|
53
|
+
const responsive = mobile?.styleProps && 'fontSize' in mobile.styleProps
|
|
54
|
+
? { ...n.responsive, mobile: { ...mobile, styleProps: Object.fromEntries(Object.entries(mobile.styleProps).filter(([k]) => k !== 'fontSize')) } }
|
|
55
|
+
: n.responsive;
|
|
56
|
+
return { ...n, styleProps, ...(responsive ? { responsive } : {}) } as SerializedNode;
|
|
57
|
+
}
|
|
58
|
+
|
|
46
59
|
/** A part's shape without its content: what it is made of and what it wears. */
|
|
47
60
|
function partShape(node: SerializedNode): string {
|
|
48
|
-
const strip = (n: SerializedNode): SerializedNode =>
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
const strip = (n: SerializedNode): SerializedNode => {
|
|
62
|
+
const own = withoutWordSize(n);
|
|
63
|
+
return { ...own, props: Object.fromEntries(Object.entries(own.props ?? {}).filter(([k]) => !CONTENT_PROPS.includes(k))), children: (own.children ?? []).map(strip) };
|
|
64
|
+
};
|
|
51
65
|
return headerShape(strip(node));
|
|
52
66
|
}
|
|
53
67
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DesignChoices, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { DesignChoices, designTokenRows, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
3
|
import { LAYOUT_INSET } from './layout-column';
|
|
4
4
|
import { GenerationTier } from './site-plan.model';
|
|
@@ -48,6 +48,8 @@ interface OpeningTable {
|
|
|
48
48
|
wordsNeverCut: boolean; phoneInsetPx: readonly [number, number]; slowZoomMinS: number; badgeOwnersOnly: boolean; neverHoldsScroll: boolean;
|
|
49
49
|
/** AW9 `motion.dissolve`: the picture's last scale, the words' last scale, and the share of the exit the words take. */
|
|
50
50
|
dissolve: { grow: number; wordsGrow: number; wordsUntil: number };
|
|
51
|
+
/** Type scale: the opening's headline set to its words (`openingDisplaySize`). */
|
|
52
|
+
display: { capBody: number; lines: number; phoneLines: number; roomPx: number; fill: number; screenShare: number; phoneScreenShare: number };
|
|
51
53
|
};
|
|
52
54
|
tiers: Readonly<Record<string, 'all' | 'pro'>>;
|
|
53
55
|
references: ReadonlyArray<{ id: string; after: string; added: string; mix: Partial<Record<string, string | ReadonlyArray<string>>> }>;
|
|
@@ -523,6 +525,62 @@ function nameFits(ctx: OpeningContext, oneLine: boolean): boolean {
|
|
|
523
525
|
return laptopOk && (PHONE_PX - 2 * PHONE_SIDE_PX) / longest >= MIN_PHONE_DISPLAY_PX;
|
|
524
526
|
}
|
|
525
527
|
|
|
528
|
+
/** The laptop and phone the opening's display is set for (the reference cards' screens). */
|
|
529
|
+
const LAPTOP_SCREEN_H = 900;
|
|
530
|
+
const PHONE_SCREEN_H = 844;
|
|
531
|
+
/** The phone's frame padding beside the words (FRAME_PAD at 375) and a panel's padding when the look names none (px). */
|
|
532
|
+
const PHONE_FRAME_PX = 20;
|
|
533
|
+
const PANEL_PAD_PX = 32;
|
|
534
|
+
const PX = /^(\d+(?:\.\d+)?)px$/;
|
|
535
|
+
const CLAMP_PX = /^clamp\((\d+(?:\.\d+)?)px,.*?,\s*(\d+(?:\.\d+)?)px\)$/;
|
|
536
|
+
|
|
537
|
+
/** The opening's headline set to its words (contract OPENING.rules.display): the size on each screen and its CSS. */
|
|
538
|
+
export interface OpeningDisplaySize {
|
|
539
|
+
laptopPx: number;
|
|
540
|
+
phonePx: number;
|
|
541
|
+
fontSize: string;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Type scale (the 2026-11-28 reference baseline, gap #3): the opening's headline, set to ITS words on the look's own face
|
|
546
|
+
* rather than the look's one display size — so a short headline stands as the references' do (9–22× the body) and a long
|
|
547
|
+
* one stays inside its lines. The largest size that keeps (contract `rules.display`): ≤ `capBody` × body; ≤ `lines` lines
|
|
548
|
+
* across the words' room (a wrapped line filled to `fill`); the longest word on one line; the lines within `screenShare`
|
|
549
|
+
* of the screen — on a 1440 × 900 laptop, and with the phone's own lines and share on a 375 × 844 phone; fluid between
|
|
550
|
+
* (`cqi`, as the look's display token: the builder canvas reads its simulated width). Never below the look's display token
|
|
551
|
+
* on either screen: null when the words would stand no larger than it (the token stays). `panel` — the words stand in a
|
|
552
|
+
* scrim panel (its padding leaves less room). Pure.
|
|
553
|
+
*/
|
|
554
|
+
export function openingDisplaySize(ctx: OpeningContext, panel: boolean): OpeningDisplaySize | null {
|
|
555
|
+
const R = O.rules.display;
|
|
556
|
+
const { line, longest } = nameEm(ctx);
|
|
557
|
+
if (!line || !longest) return null;
|
|
558
|
+
const rows = new Map(designTokenRows(ctx.design ?? resolveDesignChoices({})).map(r => [r.name, r.value]));
|
|
559
|
+
const body = Number(PX.exec(rows.get('size-body') ?? '')?.[1] ?? 16);
|
|
560
|
+
const token = CLAMP_PX.exec(rows.get('size-display') ?? '');
|
|
561
|
+
if (!token) return null;
|
|
562
|
+
const [tokenPhone, tokenLaptop] = [Number(token[1]), Number(token[2])];
|
|
563
|
+
const pad = panel ? Number(PX.exec(rows.get('space-pad') ?? '')?.[1] ?? PANEL_PAD_PX) : 0;
|
|
564
|
+
/** The largest size that keeps the words within `lines` lines of `room`, their longest word on one, the lines within
|
|
565
|
+
* `screen` px — never above the cap. */
|
|
566
|
+
const fitted = (room: number, lines: number, screen: number): number => {
|
|
567
|
+
let size = 0;
|
|
568
|
+
for (let n = 1; n <= lines; n++) {
|
|
569
|
+
const across = (room * n * (n === 1 ? FIT : R.fill)) / line;
|
|
570
|
+
size = Math.max(size, Math.min(R.capBody * body, across, (room * FIT) / longest, screen / n));
|
|
571
|
+
}
|
|
572
|
+
return Math.floor(size);
|
|
573
|
+
};
|
|
574
|
+
const laptop = fitted(Math.min(R.roomPx, LAPTOP_PX - 2 * LAPTOP_SIDE_PX) - 2 * pad, R.lines, R.screenShare * LAPTOP_SCREEN_H);
|
|
575
|
+
const phone = Math.min(laptop, fitted(PHONE_PX - 2 * PHONE_FRAME_PX - 2 * pad, R.phoneLines, R.phoneScreenShare * PHONE_SCREEN_H));
|
|
576
|
+
if (laptop <= tokenLaptop) return null;
|
|
577
|
+
// Never smaller than the token on a phone either: where the words would want less, the token's own size stands.
|
|
578
|
+
const phonePx = Math.max(phone, Math.min(tokenPhone, laptop));
|
|
579
|
+
const slope = ((laptop - phonePx) / (LAPTOP_PX - PHONE_PX)) * 100;
|
|
580
|
+
const intercept = phonePx - (slope / 100) * PHONE_PX;
|
|
581
|
+
return { laptopPx: laptop, phonePx, fontSize: `clamp(${phonePx}px, ${slope.toFixed(2)}cqi + ${intercept.toFixed(1)}px, ${laptop}px)` };
|
|
582
|
+
}
|
|
583
|
+
|
|
526
584
|
/**
|
|
527
585
|
* The ONE judge of an opening mix against the site: what the site cannot carry is mended to the nearest mix it can, and
|
|
528
586
|
* each mend is said. Judges the mix as DRAWN (`drawnOpeningMix` first). Never throws on a well-formed mix. Pure.
|
|
@@ -614,6 +672,8 @@ export const SCRIM_WORDS_PAD = 'var(--iox-space-pad)';
|
|
|
614
672
|
/** iox-ui#133 (AW-D41, one edge): a frame's words start on the content column every other section starts on — its inline
|
|
615
673
|
* padding is never less than `space-inline`; the frame itself may bleed, its words do not. */
|
|
616
674
|
const framePadding = (block: string): string => `${block} max(${block}, ${LAYOUT_INSET})`;
|
|
675
|
+
/** The opening's words column at the look's display size, and the reading measure of the line under a larger one. */
|
|
676
|
+
const WORDS_MAX = '760px';
|
|
617
677
|
/** A display line is sized a little under its measured width, so a rounding never wraps it. */
|
|
618
678
|
const FIT = 0.95;
|
|
619
679
|
|
|
@@ -805,11 +865,12 @@ function typeLedWordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[]
|
|
|
805
865
|
return [apart, typeLedAside('bottom')];
|
|
806
866
|
}
|
|
807
867
|
default:
|
|
868
|
+
const sized = openingDisplaySize(ctx, false);
|
|
808
869
|
return [{
|
|
809
870
|
t: 'Container', es: 'box', role: OpeningRole.Words,
|
|
810
|
-
lay: { ...OVER(1), display: 'flex', flexDirection: 'column', gap: '14px', maxWidth:
|
|
871
|
+
lay: { ...OVER(1), display: 'flex', flexDirection: 'column', gap: '14px', maxWidth: sized ? `${O.rules.display.roomPx}px` : WORDS_MAX },
|
|
811
872
|
enter: 'heroText',
|
|
812
|
-
c: [eyebrowPart(), title({}), typeLedLead(), actionsPart()],
|
|
873
|
+
c: [eyebrowPart(), title(sized ? { fontSize: sized.fontSize } : {}), typeLedLead(sized ? { maxWidth: WORDS_MAX } : {}), actionsPart()],
|
|
813
874
|
}];
|
|
814
875
|
}
|
|
815
876
|
}
|
|
@@ -866,11 +927,14 @@ function wordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[] {
|
|
|
866
927
|
// iox-ui#157: the words stand IN a scrim panel (its fill is the scrim the picture made asks for), so the panel
|
|
867
928
|
// keeps its inner space on every side — the look's own panel padding — and its button its own width (the
|
|
868
929
|
// asides' rule): the heading, the line and the button touched the panel's edges, the button ran across it.
|
|
930
|
+
// Type scale: the headline set to its words (`openingDisplaySize`); the panel then makes room for it, and the line
|
|
931
|
+
// under it keeps a reading measure.
|
|
932
|
+
const sized = openingDisplaySize(ctx, true);
|
|
869
933
|
return [{
|
|
870
934
|
t: 'Container', es: 'media-scrim', role: OpeningRole.Words,
|
|
871
|
-
lay: { ...OVER(1), display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: '14px', maxWidth:
|
|
935
|
+
lay: { ...OVER(1), display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: '14px', maxWidth: sized ? `min(${O.rules.display.roomPx}px, 100%)` : WORDS_MAX, padding: SCRIM_WORDS_PAD },
|
|
872
936
|
enter: 'heroText',
|
|
873
|
-
c: [title({}), lead(), action()],
|
|
937
|
+
c: [title(sized ? { fontSize: sized.fontSize } : {}), lead(sized ? { maxWidth: WORDS_MAX } : {}), action()],
|
|
874
938
|
}];
|
|
875
939
|
}
|
|
876
940
|
}
|
|
@@ -76,6 +76,8 @@ export interface PatternNode {
|
|
|
76
76
|
readonly video?: string;
|
|
77
77
|
/** CC3: a click on this node opens the pattern's lightbox at the clicked row (`lightbox`). */
|
|
78
78
|
readonly opens?: string;
|
|
79
|
+
/** FV1b (footer `holds.top`): a click on this node scrolls the page to its top (`top`). */
|
|
80
|
+
readonly scrolls?: string;
|
|
79
81
|
/** CC3: a control's accessible name (`ariaLabel`). */
|
|
80
82
|
readonly name?: string;
|
|
81
83
|
/** CC4b: hidden at base, shown while the pattern's Segmented option with this key is on. */
|
|
@@ -221,6 +223,11 @@ export enum PatternOpens {
|
|
|
221
223
|
Lightbox = 'lightbox',
|
|
222
224
|
}
|
|
223
225
|
|
|
226
|
+
/** FV1b: where a button's or a link's click scrolls the page — its top (a scrollTo with no target, both renderers). */
|
|
227
|
+
export enum PatternScrolls {
|
|
228
|
+
Top = 'top',
|
|
229
|
+
}
|
|
230
|
+
|
|
224
231
|
/** The composer directives a pattern writes where a plan supplies the value. */
|
|
225
232
|
export enum PatternDirective {
|
|
226
233
|
/** A Repeater's source: the section's `binding`. */
|
|
@@ -8,6 +8,7 @@ import { DEFAULT_HEADER_PATTERN, HeaderIngredient, headerMeaning, headerMix, hea
|
|
|
8
8
|
import { DEFAULT_FOOTER_PATTERN, FooterIngredient, footerMeaning, footerMix, footerMixFromWords, footerMixOfPlan, footerMixWords, footerPatternIdOf, footerWireWords, footerWords } from './footer-mix';
|
|
9
9
|
import { openingHarnessWord, OpeningIngredient, openingMeaning, openingWireWords } from './opening-mix';
|
|
10
10
|
import { BodyIngredient, bodyMeaning, bodyMix, bodyMixWords, bodyWireWords } from './body-mix';
|
|
11
|
+
import { ColourIngredient, colourMeaning, colourWireWords } from './colour-mix';
|
|
11
12
|
import { POPUP_LINK_WORD, POPUP_WIRE_INGREDIENTS, popupMeaning, popupWireWords } from './popup-plan';
|
|
12
13
|
import { shopCategoriesOf } from './shop-plan';
|
|
13
14
|
import { ContentFieldControl, FIELD_TYPE_OF_CONTROL,
|
|
@@ -129,6 +130,8 @@ const HEADER_WIRE_TEXT = 'string[] — the header as ONE list of <ingredient>:<w
|
|
|
129
130
|
|
|
130
131
|
/** The wire's `globals` key the site's body travels in (AW6) — every tier's since AW-D42. */
|
|
131
132
|
const BODY_WIRE_KEY = 'body';
|
|
133
|
+
/** The plan's `mixes` key the body list's colour words go to (CV2). */
|
|
134
|
+
const COLOUR_MIX_KEY = 'colour';
|
|
132
135
|
|
|
133
136
|
/** The body's words as the model reads them (AW6): each ingredient, the words a build may wear today and their meanings,
|
|
134
137
|
* from the contract's body table. */
|
|
@@ -138,7 +141,17 @@ const BODY_WIRE_TEXT = "string[] — the site's body as ONE list of <ingredient>
|
|
|
138
141
|
+ 'sections wear different grounds; a calm business (care, advice) never wears a torn or dripping edge. '
|
|
139
142
|
+ Object.values(BodyIngredient).map(k => [k, bodyWireWords().filter(w => w.startsWith(`${k}:`)).map(w => w.slice(k.length + 1))] as const)
|
|
140
143
|
.filter(([, words]) => words.length)
|
|
141
|
-
.map(([k, words]) => `${k}: ${words.map(w => `${w} (${bodyMeaning(k, w)})`).join(' | ')}`).join('; ')
|
|
144
|
+
.map(([k, words]) => `${k}: ${words.map(w => `${w} (${bodyMeaning(k, w)})`).join(' | ')}`).join('; ')
|
|
145
|
+
// Colour v2 CV2: the site's colours ride the same list (+0 properties) and are split out into `mixes.colour`; one word per
|
|
146
|
+
// ingredient, an ingredient left out is the style preset's own.
|
|
147
|
+
+ '. The same list carries the site\'s colours: '
|
|
148
|
+
+ Object.values(ColourIngredient).map(k => [k, colourWireWords(GenerationTier.Award).filter(w => w.startsWith(`${k}:`)).map(w => w.slice(k.length + 1))] as const)
|
|
149
|
+
.filter(([, words]) => words.length)
|
|
150
|
+
.map(([k, words]) => `${k}: ${words.map(w => `${w} (${colourMeaning(k, w)})`).join(' | ')}`).join('; ');
|
|
151
|
+
|
|
152
|
+
/** The ingredients whose words ride the body list but are the site's colours (CV2): split out into `mixes.colour`. */
|
|
153
|
+
const COLOUR_INGREDIENTS: ReadonlySet<string> = new Set(Object.values(ColourIngredient));
|
|
154
|
+
const isColourWord = (word: unknown): boolean => typeof word === 'string' && COLOUR_INGREDIENTS.has(word.split(':')[0]);
|
|
142
155
|
|
|
143
156
|
/** The wire's `globals` key the site's popup travels in (popups PU3) — a mix beside the others; [] = no popup. */
|
|
144
157
|
const POPUP_WIRE_KEY = 'popup';
|
|
@@ -259,7 +272,7 @@ const WIRE_KEYS: Readonly<Record<`${PlanWireEntry}`, Readonly<Record<string, Wir
|
|
|
259
272
|
opening: { refs: ['plan.mixes', 'mixes.opening'], text: OPENING_WIRE_TEXT },
|
|
260
273
|
// AW6: the site's body travels as its MIX, ONE list of `<ingredient>:<word>` words (body-mix.ts); [] = none. Every
|
|
261
274
|
// tier's request carries it since AW-D42 (it was the award tier's alone, AW-D23).
|
|
262
|
-
body: { refs: ['plan.mixes', 'mixes.body'], text: BODY_WIRE_TEXT },
|
|
275
|
+
body: { refs: ['plan.mixes', 'mixes.body', 'mixes.colour'], text: BODY_WIRE_TEXT },
|
|
263
276
|
// PU3: the popup travels as its words, ONE list (popup-plan.ts); [] = none. Stamped only from the owner's lines (plan.popup).
|
|
264
277
|
popup: { refs: ['plan.mixes', 'mixes.popup'], text: POPUP_WIRE_TEXT },
|
|
265
278
|
},
|
|
@@ -283,6 +296,7 @@ export const PLAN_WIRE_DERIVED: Readonly<Record<string, string>> = {
|
|
|
283
296
|
'plan.locale': "the reading's language (the context)",
|
|
284
297
|
'plan.design': "the owner's pick (the context)",
|
|
285
298
|
'business.facts': "the owner's own facts, verbatim (the context)",
|
|
299
|
+
'business.social': "the owner's social links as the reading stated them (statedFacts.social, footer-v2 FV1b) — set by the server, never the model's",
|
|
286
300
|
'page.isHome': 'the page at "/"',
|
|
287
301
|
'page.required': "a template page's (the wizard's Pages step), never the AI's",
|
|
288
302
|
sourceTemplate: 'the AI never writes a template plan',
|
|
@@ -471,7 +485,8 @@ const PLAN_TOP_SCHEMAS: Readonly<Record<string, (options: PlanWireOptions) => Js
|
|
|
471
485
|
[GlobalSlot.Header]: jsonListOf(jsonOneOf(headerWireWords())),
|
|
472
486
|
[GlobalSlot.Footer]: jsonListOf(jsonOneOf(footerWireWords())),
|
|
473
487
|
[OPENING_WIRE_KEY]: jsonListOf(jsonOneOf(openingWireWords())),
|
|
474
|
-
|
|
488
|
+
// AW-D42: every tier's request is the award request — the colour's Pro words ride it too.
|
|
489
|
+
[BODY_WIRE_KEY]: jsonListOf(jsonOneOf([...bodyWireWords(), ...colourWireWords(GenerationTier.Award)])),
|
|
475
490
|
[POPUP_WIRE_KEY]: jsonListOf(jsonText()),
|
|
476
491
|
}, `wire ${PlanWireEntry.Globals}`),
|
|
477
492
|
direction: () => shaped(PlanWireEntry.Direction, { idea: jsonText(), cliche: jsonText(), flip: jsonText(), rules: jsonListOf(jsonText()) }),
|
|
@@ -670,7 +685,10 @@ function expandWireGlobals(globals: unknown): PlainObject {
|
|
|
670
685
|
// AW8: the opening is a mix only (no stored pattern stands for it on the wire); [] = none. Not a list: the validator says so.
|
|
671
686
|
// AW6: so is the body (the award tier's wire alone writes it); [] = none.
|
|
672
687
|
// PU3: so is the popup ([] = none).
|
|
673
|
-
|
|
688
|
+
// CV2: the body list's colour words are the site's colours (`mixes.colour`); the rest its body.
|
|
689
|
+
const bodyWords = Array.isArray(body) ? body.filter(w => !isColourWord(w)) : body;
|
|
690
|
+
const colour = Array.isArray(body) ? body.filter(isColourWord) : undefined;
|
|
691
|
+
for (const [name, words] of [[OPENING_WIRE_KEY, opening], [BODY_WIRE_KEY, bodyWords], [POPUP_WIRE_KEY, popup], [COLOUR_MIX_KEY, colour]] as const) {
|
|
674
692
|
if (words !== undefined && (!Array.isArray(words) || words.length)) mixes[name] = Array.isArray(words) ? [...words] : words;
|
|
675
693
|
}
|
|
676
694
|
for (const [slot, readId, fallback] of [
|
|
@@ -746,7 +764,7 @@ const PLAN_TO_WIRE: Readonly<Record<string, (plan: SitePlan, options: PlanWireOp
|
|
|
746
764
|
...plan.globals, [GlobalSlot.Header]: headerMixWords(headerMixOfPlan(plan)), [GlobalSlot.Footer]: footerMixWords(footerMixOfPlan(plan)),
|
|
747
765
|
[OPENING_WIRE_KEY]: [...(plan.mixes?.opening ?? [])],
|
|
748
766
|
// AW6: the wire writes the body ([] = none) — at every tier since AW-D42.
|
|
749
|
-
[BODY_WIRE_KEY]: [...(plan.mixes?.body ?? [])],
|
|
767
|
+
[BODY_WIRE_KEY]: [...(plan.mixes?.body ?? []), ...(plan.mixes?.colour ?? [])],
|
|
750
768
|
[POPUP_WIRE_KEY]: [...(plan.mixes?.popup ?? [])],
|
|
751
769
|
}),
|
|
752
770
|
direction: plan => ({ idea: plan.direction?.idea ?? NONE, cliche: plan.direction?.cliche ?? NONE, flip: plan.direction?.flip ?? NONE, rules: [...(plan.direction?.rules ?? [])] }),
|