@vectoriox/iox-ui 5.141.0 → 5.142.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 +171 -2
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +358 -172
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1205 -591
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +49 -18
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +69 -4
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +464 -144
- package/harness-core/index.d.ts +18 -18
- package/index.d.ts +71 -2
- package/package.json +1 -1
- package/src/design-core/flavor-spec.generated.ts +141 -0
- package/src/design-core/ink-on-ground.ts +36 -0
- package/src/design-core/list-classes.ts +37 -0
- package/src/design-core/node-classes.ts +3 -2
- package/src/design-core/public-api.ts +2 -0
- package/src/generation-core/check-layout.ts +4 -1
- package/src/generation-core/check-list.ts +144 -5
- package/src/generation-core/compose-layout.ts +164 -19
- package/src/generation-core/compose-site.ts +8 -2
- package/src/generation-core/layout-fingerprint.ts +5 -1
- package/src/generation-core/layout-language.ts +5 -0
- package/src/generation-core/layout-wire.ts +64 -24
- package/src/generation-core/list-panel.ts +122 -0
- package/src/generation-core/list-space.ts +54 -1
- package/src/generation-core/list-table.ts +101 -0
- package/src/generation-core/node-baselines.generated.ts +3 -1
- package/src/generation-core/public-api.ts +1 -0
- package/src/generation-core/serialized-node.ts +2 -0
- package/src/generation-core/site-plan.model.ts +6 -0
- package/src/generation-core/site-spec.generated.ts +188 -70
- package/src/generation-core/validate-site-plan.ts +8 -4
- package/src/harness-core/harness-spec.generated.ts +49 -18
- package/styles/iox-design.css +376 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
LayoutListHow, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutListWho, LayoutPage, LayoutSection, LayoutTrack,
|
|
7
7
|
} from './layout-language';
|
|
8
8
|
import { isPlainObject, PlainObject } from './shape-check';
|
|
9
|
-
import { LIST_INGREDIENTS, LIST_TABLE, listBuiltWords, listIngredientWords } from './list-table';
|
|
9
|
+
import { LIST_INGREDIENTS, LIST_TABLE, listBuiltWords, listIngredientWords, listWordOffered, listWordRefusal } from './list-table';
|
|
10
10
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
11
11
|
import type { LayoutListNever } from './check-list';
|
|
12
12
|
|
|
@@ -50,12 +50,16 @@ export enum LayoutMixIngredient {
|
|
|
50
50
|
Phone = 'phone',
|
|
51
51
|
}
|
|
52
52
|
const MIX_SEPARATOR = ':';
|
|
53
|
+
const BASIC = 'basic';
|
|
54
|
+
const AWARD = 'award';
|
|
53
55
|
const PART_SEPARATOR = '.';
|
|
54
56
|
/** Every word a stored mix may hold, ingredient by ingredient (a waiting word too: a stored answer still reads). */
|
|
55
57
|
export const LAYOUT_MIX_WORDS: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listIngredientWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
56
|
-
/** The words the wire OFFERS — the built ones only (ingredients.md §3.3
|
|
57
|
-
* site that asked for it. */
|
|
58
|
-
export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
58
|
+
/** The words the wire OFFERS a site below the award tier — the built ones only (ingredients.md §3.3: a waiting word would
|
|
59
|
+
* put its stand-in on every site that asked for it), less the award tier's (AW-D23, AW11). */
|
|
60
|
+
export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).filter(w => listWordOffered(k, w, BASIC)).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
61
|
+
/** AW11: every built word, the award tier's included — what the wire offers an award site before the lists are read. */
|
|
62
|
+
export const LAYOUT_MIX_OFFERED_AWARD: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
59
63
|
|
|
60
64
|
/** A list a composed page may show, as the wire's parts enum needs it (`layoutListShapes` gives these). */
|
|
61
65
|
export interface LayoutWireList { alias: string; roles: ReadonlyArray<string> }
|
|
@@ -66,6 +70,9 @@ export interface LayoutWireOptions {
|
|
|
66
70
|
lists?: ReadonlyArray<LayoutWireList>;
|
|
67
71
|
/** L-D12: what this business type's lists never do — those words are not offered (the check repairs one anyway). */
|
|
68
72
|
never?: LayoutListNever | null;
|
|
73
|
+
/** AW-D23 (AW11): the tier the site is built at — the award tier alone is offered the round-two list words. Absent:
|
|
74
|
+
* below it (no property changes either way). */
|
|
75
|
+
tier?: string | null;
|
|
69
76
|
/** A redesign (site-redesign RD2, H3): THIS page's carry handles (`carryHandles`) — given, every layer carries `carry`,
|
|
70
77
|
* closed to these handles: a model can place only the page's own parts (one property: 38, 40 with lists). */
|
|
71
78
|
carry?: ReadonlyArray<string>;
|
|
@@ -98,10 +105,28 @@ export function isSectionCarryHandle(handle: string): boolean {
|
|
|
98
105
|
return SECTION_HANDLE.test(handle);
|
|
99
106
|
}
|
|
100
107
|
|
|
101
|
-
/**
|
|
102
|
-
|
|
108
|
+
/** AW11: what else decides a word's offer — the tier (absent: below the award tier) and the plan's lists (absent: not
|
|
109
|
+
* judged). */
|
|
110
|
+
export interface LayoutMixOfferOptions {
|
|
111
|
+
readonly tier?: string | null;
|
|
112
|
+
readonly lists?: ReadonlyArray<LayoutWireList>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The mix words offered to a business whose lists never do `never` (L-D12): the built words less the forbidden ones —
|
|
117
|
+
* and since AW11, the award tier's only to an award site, and a word NO list of the plan can carry (a second picture, a
|
|
118
|
+
* picture at all) never (R-H-AW11-7: the one table, `listWordRefusal`; `checkList` judges each list).
|
|
119
|
+
*/
|
|
120
|
+
export function layoutMixOffered(never?: LayoutListNever | null, options: LayoutMixOfferOptions = {}): string[] {
|
|
103
121
|
const banned = new Set([...(never?.arranges ?? []).map(w => `arrange${MIX_SEPARATOR}${w}`), ...(never?.moves ?? []).map(w => `move${MIX_SEPARATOR}${w}`)]);
|
|
104
|
-
|
|
122
|
+
const offered = options.tier === AWARD ? LAYOUT_MIX_OFFERED_AWARD : LAYOUT_MIX_OFFERED;
|
|
123
|
+
const lists = options.lists;
|
|
124
|
+
return offered.filter(w => {
|
|
125
|
+
if (banned.has(w)) return false;
|
|
126
|
+
if (!lists?.length) return true;
|
|
127
|
+
const [k, word] = w.split(MIX_SEPARATOR) as [typeof LIST_INGREDIENTS[number], string];
|
|
128
|
+
return lists.some(l => listWordRefusal(k, word, l) === null);
|
|
129
|
+
});
|
|
105
130
|
}
|
|
106
131
|
const mixHint = (offered: ReadonlyArray<string>) => LIST_INGREDIENTS.map(k => {
|
|
107
132
|
const words = offered.filter(w => w.startsWith(`${k}${MIX_SEPARATOR}`)).map(w => w.slice(k.length + MIX_SEPARATOR.length));
|
|
@@ -140,9 +165,11 @@ const closed = (properties: Record<string, JsonSchema>, d?: string) => jsonClose
|
|
|
140
165
|
/** The strict format for one composed page — with the list ingredients when `options.lists` is given. */
|
|
141
166
|
export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchema {
|
|
142
167
|
const partWords = options.lists ? layoutWirePartWords(options.lists) : [];
|
|
168
|
+
// A list (round one) keeps today's offer exactly: the plan's lists narrow only what the award tier adds.
|
|
169
|
+
const mixOffered = options.tier === AWARD ? layoutMixOffered(options.never, { tier: AWARD, lists: options.lists }) : layoutMixOffered(options.never);
|
|
143
170
|
const lists: Record<string, JsonSchema> = options.lists
|
|
144
171
|
? {
|
|
145
|
-
mix: listOf(jsonOneOf(
|
|
172
|
+
mix: listOf(jsonOneOf(mixOffered), `gallery showing a list (source): how its items are shown, one word per choice — ${mixHint(mixOffered)}; [] for none`),
|
|
146
173
|
parts: listOf(jsonOneOf(partWords.length ? partWords : [NONE]), "gallery showing a list as cards: the list's fields each card shows, <list>.<role>, the source's own; [] for none"),
|
|
147
174
|
}
|
|
148
175
|
: {};
|
|
@@ -236,6 +263,21 @@ function expandGallery(l: PlainObject, flags: ReadonlySet<string>, variant: stri
|
|
|
236
263
|
* parts of another list than the gallery's are left out, and the first part names the list when `source` is empty. */
|
|
237
264
|
function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix | null {
|
|
238
265
|
const words = strings(l['mix']);
|
|
266
|
+
if (!words.length) return null;
|
|
267
|
+
const parts = strings(l['parts']).filter(p => p !== NONE).map(p => {
|
|
268
|
+
const at = p.lastIndexOf(PART_SEPARATOR);
|
|
269
|
+
return at > 0 ? { list: p.slice(0, at), role: p.slice(at + 1) } : null;
|
|
270
|
+
}).filter((p): p is { list: string; role: string } => !!p);
|
|
271
|
+
if (!gallery.source && parts[0]) gallery.source = parts[0].list;
|
|
272
|
+
return listMixFromWords(words, parts.filter(p => p.list === gallery.source).map(p => p.role));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* `<ingredient>:<word>` words (the wire's `mix`, or what a composed list's frame stores — design-core `LIST_MIX_PROP`)
|
|
277
|
+
* and the roles each item shows → a list mix, or null when there are no words. Words are kept as written (`checkList`
|
|
278
|
+
* judges them); what is not named takes the wire's defaults. Bindings ▸ List reads a list back through this.
|
|
279
|
+
*/
|
|
280
|
+
export function listMixFromWords(words: ReadonlyArray<string>, parts: ReadonlyArray<string> = []): LayoutListMix | null {
|
|
239
281
|
if (!words.length) return null;
|
|
240
282
|
const picked = new Map<string, string[]>();
|
|
241
283
|
for (const w of words) {
|
|
@@ -243,12 +285,7 @@ function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix |
|
|
|
243
285
|
if (at > 0) (picked.get(w.slice(0, at)) ?? picked.set(w.slice(0, at), []).get(w.slice(0, at))!).push(w.slice(at + 1));
|
|
244
286
|
}
|
|
245
287
|
const one = (k: LayoutMixIngredient) => picked.get(k)?.[0];
|
|
246
|
-
const
|
|
247
|
-
const at = p.lastIndexOf(PART_SEPARATOR);
|
|
248
|
-
return at > 0 ? { list: p.slice(0, at), role: p.slice(at + 1) } : null;
|
|
249
|
-
}).filter((p): p is { list: string; role: string } => !!p);
|
|
250
|
-
if (!gallery.source && parts[0]) gallery.source = parts[0].list;
|
|
251
|
-
const own = parts.filter(p => p.list === gallery.source).map(p => p.role);
|
|
288
|
+
const own = [...parts];
|
|
252
289
|
const arrange = (one(LayoutMixIngredient.Arrange) ?? LayoutListArrange.Row) as LayoutListMix['arrange'];
|
|
253
290
|
const who = one(LayoutMixIngredient.Who);
|
|
254
291
|
const how = one(LayoutMixIngredient.How);
|
|
@@ -264,18 +301,21 @@ function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix |
|
|
|
264
301
|
};
|
|
265
302
|
}
|
|
266
303
|
|
|
304
|
+
/** A list mix's words, `<ingredient>:<word>` — the wire's `mix`, and what a composed list's frame stores (AW11,
|
|
305
|
+
* design-core `LIST_MIX_PROP`) for Bindings ▸ List and the shared CSS. */
|
|
306
|
+
export function listMixWords(mix: LayoutListMix): string[] {
|
|
307
|
+
const w = (k: LayoutMixIngredient, v: string) => `${k}${MIX_SEPARATOR}${v}`;
|
|
308
|
+
return [
|
|
309
|
+
w(LayoutMixIngredient.Item, mix.item), w(LayoutMixIngredient.Arrange, mix.arrange),
|
|
310
|
+
...(mix.standout ? [w(LayoutMixIngredient.Who, mix.standout.who), ...(mix.standout.how ? [w(LayoutMixIngredient.How, mix.standout.how)] : [])] : []),
|
|
311
|
+
...mix.move.map(m => w(LayoutMixIngredient.Move, m)), ...mix.hover.map(h => w(LayoutMixIngredient.Hover, h)),
|
|
312
|
+
w(LayoutMixIngredient.Arrive, mix.arrive), w(LayoutMixIngredient.Phone, mix.phone),
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
|
|
267
316
|
/** A list mix → the wire's `mix` words and `parts`. */
|
|
268
317
|
function listMixToWire(mix: LayoutListMix, source: string): { mix: string[]; parts: string[] } {
|
|
269
|
-
|
|
270
|
-
return {
|
|
271
|
-
mix: [
|
|
272
|
-
w(LayoutMixIngredient.Item, mix.item), w(LayoutMixIngredient.Arrange, mix.arrange),
|
|
273
|
-
...(mix.standout ? [w(LayoutMixIngredient.Who, mix.standout.who), ...(mix.standout.how ? [w(LayoutMixIngredient.How, mix.standout.how)] : [])] : []),
|
|
274
|
-
...mix.move.map(m => w(LayoutMixIngredient.Move, m)), ...mix.hover.map(h => w(LayoutMixIngredient.Hover, h)),
|
|
275
|
-
w(LayoutMixIngredient.Arrive, mix.arrive), w(LayoutMixIngredient.Phone, mix.phone),
|
|
276
|
-
],
|
|
277
|
-
parts: mix.parts.map(r => `${source}${PART_SEPARATOR}${r}`),
|
|
278
|
-
};
|
|
318
|
+
return { mix: listMixWords(mix), parts: mix.parts.map(r => `${source}${PART_SEPARATOR}${r}`) };
|
|
279
319
|
}
|
|
280
320
|
|
|
281
321
|
function expandTrack(t: PlainObject): LayoutTrack {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { checkList, LayoutListNever } from './check-list';
|
|
2
|
+
import {
|
|
3
|
+
LayoutIssue, LayoutIssueCode, LayoutListHow, LayoutListMix, LayoutListShape, LayoutListWho, LayoutMendKind,
|
|
4
|
+
} from './layout-language';
|
|
5
|
+
import {
|
|
6
|
+
LIST_INGREDIENTS, LIST_TABLE, ListIngredient, ListWordRefusal, listBuiltWords, listMeaning, listWordRefusal, listWordTier,
|
|
7
|
+
} from './list-table';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Bindings ▸ List (AW11-D18, board award-lists "Where an owner sets it"): the rows of the ONE list group, framework-free so
|
|
11
|
+
* the host (cms-client's Bindings panel) only draws them. P1 — the rows ARE the contract's ingredients and words (the
|
|
12
|
+
* same words the model writes, each with its meaning as the hint), so the panel can never offer a word the model can't
|
|
13
|
+
* write or the composer can't draw. P2 — a word the list's data can't carry is disabled with its reason (the same rule
|
|
14
|
+
* as the wire's per-list offer, `listWordRefusal`). P3 — what `checkList` mends after a pick is SAID under the group.
|
|
15
|
+
* Below Pro the round-two words show with the plan mark and cannot be picked (AW-D23).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** One word of a row. */
|
|
19
|
+
export interface ListPanelWord {
|
|
20
|
+
readonly word: string;
|
|
21
|
+
/** The contract's meaning — the row's hint. */
|
|
22
|
+
readonly meaning: string;
|
|
23
|
+
/** A round-two word (the plan mark). */
|
|
24
|
+
readonly pro: boolean;
|
|
25
|
+
/** A hover word: phones never show it, so its hint says "(mouse)" (P4). */
|
|
26
|
+
readonly mouse: boolean;
|
|
27
|
+
/** Why it cannot be picked, or null. */
|
|
28
|
+
readonly refusal: ListWordRefusal | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** One row of the group: an ingredient, its words, what the list wears now. */
|
|
32
|
+
export interface ListPanelRow {
|
|
33
|
+
readonly ingredient: ListIngredient;
|
|
34
|
+
/** Several words at once (move, hover) — a multi-select. */
|
|
35
|
+
readonly many: boolean;
|
|
36
|
+
readonly words: ReadonlyArray<ListPanelWord>;
|
|
37
|
+
/** The word(s) the list wears. */
|
|
38
|
+
readonly value: string | ReadonlyArray<string>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** What the panel is judged against. */
|
|
42
|
+
export interface ListPanelContext {
|
|
43
|
+
/** The list the section shows (`layoutListShapes`), or null when unknown — nothing is refused for its data then. */
|
|
44
|
+
readonly shape: LayoutListShape | null;
|
|
45
|
+
/** The studio's plan tier (`award` wears every word); absent: nothing is held back for the plan. */
|
|
46
|
+
readonly tier?: string | null;
|
|
47
|
+
/** The business type's never rule (`LIST_NEVER`). */
|
|
48
|
+
readonly never?: LayoutListNever | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const MANY: ReadonlySet<string> = new Set(LIST_TABLE.many as ReadonlyArray<string>);
|
|
52
|
+
const HOVER: ListIngredient = 'hover';
|
|
53
|
+
|
|
54
|
+
/** The word(s) a mix wears for an ingredient. */
|
|
55
|
+
export function listMixValue(mix: LayoutListMix, k: ListIngredient): string | ReadonlyArray<string> {
|
|
56
|
+
switch (k) {
|
|
57
|
+
case 'who': return mix.standout?.who ?? LayoutListWho.None;
|
|
58
|
+
case 'how': return mix.standout?.how ?? String((LIST_TABLE.defaults as unknown as Readonly<Record<string, unknown>>)['how']);
|
|
59
|
+
case 'move': return mix.move;
|
|
60
|
+
case 'hover': return mix.hover;
|
|
61
|
+
default: return (mix as unknown as Record<string, string>)[k];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The group's rows for a list — every ingredient the product draws, in the table's order. */
|
|
66
|
+
export function listPanelRows(mix: LayoutListMix, ctx: ListPanelContext): ListPanelRow[] {
|
|
67
|
+
return LIST_INGREDIENTS.map(k => ({
|
|
68
|
+
ingredient: k,
|
|
69
|
+
many: MANY.has(k),
|
|
70
|
+
value: listMixValue(mix, k),
|
|
71
|
+
words: listBuiltWords(k).map(word => ({
|
|
72
|
+
word,
|
|
73
|
+
meaning: listMeaning(k, word),
|
|
74
|
+
pro: listWordTier(k, word) === 'pro',
|
|
75
|
+
mouse: k === HOVER,
|
|
76
|
+
refusal: listWordRefusal(k, word, ctx.shape, ctx.tier, ctx.never),
|
|
77
|
+
})),
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A pick's outcome: the mix the list is recomposed with, what the harness mended (said under the group), and what it
|
|
82
|
+
* refused (the pick is not applied). */
|
|
83
|
+
export interface ListPick {
|
|
84
|
+
readonly mix: LayoutListMix;
|
|
85
|
+
readonly said: ReadonlyArray<string>;
|
|
86
|
+
readonly refused: ReadonlyArray<LayoutIssue>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The mix with one ingredient set (a single word) or toggled (a word of a `many` ingredient). Pure. */
|
|
90
|
+
export function withListWord(mix: LayoutListMix, k: ListIngredient, word: string): LayoutListMix {
|
|
91
|
+
const next: LayoutListMix = structuredClone(mix);
|
|
92
|
+
if (k === 'move' || k === 'hover') {
|
|
93
|
+
const list = next[k] as string[];
|
|
94
|
+
(next as unknown as Record<string, string[]>)[k] = list.includes(word) ? list.filter(w => w !== word) : [...list, word];
|
|
95
|
+
} else if (k === 'who') {
|
|
96
|
+
if (word === LayoutListWho.None) delete next.standout;
|
|
97
|
+
else next.standout = { who: word as LayoutListWho, ...(next.standout?.how ? { how: next.standout.how } : {}) };
|
|
98
|
+
} else if (k === 'how') {
|
|
99
|
+
next.standout = { who: next.standout?.who ?? LayoutListWho.First, how: word as LayoutListHow };
|
|
100
|
+
} else {
|
|
101
|
+
(next as unknown as Record<string, string>)[k] = word;
|
|
102
|
+
}
|
|
103
|
+
return next;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The owner picks a word: refused outright when the word cannot be picked here (the row shows why), else the new mix
|
|
108
|
+
* judged by the ONE `checkList` — its mends applied and said, its refusals returned (the list stays as it was). Pure.
|
|
109
|
+
*/
|
|
110
|
+
export function pickListWord(mix: LayoutListMix, k: ListIngredient, word: string, ctx: ListPanelContext): ListPick {
|
|
111
|
+
const refusal = listWordRefusal(k, word, ctx.shape, ctx.tier, ctx.never);
|
|
112
|
+
const adding = !(k === 'move' || k === 'hover') || !(mix[k] as string[]).includes(word);
|
|
113
|
+
if (refusal && adding) {
|
|
114
|
+
return { mix, said: [], refused: [{ code: LayoutIssueCode.Value, path: `list.${k}`, message: `${k} "${word}": ${refusal}` }] };
|
|
115
|
+
}
|
|
116
|
+
const next = withListWord(mix, k, word);
|
|
117
|
+
const issues = checkList(next, ctx.shape, 'list', ctx.never, { tier: ctx.tier });
|
|
118
|
+
const refused = issues.filter(i => !i.mend);
|
|
119
|
+
if (refused.length) return { mix, said: [], refused };
|
|
120
|
+
const mend = issues.map(i => i.mend).find(m => m?.kind === LayoutMendKind.List);
|
|
121
|
+
return { mix: mend?.kind === LayoutMendKind.List ? mend.mix : next, said: issues.map(i => i.message), refused: [] };
|
|
122
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
LAYOUT_TEXT_KINDS, LayoutLayer, LayoutLayerKind, LayoutListArrange, LayoutRole, LayoutSection, LayoutSize,
|
|
2
|
+
LAYOUT_TEXT_KINDS, LayoutLayer, LayoutLayerKind, LayoutListArrange, LayoutListHover, LayoutListMix, LayoutRole, LayoutSection, LayoutSize,
|
|
3
3
|
} from './layout-language';
|
|
4
|
+
import { LIST_RHYTHMS } from './list-table';
|
|
4
5
|
import { LAYOUT_CHECK_VIEWPORT, layoutTextFits } from './layout-space';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -150,3 +151,55 @@ export function layoutListPair(s: LayoutSection, li: number, side: `${LayoutList
|
|
|
150
151
|
next.phone = [...first, ...was.filter(i => !first.includes(i)), ...next.layers.map((_, i) => i).filter(i => !first.includes(i) && !was.includes(i))];
|
|
151
152
|
return next;
|
|
152
153
|
}
|
|
154
|
+
|
|
155
|
+
// ── AW11 (board award-lists, rule 2 "never cut"): the room a list paints past its items' boxes ─────────────────────
|
|
156
|
+
|
|
157
|
+
/** The room a list's frame keeps around its items, in px at the check's laptop: what leans, hangs or turns paints past
|
|
158
|
+
* its box, and its section clips (`overflow: clip`) — so the room is reserved INSIDE the frame, never left to chance. */
|
|
159
|
+
export interface ListOverhang {
|
|
160
|
+
blockStart: number;
|
|
161
|
+
blockEnd: number;
|
|
162
|
+
inline: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The box a turned item is measured on (a card a third of the laptop's row). */
|
|
166
|
+
const TURNED_ITEM = { width: 360, height: 480 } as const;
|
|
167
|
+
/** A card's own lift under the mouse (the look's card-lift is at most this), added where an item may rise. */
|
|
168
|
+
const LIFT_ROOM = 8;
|
|
169
|
+
const deg = (d: number) => (d * Math.PI) / 180;
|
|
170
|
+
const up4 = (px: number) => Math.ceil(px / 4) * 4;
|
|
171
|
+
/** How far a box's corner passes its own edge, turned by `d` degrees about its middle. */
|
|
172
|
+
function turnRoom(d: number): { block: number; inline: number } {
|
|
173
|
+
const t = deg(Math.abs(d));
|
|
174
|
+
const { width: w, height: h } = TURNED_ITEM;
|
|
175
|
+
return { block: (w / 2) * Math.sin(t) + (h / 2) * (1 - Math.cos(t)), inline: (h / 2) * Math.sin(t) + (w / 2) * (1 - Math.cos(t)) };
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The room a list mix keeps (AW11, R-H-AW11-2) — from the contract's rhythms, never a guess: a gallery wall's items hang
|
|
180
|
+
* by margins (real room, inside the list), so it keeps only the lift of a picture under the mouse; a tilted list turns
|
|
181
|
+
* its items up to `tiltMaxDeg`; a hover tilt turns a card's ground by `hoverTiltDeg`. A fan holds its arc in its own
|
|
182
|
+
* height (the shared CSS), so it needs none here. Pure.
|
|
183
|
+
*/
|
|
184
|
+
export function listOverhang(mix: Pick<LayoutListMix, 'arrange' | 'hover'>): ListOverhang {
|
|
185
|
+
let blockStart = 0;
|
|
186
|
+
let blockEnd = 0;
|
|
187
|
+
let inline = 0;
|
|
188
|
+
if (mix.arrange === LayoutListArrange.Hang) {
|
|
189
|
+
blockStart = LIFT_ROOM;
|
|
190
|
+
blockEnd = LIFT_ROOM;
|
|
191
|
+
}
|
|
192
|
+
if (mix.arrange === LayoutListArrange.Tilted) {
|
|
193
|
+
const room = turnRoom(LIST_RHYTHMS.tiltMaxDeg);
|
|
194
|
+
blockStart = Math.max(blockStart, room.block + LIFT_ROOM);
|
|
195
|
+
blockEnd = Math.max(blockEnd, room.block);
|
|
196
|
+
inline = Math.max(inline, room.inline);
|
|
197
|
+
}
|
|
198
|
+
if ((mix.hover ?? []).includes(LayoutListHover.Tilt)) {
|
|
199
|
+
const room = turnRoom(LIST_RHYTHMS.hoverTiltDeg);
|
|
200
|
+
blockStart = Math.max(blockStart, room.block);
|
|
201
|
+
blockEnd = Math.max(blockEnd, room.block);
|
|
202
|
+
inline = Math.max(inline, room.inline);
|
|
203
|
+
}
|
|
204
|
+
return { blockStart: up4(blockStart), blockEnd: up4(blockEnd), inline: up4(inline) };
|
|
205
|
+
}
|
|
@@ -37,3 +37,104 @@ export function listBuiltWords(k: ListIngredient): string[] {
|
|
|
37
37
|
export function listMeaning(k: ListIngredient, word: string): string {
|
|
38
38
|
return MEANINGS[`${k}.${word}`] ?? word;
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
// ── AW11 (award-ingredients-plan.md §7.1f, board award-lists): the award tier, the rhythms, what each word needs ─────
|
|
42
|
+
|
|
43
|
+
/** AW-D23: a word every plan wears (`all`) or the award tier's alone (`pro`). */
|
|
44
|
+
export function listWordTier(k: ListIngredient, word: string): 'all' | 'pro' {
|
|
45
|
+
return (LIST_TABLE.tiers as Readonly<Record<string, string>>)[`${k}.${word}`] === 'pro' ? 'pro' : 'all';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** May a build at `tier` wear this word? (`award` wears every word; anything else the `all` ones.) */
|
|
49
|
+
export function listWordOffered(k: ListIngredient, word: string, tier?: string | null): boolean {
|
|
50
|
+
return listWordTier(k, word) === 'all' || tier === 'award';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The word a round-two word is drawn as below the award tier (null: left out), from the contract's `belowPro`. */
|
|
54
|
+
export function listBelowPro(k: ListIngredient, word: string): string | null | undefined {
|
|
55
|
+
const stand = (LIST_TABLE.belowPro as Readonly<Record<string, string | null>>)[`${k}.${word}`];
|
|
56
|
+
return stand === undefined ? undefined : stand;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** One step of a gallery wall: its share of a 12-column row and how far it hangs below the row's line (px). */
|
|
60
|
+
/** One step of the gallery wall: its share of a 12-column row, the bare columns before it (`start`), the margin it hangs
|
|
61
|
+
* below its row's line by, and its picture's shape. */
|
|
62
|
+
export interface ListHangStep { span: number; start?: number; drop: number; ratio: string }
|
|
63
|
+
|
|
64
|
+
/** The numbers the round-two arrangements are drawn with (the contract's `rhythms`, AW11-D3) — never the model's. */
|
|
65
|
+
export const LIST_RHYTHMS = LIST_TABLE.rhythms as unknown as {
|
|
66
|
+
readonly hang: ReadonlyArray<ListHangStep>;
|
|
67
|
+
readonly bento: ReadonlyArray<number>;
|
|
68
|
+
readonly tilt: ReadonlyArray<number>;
|
|
69
|
+
readonly tiltMaxDeg: number;
|
|
70
|
+
readonly fanRadius: number;
|
|
71
|
+
readonly hoverTiltDeg: number;
|
|
72
|
+
readonly hoverSettle: number;
|
|
73
|
+
readonly clipUpRise: number;
|
|
74
|
+
readonly numberBehindInk: number;
|
|
75
|
+
readonly colourRamp: ReadonlyArray<{ readonly ground: string; readonly ink: string }>;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** The rules `checkList` holds, typed (the contract's `rules`). */
|
|
79
|
+
export const LIST_RULES = LIST_TABLE.rules as unknown as {
|
|
80
|
+
readonly minItems: number;
|
|
81
|
+
readonly strips: readonly [number, number];
|
|
82
|
+
readonly onlyStrips: { readonly how: ReadonlyArray<string>; readonly hover: ReadonlyArray<string> };
|
|
83
|
+
readonly onlyRow: { readonly who: ReadonlyArray<string>; readonly move: ReadonlyArray<string> };
|
|
84
|
+
readonly moving: ReadonlyArray<string>;
|
|
85
|
+
readonly neverSwipe: ReadonlyArray<string>;
|
|
86
|
+
readonly alone: ReadonlyArray<string>;
|
|
87
|
+
readonly counts: Readonly<Record<string, readonly [number, number]>>;
|
|
88
|
+
readonly bento: ReadonlyArray<number>;
|
|
89
|
+
readonly fanDragFrom: number;
|
|
90
|
+
readonly leaning: ReadonlyArray<string>;
|
|
91
|
+
readonly pictured: Readonly<Partial<Record<ListIngredient, ReadonlyArray<string>>>>;
|
|
92
|
+
readonly secondPicture: Readonly<Partial<Record<ListIngredient, ReadonlyArray<string>>>>;
|
|
93
|
+
readonly still: Readonly<Partial<Record<ListIngredient, ReadonlyArray<string>>>>;
|
|
94
|
+
readonly titleOnPhotoWords: number;
|
|
95
|
+
readonly rowsStandout: { readonly who: string; readonly how: string };
|
|
96
|
+
readonly middle?: ReadonlyArray<string>;
|
|
97
|
+
readonly notFirstScreen: Readonly<Partial<Record<ListIngredient, ReadonlyArray<string>>>>;
|
|
98
|
+
readonly onlyPictures: Readonly<Partial<Record<ListIngredient, ReadonlyArray<string>>>>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** The largest bento fill a list of `items` can show without a hole (3, 5 or 7), or null under the smallest. */
|
|
102
|
+
export function bentoFill(items: number): number | null {
|
|
103
|
+
const fills = LIST_RULES.bento.filter(n => n <= items);
|
|
104
|
+
return fills.length ? fills[fills.length - 1] : null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Why a list cannot carry a word (R-H-AW11-7 — ONE table for the wire, the judge and Bindings ▸ List). */
|
|
108
|
+
export enum ListWordRefusal {
|
|
109
|
+
/** The award tier's word, on a plan below it (AW-D23). */
|
|
110
|
+
ProOnly = 'pro-only',
|
|
111
|
+
/** The word shows a picture in every item, and the list has none. */
|
|
112
|
+
NoPictures = 'no-pictures',
|
|
113
|
+
/** The word shows a second picture (the gallery role), and the list has none (AW11-D12). */
|
|
114
|
+
NoSecondPicture = 'no-second-picture',
|
|
115
|
+
/** The business type's lists never take it (L-D12, AW11-D7). */
|
|
116
|
+
Never = 'never',
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** What a list holds, as the word table reads it: its roles. */
|
|
120
|
+
export interface ListWordShape { readonly roles: ReadonlyArray<string> }
|
|
121
|
+
|
|
122
|
+
/** What a business's lists never do, as the word table reads it (`LayoutListNever`). */
|
|
123
|
+
export interface ListWordNever { readonly arranges: ReadonlyArray<string>; readonly moves: ReadonlyArray<string> }
|
|
124
|
+
|
|
125
|
+
const inRule = (rule: Readonly<Partial<Record<ListIngredient, ReadonlyArray<string>>>>, k: ListIngredient, w: string) => !!rule[k]?.includes(w);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Can this list carry this word — and if not, why (R-H-AW11-7)? The ONE answer the wire's offer, `checkList` and
|
|
129
|
+
* Bindings ▸ List read: a word the list's data cannot carry is never offered, never picked. `shape` null: nothing is
|
|
130
|
+
* known of the list (any word its tier allows). `tier` absent: no tier is judged (the judge's own tier step, the owner's
|
|
131
|
+
* builder).
|
|
132
|
+
*/
|
|
133
|
+
export function listWordRefusal(k: ListIngredient, word: string, shape: ListWordShape | null, tier?: string | null, never?: ListWordNever | null): ListWordRefusal | null {
|
|
134
|
+
if (tier !== undefined && tier !== null && !listWordOffered(k, word, tier)) return ListWordRefusal.ProOnly;
|
|
135
|
+
if (never && ((k === 'arrange' && never.arranges.includes(word)) || (k === 'move' && never.moves.includes(word)))) return ListWordRefusal.Never;
|
|
136
|
+
if (!shape) return null;
|
|
137
|
+
if (inRule(LIST_RULES.pictured, k, word) && !shape.roles.includes('image')) return ListWordRefusal.NoPictures;
|
|
138
|
+
if (inRule(LIST_RULES.secondPicture, k, word) && !shape.roles.includes('gallery')) return ListWordRefusal.NoSecondPicture;
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
@@ -706,7 +706,8 @@ export const NODE_BASELINES: Readonly<Record<string, NodeBaseline>> = {
|
|
|
706
706
|
"marqueeFade",
|
|
707
707
|
"marqueePauseOnHover",
|
|
708
708
|
"seam",
|
|
709
|
-
"sectionShape"
|
|
709
|
+
"sectionShape",
|
|
710
|
+
"listMix"
|
|
710
711
|
],
|
|
711
712
|
"styleTraits": [
|
|
712
713
|
"position",
|
|
@@ -3251,6 +3252,7 @@ export const NODE_BASELINES: Readonly<Record<string, NodeBaseline>> = {
|
|
|
3251
3252
|
"__effectsLabel",
|
|
3252
3253
|
"effect",
|
|
3253
3254
|
"speed",
|
|
3255
|
+
"creativePreset",
|
|
3254
3256
|
"scrollPlays",
|
|
3255
3257
|
"__navLabel",
|
|
3256
3258
|
"controlsPlacement",
|
|
@@ -64,6 +64,7 @@ export * from './check-list';
|
|
|
64
64
|
export * from './list-table';
|
|
65
65
|
export * from './layout-space';
|
|
66
66
|
export * from './list-space';
|
|
67
|
+
export * from './list-panel';
|
|
67
68
|
export * from './layout-fingerprint';
|
|
68
69
|
export * from './header-mix';
|
|
69
70
|
export * from './header-edit';
|
|
@@ -14,6 +14,8 @@ export interface SerializedBinding {
|
|
|
14
14
|
prop: string;
|
|
15
15
|
source: string;
|
|
16
16
|
path: string;
|
|
17
|
+
/** Render-time transforms (iox-ui `applyBindingPipes`) — AW11's colour block writes its ground and ink pipes. */
|
|
18
|
+
pipes?: Array<{ name: string; args?: unknown[] }>;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
/** Per breakpoint: the styles a width overrides, and the component inputs it overrides (a slider's slides per view —
|
|
@@ -47,6 +47,9 @@ export enum ContentFieldControl {
|
|
|
47
47
|
List = 'list',
|
|
48
48
|
Number = 'number',
|
|
49
49
|
Switch = 'switch',
|
|
50
|
+
/** AW11-D10: the item's own colour (a colour block's ground) — the admin's colour picker; a hex is drawn, a token or
|
|
51
|
+
* a gradient leaves the look's ramp in place. */
|
|
52
|
+
Colour = 'colorPicker',
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
/** How a field is stored. The schema editor's and the item editor's own list: anything else renders no input. */
|
|
@@ -66,6 +69,7 @@ export const FIELD_TYPE_OF_CONTROL: Readonly<Record<ContentFieldControl, Content
|
|
|
66
69
|
[ContentFieldControl.List]: ContentFieldType.Array,
|
|
67
70
|
[ContentFieldControl.Number]: ContentFieldType.Number,
|
|
68
71
|
[ContentFieldControl.Switch]: ContentFieldType.Boolean,
|
|
72
|
+
[ContentFieldControl.Colour]: ContentFieldType.String,
|
|
69
73
|
};
|
|
70
74
|
|
|
71
75
|
export interface ContentFieldPlan {
|
|
@@ -106,6 +110,8 @@ export enum ContentRole {
|
|
|
106
110
|
Person = 'person',
|
|
107
111
|
/** LI0: where the item leads — its own page or an address. */
|
|
108
112
|
Link = 'link',
|
|
113
|
+
/** AW11-D10: its own colour (a hex) — a colour block's ground; the ink on it is chosen when the page is drawn. */
|
|
114
|
+
Colour = 'colour',
|
|
109
115
|
/** Commerce C-D21: the shop's own price — played only by the shop's fields (`SHOP_ROLES`), never a content type's. */
|
|
110
116
|
Price = 'price',
|
|
111
117
|
/** Commerce C-D21: the shop's earlier price, struck through. */
|