@vectoriox/iox-ui 5.177.0 → 5.179.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/fesm2022/vectoriox-iox-ui-generation-core.mjs +919 -858
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/generation-core/index.d.ts +56 -20
- package/package.json +1 -1
- package/src/generation-core/import-plan.ts +25 -1
- package/src/generation-core/opening-mix.ts +16 -5
- package/src/generation-core/patterns.ts +12 -0
- package/src/generation-core/site-build-run.ts +22 -3
- package/src/generation-core/site-spec.generated.ts +3 -0
- package/src/generation-core/type-led.ts +111 -101
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ComposedItem, ComposedPlaceholder, ComposedSite, openingContextOf, PlaceholderKind } from './compose-site';
|
|
2
2
|
import { FingerprintedPage, wornOpenings } from './layout-fingerprint';
|
|
3
|
-
import {
|
|
4
|
-
import { fallBackBySection, SectionFallbackLastResort, SectionSwapAction } from './layout-section-fallback';
|
|
3
|
+
import { LAYOUT_TEXT_KINDS, LayoutColour, LayoutLayer, LayoutLayerKind, LayoutSection } from './layout-language';
|
|
5
4
|
import {
|
|
6
5
|
checkOpening, drawnOpeningMix, OPENING_MIX_PROP, OpeningGround, OpeningMedia, OpeningMix, openingMixOfPlan, openingMixWords, OpeningMotion,
|
|
7
6
|
openingTokenOf, openingTokenParts, typeLedGrounds, typeLedOpeningSection, typeLedOpeningWays,
|
|
8
7
|
} from './opening-mix';
|
|
9
8
|
import type { GenerationTier } from './site-plan.model';
|
|
10
|
-
import { patternById, patternLinkSlots, patternOptionalParts, patternSlots, slotBudget } from './patterns';
|
|
9
|
+
import { patternById, patternLinkSlots, patternOptionalParts, patternPartSlots, patternSlots, slotBudget } from './patterns';
|
|
11
10
|
import { SerializedNode, walkSerialized } from './serialized-node';
|
|
12
11
|
import { SHOP_ROLES } from './shop-plan';
|
|
13
12
|
import { ContentRole, PagePlan, PageSectionPlan, roleField, ShopResource, SitePlan } from './site-plan.model';
|
|
@@ -21,10 +20,11 @@ import { ContentRole, PagePlan, PageSectionPlan, roleField, ShopResource, SitePl
|
|
|
21
20
|
* So, when the caller says which picture slots a picture fills (`PictureSupply`), a section whose picture stays empty is
|
|
22
21
|
* composed TYPE-LED instead: the same words in the library's type-led pattern for that place (`TYPE_LED_SWAPS` — every
|
|
23
22
|
* slot carried, never cut), an opening on a photo or film with nothing to show is left out (the page opens on its
|
|
24
|
-
* type-led hero), a model-laid section
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* they were, so the caller's filled slots and its
|
|
23
|
+
* type-led hero), a model-laid section's empty photo stands in its own place as a ground plate of the look's colour — a
|
|
24
|
+
* composed page KEEPS its composition (2026-11-25, iox-ui#129 × #131): it is never handed back to ready-made sections —
|
|
25
|
+
* and a list whose items have no picture at all shows its cards without the picture part. Nothing is dropped from a
|
|
26
|
+
* page: plan indices, section ids and every other slot's node id stay as they were, so the caller's filled slots and its
|
|
27
|
+
* placements still name the same nodes.
|
|
28
28
|
*
|
|
29
29
|
* Pure: `composeSite` runs it when `ComposeContext.pictures` is given — absent, the plan composes exactly as it says.
|
|
30
30
|
* The plan the caller stores is never rewritten: the picture-led choice stays in it, so a later build or redesign that
|
|
@@ -77,13 +77,11 @@ export enum TypeLedChangeKind {
|
|
|
77
77
|
/** The home page's first screen had no picture to show: it opens type-led (`media:none`), a way no other site of the
|
|
78
78
|
* studio opens — or, when its first section cannot give its words slot by slot, on that section (the mix left out). */
|
|
79
79
|
Opening = 'opening',
|
|
80
|
-
/** A model-laid section
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
|
|
85
|
-
/** A model-laid page that could not give its empty photos away section by section is made from its plan sections. */
|
|
86
|
-
Layout = 'layout',
|
|
80
|
+
/** A model-laid section's empty photos (and an empty photo ground) are filled type-led in their own place: each a
|
|
81
|
+
* ground plate of the look's colour at the same layer, cell and motion — the composition kept (2026-11-25). The
|
|
82
|
+
* retired kinds `layout-section`, `layout-words` and `layout` handed composed sections or pages back to ready-made
|
|
83
|
+
* sections; a stored run's words for them stay as they were said. */
|
|
84
|
+
Plate = 'plate',
|
|
87
85
|
/** A list's items have no picture at all: its cards show no picture part. */
|
|
88
86
|
List = 'list',
|
|
89
87
|
}
|
|
@@ -171,7 +169,12 @@ export function typeLedSection(section: PageSectionPlan, density: string | null)
|
|
|
171
169
|
const linkSlots = new Set(patternLinkSlots(pattern));
|
|
172
170
|
const links = Object.fromEntries(Object.entries(section.links ?? {}).map(([slot, route]) => [target.slots[slot], route] as const).filter(([slot]) => !!slot && linkSlots.has(slot)));
|
|
173
171
|
const parts = new Set(patternOptionalParts(pattern));
|
|
174
|
-
|
|
172
|
+
// iox-ui#149: a part of the target that holds only slots the source has no place for would show the pattern's own
|
|
173
|
+
// sample ("The one sentence a reader should remember.") on the live site, words the picture-led section never
|
|
174
|
+
// showed — the swap leaves it out. (A slot the source has but left unsaid shows its sample either way.)
|
|
175
|
+
const mapped = new Set(Object.values(target.slots));
|
|
176
|
+
const unsaid = Object.entries(patternPartSlots(pattern)).filter(([, held]) => held.length && !held.some(s => mapped.has(s))).map(([part]) => part);
|
|
177
|
+
const without = [...new Set([...(section.without ?? []).filter(w => parts.has(w)), ...unsaid])];
|
|
175
178
|
const next: PageSectionPlan = {
|
|
176
179
|
pattern: target.pattern,
|
|
177
180
|
...(Object.keys(slots).length ? { slots } : {}),
|
|
@@ -225,56 +228,81 @@ function layerOf(nodeId: string): { section: number; layer: number } | null {
|
|
|
225
228
|
return m ? { section: Number(m[1]), layer: Number(m[2]) } : null;
|
|
226
229
|
}
|
|
227
230
|
|
|
228
|
-
/**
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
]);
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
231
|
+
/** A composed section's photo ground (`<page>-s<section>-ground`). */
|
|
232
|
+
const GROUND_NODE = /-s\d+-ground$/;
|
|
233
|
+
const PHOTO_GROUND = 'photo:';
|
|
234
|
+
/** The layer kinds whose picture a plate stands in for. */
|
|
235
|
+
const PICTURE_LAYERS: ReadonlySet<string> = new Set([LayoutLayerKind.Photo, LayoutLayerKind.Gallery]);
|
|
236
|
+
/** Word colours that read on a dark plate (the rest read on a light one). */
|
|
237
|
+
const LIGHT_WORDS: ReadonlySet<string> = new Set([LayoutColour.Ground, LayoutColour.Soft]);
|
|
238
|
+
|
|
239
|
+
/** The plates a section's ground takes, in order — the n-th plate of a section the n-th colour, so plates stacked in one
|
|
240
|
+
* cell still show their movement. Never the section's own ground. */
|
|
241
|
+
const PLATE_COLOURS: Readonly<Record<string, ReadonlyArray<LayoutColour>>> = {
|
|
242
|
+
[LayoutColour.Ground]: [LayoutColour.Soft, LayoutColour.Accent, LayoutColour.Ink],
|
|
243
|
+
[LayoutColour.Soft]: [LayoutColour.Ground, LayoutColour.Accent, LayoutColour.Ink],
|
|
244
|
+
[LayoutColour.Ink]: [LayoutColour.Accent, LayoutColour.Soft, LayoutColour.Ground],
|
|
245
|
+
[LayoutColour.Muted]: [LayoutColour.Soft, LayoutColour.Accent, LayoutColour.Ground],
|
|
246
|
+
[LayoutColour.Accent]: [LayoutColour.Ink, LayoutColour.Soft, LayoutColour.Ground],
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const cellsMeet = (a: Pick<LayoutLayer, 'col' | 'row'>, b: Pick<LayoutLayer, 'col' | 'row'>) =>
|
|
250
|
+
a.col[0] < b.col[1] && b.col[0] < a.col[1] && a.row[0] < b.row[1] && b.row[0] < a.row[1];
|
|
251
|
+
const lightWords = (l: LayoutLayer) => LIGHT_WORDS.has(String(l.color ?? LayoutColour.Ink));
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* The colour a ground plate stands in, in a section on `ground`: under words laid over it, the ground those words read
|
|
255
|
+
* on (light words → the ink, dark words → the soft — the ground when the section is soft); else the `nth` of the
|
|
256
|
+
* ground's rotation. A calm look never takes the accent. Pure.
|
|
257
|
+
*/
|
|
258
|
+
export function typeLedPlateColour(section: Pick<LayoutSection, 'layers'>, ground: string, plate: LayoutLayer, nth: number, calm: boolean): LayoutColour {
|
|
259
|
+
const over = section.layers.filter(o => o !== plate && LAYOUT_TEXT_KINDS.has(o.kind) && (o.z ?? 0) > (plate.z ?? 0) && cellsMeet(o, plate));
|
|
260
|
+
if (over.length) return over.some(lightWords) ? LayoutColour.Ink : ground === LayoutColour.Soft ? LayoutColour.Ground : LayoutColour.Soft;
|
|
261
|
+
const rotation = (PLATE_COLOURS[ground] ?? PLATE_COLOURS[LayoutColour.Ground]).filter(c => !calm || c !== LayoutColour.Accent);
|
|
262
|
+
return rotation[nth % rotation.length];
|
|
263
|
+
}
|
|
238
264
|
|
|
239
265
|
/**
|
|
240
|
-
* A model-laid section with its empty
|
|
241
|
-
*
|
|
242
|
-
*
|
|
266
|
+
* A model-laid section with its empty pictures filled type-led IN PLACE (2026-11-25, a composed page keeps its
|
|
267
|
+
* composition): each layer in `plates` becomes a ground plate — a `shape` at the same index, cell, depth, entrance and
|
|
268
|
+
* scroll motion (so every node id and the signature's mechanism stay), painted `typeLedPlateColour`; an empty photo
|
|
269
|
+
* ground (`ground`) becomes a plain ground the section's words read on (the ink under light words, else the soft). On a
|
|
270
|
+
* phone a shape is hidden, as every shape is: the words stack on the section's ground. Pure.
|
|
243
271
|
*/
|
|
244
|
-
export function
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const grown = beside ? Math.min(WORDS_MEASURE, GRID_COLUMNS, width + Math.max(...photos.map(p => p.col[1] - p.col[0]))) : width;
|
|
255
|
-
const start = beside ? 1 + Math.floor((GRID_COLUMNS - grown) / 2) : from;
|
|
256
|
-
const col = (c: number): number => (beside ? start + Math.round(((c - from) * grown) / width) : c);
|
|
257
|
-
const used = new Set<number>();
|
|
258
|
-
for (const { layer } of kept) for (let r = layer.row[0]; r < layer.row[1]; r++) used.add(r);
|
|
259
|
-
const line = (r: number): number => 1 + [...used].filter(u => u < r).length;
|
|
260
|
-
const rows = used.size;
|
|
261
|
-
const layers = kept.map(({ layer }) => {
|
|
262
|
-
const c0 = col(layer.col[0]);
|
|
263
|
-
return { ...layer, col: [c0, Math.max(c0 + 1, col(layer.col[1]))] as [number, number], row: [line(layer.row[0]), line(layer.row[1])] as [number, number] };
|
|
272
|
+
export function typeLedPlates(section: LayoutSection, plates: ReadonlySet<number>, ground: boolean, calm: boolean): LayoutSection {
|
|
273
|
+
const words = section.layers.filter(l => LAYOUT_TEXT_KINDS.has(l.kind));
|
|
274
|
+
const plain = words.some(lightWords) ? LayoutColour.Ink : LayoutColour.Soft;
|
|
275
|
+
const swapped = ground && String(section.ground ?? '').startsWith(PHOTO_GROUND);
|
|
276
|
+
const sectionGround = swapped ? plain : String(section.ground ?? LayoutColour.Ground);
|
|
277
|
+
let nth = 0;
|
|
278
|
+
const layers = section.layers.map((layer, i) => {
|
|
279
|
+
if (!plates.has(i) || !PICTURE_LAYERS.has(layer.kind)) return layer;
|
|
280
|
+
const { photo: _photo, gallery: _gallery, fit: _fit, inner: _inner, ...kept } = layer;
|
|
281
|
+
return { ...kept, kind: LayoutLayerKind.Shape, color: typeLedPlateColour(section, sectionGround, layer, nth++, calm) } as LayoutLayer;
|
|
264
282
|
});
|
|
265
|
-
|
|
266
|
-
const ground = section.ground?.startsWith(BOX_PHOTO) ? PLAIN_GROUND : section.ground;
|
|
267
|
-
const { phone, ...rest } = section;
|
|
268
|
-
const order = phone?.filter(i => index.has(i)).map(i => index.get(i)!);
|
|
269
|
-
return { ...rest, ...(ground !== undefined ? { ground } : {}), screens, rows, layers, ...(order?.length ? { phone: order } : {}) };
|
|
283
|
+
return { ...section, ...(swapped ? { ground: sectionGround } : {}), layers };
|
|
270
284
|
}
|
|
271
285
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
286
|
+
/** What a section of a model-laid page holds that nothing fills: its picture layers (every picture of each empty), its
|
|
287
|
+
* photo ground. */
|
|
288
|
+
interface LaidEmpty {
|
|
289
|
+
layers: Set<number>;
|
|
290
|
+
ground: boolean;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** How many picture placeholders each layer of a model-laid page holds (`<section>:<layer>`), filled or not. */
|
|
294
|
+
function picturesByLayer(placeholders: ReadonlyArray<ComposedPlaceholder>, owner: string, roots: ReadonlyMap<string, RootOf>): Map<string, number> {
|
|
295
|
+
const out = new Map<string, number>();
|
|
296
|
+
for (const p of placeholders) {
|
|
297
|
+
if (p.owner !== owner || !isPictureKind(p.kind)) continue;
|
|
298
|
+
const laid = roots.get(p.nodeId)?.laid ?? -1;
|
|
299
|
+
const at = layerOf(p.nodeId);
|
|
300
|
+
if (laid < 0 || !at || at.section !== laid) continue;
|
|
301
|
+
const key = `${laid}:${at.layer}`;
|
|
302
|
+
out.set(key, (out.get(key) ?? 0) + 1);
|
|
303
|
+
}
|
|
304
|
+
return out;
|
|
305
|
+
}
|
|
278
306
|
|
|
279
307
|
/** What a type-led round needs of the build beyond the plan: its tier and the studio's memory. */
|
|
280
308
|
export interface TypeLedRoundContext {
|
|
@@ -348,14 +376,16 @@ export function typeLedRound(
|
|
|
348
376
|
changes.push({ kind: TypeLedChangeKind.Section, page: page.key, at: i, from: section.pattern, to: led.to, said: `${page.name}: ${section.pattern} has no picture — ${led.to} says its words` });
|
|
349
377
|
return true;
|
|
350
378
|
};
|
|
379
|
+
const calm = CALM_ANIMATE.has(String(plan.design?.animate ?? ''));
|
|
351
380
|
const pages = plan.pages.map((page, p) => {
|
|
352
381
|
const made = composed.pages.find(c => c.key === page.key) ?? composed.pages[p];
|
|
353
382
|
const mine = empty.filter(e => e.owner === page.key);
|
|
354
383
|
if (!made || !mine.length) return page;
|
|
355
384
|
const roots = rootsOf(page, made.layout);
|
|
356
|
-
const laid = new Map<number,
|
|
385
|
+
const laid = new Map<number, LaidEmpty>();
|
|
357
386
|
const planAt = new Set<number>();
|
|
358
387
|
let first = false;
|
|
388
|
+
const laidOf = (i: number): LaidEmpty => laid.get(i) ?? laid.set(i, { layers: new Set(), ground: false }).get(i)!;
|
|
359
389
|
for (const e of mine) {
|
|
360
390
|
const where = roots.get(e.nodeId);
|
|
361
391
|
if (!where) continue;
|
|
@@ -363,9 +393,8 @@ export function typeLedRound(
|
|
|
363
393
|
if (where.opening) continue;
|
|
364
394
|
if (where.laid >= 0) {
|
|
365
395
|
const at = layerOf(e.nodeId);
|
|
366
|
-
|
|
367
|
-
if (
|
|
368
|
-
laid.set(where.laid, layers);
|
|
396
|
+
if (at && at.section === where.laid) laidOf(where.laid).layers.add(at.layer);
|
|
397
|
+
else if (GROUND_NODE.test(e.nodeId)) laidOf(where.laid).ground = true;
|
|
369
398
|
} else if (where.planAt >= 0) planAt.add(where.planAt);
|
|
370
399
|
}
|
|
371
400
|
let next: PagePlan = page;
|
|
@@ -376,46 +405,27 @@ export function typeLedRound(
|
|
|
376
405
|
if (swapSection(page, copy, i)) sections = copy;
|
|
377
406
|
}
|
|
378
407
|
if (sections) next = { ...next, sections };
|
|
379
|
-
// A section the model laid with a
|
|
380
|
-
//
|
|
381
|
-
// whole page from its sections when no place can be given away.
|
|
408
|
+
// A composed page KEEPS its composition (2026-11-25): a section the model laid with a picture nothing fills is
|
|
409
|
+
// filled type-led in its own place — never handed to a ready-made section, the page never made from its sections.
|
|
382
410
|
if (page.layout && laid.size) {
|
|
383
|
-
const
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
:
|
|
396
|
-
|
|
397
|
-
const { layout: _laid, ...rest } = next;
|
|
398
|
-
next = rest as PagePlan;
|
|
399
|
-
} else {
|
|
400
|
-
for (const swap of fallback.swaps) {
|
|
401
|
-
const kept = words.get(swap.at);
|
|
402
|
-
changes.push({
|
|
403
|
-
kind: kept ? TypeLedChangeKind.LayoutWords : TypeLedChangeKind.LayoutSection, page: page.key, at: swap.at, ...(swap.readyMade ? { to: swap.readyMade.pattern } : {}),
|
|
404
|
-
said: `${page.name}: section ${swap.at + 1} ${SAID_LAYOUT} — ${swap.readyMade ? `the ready-made ${swap.readyMade.pattern} stands there` : kept ? 'its words stay, its photos left out' : 'left out (it says nothing without its photos)'}`,
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
// The dropped places that keep their words go back where the model laid them.
|
|
408
|
-
const swapped = new Set(fallback.swaps.filter(w => w.action === SectionSwapAction.Dropped).map(w => w.at));
|
|
409
|
-
const left = [...fallback.page.sections];
|
|
410
|
-
const sectionsBack: LayoutSection[] = [];
|
|
411
|
-
page.layout.sections.forEach((_, i) => {
|
|
412
|
-
if (words.has(i)) sectionsBack.push(words.get(i)!);
|
|
413
|
-
else if (!swapped.has(i)) sectionsBack.push(left.shift()!);
|
|
411
|
+
const pictured = picturesByLayer(composed.placeholders, page.key, roots);
|
|
412
|
+
const unfilled = picturesByLayer(mine, page.key, roots);
|
|
413
|
+
let plated = false;
|
|
414
|
+
const laidSections = page.layout.sections.map((section, i) => {
|
|
415
|
+
const at = laid.get(i);
|
|
416
|
+
if (!at) return section;
|
|
417
|
+
// A layer becomes a plate only when no picture of it is filled (a gallery with one filled slide stays).
|
|
418
|
+
const plates = new Set([...at.layers].filter(li => PICTURE_LAYERS.has(section.layers[li]?.kind) && pictured.get(`${i}:${li}`) === unfilled.get(`${i}:${li}`)));
|
|
419
|
+
if (!plates.size && !at.ground) return section;
|
|
420
|
+
plated = true;
|
|
421
|
+
const n = plates.size;
|
|
422
|
+
changes.push({
|
|
423
|
+
kind: TypeLedChangeKind.Plate, page: page.key, at: i,
|
|
424
|
+
said: `${page.name}: section ${i + 1} (${section.id}) ${n ? `holds ${n === 1 ? 'a photo' : `${n} photos`} nothing fills — ${n === 1 ? 'it stands' : 'each stands'} as a plate of the look's colour in its place` : 'stands on a photo nothing fills — it stands on a ground of the look'}${n && at.ground ? ', on a ground of the look' : ''}, the composition kept`,
|
|
414
425
|
});
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
426
|
+
return typeLedPlates(section, plates, at.ground, calm);
|
|
427
|
+
});
|
|
428
|
+
if (plated) next = { ...next, layout: { ...page.layout, sections: laidSections } };
|
|
419
429
|
}
|
|
420
430
|
if (first) { firstScreen = next; homeAt = p; }
|
|
421
431
|
return next;
|