@vectoriox/iox-ui 5.151.1 → 5.153.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/assist-core/index.d.ts +200 -5
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +273 -15
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +149 -7
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/generation-core/index.d.ts +69 -6
- package/package.json +1 -1
- package/src/assist-core/media-generate.ts +325 -0
- package/src/assist-core/public-api.ts +1 -0
- package/src/assist-core/site-look.ts +12 -4
- package/src/assist-core/surfaces.ts +3 -0
- package/src/generation-core/adjustments.ts +25 -2
- package/src/generation-core/fallback-memory.ts +142 -0
- package/src/generation-core/public-api.ts +1 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { COLUMN_IDS, COLUMN_SETTING, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* `ADJUSTMENTS` — the size and spacing STEPS an element may take by asking (ai-session-panel-plan `adjust`, ai-assist-plan
|
|
3
5
|
* AI2c). "Make the hero taller" is a row of this table, never a number: the model picks an axis and a step, this file is
|
|
@@ -7,6 +9,9 @@
|
|
|
7
9
|
* the server's check and in the builder's trial.
|
|
8
10
|
*
|
|
9
11
|
* Every value is a desktop-first BASE value: a width the author (or the composer) set on its own keeps its own value.
|
|
12
|
+
*
|
|
13
|
+
* Award §0c CW4: the ONE page-level axis, Width, writes the PAGE's settings (`pageSettings.column`, design-core
|
|
14
|
+
* `COLUMN_SETTING`) — never a node's max-width. A page with no word of its own follows the look's ({@link ADJUST_LOOK}).
|
|
10
15
|
*/
|
|
11
16
|
|
|
12
17
|
/** What a step changes. */
|
|
@@ -17,6 +22,8 @@ export enum AdjustAxis {
|
|
|
17
22
|
Spacing = 'spacing',
|
|
18
23
|
/** Where words sit on their line: start · centre · end (logical — follows the page's direction). */
|
|
19
24
|
Align = 'align',
|
|
25
|
+
/** How wide the page's content column is: wide · contained · narrow (award §0c, AW-D33) — the PAGE's word. */
|
|
26
|
+
Width = 'width',
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
/** Which kind of element an axis acts on — a section's spacing is its rhythm, a card's is its padding. */
|
|
@@ -24,11 +31,16 @@ export enum AdjustKind {
|
|
|
24
31
|
Section = 'section',
|
|
25
32
|
Box = 'box',
|
|
26
33
|
Words = 'words',
|
|
34
|
+
/** The page itself — its row writes `pageSettings`, never a node's `styleProps`. */
|
|
35
|
+
Page = 'page',
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
/** What a node holds when its value is none of the steps — the author's (or the composer's) own. */
|
|
30
39
|
export const ADJUST_OWN = 'own';
|
|
31
40
|
|
|
41
|
+
/** What a page holds when it stores no width of its own — it wears the look's (the site's) word. */
|
|
42
|
+
export const ADJUST_LOOK = 'look';
|
|
43
|
+
|
|
32
44
|
export interface AdjustStep {
|
|
33
45
|
readonly id: string;
|
|
34
46
|
/** How the owner reads it on a change card. */
|
|
@@ -52,12 +64,15 @@ export const ADJUST_STEPS: Readonly<Record<AdjustAxis, ReadonlyArray<AdjustStep>
|
|
|
52
64
|
{ id: 'center', label: 'Centre' },
|
|
53
65
|
{ id: 'end', label: 'End' },
|
|
54
66
|
],
|
|
67
|
+
// The contract's three words, narrowest last, labelled as Design ▸ Shape says them.
|
|
68
|
+
[AdjustAxis.Width]: COLUMN_IDS.map(id => ({ id, label: SPEC_AXES.columns[id].label })),
|
|
55
69
|
};
|
|
56
70
|
|
|
57
71
|
export const ADJUST_AXIS_LABELS: Readonly<Record<AdjustAxis, string>> = {
|
|
58
72
|
[AdjustAxis.Height]: 'Height',
|
|
59
73
|
[AdjustAxis.Spacing]: 'Spacing',
|
|
60
74
|
[AdjustAxis.Align]: 'Alignment',
|
|
75
|
+
[AdjustAxis.Width]: 'Content width',
|
|
61
76
|
};
|
|
62
77
|
|
|
63
78
|
const SECTION_SPACE = 'var(--iox-space-section)';
|
|
@@ -98,6 +113,9 @@ export const ADJUSTMENTS: Readonly<Record<AdjustAxis, Partial<Record<AdjustKind,
|
|
|
98
113
|
end: { textAlign: 'end' },
|
|
99
114
|
},
|
|
100
115
|
},
|
|
116
|
+
[AdjustAxis.Width]: {
|
|
117
|
+
[AdjustKind.Page]: Object.fromEntries(COLUMN_IDS.map(id => [id, { [COLUMN_SETTING]: id }])),
|
|
118
|
+
},
|
|
101
119
|
};
|
|
102
120
|
|
|
103
121
|
/** Split a CSS value on its top-level spaces (a `calc(a * b)` stays one part). */
|
|
@@ -157,11 +175,15 @@ export function adjustStyleProps(
|
|
|
157
175
|
return { ...row };
|
|
158
176
|
}
|
|
159
177
|
|
|
160
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* The step a node's current values are, or {@link ADJUST_OWN} when they are none of the rows. For the page (`Width` ·
|
|
180
|
+
* `Page`, read from its `pageSettings`): its own word, or {@link ADJUST_LOOK} when it stores none.
|
|
181
|
+
*/
|
|
161
182
|
export function adjustStepOf(axis: AdjustAxis, kind: AdjustKind, styleProps: Readonly<Record<string, unknown>> = {}): string {
|
|
162
183
|
const rows = ADJUSTMENTS[axis][kind];
|
|
163
184
|
if (!rows) return ADJUST_OWN;
|
|
164
185
|
const value = (name: string): string => String(styleProps[name] ?? '').trim();
|
|
186
|
+
if (kind === AdjustKind.Page && !value(COLUMN_SETTING)) return ADJUST_LOOK;
|
|
165
187
|
for (const { id } of ADJUST_STEPS[axis]) {
|
|
166
188
|
const row = rows[id];
|
|
167
189
|
if (!row) continue;
|
|
@@ -176,9 +198,10 @@ export function adjustStepOf(axis: AdjustAxis, kind: AdjustKind, styleProps: Rea
|
|
|
176
198
|
return ADJUST_OWN;
|
|
177
199
|
}
|
|
178
200
|
|
|
179
|
-
/** How the owner reads a step id ("own" → "As set"). */
|
|
201
|
+
/** How the owner reads a step id ("own" → "As set", "look" → "From the look"). */
|
|
180
202
|
export function adjustStepLabel(axis: AdjustAxis, step: string): string {
|
|
181
203
|
if (step === ADJUST_OWN) return 'As set';
|
|
204
|
+
if (step === ADJUST_LOOK) return 'From the look';
|
|
182
205
|
return ADJUST_STEPS[axis].find(s => s.id === step)?.label ?? step;
|
|
183
206
|
}
|
|
184
207
|
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { LayoutPage, LayoutSection, LayoutSectionKind } from './layout-language';
|
|
2
|
+
import { FingerprintedPage, fingerprintOf, LAYOUT_READY_MADE_TOKEN, LayoutFingerprint } from './layout-fingerprint';
|
|
3
|
+
import { footerMixOfPlan } from './footer-mix';
|
|
4
|
+
import { wornHeaderOfPlan } from './header-mix';
|
|
5
|
+
import { PatternNode, patternById, patternNeedsBinding, patternNodes, SITE_LIBRARY, SitePattern } from './patterns';
|
|
6
|
+
import { PagePlan, PageSectionPlan } from './site-plan.model';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A PAGE BUILT FROM ITS SECTIONS IN THE STUDIO'S MEMORY (vectoriox/iox-ui#119, option C — Doron, 2026-11-23). A composed
|
|
10
|
+
* page that falls back whole is stamped from the plan's ready-made sections, and four of six J10 Homes did — two hero
|
|
11
|
+
* patterns between them, so six businesses wore two skeletons while the memory held none of them (only a model's layout
|
|
12
|
+
* was fingerprinted). Here a fallen page is fingerprinted too, by the sections it is built from, and before it is built
|
|
13
|
+
* its opening is moved away from the ready-made openings the studio's other sites already wear, when another hero of the
|
|
14
|
+
* library can carry every word the plan wrote for it. The closed layout language only: free sections get no sameness
|
|
15
|
+
* gate (Doron). Pure.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** A ready-made section's token in a fallen page's sequence: `ready-made:<pattern>`. A composed page's swapped section stays
|
|
19
|
+
* `ready-made` (its place in the model's order); a whole page of them is told apart by which sections they are. */
|
|
20
|
+
export function readyMadeToken(pattern: string): string {
|
|
21
|
+
return `${LAYOUT_READY_MADE_TOKEN}:${pattern}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The sections as the fingerprint reads them: a ready-made stub per place (as `fallBackBySection` writes one). */
|
|
25
|
+
function readyMadePage(sections: ReadonlyArray<Pick<PageSectionPlan, 'pattern'>>): LayoutPage {
|
|
26
|
+
return {
|
|
27
|
+
sections: sections.map((s, at): LayoutSection => ({
|
|
28
|
+
id: `ready-made-${at}`, kind: LayoutSectionKind.Content, screens: 1, rows: 1, layers: [], phone: [], readyMade: { at, pattern: s.pattern },
|
|
29
|
+
})),
|
|
30
|
+
} as LayoutPage;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A page built from its sections, as the studio remembers it: it opens on its first section's pattern
|
|
35
|
+
* (`ready-made:hero.split`), its sequence is its patterns in order, its signature holds the screen (a ready-made page has
|
|
36
|
+
* no signature section). The rest — ground, preset, header, footer — as `fingerprintOf`.
|
|
37
|
+
*/
|
|
38
|
+
export function fallbackFingerprintOf(sections: ReadonlyArray<Pick<PageSectionPlan, 'pattern'>>, preset: string, mode: 'light' | 'dark', plan?: Parameters<typeof wornHeaderOfPlan>[0] & Parameters<typeof footerMixOfPlan>[0]): LayoutFingerprint {
|
|
39
|
+
const base = fingerprintOf(readyMadePage(sections), preset, mode, plan ? wornHeaderOfPlan(plan).mix : undefined, plan ? footerMixOfPlan(plan) : undefined);
|
|
40
|
+
return { ...base, sequence: sections.map(s => readyMadeToken(s.pattern)) };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A plan page built from its sections (it fell back whole, or was never asked) — the ONE call a reader of a plan makes. */
|
|
44
|
+
export function fallbackFingerprintOfPlanPage(page: Pick<PagePlan, 'sections'>, preset: string, mode: 'light' | 'dark', plan: Parameters<typeof wornHeaderOfPlan>[0] & Parameters<typeof footerMixOfPlan>[0]): LayoutFingerprint {
|
|
45
|
+
return fallbackFingerprintOf(page.sections, preset, mode, plan);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** What a slot is, by the element style its node wears (`display`, `lead`, `button-primary`…), else its type. */
|
|
49
|
+
interface SlotKind {
|
|
50
|
+
slot: string;
|
|
51
|
+
kind: string;
|
|
52
|
+
/** It reads well left empty: it takes the business's own value, or it shows its own words and links nowhere. */
|
|
53
|
+
fillsItself: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function slotKinds(pattern: SitePattern): SlotKind[] {
|
|
57
|
+
const out = new Map<string, SlotKind>();
|
|
58
|
+
for (const n of patternNodes(pattern)) {
|
|
59
|
+
if (!n.slot || out.has(n.slot)) continue;
|
|
60
|
+
out.set(n.slot, { slot: n.slot, kind: n.es ?? n.t, fillsItself: fillsItself(n) });
|
|
61
|
+
}
|
|
62
|
+
return [...out.values()];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const fillsItself = (n: PatternNode): boolean => !!n.fromBusiness || (n.ph === undefined && n.href === undefined && n.text !== undefined);
|
|
66
|
+
|
|
67
|
+
const filled = (value: string | undefined): boolean => typeof value === 'string' && value.trim() !== '';
|
|
68
|
+
|
|
69
|
+
/** May the pattern stand in for another at a fallen page's opening — a plain section of the same family. */
|
|
70
|
+
function mayStandIn(id: string, family: string): boolean {
|
|
71
|
+
const p = patternById(id);
|
|
72
|
+
return !!p && p.family === family && !p.scene && !p.film && !p.shop && !p.global && !patternNeedsBinding(p);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The plan section moved onto `to`, every word and link it holds carried to `to`'s slot of the same kind — or null when
|
|
77
|
+
* one of them has nowhere to go, `to` would show a placeholder or a link to nowhere where the section said nothing, or the
|
|
78
|
+
* section holds what only its own pattern knows (a list, a form, parts left out).
|
|
79
|
+
*/
|
|
80
|
+
export function carrySection(section: PageSectionPlan, to: string): PageSectionPlan | null {
|
|
81
|
+
const from = patternById(section.pattern);
|
|
82
|
+
const target = patternById(to);
|
|
83
|
+
if (!from || !target || section.binding || section.form || section.without?.length) return null;
|
|
84
|
+
const theirs = slotKinds(target);
|
|
85
|
+
const taken = new Set<string>();
|
|
86
|
+
const slots: Record<string, string> = {};
|
|
87
|
+
const links: Record<string, string> = {};
|
|
88
|
+
for (const mine of slotKinds(from)) {
|
|
89
|
+
const value = section.slots?.[mine.slot];
|
|
90
|
+
if (!filled(value)) continue;
|
|
91
|
+
const home = theirs.find(t => t.kind === mine.kind && !taken.has(t.slot));
|
|
92
|
+
if (!home) return null;
|
|
93
|
+
taken.add(home.slot);
|
|
94
|
+
slots[home.slot] = value!;
|
|
95
|
+
const link = section.links?.[mine.slot];
|
|
96
|
+
if (link) links[home.slot] = link;
|
|
97
|
+
}
|
|
98
|
+
if (theirs.some(t => !taken.has(t.slot) && !t.fillsItself)) return null;
|
|
99
|
+
return {
|
|
100
|
+
pattern: to,
|
|
101
|
+
...(Object.keys(slots).length ? { slots } : {}),
|
|
102
|
+
...(Object.keys(links).length ? { links } : {}),
|
|
103
|
+
...(section.enter ? { enter: section.enter } : {}),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Why a fallen page's opening stayed as the plan wrote it. */
|
|
108
|
+
export enum FallbackOpeningKept {
|
|
109
|
+
/** No other site of the studio opens on it. */
|
|
110
|
+
Free = 'free',
|
|
111
|
+
/** Every hero that could carry the plan's words is already worn as another site's opening (or none can carry them). */
|
|
112
|
+
NoneFree = 'none-free',
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface DistinctFallback {
|
|
116
|
+
sections: PageSectionPlan[];
|
|
117
|
+
/** Set when the opening moved: the pattern the plan wrote and the one it is built from now. */
|
|
118
|
+
moved?: { from: string; to: string };
|
|
119
|
+
/** Set when it did not move. */
|
|
120
|
+
kept?: `${FallbackOpeningKept}`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A page about to be built from its sections, opened away from what the studio's other sites open on (option C). Only the
|
|
125
|
+
* opening moves — the first screen is what makes two sites read as one — and only to a library pattern of the same family
|
|
126
|
+
* that carries every word and link the plan wrote (`carrySection`), in the library's order. This site's own pages
|
|
127
|
+
* (`sameSite`) and the demos are never a reason: every page of a site may open alike, and a demo is not a site.
|
|
128
|
+
*/
|
|
129
|
+
export function distinctFallbackSections(sections: ReadonlyArray<PageSectionPlan>, others: ReadonlyArray<FingerprintedPage>): DistinctFallback {
|
|
130
|
+
const all = [...sections];
|
|
131
|
+
const first = all[0];
|
|
132
|
+
const worn = new Set(others.filter(o => !o.sameSite && !o.demo).map(o => o.fingerprint.opening));
|
|
133
|
+
if (!first || !worn.has(readyMadeToken(first.pattern))) return { sections: all, kept: FallbackOpeningKept.Free };
|
|
134
|
+
const family = patternById(first.pattern)?.family;
|
|
135
|
+
if (!family) return { sections: all, kept: FallbackOpeningKept.NoneFree };
|
|
136
|
+
for (const { id } of SITE_LIBRARY) {
|
|
137
|
+
if (id === first.pattern || worn.has(readyMadeToken(id)) || !mayStandIn(id, family)) continue;
|
|
138
|
+
const moved = carrySection(first, id);
|
|
139
|
+
if (moved) return { sections: [moved, ...all.slice(1)], moved: { from: first.pattern, to: id } };
|
|
140
|
+
}
|
|
141
|
+
return { sections: all, kept: FallbackOpeningKept.NoneFree };
|
|
142
|
+
}
|
|
@@ -70,6 +70,7 @@ export * from './layout-space';
|
|
|
70
70
|
export * from './list-space';
|
|
71
71
|
export * from './list-panel';
|
|
72
72
|
export * from './layout-fingerprint';
|
|
73
|
+
export * from './fallback-memory';
|
|
73
74
|
export * from './header-mix';
|
|
74
75
|
export * from './header-edit';
|
|
75
76
|
export * from './opening-mix';
|