@vectoriox/iox-ui 5.133.0 → 5.134.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/commerce-core/index.d.ts +12 -1
- package/composite-core/index.d.ts +27 -22
- package/design-core/index.d.ts +436 -35
- package/domain-core/index.d.ts +353 -0
- package/domain-core/package.json +3 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +2 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -48
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +21 -0
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +68 -57
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +895 -416
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-domain-core.mjs +422 -0
- package/fesm2022/vectoriox-iox-ui-domain-core.mjs.map +1 -0
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +13974 -12036
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +9 -3
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-mail-core.mjs +210 -2
- package/fesm2022/vectoriox-iox-ui-mail-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +290 -16
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1419 -379
- package/harness-core/index.d.ts +6 -1
- package/index.d.ts +139 -10
- package/mail-core/index.d.ts +190 -2
- package/package.json +5 -1
- package/src/actions-core/element-actions.ts +2 -0
- package/src/assist-core/page-sections.ts +7 -37
- package/src/commerce-core/shop-display.ts +21 -0
- package/src/composite-core/shop.ts +71 -57
- package/src/design-core/design-settings.ts +16 -0
- package/src/design-core/design-token.model.ts +7 -1
- package/src/design-core/flavor-spec.generated.ts +374 -35
- package/src/design-core/flavor-tokens.ts +12 -1
- package/src/design-core/header-behaviour.ts +32 -0
- package/src/design-core/motion-language.ts +115 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/style-presets.ts +3 -0
- package/src/domain-core/domain-vocabulary.ts +125 -0
- package/src/domain-core/domain-wire.ts +95 -0
- package/src/domain-core/org-path-redirect.ts +105 -0
- package/src/domain-core/public-api.ts +12 -0
- package/src/domain-core/web-domain.ts +251 -0
- package/src/generation-core/carry-fill.ts +36 -0
- package/src/generation-core/carry.ts +398 -0
- package/src/generation-core/check-carry.ts +216 -0
- package/src/generation-core/check-layout.ts +71 -5
- package/src/generation-core/compose-layout.ts +187 -28
- package/src/generation-core/compose-site.ts +154 -31
- package/src/generation-core/entrances.ts +66 -10
- package/src/generation-core/header-edit.ts +299 -0
- package/src/generation-core/header-mix.ts +64 -5
- package/src/generation-core/layout-fingerprint.ts +5 -1
- package/src/generation-core/layout-language.ts +20 -1
- package/src/generation-core/layout-space.ts +4 -4
- package/src/generation-core/layout-wire.ts +36 -1
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/public-api.ts +7 -0
- package/src/generation-core/redesign-additions.ts +273 -0
- package/src/generation-core/redesign-run.ts +364 -0
- package/src/generation-core/refit-page.ts +151 -0
- package/src/generation-core/section-stamp.ts +4 -4
- package/src/generation-core/shop-plan.ts +15 -0
- package/src/generation-core/site-build-run.ts +20 -3
- package/src/generation-core/site-spec.generated.ts +194 -94
- package/src/generation-core/site-tree.ts +19 -5
- package/src/generation-core/validate-site-plan.ts +37 -3
- package/src/harness-core/motion.ts +13 -3
- package/src/harness-core/starting-design.ts +1 -1
- package/src/mail-core/mail-domain.ts +305 -0
- package/src/mail-core/mail-wire.ts +8 -0
- package/src/mail-core/public-api.ts +3 -1
- package/styles/iox-design.css +30 -1
|
@@ -3,7 +3,7 @@ import { ParallaxDepth } from '@vectoriox/iox-ui/scene-core';
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
LAYOUT_HIDDEN_OPACITY, LAYOUT_OPERATED, LAYOUT_TEXT_KINDS, LayoutBandMove, LayoutColour, LayoutDepth, LayoutDial, LayoutEnter, LayoutGalleryList, LayoutIssue, LayoutListShape, LayoutIssueCode, LayoutLayer, LayoutLayerKind, LayoutMend, LayoutMendKind,
|
|
6
|
-
LayoutGivenAway, LayoutPage, LayoutPhotoSource,
|
|
6
|
+
LayoutGivenAway, LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutPage, LayoutPhotoSource,
|
|
7
7
|
LayoutRole, LayoutSection, LayoutSectionKind, LayoutSourceChoice, LayoutTrackProp, parseLayoutPhotoId,
|
|
8
8
|
} from './layout-language';
|
|
9
9
|
import { DriftBox, driftOverlap, layoutGlideDepth } from './layout-drift';
|
|
@@ -51,6 +51,12 @@ export interface CheckLayoutContext {
|
|
|
51
51
|
listShapes?: ReadonlyArray<LayoutListShape>;
|
|
52
52
|
/** What this business type's lists never do (L-D12 — harness-core `BusinessType.lists`): repaired by `checkList`. */
|
|
53
53
|
listNever?: LayoutListNever;
|
|
54
|
+
/** The lists this page is where the site shows (`layoutListsShownOn` — a shop page's products): one of its list sections
|
|
55
|
+
* shows one of them, its items linking to their own page (vectoriox/iox-ui#99). */
|
|
56
|
+
shows?: ReadonlyArray<string>;
|
|
57
|
+
/** The list each of the page's plan sections binds, by its index (`page.sections[i].binding`): a ready-made place
|
|
58
|
+
* stamps its section, so it shows that list. */
|
|
59
|
+
sectionBindings?: ReadonlyArray<string | undefined>;
|
|
54
60
|
/** The site's page routes a button may lead to (`/contact`). */
|
|
55
61
|
routes?: string[];
|
|
56
62
|
/** Every word the owner gave and what was read from it: a number not in here was invented. */
|
|
@@ -354,11 +360,13 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
354
360
|
// A place given to the plan's ready-made section (silent section fallback) is the pattern's own, already proven: none
|
|
355
361
|
// of a composed section's rules reach into it, and the page's counts are the composed sections'. It still lets people
|
|
356
362
|
// reach the business when its pattern is a call to act or a contact.
|
|
357
|
-
|
|
363
|
+
// A redesign's section place (RD-D20: a bound part, a block or a kept section carried whole) is the owner's, judged by
|
|
364
|
+
// `checkCarry` — like a ready-made place, no composed section's rule reaches into it.
|
|
365
|
+
const composedCount = sections.filter(s => !s.readyMade && !s.carry).length;
|
|
358
366
|
if (sections.some(s => s.readyMade && READY_MADE_REACH.has(patternById(s.readyMade.pattern)?.family ?? ''))) reachable = true;
|
|
359
367
|
const readyMadeEntering = sections.filter(s => s.readyMade && readyMadeEnters(s.readyMade.pattern, ctx.design?.animate)).length;
|
|
360
368
|
sections.forEach((s, i) => {
|
|
361
|
-
if (s.readyMade) return;
|
|
369
|
+
if (s.readyMade || s.carry) return;
|
|
362
370
|
const at = `sections[${i}]`;
|
|
363
371
|
const track = trackOf(s);
|
|
364
372
|
const kind = s.kind ?? LayoutSectionKind.Content;
|
|
@@ -610,6 +618,9 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
610
618
|
const large = (L.sizePx[l.size ?? 'm'] ?? 0) >= LARGE_TEXT_PX;
|
|
611
619
|
const need = large ? CONTRAST_LARGE : CONTRAST_BODY;
|
|
612
620
|
if (under.length && isText(l)) wordsOnPhoto++;
|
|
621
|
+
// a gallery's pictures change under whatever sits on them (and an empty one is a box): words never do (iox-ui#102)
|
|
622
|
+
const gallery = layers.findIndex(o => o !== l && o.kind === LayoutLayerKind.Gallery && overlaps(o, l));
|
|
623
|
+
if (gallery >= 0) add(LayoutIssueCode.Reading, lp, `overlaps the gallery at layers[${gallery}] — words never sit on a gallery's pictures; move one of them`);
|
|
613
624
|
for (const p of under) {
|
|
614
625
|
if (limits.noTextOnPhoto && isText(l)) {
|
|
615
626
|
add(LayoutIssueCode.Look, lp, `the ${look?.id} look never puts words on a photo`);
|
|
@@ -654,8 +665,9 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
654
665
|
&& (o.row?.[1] ?? 0) >= (l.row?.[0] ?? 0) - 1 && (o.row?.[1] ?? 0) <= (l.row?.[0] ?? 0)
|
|
655
666
|
&& (o.col?.[0] ?? 0) < (l.col?.[1] ?? 0) && (l.col?.[0] ?? 0) < (o.col?.[1] ?? 0))) eyebrows++;
|
|
656
667
|
|
|
657
|
-
// facts: tokens that name a fact, placeholders that should be one, numbers nobody gave
|
|
658
|
-
|
|
668
|
+
// facts: tokens that name a fact, placeholders that should be one, numbers nobody gave — never on a carried layer:
|
|
669
|
+
// its words are the owner's own (a redesign, RD-D5), read only for how they fit (`withCarriedText`)
|
|
670
|
+
if (!l.carry) for (const words of wordsOfLayer(l)) {
|
|
659
671
|
for (const [, key] of words.matchAll(FACT_TOKEN)) if (!factKeys.includes(key)) add(LayoutIssueCode.Content, `${lp}.text`, `{fact:${key}} names no fact — one of ${factKeys.join(' | ')}`);
|
|
660
672
|
const plain = words.replace(FACT_TOKEN, '');
|
|
661
673
|
for (const [whole, inner] of plain.matchAll(BRACKET)) {
|
|
@@ -744,9 +756,55 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
744
756
|
if (limits.lightGroundsMax !== undefined && lightGrounds > limits.lightGroundsMax) add(LayoutIssueCode.Look, 'sections', `${lightGrounds} sections on a light ground — the ${look.id} look allows ${limits.lightGroundsMax}`);
|
|
745
757
|
}
|
|
746
758
|
issues.push(...pageListIssues(page));
|
|
759
|
+
const unshown = shownListIssue(page, ctx);
|
|
760
|
+
if (unshown) issues.push(unshown);
|
|
747
761
|
return { issues: uniqueIssues(issues), tally: { signatures: signatures.length, galleries, swappable, layered, bleeds, screenWords, wordsOnPhoto, holds } };
|
|
748
762
|
}
|
|
749
763
|
|
|
764
|
+
/** The mix a gallery takes when it becomes the page's list (`LayoutMendKind.ShowList`): cards of the list's parts — the
|
|
765
|
+
* picture, the name and (a product) its price — on a grid, rising under the mouse, arriving one by one, swiped on a phone. */
|
|
766
|
+
const SHOWN_LIST_PARTS: ReadonlyArray<string> = ['image', 'title', 'price', 'compareAt'];
|
|
767
|
+
|
|
768
|
+
function shownListMix(shape: LayoutListShape | undefined): LayoutListMix {
|
|
769
|
+
const roles = shape?.roles ?? ['image', 'title'];
|
|
770
|
+
return {
|
|
771
|
+
item: LayoutListItem.Card, parts: SHOWN_LIST_PARTS.filter(r => roles.includes(r)), arrange: LayoutListArrange.Grid,
|
|
772
|
+
move: [], hover: [LayoutListHover.Rise], arrive: LayoutListArrive.OneByOne, phone: LayoutListPhone.Swipe,
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* vectoriox/iox-ui#99: the page where the site shows a list (`ctx.shows` — a shop page's products) shows it in a list
|
|
778
|
+
* section, so every item is reachable from it. Missing: the gallery there that shows fixed pictures or boxes (not held by
|
|
779
|
+
* the scroll, the model's own — never a ready-made place) becomes that list section (`ShowList`); none, the model is
|
|
780
|
+
* asked, and a page that still lacks it is refused by the plan's validator (`productReachIssues`).
|
|
781
|
+
*/
|
|
782
|
+
function shownListIssue(page: LayoutPage, ctx: CheckLayoutContext): LayoutIssue | null {
|
|
783
|
+
const shows = ctx.shows ?? [];
|
|
784
|
+
if (!shows.length) return null;
|
|
785
|
+
const layers = (page.sections ?? []).flatMap((s, si) => (s.layers ?? []).map((l, li) => ({ s, l, path: `sections[${si}].layers[${li}]` })));
|
|
786
|
+
if (layers.some(({ l }) => !!l.gallery?.list && shows.includes(String(l.gallery.source)))) return null;
|
|
787
|
+
const bound = (at: number | undefined) => at !== undefined && shows.includes(String(ctx.sectionBindings?.[at] ?? ''));
|
|
788
|
+
if ((page.sections ?? []).some(s => bound(s.readyMade?.at))) return null;
|
|
789
|
+
const source = shows[0];
|
|
790
|
+
const candidates = layers.filter(({ s, l }) => !s.readyMade && !!l.gallery && l.gallery.source === undefined);
|
|
791
|
+
const pick = candidates.find(({ l }) => !l.gallery!.scroll) ?? candidates[0];
|
|
792
|
+
return {
|
|
793
|
+
code: LayoutIssueCode.Content, path: pick?.path ?? 'sections',
|
|
794
|
+
message: `this is where the site lists "${source}" — a list section shows it (gallery.source "${source}" with a list mix), each item linking to its own page`,
|
|
795
|
+
...(pick ? { mend: { kind: LayoutMendKind.ShowList, layer: pick.path, source, mix: shownListMix(ctx.listShapes?.find(x => x.alias === source)) } } : {}),
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/** A composed page with the list it is where the site shows (`ctx.shows`) in a list section — as it is, or with the
|
|
800
|
+
* gallery the check turns into it (`ShowList`). Null: it cannot show it without the model. What the composer stamps and
|
|
801
|
+
* the plan's validator judges (vectoriox/iox-ui#99). Pure. */
|
|
802
|
+
export function withShownList(page: LayoutPage, ctx: Pick<CheckLayoutContext, 'shows' | 'sectionBindings' | 'listShapes'>): LayoutPage | null {
|
|
803
|
+
const issue = shownListIssue(page, ctx as CheckLayoutContext);
|
|
804
|
+
if (!issue) return page;
|
|
805
|
+
return issue.mend ? mendLayout(page, [issue]).page : null;
|
|
806
|
+
}
|
|
807
|
+
|
|
750
808
|
/** A ready-made section enters when the look's entrance level moves something of its family (a fade alone is not an entrance). */
|
|
751
809
|
function readyMadeEnters(pattern: string, level: string | null | undefined): boolean {
|
|
752
810
|
const family = patternById(pattern)?.family;
|
|
@@ -1019,6 +1077,14 @@ export function mendLayout(page: LayoutPage, issues: ReadonlyArray<LayoutIssue>)
|
|
|
1019
1077
|
if (!layer?.gallery) continue;
|
|
1020
1078
|
layer.gallery.source = mend.source;
|
|
1021
1079
|
mended.push(issue);
|
|
1080
|
+
} else if (mend?.kind === LayoutMendKind.ShowList) {
|
|
1081
|
+
const layer = layerAt(mend.layer);
|
|
1082
|
+
if (!layer?.gallery) continue;
|
|
1083
|
+
layer.gallery.source = mend.source;
|
|
1084
|
+
layer.gallery.list = structuredClone(mend.mix);
|
|
1085
|
+
layer.gallery.slides = [];
|
|
1086
|
+
delete layer.gallery.scroll;
|
|
1087
|
+
mended.push(issue);
|
|
1022
1088
|
} else if (mend?.kind === LayoutMendKind.List) {
|
|
1023
1089
|
const layer = layerAt(mend.layer);
|
|
1024
1090
|
if (!layer?.gallery) continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildCardRecipe, buildMarqueeRecipe, CardLayout, CardPart, CardRole, CompositeNode, CompositeNodeSpec, findByRole, NO_ELEMENT_STYLE, SceneRole,
|
|
3
|
-
SLIDER_PLACEMENT_TRAIT, SliderPlacement, SliderRole, syncSliderParts,
|
|
3
|
+
SLIDER_PLACEMENT_TRAIT, SliderPlacement, SliderRole, syncSliderParts, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget,
|
|
4
4
|
} from '@vectoriox/iox-ui/composite-core';
|
|
5
5
|
|
|
6
6
|
import { ColorScheme, DesignChoices, LinkType, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
@@ -19,6 +19,8 @@ import { layoutGlideDepth } from './layout-drift';
|
|
|
19
19
|
import { isLayoutRule, layoutRuleEdge } from './layout-space';
|
|
20
20
|
import { layoutDesignOf, layoutElementStyle, layoutTextWidthEm, screenWordColumns } from './layout-type';
|
|
21
21
|
import { ComposeError, createSerializedNode, SerializedNode, setStyleProps, assertStyleSlots, walkSerialized } from './serialized-node';
|
|
22
|
+
import { BUTTON_LINK_PROPS, CarryKind, PageCarry } from './carry';
|
|
23
|
+
import { MOTION_TRIGGERS, ownerContentInto } from './carry-fill';
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* THE layout composer (premium components M8, gate 1): a page written in the layout language (`layout-language.ts`) in,
|
|
@@ -102,6 +104,9 @@ export interface ComposeLayoutOptions {
|
|
|
102
104
|
/** List ingredients (LI1): how a list's items are read — the field that plays each role and the item's own page. Null
|
|
103
105
|
* when the alias is no list. A gallery with a `list` mix needs it; without it the gallery is today's. */
|
|
104
106
|
listOf?: (alias: string) => LayoutListBinding | null;
|
|
107
|
+
/** A redesign (site-redesign RD1): the page's carry (`harvestPage`) — a layer or a section naming a handle shows the
|
|
108
|
+
* owner's part in it. A handle the carry does not have is refused (ComposeError); `checkCarry` judges the rest. */
|
|
109
|
+
carry?: PageCarry;
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
/** A list as the list composer reads it (`ComposeLayoutOptions.listOf`). */
|
|
@@ -153,6 +158,9 @@ export interface ComposedLayout {
|
|
|
153
158
|
/** The node id each section's id became (what its links scroll to). */
|
|
154
159
|
sections: Record<string, string>;
|
|
155
160
|
gaps: LayoutGap[];
|
|
161
|
+
/** RD-D20: the carried sections (`bind:`, `block:`, `keep:`) placed as they were arranged — restyled by the new look, their
|
|
162
|
+
* data and structure as they were; Compare lists them. */
|
|
163
|
+
keptArrangement: string[];
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
const COMPOSED = { releaseLayoutDefaults: true } as const;
|
|
@@ -223,8 +231,87 @@ interface Ctx {
|
|
|
223
231
|
/** Every node a section link was written on, with the section id it scrolls to (resolved once all are stamped). */
|
|
224
232
|
links: Array<{ node: SerializedNode; to: string; closes?: string }>;
|
|
225
233
|
headingSeen: boolean;
|
|
234
|
+
carry: ReadonlyMap<string, CarriedPart>;
|
|
235
|
+
keptArrangement: string[];
|
|
226
236
|
}
|
|
227
237
|
|
|
238
|
+
// ── The carry (site-redesign RD1): a layer or a section showing the owner's part ────────────────────────
|
|
239
|
+
|
|
240
|
+
type CarriedPart = PageCarry[keyof PageCarry][number] & { node: SerializedNode };
|
|
241
|
+
|
|
242
|
+
function carryIndex(carry: PageCarry | undefined): Map<string, CarriedPart> {
|
|
243
|
+
const out = new Map<string, CarriedPart>();
|
|
244
|
+
if (!carry) return out;
|
|
245
|
+
for (const part of [...carry.words, ...carry.photos, ...carry.forms, ...carry.bound, ...carry.blocks, ...carry.kept]) out.set(part.handle, part as CarriedPart);
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function carriedPart(ctx: Ctx, handle: string, path: string): CarriedPart {
|
|
250
|
+
const part = ctx.carry.get(handle);
|
|
251
|
+
if (!part) throw new ComposeError(`${path}: carries "${handle}", which the page's carry does not have`);
|
|
252
|
+
return part;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** The node holding a carried part's words: the node itself (a heading, a text) or its first Text (a button, a badge). */
|
|
256
|
+
function wordsNodeOf(node: SerializedNode): SerializedNode | undefined {
|
|
257
|
+
if (node.type === T.Text || node.type === T.Heading) return node;
|
|
258
|
+
for (const child of node.children ?? []) {
|
|
259
|
+
const hit = wordsNodeOf(child);
|
|
260
|
+
if (hit) return hit;
|
|
261
|
+
}
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const firstOfType = (root: SerializedNode, type: string): SerializedNode | undefined => {
|
|
266
|
+
let hit: SerializedNode | undefined;
|
|
267
|
+
walkSerialized([root], node => { if (!hit && node.type === type) hit = node; });
|
|
268
|
+
return hit;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* A layer carrying the owner's word, photo or form (Doron 2026-11-21, "New look, owner's content"): the layer composed as
|
|
273
|
+
* always, the owner's content put in — a text's words, a button's words, link and what it does, a photo's src and alt (a
|
|
274
|
+
* video stands in the photo's place), the form whole (F8). A heading keeps the level the layout's role gives it.
|
|
275
|
+
*/
|
|
276
|
+
function fillCarriedLayer(outer: SerializedNode, part: CarriedPart): void {
|
|
277
|
+
const owner = part.node;
|
|
278
|
+
if ('formId' in part) {
|
|
279
|
+
const frame = outer;
|
|
280
|
+
frame.children = (frame.children ?? []).map(child => (child.type === 'Form' ? structuredClone(owner) : child));
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (outer.type === T.ButtonBlock) {
|
|
284
|
+
if (owner.type === T.ButtonBlock) ownerContentInto(outer, owner);
|
|
285
|
+
else for (const prop of BUTTON_LINK_PROPS) if (prop in owner.props) outer.props[prop] = structuredClone(owner.props[prop]);
|
|
286
|
+
const label = wordsNodeOf(outer);
|
|
287
|
+
const words = owner.type === T.Link ? owner.props['label'] : wordsNodeOf(owner)?.props['content'];
|
|
288
|
+
if (label) label.props['content'] = structuredClone(words ?? '');
|
|
289
|
+
if (owner.type !== T.ButtonBlock) outer.interactions = [...outer.interactions, ...structuredClone(owner.interactions ?? [])];
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if ('src' in part) {
|
|
293
|
+
const image = firstOfType(outer, T.Image);
|
|
294
|
+
if (!image) return;
|
|
295
|
+
if (owner.type === T.Image) return void ownerContentInto(image, owner);
|
|
296
|
+
// A video stands where the photo would: the photo's box, the owner's video.
|
|
297
|
+
const video = structuredClone(owner);
|
|
298
|
+
video.styleProps = { ...image.styleProps };
|
|
299
|
+
video.elementStyle = image.elementStyle;
|
|
300
|
+
const swap = (node: SerializedNode) => {
|
|
301
|
+
node.children = (node.children ?? []).map(c => (c === image ? video : (swap(c), c)));
|
|
302
|
+
};
|
|
303
|
+
swap(outer);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const target = wordsNodeOf(outer) ?? outer;
|
|
307
|
+
const source = owner.type === T.Link ? null : wordsNodeOf(owner);
|
|
308
|
+
if (source && source.type === target.type) ownerContentInto(target, source);
|
|
309
|
+
else target.props['content'] = structuredClone(source?.props['content'] ?? owner.props['label'] ?? '');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** The kind a carried part is: a word or photo kind, or null for a form, a bound part, a block, a kept section. */
|
|
313
|
+
const wordKindOf = (part: CarriedPart): CarryKind | null => ('kind' in part && Object.values(CarryKind).includes(part.kind as CarryKind) ? part.kind as CarryKind : null);
|
|
314
|
+
|
|
228
315
|
function gap(ctx: Ctx, code: LayoutGapCode, path: string, detail: string): void {
|
|
229
316
|
if (!ctx.gaps.some(g => g.code === code && g.path === path)) ctx.gaps.push({ code, path, detail });
|
|
230
317
|
}
|
|
@@ -320,7 +407,8 @@ const ENTER_TYPE: Readonly<Record<string, string>> = {
|
|
|
320
407
|
[LayoutEnter.Pop]: 'scaleIn',
|
|
321
408
|
[LayoutEnter.ClipReveal]: 'clipReveal',
|
|
322
409
|
[LayoutEnter.MaskRise]: 'revealText',
|
|
323
|
-
|
|
410
|
+
// AW3: the keyframe map draws blurIn (a small blur into focus) — it no longer rises without its blur.
|
|
411
|
+
[LayoutEnter.BlurIn]: 'blurIn',
|
|
324
412
|
};
|
|
325
413
|
|
|
326
414
|
/** A time entrance: the round-four renderer's `playEnter` as a `viewportEnter` interaction on the node. */
|
|
@@ -335,10 +423,6 @@ function enterInteraction(nodeId: string, l: LayoutLayer, ctx: Ctx, path: string
|
|
|
335
423
|
const params: Record<string, unknown> = {};
|
|
336
424
|
const rise = LAYOUT_RISE[role] ?? LAYOUT_RISE[LayoutRole.Support];
|
|
337
425
|
if (recipe === LayoutEnter.FadeRise) params['distance'] = rise;
|
|
338
|
-
if (recipe === LayoutEnter.BlurIn) {
|
|
339
|
-
params['distance'] = Math.round(rise / 2);
|
|
340
|
-
gap(ctx, LayoutGapCode.Blur, path, 'blurIn rises without its blur');
|
|
341
|
-
}
|
|
342
426
|
if (recipe === LayoutEnter.ScaleIn || recipe === LayoutEnter.Pop) gap(ctx, LayoutGapCode.ScaleIn, path, `${recipe} starts at 0.8`);
|
|
343
427
|
if (recipe === LayoutEnter.ClipReveal) params['from'] = l.from ?? LayoutSide.Bottom;
|
|
344
428
|
if (recipe === LayoutEnter.MaskRise) {
|
|
@@ -716,6 +800,19 @@ function listCard(id: string, mix: LayoutListMix, source: string, list: LayoutLi
|
|
|
716
800
|
bind(CardRole.Quote, 'content', field('quote'));
|
|
717
801
|
bind(CardRole.Person, 'content', field('person'));
|
|
718
802
|
const heading = bind(CardRole.Title, 'content', title);
|
|
803
|
+
// A product's price (and its earlier price) under its name: the shop's Price recipe — the money pipe kept — bound to
|
|
804
|
+
// the row, as a template's product card has it (vectoriox/iox-ui#99).
|
|
805
|
+
const price = field('price');
|
|
806
|
+
const content = price ? findByRole(card as unknown as CompositeNode, CardRole.Content) as SerializedNode | undefined : undefined;
|
|
807
|
+
if (price && content) {
|
|
808
|
+
const tag = SHOP_RECIPES[ShopRecipe.Price](partFactory(id)) as unknown as SerializedNode;
|
|
809
|
+
bindShopPart(tag as unknown as CompositeNode, ShopBindTarget.Price, source, price);
|
|
810
|
+
if (field('compareAt')) bindShopPart(tag as unknown as CompositeNode, ShopBindTarget.CompareAt, source, field('compareAt')!);
|
|
811
|
+
else tag.children = (tag.children ?? []).filter(c => c.role !== ShopRole.PriceCompare);
|
|
812
|
+
const at = (content.children ?? []).findIndex(c => c.role === CardRole.Title);
|
|
813
|
+
content.children = [...(content.children ?? [])];
|
|
814
|
+
content.children.splice(at >= 0 ? at + 1 : content.children.length, 0, tag);
|
|
815
|
+
}
|
|
719
816
|
// The whole card links (the stretched link, through its title): to the item's own page, else to the address the list
|
|
720
817
|
// keeps for it when the mix shows it. A card that rises or zooms under the mouse and links nowhere is said (D3).
|
|
721
818
|
if (heading && list.detail) linkToDetail(heading, source, list.detail);
|
|
@@ -994,7 +1091,14 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
|
|
|
994
1091
|
let entering: SerializedNode;
|
|
995
1092
|
let textual = false;
|
|
996
1093
|
let image: SerializedNode | null = null;
|
|
997
|
-
|
|
1094
|
+
const part = l.carry ? carriedPart(ctx, l.carry, lc.path) : null;
|
|
1095
|
+
if (part && !wordKindOf(part) && !('formId' in part)) {
|
|
1096
|
+
// A bound part or a block in a gallery, list or marquee place: as it was arranged, placed and restyled (RD-D20).
|
|
1097
|
+
outer = entering = structuredClone(part.node);
|
|
1098
|
+
// How it moves is the new look's: its old entrance and scroll motion go, what it does stays.
|
|
1099
|
+
outer.interactions = (outer.interactions ?? []).filter(ix => !MOTION_TRIGGERS.has(String((ix as { trigger?: unknown })?.trigger ?? '')));
|
|
1100
|
+
ctx.keptArrangement.push(part.handle);
|
|
1101
|
+
} else switch (l.kind) {
|
|
998
1102
|
case LayoutLayerKind.Photo: {
|
|
999
1103
|
const made = photoLayer(id, l, ctx, lc.path);
|
|
1000
1104
|
outer = entering = made.frame;
|
|
@@ -1002,7 +1106,8 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
|
|
|
1002
1106
|
break;
|
|
1003
1107
|
}
|
|
1004
1108
|
case LayoutLayerKind.Gallery: outer = entering = galleryLayer(id, l, lc, ctx); break;
|
|
1005
|
-
|
|
1109
|
+
// A carried button does what the owner's did: the layer's own `to` does not apply.
|
|
1110
|
+
case LayoutLayerKind.Button: outer = entering = buttonLayer(id, part ? { ...l, to: undefined } : l, ctx); break;
|
|
1006
1111
|
case LayoutLayerKind.List: outer = entering = listLayer(id, l, ctx); break;
|
|
1007
1112
|
case LayoutLayerKind.Form: outer = entering = formLayer(id, l, lc, ctx, lc.path); break;
|
|
1008
1113
|
case LayoutLayerKind.Marquee: outer = entering = marqueeLayer(id, l); break;
|
|
@@ -1011,6 +1116,7 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
|
|
|
1011
1116
|
outer = entering = textLayer(id, l, lc, ctx);
|
|
1012
1117
|
textual = true;
|
|
1013
1118
|
}
|
|
1119
|
+
if (part && (wordKindOf(part) || 'formId' in part)) fillCarriedLayer(outer, part);
|
|
1014
1120
|
outer.label = `${lc.section.id} · ${l.kind}${l.role ? ` (${l.role})` : ''}`;
|
|
1015
1121
|
place(outer, l, lc, ctx);
|
|
1016
1122
|
// A rule is a line against the words it belongs to, never its row's full height (the bar's grey boxes, M8 demo).
|
|
@@ -1057,29 +1163,30 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
|
|
|
1057
1163
|
|
|
1058
1164
|
// ── Sections ────────────────────────────────────────────────────────────────────────────────────────────
|
|
1059
1165
|
|
|
1060
|
-
|
|
1166
|
+
/**
|
|
1167
|
+
* A section arriving on another ground (iox-ui#102): its BODY — the ground and every layer on it — opens by the
|
|
1168
|
+
* transition's clip, over the previous ground the section paints behind it. The words open with their ground, so none
|
|
1169
|
+
* ever stands outside it (a flood used to grow a ground veil under words laid out at full width: cream words on the
|
|
1170
|
+
* cream page while it was inset). Null when nothing changes ground (a cut, the first section, a photo ground, the same
|
|
1171
|
+
* ground).
|
|
1172
|
+
*/
|
|
1173
|
+
function transitionOf(s: LayoutSection, prev: string | null, ctx: Ctx, si: number): { under: string; clip: Record<string, unknown> } | null {
|
|
1061
1174
|
const kind = s.transition ?? LayoutTransition.Cut;
|
|
1062
1175
|
const ground = String(s.ground ?? LayoutColour.Ground);
|
|
1063
|
-
if (kind === LayoutTransition.Cut || !prev || ground.startsWith('photo:') || prev === ground) return
|
|
1064
|
-
const box = { position: 'absolute', top: ZERO, left: ZERO, width: FULL, height: 'min(100%, 100svh)', zIndex: '0', minHeight: ZERO };
|
|
1065
|
-
const under = create(`${ctx.p}-s${si}-under`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1066
|
-
setStyleProps(under, { ...box, backgroundColor: veilPaint(prev) });
|
|
1067
|
-
const veil = create(`${ctx.p}-s${si}-veil`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1068
|
-
setStyleProps(veil, { ...box, backgroundColor: veilPaint(ground) });
|
|
1069
|
-
for (const n of [under, veil]) {
|
|
1070
|
-
n.label = `${s.id} · ${kind}`;
|
|
1071
|
-
phone(n, { display: 'none' });
|
|
1072
|
-
}
|
|
1176
|
+
if (kind === LayoutTransition.Cut || !prev || ground.startsWith('photo:') || prev === ground) return null;
|
|
1073
1177
|
const from: Readonly<Record<string, string>> = {
|
|
1074
1178
|
[LayoutTransition.Flood]: 'centre', [LayoutTransition.WipeUp]: LayoutSide.Bottom, [LayoutTransition.WipeDown]: LayoutSide.Top,
|
|
1075
1179
|
[LayoutTransition.WipeStart]: LayoutSide.Start, [LayoutTransition.WipeEnd]: LayoutSide.End,
|
|
1076
1180
|
};
|
|
1077
1181
|
if (kind === LayoutTransition.Flood) gap(ctx, LayoutGapCode.Flood, `sections[${si}]`, 'the flood opens from the centre as an inset');
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1182
|
+
return {
|
|
1183
|
+
under: veilPaint(prev),
|
|
1184
|
+
clip: {
|
|
1185
|
+
id: `${ctx.p}-s${si}-arrive`, trigger: 'scrollProgress', range: 'enter',
|
|
1186
|
+
// Never on a phone: there the ground changes at the section's edge (a stack runs far taller than its screen).
|
|
1187
|
+
actions: [{ type: 'clipReveal', target: 'self', duration: 1000, delay: 0, easing: 'linear', params: { from: from[kind] ?? LayoutSide.Bottom, phone: LAYOUT_DEPTH_ON_PHONE } }],
|
|
1188
|
+
},
|
|
1189
|
+
};
|
|
1083
1190
|
}
|
|
1084
1191
|
|
|
1085
1192
|
function groundPhoto(s: LayoutSection, si: number, ctx: Ctx): SerializedNode | null {
|
|
@@ -1126,8 +1233,23 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1126
1233
|
position: 'relative', width: FULL, minHeight: ZERO, height: `${s.screens * 100}svh`, backgroundColor: paint, color: 'var(--iox-text)', margin: ZERO,
|
|
1127
1234
|
...(ctx.rtl ? { textDirection: 'rtl' } : {}),
|
|
1128
1235
|
};
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1236
|
+
const photo = groundPhoto(s, si, ctx);
|
|
1237
|
+
const behind = photo ? [photo] : [];
|
|
1238
|
+
const transition = transitionOf(s, prevGround, ctx, si);
|
|
1239
|
+
|
|
1240
|
+
if (!held && transition) {
|
|
1241
|
+
// The previous ground behind; the section's own ground and layers in its body, opened together.
|
|
1242
|
+
setStyleProps(root, { ...base, backgroundColor: transition.under, display: 'block', padding: ZERO, overflow: 'clip' });
|
|
1243
|
+
phone(root, { height: 'auto', backgroundColor: veilPaint(ground) });
|
|
1244
|
+
const body = create(`${id}-body`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1245
|
+
body.label = `${s.id} · ${s.transition}`;
|
|
1246
|
+
setStyleProps(body, { position: 'relative', width: FULL, height: FULL, minHeight: ZERO, backgroundColor: veilPaint(ground), ...gridLayout(s.rows, 1) });
|
|
1247
|
+
phone(body, phoneStack(si === 0));
|
|
1248
|
+
body.interactions = [transition.clip];
|
|
1249
|
+
body.children = layers;
|
|
1250
|
+
root.children = [...behind, body];
|
|
1251
|
+
return root;
|
|
1252
|
+
}
|
|
1131
1253
|
if (!held) {
|
|
1132
1254
|
setStyleProps(root, { ...base, ...gridLayout(s.rows, 1), overflow: 'clip' });
|
|
1133
1255
|
phone(root, phoneStack(si === 0));
|
|
@@ -1139,7 +1261,7 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1139
1261
|
// phone it stacks (M8-D5): the stage steps out of the layout (`contents`), because its size containment would give a
|
|
1140
1262
|
// stage that flows no height at all, and its layers stand in the section's stack.
|
|
1141
1263
|
root.role = SceneRole.Scene;
|
|
1142
|
-
setStyleProps(root, { ...base, display: 'block', padding: ZERO });
|
|
1264
|
+
setStyleProps(root, { ...base, display: 'block', padding: ZERO, ...(transition ? { backgroundColor: transition.under } : {}) });
|
|
1143
1265
|
const stage = create(`${id}-stage`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1144
1266
|
stage.role = SceneRole.Stage;
|
|
1145
1267
|
stage.label = `${s.id} · stage`;
|
|
@@ -1162,6 +1284,13 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1162
1284
|
wide.children = layers;
|
|
1163
1285
|
stage.children = [wide];
|
|
1164
1286
|
}
|
|
1287
|
+
if (transition) {
|
|
1288
|
+
// A held section arriving on another ground: the stage — the screen that holds, with every layer on it — opens by
|
|
1289
|
+
// the transition over the previous ground (iox-ui#102), as a body does.
|
|
1290
|
+
setStyleProps(stage, { backgroundColor: veilPaint(ground) });
|
|
1291
|
+
phone(root, { backgroundColor: veilPaint(ground) });
|
|
1292
|
+
stage.interactions = [...stage.interactions, transition.clip];
|
|
1293
|
+
}
|
|
1165
1294
|
root.children = [...behind, stage];
|
|
1166
1295
|
return root;
|
|
1167
1296
|
}
|
|
@@ -1280,6 +1409,25 @@ function dressReadyMade(root: SerializedNode, ground: string | null, column: num
|
|
|
1280
1409
|
root.children = [bandColours(`${root.id}-band`, scheme, root.children)];
|
|
1281
1410
|
}
|
|
1282
1411
|
|
|
1412
|
+
/**
|
|
1413
|
+
* RD-D20 (Doron, 2026-11-21: "the idea is style change structure being updated but the data and data relations
|
|
1414
|
+
* remains"): a section place carrying a bound part, a block or a kept section. Its data plane is untouched — every
|
|
1415
|
+
* source, binding path, relation, form id and item as it was; it wears the new look through its element styles, its
|
|
1416
|
+
* scheme and the tokens, and paints the ground it follows as a ready-made section does. Its arrangement is kept (no
|
|
1417
|
+
* recipe recomposes it yet) and Compare lists it (`keptArrangement`).
|
|
1418
|
+
*/
|
|
1419
|
+
function carriedSection(s: LayoutSection, si: number, ctx: Ctx): SerializedNode {
|
|
1420
|
+
const part = carriedPart(ctx, s.carry!, `sections[${si}].carry`);
|
|
1421
|
+
ctx.keptArrangement.push(part.handle);
|
|
1422
|
+
const node = structuredClone(part.node);
|
|
1423
|
+
if (node.type === T.Section) return node;
|
|
1424
|
+
const root = create(`${ctx.p}-s${si}`, T.Section, {}, NO_ELEMENT_STYLE);
|
|
1425
|
+
root.label = s.id;
|
|
1426
|
+
setStyleProps(root, { padding: PATTERN_SECTION_PAD, margin: ZERO, ...(ctx.rtl ? { textDirection: 'rtl' } : {}) });
|
|
1427
|
+
root.children = [node];
|
|
1428
|
+
return root;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1283
1431
|
/**
|
|
1284
1432
|
* A layout-language page → its layout and header. Deterministic: the same layout composes to byte-identical nodes.
|
|
1285
1433
|
* Refuses (ComposeError) a link to a section the layout does not have; everything the product cannot say comes back in
|
|
@@ -1305,9 +1453,20 @@ export function composeLayout(site: LayoutSite, options: ComposeLayoutOptions):
|
|
|
1305
1453
|
listOf: options.listOf ?? (() => null),
|
|
1306
1454
|
links: [],
|
|
1307
1455
|
headingSeen: false,
|
|
1456
|
+
carry: carryIndex(options.carry),
|
|
1457
|
+
keptArrangement: [],
|
|
1308
1458
|
};
|
|
1309
1459
|
let prev: string | null = null;
|
|
1310
1460
|
const layout = site.sections.map((s, si) => {
|
|
1461
|
+
if (s.carry) {
|
|
1462
|
+
const node = carriedSection(s, si, ctx);
|
|
1463
|
+
const neighbour = readyMadeNeighbour(site.sections, si);
|
|
1464
|
+
const ground = neighbour ? groundOf(neighbour) : null;
|
|
1465
|
+
dressReadyMade(node, ground, readyMadeColumn(neighbour));
|
|
1466
|
+
ctx.sections[s.id] = node.id;
|
|
1467
|
+
prev = paintsItsOwnGround(node) || ground === null ? LayoutColour.Ground : ground;
|
|
1468
|
+
return node;
|
|
1469
|
+
}
|
|
1311
1470
|
if (s.readyMade) {
|
|
1312
1471
|
if (!options.readyMade) throw new ComposeError(`sections[${si}]: a ready-made place needs its plan section stamped (options.readyMade)`);
|
|
1313
1472
|
const node = options.readyMade(s, `${ctx.p}-s${si}`);
|
|
@@ -1325,5 +1484,5 @@ export function composeLayout(site: LayoutSite, options: ComposeLayoutOptions):
|
|
|
1325
1484
|
const header = composeHeader(ctx);
|
|
1326
1485
|
if (ctx.links.some(l => !l.closes) && !site.nav?.links?.length) gap(ctx, LayoutGapCode.SectionLink, 'buttons', 'a button to a section scrolls by an action');
|
|
1327
1486
|
wireLinks(ctx);
|
|
1328
|
-
return { layout, header, sections: ctx.sections, gaps: ctx.gaps };
|
|
1487
|
+
return { layout, header, sections: ctx.sections, gaps: ctx.gaps, keptArrangement: ctx.keptArrangement };
|
|
1329
1488
|
}
|