@vectoriox/iox-ui 5.197.0 → 5.199.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions-core/index.d.ts +7 -1
- package/composite-core/index.d.ts +16 -2
- package/data-core/index.d.ts +11 -3
- package/design-core/index.d.ts +185 -28
- 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-composite-core.mjs +34 -2
- package/fesm2022/vectoriox-iox-ui-composite-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 +323 -72
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +17351 -15175
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +243 -38
- package/fesm2022/vectoriox-iox-ui-harness-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 +1703 -264
- package/harness-core/index.d.ts +93 -6
- package/package.json +1 -1
- package/src/actions-core/element-actions.ts +6 -0
- package/src/composite-core/header.ts +34 -1
- package/src/data-core/placeholder-rows.ts +29 -4
- 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/menu-look.ts +23 -0
- package/src/design-core/motion-language.ts +5 -14
- package/src/design-core/node-classes.ts +39 -0
- package/src/design-core/preloader.ts +4 -5
- package/src/generation-core/body-mix.ts +40 -102
- package/src/generation-core/check-free.ts +22 -11
- 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 +47 -20
- package/src/generation-core/compose-site.ts +259 -59
- package/src/generation-core/footer-mix.ts +258 -64
- package/src/generation-core/free-fallback.ts +6 -4
- package/src/generation-core/free-opening.ts +13 -2
- package/src/generation-core/free-parts.ts +87 -0
- package/src/generation-core/free-slot-words.ts +30 -0
- package/src/generation-core/free-wire.ts +8 -0
- package/src/generation-core/generation-tier.ts +6 -17
- package/src/generation-core/header-mix.ts +73 -3
- package/src/generation-core/layout-drawers.ts +3 -2
- package/src/generation-core/layout-wire.ts +10 -16
- package/src/generation-core/legal.ts +24 -0
- 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/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-mix.ts +7 -34
- package/src/generation-core/part-tier.ts +14 -0
- package/src/generation-core/patterns.ts +7 -0
- package/src/generation-core/plan-wire.ts +32 -43
- package/src/generation-core/public-api.ts +3 -0
- package/src/generation-core/site-build-run.ts +8 -0
- package/src/generation-core/site-plan.model.ts +3 -0
- package/src/generation-core/site-spec.generated.ts +1383 -189
- package/src/generation-core/validate-site-plan.ts +6 -5
- package/src/harness-core/business-types.ts +4 -0
- package/src/harness-core/harness-spec.generated.ts +189 -30
- package/src/harness-core/popup-stance.ts +56 -3
- package/src/harness-core/run-compose-context.ts +25 -5
- package/styles/iox-design.css +162 -3
|
@@ -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;
|
|
@@ -2,6 +2,7 @@ import { DesignChoices, elementStyleFace, resolveDesignChoices, textWidthEm } fr
|
|
|
2
2
|
|
|
3
3
|
import { LAYOUT_INSET } from './layout-column';
|
|
4
4
|
import { GenerationTier } from './site-plan.model';
|
|
5
|
+
import { tierOffers } from './part-tier';
|
|
5
6
|
import { PatternNode, PatternPlaceholder, PatternRecipe, SitePattern } from './patterns';
|
|
6
7
|
import { SerializedNode, walkSerialized } from './serialized-node';
|
|
7
8
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
@@ -160,14 +161,14 @@ export function openingWordWaits(ingredient: `${OpeningIngredient}`, word: strin
|
|
|
160
161
|
return WAITS[`${ingredient}.${word}`]?.phase ?? null;
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
/**
|
|
164
|
+
/** The tier a word was first drawn for (`all`, or `pro` — the award tier's, AW-D23); since AW-D42 every tier wears both. */
|
|
164
165
|
export function openingWordTier(ingredient: `${OpeningIngredient}`, word: string): 'all' | 'pro' {
|
|
165
166
|
return O.tiers[`${ingredient}.${word}`] === 'pro' ? 'pro' : 'all';
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
/** May a build at `tier` wear this word? */
|
|
169
|
+
/** May a build at `tier` wear this word? Every tier wears every drawn word (AW-D42, `tierOffers`). */
|
|
169
170
|
export function openingWordOffered(ingredient: `${OpeningIngredient}`, word: string, tier: `${GenerationTier}`): boolean {
|
|
170
|
-
return openingWordTier(ingredient, word)
|
|
171
|
+
return tierOffers(openingWordTier(ingredient, word), tier);
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
const listOf = (v: string | ReadonlyArray<string> | undefined): string[] => (v === undefined ? [] : Array.isArray(v) ? [...v] : [v as string]);
|
|
@@ -424,7 +425,7 @@ export function typeLedGrounds(calm = false): OpeningGround[] {
|
|
|
424
425
|
}
|
|
425
426
|
|
|
426
427
|
/** Every `<ingredient>:<word>` the generator's wire may carry at `tier`: drawn words only (a waiting word is never
|
|
427
|
-
* offered)
|
|
428
|
+
* offered) — every tier's since AW-D42. */
|
|
428
429
|
export function openingWireWords(tier: `${GenerationTier}` = GenerationTier.Basic): string[] {
|
|
429
430
|
return ORDER.flatMap(k => openingWords(k).filter(w => openingWordDrawn(k, w) && openingWordOffered(k, w, tier)).map(w => `${k}:${w}`));
|
|
430
431
|
}
|
|
@@ -440,20 +441,12 @@ export function typeLedOpeningWays(): OpeningMix[] {
|
|
|
440
441
|
return (O.typeLed ?? []).map(w => openingMix({ frame: w.frame, words: w.words, media: OpeningMedia.None }));
|
|
441
442
|
}
|
|
442
443
|
|
|
443
|
-
/** AW-D23 amended (2026-11-24): a type-led first screen's frame and words are worn at every tier when they are one of
|
|
444
|
-
* the contract's type-led ways — with no picture they are all the screen has. */
|
|
445
|
-
function typeLedWayEveryTier(mix: OpeningMix): boolean {
|
|
446
|
-
return !!O.typeLedEveryTier && mix.media === OpeningMedia.None && (O.typeLed ?? []).some(w => w.frame === mix.frame && w.words === mix.words);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
444
|
/** #129: is the mix a type-led first screen (nothing to show but its words)? */
|
|
450
445
|
export const openingIsTypeLed = (mix: Pick<OpeningMix, 'media'>): boolean => mix.media === OpeningMedia.None;
|
|
451
446
|
|
|
452
447
|
// ── The check: a mix judged against the site, mended where the site cannot carry it, each mend said ──────────────────
|
|
453
448
|
|
|
454
449
|
export enum OpeningRepairCode {
|
|
455
|
-
/** A word the award tier alone wears, on a site built below it. */
|
|
456
|
-
ProOnly = 'pro-only',
|
|
457
450
|
/** The name behind the subject needs a cut-out picture: the name, large. */
|
|
458
451
|
NeedsCutOut = 'needs-cut-out',
|
|
459
452
|
/** J10 lever (b): a looping film is the owner's own clip — a build with none draws a picture there, which the owner's
|
|
@@ -488,7 +481,8 @@ export interface OpeningContext {
|
|
|
488
481
|
/** The business name — the words of a display-size opening. */
|
|
489
482
|
readonly name: string;
|
|
490
483
|
readonly design?: DesignChoices | null;
|
|
491
|
-
/**
|
|
484
|
+
/** The tier the site is built at. Since AW-D42 it holds back no word (every tier wears every drawn word); kept so the
|
|
485
|
+
* callers that pass it still read. */
|
|
492
486
|
readonly tier?: `${GenerationTier}`;
|
|
493
487
|
/** The owner gives a cut-out picture (a transparent background) for the name behind the subject. */
|
|
494
488
|
readonly cutOut?: boolean;
|
|
@@ -529,11 +523,6 @@ function nameFits(ctx: OpeningContext, oneLine: boolean): boolean {
|
|
|
529
523
|
return laptopOk && (PHONE_PX - 2 * PHONE_SIDE_PX) / longest >= MIN_PHONE_DISPLAY_PX;
|
|
530
524
|
}
|
|
531
525
|
|
|
532
|
-
/** The stand-in for a word a tier may not wear: the one-word ingredients' defaults; a many-ingredient's word left out. */
|
|
533
|
-
function tierStandIn(k: OpeningIngredient): string {
|
|
534
|
-
return O.defaults[k] as string;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
526
|
/**
|
|
538
527
|
* The ONE judge of an opening mix against the site: what the site cannot carry is mended to the nearest mix it can, and
|
|
539
528
|
* each mend is said. Judges the mix as DRAWN (`drawnOpeningMix` first). Never throws on a well-formed mix. Pure.
|
|
@@ -542,22 +531,6 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
|
|
|
542
531
|
const m: OpeningMix = { ...mix, extras: [...mix.extras], motion: [...mix.motion] };
|
|
543
532
|
const repairs: OpeningRepair[] = [];
|
|
544
533
|
const say = (code: OpeningRepairCode, said: string) => repairs.push({ code, said });
|
|
545
|
-
if (ctx.tier && ctx.tier !== GenerationTier.Award) {
|
|
546
|
-
const everyTier = typeLedWayEveryTier(m);
|
|
547
|
-
for (const k of ORDER) {
|
|
548
|
-
if (everyTier && (k === OpeningIngredient.Frame || k === OpeningIngredient.Words)) continue;
|
|
549
|
-
if (isMany(k)) {
|
|
550
|
-
const kept = m[k].filter(w => openingWordTier(k, w) === 'all');
|
|
551
|
-
for (const w of m[k].filter(x => !kept.includes(x))) say(OpeningRepairCode.ProOnly, `"${openingMeaning(k, w)}" comes with the award plan: left out`);
|
|
552
|
-
m[k] = kept;
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
const word = (m as unknown as Record<string, string>)[k];
|
|
556
|
-
if (openingWordTier(k, word) === 'all') continue;
|
|
557
|
-
(m as unknown as Record<string, string>)[k] = tierStandIn(k);
|
|
558
|
-
say(OpeningRepairCode.ProOnly, `"${openingMeaning(k, word)}" comes with the award plan: ${openingMeaning(k, tierStandIn(k))} instead`);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
534
|
if (m.media === OpeningMedia.Film && ctx.film === false) {
|
|
562
535
|
m.media = OpeningMedia.Photo;
|
|
563
536
|
say(OpeningRepairCode.FilmIsTheOwners, 'a looping film is the owner\'s own clip, and there is none yet: a picture stands in, filled by their photo or one that fits the business');
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AW-D42 (Doron, 2026-11-28: "we don't need the award website for Pro" — AW-D23's word gate overturned): EVERY PART IS
|
|
3
|
+
* EVERY TIER'S. A word, a recipe, a table row or a wire key the contract once held for the award tier (its `tier: 'pro'`
|
|
4
|
+
* / `'award'`) is offered to a build at any tier. The tier now decides only HOW MUCH the model composes (AW-D24: which
|
|
5
|
+
* pages, `withComposedPages`) — never what a site may wear.
|
|
6
|
+
*
|
|
7
|
+
* This is the ONE predicate every part offer reads — the body, opening, list and footer words, the layout signatures,
|
|
8
|
+
* the plan wire's keys. The contract's `tier` column stays as each row's history (the tier it was first drawn for), so a
|
|
9
|
+
* price split, should one ever come back, comes back here and nowhere else. A leaf module (no imports): the mixes read it
|
|
10
|
+
* without reordering the generation-core load. Pure.
|
|
11
|
+
*/
|
|
12
|
+
export function tierOffers(_rowTier: string | null | undefined, _tier?: string | null): boolean {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
@@ -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`. */
|