@vectoriox/iox-ui 5.135.0 → 5.136.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/composite-core/index.d.ts +15 -2
- package/design-core/index.d.ts +153 -9
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -36
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +28 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +241 -48
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1257 -126
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +7 -3
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/generation-core/index.d.ts +444 -59
- package/harness-core/index.d.ts +4 -2
- package/package.json +1 -1
- package/src/assist-core/page-sections.ts +4 -31
- package/src/composite-core/slider.ts +35 -0
- package/src/design-core/design-settings.ts +16 -3
- package/src/design-core/design-token.model.ts +3 -0
- package/src/design-core/flavor-spec.generated.ts +98 -25
- package/src/design-core/motion-language.ts +12 -9
- package/src/design-core/preloader.ts +129 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/style-presets.ts +3 -1
- package/src/generation-core/carry.ts +37 -0
- package/src/generation-core/compose-site.ts +222 -9
- package/src/generation-core/node-baselines.generated.ts +2 -1
- package/src/generation-core/opening-edit.ts +240 -0
- package/src/generation-core/opening-mix.ts +639 -0
- package/src/generation-core/patterns.ts +3 -0
- package/src/generation-core/plan-wire.ts +26 -4
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/site-build-run.ts +23 -1
- package/src/generation-core/site-plan.model.ts +3 -1
- package/src/generation-core/site-spec.generated.ts +137 -56
- package/src/generation-core/validate-site-plan.ts +5 -3
- package/src/harness-core/starting-design.ts +8 -4
- package/styles/iox-design.css +32 -0
package/harness-core/index.d.ts
CHANGED
|
@@ -3659,9 +3659,11 @@ declare const GENERATION_LIMITS: {
|
|
|
3659
3659
|
/**
|
|
3660
3660
|
* A preset for this business: its choices, Motion from the business (`motionFor`), the references' colour as its seed
|
|
3661
3661
|
* when that colour passes AA in every mode the preset offers (`referenceSeed` — judged as used), and what the owner
|
|
3662
|
-
* already set kept. The ONE rule for a Look pick and for Build with these.
|
|
3662
|
+
* already set kept. The ONE rule for a Look pick and for Build with these. The style's first-visit preloader (AW5) is kept
|
|
3663
|
+
* only while the start is Lively or Expressive (PL-D6) — a calm business (its ceiling below Standard) or "little
|
|
3664
|
+
* movement" never opens with one.
|
|
3663
3665
|
*/
|
|
3664
|
-
declare function presetDesign(presetId: string, input: MotionInput | string | null, kept?: Partial<Pick<DesignChoices, 'scroll' | 'animate' | 'between' | 'motion' | 'feel' | 'headings'>>, read?: StyleRead | null): DesignChoices | null;
|
|
3666
|
+
declare function presetDesign(presetId: string, input: MotionInput | string | null, kept?: Partial<Pick<DesignChoices, 'scroll' | 'animate' | 'between' | 'motion' | 'feel' | 'headings' | 'preloader'>>, read?: StyleRead | null): DesignChoices | null;
|
|
3665
3667
|
interface StartingDesign {
|
|
3666
3668
|
presetId: string;
|
|
3667
3669
|
design: DesignChoices;
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
SWAP_CARRY_KINDS, swapParts, walkSerialized,
|
|
2
|
+
carryInto, composeSection, jsonClosedObject, jsonListOf, jsonOneOf, JsonSchema, jsonText, patternById, SectionInput, SerializedNode, walkSerialized,
|
|
4
3
|
} from '@vectoriox/iox-ui/generation-core';
|
|
5
4
|
|
|
6
5
|
import { assertAssistBudget } from './budget';
|
|
@@ -174,37 +173,11 @@ function swapBlocker(root: SerializedNode): string | null {
|
|
|
174
173
|
return blocker;
|
|
175
174
|
}
|
|
176
175
|
|
|
177
|
-
const labelOf = (button: SerializedNode) => (button.children ?? []).find(c => c.type === 'Text');
|
|
178
|
-
|
|
179
176
|
/** The owner's words and pictures, placed into the new section part for part (kind by kind, in order); how many found no
|
|
180
|
-
* place. WHAT is carried is generation-core's carry rule (`
|
|
177
|
+
* place. WHAT is carried and HOW is generation-core's ONE carry rule (`carryInto` — the harvest's classifier, today's
|
|
178
|
+
* kinds only), shared with the Opening studio's "Make this an opening". */
|
|
181
179
|
function carryOver(from: SerializedNode, to: SerializedNode): number {
|
|
182
|
-
|
|
183
|
-
const fresh = swapParts(to);
|
|
184
|
-
let notPlaced = 0;
|
|
185
|
-
for (const kind of SWAP_CARRY_KINDS) {
|
|
186
|
-
old[kind].forEach((source, i) => {
|
|
187
|
-
const target = fresh[kind][i];
|
|
188
|
-
if (!target) {
|
|
189
|
-
const hasContent = kind === CarryKind.Image ? !!source.props['src'] : true;
|
|
190
|
-
if (hasContent) notPlaced++;
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
if (kind === CarryKind.Image) {
|
|
194
|
-
if (!source.props['src']) return;
|
|
195
|
-
target.props = { ...target.props, src: source.props['src'], alt: source.props['alt'] ?? target.props['alt'] };
|
|
196
|
-
} else if (kind === CarryKind.Button) {
|
|
197
|
-
const words = labelOf(source);
|
|
198
|
-
const into = labelOf(target);
|
|
199
|
-
if (words && into) into.props = { ...into.props, content: words.props['content'] };
|
|
200
|
-
const link = Object.fromEntries(BUTTON_LINK_PROPS.filter(k => k in source.props).map(k => [k, source.props[k]]));
|
|
201
|
-
target.props = { ...target.props, ...link };
|
|
202
|
-
} else {
|
|
203
|
-
target.props = { ...target.props, content: source.props['content'] };
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
return notPlaced;
|
|
180
|
+
return carryInto(from, to).length;
|
|
208
181
|
}
|
|
209
182
|
|
|
210
183
|
/** A stable id no node of the page holds (nor any of its parts' derived ids, `<id>-0-1`). */
|
|
@@ -145,6 +145,7 @@ enum Type {
|
|
|
145
145
|
Icon = 'Icon',
|
|
146
146
|
Container = 'Container',
|
|
147
147
|
Text = 'Text',
|
|
148
|
+
Image = 'Image',
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
enum Style {
|
|
@@ -539,6 +540,40 @@ export function buildCarouselRecipe(create: CompositeNodeFactory, options: Carou
|
|
|
539
540
|
return slider;
|
|
540
541
|
}
|
|
541
542
|
|
|
543
|
+
export interface SlideshowOptions {
|
|
544
|
+
/** The slideshow's accessible name (a `region` landmark). */
|
|
545
|
+
name?: string;
|
|
546
|
+
/** How many pictures (empty — the studio's own go in). */
|
|
547
|
+
count?: number;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/** A slide that is one picture, filling it. */
|
|
551
|
+
const PICTURE_SLIDE_BASE: Readonly<Record<string, string>> = { width: '100%', height: '100%', aspectRatio: 'auto', minHeight: '100%', padding: ZERO };
|
|
552
|
+
const SLIDE_PICTURE_BASE: Readonly<Record<string, string>> = { width: '100%', height: '100%', aspectRatio: 'auto', objectFit: 'cover', borderRadius: ZERO, margin: ZERO };
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* The slideshow (award-ingredients AW8, `media.slideshow`): pictures cross-fading on their own — a named Slider with a
|
|
556
|
+
* fade, autoplay and its control parts over the pictures: the pause control (WCAG 2.2.2 — always there while it
|
|
557
|
+
* rotates, `syncSliderParts`) and the dots; no arrows. One empty picture per slide. ONE recipe for the composer and the
|
|
558
|
+
* builder, beside the carousel's.
|
|
559
|
+
*/
|
|
560
|
+
export function buildSlideshowRecipe(create: CompositeNodeFactory, options: SlideshowOptions = {}): CompositeNode {
|
|
561
|
+
const slider = makeCompositePart(create, { key: 'slideshow', type: SLIDER_TYPE, props: {}, elementStyle: NO_ELEMENT_STYLE }, null, 'Slideshow', { width: '100%', height: '100%' });
|
|
562
|
+
for (const [name, value] of Object.entries({
|
|
563
|
+
slidesPerView: 1, spaceBetween: 0, loop: 'rewind', effect: 'fade', speed: 1200, enableNavigation: false, enablePagination: true,
|
|
564
|
+
enableAutoplay: true, autoplayDelay: 5000, autoplayPauseOnMouseEnter: false, autoHeight: false, grabCursor: false,
|
|
565
|
+
[SLIDER_NAME_TRAIT]: options.name ?? 'Pictures', [SLIDER_PLACEMENT_TRAIT]: SliderPlacement.Over,
|
|
566
|
+
})) writeProp(slider, name, value);
|
|
567
|
+
const count = Math.max(2, options.count ?? 3);
|
|
568
|
+
slider.children = Array.from({ length: count }, (_, i) => {
|
|
569
|
+
const slide = makeCompositePart(create, { key: `slide-${i + 1}`, type: SLIDE_TYPE, props: {}, elementStyle: NO_ELEMENT_STYLE }, null, 'Slide', PICTURE_SLIDE_BASE);
|
|
570
|
+
slide.children = [makeCompositePart(create, { key: `picture-${i + 1}`, type: Type.Image, props: { src: '', alt: '' }, elementStyle: 'media' }, null, 'Picture', SLIDE_PICTURE_BASE)];
|
|
571
|
+
return slide;
|
|
572
|
+
});
|
|
573
|
+
syncSliderParts(slider, create);
|
|
574
|
+
return slider;
|
|
575
|
+
}
|
|
576
|
+
|
|
542
577
|
/** The slide a lightbox opens at for the clicked row (clamped to the slides there are). */
|
|
543
578
|
export function slideIndexForRow(rowIndex: number, slideCount: number): number {
|
|
544
579
|
if (!Number.isFinite(rowIndex) || rowIndex < 0 || slideCount <= 0) return 0;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from './design-token.model';
|
|
7
7
|
import type { FlavorRevertSnapshot } from './flavor-seed';
|
|
8
8
|
import { isArriveId, isMoveId } from './motion-language';
|
|
9
|
+
import { isPreloaderKind, PreloaderKind } from './preloader';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* The `settings.design` row (design-system plan §3f), read and written by ONE pair of functions so
|
|
@@ -41,6 +42,8 @@ export enum DesignConfigKey {
|
|
|
41
42
|
Between = 'between',
|
|
42
43
|
Feel = 'feel',
|
|
43
44
|
Headings = 'headings',
|
|
45
|
+
/** AW5: the first-visit preloader (a `PreloaderKind`); absent = none. */
|
|
46
|
+
Preloader = 'preloader',
|
|
44
47
|
Revert = 'revert',
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -138,11 +141,18 @@ export function resolveDesignChoices(partial: Partial<DesignChoices> | null | un
|
|
|
138
141
|
};
|
|
139
142
|
}
|
|
140
143
|
|
|
141
|
-
/** The look's motion language as stored: a known Feel / Headings word
|
|
142
|
-
|
|
144
|
+
/** The look's motion language as stored: a known Feel / Headings word (AW3) or first-visit preloader (AW5) is kept,
|
|
145
|
+
* anything else is absent. */
|
|
146
|
+
export function resolveMotionLanguageChoices(partial: Readonly<Partial<Record<'feel' | 'headings' | 'preloader', unknown>>> | null | undefined): Pick<DesignChoices, 'feel' | 'headings' | 'preloader'> {
|
|
143
147
|
const feel = asString(partial?.feel);
|
|
144
148
|
const headings = asString(partial?.headings);
|
|
145
|
-
|
|
149
|
+
const preloader = asString(partial?.preloader);
|
|
150
|
+
return {
|
|
151
|
+
...(isArriveId(feel) ? { feel } : {}),
|
|
152
|
+
...(isMoveId(headings) ? { headings } : {}),
|
|
153
|
+
// AW5: a known kind other than none is kept; none, unknown or absent reads absent (= nothing opens the visit).
|
|
154
|
+
...(isPreloaderKind(preloader) && preloader !== PreloaderKind.None ? { preloader } : {}),
|
|
155
|
+
};
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
/** The look's motion, completed: an absent or unknown choice reads `PRE_MOTION` — what the site already does. */
|
|
@@ -197,6 +207,7 @@ export function readDesignConfig(config: ReadonlyArray<DesignConfigEntry> | null
|
|
|
197
207
|
between: map.get(DesignConfigKey.Between) as BetweenId,
|
|
198
208
|
feel: asString(map.get(DesignConfigKey.Feel)) ?? undefined,
|
|
199
209
|
headings: asString(map.get(DesignConfigKey.Headings)) ?? undefined,
|
|
210
|
+
preloader: asString(map.get(DesignConfigKey.Preloader)) ?? undefined,
|
|
200
211
|
});
|
|
201
212
|
return {
|
|
202
213
|
choices,
|
|
@@ -241,6 +252,7 @@ export function designConfigEntries(
|
|
|
241
252
|
{ key: DesignConfigKey.Between, value: c.between },
|
|
242
253
|
...(c.feel ? [{ key: DesignConfigKey.Feel, value: c.feel }] : []),
|
|
243
254
|
...(c.headings ? [{ key: DesignConfigKey.Headings, value: c.headings }] : []),
|
|
255
|
+
...(c.preloader ? [{ key: DesignConfigKey.Preloader, value: c.preloader }] : []),
|
|
244
256
|
...(c.fonts ? [{ key: DesignConfigKey.Fonts, value: JSON.stringify(c.fonts) }] : []),
|
|
245
257
|
...(revert ? [{ key: DesignConfigKey.Revert, value: JSON.stringify(revert) }] : []),
|
|
246
258
|
];
|
|
@@ -255,5 +267,6 @@ export function sameDesignChoices(a: DesignChoices, b: DesignChoices): boolean {
|
|
|
255
267
|
&& x.pillButtons === y.pillButtons && x.mode === y.mode && x.tint === y.tint
|
|
256
268
|
&& x.scroll === y.scroll && x.animate === y.animate && x.between === y.between
|
|
257
269
|
&& (x.feel ?? '') === (y.feel ?? '') && (x.headings ?? '') === (y.headings ?? '')
|
|
270
|
+
&& (x.preloader ?? '') === (y.preloader ?? '')
|
|
258
271
|
&& JSON.stringify(x.fonts ?? {}) === JSON.stringify(y.fonts ?? {});
|
|
259
272
|
}
|
|
@@ -92,6 +92,9 @@ export interface DesignChoices {
|
|
|
92
92
|
/** Design ▸ Motion ▸ Headings arrive: the look's ONE heading move. Absent = each level's own heading entrance
|
|
93
93
|
* (MB-D8 — what a page built before AW3 was stamped with). A `MoveId`. */
|
|
94
94
|
headings?: string;
|
|
95
|
+
/** Design ▸ Motion ▸ First visit (AW5): the preloader a visitor's first page of a session opens with — a
|
|
96
|
+
* `PreloaderKind`. Absent = none (a row stored before AW5). Its exit is the look's, never stored. */
|
|
97
|
+
preloader?: string;
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
export interface FlavorSpecToken {
|
|
@@ -2222,6 +2222,19 @@ export const SPEC_MOTION_LANGUAGE = {
|
|
|
2222
2222
|
"pop": "cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
2223
2223
|
"exit": "cubic-bezier(0.25, 1, 0.5, 1)"
|
|
2224
2224
|
},
|
|
2225
|
+
"preloader": [
|
|
2226
|
+
"none",
|
|
2227
|
+
"mark",
|
|
2228
|
+
"counter",
|
|
2229
|
+
"letters"
|
|
2230
|
+
],
|
|
2231
|
+
"preloaderExit": [
|
|
2232
|
+
"none",
|
|
2233
|
+
"fade",
|
|
2234
|
+
"sweep",
|
|
2235
|
+
"window",
|
|
2236
|
+
"lift"
|
|
2237
|
+
],
|
|
2225
2238
|
"tiers": {
|
|
2226
2239
|
"arrive": {
|
|
2227
2240
|
"enter": "all",
|
|
@@ -2254,6 +2267,12 @@ export const SPEC_MOTION_LANGUAGE = {
|
|
|
2254
2267
|
"veil": "pro",
|
|
2255
2268
|
"interstitial": "pro",
|
|
2256
2269
|
"controls": "pro"
|
|
2270
|
+
},
|
|
2271
|
+
"preloader": {
|
|
2272
|
+
"none": "all",
|
|
2273
|
+
"mark": "pro",
|
|
2274
|
+
"counter": "pro",
|
|
2275
|
+
"letters": "pro"
|
|
2257
2276
|
}
|
|
2258
2277
|
},
|
|
2259
2278
|
"meanings": {
|
|
@@ -2278,122 +2297,170 @@ export const SPEC_MOTION_LANGUAGE = {
|
|
|
2278
2297
|
"clear-care": {
|
|
2279
2298
|
"arrive": "quart-out",
|
|
2280
2299
|
"leave": "quart-out",
|
|
2281
|
-
"move": "rise"
|
|
2300
|
+
"move": "rise",
|
|
2301
|
+
"preloader": "none",
|
|
2302
|
+
"preloaderExit": "none"
|
|
2282
2303
|
},
|
|
2283
2304
|
"swiss-grid": {
|
|
2284
2305
|
"arrive": "quart-out",
|
|
2285
2306
|
"leave": "quart-out",
|
|
2286
|
-
"move": "clip"
|
|
2307
|
+
"move": "clip",
|
|
2308
|
+
"preloader": "none",
|
|
2309
|
+
"preloaderExit": "none"
|
|
2287
2310
|
},
|
|
2288
2311
|
"trusted-advisor": {
|
|
2289
2312
|
"arrive": "quart-out",
|
|
2290
2313
|
"leave": "quart-out",
|
|
2291
|
-
"move": "rise"
|
|
2314
|
+
"move": "rise",
|
|
2315
|
+
"preloader": "none",
|
|
2316
|
+
"preloaderExit": "none"
|
|
2292
2317
|
},
|
|
2293
2318
|
"fresh-practice": {
|
|
2294
2319
|
"arrive": "expo-out",
|
|
2295
2320
|
"leave": "quart-out",
|
|
2296
|
-
"move": "fade"
|
|
2321
|
+
"move": "fade",
|
|
2322
|
+
"preloader": "none",
|
|
2323
|
+
"preloaderExit": "none"
|
|
2297
2324
|
},
|
|
2298
2325
|
"gallery-minimal": {
|
|
2299
2326
|
"arrive": "expo-out",
|
|
2300
2327
|
"leave": "quart-out",
|
|
2301
|
-
"move": "fade"
|
|
2328
|
+
"move": "fade",
|
|
2329
|
+
"preloader": "none",
|
|
2330
|
+
"preloaderExit": "none"
|
|
2302
2331
|
},
|
|
2303
2332
|
"warm-editorial": {
|
|
2304
2333
|
"arrive": "quart-out",
|
|
2305
2334
|
"leave": "quart-out",
|
|
2306
|
-
"move": "mask-rise"
|
|
2335
|
+
"move": "mask-rise",
|
|
2336
|
+
"preloader": "none",
|
|
2337
|
+
"preloaderExit": "none"
|
|
2307
2338
|
},
|
|
2308
2339
|
"soft-spa": {
|
|
2309
2340
|
"arrive": "expo-out",
|
|
2310
2341
|
"leave": "quart-out",
|
|
2311
|
-
"move": "blur-in"
|
|
2342
|
+
"move": "blur-in",
|
|
2343
|
+
"preloader": "none",
|
|
2344
|
+
"preloaderExit": "none"
|
|
2312
2345
|
},
|
|
2313
2346
|
"quiet-luxury": {
|
|
2314
2347
|
"arrive": "expo-out",
|
|
2315
2348
|
"leave": "expo-out",
|
|
2316
|
-
"move": "fade"
|
|
2349
|
+
"move": "fade",
|
|
2350
|
+
"preloader": "none",
|
|
2351
|
+
"preloaderExit": "none"
|
|
2317
2352
|
},
|
|
2318
2353
|
"after-dark": {
|
|
2319
2354
|
"arrive": "expo-out",
|
|
2320
2355
|
"leave": "quart-out",
|
|
2321
|
-
"move": "mask-rise"
|
|
2356
|
+
"move": "mask-rise",
|
|
2357
|
+
"preloader": "mark",
|
|
2358
|
+
"preloaderExit": "lift"
|
|
2322
2359
|
},
|
|
2323
2360
|
"ink-studio": {
|
|
2324
2361
|
"arrive": "quart-out",
|
|
2325
2362
|
"leave": "quart-out",
|
|
2326
|
-
"move": "mask-rise"
|
|
2363
|
+
"move": "mask-rise",
|
|
2364
|
+
"preloader": "none",
|
|
2365
|
+
"preloaderExit": "none"
|
|
2327
2366
|
},
|
|
2328
2367
|
"night-gallery": {
|
|
2329
2368
|
"arrive": "expo-out",
|
|
2330
2369
|
"leave": "quart-out",
|
|
2331
|
-
"move": "blur-in"
|
|
2370
|
+
"move": "blur-in",
|
|
2371
|
+
"preloader": "none",
|
|
2372
|
+
"preloaderExit": "none"
|
|
2332
2373
|
},
|
|
2333
2374
|
"tech-studio": {
|
|
2334
2375
|
"arrive": "quart-out",
|
|
2335
2376
|
"leave": "quart-out",
|
|
2336
|
-
"move": "words-lit"
|
|
2377
|
+
"move": "words-lit",
|
|
2378
|
+
"preloader": "counter",
|
|
2379
|
+
"preloaderExit": "window"
|
|
2337
2380
|
},
|
|
2338
2381
|
"morning-glass": {
|
|
2339
2382
|
"arrive": "expo-out",
|
|
2340
2383
|
"leave": "quart-out",
|
|
2341
|
-
"move": "blur-in"
|
|
2384
|
+
"move": "blur-in",
|
|
2385
|
+
"preloader": "none",
|
|
2386
|
+
"preloaderExit": "none"
|
|
2342
2387
|
},
|
|
2343
2388
|
"holiday-light": {
|
|
2344
2389
|
"arrive": "spring",
|
|
2345
2390
|
"leave": "quart-out",
|
|
2346
|
-
"move": "rise"
|
|
2391
|
+
"move": "rise",
|
|
2392
|
+
"preloader": "none",
|
|
2393
|
+
"preloaderExit": "none"
|
|
2347
2394
|
},
|
|
2348
2395
|
"frosted-portfolio": {
|
|
2349
2396
|
"arrive": "expo-out",
|
|
2350
2397
|
"leave": "quart-out",
|
|
2351
|
-
"move": "blur-in"
|
|
2398
|
+
"move": "blur-in",
|
|
2399
|
+
"preloader": "none",
|
|
2400
|
+
"preloaderExit": "none"
|
|
2352
2401
|
},
|
|
2353
2402
|
"coral-studio": {
|
|
2354
2403
|
"arrive": "pop",
|
|
2355
2404
|
"leave": "quart-out",
|
|
2356
|
-
"move": "rise"
|
|
2405
|
+
"move": "rise",
|
|
2406
|
+
"preloader": "none",
|
|
2407
|
+
"preloaderExit": "none"
|
|
2357
2408
|
},
|
|
2358
2409
|
"corner-cafe": {
|
|
2359
2410
|
"arrive": "spring",
|
|
2360
2411
|
"leave": "quart-out",
|
|
2361
|
-
"move": "rise"
|
|
2412
|
+
"move": "rise",
|
|
2413
|
+
"preloader": "mark",
|
|
2414
|
+
"preloaderExit": "fade"
|
|
2362
2415
|
},
|
|
2363
2416
|
"kind-community": {
|
|
2364
2417
|
"arrive": "quart-out",
|
|
2365
2418
|
"leave": "quart-out",
|
|
2366
|
-
"move": "rise"
|
|
2419
|
+
"move": "rise",
|
|
2420
|
+
"preloader": "none",
|
|
2421
|
+
"preloaderExit": "none"
|
|
2367
2422
|
},
|
|
2368
2423
|
"little-ones": {
|
|
2369
2424
|
"arrive": "pop",
|
|
2370
2425
|
"leave": "quart-out",
|
|
2371
|
-
"move": "rise"
|
|
2426
|
+
"move": "rise",
|
|
2427
|
+
"preloader": "none",
|
|
2428
|
+
"preloaderExit": "none"
|
|
2372
2429
|
},
|
|
2373
2430
|
"garden-party": {
|
|
2374
2431
|
"arrive": "spring",
|
|
2375
2432
|
"leave": "quart-out",
|
|
2376
|
-
"move": "rise"
|
|
2433
|
+
"move": "rise",
|
|
2434
|
+
"preloader": "none",
|
|
2435
|
+
"preloaderExit": "none"
|
|
2377
2436
|
},
|
|
2378
2437
|
"bold-maker": {
|
|
2379
2438
|
"arrive": "pop",
|
|
2380
2439
|
"leave": "quart-out",
|
|
2381
|
-
"move": "mask-rise"
|
|
2440
|
+
"move": "mask-rise",
|
|
2441
|
+
"preloader": "counter",
|
|
2442
|
+
"preloaderExit": "sweep"
|
|
2382
2443
|
},
|
|
2383
2444
|
"festival": {
|
|
2384
2445
|
"arrive": "pop",
|
|
2385
2446
|
"leave": "quart-out",
|
|
2386
|
-
"move": "rise"
|
|
2447
|
+
"move": "rise",
|
|
2448
|
+
"preloader": "letters",
|
|
2449
|
+
"preloaderExit": "fade"
|
|
2387
2450
|
},
|
|
2388
2451
|
"zine": {
|
|
2389
2452
|
"arrive": "quart-out",
|
|
2390
2453
|
"leave": "quart-out",
|
|
2391
|
-
"move": "clip"
|
|
2454
|
+
"move": "clip",
|
|
2455
|
+
"preloader": "letters",
|
|
2456
|
+
"preloaderExit": "sweep"
|
|
2392
2457
|
},
|
|
2393
2458
|
"fresh-market": {
|
|
2394
2459
|
"arrive": "spring",
|
|
2395
2460
|
"leave": "quart-out",
|
|
2396
|
-
"move": "rise"
|
|
2461
|
+
"move": "rise",
|
|
2462
|
+
"preloader": "none",
|
|
2463
|
+
"preloaderExit": "none"
|
|
2397
2464
|
}
|
|
2398
2465
|
},
|
|
2399
2466
|
"leaveFor": {
|
|
@@ -2419,13 +2486,19 @@ export const SPEC_MOTION_LANGUAGE = {
|
|
|
2419
2486
|
"planFallback": {
|
|
2420
2487
|
"arrive": "enter",
|
|
2421
2488
|
"move": "fade",
|
|
2422
|
-
"cover": "fade"
|
|
2489
|
+
"cover": "fade",
|
|
2490
|
+
"preloader": "none"
|
|
2423
2491
|
},
|
|
2424
2492
|
"coverMaxMs": {
|
|
2425
2493
|
"cover": 400,
|
|
2426
2494
|
"hold": 120,
|
|
2427
2495
|
"uncover": 500
|
|
2428
2496
|
},
|
|
2497
|
+
"preloaderCapMs": 1500,
|
|
2498
|
+
"preloaderLevels": [
|
|
2499
|
+
"lively",
|
|
2500
|
+
"expressive"
|
|
2501
|
+
],
|
|
2429
2502
|
"reduced": {
|
|
2430
2503
|
"enter": "fade",
|
|
2431
2504
|
"enterMaxMs": 200
|
|
@@ -45,15 +45,17 @@ export interface MotionLanguage {
|
|
|
45
45
|
export const isArriveId = (v: unknown): v is ArriveId => typeof v === 'string' && (ARRIVE_IDS as ReadonlyArray<string>).includes(v);
|
|
46
46
|
export const isMoveId = (v: unknown): v is MoveId => typeof v === 'string' && (MOVE_IDS as ReadonlyArray<string>).includes(v);
|
|
47
47
|
|
|
48
|
-
const PRESET_LANGUAGE = L.presets as Readonly<Record<string, { arrive: ArriveId; leave: LeaveId; move: MoveId }>>;
|
|
48
|
+
const PRESET_LANGUAGE = L.presets as Readonly<Record<string, { arrive: ArriveId; leave: LeaveId; move: MoveId; preloader: string; preloaderExit: string }>>;
|
|
49
49
|
const LEAVE_FOR = L.leaveFor as Readonly<Record<ArriveId, LeaveId>>;
|
|
50
|
-
/** The families a word's tier is asked of: the arrive / leave curves, the heading move, the cover between pages (AW4)
|
|
51
|
-
|
|
50
|
+
/** The families a word's tier is asked of: the arrive / leave curves, the heading move, the cover between pages (AW4),
|
|
51
|
+
* the first-visit preloader (AW5). */
|
|
52
|
+
export type MotionWordKind = 'arrive' | 'leave' | 'move' | 'cover' | 'preloader';
|
|
52
53
|
const TIERS = L.tiers as Readonly<Record<MotionWordKind, Readonly<Record<string, `${MotionWordTier}`>>>>;
|
|
53
|
-
const PLAN_FALLBACK = L.planFallback as Readonly<{ arrive: ArriveId; move: MoveId; cover: string }>;
|
|
54
|
+
const PLAN_FALLBACK = L.planFallback as Readonly<{ arrive: ArriveId; move: MoveId; cover: string; preloader: string }>;
|
|
54
55
|
|
|
55
|
-
/** A style preset's own language (its Feel and
|
|
56
|
-
|
|
56
|
+
/** A style preset's own language (its Feel, Headings arrive and first-visit preloader with its exit) — undefined for an
|
|
57
|
+
* unknown id. */
|
|
58
|
+
export function presetMotionLanguage(presetId: string | null | undefined): { arrive: ArriveId; leave: LeaveId; move: MoveId; preloader: string; preloaderExit: string } | undefined {
|
|
57
59
|
return presetId ? PRESET_LANGUAGE[presetId] : undefined;
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -88,16 +90,17 @@ export function motionCurve(word: ArriveId | LeaveId, tokenValue: (name: string)
|
|
|
88
90
|
|
|
89
91
|
/**
|
|
90
92
|
* What a lower plan wears of a language (AW-D23, MB-D6): a Pro word is drawn as the plan's own (the contract's
|
|
91
|
-
* `planFallback`) — Feel today's arrival, a Pro move a fade, a Pro cover (AW4) a fade between pages
|
|
92
|
-
* look is CHOSEN (a Look pick, a build); a built site keeps its words.
|
|
93
|
+
* `planFallback`) — Feel today's arrival, a Pro move a fade, a Pro cover (AW4) a fade between pages, a preloader (AW5)
|
|
94
|
+
* none. Applied where a look is CHOSEN (a Look pick, a build); a built site keeps its words.
|
|
93
95
|
*/
|
|
94
|
-
export function motionLanguageForPlan<T extends Pick<DesignChoices, 'feel' | 'headings'> & { between?: DesignChoices['between'] }>(choices: T, pro: boolean): T {
|
|
96
|
+
export function motionLanguageForPlan<T extends Pick<DesignChoices, 'feel' | 'headings'> & { between?: DesignChoices['between']; preloader?: DesignChoices['preloader'] }>(choices: T, pro: boolean): T {
|
|
95
97
|
if (pro) return choices;
|
|
96
98
|
const proWord = (kind: MotionWordKind, word: unknown) => typeof word === 'string' && motionWordTier(kind, word) === MotionWordTier.Pro;
|
|
97
99
|
const feel = isArriveId(choices.feel) && proWord('arrive', choices.feel) ? PLAN_FALLBACK.arrive : choices.feel;
|
|
98
100
|
const headings = isMoveId(choices.headings) && proWord('move', choices.headings) ? PLAN_FALLBACK.move : choices.headings;
|
|
99
101
|
const out = { ...choices, feel, headings };
|
|
100
102
|
if (proWord('cover', choices.between)) out.between = PLAN_FALLBACK.cover as DesignChoices['between'];
|
|
103
|
+
if (proWord('preloader', choices.preloader)) out.preloader = PLAN_FALLBACK.preloader;
|
|
101
104
|
return out;
|
|
102
105
|
}
|
|
103
106
|
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { SPEC_MOTION_LANGUAGE } from './flavor-spec.generated';
|
|
2
|
+
import { MotionWordTier, motionWordTier, presetMotionLanguage } from './motion-language';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* THE FIRST-VISIT PRELOADER (award-ingredients-plan §5.3, AW5; Preloader board PL-D1…PL-D9) — pure, framework-free.
|
|
6
|
+
*
|
|
7
|
+
* A look may open a visitor's FIRST page of a session with a short preloader — the brand mark, a 0 → 100 count of real
|
|
8
|
+
* loading, or the opening's first words letter by letter — that leaves by the look's own exit. ONE decision here
|
|
9
|
+
* (`planPreloader`) for the engine's runtime, every builder preview and the generator; the rules are the contract's
|
|
10
|
+
* (`layout.mjs` MOTION → `SPEC_MOTION_LANGUAGE`): ≤ `preloaderCapMs`, Lively / Expressive looks only, a Pro word, never
|
|
11
|
+
* under reduced motion, never on a return visit. The page's words are always painted under it (T1); it never holds the
|
|
12
|
+
* scroll — a scroll, key or tap ends it (PL-D4).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const L = SPEC_MOTION_LANGUAGE;
|
|
16
|
+
|
|
17
|
+
/** What opens the first visit (`design.preloader`). */
|
|
18
|
+
export enum PreloaderKind {
|
|
19
|
+
None = 'none',
|
|
20
|
+
/** The header's brand — its logo, else the business name in the display face. */
|
|
21
|
+
Mark = 'mark',
|
|
22
|
+
/** A 0 → 100 count of the first screen's real loading (pictures + fonts), in the display face. */
|
|
23
|
+
Counter = 'counter',
|
|
24
|
+
/** The opening heading's first words, letter by letter. */
|
|
25
|
+
Letters = 'letters',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** How it leaves — the look's own, never a separate choice (PL-D3). */
|
|
29
|
+
export enum PreloaderExit {
|
|
30
|
+
None = 'none',
|
|
31
|
+
Fade = 'fade',
|
|
32
|
+
/** An accent panel leaves upward. */
|
|
33
|
+
Sweep = 'sweep',
|
|
34
|
+
/** A frame grows from the centre. */
|
|
35
|
+
Window = 'window',
|
|
36
|
+
/** The whole layer rises away. */
|
|
37
|
+
Lift = 'lift',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const PRELOADER_IDS: ReadonlyArray<string> = L.preloader;
|
|
41
|
+
export const PRELOADER_EXIT_IDS: ReadonlyArray<string> = L.preloaderExit;
|
|
42
|
+
/** AW-D7: a preloader leaves at the first screen's readiness or this many ms, whichever first. */
|
|
43
|
+
export const PRELOADER_CAP_MS: number = L.preloaderCapMs;
|
|
44
|
+
/** The How animated levels a preloader is offered on. */
|
|
45
|
+
export const PRELOADER_LEVELS: ReadonlyArray<string> = L.preloaderLevels;
|
|
46
|
+
/** A preloader's exit takes at most this long (Emil: exits are short; ≤ the covers' uncover). */
|
|
47
|
+
export const PRELOADER_EXIT_MAX_MS = 500;
|
|
48
|
+
/** Letters shows the opening heading only while it is this short (PL-D2); a longer one shows the business name. */
|
|
49
|
+
export const PRELOADER_LETTERS_MAX = 24;
|
|
50
|
+
|
|
51
|
+
export const isPreloaderKind = (v: unknown): v is `${PreloaderKind}` => typeof v === 'string' && PRELOADER_IDS.includes(v);
|
|
52
|
+
|
|
53
|
+
/** What the runtime draws: the kind, the look's exit, and its cap. */
|
|
54
|
+
export interface PreloaderPlan {
|
|
55
|
+
readonly kind: Exclude<PreloaderKind, PreloaderKind.None>;
|
|
56
|
+
readonly exit: Exclude<PreloaderExit, PreloaderExit.None>;
|
|
57
|
+
readonly capMs: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Everything the decision needs; each renderer fills what only it can see. */
|
|
61
|
+
export interface PreloaderInput {
|
|
62
|
+
/** The look's choice (`design.preloader`); absent = none. */
|
|
63
|
+
readonly preloader: string | null | undefined;
|
|
64
|
+
/** The look's How animated (`design.animate`). */
|
|
65
|
+
readonly animate: string | null | undefined;
|
|
66
|
+
/** The style preset the look came from — its exit (`MOTION.presets`); absent or exit-less → Fade. */
|
|
67
|
+
readonly presetId?: string | null;
|
|
68
|
+
/** The studio's plan carries the Pro words (`GenerationTier.Award`). A built site keeps its word (AW-D23): pass true
|
|
69
|
+
* for a stored design — the clamp happens where a look is CHOSEN (`motionLanguageForPlan`). */
|
|
70
|
+
readonly pro: boolean;
|
|
71
|
+
/** The visitor asked for reduced motion. */
|
|
72
|
+
readonly reducedMotion: boolean;
|
|
73
|
+
/** This is the session's first page in this tab, not reached from another page of the site (`isFirstVisit`). */
|
|
74
|
+
readonly firstVisit: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The ONE decision: what opens this visit, or null for nothing (the page is simply there). */
|
|
78
|
+
export function planPreloader(input: PreloaderInput): PreloaderPlan | null {
|
|
79
|
+
const kind = input.preloader;
|
|
80
|
+
if (!isPreloaderKind(kind) || kind === PreloaderKind.None) return null;
|
|
81
|
+
if (input.reducedMotion || !input.firstVisit) return null;
|
|
82
|
+
if (!PRELOADER_LEVELS.includes(String(input.animate ?? ''))) return null;
|
|
83
|
+
if (!input.pro && motionWordTier('preloader', kind) === MotionWordTier.Pro) return null;
|
|
84
|
+
return { kind: kind as PreloaderPlan['kind'], exit: preloaderExitOf(input.presetId), capMs: PRELOADER_CAP_MS };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The look's exit (PL-D3): the preset's own, else a fade. */
|
|
88
|
+
export function preloaderExitOf(presetId: string | null | undefined): PreloaderPlan['exit'] {
|
|
89
|
+
const own = presetMotionLanguage(presetId ?? null)?.preloaderExit;
|
|
90
|
+
return own && own !== PreloaderExit.None && PRELOADER_EXIT_IDS.includes(own) ? (own as PreloaderPlan['exit']) : PreloaderExit.Fade;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** When it leaves (PL-D4): at the page's readiness, never past the cap; a reading not yet known waits for the cap. */
|
|
94
|
+
export function preloaderLeaveAt(readyMs: number | null | undefined, capMs: number = PRELOADER_CAP_MS): number {
|
|
95
|
+
if (typeof readyMs !== 'number' || !Number.isFinite(readyMs) || readyMs < 0) return capMs;
|
|
96
|
+
return Math.min(readyMs, capMs);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* PL-D5: a first visit is the session's first page in this tab AND not reached from another page of the same site
|
|
101
|
+
* (a new tab opened from the site, a reload after Back). `seen` = the tab's session memory; `referrer` and `origin`
|
|
102
|
+
* as the browser reports them.
|
|
103
|
+
*/
|
|
104
|
+
export function isFirstVisit(seen: boolean, referrer: string | null | undefined, origin: string | null | undefined): boolean {
|
|
105
|
+
if (seen) return false;
|
|
106
|
+
if (!referrer || !origin) return true;
|
|
107
|
+
try {
|
|
108
|
+
return new URL(referrer).origin !== new URL(origin).origin;
|
|
109
|
+
} catch {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The counter's number (PL-D2): real loading only — `loaded` of `total` first-screen resources, a whole percent that
|
|
116
|
+
* never goes back; nothing to load reads 100. Never a timer.
|
|
117
|
+
*/
|
|
118
|
+
export function preloaderPercent(loaded: number, total: number, previous = 0): number {
|
|
119
|
+
const t = Math.max(0, Math.floor(total));
|
|
120
|
+
const raw = t === 0 ? 100 : Math.floor((100 * Math.min(Math.max(0, loaded), t)) / t);
|
|
121
|
+
return Math.max(Math.min(100, Math.max(0, Math.floor(previous))), raw);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** PL-D2: what Letters spells — the opening heading while it is short enough, else the business name. */
|
|
125
|
+
export function preloaderWords(heading: string | null | undefined, businessName: string | null | undefined): string {
|
|
126
|
+
const h = String(heading ?? '').replace(/\s+/g, ' ').trim();
|
|
127
|
+
if (h && Array.from(h).length <= PRELOADER_LETTERS_MAX) return h;
|
|
128
|
+
return String(businessName ?? '').replace(/\s+/g, ' ').trim() || Array.from(h).slice(0, PRELOADER_LETTERS_MAX).join('');
|
|
129
|
+
}
|
|
@@ -71,8 +71,10 @@ export function presetChoices(id: string, mode?: DesignMode): DesignChoices | nu
|
|
|
71
71
|
return resolveDesignChoices({
|
|
72
72
|
flavorId: preset.flavorId, seed: preset.seed, pairId: preset.pairId, shape: preset.shape, density: preset.density,
|
|
73
73
|
motion: preset.motion, pillButtons: preset.pillButtons, mode: wear, tint: preset.tint, ...preset.moves,
|
|
74
|
-
// AW3: the look's own motion language — its Feel and how its headings arrive (MB-D5)
|
|
74
|
+
// AW3: the look's own motion language — its Feel and how its headings arrive (MB-D5); AW5: its first-visit
|
|
75
|
+
// preloader (PL-D1 — the exit is the preset's, never stored).
|
|
75
76
|
feel: presetMotionLanguage(preset.id)?.arrive, headings: presetMotionLanguage(preset.id)?.move,
|
|
77
|
+
preloader: presetMotionLanguage(preset.id)?.preloader,
|
|
76
78
|
});
|
|
77
79
|
}
|
|
78
80
|
|