@vectoriox/iox-ui 5.157.0 → 5.159.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/design-core/index.d.ts +18 -2
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +41 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +3292 -2477
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +5 -33
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +616 -414
- package/package.json +1 -1
- package/src/design-core/css-functions.ts +48 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/generation-core/check-free.ts +31 -5
- package/src/generation-core/check-layout.ts +123 -14
- package/src/generation-core/compose-free.ts +205 -0
- package/src/generation-core/compose-layout.ts +3 -1
- package/src/generation-core/compose-site.ts +74 -9
- package/src/generation-core/free-fallback.ts +11 -3
- package/src/generation-core/free-slots.ts +125 -0
- package/src/generation-core/free-wire.ts +5 -0
- package/src/generation-core/layout-fingerprint.ts +28 -3
- package/src/generation-core/layout-language.ts +11 -2
- package/src/generation-core/layout-section-fallback.ts +38 -1
- package/src/generation-core/opening-edit.ts +2 -0
- package/src/generation-core/opening-mix.ts +39 -8
- package/src/generation-core/plan-wire.ts +5 -0
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/site-plan.model.ts +12 -0
- package/src/generation-core/site-spec.generated.ts +58 -7
- package/src/generation-core/type-led.ts +31 -9
- package/src/generation-core/validate-site-plan.ts +124 -0
|
@@ -50,6 +50,8 @@ import { MenuSide, NavRole, NavShape, planNavShape } from './nav-shape';
|
|
|
50
50
|
import { composeLayout, LayoutColourMode, layoutBandScheme, LayoutListBinding } from './compose-layout';
|
|
51
51
|
import { LayoutGalleryList, LayoutListShape, LayoutPage, LayoutPhotoShape, LayoutPhotoSource, LayoutSite, parseLayoutPhotoId } from './layout-language';
|
|
52
52
|
import { layoutMotionOf, layoutPresetOf } from './layout-look';
|
|
53
|
+
import { ComposeFreeOptions, composeFreePage, composeFreeSection } from './compose-free';
|
|
54
|
+
import { FreePage } from './free-wire';
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
57
|
* THE composer — a Site Plan in, ordinary IOX data out (design-system plan §6b, W1). Deterministic and
|
|
@@ -1690,16 +1692,62 @@ function composeLayoutPage(
|
|
|
1690
1692
|
const image = type && pictureless.has(type.name) ? undefined : roleField(type, 'image');
|
|
1691
1693
|
return image ? { image, ...(roleField(type, 'title') ? { title: roleField(type, 'title')! } : {}) } : null;
|
|
1692
1694
|
},
|
|
1693
|
-
listOf: alias =>
|
|
1694
|
-
const binding = layoutListBinding(alias, plan);
|
|
1695
|
-
const type = contentTypeOfSource(alias, plan);
|
|
1696
|
-
// #129: a list whose items have no picture is read as a list without one (its cards draw no picture part).
|
|
1697
|
-
if (!binding || !type || !pictureless.has(type.name) || !binding.roles[ContentRole.Image]) return binding;
|
|
1698
|
-
const { [ContentRole.Image]: _none, ...roles } = binding.roles;
|
|
1699
|
-
return { ...binding, roles };
|
|
1700
|
-
},
|
|
1695
|
+
listOf: alias => pageListOf(alias, plan, pictureless),
|
|
1701
1696
|
...(context.carry?.[page.key] ? { carry: context.carry[page.key] } : {}),
|
|
1702
1697
|
});
|
|
1698
|
+
fillPageFacts(nodes, page, plan, placeholders);
|
|
1699
|
+
return nodes;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
/** How a model-laid page reads one list (`layoutListBinding`) — #129: a list whose items have no picture is read as a list
|
|
1703
|
+
* without one (its cards draw no picture part). */
|
|
1704
|
+
function pageListOf(alias: string, plan: SitePlan, pictureless: ReadonlySet<string>): LayoutListBinding | null {
|
|
1705
|
+
const binding = layoutListBinding(alias, plan);
|
|
1706
|
+
const type = contentTypeOfSource(alias, plan);
|
|
1707
|
+
if (!binding || !type || !pictureless.has(type.name) || !binding.roles[ContentRole.Image]) return binding;
|
|
1708
|
+
const { [ContentRole.Image]: _none, ...roles } = binding.roles;
|
|
1709
|
+
return { ...binding, roles };
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/**
|
|
1713
|
+
* FS3: a free page — the model's own nodes, stamped by `composeFreePage` in the look's pace — with the site's facts
|
|
1714
|
+
* written in as on a composed page; a section the fall back gave back is the plan's ready-made one.
|
|
1715
|
+
*/
|
|
1716
|
+
function composeFreePlanPage(
|
|
1717
|
+
page: PagePlan, free: FreePage, plan: SitePlan, context: ComposeContext, placeholders: ComposedPlaceholder[], pictureless: ReadonlySet<string>,
|
|
1718
|
+
readyMade: (section: PageSectionPlan, id: string, at: number) => SerializedNode,
|
|
1719
|
+
): SerializedNode[] {
|
|
1720
|
+
const nodes = composeFreePage(free, freeOptionsOf(page, plan, context, pictureless, readyMade));
|
|
1721
|
+
fillPageFacts(nodes, page, plan, placeholders);
|
|
1722
|
+
return nodes;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/** What the free stamp reads of the site: its language, the look's pace, the owner's pictures, the plan's lists. */
|
|
1726
|
+
function freeOptionsOf(
|
|
1727
|
+
page: PagePlan, plan: SitePlan, context: ComposeContext, pictureless: ReadonlySet<string>,
|
|
1728
|
+
readyMade?: (section: PageSectionPlan, id: string, at: number) => SerializedNode,
|
|
1729
|
+
): ComposeFreeOptions {
|
|
1730
|
+
const locale = plan.locale ?? DEFAULT_SITE_LOCALE;
|
|
1731
|
+
return {
|
|
1732
|
+
owner: page.key, locale, rtl: isRtlLocale(locale), motion: layoutMotionOf(layoutPresetOf(plan.design).id),
|
|
1733
|
+
photoSrc: id => context.photoSrc?.(id) ?? '', photoAlt: id => context.photoAlt?.(id) ?? '',
|
|
1734
|
+
listOf: alias => pageListOf(alias, plan, pictureless),
|
|
1735
|
+
...(readyMade ? {
|
|
1736
|
+
readyMade: (at: number, id: string) => {
|
|
1737
|
+
const section = page.sections[at];
|
|
1738
|
+
if (!section) throw new ComposeError(`${page.key}: a ready-made place names plan section ${at}, which the page does not have`);
|
|
1739
|
+
return readyMade(section, id, at);
|
|
1740
|
+
},
|
|
1741
|
+
} : {}),
|
|
1742
|
+
};
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* A model-laid page's facts (M8 gate 2; a free page's too, FS3): a `{fact:<key>}` the owner gave becomes their words, one
|
|
1747
|
+
* they did not becomes the fact's label and a contact placeholder (never invented); a photo with no address is the empty
|
|
1748
|
+
* image box, a placeholder like a pattern's.
|
|
1749
|
+
*/
|
|
1750
|
+
function fillPageFacts(nodes: SerializedNode[], page: PagePlan, plan: SitePlan, placeholders: ComposedPlaceholder[]): void {
|
|
1703
1751
|
const facts = plan.business.facts ?? {};
|
|
1704
1752
|
walkSerialized(nodes, node => {
|
|
1705
1753
|
for (const prop of LAYOUT_TEXT_PROPS) {
|
|
@@ -1716,7 +1764,6 @@ function composeLayoutPage(
|
|
|
1716
1764
|
}
|
|
1717
1765
|
if (node.type === IMAGE && !node.props['src'] && !node.bindings.length) placeholders.push({ nodeId: node.id, owner: page.key, kind: PlaceholderKind.Image, text: '' });
|
|
1718
1766
|
});
|
|
1719
|
-
return nodes;
|
|
1720
1767
|
}
|
|
1721
1768
|
|
|
1722
1769
|
/** M2-1: each section root of a model-laid page says where it came from — a ready-made place its plan section's library
|
|
@@ -1788,6 +1835,18 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
1788
1835
|
const body = bodyChecked?.mix ?? null;
|
|
1789
1836
|
const pages: ComposedPage[] = plan.pages.map(page => {
|
|
1790
1837
|
const nextAlias = page.routeSource ? nextSourceOf(relatives, page.routeSource) : null;
|
|
1838
|
+
if (page.free) {
|
|
1839
|
+
// FS3: the model's own page. Its opening is its own (the plan's opening is never worn over it).
|
|
1840
|
+
const nodes = composeFreePlanPage(page, page.free, plan, context, placeholders, pictureless, (section, id, at) =>
|
|
1841
|
+
composePattern(patternById(section.pattern) as SitePattern, id, { ...base, owner: page.key, page, section, nextAlias },
|
|
1842
|
+
{ level: section.enter ?? design.animate ?? null, rtl, move: design.headings ?? null, scrub: design.scrub ?? null, opening: at === 0 }));
|
|
1843
|
+
const opening = schemeOfFirst(nodes);
|
|
1844
|
+
return {
|
|
1845
|
+
key: page.key, name: page.name, route: { path: page.route }, isHome: page.isHome === true, status: STATUS_DRAFT, locale,
|
|
1846
|
+
pageSettings: { designSystem: true, layoutSource: { pageKey: page.key }, ...(opening ? { opening } : {}) }, seo: composePageSeo(page, plan),
|
|
1847
|
+
layout: wearBodyMix(nodes, body),
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1791
1850
|
if (page.layout) {
|
|
1792
1851
|
// vectoriox/iox-ui#99: a composed page that is where the site lists the shop lists it (a stored layout too).
|
|
1793
1852
|
const layout = withShownList(page.layout, layoutListsContext(page, plan)) ?? page.layout;
|
|
@@ -1810,6 +1869,12 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
1810
1869
|
const layout = wearPlanOpening(page, page.sections.map((section, i) => {
|
|
1811
1870
|
const pattern = patternById(section.pattern) as SitePattern;
|
|
1812
1871
|
const motion: SectionMotion = { level: section.enter ?? design.animate ?? null, rtl, move: design.headings ?? null, scrub: design.scrub ?? null, opening: i === 0 };
|
|
1872
|
+
// FS-D19: a free signature section stands in its place; its fall back is this pattern.
|
|
1873
|
+
if (section.free) {
|
|
1874
|
+
const root = composeFreeSection(section.free, `${page.key}-${i}`, freeOptionsOf(page, plan, context, pictureless));
|
|
1875
|
+
fillPageFacts([root], page, plan, placeholders);
|
|
1876
|
+
return root;
|
|
1877
|
+
}
|
|
1813
1878
|
return stampSection(composePattern(pattern, `${page.key}-${i}`, { ...base, owner: page.key, page, section, nextAlias }, motion), { pattern: section.pattern });
|
|
1814
1879
|
}), plan, context, design, placeholders, issues, false, page.sections[0]);
|
|
1815
1880
|
const opening = schemeOfFirst(layout);
|
|
@@ -87,8 +87,10 @@ export function fallBackFree(page: FreePage, plan: ReadonlyArray<PageSectionPlan
|
|
|
87
87
|
const limits = prompt?.limits ?? [];
|
|
88
88
|
const lastAt = plan.length - 1;
|
|
89
89
|
const honest = plan.map((_, i) => i).filter(i => i === 0 || i === lastAt || !sectionBreaks(plan[i], limits).length);
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
// The honest pass holds the page's minimum (FS-D47: a place is dropped only where the minimums allow); the last pass,
|
|
91
|
+
// over the whole plan, forgives a place nothing at all is left for (iox-ui#134: never the whole page for its count).
|
|
92
|
+
const first = limits.length && honest.length < plan.length ? fallBackOn(page, plan, honest, issues, ctx, false) : null;
|
|
93
|
+
const done = first && !first.lastResort ? first : fallBackOn(page, plan, plan.map((_, i) => i), issues, ctx, true);
|
|
92
94
|
if (done.lastResort || !limits.length) return done;
|
|
93
95
|
const broken = new Map<PromptLimit, number>();
|
|
94
96
|
for (const s of done.page.sections) {
|
|
@@ -103,11 +105,15 @@ export function fallBackFree(page: FreePage, plan: ReadonlyArray<PageSectionPlan
|
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
/** The ONE fall back over the plan sections `use` (by their index in `plan`); ready-made places name the FULL plan. */
|
|
106
|
-
function fallBackOn(
|
|
108
|
+
function fallBackOn(
|
|
109
|
+
page: FreePage, plan: ReadonlyArray<PageSectionPlan>, use: ReadonlyArray<number>, issues: ReadonlyArray<FreeIssue>, ctx: FreeJudgeContext, forgive: boolean,
|
|
110
|
+
): FreeFallback {
|
|
107
111
|
const byId = new Map(page.sections.map(s => [s.id, s]));
|
|
108
112
|
const real = (at: number) => use[at] ?? at;
|
|
113
|
+
// iox-ui#134: on the last pass, what the fall back dropped is given away — the page's minimum forgives it (as #67).
|
|
109
114
|
const toFree = (layout: LayoutPage): FreePage => ({
|
|
110
115
|
...page,
|
|
116
|
+
...(forgive && layout.sections.length < page.sections.length ? { givenAway: (page.givenAway ?? 0) + page.sections.length - layout.sections.length } : {}),
|
|
111
117
|
sections: layout.sections.map(s => {
|
|
112
118
|
const was = byId.get(s.id)!;
|
|
113
119
|
return s.readyMade && !was.readyMade
|
|
@@ -129,6 +135,8 @@ function fallBackOn(page: FreePage, plan: ReadonlyArray<PageSectionPlan>, use: R
|
|
|
129
135
|
last = checkFree(toFree(layout), ctx);
|
|
130
136
|
return { page: layout, issues: last.map(asLayoutIssue) };
|
|
131
137
|
},
|
|
138
|
+
// iox-ui#134: a free page keeps its places — a middle section nothing fits by its words takes the nearest unused one.
|
|
139
|
+
{ keepPlace: true },
|
|
132
140
|
);
|
|
133
141
|
return {
|
|
134
142
|
page: toFree(judged.page),
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { decomposeCssFunctions, FILTER_FUNCTIONS } from '@vectoriox/iox-ui/design-core';
|
|
2
|
+
|
|
3
|
+
import { FreeNodeType, FreeStyle, FREE_BUILDER_TYPE } from './free-wire';
|
|
4
|
+
import { NODE_BASELINES } from './node-baselines.generated';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* HOW A FREE STYLE IS HELD (FS3 stamp). The free language (`check-free.ts`) speaks CSS as a model writes it — sides as
|
|
8
|
+
* start / end, `rowGap`, `placeItems`, `flex`, one `filter` — while a builder node holds its look in its style CONTROLS
|
|
9
|
+
* (`NODE_BASELINES[type].styleTraits`): one `margin`, `left` / `right`, `alignItems` + `justifyItems`, `filterBlur`…
|
|
10
|
+
* A base style the builder has no control for is DROPPED on the first save (cms-client `serializeBuilderToPageLayout`
|
|
11
|
+
* keeps trait values only), so the stamp never writes one: each free property is folded into the controls here — the ONE
|
|
12
|
+
* table, read by the judge (`freeSlotIssues`: a property a node's type has no control for is refused, with a path) and
|
|
13
|
+
* by the stamp (`composeFree`). Start / end become left / right by the page's direction, as `bleedSides` does. Pure.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const SIDES = ['top', 'right', 'bottom', 'left'] as const;
|
|
17
|
+
type Sides = [string, string, string, string];
|
|
18
|
+
const BOX_GROUPS = ['margin', 'padding'] as const;
|
|
19
|
+
/** The free side keys of a box group, read in this order: the shorthand, then the axes, then each side. */
|
|
20
|
+
const SIDE_KEYS = ['', 'Block', 'Inline', 'Top', 'Bottom', 'InlineStart', 'InlineEnd'] as const;
|
|
21
|
+
const ZERO = '0px';
|
|
22
|
+
|
|
23
|
+
export interface FreeSlotOptions {
|
|
24
|
+
/** The page runs right to left: start is the right side. */
|
|
25
|
+
rtl: boolean;
|
|
26
|
+
/** What the node already holds at this width (its element style, a wider layer): a side the answer leaves is kept. */
|
|
27
|
+
held?: Readonly<Record<string, unknown>>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** CSS's 1–4 value box shorthand as four physical sides. */
|
|
31
|
+
export function boxSides(value: unknown): Sides | null {
|
|
32
|
+
const parts = String(value ?? '').trim().split(/\s+(?![^(]*\))/).filter(Boolean);
|
|
33
|
+
if (!parts.length || parts.length > 4) return null;
|
|
34
|
+
const [t, r = t, b = t, l = r] = parts;
|
|
35
|
+
return [t, r, b, l];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const sidesText = (s: Sides) => (s[1] === s[3] ? (s[0] === s[2] ? (s[0] === s[1] ? s[0] : `${s[0]} ${s[1]}`) : `${s[0]} ${s[1]} ${s[2]}`) : s.join(' '));
|
|
39
|
+
const pair = (value: string): [string, string] => {
|
|
40
|
+
const [a, b = a] = value.trim().split(/\s+(?![^(]*\))/);
|
|
41
|
+
return [a, b];
|
|
42
|
+
};
|
|
43
|
+
const NUMBER = /^-?\d*\.?\d+$/;
|
|
44
|
+
|
|
45
|
+
/** `flex` as grow / shrink / basis (CSS's own expansion). */
|
|
46
|
+
function flexParts(value: string): Record<string, string> | null {
|
|
47
|
+
const v = value.trim();
|
|
48
|
+
if (v === 'none') return { flexGrow: '0', flexShrink: '0', flexBasis: 'auto' };
|
|
49
|
+
if (v === 'auto') return { flexGrow: '1', flexShrink: '1', flexBasis: 'auto' };
|
|
50
|
+
if (v === 'initial') return { flexGrow: '0', flexShrink: '1', flexBasis: 'auto' };
|
|
51
|
+
const p = v.split(/\s+(?![^(]*\))/);
|
|
52
|
+
if (p.length === 1) return NUMBER.test(p[0]) ? { flexGrow: p[0], flexShrink: '1', flexBasis: '0%' } : { flexGrow: '1', flexShrink: '1', flexBasis: p[0] };
|
|
53
|
+
if (p.length === 2) return NUMBER.test(p[1]) ? { flexGrow: p[0], flexShrink: p[1], flexBasis: '0%' } : { flexGrow: p[0], flexShrink: '1', flexBasis: p[1] };
|
|
54
|
+
if (p.length === 3) return { flexGrow: p[0], flexShrink: p[1], flexBasis: p[2] };
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A free style as the builder's controls hold it. A property with no fold is passed through as written — the judge says
|
|
60
|
+
* whether the node's type has a control for it (`freeSlotIssues`).
|
|
61
|
+
*/
|
|
62
|
+
export function freeStyleToSlots(style: FreeStyle | undefined, options: FreeSlotOptions): Record<string, string> {
|
|
63
|
+
const out: Record<string, string> = {};
|
|
64
|
+
const held = options.held ?? {};
|
|
65
|
+
// The start side is the right (1) on a right-to-left page, the left (3) otherwise.
|
|
66
|
+
const start = options.rtl ? 1 : 3;
|
|
67
|
+
const end = options.rtl ? 3 : 1;
|
|
68
|
+
const given = style ?? {};
|
|
69
|
+
for (const group of BOX_GROUPS) {
|
|
70
|
+
const keys = SIDE_KEYS.map(k => `${group}${k}`).filter(k => given[k] !== undefined);
|
|
71
|
+
if (!keys.length) continue;
|
|
72
|
+
const sides: Sides = boxSides(held[group]) ?? [ZERO, ZERO, ZERO, ZERO];
|
|
73
|
+
for (const key of keys) {
|
|
74
|
+
const v = String(given[key]).trim();
|
|
75
|
+
const k = key.slice(group.length);
|
|
76
|
+
if (k === '') {
|
|
77
|
+
const s = boxSides(v);
|
|
78
|
+
if (s) sides.splice(0, 4, ...s);
|
|
79
|
+
} else if (k === 'Block') [sides[0], sides[2]] = pair(v);
|
|
80
|
+
else if (k === 'Inline') { const [a, b] = pair(v); sides[start] = a; sides[end] = b; }
|
|
81
|
+
else if (k === 'Top') sides[0] = v;
|
|
82
|
+
else if (k === 'Bottom') sides[2] = v;
|
|
83
|
+
else if (k === 'InlineStart') sides[start] = v;
|
|
84
|
+
else sides[end] = v;
|
|
85
|
+
}
|
|
86
|
+
out[group] = sidesText(sides);
|
|
87
|
+
}
|
|
88
|
+
for (const [prop, raw] of Object.entries(given)) {
|
|
89
|
+
const v = String(raw).trim();
|
|
90
|
+
if (BOX_GROUPS.some(g => prop.startsWith(g) && SIDE_KEYS.includes(prop.slice(g.length) as typeof SIDE_KEYS[number]))) continue;
|
|
91
|
+
if (prop === 'insetInlineStart') out[SIDES[start]] = v;
|
|
92
|
+
else if (prop === 'insetInlineEnd') out[SIDES[end]] = v;
|
|
93
|
+
else if (prop === 'rowGap' || prop === 'columnGap') {
|
|
94
|
+
const [row, col] = pair(String(out['gap'] ?? given['gap'] ?? held['gap'] ?? 'normal'));
|
|
95
|
+
const next: [string, string] = prop === 'rowGap' ? [v, col] : [row, v];
|
|
96
|
+
out['gap'] = next[0] === next[1] ? next[0] : next.join(' ');
|
|
97
|
+
} else if (prop === 'gap') {
|
|
98
|
+
if (out['gap'] === undefined) out['gap'] = v;
|
|
99
|
+
} else if (prop === 'placeItems') { const [a, b] = pair(v); out['alignItems'] = a; out['justifyItems'] = b; }
|
|
100
|
+
else if (prop === 'placeSelf') { const [a, b] = pair(v); out['alignSelf'] = a; out['justifySelf'] = b; }
|
|
101
|
+
else if (prop === 'flex') Object.assign(out, flexParts(v) ?? { flex: v });
|
|
102
|
+
else if (prop === 'filter') Object.assign(out, decomposeCssFunctions(FILTER_FUNCTIONS, v) ?? { filter: v });
|
|
103
|
+
else out[prop] = v;
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The builder controls a free node's type has. */
|
|
109
|
+
export function freeControlsOf(type: FreeNodeType): ReadonlyArray<string> {
|
|
110
|
+
return NODE_BASELINES[FREE_BUILDER_TYPE[type]]?.styleTraits ?? [];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Each property of one free style map that the node's type has no control for, by the property as the answer wrote it
|
|
115
|
+
* (`[prop, the control it would need]`): what the stamp could not keep past the first save.
|
|
116
|
+
*/
|
|
117
|
+
export function freeStyleWithoutSlot(type: FreeNodeType, style: FreeStyle | undefined): Array<[string, string]> {
|
|
118
|
+
const slots = freeControlsOf(type);
|
|
119
|
+
const out: Array<[string, string]> = [];
|
|
120
|
+
for (const [prop, value] of Object.entries(style ?? {})) {
|
|
121
|
+
const missing = Object.keys(freeStyleToSlots({ [prop]: value }, { rtl: false })).find(k => !slots.includes(k));
|
|
122
|
+
if (missing) out.push([prop, missing]);
|
|
123
|
+
}
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
@@ -168,6 +168,11 @@ export interface FreePage {
|
|
|
168
168
|
read: FreeRead;
|
|
169
169
|
pictures: string;
|
|
170
170
|
sections: FreeNode[];
|
|
171
|
+
/**
|
|
172
|
+
* Set by the fall back only (never asked, never on the wire): how many of the model's sections it dropped — the page's
|
|
173
|
+
* section minimum forgives them, as a composed page's does (iox-ui#67, iox-ui#134).
|
|
174
|
+
*/
|
|
175
|
+
givenAway?: number;
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
/** The wire's node keys, in the order a model writes them. Every one is required. */
|
|
@@ -73,6 +73,9 @@ export interface FingerprintedPage {
|
|
|
73
73
|
* by the "same kind of business" clauses — every page of a site is the same kind of business (m8-gate2 §16;
|
|
74
74
|
* vectoriox/iox-ui#96: an award site's pages fell back, each refused against the site's own Workshops page). */
|
|
75
75
|
sameSite?: boolean;
|
|
76
|
+
/** The layout the owner asked to replace (Try another layout): its order of sections is judged by plain share — a new
|
|
77
|
+
* layout must not be the same page with one section swapped (iox-ui#131 keeps `sequenceRepeats` for other sites). */
|
|
78
|
+
replaced?: boolean;
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
const OPENING_SCREEN_WORD = 'screen-word';
|
|
@@ -210,6 +213,23 @@ export function sequenceShare(a: ReadonlyArray<string>, b: ReadonlyArray<string>
|
|
|
210
213
|
return lcs(a, b) / Math.max(1, a.length, b.length);
|
|
211
214
|
}
|
|
212
215
|
|
|
216
|
+
/** The sections every page is built from — what two pages share without repeating each other (iox-ui#131): a plain
|
|
217
|
+
* composition, a split, an inhale. */
|
|
218
|
+
const GLUE_TOKENS: ReadonlySet<string> = new Set([LayoutSequenceToken.Composition, LayoutSequenceToken.Split, LayoutSequenceToken.Inhale]);
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* iox-ui#131: a REAL repeat of a page's order of sections — most of the sequence shared (`SPEC_SITE_LAYOUT.sameness.sequence`)
|
|
222
|
+
* AND as much of its distinctive sections (held, sideways, a photo ground, a gallery, a list mix…), in order. Two pages
|
|
223
|
+
* that hold their story in different ways are not one page twice because both are mostly plain compositions (the hotel's
|
|
224
|
+
* visit page was refused as "Boutique law firm · Contact": held vs held-words). Two pages of glue alone are a repeat.
|
|
225
|
+
*/
|
|
226
|
+
export function sequenceRepeats(a: ReadonlyArray<string>, b: ReadonlyArray<string>): boolean {
|
|
227
|
+
if (sequenceShare(a, b) < SPEC_SITE_LAYOUT.sameness.sequence) return false;
|
|
228
|
+
const marks = (s: ReadonlyArray<string>) => s.filter(t => !GLUE_TOKENS.has(t));
|
|
229
|
+
const [x, y] = [marks(a), marks(b)];
|
|
230
|
+
return (!x.length && !y.length) || sequenceShare(x, y) >= SPEC_SITE_LAYOUT.sameness.sequence;
|
|
231
|
+
}
|
|
232
|
+
|
|
213
233
|
/** #129: an opening mix's token (`opening:<frame>/<media>/<words>`, opening-mix `openingTokenOf`) — a type-led first
|
|
214
234
|
* screen's. Literal here: importing opening-mix from this module reorders the generation-core load (a cycle). */
|
|
215
235
|
const MIX_OPENING = 'opening:';
|
|
@@ -223,7 +243,8 @@ const signatureWords = (id: string) => SPEC_SITE_LAYOUT.signatures.find(s => s.i
|
|
|
223
243
|
/**
|
|
224
244
|
* Refuses a page that repeats one already made (M8-G2-D7): most of the same sequence (`SPEC_SITE_LAYOUT.sameness.sequence`,
|
|
225
245
|
* 6 of 7), or the same opening AND signature; against a page of the same business type, the same opening or the same
|
|
226
|
-
* signature alone — never a page of THIS site (`sameSite
|
|
246
|
+
* signature alone — never a page of THIS site (`sameSite`, iox-ui#131). The sequence is a repeat only when the distinctive
|
|
247
|
+
* sections agree too (`sequenceRepeats`), and is compared with real pages only — never a
|
|
227
248
|
* demo's (Doron, 2026-11-09: the proof sites' order is the product's grammar, not someone's site). The look is the
|
|
228
249
|
* owner's pick and is never a reason.
|
|
229
250
|
*/
|
|
@@ -233,8 +254,11 @@ export function samenessIssues(me: LayoutFingerprint, others: ReadonlyArray<Fing
|
|
|
233
254
|
issues.push({ code: LayoutIssueCode.Sameness, path, message });
|
|
234
255
|
};
|
|
235
256
|
for (const o of others) {
|
|
257
|
+
// iox-ui#131: sameness is judged against the studio's OTHER sites only — a page of this site is never a reason (it
|
|
258
|
+
// is named in the brief, never refused; m8-gate2 §16 reversed, the lead 2026-11-24).
|
|
259
|
+
if (o.sameSite) continue;
|
|
236
260
|
const them = o.fingerprint;
|
|
237
|
-
const sameType =
|
|
261
|
+
const sameType = !!businessType && o.businessType === businessType;
|
|
238
262
|
const opening = me.opening === them.opening;
|
|
239
263
|
const signature = me.signature === them.signature;
|
|
240
264
|
if (opening && (signature || sameType)) add('sections[0]', `"${o.name}" already opens on ${openingWords(them.opening)}${sameType ? ', and it is the same kind of business' : ` with ${signatureWords(them.signature)}`} — open another way`);
|
|
@@ -243,7 +267,8 @@ export function samenessIssues(me: LayoutFingerprint, others: ReadonlyArray<Fing
|
|
|
243
267
|
if (sameType) for (const token of (me.lists ?? []).filter(t => (them.lists ?? []).includes(t))) {
|
|
244
268
|
add('sections', `"${o.name}" already shows a list as ${listWords(token)}, and it is the same kind of business — mix this list another way`);
|
|
245
269
|
}
|
|
246
|
-
|
|
270
|
+
const repeats = o.replaced ? sequenceShare(me.sequence, them.sequence) >= SPEC_SITE_LAYOUT.sameness.sequence : sequenceRepeats(me.sequence, them.sequence);
|
|
271
|
+
if (!o.demo && repeats) {
|
|
247
272
|
add('sections', `your sequence (${me.sequence.join(' → ')}) repeats "${o.name}"'s (${them.sequence.join(' → ')}) — change the order and the kinds of sections`);
|
|
248
273
|
}
|
|
249
274
|
}
|
|
@@ -436,7 +436,9 @@ export enum LayoutMendKind {
|
|
|
436
436
|
/** Words over a busy or too-light part of a photo, in a look that allows scrims: the layer gets one. */
|
|
437
437
|
Scrim = 'scrim',
|
|
438
438
|
/** The accent on more layers than the look allows: the least important words go back to the ink, then — where words
|
|
439
|
-
* cannot give enough back — the least important accent bands take the ground nearest the accent their words read on
|
|
439
|
+
* cannot give enough back — the least important accent bands take the ground nearest the accent their words read on,
|
|
440
|
+
* then the least important primary buttons step to secondary (never the main call to action — iox-ui#131: a page whose
|
|
441
|
+
* accent was on its buttons fell back whole). */
|
|
440
442
|
Accent = 'accent',
|
|
441
443
|
/** Words too faint on their ground, where the ink holds there: they go back to the ink. */
|
|
442
444
|
Ink = 'ink',
|
|
@@ -485,6 +487,11 @@ export enum LayoutMendKind {
|
|
|
485
487
|
* the column the type is offered first (`contained`) — said to the owner as `column-mended`. A word outside the
|
|
486
488
|
* axis is dropped (the page wears the site's). */
|
|
487
489
|
Column = 'column',
|
|
490
|
+
/** iox-ui#131: words a few characters too many for their box (a near miss): one size step down, where they then fit
|
|
491
|
+
* and the smaller size still holds them — never below a heading's reading size, never the opening's display. */
|
|
492
|
+
Size = 'size',
|
|
493
|
+
/** iox-ui#131: a form a column or two narrower than a form needs: it widens into empty cells of its own rows. */
|
|
494
|
+
Widen = 'widen',
|
|
488
495
|
}
|
|
489
496
|
|
|
490
497
|
/** What the build says when the column a page asked for was mended (award §0c CW2). */
|
|
@@ -543,7 +550,9 @@ export interface LayoutBandMove {
|
|
|
543
550
|
export type LayoutMend =
|
|
544
551
|
| { kind: LayoutMendKind.Scrim | LayoutMendKind.Ink | LayoutMendKind.Fade; layer: string }
|
|
545
552
|
| { kind: LayoutMendKind.Scrub; layer: string; why: `${LayoutScrubRefusal}` }
|
|
546
|
-
| { kind: LayoutMendKind.Accent; over: number; bands?: ReadonlyArray<LayoutBandMove> }
|
|
553
|
+
| { kind: LayoutMendKind.Accent; over: number; bands?: ReadonlyArray<LayoutBandMove>; buttons?: ReadonlyArray<string> }
|
|
554
|
+
| { kind: LayoutMendKind.Size; layer: string; size: `${LayoutSize}` }
|
|
555
|
+
| { kind: LayoutMendKind.Widen; layer: string; col: [number, number] }
|
|
547
556
|
| { kind: LayoutMendKind.Depth; layers: ReadonlyArray<string> }
|
|
548
557
|
| { kind: LayoutMendKind.Source; layer: string; source: string; by: `${LayoutSourceChoice}` }
|
|
549
558
|
| { kind: LayoutMendKind.Words | LayoutMendKind.Drop | LayoutMendKind.Drift; layer: string }
|
|
@@ -34,6 +34,21 @@ export enum SectionSwapRule {
|
|
|
34
34
|
Fit = 'fit',
|
|
35
35
|
/** A middle section no ready-made section fits (or every one that does would repeat a kept section, iox-ui#68): dropped. */
|
|
36
36
|
NoFit = 'no-fit',
|
|
37
|
+
/**
|
|
38
|
+
* A middle section no ready-made section fits by its words, given the plan's unused middle section nearest its place
|
|
39
|
+
* — only when the caller keeps every place (`SectionFallbackOptions.keepPlace`: a free page, iox-ui#134).
|
|
40
|
+
*/
|
|
41
|
+
Place = 'place',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** How the fall back treats a middle place nothing fits. */
|
|
45
|
+
export interface SectionFallbackOptions {
|
|
46
|
+
/**
|
|
47
|
+
* iox-ui#134: keep the place — a middle section no ready-made section fits takes the plan's unused middle section
|
|
48
|
+
* nearest its place (never one that repeats a kept section) instead of being dropped. A free page asks this: its count
|
|
49
|
+
* is the model's, and a page one short of its minimum fell back WHOLE. Absent: dropped, as a composed page always was.
|
|
50
|
+
*/
|
|
51
|
+
keepPlace?: boolean;
|
|
37
52
|
}
|
|
38
53
|
|
|
39
54
|
/** One place swapped, kept for us on the composed record — never shown to the owner. */
|
|
@@ -139,6 +154,21 @@ function fitScore(section: LayoutSection, plan: PageSectionPlan): number {
|
|
|
139
154
|
/** The least a middle section's fit scores to be given a ready-made section (two shared words, a form or a list). */
|
|
140
155
|
const FIT_MIN = 2;
|
|
141
156
|
|
|
157
|
+
/**
|
|
158
|
+
* iox-ui#134: the plan's middle section (neither its opening nor its close) not yet used whose place is nearest the model's
|
|
159
|
+
* section's — by their share of each page's length, the earlier one on a tie — and that repeats no kept section; else null.
|
|
160
|
+
*/
|
|
161
|
+
function nearestUnusedMiddle(plan: ReadonlyArray<PageSectionPlan>, i: number, lastAt: number, used: ReadonlySet<number>, kept: ReadonlyArray<LayoutSection>): number | null {
|
|
162
|
+
const share = lastAt > 0 ? i / lastAt : 0;
|
|
163
|
+
const planLast = plan.length - 1;
|
|
164
|
+
const candidates = plan
|
|
165
|
+
.map((p, at) => ({ at, p }))
|
|
166
|
+
.filter(c => c.at > 0 && c.at < planLast && !used.has(c.at) && !repeatsKept(c.p, kept))
|
|
167
|
+
.map(c => ({ at: c.at, off: Math.abs(c.at / planLast - share) }))
|
|
168
|
+
.sort((a, b) => a.off - b.off || a.at - b.at);
|
|
169
|
+
return candidates[0]?.at ?? null;
|
|
170
|
+
}
|
|
171
|
+
|
|
142
172
|
/** A ready-made stub at a place: no layers of its own — the composer stamps the plan section's pattern there. */
|
|
143
173
|
function readyMadeSection(original: LayoutSection, at: number, plan: PageSectionPlan): LayoutSection {
|
|
144
174
|
return { id: original.id, kind: 'content', screens: 1, rows: 1, layers: [], phone: [], readyMade: { at, pattern: plan.pattern } };
|
|
@@ -149,7 +179,9 @@ function readyMadeSection(original: LayoutSection, at: number, plan: PageSection
|
|
|
149
179
|
* more (a page-wide issue beside them may be cured by the swap — the judge says). `plan` is the page's ready-made
|
|
150
180
|
* sections (`PagePlan.sections`), in order; `issues` what is left after the mends and the one repair.
|
|
151
181
|
*/
|
|
152
|
-
export function fallBackBySection(
|
|
182
|
+
export function fallBackBySection(
|
|
183
|
+
page: LayoutPage, plan: ReadonlyArray<PageSectionPlan>, issues: ReadonlyArray<LayoutIssue>, judge: SectionJudge, options: SectionFallbackOptions = {},
|
|
184
|
+
): SectionFallback {
|
|
153
185
|
const current: LayoutPage = structuredClone(page) as LayoutPage;
|
|
154
186
|
const swaps: SectionSwap[] = [];
|
|
155
187
|
const last = (lastResort: `${SectionFallbackLastResort}`, left: LayoutIssue[], at: LayoutPage = current): SectionFallback => ({ page: at, swaps, left, lastResort });
|
|
@@ -180,10 +212,15 @@ export function fallBackBySection(page: LayoutPage, plan: ReadonlyArray<PageSect
|
|
|
180
212
|
.map((p, at) => ({ at, score: at > 0 && at < plan.length - 1 && !used.has(at) && !repeatsKept(p, keptSections) ? fitScore(s, p) : -1 }))
|
|
181
213
|
.filter(c => c.score >= FIT_MIN)
|
|
182
214
|
.sort((a, b) => b.score - a.score || a.at - b.at)[0];
|
|
215
|
+
const near = !best && options.keepPlace ? nearestUnusedMiddle(plan, i, lastAt, used, keptSections) : null;
|
|
183
216
|
if (best) {
|
|
184
217
|
used.add(best.at);
|
|
185
218
|
next[i] = readyMadeSection(s, best.at, plan[best.at]);
|
|
186
219
|
record(SectionSwapAction.Replaced, SectionSwapRule.Fit, { at: best.at, pattern: plan[best.at].pattern });
|
|
220
|
+
} else if (near !== null) {
|
|
221
|
+
used.add(near);
|
|
222
|
+
next[i] = readyMadeSection(s, near, plan[near]);
|
|
223
|
+
record(SectionSwapAction.Replaced, SectionSwapRule.Place, { at: near, pattern: plan[near].pattern });
|
|
187
224
|
} else {
|
|
188
225
|
drop.add(i);
|
|
189
226
|
record(SectionSwapAction.Dropped, SectionSwapRule.NoFit);
|
|
@@ -36,6 +36,8 @@ const ROW_ROLES: Readonly<Record<OpeningIngredient, ReadonlyArray<string>>> = {
|
|
|
36
36
|
[OpeningIngredient.Words]: [OpeningRole.Words, OpeningRole.Title, OpeningRole.Lead, OpeningRole.Action, OpeningRole.Apart, OpeningRole.ApartWord, OpeningRole.Aside, OpeningRole.Cutout, OpeningRole.Scrim],
|
|
37
37
|
[OpeningIngredient.Extras]: [OpeningRole.Card, OpeningRole.Badge, OpeningRole.Cue],
|
|
38
38
|
[OpeningIngredient.Motion]: [],
|
|
39
|
+
// iox-ui#131: a type-led first screen's ground is its frame's scheme.
|
|
40
|
+
[OpeningIngredient.Ground]: [OpeningRole.Frame, OpeningRole.FrameSettles],
|
|
39
41
|
};
|
|
40
42
|
|
|
41
43
|
/** The props that are the owner's CONTENT (words, pictures, a film, a form's identity) — never a sign of a hand edit. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DesignChoices, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
|
+
import { LAYOUT_INSET } from './layout-column';
|
|
3
4
|
import { GenerationTier } from './site-plan.model';
|
|
4
5
|
import { PatternNode, PatternPlaceholder, PatternRecipe, SitePattern } from './patterns';
|
|
5
6
|
import { SerializedNode, walkSerialized } from './serialized-node';
|
|
@@ -49,6 +50,8 @@ interface OpeningTable {
|
|
|
49
50
|
typeLed?: ReadonlyArray<{ frame: string; words: string }>;
|
|
50
51
|
/** AW-D23 amended (2026-11-24): a type-led way is worn at every tier. */
|
|
51
52
|
typeLedEveryTier?: boolean;
|
|
53
|
+
/** iox-ui#131: the grounds a type-led first screen may stand on, in the order tried (`inverse` first, no word). */
|
|
54
|
+
typeLedGrounds?: ReadonlyArray<string>;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
/** The ingredients, by the contract's keys (held equal to it by opening-mix.spec). */
|
|
@@ -58,6 +61,8 @@ export enum OpeningIngredient {
|
|
|
58
61
|
Words = 'words',
|
|
59
62
|
Extras = 'extras',
|
|
60
63
|
Motion = 'motion',
|
|
64
|
+
/** iox-ui#131: what a type-led first screen stands on (none named: the inverse scheme). The harness's alone. */
|
|
65
|
+
Ground = 'ground',
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
export enum OpeningFrame { Full = 'full', Inset = 'inset', Shrinks = 'shrinks', Grows = 'grows' }
|
|
@@ -65,6 +70,8 @@ export enum OpeningMedia { Photo = 'photo', Film = 'film', Slideshow = 'slidesho
|
|
|
65
70
|
export enum OpeningWords { Headline = 'headline', OnEdge = 'on-edge', Apart = 'apart', Wordmark = 'wordmark', Behind = 'behind', None = 'none' }
|
|
66
71
|
export enum OpeningExtra { Card = 'card', Badge = 'badge', Cue = 'cue' }
|
|
67
72
|
export enum OpeningMotion { SlowZoom = 'slow-zoom', CopyOut = 'copy-out', PinnedCovered = 'pinned-covered' }
|
|
73
|
+
/** iox-ui#131: a type-led first screen's ground — `inverse` is the default and no word (the contract's `typeLedGrounds`). */
|
|
74
|
+
export enum OpeningGround { Inverse = 'inverse', Accent = 'accent', Subtle = 'subtle' }
|
|
68
75
|
|
|
69
76
|
/** One word for each of frame, media and words; a list (in the table's order) for extras and motion. */
|
|
70
77
|
export interface OpeningMix {
|
|
@@ -73,6 +80,8 @@ export interface OpeningMix {
|
|
|
73
80
|
words: string;
|
|
74
81
|
extras: string[];
|
|
75
82
|
motion: string[];
|
|
83
|
+
/** iox-ui#131: at most one word; empty — the inverse scheme. Worn by a type-led first screen only. */
|
|
84
|
+
ground: string[];
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
export class OpeningMixError extends Error {}
|
|
@@ -122,7 +131,7 @@ const MANY: ReadonlySet<string> = new Set(O.many);
|
|
|
122
131
|
const WAITS = O.waits;
|
|
123
132
|
const ORDER: ReadonlyArray<OpeningIngredient> = Object.values(OpeningIngredient);
|
|
124
133
|
|
|
125
|
-
const isMany = (k: string): k is OpeningIngredient.Extras | OpeningIngredient.Motion => MANY.has(k);
|
|
134
|
+
const isMany = (k: string): k is OpeningIngredient.Extras | OpeningIngredient.Motion | OpeningIngredient.Ground => MANY.has(k);
|
|
126
135
|
|
|
127
136
|
/** The words an ingredient may take, in the table's order. */
|
|
128
137
|
export function openingWords(ingredient: `${OpeningIngredient}`): ReadonlyArray<string> {
|
|
@@ -164,13 +173,14 @@ const ordered = (k: string, words: ReadonlyArray<string>): string[] => openingWo
|
|
|
164
173
|
export function openingMix(partial: Partial<Record<string, string | ReadonlyArray<string>>> = {}): OpeningMix {
|
|
165
174
|
const mix: OpeningMix = {
|
|
166
175
|
frame: O.defaults['frame'] as string, media: O.defaults['media'] as string, words: O.defaults['words'] as string,
|
|
167
|
-
extras: listOf(O.defaults['extras']), motion: listOf(O.defaults['motion']),
|
|
176
|
+
extras: listOf(O.defaults['extras']), motion: listOf(O.defaults['motion']), ground: listOf(O.defaults['ground']),
|
|
168
177
|
};
|
|
169
178
|
for (const [k, v] of Object.entries(partial)) {
|
|
170
179
|
if (v === undefined) continue;
|
|
171
180
|
if (!INGREDIENTS[k]) throw new OpeningMixError(`no opening ingredient "${k}"`);
|
|
172
181
|
const words = listOf(v);
|
|
173
182
|
for (const w of words) if (!INGREDIENTS[k].includes(w)) throw new OpeningMixError(`an opening's ${k} cannot be "${w}" (${INGREDIENTS[k].join(' · ')})`);
|
|
183
|
+
if (k === OpeningIngredient.Ground && words.length > 1) throw new OpeningMixError(`an opening stands on one ground ("${words.join('" and "')}")`);
|
|
174
184
|
if (isMany(k)) mix[k] = ordered(k, words);
|
|
175
185
|
else if (words.length !== 1) throw new OpeningMixError(`an opening has one ${k}`);
|
|
176
186
|
else (mix as unknown as Record<string, string>)[k] = words[0];
|
|
@@ -331,9 +341,26 @@ export function drawnOpeningMix(mix: OpeningMix): { drawn: OpeningMix; gaps: Ope
|
|
|
331
341
|
/** The fingerprint's prefix for an opening. */
|
|
332
342
|
export const OPENING_TOKEN = 'opening';
|
|
333
343
|
|
|
334
|
-
/**
|
|
344
|
+
/** What a type-led token says its ground is (`+<ground>`, iox-ui#131). */
|
|
345
|
+
const GROUND_MARK = '+';
|
|
346
|
+
|
|
347
|
+
/** An opening as the fingerprint sees it: `opening:<frame>/<media>/<words>` — what a visitor takes in at once; a type-led
|
|
348
|
+
* first screen on a ground other than the inverse adds it (`opening:full/none/wordmark+accent`, iox-ui#131). */
|
|
335
349
|
export function openingTokenOf(mix: OpeningMix): string {
|
|
336
|
-
|
|
350
|
+
const way = `${OPENING_TOKEN}:${O.fingerprint.map(k => (mix as unknown as Record<string, string>)[k]).join('/')}`;
|
|
351
|
+
const ground = mix.media === OpeningMedia.None ? mix.ground?.[0] : undefined;
|
|
352
|
+
return ground ? `${way}${GROUND_MARK}${ground}` : way;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** iox-ui#131: a token's way (frame, media, words) and its ground — `inverse` when it names none. */
|
|
356
|
+
export function openingTokenParts(token: string): { way: string; ground: string } {
|
|
357
|
+
const [way, ground] = token.split(GROUND_MARK);
|
|
358
|
+
return { way, ground: ground || OpeningGround.Inverse };
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/** iox-ui#131: the grounds a type-led first screen may stand on, in the order tried; a calm look never takes the accent. */
|
|
362
|
+
export function typeLedGrounds(calm = false): OpeningGround[] {
|
|
363
|
+
return ((O.typeLedGrounds ?? [OpeningGround.Inverse]) as OpeningGround[]).filter(g => !(calm && g === OpeningGround.Accent));
|
|
337
364
|
}
|
|
338
365
|
|
|
339
366
|
/** Every `<ingredient>:<word>` the generator's wire may carry at `tier`: drawn words only (a waiting word is never
|
|
@@ -493,6 +520,7 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
|
|
|
493
520
|
m.extras = m.extras.filter(w => w !== OpeningExtra.Card);
|
|
494
521
|
say(OpeningRepairCode.OneCard, 'the form is the first screen\'s card: the small card is left out');
|
|
495
522
|
}
|
|
523
|
+
if (m.ground.length && m.media !== OpeningMedia.None) m.ground = [];
|
|
496
524
|
const still = m.media === OpeningMedia.Photo || m.media === OpeningMedia.Diptych || m.media === OpeningMedia.Live;
|
|
497
525
|
if (m.motion.includes(OpeningMotion.SlowZoom) && !still) {
|
|
498
526
|
m.motion = m.motion.filter(w => w !== OpeningMotion.SlowZoom);
|
|
@@ -521,6 +549,9 @@ const ABS_FILL: Readonly<Record<string, string>> = { position: 'absolute', top:
|
|
|
521
549
|
const MEDIA_FILL: Readonly<Record<string, string>> = { ...ABS_FILL, aspectRatio: 'auto', borderRadius: '0px', objectFit: 'cover' };
|
|
522
550
|
const OVER = (z: number): Readonly<Record<string, string>> => ({ position: 'relative', zIndex: String(z) });
|
|
523
551
|
const FRAME_PAD = 'clamp(20px, 4vw, 56px)';
|
|
552
|
+
/** iox-ui#133 (AW-D41, one edge): a frame's words start on the content column every other section starts on — its inline
|
|
553
|
+
* padding is never less than `space-inline`; the frame itself may bleed, its words do not. */
|
|
554
|
+
const framePadding = (block: string): string => `${block} max(${block}, ${LAYOUT_INSET})`;
|
|
524
555
|
/** A display line is sized a little under its measured width, so a rounding never wraps it. */
|
|
525
556
|
const FIT = 0.95;
|
|
526
557
|
|
|
@@ -544,17 +575,17 @@ function frameNode(mix: OpeningMix, children: PatternNode[]): PatternNode {
|
|
|
544
575
|
const inset = mix.frame === OpeningFrame.Inset || mix.frame === OpeningFrame.Shrinks;
|
|
545
576
|
const height = mix.media === OpeningMedia.None ? typeLedHeights(mix) : { laptop: OPENING_HEIGHT };
|
|
546
577
|
const phone = {
|
|
547
|
-
...(inset ? { clipPath: insetClip(openingPhoneInset()), padding: phoneFramePad(mix) } : {}),
|
|
578
|
+
...(inset ? { clipPath: insetClip(openingPhoneInset()), padding: framePadding(phoneFramePad(mix)) } : {}),
|
|
548
579
|
...(height.phone ? { minHeight: height.phone } : {}),
|
|
549
580
|
};
|
|
550
581
|
return {
|
|
551
582
|
// A pictured frame is a box its picture fills; a type-led one (no picture) paints its scheme's own ground — a
|
|
552
583
|
// box paints nothing, and the scheme's light words stood on the page's light ground (the #129 proof's shots).
|
|
553
|
-
t: 'Container', es: mix.media === OpeningMedia.None ? 'section' : 'box', scheme:
|
|
584
|
+
t: 'Container', es: mix.media === OpeningMedia.None ? 'section' : 'box', scheme: mix.media === OpeningMedia.None ? (mix.ground?.[0] ?? OpeningGround.Inverse) : OpeningGround.Inverse,
|
|
554
585
|
role: mix.frame === OpeningFrame.Shrinks ? OpeningRole.FrameSettles : OpeningRole.Frame,
|
|
555
586
|
lay: {
|
|
556
587
|
position: 'relative', overflow: 'hidden', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', gap: 'var(--iox-space-gap)',
|
|
557
|
-
minHeight: height.laptop, padding: inset ? `calc(${INSET_LAPTOP} + ${FRAME_PAD})` : FRAME_PAD, borderRadius: '0px',
|
|
588
|
+
minHeight: height.laptop, padding: framePadding(inset ? `calc(${INSET_LAPTOP} + ${FRAME_PAD})` : FRAME_PAD), borderRadius: '0px',
|
|
558
589
|
...(inset ? { clipPath: insetClip(INSET_LAPTOP) } : {}),
|
|
559
590
|
},
|
|
560
591
|
...(Object.keys(phone).length ? { resp: { mobile: phone } } : {}),
|
|
@@ -749,7 +780,7 @@ function wordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[] {
|
|
|
749
780
|
: { t: 'Heading', es: 'display', level: 'h2', text: w, role: OpeningRole.ApartWord, lay: { fontSize: size, lineHeight: '0.9', margin: '0px', ...place[i] } });
|
|
750
781
|
return [scrim(), {
|
|
751
782
|
t: 'Container', es: 'box', role: OpeningRole.Apart,
|
|
752
|
-
lay: { ...ABS_FILL, zIndex: '1', display: 'grid', gridTemplateRows: 'repeat(3, minmax(0, 1fr))', padding: FRAME_PAD },
|
|
783
|
+
lay: { ...ABS_FILL, zIndex: '1', display: 'grid', gridTemplateRows: 'repeat(3, minmax(0, 1fr))', padding: framePadding(FRAME_PAD) },
|
|
753
784
|
c: words.map(word),
|
|
754
785
|
}, aside('bottom')];
|
|
755
786
|
}
|
|
@@ -281,6 +281,11 @@ export const PLAN_WIRE_DERIVED: Readonly<Record<string, string>> = {
|
|
|
281
281
|
'page.layout': 'the layout step: one request per composed page, after the pages (M8 gate 2)',
|
|
282
282
|
'shop.categories': "the products' own categories, in order (shopCategoriesOf)",
|
|
283
283
|
layoutPage: 'the layout step: one request per composed page, after the pages (M8 gate 2)',
|
|
284
|
+
'page.free': 'the free step: a page the model writes free, on its own wire, set by the server (FS3)',
|
|
285
|
+
'section.free': 'the free step: one signature section written free, set by the server (FS3, FS-D19)',
|
|
286
|
+
freePage: 'the free step: a page the model writes free, on its own wire, set by the server (FS3)',
|
|
287
|
+
freeRead: 'the free step (FS3)',
|
|
288
|
+
freeNode: 'the free step (FS3)',
|
|
284
289
|
};
|
|
285
290
|
|
|
286
291
|
const wireText = (spec: WireKey): string => {
|