@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
|
@@ -60,6 +60,18 @@ export enum MenuPhoneForm {
|
|
|
60
60
|
Full = 'full',
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/** What the menu shows besides its own head (HI2 shelves, header-builder board v2 "menu contents"): the page names (today's),
|
|
64
|
+
* the page names LARGE in the look's display face (Flyward's and Hotel Aurelia's full-screen index), the first four large
|
|
65
|
+
* with a MORE row of the rest and a picture card (Savvia's card: four names at 48px, "MÁS", small links and a reel tile),
|
|
66
|
+
* or pictured cards for the site's main collections beside the page names (Vonder's top panel: two category photo tiles
|
|
67
|
+
* and the page list). `two-levels` waits for HI6 and is drawn as the page names. */
|
|
68
|
+
export enum MenuShows {
|
|
69
|
+
Links = 'links',
|
|
70
|
+
Big = 'big',
|
|
71
|
+
WordsCard = 'words-card',
|
|
72
|
+
Pictures = 'pictures',
|
|
73
|
+
}
|
|
74
|
+
|
|
63
75
|
/** The traits, stored in the node's props (no default: a node saved before HI2 saves none). */
|
|
64
76
|
export enum MenuTrait {
|
|
65
77
|
/** On the menu (the Dialog). */
|
|
@@ -67,6 +79,8 @@ export enum MenuTrait {
|
|
|
67
79
|
Reveal = 'menuReveal',
|
|
68
80
|
Hover = 'menuHover',
|
|
69
81
|
Phone = 'menuPhone',
|
|
82
|
+
/** HI2: what the menu shows (`MenuShows`) — the shelves' parts are its children; the trait sizes them. */
|
|
83
|
+
Shows = 'menuShows',
|
|
70
84
|
/** On the menu button AND the menu's Close (the same button, open). */
|
|
71
85
|
Button = 'menuButton',
|
|
72
86
|
}
|
|
@@ -76,6 +90,7 @@ export enum MenuAttribute {
|
|
|
76
90
|
Reveal = 'data-iox-reveal',
|
|
77
91
|
Hover = 'data-iox-menu-hover',
|
|
78
92
|
Phone = 'data-iox-menu-phone',
|
|
93
|
+
Shows = 'data-iox-menu-shows',
|
|
79
94
|
Button = 'data-iox-menu-button',
|
|
80
95
|
}
|
|
81
96
|
|
|
@@ -89,6 +104,8 @@ export interface MenuLook {
|
|
|
89
104
|
button: MenuButtonKind;
|
|
90
105
|
hover: MenuHover;
|
|
91
106
|
phone: MenuPhoneForm;
|
|
107
|
+
/** HI2: what it shows. */
|
|
108
|
+
shows: MenuShows;
|
|
92
109
|
}
|
|
93
110
|
|
|
94
111
|
/** Today's menu, every default (R-H4: it writes nothing). */
|
|
@@ -98,6 +115,7 @@ export const DEFAULT_MENU_LOOK: Readonly<MenuLook> = Object.freeze({
|
|
|
98
115
|
button: MenuButtonKind.Lines,
|
|
99
116
|
hover: MenuHover.Line,
|
|
100
117
|
phone: MenuPhoneForm.Drawer,
|
|
118
|
+
shows: MenuShows.Links,
|
|
101
119
|
});
|
|
102
120
|
|
|
103
121
|
const valueOf = <E extends string>(values: ReadonlyArray<E>, fallback: E) => (v: unknown): E =>
|
|
@@ -108,6 +126,8 @@ export const menuRevealOf = valueOf(Object.values(MenuReveal), DEFAULT_MENU_LOOK
|
|
|
108
126
|
export const menuButtonOf = valueOf(Object.values(MenuButtonKind), DEFAULT_MENU_LOOK.button);
|
|
109
127
|
export const menuHoverOf = valueOf(Object.values(MenuHover), DEFAULT_MENU_LOOK.hover);
|
|
110
128
|
export const menuPhoneOf = valueOf(Object.values(MenuPhoneForm), DEFAULT_MENU_LOOK.phone);
|
|
129
|
+
/** A word the product does not draw (`two-levels`, HI6) reads as the page names. */
|
|
130
|
+
export const menuShowsOf = valueOf(Object.values(MenuShows), DEFAULT_MENU_LOOK.shows);
|
|
111
131
|
|
|
112
132
|
/** Reads a trait (`props` on a serialized node). */
|
|
113
133
|
export type MenuTraitReader = (name: MenuTrait) => unknown;
|
|
@@ -119,10 +139,12 @@ export function menuDialogAttributes(read: MenuTraitReader): Record<string, stri
|
|
|
119
139
|
const reveal = menuRevealOf(read(MenuTrait.Reveal));
|
|
120
140
|
const hover = menuHoverOf(read(MenuTrait.Hover));
|
|
121
141
|
const phone = menuPhoneOf(read(MenuTrait.Phone));
|
|
142
|
+
const shows = menuShowsOf(read(MenuTrait.Shows));
|
|
122
143
|
if (form !== DEFAULT_MENU_LOOK.form) out[MenuAttribute.Form] = form;
|
|
123
144
|
if (reveal !== DEFAULT_MENU_LOOK.reveal) out[MenuAttribute.Reveal] = reveal;
|
|
124
145
|
if (hover !== DEFAULT_MENU_LOOK.hover) out[MenuAttribute.Hover] = hover;
|
|
125
146
|
if (phone !== DEFAULT_MENU_LOOK.phone) out[MenuAttribute.Phone] = phone;
|
|
147
|
+
if (shows !== DEFAULT_MENU_LOOK.shows) out[MenuAttribute.Shows] = shows;
|
|
126
148
|
return out;
|
|
127
149
|
}
|
|
128
150
|
|
|
@@ -139,6 +161,7 @@ export function menuDialogProps(look: Partial<MenuLook>): Record<string, string>
|
|
|
139
161
|
if (look.reveal && look.reveal !== DEFAULT_MENU_LOOK.reveal) out[MenuTrait.Reveal] = look.reveal;
|
|
140
162
|
if (look.hover && look.hover !== DEFAULT_MENU_LOOK.hover) out[MenuTrait.Hover] = look.hover;
|
|
141
163
|
if (look.phone && look.phone !== DEFAULT_MENU_LOOK.phone) out[MenuTrait.Phone] = look.phone;
|
|
164
|
+
if (look.shows && look.shows !== DEFAULT_MENU_LOOK.shows) out[MenuTrait.Shows] = look.shows;
|
|
142
165
|
return out;
|
|
143
166
|
}
|
|
144
167
|
|
|
@@ -50,6 +50,45 @@ const ROLE_PREFIX = 'iox-role-';
|
|
|
50
50
|
const ROLE_SHAPE = /^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)*$/;
|
|
51
51
|
const MARKER_PREFIX = `${ELEMENT_STYLE_MARKER_CLASS}-`;
|
|
52
52
|
|
|
53
|
+
/** The scheme rows that name a scheme's GROUND (what its band and its boxes are painted). */
|
|
54
|
+
const SCHEME_GROUND_ROWS: ReadonlyArray<string> = ['section-bg', 'bg', 'surface'];
|
|
55
|
+
/** The row a scheme re-declares when it changes the ink. */
|
|
56
|
+
const SCHEME_INK_ROW = 'text';
|
|
57
|
+
/** The one token a scheme row or a style value names: `var(--iox-x)` or the contract's `{{x}}` / `{{~x}}`. */
|
|
58
|
+
const ONE_GROUND_TOKEN = /^(?:var\(\s*--iox-([a-z0-9-]+)\s*\)|\{\{~?([a-z0-9-]+)\}\})$/;
|
|
59
|
+
const groundToken = (v: unknown): string | null => {
|
|
60
|
+
const m = ONE_GROUND_TOKEN.exec(String(v ?? '').trim());
|
|
61
|
+
return m ? (m[1] ?? m[2]) : null;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Ground token → the scheme it is the ground of, read from the contract (iox-ui#186): only a scheme that RE-DECLARES the
|
|
65
|
+
* ink (a dark band's words, buttons, lines) and whose ground tokens keep their meaning inside it — Inverse paints
|
|
66
|
+
* `inverse-bg` and never re-declares it, so a node painted `var(--iox-inverse-bg)` that wears Inverse looks the same and
|
|
67
|
+
* everything in it reads. Brand and Muted re-declare their own grounds (`accent`, `text-muted`), so a painted
|
|
68
|
+
* `var(--iox-accent)` cannot wear Brand without changing colour: those are never inferred.
|
|
69
|
+
*/
|
|
70
|
+
const SCHEME_OF_GROUND: ReadonlyMap<string, ColorScheme> = (() => {
|
|
71
|
+
const out = new Map<string, ColorScheme>();
|
|
72
|
+
for (const [id, { set }] of Object.entries(SPEC_SCHEMES as Readonly<Record<string, { set: Readonly<Record<string, string>> }>>)) {
|
|
73
|
+
if (id === ColorScheme.Default || !(SCHEME_INK_ROW in set)) continue;
|
|
74
|
+
const grounds = SCHEME_GROUND_ROWS.map(row => groundToken(set[row])).filter((t): t is string => !!t);
|
|
75
|
+
if (!grounds.length || grounds.some(t => t in set)) continue;
|
|
76
|
+
for (const t of grounds) if (!out.has(t)) out.set(t, id as ColorScheme);
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
})();
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The scheme a node's painted ground IS (iox-ui#186): a Section or Container whose `backgroundColor` is exactly a
|
|
83
|
+
* scheme's own ground token (`var(--iox-inverse-bg)`) — the free stamp gives it that scheme so every token the look
|
|
84
|
+
* reads inside (a button's ink and outline, a line, a link) is re-declared for the ground, not only the words someone
|
|
85
|
+
* coloured by hand. Null for any other value (a page token, a colour-mix, a ground a scheme re-declares).
|
|
86
|
+
*/
|
|
87
|
+
export function schemeOfGround(backgroundColor: unknown): ColorScheme | null {
|
|
88
|
+
const token = groundToken(backgroundColor);
|
|
89
|
+
return token ? SCHEME_OF_GROUND.get(token) ?? null : null;
|
|
90
|
+
}
|
|
91
|
+
|
|
53
92
|
/** `iox-scheme-<id>` for a known NON-default scheme, else null — an unknown id never reaches a class attribute. */
|
|
54
93
|
export function colorSchemeClass(id: unknown): string | null {
|
|
55
94
|
return typeof id === 'string' && id !== ColorScheme.Default && SCHEME_IDS.has(id) ? `${SCHEME_PREFIX}${id}` : null;
|
|
@@ -30,6 +30,7 @@ export * from './node-links';
|
|
|
30
30
|
export * from './brand';
|
|
31
31
|
export * from './colour-eval';
|
|
32
32
|
export * from './brand-neutrals';
|
|
33
|
+
export * from './colour-words';
|
|
33
34
|
export * from './contrast-audit';
|
|
34
35
|
export * from './flavor-tokens';
|
|
35
36
|
export * from './flavor-seed';
|
|
@@ -46,5 +47,6 @@ export * from './graphemes';
|
|
|
46
47
|
export * from './preloader';
|
|
47
48
|
export * from './preloader-of';
|
|
48
49
|
export * from './scrub';
|
|
50
|
+
export * from './signature-move';
|
|
49
51
|
export * from './locale-direction';
|
|
50
52
|
export * from './close-word';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ANIMATE_IDS, AnimateId, DesignChoices } from './design-token.model';
|
|
2
|
+
import { presetMotionLanguage, QUIET_LEVELS } from './motion-language';
|
|
3
|
+
import { PRELOADER_LEVELS, PreloaderKind } from './preloader';
|
|
4
|
+
import { SCRUB_LEVELS, ScrubId, scrubOfChoices } from './scrub';
|
|
5
|
+
import { stylePresetOfChoices } from './style-presets';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* THE SIGNATURE MOVE (motion-reach-plan.md MR-D1…MR-D4; the 2026-11-28 reference baseline's gap #2) — pure,
|
|
9
|
+
* framework-free. Every reference a generated site is scored against has a signature move; the J10 sites had none,
|
|
10
|
+
* because the look's preloader and By the scroll were kept only on a Lively start and nearly every generated start is
|
|
11
|
+
* Still, Subtle or Standard. This completes a GENERATED look with ONE move its kind of business signs with (harness
|
|
12
|
+
* `SIGNATURE_MOVES`, carried on each business type as `signature`), so the wizard's start (harness-core `presetDesign`)
|
|
13
|
+
* and every compose of a plan (generation-core `composeSite`) wear the same — a rebuild from a kept plan included, with no
|
|
14
|
+
* model call. Only BUILT parts: the look's first-visit preloader (`design.preloader`) and By the scroll
|
|
15
|
+
* (`design.scrub`); their runtimes are the ones every look already plays (reduced motion: no preloader, a scrub keeps only
|
|
16
|
+
* its opacity — AW-D6). Binds generated output only (D12): Design ▸ Motion turns either off.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** The closed vocabulary (contract `SIGNATURE_MOVES.moves`; build-spec holds the two equal). */
|
|
20
|
+
export enum SignatureMove {
|
|
21
|
+
/** The first visit opens on the look's mark — the preset's own kind, else `mark` (`design.preloader`). */
|
|
22
|
+
Preloader = 'preloader',
|
|
23
|
+
/** The look's entrances follow the scroll (`design.scrub` = `entrances`); the opening plays on time (AW10-D8). */
|
|
24
|
+
Scroll = 'scroll',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const SIGNATURE_MOVES: ReadonlyArray<SignatureMove> = Object.values(SignatureMove);
|
|
28
|
+
|
|
29
|
+
/** What the kind of business says about its signature — every field the caller's (harness-core reads its type). */
|
|
30
|
+
export interface SignatureInput {
|
|
31
|
+
/** The moves it signs with, best first (`BusinessType.signature.moves`). Empty or absent: the look is left as it is. */
|
|
32
|
+
readonly moves?: ReadonlyArray<string> | null;
|
|
33
|
+
/** The level a Still start is lifted to (`BusinessType.signature.floor`, MR-D4) — a still page has nothing to sign with. */
|
|
34
|
+
readonly floor?: string | null;
|
|
35
|
+
/** Its How animated ceiling (`BusinessType.ceiling`): the floor never lifts past it. */
|
|
36
|
+
readonly ceiling?: string | null;
|
|
37
|
+
/** The preloader kinds its art direction refuses (`BusinessType.art.preloader`, ART_NEVER). */
|
|
38
|
+
readonly preloaderNever?: ReadonlyArray<string> | null;
|
|
39
|
+
/** The owner asked for little movement: nothing is added (PL-D6). */
|
|
40
|
+
readonly littleMovement?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface SignatureResult {
|
|
44
|
+
readonly design: DesignChoices;
|
|
45
|
+
/** The move the look signs with — one it already carried, or the one added. Null: none fits (or none asked). */
|
|
46
|
+
readonly move: SignatureMove | null;
|
|
47
|
+
/** The move was added here (false: the look already carried it, or nothing fits). */
|
|
48
|
+
readonly added: boolean;
|
|
49
|
+
/** A Still start was lifted to the floor (MR-D4). */
|
|
50
|
+
readonly lifted: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const rank = (level: string | null | undefined) => ANIMATE_IDS.indexOf(level as AnimateId);
|
|
54
|
+
const STILL: AnimateId = ANIMATE_IDS[0];
|
|
55
|
+
|
|
56
|
+
/** The preloader kind a look would sign with: its own (when its kind of business allows it), else `mark` — or null. */
|
|
57
|
+
export function signaturePreloaderOf(design: DesignChoices, never: ReadonlyArray<string> = []): string | null {
|
|
58
|
+
const own = design.preloader ?? presetMotionLanguage(stylePresetOfChoices(design)?.id ?? null)?.preloader;
|
|
59
|
+
if (own && own !== PreloaderKind.None && !never.includes(own)) return own;
|
|
60
|
+
return never.includes(PreloaderKind.Mark) ? null : PreloaderKind.Mark;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The signature move a look already carries: a preloader that plays at its level and its kind of business allows, or a
|
|
65
|
+
* By the scroll that moves something at its level (`words` lights only text reveals, which a quiet level never stamps —
|
|
66
|
+
* so on Subtle only `entrances` counts). Null: none. Pure.
|
|
67
|
+
*/
|
|
68
|
+
export function signatureMoveOf(design: DesignChoices, preloaderNever: ReadonlyArray<string> = []): SignatureMove | null {
|
|
69
|
+
const level = String(design.animate ?? '');
|
|
70
|
+
if (design.preloader && design.preloader !== PreloaderKind.None && PRELOADER_LEVELS.includes(level) && !preloaderNever.includes(design.preloader)) {
|
|
71
|
+
return SignatureMove.Preloader;
|
|
72
|
+
}
|
|
73
|
+
const scrub = scrubOfChoices(design);
|
|
74
|
+
if (scrub !== ScrubId.Never && SCRUB_LEVELS.includes(level) && (scrub === ScrubId.Entrances || !QUIET_LEVELS.includes(level))) return SignatureMove.Scroll;
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A generated look, signed (MR-D1): unchanged when its kind of business names no move or the owner asked for little
|
|
80
|
+
* movement; else a Still start is lifted to the floor (never past the ceiling), and — unless the look already carries a
|
|
81
|
+
* signature move — the first of the type's moves that plays at its level is added. A move the owner turned off (an
|
|
82
|
+
* explicit `none` / `never`) is never added (D12); with every one off, the look is left exactly as it is. Idempotent. Pure.
|
|
83
|
+
*/
|
|
84
|
+
export function withSignatureMove(design: DesignChoices, input: SignatureInput | null | undefined): SignatureResult {
|
|
85
|
+
// D12: a move the owner turned off (`none` / `never`, stored explicitly) is never added back — and when every move the
|
|
86
|
+
// type signs with is off, nothing is lifted either.
|
|
87
|
+
const off = (m: SignatureMove) => (m === SignatureMove.Preloader ? design.preloader === PreloaderKind.None : design.scrub === ScrubId.Never);
|
|
88
|
+
const moves = (input?.moves ?? []).filter((m): m is SignatureMove => (SIGNATURE_MOVES as ReadonlyArray<string>).includes(m) && !off(m as SignatureMove));
|
|
89
|
+
const never = input?.preloaderNever ?? [];
|
|
90
|
+
if (!moves.length || input?.littleMovement) return { design, move: signatureMoveOf(design, never), added: false, lifted: false };
|
|
91
|
+
const floor = input?.floor && rank(input.floor) > 0 ? (input.floor as AnimateId) : null;
|
|
92
|
+
const liftable = floor && design.animate === STILL && (!input?.ceiling || rank(input.ceiling) >= rank(floor));
|
|
93
|
+
const lifted: DesignChoices = liftable ? { ...design, animate: floor } : design;
|
|
94
|
+
const carried = signatureMoveOf(lifted, never);
|
|
95
|
+
if (carried) return { design: lifted, move: carried, added: false, lifted: !!liftable };
|
|
96
|
+
const level = String(lifted.animate ?? '');
|
|
97
|
+
for (const move of moves) {
|
|
98
|
+
if (move === SignatureMove.Preloader && PRELOADER_LEVELS.includes(level)) {
|
|
99
|
+
const kind = signaturePreloaderOf(lifted, never);
|
|
100
|
+
if (kind) return { design: { ...lifted, preloader: kind }, move, added: true, lifted: !!liftable };
|
|
101
|
+
}
|
|
102
|
+
if (move === SignatureMove.Scroll && SCRUB_LEVELS.includes(level)) {
|
|
103
|
+
return { design: { ...lifted, scrub: ScrubId.Entrances }, move, added: true, lifted: !!liftable };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { design: lifted, move: null, added: false, lifted: !!liftable };
|
|
107
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SPEC_MOODS, SPEC_STYLE_PRESETS } from './flavor-spec.generated';
|
|
2
2
|
import { resolveDesignChoices } from './design-settings';
|
|
3
3
|
import { presetMotionLanguage } from './motion-language';
|
|
4
|
+
import { PreloaderKind } from './preloader';
|
|
5
|
+
import { ScrubId } from './scrub';
|
|
4
6
|
import {
|
|
5
7
|
DensityId, DesignChoices, DesignMode, DesignMotion, MotionId, ShapeId, TintId,
|
|
6
8
|
} from './design-token.model';
|
|
@@ -63,6 +65,9 @@ export function presetModes(preset: StylePreset): DesignMode[] {
|
|
|
63
65
|
* What picking a preset means — the complete `DesignChoices`, its motion included — in `mode` (default:
|
|
64
66
|
* its first). A mode it was not audited in is REFUSED (null): a light-only preset is never worn dark.
|
|
65
67
|
*/
|
|
68
|
+
/** A style's own motion word, or nothing when it is the style's "none" — never stored as the owner's choice. */
|
|
69
|
+
const ownWord = (word: string | undefined, none: string): string | undefined => (word && word !== none ? word : undefined);
|
|
70
|
+
|
|
66
71
|
export function presetChoices(id: string, mode?: DesignMode): DesignChoices | null {
|
|
67
72
|
const preset = stylePresetById(id);
|
|
68
73
|
if (!preset) return null;
|
|
@@ -74,9 +79,10 @@ export function presetChoices(id: string, mode?: DesignMode): DesignChoices | nu
|
|
|
74
79
|
// AW3: the look's own motion language — its Feel and how its headings arrive (MB-D5); AW5: its first-visit
|
|
75
80
|
// preloader (PL-D1 — the exit is the preset's, never stored).
|
|
76
81
|
feel: presetMotionLanguage(preset.id)?.arrive, headings: presetMotionLanguage(preset.id)?.move,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
// A style without one stores nothing (absent, not `none`): only the OWNER's none is a choice (motion reach, D12).
|
|
83
|
+
preloader: ownWord(presetMotionLanguage(preset.id)?.preloader, PreloaderKind.None),
|
|
84
|
+
// AW10: its By the scroll (a style's never stores nothing, as its preloader's none).
|
|
85
|
+
scrub: ownWord(presetMotionLanguage(preset.id)?.scrub, ScrubId.Never),
|
|
80
86
|
});
|
|
81
87
|
}
|
|
82
88
|
|
|
@@ -15,9 +15,11 @@ import { specTokenNames } from './token-names';
|
|
|
15
15
|
* 2. schemes `.iox-scheme-<id> { overrides; every var()-referencing token re-declared }`, then the
|
|
16
16
|
* ONE scheme-ink rule `.iox-scheme-subtle, … { color: var(--iox-text) }` (iox-ui#15)
|
|
17
17
|
* columns `[data-iox-column="<word>"] { --iox-content-width: <literal>; --iox-content-cap: <length>; every token reading it }` (award §0c)
|
|
18
|
+
* phone step `@media (max-width: 767px) { <root> { --iox-space-section: <phone>; its readers } }` (CO5; the builder's
|
|
19
|
+
* canvas: `@container iox-canvas (…) { <scope> > * { … } }`)
|
|
18
20
|
* caseless script `<root>:is([lang|="he" i], …), <root> :is(…) { case + tracking tokens stand down }` (iox-ui#124)
|
|
19
21
|
* 3. reduced motion `@media (prefers-reduced-motion: reduce)`
|
|
20
|
-
* 4. reduced transparency `@media (prefers-reduced-transparency: reduce)`
|
|
22
|
+
* 4. reduced transparency `@media (prefers-reduced-transparency: reduce)`, then more contrast `(prefers-contrast: more)`
|
|
21
23
|
* 5. dark — LAST `@media (prefers-color-scheme: dark)`
|
|
22
24
|
*
|
|
23
25
|
* MODE (design-system D6) is a compile choice, never a row change: `auto` is the visitor-following
|
|
@@ -53,6 +55,12 @@ export interface TokenCssOptions {
|
|
|
53
55
|
* computes exactly what the live site computes for that row — unset.
|
|
54
56
|
*/
|
|
55
57
|
isolate?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* CO5: the canvas's named container (the builder's `iox-canvas`). The section space's phone step is then a container
|
|
60
|
+
* query on the scope's children — the scope element IS the container, which cannot query itself — instead of the
|
|
61
|
+
* live site's `@media`. Absent: `@media`.
|
|
62
|
+
*/
|
|
63
|
+
phoneContainer?: string;
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
export interface TokenCssBlocks {
|
|
@@ -68,6 +76,10 @@ export const REDUCED_MOTION_OVERRIDES: Readonly<Record<string, string>> = SPEC_A
|
|
|
68
76
|
/** What `prefers-reduced-transparency: reduce` makes solid — the contract's `a11y.reducedTransparency`. */
|
|
69
77
|
export const REDUCED_TRANSPARENCY_OVERRIDES: Readonly<Record<string, string>> = SPEC_A11Y.reducedTransparency;
|
|
70
78
|
|
|
79
|
+
/** What `prefers-contrast: more` makes plain — the contract's `a11y.moreContrast` (colour v2 CV3: a painted page turns
|
|
80
|
+
* into its flat ground). */
|
|
81
|
+
export const MORE_CONTRAST_OVERRIDES: Readonly<Record<string, string>> = SPEC_A11Y.moreContrast;
|
|
82
|
+
|
|
71
83
|
/**
|
|
72
84
|
* What a page in a CASELESS script (Hebrew, Arabic, Japanese… — locale-direction `CASELESS_LANGUAGES`) does with the
|
|
73
85
|
* look's case and tracking tokens (vectoriox/iox-ui#124): a pairing that sets buttons and labels `uppercase` with
|
|
@@ -99,6 +111,7 @@ const MEDIA_DARK = '(prefers-color-scheme: dark)';
|
|
|
99
111
|
const ACCESSIBILITY_MEDIA: ReadonlyArray<{ query: string; overrides: Readonly<Record<string, string>> }> = [
|
|
100
112
|
{ query: '(prefers-reduced-motion: reduce)', overrides: REDUCED_MOTION_OVERRIDES },
|
|
101
113
|
{ query: '(prefers-reduced-transparency: reduce)', overrides: REDUCED_TRANSPARENCY_OVERRIDES },
|
|
114
|
+
{ query: '(prefers-contrast: more)', overrides: MORE_CONTRAST_OVERRIDES },
|
|
102
115
|
];
|
|
103
116
|
|
|
104
117
|
const usable = (t: DesignTokenLike | null | undefined): t is DesignTokenLike =>
|
|
@@ -132,6 +145,49 @@ const nonDefaultSchemes = (): ReadonlyArray<[string, Readonly<Record<string, str
|
|
|
132
145
|
.filter(([id]) => id !== DEFAULT_SCHEME)
|
|
133
146
|
.map(([id, scheme]) => [id, scheme.set as Readonly<Record<string, string>>]);
|
|
134
147
|
|
|
148
|
+
/** CO5 (composition-plan.md, contract `axes.sectionPhone`): how the section space steps down on a phone. */
|
|
149
|
+
interface SectionPhoneRule { maxWidth: number; toward: number; share: number }
|
|
150
|
+
const SECTION_PHONE = (SPEC_AXES as unknown as { sectionPhone: SectionPhoneRule }).sectionPhone;
|
|
151
|
+
const SECTION_SPACE = 'space-section';
|
|
152
|
+
const PX_VALUE = /^(\d+(?:\.\d+)?)px$/;
|
|
153
|
+
const GRID = 8;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The section space on a phone (≤ 767px): a figure above the references' phone median (`toward`, 64px) moves `share`
|
|
157
|
+
* of the way to it, floored to the 8px grid — 112px → 88px, 72px → 64px; at or below it (48px), or a value that is not a
|
|
158
|
+
* px figure (an owner's `var()` / `calc()`), there is no step (null). Pure.
|
|
159
|
+
*/
|
|
160
|
+
export function sectionSpaceOnPhone(value: string): string | null {
|
|
161
|
+
const m = PX_VALUE.exec(value.trim());
|
|
162
|
+
if (!m || !SECTION_PHONE) return null;
|
|
163
|
+
const px = Number(m[1]);
|
|
164
|
+
if (px <= SECTION_PHONE.toward) return null;
|
|
165
|
+
const phone = Math.floor((px - (px - SECTION_PHONE.toward) * SECTION_PHONE.share) / GRID) * GRID;
|
|
166
|
+
return phone < px ? `${phone}px` : null;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* CO5: the phone step block — `space-section` at its phone figure and every row that reads it (directly or through
|
|
171
|
+
* another reader, re-declared verbatim so each computes where it is declared, the scheme rule's lesson). The live site
|
|
172
|
+
* wraps it in `@media (max-width: 767px)` on the scope; the builder (`phoneContainer`) in its canvas's container query on
|
|
173
|
+
* the scope's children. Empty when there is no step.
|
|
174
|
+
*/
|
|
175
|
+
function sectionPhoneCss(rows: ReadonlyArray<DesignTokenLike>, opts: TokenCssOptions): string {
|
|
176
|
+
const space = rows.find(t => t.name === SECTION_SPACE);
|
|
177
|
+
const phone = space ? sectionSpaceOnPhone(space.value) : null;
|
|
178
|
+
if (!phone) return '';
|
|
179
|
+
const reading = new Set([SECTION_SPACE]);
|
|
180
|
+
for (let grew = true; grew;) {
|
|
181
|
+
grew = false;
|
|
182
|
+
for (const t of rows) if (!reading.has(t.name) && [...reading].some(n => t.value.includes(`var(--iox-${n})`))) { reading.add(t.name); grew = true; }
|
|
183
|
+
}
|
|
184
|
+
const entries: Array<[string, string]> = [[SECTION_SPACE, phone], ...rows.filter(t => t.name !== SECTION_SPACE && reading.has(t.name)).map((t): [string, string] => [t.name, t.value])];
|
|
185
|
+
const width = `(max-width: ${SECTION_PHONE.maxWidth}px)`;
|
|
186
|
+
const root = opts.scope ?? ROOT;
|
|
187
|
+
if (opts.phoneContainer) return `@container ${opts.phoneContainer} ${width} {\n${rule(`${root} > *`, entries, ' ')}\n}`;
|
|
188
|
+
return media(width, [rule(root, entries, ' ')]);
|
|
189
|
+
}
|
|
190
|
+
|
|
135
191
|
/** `{ 'iox-brand': '#2f6f62', … }` — the builder registry's input shape for base values. */
|
|
136
192
|
export function tokensToVarMap(tokens: ReadonlyArray<DesignTokenLike> | null | undefined): Record<string, string> {
|
|
137
193
|
const map: Record<string, string> = {};
|
|
@@ -440,6 +496,8 @@ export function compileTokenCssBlocks(
|
|
|
440
496
|
rule(root, [...unset, ...rows.map((t): [string, string] => [t.name, t.value])]),
|
|
441
497
|
compileSchemeCss(rows, opts.scope, opposite),
|
|
442
498
|
columns.base,
|
|
499
|
+
// CO5: the section space's phone step (after the base and the columns, so its re-declared readers win on a phone).
|
|
500
|
+
sectionPhoneCss(rows, opts),
|
|
443
501
|
rule(caselessSelector(root), presentOverrides(rows, CASELESS_SCRIPT_OVERRIDES, false)),
|
|
444
502
|
...ACCESSIBILITY_MEDIA.map(({ query, overrides }) =>
|
|
445
503
|
media(query, [rule(root, presentOverrides(rows, overrides, false), ' ')])),
|
|
@@ -96,10 +96,13 @@ export const FORM_PRESETS: readonly FormPresetDef[] = /* @__PURE__ */ Object.fre
|
|
|
96
96
|
description: 'One email field plus consent. Stored.',
|
|
97
97
|
formName: 'Newsletter signup',
|
|
98
98
|
fields: [
|
|
99
|
-
{ label: 'Email', control: 'email', required: true, placeholder: 'you@company.com' },
|
|
100
99
|
// Consent is a checkbox that must be TICKED — `required` on a checkbox becomes the
|
|
101
100
|
// `accepted` rule, with its own message, rather than a generic "this is required".
|
|
101
|
+
// It comes FIRST: the email box and Subscribe are the sign-up row the shared CSS lays side by side
|
|
102
|
+
// (iox-forms.css "The sign-up row"), and the keyboard must meet the parts in the order the eye does
|
|
103
|
+
// (WCAG 2.4.3) — the tick above the row, never a CSS `order` that moves it under the button.
|
|
102
104
|
{ label: 'Email me occasional updates', control: 'checkbox', required: true },
|
|
105
|
+
{ label: 'Email', control: 'email', required: true, placeholder: 'you@company.com' },
|
|
103
106
|
],
|
|
104
107
|
submitLabel: 'Subscribe',
|
|
105
108
|
successText: 'You’re on the list.',
|
|
@@ -190,7 +193,7 @@ export const FORM_PRESET_WORDS_HE: Readonly<Record<`${FormPresetId}`, FormPreset
|
|
|
190
193
|
},
|
|
191
194
|
newsletter: {
|
|
192
195
|
formName: 'הרשמה לניוזלטר',
|
|
193
|
-
fields: [{ label: '
|
|
196
|
+
fields: [{ label: 'שלחו לי עדכונים מדי פעם' }, { label: 'אימייל', placeholder: 'you@company.com' }],
|
|
194
197
|
submitLabel: 'הרשמה',
|
|
195
198
|
successText: 'נרשמתם לרשימה.',
|
|
196
199
|
errorText: 'לא הצלחנו לרשום אתכם. נסו שוב.',
|
|
@@ -4,6 +4,7 @@ import { LayoutIssue, LayoutIssueCode, LayoutLayer, LayoutLayerKind, LayoutSecti
|
|
|
4
4
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
5
5
|
import { colorSchemeOf, planSectionShape, SECTION_EDGE_TYPES, sectionShapeOf, sectionEdgeClass, SectionShape, setSectionEdge, setSectionShape } from '@vectoriox/iox-ui/design-core';
|
|
6
6
|
import { patternById } from './patterns';
|
|
7
|
+
import { NODE_BASELINES } from './node-baselines.generated';
|
|
7
8
|
import { SerializedNode, walkSerialized } from './serialized-node';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -351,6 +352,46 @@ export function joinPageHeader(layout: ReadonlyArray<SerializedNode>): Serialize
|
|
|
351
352
|
return out ?? (layout as SerializedNode[]);
|
|
352
353
|
}
|
|
353
354
|
|
|
355
|
+
/** The style props a section's own block space may be written in — a section carrying any other (a step's `paddingBlock`,
|
|
356
|
+
* a held screen's height) keeps its space as it is. */
|
|
357
|
+
const HELD_SPACE_PROPS: ReadonlyArray<string> = ['paddingBlock', 'paddingTop', 'paddingBottom', 'paddingBlockEnd', 'minHeight', 'height'];
|
|
358
|
+
const UNHELD_VALUES: ReadonlySet<string> = new Set(['', 'auto', '0px', '0']);
|
|
359
|
+
|
|
360
|
+
/** True for a section root stamped from a pattern (never one the model laid, never a free section). */
|
|
361
|
+
function isPatternSection(node: SerializedNode): boolean {
|
|
362
|
+
return !!(node.composed && 'pattern' in node.composed && node.composed.pattern);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Composition CO4 (composition-plan.md, contract `COMPOSITION.air.join: 'same-ground'`): two neighbouring PATTERN sections
|
|
367
|
+
* on one ground are ONE section space apart — the upper gives its bottom space up (iox-ui#130's page-header rule, for
|
|
368
|
+
* every pair of pattern sections; a free or model-laid neighbour keeps the space it was written with). Before, each padded its rhythm on both sides, so two sections on one ground stood two section spaces apart
|
|
369
|
+
* (288px on an airy look) — the J10 reading's "mostly empty bands". A ground change pads itself on both sides (the band
|
|
370
|
+
* reads as a band); nothing joins across a card, a Scene, a seam, a held screen or a section carrying a spacing step of
|
|
371
|
+
* its own. Pure: copies only what it changes.
|
|
372
|
+
*/
|
|
373
|
+
export function joinSameGround(layout: ReadonlyArray<SerializedNode>): SerializedNode[] {
|
|
374
|
+
let out: SerializedNode[] | null = null;
|
|
375
|
+
for (let i = 0; i + 1 < layout.length; i++) {
|
|
376
|
+
const upper = layout[i];
|
|
377
|
+
const next = layout[i + 1];
|
|
378
|
+
// Both stamped from patterns: a free or model-laid section below pads itself as it was written (its top may be 0).
|
|
379
|
+
if (!isPatternSection(upper) || !isPatternSection(next) || !SECTION_EDGE_TYPES.includes(upper.type) || !SECTION_EDGE_TYPES.includes(next.type)) continue;
|
|
380
|
+
if ((colorSchemeOf(upper) ?? 'default') !== (colorSchemeOf(next) ?? 'default')) continue;
|
|
381
|
+
if (sectionShapeOf(upper) === SectionShape.Card || sectionShapeOf(next) === SectionShape.Card || holdsScene(upper) || holdsScene(next)) continue;
|
|
382
|
+
if (sectionEdgeClass(next.props?.['seam'])) continue;
|
|
383
|
+
// A value the type's baseline stamps (`height: auto`, `minHeight: 200px`) or an `auto` / `0px` is no hold of its own.
|
|
384
|
+
const baseline = (NODE_BASELINES[upper.type]?.styleProps ?? {}) as Record<string, unknown>;
|
|
385
|
+
if (HELD_SPACE_PROPS.some(p => { const v = upper.styleProps?.[p]; return v !== undefined && !UNHELD_VALUES.has(String(v)) && v !== baseline[p]; })) continue;
|
|
386
|
+
const own = upper.styleProps?.['padding'];
|
|
387
|
+
const parts = typeof own === 'string' && own.trim() && own.trim() !== SECTION_PAD ? shorthandParts(own) : [...SECTION_PAD_SIDES];
|
|
388
|
+
const [top, right = top, , left = right] = parts;
|
|
389
|
+
out ??= layout.map(n => n);
|
|
390
|
+
out[i] = { ...upper, styleProps: { ...(upper.styleProps ?? {}), padding: `${top} ${right} ${NO_SPACE} ${left}` } };
|
|
391
|
+
}
|
|
392
|
+
return out ?? (layout as SerializedNode[]);
|
|
393
|
+
}
|
|
394
|
+
|
|
354
395
|
// ── The check: a mix judged against the site, mended where the site cannot carry it, each mend said ──────────────────
|
|
355
396
|
|
|
356
397
|
export enum BodyRepairCode {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DesignTokenLike, elementStyleById, parseHexColor, ResolvedMode,
|
|
2
|
+
DesignTokenLike, elementStyleById, parseHexColor, ResolvedMode, schemeTokenResolver, wcagContrastRatio,
|
|
3
3
|
} from '@vectoriox/iox-ui/design-core';
|
|
4
4
|
import {
|
|
5
5
|
FREE_ELEMENT_STYLES, FREE_HOLDERS, FREE_LEAD_ROLE, FREE_MOVES, FREE_PHONE_LAYERS, FREE_WORD_TYPES, FreeLayer, FreeNode,
|
|
6
|
-
FreeNodeType, FreePage, FreePictures, FreePurpose, FreeStyle, FreeTrigger, walkFree,
|
|
6
|
+
FreeNodeType, FreePage, FreePictures, FreePurpose, freeSchemeOf, FreeStyle, FreeTrigger, walkFree,
|
|
7
7
|
} from './free-wire';
|
|
8
8
|
import { factIssues, PlanWordContext, WrittenText } from './plan-words';
|
|
9
9
|
import { PageSectionPlan } from './site-plan.model';
|
|
@@ -391,23 +391,31 @@ function groundHex(grounds: ReadonlyArray<string | null>, values: Readonly<Recor
|
|
|
391
391
|
return null;
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
+
/** The node types whose words the tree pair check judges: the words, and a Button's label (iox-ui#186). */
|
|
395
|
+
const PAIRED_TYPES: ReadonlyArray<FreeNodeType> = [FreeNodeType.Heading, FreeNodeType.Text, FreeNodeType.Button];
|
|
396
|
+
|
|
394
397
|
/**
|
|
395
|
-
* THE TREE PAIR CHECK (R-H12, gate 2's tree half — `auditDesignContrast` judges the look, not a tree): each Heading's
|
|
396
|
-
* Text's ink token against the ground token of the nearest painted node, resolved in every mode the site
|
|
397
|
-
* (4.5, 3 for display / h1 / h2).
|
|
398
|
-
*
|
|
398
|
+
* THE TREE PAIR CHECK (R-H12, gate 2's tree half — `auditDesignContrast` judges the look, not a tree): each Heading's,
|
|
399
|
+
* Text's and Button's ink token against the ground token of the nearest painted node, resolved in every mode the site
|
|
400
|
+
* shows, AA (4.5, 3 for display / h1 / h2). Every token is resolved INSIDE the schemes the stamp gives the boxes above
|
|
401
|
+
* (`freeSchemeOf`, iox-ui#186) — so a dark band's plain `text` reads its light ink, as it renders. A Button is judged too:
|
|
402
|
+
* its element style paints its ink (and, when it paints none, the ground beneath shows through — an outline button on a
|
|
403
|
+
* band the look never audited). A pair that is not two hex tokens (a colour-mix, a picture behind) is left to the
|
|
404
|
+
* real-pixel check.
|
|
399
405
|
*/
|
|
400
406
|
export function freeContrastIssues(page: FreePage, ctx: Pick<FreeJudgeContext, 'tokens' | 'modes'>): FreeIssue[] {
|
|
401
407
|
const out: FreeIssue[] = [];
|
|
402
|
-
const resolved = (ctx.modes?.length ? ctx.modes : (['light'] as ResolvedMode[])).map(mode => ({ mode,
|
|
408
|
+
const resolved = (ctx.modes?.length ? ctx.modes : (['light'] as ResolvedMode[])).map(mode => ({ mode, valuesIn: schemeTokenResolver(ctx.tokens, mode) }));
|
|
403
409
|
for (const { node, path, up, section } of walkFree(page?.sections ?? [])) {
|
|
404
410
|
if (page.sections[section]?.readyMade) continue;
|
|
405
|
-
if (
|
|
411
|
+
if (!PAIRED_TYPES.includes(node.type)) continue;
|
|
406
412
|
const ink = inkOf(node, up);
|
|
407
413
|
if (!ink) continue;
|
|
408
414
|
const grounds = groundsOf(node, up);
|
|
415
|
+
const schemes = up.map(freeSchemeOf).filter((s): s is string => !!s);
|
|
409
416
|
const need = LARGE_STYLES.includes(node.elementStyle ?? '') ? FREE_CONTRAST.large : FREE_CONTRAST.text;
|
|
410
|
-
for (const { mode,
|
|
417
|
+
for (const { mode, valuesIn } of resolved) {
|
|
418
|
+
const values = valuesIn(schemes.length ? schemes : 'default');
|
|
411
419
|
const a = values[ink];
|
|
412
420
|
const ground = groundHex(grounds, values);
|
|
413
421
|
if (!a || !ground || !parseHexColor(a)) continue;
|
|
@@ -21,7 +21,7 @@ import { SPEC_SITE_FACTS, SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
|
21
21
|
import { checkList, LayoutListNever, pageListIssues } from './check-list';
|
|
22
22
|
import { LIST_WORDS_BESIDE_RULE, LayoutListSide, layoutListBare, layoutListPair } from './list-space';
|
|
23
23
|
import { GroundTone, groundToneOf, paceIssues } from './body-mix';
|
|
24
|
-
import { colourRhythmIssues } from './colour-mix';
|
|
24
|
+
import { colourAccentMax, colourGroundsMax, colourRhythmIssues } from './colour-mix';
|
|
25
25
|
import {
|
|
26
26
|
LAYOUT_CHECK_VIEWPORT, LAYOUT_DRIFT, LAYOUT_KINETIC_KINDS, LAYOUT_LINE_HEIGHT, layoutBoxPx, layoutDriftPhoto, layoutHeldStill, layoutOpeningDisplayMend, layoutOpeningDisplays, layoutShapeHasPurpose,
|
|
27
27
|
layoutStillLine, layoutTextFits, layoutVoidScreens, layoutVoids,
|
|
@@ -83,6 +83,10 @@ export interface CheckLayoutContext {
|
|
|
83
83
|
* the COLOUR table): the page's grounds are judged against it (`colourRhythmIssues`). Absent or `free`: each
|
|
84
84
|
* section's ground is its own. */
|
|
85
85
|
rhythm?: string | null;
|
|
86
|
+
/** Colour v2 CV2 (CV-D7): the site's accent word (`colourMixOfPlan(plan).accent`). Present: its budget replaces the
|
|
87
|
+
* look's `accentMax` (`colourAccentMax`) and the page wears at most `colourGroundsMax` distinct colour grounds, photos
|
|
88
|
+
* excepted (R-H-CV3). Absent: the look's budget, grounds uncounted. */
|
|
89
|
+
accent?: string | null;
|
|
86
90
|
/** AW6: the body's pace as DRAWN (`drawnBodyMix(bodyMixOfPlan(plan)).drawn.pace`): `loud-quiet` asks picture sections
|
|
87
91
|
* followed by quiet ones (`paceIssues`). Absent or `free`: nothing asked. */
|
|
88
92
|
pace?: string | null;
|
|
@@ -418,6 +422,7 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
418
422
|
let eyebrows = 0;
|
|
419
423
|
let splitRun = 0;
|
|
420
424
|
let lightGrounds = 0;
|
|
425
|
+
const colourGrounds = new Set<string>();
|
|
421
426
|
let bleeds = 0;
|
|
422
427
|
let screenWords = 0;
|
|
423
428
|
let wordsOnPhoto = 0;
|
|
@@ -460,6 +465,7 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
460
465
|
}
|
|
461
466
|
if (inList(V.colours, ground) && paint && lumOf(paint.colours[ground as LayoutColour]) > PHOTO_LIGHT_LUMINANCE) lightGrounds++;
|
|
462
467
|
if (ground === LayoutColour.Accent) accentUses += ACCENT_GROUND_USES;
|
|
468
|
+
if (inList(V.colours, ground)) colourGrounds.add(ground);
|
|
463
469
|
const layers = Array.isArray(s.layers) ? s.layers : [];
|
|
464
470
|
if (!layers.length) add(LayoutIssueCode.Structure, `${at}.layers`, 'at least one layer');
|
|
465
471
|
if (s.pin) pinned++;
|
|
@@ -855,13 +861,17 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
855
861
|
const entering = sectionsWithEnters + readyMadeEntering;
|
|
856
862
|
if (entering > enteringMax) add(LayoutIssueCode.Motion, 'sections', `${entering} sections have entrances — at most ${enteringMax}; let the others glide`);
|
|
857
863
|
if (eyebrows > composedCount * EYEBROW_SHARE) add(LayoutIssueCode.Look, 'sections', `${eyebrows} headings carry a small label right above them — the AI-site cliché; keep it to a few`);
|
|
864
|
+
const accentBudget = ctx.accent ? { max: colourAccentMax(ctx.accent), by: `the "${ctx.accent}" accent` } : look ? { max: look.accentMax, by: `the ${look.id} look` } : null;
|
|
865
|
+
if (accentBudget && accentUses > accentBudget.max) {
|
|
866
|
+
const bands = paint ? accentBandMoves(sections, ground => paint.colours[ground], (name, text) => colourHex(name, text)) : [];
|
|
867
|
+
const buttons = accentButtonSteps(sections);
|
|
868
|
+
add(LayoutIssueCode.Look, 'sections', `the accent is on ${accentUses} layers (a button counts, an accent ground twice) — ${accentBudget.by} allows ${accentBudget.max}`,
|
|
869
|
+
{ kind: LayoutMendKind.Accent, over: accentUses - accentBudget.max, ...(bands.length ? { bands } : {}), ...(buttons.length ? { buttons } : {}) });
|
|
870
|
+
}
|
|
871
|
+
if (ctx.accent && colourGrounds.size > colourGroundsMax(ctx.accent)) {
|
|
872
|
+
add(LayoutIssueCode.Look, 'sections', `${colourGrounds.size} different grounds (${[...colourGrounds].join(', ')}) — the "${ctx.accent}" accent allows ${colourGroundsMax(ctx.accent)}, photos excepted`);
|
|
873
|
+
}
|
|
858
874
|
if (look) {
|
|
859
|
-
if (accentUses > look.accentMax) {
|
|
860
|
-
const bands = paint ? accentBandMoves(sections, ground => paint.colours[ground], (name, text) => colourHex(name, text)) : [];
|
|
861
|
-
const buttons = accentButtonSteps(sections);
|
|
862
|
-
add(LayoutIssueCode.Look, 'sections', `the accent is on ${accentUses} layers (a button counts, an accent ground twice) — the ${look.id} look allows ${look.accentMax}`,
|
|
863
|
-
{ kind: LayoutMendKind.Accent, over: accentUses - look.accentMax, ...(bands.length ? { bands } : {}), ...(buttons.length ? { buttons } : {}) });
|
|
864
|
-
}
|
|
865
875
|
if (limits.hugeMax !== undefined && huge > limits.hugeMax) add(LayoutIssueCode.Look, 'sections', `${huge} xxl/screen layers — the ${look.id} look allows ${limits.hugeMax}`);
|
|
866
876
|
if (limits.centerMax !== undefined && textLayers && centered / textLayers > limits.centerMax) {
|
|
867
877
|
add(LayoutIssueCode.Look, 'sections', `${centered} of ${textLayers} text layers are centred — the ${look.id} look allows ${Math.round(limits.centerMax * 100)}%`);
|