@vectoriox/iox-ui 5.197.0 → 5.199.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions-core/index.d.ts +7 -1
- package/composite-core/index.d.ts +16 -2
- package/data-core/index.d.ts +11 -3
- package/design-core/index.d.ts +185 -28
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +6 -1
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +34 -2
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +30 -4
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +323 -72
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +17351 -15175
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +243 -38
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +2 -2
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1703 -264
- package/harness-core/index.d.ts +93 -6
- package/package.json +1 -1
- package/src/actions-core/element-actions.ts +6 -0
- package/src/composite-core/header.ts +34 -1
- package/src/data-core/placeholder-rows.ts +29 -4
- package/src/design-core/brand.ts +58 -5
- package/src/design-core/contrast-audit.ts +49 -22
- package/src/design-core/design-apply.ts +34 -3
- package/src/design-core/flavor-fixtures.generated.ts +123 -123
- package/src/design-core/flavor-spec.generated.ts +44 -4
- package/src/design-core/flavor-tokens.ts +1 -1
- package/src/design-core/header-behaviour.ts +72 -13
- package/src/design-core/menu-look.ts +23 -0
- package/src/design-core/motion-language.ts +5 -14
- package/src/design-core/node-classes.ts +39 -0
- package/src/design-core/preloader.ts +4 -5
- package/src/generation-core/body-mix.ts +40 -102
- package/src/generation-core/check-free.ts +22 -11
- package/src/generation-core/check-layout.ts +10 -4
- package/src/generation-core/check-list.ts +3 -25
- package/src/generation-core/colour-mix.ts +296 -0
- package/src/generation-core/compose-free.ts +47 -20
- package/src/generation-core/compose-site.ts +259 -59
- package/src/generation-core/footer-mix.ts +258 -64
- package/src/generation-core/free-fallback.ts +6 -4
- package/src/generation-core/free-opening.ts +13 -2
- package/src/generation-core/free-parts.ts +87 -0
- package/src/generation-core/free-slot-words.ts +30 -0
- package/src/generation-core/free-wire.ts +8 -0
- package/src/generation-core/generation-tier.ts +6 -17
- package/src/generation-core/header-mix.ts +73 -3
- package/src/generation-core/layout-drawers.ts +3 -2
- package/src/generation-core/layout-wire.ts +10 -16
- package/src/generation-core/legal.ts +24 -0
- package/src/generation-core/list-panel.ts +3 -3
- package/src/generation-core/list-table.ts +5 -14
- package/src/generation-core/list-words.ts +2 -1
- package/src/generation-core/menu-shelves.ts +138 -0
- package/src/generation-core/nav-shape.ts +138 -15
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/opening-mix.ts +7 -34
- package/src/generation-core/part-tier.ts +14 -0
- package/src/generation-core/patterns.ts +7 -0
- package/src/generation-core/plan-wire.ts +32 -43
- package/src/generation-core/public-api.ts +3 -0
- package/src/generation-core/site-build-run.ts +8 -0
- package/src/generation-core/site-plan.model.ts +3 -0
- package/src/generation-core/site-spec.generated.ts +1383 -189
- package/src/generation-core/validate-site-plan.ts +6 -5
- package/src/harness-core/business-types.ts +4 -0
- package/src/harness-core/harness-spec.generated.ts +189 -30
- package/src/harness-core/popup-stance.ts +56 -3
- package/src/harness-core/run-compose-context.ts +25 -5
- package/styles/iox-design.css +162 -3
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { GroundTone, sectionPictured } from './body-mix';
|
|
2
|
+
import { LayoutIssue, LayoutIssueCode, LayoutSection, LayoutSectionKind } from './layout-language';
|
|
3
|
+
import { GenerationTier } from './site-plan.model';
|
|
4
|
+
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* THE COLOUR (colour-v2-plan.md §5, CV0/CV1; CV-D1…CV-D14): how a site wears its colours — the page's ground family, the
|
|
8
|
+
* colour of its dark bands, how much accent and where, what the main button is painted with, how the section grounds
|
|
9
|
+
* follow one another (the rhythm), the bands' shape, how a ground is painted, the pictures' grade and where the seed comes
|
|
10
|
+
* from. Every word, its meaning in both languages, whether the product draws it, its tier, each rhythm's rule and the 24
|
|
11
|
+
* style presets' default mixes live in ONE table, the contract's `site.layout.colour` (layout.mjs `COLOUR`), read from
|
|
12
|
+
* Doron's references. This module reads it and judges a composed page's grounds against its rhythm (`colourRhythmIssues`,
|
|
13
|
+
* run by `checkLayout` — AW6's judge, moved here with the words, CV-D6). Pure.
|
|
14
|
+
*
|
|
15
|
+
* CV1 draws no new word: every word past today's look waits for CV2–CV5 and is drawn as today's (`drawnColourMix`).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface ColourTable {
|
|
19
|
+
ingredients: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
20
|
+
meanings: Readonly<Record<string, string>>;
|
|
21
|
+
meaningsHe: Readonly<Record<string, string>>;
|
|
22
|
+
waits: Readonly<Record<string, { phase: string; drawnAs: string }>>;
|
|
23
|
+
defaults: Readonly<Record<string, string>>;
|
|
24
|
+
fingerprint: ReadonlyArray<string>;
|
|
25
|
+
rhythms: {
|
|
26
|
+
'one-ground': { darks: number };
|
|
27
|
+
'long-runs': { run: number; breaks: number };
|
|
28
|
+
alternate: { neighbours: 'differ' };
|
|
29
|
+
'paper-picture': { every: number };
|
|
30
|
+
chapters: { changesAt: ReadonlyArray<string> };
|
|
31
|
+
tail: { last: number };
|
|
32
|
+
flood: { neighbours: 'differ'; apart: number };
|
|
33
|
+
};
|
|
34
|
+
rules: {
|
|
35
|
+
groundsMax: Readonly<Record<string, number>>;
|
|
36
|
+
accentMax: Readonly<Record<string, number>>;
|
|
37
|
+
mutedGroundIn: ReadonlyArray<string>;
|
|
38
|
+
accentKeepsSeed: boolean;
|
|
39
|
+
washAudited: boolean;
|
|
40
|
+
};
|
|
41
|
+
tiers: Readonly<Record<string, 'all' | 'pro'>>;
|
|
42
|
+
presets: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const C = SPEC_SITE_LAYOUT.colour as unknown as ColourTable;
|
|
46
|
+
|
|
47
|
+
/** The ingredients, by the contract's keys (held equal to it by colour-mix.spec). */
|
|
48
|
+
export enum ColourIngredient {
|
|
49
|
+
Ground = 'ground',
|
|
50
|
+
Dark = 'dark',
|
|
51
|
+
Accent = 'accent',
|
|
52
|
+
Action = 'action',
|
|
53
|
+
Rhythm = 'rhythm',
|
|
54
|
+
Bands = 'bands',
|
|
55
|
+
Wash = 'wash',
|
|
56
|
+
Pictures = 'pictures',
|
|
57
|
+
Source = 'source',
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export enum ColourGround { Look = 'look', Paper = 'paper', White = 'white', Cool = 'cool' }
|
|
61
|
+
export enum ColourDark { Ink = 'ink', BrandDeep = 'brand-deep', Earth = 'earth' }
|
|
62
|
+
export enum ColourAccent { Signal = 'signal', OnePlace = 'one-place', None = 'none', Flood = 'flood' }
|
|
63
|
+
export enum ColourAction { Accent = 'accent', Ink = 'ink', Deep = 'deep' }
|
|
64
|
+
export enum ColourRhythm {
|
|
65
|
+
Free = 'free',
|
|
66
|
+
OneGround = 'one-ground',
|
|
67
|
+
LongRuns = 'long-runs',
|
|
68
|
+
Alternate = 'alternate',
|
|
69
|
+
PaperPicture = 'paper-picture',
|
|
70
|
+
Chapters = 'chapters',
|
|
71
|
+
Tail = 'tail',
|
|
72
|
+
Flood = 'flood',
|
|
73
|
+
Flow = 'flow',
|
|
74
|
+
}
|
|
75
|
+
export enum ColourBands { Full = 'full', Inset = 'inset' }
|
|
76
|
+
export enum ColourWash { Flat = 'flat', Gradient = 'gradient', Glow = 'glow', PhotoDim = 'photo-dim' }
|
|
77
|
+
export enum ColourPictures { Natural = 'natural', Warm = 'warm', Cool = 'cool', Mono = 'mono' }
|
|
78
|
+
export enum ColourSource { Brand = 'brand', Photos = 'photos', Look = 'look' }
|
|
79
|
+
|
|
80
|
+
/** One word per ingredient. */
|
|
81
|
+
export type ColourMix = Readonly<Record<`${ColourIngredient}`, string>>;
|
|
82
|
+
|
|
83
|
+
export class ColourMixError extends Error {}
|
|
84
|
+
|
|
85
|
+
const HEBREW = 'he';
|
|
86
|
+
const ORDER: ReadonlyArray<ColourIngredient> = Object.values(ColourIngredient);
|
|
87
|
+
|
|
88
|
+
/** The words an ingredient may take, in the table's order (waiting ones too). */
|
|
89
|
+
export function colourWords(ingredient: `${ColourIngredient}`): ReadonlyArray<string> {
|
|
90
|
+
return C.ingredients[ingredient] ?? [];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** What a word means — in Hebrew when the builder speaks it. */
|
|
94
|
+
export function colourMeaning(ingredient: `${ColourIngredient}`, word: string, locale?: string | null): string {
|
|
95
|
+
const key = `${ingredient}.${word}`;
|
|
96
|
+
return (locale === HEBREW ? C.meaningsHe[key] : undefined) ?? C.meanings[key] ?? word;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Whether the product draws a word today. */
|
|
100
|
+
export function colourWordDrawn(ingredient: `${ColourIngredient}`, word: string): boolean {
|
|
101
|
+
return colourWords(ingredient).includes(word) && !C.waits[`${ingredient}.${word}`];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** The phase a waiting word waits for, or null. */
|
|
105
|
+
export function colourWordWaits(ingredient: `${ColourIngredient}`, word: string): string | null {
|
|
106
|
+
return C.waits[`${ingredient}.${word}`]?.phase ?? null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** CV-D10: a word every plan wears (`all`) or one the award tier alone is offered (`pro`). */
|
|
110
|
+
export function colourWordTier(ingredient: `${ColourIngredient}`, word: string): 'all' | 'pro' {
|
|
111
|
+
return C.tiers[`${ingredient}.${word}`] === 'pro' ? 'pro' : 'all';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** May a build at `tier` wear this word? */
|
|
115
|
+
export function colourWordOffered(ingredient: `${ColourIngredient}`, word: string, tier: `${GenerationTier}`): boolean {
|
|
116
|
+
return colourWordTier(ingredient, word) === 'all' || tier === GenerationTier.Award;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A whole mix from part of one: what is not named is the default (today's look). Refuses a word the table lacks. */
|
|
120
|
+
export function colourMix(partial: Partial<Record<string, string>> = {}): ColourMix {
|
|
121
|
+
const mix: Record<string, string> = { ...C.defaults };
|
|
122
|
+
for (const [k, w] of Object.entries(partial)) {
|
|
123
|
+
if (w === undefined) continue;
|
|
124
|
+
if (!C.ingredients[k]) throw new ColourMixError(`no colour ingredient "${k}"`);
|
|
125
|
+
if (!C.ingredients[k].includes(w)) throw new ColourMixError(`a site's colour ${k} cannot be "${w}" (${C.ingredients[k].join(' · ')})`);
|
|
126
|
+
mix[k] = w;
|
|
127
|
+
}
|
|
128
|
+
return mix as ColourMix;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** CV-D13: a style preset's default colour mix (its §6 row, the rest the defaults); an unknown preset wears the defaults. */
|
|
132
|
+
export function presetColourMix(presetId: string | null | undefined): ColourMix {
|
|
133
|
+
return colourMix(C.presets[presetId ?? ''] ?? {});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** A mix on the wire: one `<ingredient>:<word>` per ingredient, in the table's order. */
|
|
137
|
+
export function colourMixWords(mix: ColourMix): string[] {
|
|
138
|
+
return ORDER.map(k => `${k}:${mix[k]}`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** The words back into a mix. Refuses an unknown word and two words for one ingredient. */
|
|
142
|
+
export function colourMixFromWords(words: ReadonlyArray<string>): ColourMix {
|
|
143
|
+
const partial: Record<string, string> = {};
|
|
144
|
+
for (const pair of words) {
|
|
145
|
+
const [k, w] = String(pair).split(':');
|
|
146
|
+
if (!C.ingredients[k] || !w) throw new ColourMixError(`"${pair}" is no colour word (<ingredient>:<word>)`);
|
|
147
|
+
if (partial[k] !== undefined && partial[k] !== w) throw new ColourMixError(`a site has one colour ${k} ("${partial[k]}" and "${w}")`);
|
|
148
|
+
partial[k] = w;
|
|
149
|
+
}
|
|
150
|
+
return colourMix(partial);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface ColourGap {
|
|
154
|
+
ingredient: `${ColourIngredient}`;
|
|
155
|
+
word: string;
|
|
156
|
+
phase: string;
|
|
157
|
+
drawnAs: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** The mix the product DRAWS today: a waiting word becomes its stand-in, each said. */
|
|
161
|
+
export function drawnColourMix(mix: ColourMix): { drawn: ColourMix; gaps: ColourGap[] } {
|
|
162
|
+
const drawn: Record<string, string> = { ...mix };
|
|
163
|
+
const gaps: ColourGap[] = [];
|
|
164
|
+
for (const k of ORDER) {
|
|
165
|
+
const wait = C.waits[`${k}.${mix[k]}`];
|
|
166
|
+
if (!wait) continue;
|
|
167
|
+
gaps.push({ ingredient: k, word: mix[k], phase: wait.phase, drawnAs: wait.drawnAs });
|
|
168
|
+
drawn[k] = wait.drawnAs;
|
|
169
|
+
}
|
|
170
|
+
return { drawn: drawn as ColourMix, gaps };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** The fingerprint's prefix for a site's colour. */
|
|
174
|
+
export const COLOUR_TOKEN = 'colour';
|
|
175
|
+
|
|
176
|
+
/** A site's colour as the fingerprint sees it: `colour:<ground>/<dark>/<accent>/<rhythm>` — what a visitor takes in at once. */
|
|
177
|
+
export function colourTokenOf(mix: ColourMix): string {
|
|
178
|
+
return `${COLOUR_TOKEN}:${C.fingerprint.map(k => mix[k as ColourIngredient]).join('/')}`;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Every `<ingredient>:<word>` a generator's wire may carry at `tier`: drawn words only, the award tier's only there. */
|
|
182
|
+
export function colourWireWords(tier: `${GenerationTier}` = GenerationTier.Basic): string[] {
|
|
183
|
+
return ORDER.flatMap(k => colourWords(k).filter(w => colourWordDrawn(k, w) && colourWordOffered(k, w, tier)).map(w => `${k}:${w}`));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** CV-D7: the most different grounds a page may wear (photos excepted) under an accent word. */
|
|
187
|
+
export function colourGroundsMax(accent: string): number {
|
|
188
|
+
return C.rules.groundsMax[accent] ?? C.rules.groundsMax[ColourAccent.Signal];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** The accent budget an accent word sets (replaces the look's `accentMax` when a plan names one, CV2). */
|
|
192
|
+
export function colourAccentMax(accent: string): number {
|
|
193
|
+
return C.rules.accentMax[accent] ?? C.rules.accentMax[ColourAccent.Signal];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ── The rhythm: a composed page's grounds against the site's colour rhythm ──────────────────────────────────────────
|
|
197
|
+
|
|
198
|
+
export interface ColourRhythmContext {
|
|
199
|
+
/** Each section's ground, as it reads. */
|
|
200
|
+
toneOf: (section: LayoutSection) => GroundTone;
|
|
201
|
+
/** The footer's ground, as it reads; absent: the tail is not judged (the footer's scheme is not known). */
|
|
202
|
+
footerTone?: GroundTone | null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const startsChapter = (s: LayoutSection, at: ReadonlyArray<string>) =>
|
|
206
|
+
(at.includes('inhale') && s.kind === LayoutSectionKind.Inhale) || (at.includes('signature') && !!s.signature);
|
|
207
|
+
const PHOTO_GROUND = 'photo:';
|
|
208
|
+
const groundWordOf = (s: LayoutSection): string => s.ground ?? 'ground';
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* A composed page's grounds judged against the colour rhythm (`COLOUR.rhythms`): each issue a `Structure` issue on the
|
|
212
|
+
* page, so the layout request is asked again with it. `free`, `flow` (CV5: the ScrollDriver's, not a section's) and an
|
|
213
|
+
* unknown word ask nothing. A photo ground is free in every rhythm. Pure.
|
|
214
|
+
*/
|
|
215
|
+
export function colourRhythmIssues(sections: ReadonlyArray<LayoutSection>, rhythm: string | null | undefined, ctx: ColourRhythmContext): LayoutIssue[] {
|
|
216
|
+
const issues: LayoutIssue[] = [];
|
|
217
|
+
const add = (path: string, message: string) => issues.push({ code: LayoutIssueCode.Structure, path, message });
|
|
218
|
+
const tones = sections.map(s => ctx.toneOf(s));
|
|
219
|
+
const darks = tones.flatMap((t, i) => (t === GroundTone.Dark ? [i] : []));
|
|
220
|
+
const R = C.rhythms;
|
|
221
|
+
switch (rhythm) {
|
|
222
|
+
case ColourRhythm.Alternate:
|
|
223
|
+
for (let i = 1; i < sections.length; i++) {
|
|
224
|
+
if (tones[i] !== GroundTone.Photo && tones[i] === tones[i - 1]) {
|
|
225
|
+
add(`sections[${i}].ground`, `grounds alternate dark and light — "${sections[i].id}" is ${tones[i]} like the section before it`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
break;
|
|
229
|
+
case ColourRhythm.OneGround: {
|
|
230
|
+
const lastShown = tones.reduce((at, t, i) => (t === GroundTone.Photo ? at : i), -1);
|
|
231
|
+
darks.forEach((i, n) => {
|
|
232
|
+
if (n >= R['one-ground'].darks || i !== lastShown) {
|
|
233
|
+
add(`sections[${i}].ground`, `one ground for most of the page, at most ${R['one-ground'].darks} dark section before the footer — "${sections[i].id}" is dark`);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
case ColourRhythm.LongRuns: {
|
|
239
|
+
const { run, breaks } = R['long-runs'];
|
|
240
|
+
darks.forEach((i, n) => {
|
|
241
|
+
const since = n ? i - darks[n - 1] - 1 : i;
|
|
242
|
+
if (n >= breaks || since < Math.min(run, sections.length - 1)) {
|
|
243
|
+
add(`sections[${i}].ground`, `long light runs (${run} sections or more) broken by at most ${breaks} dark section — "${sections[i].id}" breaks it too soon`);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
case ColourRhythm.PaperPicture: {
|
|
249
|
+
const { every } = R['paper-picture'];
|
|
250
|
+
let since = 0;
|
|
251
|
+
sections.forEach((s, i) => {
|
|
252
|
+
since = sectionPictured(s) ? 0 : since + 1;
|
|
253
|
+
if (since > every) add(`sections[${i}]`, `paper and full pictures take turns, a picture at least every ${every} sections — "${s.id}" is the ${since}th without one`);
|
|
254
|
+
});
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
case ColourRhythm.Chapters: {
|
|
258
|
+
const at = R.chapters.changesAt;
|
|
259
|
+
let last: GroundTone | null = null;
|
|
260
|
+
sections.forEach((s, i) => {
|
|
261
|
+
const tone = tones[i];
|
|
262
|
+
if (tone === GroundTone.Photo) return;
|
|
263
|
+
if (last !== null && tone !== last && !startsChapter(s, at)) {
|
|
264
|
+
add(`sections[${i}].ground`, `the ground changes only where a chapter starts (an inhale or the signature) — "${s.id}" changes it`);
|
|
265
|
+
}
|
|
266
|
+
last = tone;
|
|
267
|
+
});
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
case ColourRhythm.Tail: {
|
|
271
|
+
if (!ctx.footerTone || ctx.footerTone === GroundTone.Photo) break;
|
|
272
|
+
const from = Math.max(0, sections.length - R.tail.last);
|
|
273
|
+
for (let i = from; i < sections.length; i++) {
|
|
274
|
+
if (tones[i] !== GroundTone.Photo && tones[i] !== ctx.footerTone) {
|
|
275
|
+
add(`sections[${i}].ground`, `the last ${R.tail.last} sections wear the footer's ${ctx.footerTone} ground — "${sections[i].id}" is ${tones[i]}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
case ColourRhythm.Flood: {
|
|
281
|
+
const { apart } = R.flood;
|
|
282
|
+
sections.forEach((s, i) => {
|
|
283
|
+
const g = groundWordOf(s);
|
|
284
|
+
if (g.startsWith(PHOTO_GROUND)) return;
|
|
285
|
+
for (let j = Math.max(0, i - apart); j < i; j++) {
|
|
286
|
+
if (groundWordOf(sections[j]) === g) {
|
|
287
|
+
add(`sections[${i}].ground`, `a different full colour each section, none again within ${apart} — "${s.id}" repeats "${g}"`);
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return issues;
|
|
296
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { NO_ELEMENT_STYLE } from '@vectoriox/iox-ui/composite-core';
|
|
2
|
-
import { LinkType } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { CarouselFrom, ContentFieldLike, NO_ELEMENT_STYLE } from '@vectoriox/iox-ui/composite-core';
|
|
2
|
+
import { LinkType, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
3
3
|
import { VideoMode, VideoSource } from '@vectoriox/iox-ui/media-core';
|
|
4
4
|
|
|
5
5
|
import { composeListFrame, LayoutListBinding } from './compose-layout';
|
|
6
|
-
import { composePresetForm } from './compose-site';
|
|
6
|
+
import { composeListAccordion, composeListLightbox, composeListTabs, composePresetForm, composeQuoteCarousel } from './compose-site';
|
|
7
|
+
import { FREE_OPEN_LIGHTBOX, freeSlotOf, FreeSlotKind } from './free-slot-words';
|
|
7
8
|
import { freeNodeId } from './free-render-check';
|
|
8
9
|
import { freeStyleToSlots } from './free-slots';
|
|
9
|
-
import { FREE_BUILDER_TYPE, FreeLayer, FreeNode, FreeNodeType, FreePage, FreeStyle, FreeTrigger } from './free-wire';
|
|
10
|
+
import { FREE_BUILDER_TYPE, freeSchemeOf, FreeLayer, FreeNode, FreeNodeType, FreePage, FreeStyle, FreeTrigger } from './free-wire';
|
|
10
11
|
import { LAYOUT_BEAT_DELAY, LAYOUT_DEPTH_ON_PHONE, LAYOUT_EASING, LAYOUT_PACE, LAYOUT_RISE, LayoutEase, LayoutPace, LayoutRole, LayoutSite } from './layout-language';
|
|
11
12
|
import { listMixFromWords } from './layout-wire';
|
|
12
13
|
import { ComposeError, createSerializedNode, SerializedNode, setStyleProps } from './serialized-node';
|
|
@@ -26,8 +27,9 @@ import { stampSection } from './section-stamp';
|
|
|
26
27
|
const COMPOSED = { releaseLayoutDefaults: true } as const;
|
|
27
28
|
const SECTION_LINK = '#';
|
|
28
29
|
const ROUTE_MARK = '/';
|
|
29
|
-
|
|
30
|
-
const
|
|
30
|
+
/** The list roles a lightbox reads: the picture, and the name its picture is described by. */
|
|
31
|
+
const IMAGE_ROLE = 'image';
|
|
32
|
+
const TITLE_ROLE = 'title';
|
|
31
33
|
/** A list slot's mix when the answer names no option: cards of the list's parts, in a grid. */
|
|
32
34
|
const LIST_SLOT_WORDS: ReadonlyArray<string> = ['item:card', 'arrange:grid'];
|
|
33
35
|
|
|
@@ -44,6 +46,10 @@ export interface ComposeFreeOptions {
|
|
|
44
46
|
photoAlt: (id: string) => string;
|
|
45
47
|
/** How a list slot's items are read (`layoutListBinding`); null for an alias that is no list. */
|
|
46
48
|
listOf: (alias: string) => LayoutListBinding | null;
|
|
49
|
+
/** A list's fields as composite-core's pickers read them (an `accordion:` / `tabs:` slot binds them). */
|
|
50
|
+
listFields?: (alias: string) => ReadonlyArray<ContentFieldLike>;
|
|
51
|
+
/** The plan's list of real quotes (`quoteListOf`) — what a `quotes:` slot repeats; null: the plan holds none. */
|
|
52
|
+
quotes?: CarouselFrom | null;
|
|
47
53
|
/** The plan's ready-made section at plan index `at`, composed under `id` (a section the fall back gave back). */
|
|
48
54
|
readyMade?: (at: number, id: string) => SerializedNode;
|
|
49
55
|
}
|
|
@@ -112,9 +118,14 @@ function composeNode(n: FreeNode, ctx: Ctx, beat: number): SerializedNode {
|
|
|
112
118
|
if (n.href?.startsWith(SECTION_LINK)) ctx.links.push({ node, to: n.href.slice(1) });
|
|
113
119
|
}
|
|
114
120
|
styleInto(node, n, ctx);
|
|
121
|
+
// iox-ui#186: a box painted a scheme's own ground (a dark band, `var(--iox-inverse-bg)`) wears that scheme, so every
|
|
122
|
+
// token the look reads inside — a button's ink and outline, a line, a link — is the ground's, not only the words the
|
|
123
|
+
// answer coloured by hand. `freeContrastIssues` judges the tree in the same schemes (`freeSchemeOf`).
|
|
124
|
+
const scheme = freeSchemeOf(n);
|
|
125
|
+
if (scheme) setColorScheme(node, scheme);
|
|
115
126
|
const move = moveOf(n, id, ctx, beat);
|
|
116
127
|
if (move) node.interactions = [...node.interactions, move];
|
|
117
|
-
if (n.type === FreeNodeType.Slot) node.children =
|
|
128
|
+
if (n.type === FreeNodeType.Slot) node.children = slotOf(n, id, ctx);
|
|
118
129
|
else if (n.children?.length) {
|
|
119
130
|
let moving = 0;
|
|
120
131
|
node.children = [...(node.children ?? []), ...n.children.map(c => composeNode(c, ctx, c.move ? moving++ : 0))];
|
|
@@ -180,20 +191,36 @@ function moveOf(n: FreeNode, id: string, ctx: Ctx, beat: number): unknown | null
|
|
|
180
191
|
};
|
|
181
192
|
}
|
|
182
193
|
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
/**
|
|
195
|
+
* What a Slot places (`free-parts.ts`): the list composer's frame (and, asked `open:lightbox`, the Lightbox its pictures
|
|
196
|
+
* open), the preset form, or a recipe over a list — the Accordion, Tabs, the testimonial carousel. Never the model's nodes.
|
|
197
|
+
*/
|
|
198
|
+
function slotOf(n: FreeNode, id: string, ctx: Ctx): SerializedNode[] {
|
|
199
|
+
const slot = freeSlotOf(n.slot ?? '');
|
|
200
|
+
const locale = ctx.o.locale;
|
|
201
|
+
switch (slot?.kind) {
|
|
202
|
+
case FreeSlotKind.List: {
|
|
203
|
+
const list = ctx.o.listOf(slot.ref);
|
|
204
|
+
if (!list) throw new ComposeError(`${n.id}: "${slot.ref}" is no list of the plan`);
|
|
205
|
+
const asked = (n.opts ?? []).filter(o => o && o !== FREE_OPEN_LIGHTBOX);
|
|
206
|
+
const words = [...LIST_SLOT_WORDS.filter(w => !asked.some(a => a.split(':')[0] === w.split(':')[0])), ...asked];
|
|
207
|
+
const mix = listMixFromWords(words, Object.keys(list.roles))!;
|
|
208
|
+
const frame = composeListFrame({ id: `${id}-list`, mix, source: slot.ref, list, locale, label: n.purpose ?? slot.ref, path: n.id, ...(ctx.o.motion ? { motion: ctx.o.motion } : {}) }).frame;
|
|
209
|
+
if (!(n.opts ?? []).includes(FREE_OPEN_LIGHTBOX)) return [frame];
|
|
210
|
+
const image = list.roles[IMAGE_ROLE];
|
|
211
|
+
const lightbox = image ? composeListLightbox(`${id}-lightbox`, frame, slot.ref, image, locale, list.roles[TITLE_ROLE]) : null;
|
|
212
|
+
if (!lightbox) throw new ComposeError(`${n.id}: "${slot.ref}" shows no picture a click could open`);
|
|
213
|
+
return [frame, lightbox];
|
|
214
|
+
}
|
|
215
|
+
case FreeSlotKind.Form: return [composePresetForm(`${id}-form`, slot.ref, ctx.o.owner, locale)];
|
|
216
|
+
case FreeSlotKind.Accordion: return [composeListAccordion(`${id}-accordion`, slot.ref, ctx.o.listFields?.(slot.ref) ?? [], locale)];
|
|
217
|
+
case FreeSlotKind.Tabs: return [composeListTabs(`${id}-tabs`, slot.ref, ctx.o.listFields?.(slot.ref) ?? [], locale)];
|
|
218
|
+
case FreeSlotKind.Quotes: {
|
|
219
|
+
if (!ctx.o.quotes || ctx.o.quotes.source !== slot.ref) throw new ComposeError(`${n.id}: "${slot.ref}" is no list of real quotes`);
|
|
220
|
+
return [composeQuoteCarousel(`${id}-quotes`, ctx.o.quotes, locale)];
|
|
221
|
+
}
|
|
222
|
+
default: throw new ComposeError(`${n.id}: "${n.slot ?? ''}" is not a part a free page may place`);
|
|
194
223
|
}
|
|
195
|
-
if (slot.startsWith(FORM_SLOT)) return composePresetForm(`${id}-form`, slot.slice(FORM_SLOT.length), ctx.o.owner, ctx.o.locale);
|
|
196
|
-
throw new ComposeError(`${n.id}: "${slot}" is not a part a free page may place`);
|
|
197
224
|
}
|
|
198
225
|
|
|
199
226
|
/** A Button to a section of this page scrolls to it (the product's `scrollTo`: M8-G7, no shareable `#id`). */
|