@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
package/package.json
CHANGED
|
@@ -236,6 +236,12 @@ export const SERVER_ELEMENT_ACTION_TYPES: ReadonlySet<string> =
|
|
|
236
236
|
export const BEHAVIOUR_ACTION_TYPES: ReadonlySet<string> =
|
|
237
237
|
new Set(['navigate', 'scrollTo', 'submitForm', 'copyToClipboard']);
|
|
238
238
|
|
|
239
|
+
/** FV1b (footer `holds.top`): a `scrollTo` with no target — or `self` — scrolls the PAGE to its top. The live engine's
|
|
240
|
+
* rule since A1c; ONE rule both renderers ask (the canvas joins once it builds against this version). */
|
|
241
|
+
export function scrollsToPageTop(action: { readonly type: string; readonly target?: string | null }): boolean {
|
|
242
|
+
return action.type === 'scrollTo' && (!action.target || action.target === 'self');
|
|
243
|
+
}
|
|
244
|
+
|
|
239
245
|
/** The toast action's dispatch set (premium M5) — the engines branch on it beside DIALOG / POPOVER. */
|
|
240
246
|
export const TOAST_ACTION_TYPES: ReadonlySet<string> = new Set(['showToast']);
|
|
241
247
|
|
|
@@ -10,7 +10,8 @@ import { resolveRepeaterItems } from './data-source-resolver';
|
|
|
10
10
|
*
|
|
11
11
|
* - `isNumberedPlaceholderTitle` — words and then a number (G-D1). The Publishable gate reads it as well.
|
|
12
12
|
* - `isPlaceholderRow(row, titleField)` — a row marked `isSample` whose title is such a placeholder.
|
|
13
|
-
* - `listTitleField(list)` — the field a list's card shows as its title
|
|
13
|
+
* - `listTitleField(list)` — the field a list's card shows as its title; `listPlaceholderFields(list)` — that, else
|
|
14
|
+
* the fields a list with no title shows (a quote slider's person line, engine#41).
|
|
14
15
|
* - `planPlaceholderHides(roots, resolved)` — what the live engine leaves out (G-D3): placeholder rows are dropped,
|
|
15
16
|
* a list with no live row is not drawn, and its top-level section hides when only its frame is left (heading,
|
|
16
17
|
* eyebrow, lead text, buttons). Pages and their nav links stay (G-D4).
|
|
@@ -47,11 +48,14 @@ function fieldOf(row: Record<string, unknown>, path: string): unknown {
|
|
|
47
48
|
* out. `titleField` is the list's title field (`listTitleField`); without one the row's `title` / `name` / `label` is
|
|
48
49
|
* read. A row with no title to read is never a placeholder: when in doubt, show it.
|
|
49
50
|
*/
|
|
50
|
-
export function isPlaceholderRow(row: unknown, titleField?: string | null): boolean {
|
|
51
|
+
export function isPlaceholderRow(row: unknown, titleField?: string | ReadonlyArray<string> | null): boolean {
|
|
51
52
|
if (!row || typeof row !== 'object' || Array.isArray(row)) return false;
|
|
52
53
|
const r = row as Record<string, unknown>;
|
|
53
54
|
if (r[SAMPLE_ROW_FIELD] !== true) return false;
|
|
54
|
-
|
|
55
|
+
// engine#41: a list that names no title passes the fields it SHOWS — any of them still "<words> <n>" is the sample's
|
|
56
|
+
// unnamed line (a quote slider's "Guest 1").
|
|
57
|
+
if (Array.isArray(titleField) && titleField.length) return titleField.some(f => isPlaceholderRow(row, f));
|
|
58
|
+
const field = (typeof titleField === 'string' && titleField) || PLACEHOLDER_TITLE_FALLBACK_FIELDS.find(f => typeof r[f] === 'string');
|
|
55
59
|
if (!field) return false;
|
|
56
60
|
const title = fieldOf(r, field);
|
|
57
61
|
return typeof title === 'string' && isNumberedPlaceholderTitle(title);
|
|
@@ -117,6 +121,27 @@ export function listTitleField(list: PlaceholderPlanNode | null | undefined): st
|
|
|
117
121
|
return heading ? contentPath(heading, source) : null;
|
|
118
122
|
}
|
|
119
123
|
|
|
124
|
+
/** The node types whose bound words a list SHOWS on each row. */
|
|
125
|
+
const SHOWN_WORD_TYPES: ReadonlySet<string> = new Set(['Heading', 'Text', 'Link', 'Button', 'ButtonBlock']);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The fields a list's rows are judged by (engine#41): its title field (`listTitleField`) when it names one, else every
|
|
129
|
+
* field its own parts SHOW as words (a quote slider's quote and person — the person line "Guest 1" is the sample's
|
|
130
|
+
* unnamed line), else `null` (then `isPlaceholderRow` falls back to title / name / label). Nested lists are not looked
|
|
131
|
+
* into. ONE reading for the live rule and the builder's ghost rows.
|
|
132
|
+
*/
|
|
133
|
+
export function listPlaceholderFields(list: PlaceholderPlanNode | null | undefined): string | string[] | null {
|
|
134
|
+
const title = listTitleField(list);
|
|
135
|
+
if (title) return title;
|
|
136
|
+
const source = listSourceOf(list);
|
|
137
|
+
if (!list || !source) return null;
|
|
138
|
+
const shown = descendants(list, n => LIST_NODE_TYPES.has(n.type ?? ''))
|
|
139
|
+
.filter(n => SHOWN_WORD_TYPES.has(n.type ?? ''))
|
|
140
|
+
.map(n => contentPath(n, source))
|
|
141
|
+
.filter(Boolean);
|
|
142
|
+
return shown.length ? [...new Set(shown)] : null;
|
|
143
|
+
}
|
|
144
|
+
|
|
120
145
|
/**
|
|
121
146
|
* The node types that are only a list section's FRAME (G-D3): its heading, eyebrow, lead text, buttons, links, icons
|
|
122
147
|
* and the boxes around them. A section left with only these hides with its list. Anything else (a picture, a video, a
|
|
@@ -162,7 +187,7 @@ export function planPlaceholderHides(
|
|
|
162
187
|
const liveRows = (list: PlaceholderPlanNode, source: string): unknown[] | null => {
|
|
163
188
|
if (!(source in data)) return null;
|
|
164
189
|
const all = resolveRepeaterItems(data[source]);
|
|
165
|
-
const title =
|
|
190
|
+
const title = listPlaceholderFields(list);
|
|
166
191
|
const live = all.filter(r => !isPlaceholderRow(r, title));
|
|
167
192
|
if (live.length !== all.length && Array.isArray(data[source])) rows[source] = live;
|
|
168
193
|
return live;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AccentGround, atLightness, deriveAccentTokens, inSrgbGamut, oklabToRgb, parseHexColor, rgbToOklab, Rgb, toHexColor, wcagContrastRatio, WCAG_AA_TEXT,
|
|
2
|
+
AccentGround, atLightness, BAND_SURFACE_INK_TINT, deriveAccentTokens, inSrgbGamut, oklabToRgb, parseHexColor, rgbToOklab, Rgb, toHexColor, wcagContrastRatio, WCAG_AA_TEXT,
|
|
3
3
|
} from './brand';
|
|
4
4
|
import { compositeOver, paintColours, quantizeRgb } from './colour-eval';
|
|
5
5
|
import { SPEC_AXES } from './flavor-spec.generated';
|
|
@@ -75,6 +75,10 @@ export interface ColourFlavor {
|
|
|
75
75
|
export type FlavorColours = Record<string, [string, string]>;
|
|
76
76
|
|
|
77
77
|
const upper = (hex: string) => hex.toUpperCase();
|
|
78
|
+
const WHITE_HEX = '#FFFFFF';
|
|
79
|
+
const BLACK_HEX = '#000000';
|
|
80
|
+
/** The better of a white and a black label on `bg` (colour.mjs `bestInk`). */
|
|
81
|
+
const bestInk = (bg: string) => (wcagContrastRatio(WHITE_HEX, bg) >= wcagContrastRatio(BLACK_HEX, bg) ? WHITE_HEX : BLACK_HEX);
|
|
78
82
|
const passesAll = (fg: string, bgs: ReadonlyArray<string>, min: number) => bgs.every(bg => wcagContrastRatio(fg, bg) >= min);
|
|
79
83
|
|
|
80
84
|
/** The lightest/darkest version of `fg` (its own hue and chroma) that clears `min` on every ground. */
|
|
@@ -191,11 +195,120 @@ function tintPalette(p: Record<string, string>, flavor: ColourFlavor, level: Tin
|
|
|
191
195
|
for (const name of flavor.tint.paints ?? []) p[name] = rotatePaint(p[name], turn, level.paintChroma ?? 1);
|
|
192
196
|
}
|
|
193
197
|
|
|
198
|
+
// ── The page's ground and the dark band as words (colour-v2-plan.md §5a, CV-D3/CV-D4, CV2) ──────────────────────
|
|
199
|
+
|
|
200
|
+
/** A ground word's OKLCH ground (`COLOUR.ground`): `h` / `inkHue` in degrees, null = the brand's own hue. */
|
|
201
|
+
export interface GroundWordRow { readonly L: number; readonly h: number | null; readonly c: number; readonly softDL: number; readonly inkHue: number | null }
|
|
202
|
+
/** A dark word's OKLCH band (`COLOUR.dark`): `brandShare` = a share of the brand's chroma, capped at `c`. */
|
|
203
|
+
export interface DarkWordRow { readonly L: number; readonly h: number | null; readonly c: number; readonly brandShare: number | null }
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* CV-D4: the page's ground family — paper after oura's sand and hotelaurelia, white after cancan and polene (the brand's
|
|
207
|
+
* breath), cool after allerstudio, graya and plumeform. `look` is absent: the flavor's own ground. Port of colour.mjs
|
|
208
|
+
* `COLOUR_GROUNDS` (held equal by the word fixtures).
|
|
209
|
+
*/
|
|
210
|
+
export const COLOUR_GROUNDS: Readonly<Record<string, GroundWordRow>> = {
|
|
211
|
+
paper: { L: 0.968, h: 78, c: 0.014, softDL: 0.035, inkHue: 60 },
|
|
212
|
+
white: { L: 0.995, h: null, c: 0.003, softDL: 0.03, inkHue: null },
|
|
213
|
+
cool: { L: 0.982, h: 255, c: 0.006, softDL: 0.03, inkHue: null },
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* CV-D3: the dark band's colour — brand-deep after atticus and schlosshotel (the brand's hue, very dark), earth after
|
|
217
|
+
* hotelaurelia, reddottours and savvia (a warm brown, whatever the brand). `ink` is absent: the look's own near-black.
|
|
218
|
+
* Port of colour.mjs `COLOUR_DARKS`.
|
|
219
|
+
*/
|
|
220
|
+
export const COLOUR_DARKS: Readonly<Record<string, DarkWordRow>> = {
|
|
221
|
+
'brand-deep': { L: 0.235, h: null, c: 0.055, brandShare: 0.5 },
|
|
222
|
+
earth: { L: 0.255, h: 52, c: 0.035, brandShare: null },
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const DEG = Math.PI / 180;
|
|
226
|
+
const atHex = (L: number, hue: number, c: number) => upper(toHexColor(atLightnessMaxChroma(Math.min(1, Math.max(0, L)), hue, c)));
|
|
227
|
+
|
|
228
|
+
/** A ground word's light roles for a brand `seed` — null for `look` (or a word the table does not hold). */
|
|
229
|
+
export function groundWordColours(word: string | null | undefined, seed: string): Record<string, string> | null {
|
|
230
|
+
const g = word ? COLOUR_GROUNDS[word] : undefined;
|
|
231
|
+
if (!g) return null;
|
|
232
|
+
const brandHue = seedHue(seed).hue;
|
|
233
|
+
const hue = g.h === null ? brandHue : g.h * DEG;
|
|
234
|
+
const inkHue = g.inkHue === null ? brandHue : g.inkHue * DEG;
|
|
235
|
+
const bg = atHex(g.L, hue, g.c);
|
|
236
|
+
const soft = atHex(g.L - g.softDL, hue, g.c * 1.6 + 0.004);
|
|
237
|
+
return {
|
|
238
|
+
bg, surface: atHex(Math.min(0.998, g.L + 0.02), hue, g.c * 0.5), 'surface-2': soft, line: atHex(g.L - 0.1, hue, g.c * 1.4),
|
|
239
|
+
text: atHex(0.2, inkHue, 0.012), 'text-muted': groundWordMuted(bg, soft, inkHue),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const GROUND_MUTED_L = 0.47;
|
|
244
|
+
const GROUND_MUTED_L_MIN = 0.25;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* A ground word's muted words: AA on the page and its soft surface, AND room for the Muted band — whose ground IS this
|
|
248
|
+
* colour and whose ink is the page's `bg`, where Bloom's secondary hover mixes `BAND_SURFACE_INK_TINT` of that ink into
|
|
249
|
+
* it. From L 0.47 down in 0.02 steps until the band's hover reads too (float and quantized). Mirror of the contract's
|
|
250
|
+
* colour.mjs `groundWordMuted`.
|
|
251
|
+
*/
|
|
252
|
+
function groundWordMuted(bg: string, soft: string, inkHue: number): string {
|
|
253
|
+
const page = parseHexColor(bg) as Rgb;
|
|
254
|
+
const band = (m: string): number => {
|
|
255
|
+
const c = parseHexColor(m) as Rgb;
|
|
256
|
+
const t = BAND_SURFACE_INK_TINT;
|
|
257
|
+
const mix: Rgb = { r: page.r * t + c.r * (1 - t), g: page.g * t + c.g * (1 - t), b: page.b * t + c.b * (1 - t) };
|
|
258
|
+
return Math.min(wcagContrastRatio(page, mix), wcagContrastRatio(page, parseHexColor(toHexColor(mix)) as Rgb));
|
|
259
|
+
};
|
|
260
|
+
for (let L = GROUND_MUTED_L; ; L -= 0.02) {
|
|
261
|
+
const m = upper(ensureContrast(atHex(L, inkHue, 0.02), [bg, soft], WCAG_AA_TEXT));
|
|
262
|
+
if (band(m) >= WCAG_AA_TEXT || L <= GROUND_MUTED_L_MIN) return m;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** A dark word's light roles for a brand `seed` — null for `ink` (or a word the table does not hold). */
|
|
267
|
+
export function darkWordColours(word: string | null | undefined, seed: string): Record<string, string> | null {
|
|
268
|
+
const d = word ? COLOUR_DARKS[word] : undefined;
|
|
269
|
+
if (!d) return null;
|
|
270
|
+
const { hue: brandHue, chroma } = seedHue(seed);
|
|
271
|
+
const hue = d.h === null ? brandHue : d.h * DEG;
|
|
272
|
+
const c = d.brandShare === null ? d.c : Math.min(chroma * d.brandShare, d.c);
|
|
273
|
+
const bg = atHex(d.L, hue, c);
|
|
274
|
+
const surface = atHex(d.L + 0.05, hue, c);
|
|
275
|
+
return {
|
|
276
|
+
'inverse-bg': bg, 'inverse-surface': surface, 'inverse-line': atHex(d.L + 0.12, hue, c),
|
|
277
|
+
'inverse-text': atHex(0.955, hue, 0.012), 'inverse-muted': upper(ensureContrast(atHex(0.78, hue, 0.03), [bg, surface], WCAG_AA_TEXT)),
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** What the colour derivation is asked: the brand, the background tint and (CV2) the ground and dark words. */
|
|
282
|
+
/**
|
|
283
|
+
* CV3 (colour-v2-plan.md §5a, as changed 2026-11-29): how the page's ground is painted (`COLOUR.wash`) — the PAGE's paint
|
|
284
|
+
* (`page-bg`), never a per-section wash. `gradient` fades the page toward its dark band at its foot (landonorris,
|
|
285
|
+
* plumeform, enigmascult: fade to dark); `glow` lays soft brand glows at its head and foot (plumeform). Centred, so a
|
|
286
|
+
* right-to-left page mirrors to itself; role references only. Mirror of the contract's colour.mjs `COLOUR_WASHES`
|
|
287
|
+
* (derivationFixtures hold them equal). `flat` (absent) = the look's own paint.
|
|
288
|
+
*/
|
|
289
|
+
export const COLOUR_WASHES: Readonly<Record<string, string>> = {
|
|
290
|
+
gradient: 'linear-gradient(180deg, transparent 0%, transparent 50%, color-mix(in srgb, var(--iox-inverse-bg) 14%, transparent) 100%), var(--iox-bg)',
|
|
291
|
+
glow: 'radial-gradient(60% 45% at 50% 0%, color-mix(in srgb, var(--iox-accent) 14%, transparent) 0%, transparent 70%), '
|
|
292
|
+
+ 'radial-gradient(50% 40% at 50% 100%, color-mix(in srgb, var(--iox-accent) 10%, transparent) 0%, transparent 70%), var(--iox-bg)',
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export interface FlavorColourChoices {
|
|
296
|
+
seed?: string | null;
|
|
297
|
+
tint?: TintId | null;
|
|
298
|
+
/** CV2: `COLOUR.ground` — paper · white · cool write the page's roles (light block); look / absent: the flavor's. */
|
|
299
|
+
ground?: string | null;
|
|
300
|
+
/** CV2: `COLOUR.dark` — brand-deep · earth write the dark band's roles (light block); ink / absent: the flavor's. */
|
|
301
|
+
dark?: string | null;
|
|
302
|
+
/** CV3: `COLOUR.wash` — gradient · glow paint the page (`page-bg`, both modes); flat / absent: the flavor's own paint. */
|
|
303
|
+
wash?: string | null;
|
|
304
|
+
}
|
|
305
|
+
|
|
194
306
|
/**
|
|
195
307
|
* The colour tokens of a flavor for a brand `seed` and a background `tint`, light and dark.
|
|
196
|
-
* Neutral at the flavor's own seed returns its palette exactly.
|
|
308
|
+
* Neutral at the flavor's own seed returns its palette exactly. CV2: a ground or dark word writes its roles in the light
|
|
309
|
+
* block after the tint and before the accents (which are then held on the new grounds).
|
|
197
310
|
*/
|
|
198
|
-
export function flavorColours(flavor: ColourFlavor, choices:
|
|
311
|
+
export function flavorColours(flavor: ColourFlavor, choices: FlavorColourChoices): FlavorColours {
|
|
199
312
|
const seed = choices.seed || flavor.seed;
|
|
200
313
|
const level = TINT_LEVELS[choices.tint ?? PRE_TINT_DEFAULT];
|
|
201
314
|
const palette = {
|
|
@@ -203,6 +316,13 @@ export function flavorColours(flavor: ColourFlavor, choices: { seed?: string | n
|
|
|
203
316
|
dark: { ...flavor.palette.light, ...flavor.palette.dark } as Record<string, string>,
|
|
204
317
|
};
|
|
205
318
|
if (level?.chroma) for (const mode of MODES) tintPalette(palette[mode], flavor, level, seed);
|
|
319
|
+
const grounded = groundWordColours(choices.ground, seed);
|
|
320
|
+
const darkened = darkWordColours(choices.dark, seed);
|
|
321
|
+
if (grounded) Object.assign(palette.light, grounded);
|
|
322
|
+
if (darkened) Object.assign(palette.light, darkened);
|
|
323
|
+
// CV3: the wash paints the page in both modes, before the accents (a glow reads the accent) and the held roles.
|
|
324
|
+
const wash = choices.wash ? COLOUR_WASHES[choices.wash] : undefined;
|
|
325
|
+
if (wash) { palette.light['page-bg'] = wash; palette.dark['page-bg'] = wash; }
|
|
206
326
|
|
|
207
327
|
if (seed.toLowerCase() !== flavor.seed.toLowerCase()) {
|
|
208
328
|
// Twice: the page paint may read the accent (Midnight's glow), so its grounds are known only once
|
|
@@ -222,6 +342,8 @@ export function flavorColours(flavor: ColourFlavor, choices: { seed?: string | n
|
|
|
222
342
|
const p = palette[mode];
|
|
223
343
|
p['accent-text'] = upper(ensureContrast(p['accent-text'], groundsOf(p, TEXT_GROUNDS), WCAG_AA_TEXT));
|
|
224
344
|
p['inverse-accent'] = upper(ensureContrast(p['inverse-accent'], groundsOf(p, INVERSE_GROUNDS), WCAG_AA_TEXT));
|
|
345
|
+
// A dark word may move the inverse accent: its label follows when it no longer reads (never for a look's own palette).
|
|
346
|
+
if ((grounded || darkened) && wcagContrastRatio(p['inverse-accent-ink'], p['inverse-accent']) < WCAG_AA_TEXT) p['inverse-accent-ink'] = bestInk(p['inverse-accent']);
|
|
225
347
|
holdContrast(p);
|
|
226
348
|
}
|
|
227
349
|
const out: FlavorColours = {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { COLOUR_DARKS, COLOUR_GROUNDS, COLOUR_WASHES } from './brand-neutrals';
|
|
2
|
+
import { DesignChoices } from './design-token.model';
|
|
3
|
+
import { SPEC_AXES } from './flavor-spec.generated';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Colour v2 CV2 + CV3 (colour-v2-plan.md §5a): the four colour words a look carries as TOKENS — the page's ground, the
|
|
7
|
+
* dark band's colour, the main button's paint and the page's wash (CV3). Each is ONE `settings.design` row, absent = the look's own (look · ink ·
|
|
8
|
+
* accent — what every site wore before CV2). The ground and dark words are values `flavorColours` computes (the port of
|
|
9
|
+
* colour.mjs, held by the derivation fixtures); the button word is three component tokens (`axes.actionPaints`) that
|
|
10
|
+
* reference roles only. The other COLOUR words (accent, rhythm, bands) are judged by the composer, never painted.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** COLOUR.ground: the page's ground family (paper after oura and hotelaurelia, white after cancan, cool after graya). */
|
|
14
|
+
export enum GroundWord { Look = 'look', Paper = 'paper', White = 'white', Cool = 'cool' }
|
|
15
|
+
/** COLOUR.dark: the dark band's colour (brand-deep after atticus and schlosshotel, earth after hotelaurelia and savvia). */
|
|
16
|
+
export enum DarkWord { Ink = 'ink', BrandDeep = 'brand-deep', Earth = 'earth' }
|
|
17
|
+
/** COLOUR.action: what the main button is painted with — a key of the contract's `axes.actionPaints`. */
|
|
18
|
+
/** COLOUR.wash: how the page is painted (CV3) — gradient after landonorris and plumeform, glow after plumeform. Flat = the
|
|
19
|
+
* look's own. The dimmed photo waits for CV3b. */
|
|
20
|
+
export enum WashWord { Flat = 'flat', Gradient = 'gradient', Glow = 'glow' }
|
|
21
|
+
export type ActionWord = Extract<keyof typeof SPEC_AXES.actionPaints, string>;
|
|
22
|
+
export const ACTION_ACCENT: ActionWord = 'accent';
|
|
23
|
+
|
|
24
|
+
const isGround = (w: unknown): w is GroundWord => typeof w === 'string' && Object.prototype.hasOwnProperty.call(COLOUR_GROUNDS, w);
|
|
25
|
+
const isDark = (w: unknown): w is DarkWord => typeof w === 'string' && Object.prototype.hasOwnProperty.call(COLOUR_DARKS, w);
|
|
26
|
+
const isWash = (w: unknown): w is WashWord => typeof w === 'string' && Object.prototype.hasOwnProperty.call(COLOUR_WASHES, w);
|
|
27
|
+
const isAction = (w: unknown): w is ActionWord => typeof w === 'string' && Object.prototype.hasOwnProperty.call(SPEC_AXES.actionPaints, w);
|
|
28
|
+
|
|
29
|
+
/** The colour words a look carries (CV2 ground · dark · action, CV3 wash). */
|
|
30
|
+
export type ColourWordKey = 'ground' | 'dark' | 'action' | 'wash';
|
|
31
|
+
|
|
32
|
+
/** The colour words as stored: a known word other than the look's own is kept; the look's own, unknown or absent reads
|
|
33
|
+
* absent (so a row stored before CV2 is the look it always was). Pure. */
|
|
34
|
+
export function resolveColourWords(partial: Readonly<Partial<Record<ColourWordKey, unknown>>> | null | undefined): Pick<DesignChoices, ColourWordKey> {
|
|
35
|
+
const { ground, dark, action, wash } = partial ?? {};
|
|
36
|
+
return {
|
|
37
|
+
...(isGround(ground) ? { ground } : {}),
|
|
38
|
+
...(isDark(dark) ? { dark } : {}),
|
|
39
|
+
...(isWash(wash) ? { wash } : {}),
|
|
40
|
+
...(isAction(action) && action !== ACTION_ACCENT ? { action } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The button word's three component tokens (`action-bg` · `action-ink` · `action-hover`), or none for the accent. */
|
|
45
|
+
export function actionPaintTokens(action: string | null | undefined): ReadonlyArray<readonly [string, string]> {
|
|
46
|
+
if (!isAction(action) || action === ACTION_ACCENT) return [];
|
|
47
|
+
return Object.entries(SPEC_AXES.actionPaints[action] as Readonly<Record<string, string>>).filter(([k]) => k !== 'label');
|
|
48
|
+
}
|
|
@@ -8,6 +8,7 @@ import type { FlavorRevertSnapshot } from './flavor-seed';
|
|
|
8
8
|
import { isArriveId, isMoveId } from './motion-language';
|
|
9
9
|
import { isPreloaderKind, PreloaderKind } from './preloader';
|
|
10
10
|
import { isScrubId, ScrubId } from './scrub';
|
|
11
|
+
import { resolveColourWords } from './colour-words';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* The `settings.design` row (design-system plan §3f), read and written by ONE pair of functions so
|
|
@@ -49,6 +50,12 @@ export enum DesignConfigKey {
|
|
|
49
50
|
Preloader = 'preloader',
|
|
50
51
|
/** AW10: the look's By the scroll (a `ScrubId`); absent = never. */
|
|
51
52
|
Scrub = 'scrub',
|
|
53
|
+
/** Colour v2 CV2: the page's ground, the dark band's colour, the main button's paint; absent = the look's own. */
|
|
54
|
+
Ground = 'ground',
|
|
55
|
+
Dark = 'dark',
|
|
56
|
+
Action = 'action',
|
|
57
|
+
/** Colour v2 CV3: how the page is painted; absent = the look's own paint. */
|
|
58
|
+
Wash = 'wash',
|
|
52
59
|
Revert = 'revert',
|
|
53
60
|
}
|
|
54
61
|
|
|
@@ -144,11 +151,13 @@ export function resolveDesignChoices(partial: Partial<DesignChoices> | null | un
|
|
|
144
151
|
...(fonts ? { fonts } : {}),
|
|
145
152
|
...resolveDesignMotion(partial),
|
|
146
153
|
...resolveMotionLanguageChoices(partial),
|
|
154
|
+
...resolveColourWords(partial),
|
|
147
155
|
};
|
|
148
156
|
}
|
|
149
157
|
|
|
150
158
|
/** The look's motion language as stored: a known Feel / Headings word (AW3), first-visit preloader (AW5) or By the
|
|
151
|
-
* scroll word (AW10) is kept, anything else is absent.
|
|
159
|
+
* scroll word (AW10) is kept, anything else is absent. An explicit `none` / `never` is KEPT (motion reach, D12): it is the
|
|
160
|
+
* owner turning the move off, which `withSignatureMove` respects — absent means nobody chose, and a build may sign it. */
|
|
152
161
|
export function resolveMotionLanguageChoices(
|
|
153
162
|
partial: Readonly<Partial<Record<'feel' | 'headings' | 'preloader' | 'scrub', unknown>>> | null | undefined,
|
|
154
163
|
): Pick<DesignChoices, 'feel' | 'headings' | 'preloader' | 'scrub'> {
|
|
@@ -159,10 +168,11 @@ export function resolveMotionLanguageChoices(
|
|
|
159
168
|
return {
|
|
160
169
|
...(isArriveId(feel) ? { feel } : {}),
|
|
161
170
|
...(isMoveId(headings) ? { headings } : {}),
|
|
162
|
-
// AW5: a known kind
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
// AW5: a known kind is kept — `none` too (the owner turned it off); unknown or absent reads absent. Either way nothing
|
|
172
|
+
// opens the visit unless a kind is named.
|
|
173
|
+
...(isPreloaderKind(preloader) ? { preloader } : {}),
|
|
174
|
+
// AW10: a known word is kept — `never` too (the owner turned it off); unknown or absent reads absent (= plays once).
|
|
175
|
+
...(isScrubId(scrub) ? { scrub } : {}),
|
|
166
176
|
};
|
|
167
177
|
}
|
|
168
178
|
|
|
@@ -227,6 +237,10 @@ export function readDesignConfig(config: ReadonlyArray<DesignConfigEntry> | null
|
|
|
227
237
|
headings: asString(map.get(DesignConfigKey.Headings)) ?? undefined,
|
|
228
238
|
preloader: asString(map.get(DesignConfigKey.Preloader)) ?? undefined,
|
|
229
239
|
scrub: asString(map.get(DesignConfigKey.Scrub)) ?? undefined,
|
|
240
|
+
ground: asString(map.get(DesignConfigKey.Ground)) ?? undefined,
|
|
241
|
+
dark: asString(map.get(DesignConfigKey.Dark)) ?? undefined,
|
|
242
|
+
action: asString(map.get(DesignConfigKey.Action)) ?? undefined,
|
|
243
|
+
wash: asString(map.get(DesignConfigKey.Wash)) ?? undefined,
|
|
230
244
|
});
|
|
231
245
|
return {
|
|
232
246
|
choices,
|
|
@@ -274,6 +288,10 @@ export function designConfigEntries(
|
|
|
274
288
|
...(c.headings ? [{ key: DesignConfigKey.Headings, value: c.headings }] : []),
|
|
275
289
|
...(c.preloader ? [{ key: DesignConfigKey.Preloader, value: c.preloader }] : []),
|
|
276
290
|
...(c.scrub ? [{ key: DesignConfigKey.Scrub, value: c.scrub }] : []),
|
|
291
|
+
...(c.ground ? [{ key: DesignConfigKey.Ground, value: c.ground }] : []),
|
|
292
|
+
...(c.dark ? [{ key: DesignConfigKey.Dark, value: c.dark }] : []),
|
|
293
|
+
...(c.action ? [{ key: DesignConfigKey.Action, value: c.action }] : []),
|
|
294
|
+
...(c.wash ? [{ key: DesignConfigKey.Wash, value: c.wash }] : []),
|
|
277
295
|
...(c.fonts ? [{ key: DesignConfigKey.Fonts, value: JSON.stringify(c.fonts) }] : []),
|
|
278
296
|
...(revert ? [{ key: DesignConfigKey.Revert, value: JSON.stringify(revert) }] : []),
|
|
279
297
|
];
|
|
@@ -290,5 +308,6 @@ export function sameDesignChoices(a: DesignChoices, b: DesignChoices): boolean {
|
|
|
290
308
|
&& (x.feel ?? '') === (y.feel ?? '') && (x.headings ?? '') === (y.headings ?? '')
|
|
291
309
|
&& (x.preloader ?? '') === (y.preloader ?? '')
|
|
292
310
|
&& (x.scrub ?? '') === (y.scrub ?? '')
|
|
311
|
+
&& (x.ground ?? '') === (y.ground ?? '') && (x.dark ?? '') === (y.dark ?? '') && (x.action ?? '') === (y.action ?? '') && (x.wash ?? '') === (y.wash ?? '')
|
|
293
312
|
&& JSON.stringify(x.fonts ?? {}) === JSON.stringify(y.fonts ?? {});
|
|
294
313
|
}
|
|
@@ -108,6 +108,14 @@ export interface DesignChoices {
|
|
|
108
108
|
/** Design ▸ Motion ▸ By the scroll (AW10): what may follow the scroll — a `ScrubId` (never · words · entrances).
|
|
109
109
|
* Absent = never (a row stored before AW10). */
|
|
110
110
|
scrub?: string;
|
|
111
|
+
/** Colour v2 CV2: the page's ground word (`GroundWord` — paper · white · cool). Absent = the look's own ground. */
|
|
112
|
+
ground?: string;
|
|
113
|
+
/** Colour v2 CV2: the dark band's word (`DarkWord` — brand-deep · earth). Absent = the look's own near-black. */
|
|
114
|
+
dark?: string;
|
|
115
|
+
/** Colour v2 CV2: the main button's paint (`ActionWord` — ink · deep). Absent = the brand colour (accent). */
|
|
116
|
+
action?: string;
|
|
117
|
+
/** Colour v2 CV3: how the page is painted (`WashWord` — gradient · glow). Absent = the look's own paint. */
|
|
118
|
+
wash?: string;
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
export interface FlavorSpecToken {
|