@vectoriox/iox-ui 5.196.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 +19 -2
- package/data-core/index.d.ts +101 -2
- package/design-core/index.d.ts +183 -30
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +49 -10
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +192 -2
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +299 -74
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +2287 -528
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +3 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +32 -2
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1454 -200
- package/harness-core/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/composite-core/header.ts +34 -1
- package/src/composite-core/slider-runtime.ts +16 -8
- package/src/data-core/placeholder-rows.ts +220 -0
- package/src/data-core/public-api.ts +2 -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 +82 -15
- package/src/design-core/motion-language.ts +5 -14
- package/src/design-core/node-links.ts +34 -0
- package/src/design-core/preloader.ts +4 -5
- package/src/generation-core/audit-site.ts +10 -1
- package/src/generation-core/audit-words.ts +5 -0
- package/src/generation-core/body-mix.ts +40 -102
- package/src/generation-core/check-free.ts +26 -5
- 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 +124 -22
- package/src/generation-core/footer-mix.ts +102 -54
- package/src/generation-core/free-fallback.ts +6 -4
- package/src/generation-core/free-opening.ts +57 -0
- 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 +125 -4
- package/src/generation-core/item-fill.ts +42 -0
- 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/nav-shape.ts +45 -16
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/opening-mix.ts +16 -33
- 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 +4 -0
- package/src/generation-core/site-build-run.ts +4 -0
- package/src/generation-core/site-spec.generated.ts +1127 -93
- package/src/generation-core/stock-search.ts +106 -18
- package/src/generation-core/type-led.ts +19 -4
- package/src/generation-core/validate-site-plan.ts +4 -5
- package/src/harness-core/run-compose-context.ts +3 -1
- package/styles/iox-design.css +139 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DesignChoices, elementStyleFace, HeaderGround, headerGroundIsGlass, headerGroundIsOver, HeaderTrait, MenuForm, menuButtonOf, menuFormOf, menuHoverOf, MenuLook, MenuPhoneForm,
|
|
3
|
-
menuRevealOf, parseHexColor, resolveDesignChoices, textWidthEm, wcagContrastRatio,
|
|
2
|
+
DesignChoices, designTokenRows, elementStyleFace, HeaderBrand, HeaderGround, headerGroundIsGlass, headerGroundIsOver, HeaderShape, headerShapeFloats, HeaderTrait, MenuForm, menuButtonOf, menuFormOf, menuHoverOf, MenuLook, MenuPhoneForm,
|
|
3
|
+
menuRevealOf, parseHexColor, resolveDesignChoices, resolveSchemeTokenValues, resolveTokenValues, ResolvedMode, textWidthEm, wcagContrastRatio,
|
|
4
4
|
} from '@vectoriox/iox-ui/design-core';
|
|
5
5
|
|
|
6
6
|
import { MenuSide, NavRole, NavShape } from './nav-shape';
|
|
7
|
-
import { OpeningMixError, openingMixOfPlan } from './opening-mix';
|
|
7
|
+
import { OpeningMixError, openingMixOfPlan, OpeningRole } from './opening-mix';
|
|
8
8
|
import { calmUnder, PhotoInventory } from './photo-inventory';
|
|
9
9
|
import { PatternGlobalPosition, PatternNode, SITE_PATTERNS, SitePattern } from './patterns';
|
|
10
10
|
import { planSells, ShopSourceRole, shopSourceAliases } from './shop-plan';
|
|
@@ -285,6 +285,16 @@ export enum HeaderRepairCode {
|
|
|
285
285
|
GlassOwnBar = 'glass-own-bar',
|
|
286
286
|
/** HI3-D9: glass carries its own hairline and shadow: no scroll edge. */
|
|
287
287
|
GlassEdge = 'glass-edge',
|
|
288
|
+
/** HI3-D20: a floating header has no scroll edge. */
|
|
289
|
+
FloatEdge = 'float-edge',
|
|
290
|
+
/** HI3-D18: a centred name has no island side: islands become one pill. */
|
|
291
|
+
IslandsCentred = 'islands-centred',
|
|
292
|
+
/** HI3-D25: a floating header, or a name that arrives later, needs a home page that opens on a picture. */
|
|
293
|
+
FloatPlain = 'float-plain',
|
|
294
|
+
/** HI3-D21: a hanging name needs a logo picture. */
|
|
295
|
+
NoLogo = 'no-logo',
|
|
296
|
+
/** HI3-D25: a kind of business that keeps its header plain never takes islands or a late name. */
|
|
297
|
+
TypeNeverShape = 'type-never-shape',
|
|
288
298
|
}
|
|
289
299
|
|
|
290
300
|
export interface HeaderRepair {
|
|
@@ -330,6 +340,8 @@ export interface HeaderContext {
|
|
|
330
340
|
readonly readableAtRest?: boolean | null;
|
|
331
341
|
/** HI3-D12: what this kind of business never stands its header on. Absent: nothing refused. */
|
|
332
342
|
readonly never?: HeaderNever | null;
|
|
343
|
+
/** HI3-D21: the brand has a logo picture (a hanging name needs one). Absent: none known — a hanging name fits. */
|
|
344
|
+
readonly logo?: boolean | null;
|
|
333
345
|
}
|
|
334
346
|
|
|
335
347
|
const RULES = H.rules as unknown as Readonly<{
|
|
@@ -399,14 +411,49 @@ export function checkHeader(mix: HeaderMix, ctx: HeaderContext): { mix: HeaderMi
|
|
|
399
411
|
say(HeaderRepairCode.OneDestination, 'two actions need two places to go (the contact page and the shop): one button');
|
|
400
412
|
}
|
|
401
413
|
mendGround(m, ctx, say);
|
|
414
|
+
mendShape(m, ctx, say);
|
|
402
415
|
return { mix: m, repairs };
|
|
403
416
|
}
|
|
404
417
|
|
|
418
|
+
/** The outline and name rules (HI3 slice 2, HI3-D18, D20, D21, D25), in order: the kind of business, the opening, the
|
|
419
|
+
* arrangement, the logo, then the edge a floating header does not draw. */
|
|
420
|
+
function mendShape(m: HeaderMix, ctx: HeaderContext, say: (code: HeaderRepairCode, said: string) => void): void {
|
|
421
|
+
const floats = (): boolean => headerShapeFloats(m.shape);
|
|
422
|
+
if (ctx.never?.grounds.length && (m.shape === HeaderShape.Islands || m.brand === HeaderBrand.Later)) {
|
|
423
|
+
if (m.shape === HeaderShape.Islands) m.shape = HeaderShape.Pill;
|
|
424
|
+
if (m.brand === HeaderBrand.Later) m.brand = HeaderBrand.Fits;
|
|
425
|
+
say(HeaderRepairCode.TypeNeverShape, 'this kind of business keeps its header plain: one bar, the name always in it');
|
|
426
|
+
}
|
|
427
|
+
if ((floats() || m.brand === HeaderBrand.Later) && ctx.opening !== undefined && !opensOnPicture(ctx.opening)) {
|
|
428
|
+
m.shape = HeaderShape.Bar;
|
|
429
|
+
if (m.brand === HeaderBrand.Later) m.brand = HeaderBrand.Fits;
|
|
430
|
+
say(HeaderRepairCode.FloatPlain, 'the home page does not open on a full picture: the header is a bar, its name in it from the top');
|
|
431
|
+
}
|
|
432
|
+
if (m.shape === HeaderShape.Islands && (m.arrange === HeaderArrange.Centred || m.arrange === HeaderArrange.Between)) {
|
|
433
|
+
m.shape = HeaderShape.Pill;
|
|
434
|
+
say(HeaderRepairCode.IslandsCentred, 'a centred name has no side for an island: the header floats as one pill');
|
|
435
|
+
}
|
|
436
|
+
if (m.brand === HeaderBrand.Hangs && !ctx.logo) {
|
|
437
|
+
m.brand = HeaderBrand.Fits;
|
|
438
|
+
say(HeaderRepairCode.NoLogo, 'the site has no logo picture, so the name fits the bar');
|
|
439
|
+
}
|
|
440
|
+
if (floats() && m.edge !== 'none') {
|
|
441
|
+
m.edge = 'none';
|
|
442
|
+
say(HeaderRepairCode.FloatEdge, 'a floating header has no edge under it');
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
405
446
|
/** HI3-D12: does the home page open on a picture the header can stand over — the contract's frames and media. */
|
|
406
447
|
export function opensOnPicture(opening: HeaderOpening | null | undefined): boolean {
|
|
407
448
|
return !!opening && RULES.overFrames.includes(opening.frame) && RULES.overMedia.includes(opening.media);
|
|
408
449
|
}
|
|
409
450
|
|
|
451
|
+
/** HI3-D5: what an over header stands on when its words do not read over the opening — the look's glass from the top,
|
|
452
|
+
* or its own solid bar in a look with no glass (Pop). The ONE answer `checkHeader` and a build's late mend share. */
|
|
453
|
+
export function headerGroundWhenUnreadable(design: Pick<DesignChoices, 'flavorId'>): HeaderGround {
|
|
454
|
+
return lookHasGlass(design) ? HeaderGround.Glass : HeaderGround.Solid;
|
|
455
|
+
}
|
|
456
|
+
|
|
410
457
|
/** HI3-D2: does the look carry a header glass set (Pop draws its own solid bar). */
|
|
411
458
|
export function lookHasGlass(design: Pick<DesignChoices, 'flavorId'>): boolean {
|
|
412
459
|
return RULES.glassFlavors.includes(design.flavorId);
|
|
@@ -426,7 +473,7 @@ function mendGround(m: HeaderMix, ctx: HeaderContext, say: (code: HeaderRepairCo
|
|
|
426
473
|
say(HeaderRepairCode.OverPlain, 'the home page does not open on a full picture the header can stand over: it keeps its own ground');
|
|
427
474
|
}
|
|
428
475
|
if (headerGroundIsOver(m.ground) && ctx.readableAtRest === false) {
|
|
429
|
-
m.ground =
|
|
476
|
+
m.ground = headerGroundWhenUnreadable(ctx.design);
|
|
430
477
|
say(HeaderRepairCode.OverUnreadable, glass ? "the header's words do not read over the opening's picture: it stands on its glass from the top"
|
|
431
478
|
: "the header's words do not read over the opening's picture: it keeps its own ground");
|
|
432
479
|
}
|
|
@@ -489,6 +536,80 @@ export function headerReadsAtRest(inv: PhotoInventory, frame: { w: number; h: nu
|
|
|
489
536
|
return true;
|
|
490
537
|
}
|
|
491
538
|
|
|
539
|
+
/** The frames the words at rest are judged in (HI3-D5): a laptop's first screen under its 80px bar, a phone's under 64px
|
|
540
|
+
* (the shared CSS's bar fallbacks, iox-design.css). */
|
|
541
|
+
export const HEADER_REST_FRAMES: ReadonlyArray<{ readonly w: number; readonly h: number; readonly barPx: number }> = [
|
|
542
|
+
{ w: 1440, h: 900, barPx: HEADER_BAR_PX },
|
|
543
|
+
{ w: 390, h: 760, barPx: 64 },
|
|
544
|
+
];
|
|
545
|
+
const DEFAULT_SCHEME = 'default';
|
|
546
|
+
const MODES_OF: Readonly<Record<string, ReadonlyArray<ResolvedMode>>> = { light: ['light'], dark: ['dark'], auto: ['light', 'dark'] };
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* HI3-D5: the header's words at rest, one per mode the look offers — the opening scheme's `text` (what an over header
|
|
550
|
+
* wears at rest, HI3-D8) over a veil of its `bg` — resolved from the look's own token rows. A scheme the rows lack reads
|
|
551
|
+
* as the page's. Pure.
|
|
552
|
+
*/
|
|
553
|
+
export function headerRestInks(design: DesignChoices, scheme?: string | null): HeaderRestInk[] {
|
|
554
|
+
const rows = designTokenRows(design);
|
|
555
|
+
return (MODES_OF[design.mode] ?? MODES_OF['light']).map(mode => {
|
|
556
|
+
const values = scheme && scheme !== DEFAULT_SCHEME ? resolveSchemeTokenValues(rows, mode, scheme) : resolveTokenValues(rows, mode);
|
|
557
|
+
return { ink: values['text'] ?? '', veilGround: values['bg'] ?? '' };
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** A node as the readable check walks it (a composed page's SerializedNode). */
|
|
562
|
+
export interface HeaderRestNode {
|
|
563
|
+
readonly role?: string | null;
|
|
564
|
+
readonly type?: string;
|
|
565
|
+
readonly props?: Readonly<Record<string, unknown>> | null;
|
|
566
|
+
readonly children?: ReadonlyArray<HeaderRestNode> | null;
|
|
567
|
+
}
|
|
568
|
+
/** A composed page as the readable check reads it. */
|
|
569
|
+
export interface HeaderRestPage {
|
|
570
|
+
readonly isHome?: boolean;
|
|
571
|
+
readonly route?: { readonly path?: string } | string | null;
|
|
572
|
+
readonly pageSettings?: { readonly opening?: string | null } | null;
|
|
573
|
+
readonly layout?: ReadonlyArray<HeaderRestNode> | null;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
const PICTURE_ROLES: ReadonlySet<string> = new Set([OpeningRole.Media, OpeningRole.MediaZooms, OpeningRole.Slides, OpeningRole.Film]);
|
|
577
|
+
|
|
578
|
+
/** The address of the picture the home opening shows first: its picture, the first slide, a film's poster — or null. */
|
|
579
|
+
export function openingPictureSrc(opening: HeaderRestNode | null | undefined): string | null {
|
|
580
|
+
let found: string | null = null;
|
|
581
|
+
const walk = (n: HeaderRestNode, inside: boolean): void => {
|
|
582
|
+
if (found) return;
|
|
583
|
+
const here = inside || PICTURE_ROLES.has(n.role ?? '');
|
|
584
|
+
if (here) {
|
|
585
|
+
const src = n.type === 'Video' ? n.props?.['poster'] : n.type === 'Image' ? n.props?.['src'] : null;
|
|
586
|
+
if (typeof src === 'string' && src.trim()) { found = src; return; }
|
|
587
|
+
}
|
|
588
|
+
for (const c of n.children ?? []) walk(c, here);
|
|
589
|
+
};
|
|
590
|
+
if (opening?.role === OpeningRole.Root) walk(opening, false);
|
|
591
|
+
return found;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* HI3-D5 on a COMPOSED site: whether its header's words read at rest over the home opening's picture — the picture's pixels
|
|
596
|
+
* (`inventoryOf` its address: the caller holds them, the reading), the opening's scheme, in every mode the look offers
|
|
597
|
+
* and in both frames (`HEADER_REST_FRAMES`). Null — not judged — when the home page opens on no composed picture or its
|
|
598
|
+
* pixels are unknown (a placeholder, a stock picture not read yet). The ONE judgement the build (iox-cms, which then
|
|
599
|
+
* composes with `headerReadable`) and the Header studio's advice share. Pure.
|
|
600
|
+
*/
|
|
601
|
+
export function headerReadableOfSite(
|
|
602
|
+
site: { readonly pages: ReadonlyArray<HeaderRestPage>; readonly design: DesignChoices },
|
|
603
|
+
inventoryOf: (src: string) => PhotoInventory | null | undefined,
|
|
604
|
+
): boolean | null {
|
|
605
|
+
const home = site.pages.find(p => p.isHome === true) ?? site.pages.find(p => (typeof p.route === 'string' ? p.route : p.route?.path) === '/');
|
|
606
|
+
const src = openingPictureSrc(home?.layout?.[0]);
|
|
607
|
+
const inv = src ? inventoryOf(src) : null;
|
|
608
|
+
if (!inv) return null;
|
|
609
|
+
const inks = headerRestInks(site.design, home?.pageSettings?.opening ?? null);
|
|
610
|
+
return HEADER_REST_FRAMES.every(f => headerReadsAtRest(inv, f, inks, f.barPx));
|
|
611
|
+
}
|
|
612
|
+
|
|
492
613
|
// ── The recipe: the mix arranged from the contract's parts (§4 — ONE recipe for the palette and the generator) ────
|
|
493
614
|
|
|
494
615
|
const clone = <T>(v: T): T => JSON.parse(JSON.stringify(v));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ContentTypePlan, SitePlan, SitePlanSourceKind } from './site-plan.model';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WHICH SAMPLE ITEMS ARE THE PLAN'S OWN, AND WHICH ARE NUMBERED PLACEHOLDERS (vectoriox/iox-ui#178). A generated site
|
|
5
|
+
* showed "Piece 2", "Product 2", "Room 2": the sample items of a content type whose plan gave no words for each item
|
|
6
|
+
* (the business's own products, rooms, team — neutral by `SAMPLE_CONTENT_RULE`, Doron 2026-11-01), every title its seed
|
|
7
|
+
* template (`"Product {n}"`) with the number filled in. Doron, 2026-11-28 — GHOST CARDS: those items stay in the data and
|
|
8
|
+
* every page and section stays; the builder draws such a row as an owner prompt ("Add your first room"), the live site
|
|
9
|
+
* never shows a list made only of them, and the Publishable gate ASKS about one still titled like a placeholder.
|
|
10
|
+
*
|
|
11
|
+
* This file is the reading both halves share: which items the PLAN fills (the composer, the proof) and how a stored item
|
|
12
|
+
* is recognised as a numbered placeholder (the gate, the renderers). Pure.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** The rule is about a plan the model wrote — a template's samples are its structure, an import's items are real. */
|
|
16
|
+
export function itemFillApplies(plan: Pick<SitePlan, 'source'>): boolean {
|
|
17
|
+
return plan.source?.kind === SitePlanSourceKind.Ai;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const TEMPLATE_NUMBER = /\{n\}/;
|
|
21
|
+
|
|
22
|
+
/** Whether the plan gives item `n` (1-based) of `type` its own title: a real item, or a sample with its own words. */
|
|
23
|
+
export function isFilledItem(type: ContentTypePlan, n: number): boolean {
|
|
24
|
+
const seed = type.seed;
|
|
25
|
+
if (!seed || n < 1 || n > seed.count) return false;
|
|
26
|
+
if (!seed.sample) return true;
|
|
27
|
+
const own = seed.perItem?.[type.roles.title]?.[n - 1];
|
|
28
|
+
return typeof own === 'string' && own.trim() !== '' && !TEMPLATE_NUMBER.test(own);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The numbers (1-based) of the items of `type` the plan fills. */
|
|
32
|
+
export function filledItemNumbers(type: ContentTypePlan): number[] {
|
|
33
|
+
const out: number[] = [];
|
|
34
|
+
for (let n = 1; n <= (type.seed?.count ?? 0); n++) if (isFilledItem(type, n)) out.push(n);
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The content types of an AI plan whose samples are all numbered placeholders — the lists that start as ghost cards. */
|
|
39
|
+
export function placeholderContentTypes(plan: SitePlan): Set<string> {
|
|
40
|
+
if (!itemFillApplies(plan)) return new Set();
|
|
41
|
+
return new Set(plan.contentTypes.filter(t => t.seed?.sample && t.seed.count > 0 && !filledItemNumbers(t).length).map(t => t.name));
|
|
42
|
+
}
|
|
@@ -2,6 +2,7 @@ import { ColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
|
2
2
|
|
|
3
3
|
import { LayoutLayer, LayoutLayerKind, LayoutSection, LayoutSectionKind } from './layout-language';
|
|
4
4
|
import { GenerationTier } from './site-plan.model';
|
|
5
|
+
import { tierOffers } from './part-tier';
|
|
5
6
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -87,10 +88,10 @@ export function drawerRamp(n: number): ColorScheme[] | null {
|
|
|
87
88
|
return ramp ? ramp.map(id => id as ColorScheme) : null;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
/** A signature of the contract offered to a build at `tier`:
|
|
91
|
+
/** A signature of the contract offered to a build at `tier`: every row, at every tier since AW-D42 (`tierOffers`). */
|
|
91
92
|
export function layoutSignatureOffered(id: string, tier: `${GenerationTier}` | string | null | undefined): boolean {
|
|
92
93
|
const row = SPEC_SITE_LAYOUT.signatures.find(s => s.id === id);
|
|
93
|
-
return !!row && (row.tier
|
|
94
|
+
return !!row && tierOffers(row.tier, tier);
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
/** The section kinds the layout wire offers a build at `tier`: content · inhale · signature, and a signature kind
|
|
@@ -53,16 +53,12 @@ export enum LayoutMixIngredient {
|
|
|
53
53
|
Phone = 'phone',
|
|
54
54
|
}
|
|
55
55
|
const MIX_SEPARATOR = ':';
|
|
56
|
-
const BASIC = 'basic';
|
|
57
|
-
const AWARD = 'award';
|
|
58
56
|
const PART_SEPARATOR = '.';
|
|
59
57
|
/** Every word a stored mix may hold, ingredient by ingredient (a waiting word too: a stored answer still reads). */
|
|
60
58
|
export const LAYOUT_MIX_WORDS: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listIngredientWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
61
|
-
/** The words the wire OFFERS
|
|
62
|
-
*
|
|
63
|
-
export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).filter(w => listWordOffered(k, w
|
|
64
|
-
/** AW11: every built word, the award tier's included — what the wire offers an award site before the lists are read. */
|
|
65
|
-
export const LAYOUT_MIX_OFFERED_AWARD: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
59
|
+
/** The words the wire OFFERS — the built ones only (ingredients.md §3.3: a waiting word would put its stand-in on every
|
|
60
|
+
* site that asked for it); the award tier's round-two words at every tier since AW-D42 (`listWordOffered`). */
|
|
61
|
+
export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).filter(w => listWordOffered(k, w)).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
66
62
|
|
|
67
63
|
/** A list a composed page may show, as the wire's parts enum needs it (`layoutListShapes` gives these). */
|
|
68
64
|
export interface LayoutWireList { alias: string; roles: ReadonlyArray<string> }
|
|
@@ -73,8 +69,8 @@ export interface LayoutWireOptions {
|
|
|
73
69
|
lists?: ReadonlyArray<LayoutWireList>;
|
|
74
70
|
/** L-D12: what this business type's lists never do — those words are not offered (the check repairs one anyway). */
|
|
75
71
|
never?: LayoutListNever | null;
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
72
|
+
/** The tier the site is built at. Since AW-D42 every tier is offered every built list word; kept so its callers still
|
|
73
|
+
* read (no property changes either way). */
|
|
78
74
|
tier?: string | null;
|
|
79
75
|
/** A redesign (site-redesign RD2, H3): THIS page's carry handles (`carryHandles`) — given, every layer carries `carry`,
|
|
80
76
|
* closed to these handles: a model can place only the page's own parts (one property: 38, 40 with lists). */
|
|
@@ -123,8 +119,7 @@ export function isSectionCarryHandle(handle: string): boolean {
|
|
|
123
119
|
return SECTION_HANDLE.test(handle);
|
|
124
120
|
}
|
|
125
121
|
|
|
126
|
-
/** AW11: what else decides a word's offer — the
|
|
127
|
-
* judged). */
|
|
122
|
+
/** AW11: what else decides a word's offer — the plan's lists (absent: not judged). The tier holds back none since AW-D42. */
|
|
128
123
|
export interface LayoutMixOfferOptions {
|
|
129
124
|
readonly tier?: string | null;
|
|
130
125
|
readonly lists?: ReadonlyArray<LayoutWireList>;
|
|
@@ -132,12 +127,11 @@ export interface LayoutMixOfferOptions {
|
|
|
132
127
|
|
|
133
128
|
/**
|
|
134
129
|
* The mix words offered to a business whose lists never do `never` (L-D12): the built words less the forbidden ones —
|
|
135
|
-
* and since AW11
|
|
136
|
-
* picture at all) never (R-H-AW11-7: the one table, `listWordRefusal`; `checkList` judges each list).
|
|
130
|
+
* and since AW11 a word NO list of the plan can carry (a second picture, a picture at all) never (R-H-AW11-7: the one table, `listWordRefusal`; `checkList` judges each list).
|
|
137
131
|
*/
|
|
138
132
|
export function layoutMixOffered(never?: LayoutListNever | null, options: LayoutMixOfferOptions = {}): string[] {
|
|
139
133
|
const banned = new Set([...(never?.arranges ?? []).map(w => `arrange${MIX_SEPARATOR}${w}`), ...(never?.moves ?? []).map(w => `move${MIX_SEPARATOR}${w}`)]);
|
|
140
|
-
const offered =
|
|
134
|
+
const offered = LAYOUT_MIX_OFFERED;
|
|
141
135
|
const lists = options.lists;
|
|
142
136
|
return offered.filter(w => {
|
|
143
137
|
if (banned.has(w)) return false;
|
|
@@ -183,8 +177,8 @@ const closed = (properties: Record<string, JsonSchema>, d?: string) => jsonClose
|
|
|
183
177
|
/** The strict format for one composed page — with the list ingredients when `options.lists` is given. */
|
|
184
178
|
export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchema {
|
|
185
179
|
const partWords = options.lists ? layoutWirePartWords(options.lists) : [];
|
|
186
|
-
//
|
|
187
|
-
const mixOffered =
|
|
180
|
+
// AW-D42: every tier is offered every built word, narrowed by what the plan's lists can carry (R-H-AW11-7).
|
|
181
|
+
const mixOffered = layoutMixOffered(options.never, { tier: options.tier, lists: options.lists });
|
|
188
182
|
const lists: Record<string, JsonSchema> = options.lists
|
|
189
183
|
? {
|
|
190
184
|
mix: listOf(jsonOneOf(mixOffered), `gallery showing a list (source): how its items are shown, one word per choice — ${mixHint(mixOffered)}; [] for none`),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
LayoutIssue, LayoutIssueCode, LayoutListHow, LayoutListMix, LayoutListShape, LayoutListWho, LayoutMendKind,
|
|
4
4
|
} from './layout-language';
|
|
5
5
|
import {
|
|
6
|
-
LIST_INGREDIENTS, LIST_TABLE, ListIngredient, ListWordRefusal, listBuiltWords, listMeaning,
|
|
6
|
+
LIST_INGREDIENTS, LIST_TABLE, ListIngredient, ListWordRefusal, listBuiltWords, listMeaning, listWordOffered, listWordRefusal,
|
|
7
7
|
} from './list-table';
|
|
8
8
|
import { ListSaid } from './list-words';
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ export interface ListPanelWord {
|
|
|
21
21
|
readonly word: string;
|
|
22
22
|
/** The contract's meaning — the row's hint. */
|
|
23
23
|
readonly meaning: string;
|
|
24
|
-
/** A
|
|
24
|
+
/** A word held from this build's plan (the plan mark) — none since AW-D42 (`listWordOffered`). */
|
|
25
25
|
readonly pro: boolean;
|
|
26
26
|
/** A hover word: phones never show it, so its hint says "(mouse)" (P4). */
|
|
27
27
|
readonly mouse: boolean;
|
|
@@ -77,7 +77,7 @@ export function listPanelRows(mix: LayoutListMix, ctx: ListPanelContext): ListPa
|
|
|
77
77
|
words: listBuiltWords(k).map(word => ({
|
|
78
78
|
word,
|
|
79
79
|
meaning: listMeaning(k, word, ctx.locale),
|
|
80
|
-
pro:
|
|
80
|
+
pro: !listWordOffered(k, word, ctx.tier),
|
|
81
81
|
mouse: k === HOVER,
|
|
82
82
|
refusal: listWordRefusal(k, word, ctx.shape, ctx.tier, ctx.never),
|
|
83
83
|
})),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommerceLanguage, commerceLanguage } from '@vectoriox/iox-ui/commerce-core';
|
|
2
2
|
|
|
3
|
+
import { tierOffers } from './part-tier';
|
|
3
4
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -46,20 +47,14 @@ export function listMeaning(k: ListIngredient, word: string, locale?: string | n
|
|
|
46
47
|
|
|
47
48
|
// ── AW11 (award-ingredients-plan.md §7.1f, board award-lists): the award tier, the rhythms, what each word needs ─────
|
|
48
49
|
|
|
49
|
-
/**
|
|
50
|
+
/** The tier a word was first drawn for (`all`, or `pro` — the award tier's, AW-D23); since AW-D42 every tier wears both. */
|
|
50
51
|
export function listWordTier(k: ListIngredient, word: string): 'all' | 'pro' {
|
|
51
52
|
return (LIST_TABLE.tiers as Readonly<Record<string, string>>)[`${k}.${word}`] === 'pro' ? 'pro' : 'all';
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
/** May a build at `tier` wear this word?
|
|
55
|
+
/** May a build at `tier` wear this word? Every tier wears every word (AW-D42, `tierOffers`). */
|
|
55
56
|
export function listWordOffered(k: ListIngredient, word: string, tier?: string | null): boolean {
|
|
56
|
-
return listWordTier(k, word)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** The word a round-two word is drawn as below the award tier (null: left out), from the contract's `belowPro`. */
|
|
60
|
-
export function listBelowPro(k: ListIngredient, word: string): string | null | undefined {
|
|
61
|
-
const stand = (LIST_TABLE.belowPro as Readonly<Record<string, string | null>>)[`${k}.${word}`];
|
|
62
|
-
return stand === undefined ? undefined : stand;
|
|
57
|
+
return tierOffers(listWordTier(k, word), tier);
|
|
63
58
|
}
|
|
64
59
|
|
|
65
60
|
/** One step of a gallery wall: its share of a 12-column row and how far it hangs below the row's line (px). */
|
|
@@ -112,8 +107,6 @@ export function bentoFill(items: number): number | null {
|
|
|
112
107
|
|
|
113
108
|
/** Why a list cannot carry a word (R-H-AW11-7 — ONE table for the wire, the judge and Bindings ▸ List). */
|
|
114
109
|
export enum ListWordRefusal {
|
|
115
|
-
/** The award tier's word, on a plan below it (AW-D23). */
|
|
116
|
-
ProOnly = 'pro-only',
|
|
117
110
|
/** The word shows a picture in every item, and the list has none. */
|
|
118
111
|
NoPictures = 'no-pictures',
|
|
119
112
|
/** The word shows a second picture (the gallery role), and the list has none (AW11-D12). */
|
|
@@ -133,11 +126,9 @@ const inRule = (rule: Readonly<Partial<Record<ListIngredient, ReadonlyArray<stri
|
|
|
133
126
|
/**
|
|
134
127
|
* Can this list carry this word — and if not, why (R-H-AW11-7)? The ONE answer the wire's offer, `checkList` and
|
|
135
128
|
* Bindings ▸ List read: a word the list's data cannot carry is never offered, never picked. `shape` null: nothing is
|
|
136
|
-
* known of the list (any word
|
|
137
|
-
* builder).
|
|
129
|
+
* known of the list (any word). `tier` holds back no word since AW-D42; kept so its callers still read.
|
|
138
130
|
*/
|
|
139
131
|
export function listWordRefusal(k: ListIngredient, word: string, shape: ListWordShape | null, tier?: string | null, never?: ListWordNever | null): ListWordRefusal | null {
|
|
140
|
-
if (tier !== undefined && tier !== null && !listWordOffered(k, word, tier)) return ListWordRefusal.ProOnly;
|
|
141
132
|
if (never && ((k === 'arrange' && never.arranges.includes(word)) || (k === 'move' && never.moves.includes(word)))) return ListWordRefusal.Never;
|
|
142
133
|
if (!shape) return null;
|
|
143
134
|
if (inRule(LIST_RULES.pictured, k, word) && !shape.roles.includes('image')) return ListWordRefusal.NoPictures;
|
|
@@ -16,7 +16,8 @@ import { ListIngredient, listMeaning } from './list-table';
|
|
|
16
16
|
export enum ListSayCode {
|
|
17
17
|
/** A word the product draws in a later phase, drawn as its stand-in meanwhile (or left out). */
|
|
18
18
|
Waits = 'list-waits',
|
|
19
|
-
/** A round-two word on a site below the award plan: its stand-in instead (or left out).
|
|
19
|
+
/** A round-two word on a site below the award plan: its stand-in instead (or left out). No longer said since AW-D42
|
|
20
|
+
* (every tier wears every word); kept so a stored run's sentence still reads. */
|
|
20
21
|
AwardOnly = 'list-award-only',
|
|
21
22
|
/** The mix shows roles the list does not hold. */
|
|
22
23
|
NoSuchParts = 'list-no-such-parts',
|
|
@@ -145,8 +145,39 @@ const MENU_WORDS: Readonly<Record<string, MenuWords>> = {
|
|
|
145
145
|
he: { menu: 'תפריט', close: 'סגירה', closeMenu: 'סגירת התפריט', more: 'עוד', home: 'בית' },
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
/** vectoriox/iox-ui#177: the words a menu button may be named, in order — the next is taken while a page of the site is
|
|
149
|
+
* called like the one before (a café's "Menu" page beside a "Menu" button: a visitor cannot tell which gives the food).
|
|
150
|
+
* Its Close is named with it. */
|
|
151
|
+
const MENU_BUTTON_LADDER: Readonly<Record<string, ReadonlyArray<Pick<MenuWords, 'menu' | 'closeMenu'>>>> = {
|
|
152
|
+
en: [{ menu: 'Menu', closeMenu: 'Close menu' }, { menu: 'Pages', closeMenu: 'Close pages' }, { menu: 'Navigation', closeMenu: 'Close navigation' }],
|
|
153
|
+
he: [{ menu: 'תפריט', closeMenu: 'סגירת התפריט' }, { menu: 'עמודים', closeMenu: 'סגירת העמודים' }, { menu: 'ניווט', closeMenu: 'סגירת הניווט' }],
|
|
154
|
+
};
|
|
155
|
+
/** The same for the bottom bar's More (a page called "More"). */
|
|
156
|
+
const MORE_LADDER: Readonly<Record<string, ReadonlyArray<string>>> = {
|
|
157
|
+
en: ['More', 'Other pages'],
|
|
158
|
+
he: ['עוד', 'עמודים נוספים'],
|
|
159
|
+
};
|
|
160
|
+
/** An article a page name may start with that does not make it another word ("The menu", "התפריט"). */
|
|
161
|
+
const LEADING_ARTICLE: Readonly<Record<string, RegExp>> = { en: /^(?:the|our)\s+/u, he: /^ה(?=\p{L}{2})/u };
|
|
162
|
+
|
|
163
|
+
/** One word of the navigation said the same way: case, stops and a leading article aside. */
|
|
164
|
+
function navWordKey(words: string, lang: string): string {
|
|
165
|
+
const plain = words.normalize('NFC').toLocaleLowerCase().replace(/[^\p{L}\p{N}\s]/gu, '').replace(/\s+/g, ' ').trim();
|
|
166
|
+
return plain.replace(LEADING_ARTICLE[lang] ?? /^$/u, '');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** The words of the menu's parts in the site's language. Given the labels of the pages it links to (iox-ui#177), the
|
|
170
|
+
* menu button (and its drawer and Close) and the bar's More never say a word a page is called: each takes the next word
|
|
171
|
+
* of its ladder. */
|
|
172
|
+
export function menuWords(locale: string | undefined, labels: ReadonlyArray<string> = []): MenuWords {
|
|
173
|
+
const lang = MENU_WORDS[commerceLanguage(locale)] ? commerceLanguage(locale) : 'en';
|
|
174
|
+
const base = MENU_WORDS[lang];
|
|
175
|
+
if (!labels.length) return base;
|
|
176
|
+
const taken = new Set(labels.map(l => navWordKey(l, lang)));
|
|
177
|
+
const free = (w: string) => !taken.has(navWordKey(w, lang));
|
|
178
|
+
const buttons = MENU_BUTTON_LADDER[lang];
|
|
179
|
+
const mores = MORE_LADDER[lang];
|
|
180
|
+
return { ...base, ...(buttons.find(b => free(b.menu)) ?? buttons[buttons.length - 1]), more: mores.find(free) ?? mores[mores.length - 1] };
|
|
150
181
|
}
|
|
151
182
|
|
|
152
183
|
/** The layer names of the parts (R2: the tree, the breadcrumb and the toolbar read them). */
|
|
@@ -467,12 +498,9 @@ const WORD_BUTTON_LAY = { width: 'auto', minWidth: '48px' };
|
|
|
467
498
|
|
|
468
499
|
/** What a menu button shows for its kind — closed (the menu button) or open (the drawer's Close, which lands where the
|
|
469
500
|
* menu button is): the list icon and an X, the nine dots and an X (the shared CSS draws both as dots), or the word. */
|
|
470
|
-
function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolean,
|
|
501
|
+
function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolean, words: MenuWords): SerializedNode[] {
|
|
471
502
|
switch (kind) {
|
|
472
|
-
case MenuButtonKind.Word: {
|
|
473
|
-
const words = menuWords(locale);
|
|
474
|
-
return [labelText(kit, `${suffix}-word`, open ? words.close : words.menu)];
|
|
475
|
-
}
|
|
503
|
+
case MenuButtonKind.Word: return [labelText(kit, `${suffix}-word`, open ? words.close : words.menu)];
|
|
476
504
|
case MenuButtonKind.Dots: return [iconNode(kit, `${suffix}-dots`, open ? CLOSE_ICON : DOTS_ICON)];
|
|
477
505
|
default: return [iconNode(kit, `${suffix}-icon`, open ? CLOSE_ICON : MENU_ICON)];
|
|
478
506
|
}
|
|
@@ -480,12 +508,12 @@ function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolea
|
|
|
480
508
|
|
|
481
509
|
/** Give a menu button (or the drawer's Close) a kind. The same kind keeps the author's children; another kind gets that
|
|
482
510
|
* kind's face and size. */
|
|
483
|
-
function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuButtonKind, open: boolean,
|
|
511
|
+
function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuButtonKind, open: boolean, words: MenuWords): void {
|
|
484
512
|
const was = menuButtonOf(btn.props?.[MenuTrait.Button]);
|
|
485
513
|
const { [MenuTrait.Button]: _drop, ...props } = btn.props ?? {};
|
|
486
514
|
btn.props = { ...props, ...menuButtonProps(kind) };
|
|
487
515
|
if (was === kind) return;
|
|
488
|
-
btn.children = buttonFace(kit, suffix, kind, open,
|
|
516
|
+
btn.children = buttonFace(kit, suffix, kind, open, words);
|
|
489
517
|
if (kind === MenuButtonKind.Word) Object.assign(btn.styleProps, WORD_BUTTON_LAY);
|
|
490
518
|
else if (was === MenuButtonKind.Word) Object.assign(btn.styleProps, { width: MENU_BUTTON_LAY.width, minWidth: ICON_BUTTON_MIN_WIDTH });
|
|
491
519
|
}
|
|
@@ -494,12 +522,12 @@ function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuBu
|
|
|
494
522
|
const ICON_BUTTON_MIN_WIDTH = String(createSerializedNode('min-width', BUTTON, { tag: 'button' }, 'button-ghost', COMPOSED).styleProps['minWidth'] ?? '0px');
|
|
495
523
|
|
|
496
524
|
/** Put a look on a header's menu: the drawer's traits, and the menu button's and the Close's kind. */
|
|
497
|
-
function dressMenu(kit: Kit, dr: SerializedNode | null, menu: SerializedNode | null, look: Partial<MenuLook>,
|
|
525
|
+
function dressMenu(kit: Kit, dr: SerializedNode | null, menu: SerializedNode | null, look: Partial<MenuLook>, words: MenuWords): void {
|
|
498
526
|
if (dr) dressDrawer(dr, look);
|
|
499
527
|
if (!look.button) return;
|
|
500
|
-
if (menu) dressButton(kit, menu, 'menu', look.button, false,
|
|
528
|
+
if (menu) dressButton(kit, menu, 'menu', look.button, false, words);
|
|
501
529
|
const close = dr ? find([dr], NavRole.DrawerClose) : null;
|
|
502
|
-
if (close) dressButton(kit, close, 'drawer-close', look.button, true,
|
|
530
|
+
if (close) dressButton(kit, close, 'drawer-close', look.button, true, words);
|
|
503
531
|
}
|
|
504
532
|
|
|
505
533
|
function barItem(kit: Kit, i: number, page: NavPage): SerializedNode {
|
|
@@ -655,10 +683,10 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
|
|
|
655
683
|
const everyWidth = shape === NavShape.Drawer && (options.everyWidth ?? wasEveryWidth);
|
|
656
684
|
if (options.everyWidth && shape !== NavShape.Drawer) throw new NavShapeError('only a drawer menu shows at every width');
|
|
657
685
|
const kit = makeKit(out, root.id, options.newId);
|
|
658
|
-
const words = menuWords(options.locale);
|
|
659
686
|
|
|
660
687
|
adoptRoles(root);
|
|
661
688
|
const { pages } = phoneMenuPages(root, options.pages);
|
|
689
|
+
const words = menuWords(options.locale, pages.map(p => p.label));
|
|
662
690
|
const wantDrawer = shape !== NavShape.Bar;
|
|
663
691
|
const wantBar = shape !== NavShape.Drawer;
|
|
664
692
|
const wantMenuButton = shape === NavShape.Drawer;
|
|
@@ -704,7 +732,7 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
|
|
|
704
732
|
placeMenu(root, menu, (options.menuSide as MenuSide | undefined) ?? null, was);
|
|
705
733
|
}
|
|
706
734
|
// HI2a: the menu's look, when one is asked (the composer's header recipe; the Header studio later).
|
|
707
|
-
if (options.look) dressMenu(kit, dr, menu, options.look,
|
|
735
|
+
if (options.look) dressMenu(kit, dr, menu, options.look, words);
|
|
708
736
|
if (dr && shape === NavShape.Drawer) kids.push(dr);
|
|
709
737
|
if (dr && shape === NavShape.Both) {
|
|
710
738
|
dr.isGlobal = true;
|
|
@@ -789,8 +817,9 @@ export function addBarItem(globals: ReadonlyArray<SerializedNode>, options: Pick
|
|
|
789
817
|
const kids = b.children ?? (b.children = []);
|
|
790
818
|
if (kids.length >= BAR_ITEMS_MAX) return { globals: out, added: false };
|
|
791
819
|
const linked = new Set(kids.filter(c => c.role === NavRole.BarItem).map(c => prop(c, 'pageRoute')));
|
|
792
|
-
const
|
|
793
|
-
const
|
|
820
|
+
const sitePages = phoneMenuPages(root, options.pages).pages;
|
|
821
|
+
const words = menuWords(options.locale, sitePages.map(p => p.label));
|
|
822
|
+
const page = barPages(root, sitePages, BAR_ITEMS_MAX + 1, words).find(p => !linked.has(p.route))
|
|
794
823
|
?? { label: words.home, route: HOME_ROUTE };
|
|
795
824
|
const item = barItem(makeKit(out, root.id, options.newId), kids.length, page);
|
|
796
825
|
const more = kids.findIndex(c => c.role === NavRole.More);
|