@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
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
LayoutIssue, LayoutIssueCode, LayoutLayerKind, LayoutListArrange, LayoutListArrive, LayoutListHow, LayoutListHover, LayoutListItem, LayoutListMix,
|
|
3
3
|
LayoutListMove, LayoutListPhone, LayoutListShape, LayoutListWho, LayoutMendKind, LayoutPage,
|
|
4
4
|
} from './layout-language';
|
|
5
|
-
import { listBuiltWords, listMeaning, listWait } from './list-table';
|
|
5
|
+
import { LIST_RULES, bentoFill, listBelowPro, listBuiltWords, listMeaning, listWait, listWordRefusal, ListWordRefusal } from './list-table';
|
|
6
6
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -14,6 +14,9 @@ import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
|
14
14
|
|
|
15
15
|
const R = SPEC_SITE_LAYOUT.list.rules;
|
|
16
16
|
const IMAGE = 'image';
|
|
17
|
+
const AWARD = 'award';
|
|
18
|
+
/** What a name set on its picture may show beside the picture: the name and a short detail (AW11-D8). */
|
|
19
|
+
const TITLE_ON_PHOTO_PARTS: ReadonlySet<string> = new Set(['title', 'meta', 'date']);
|
|
17
20
|
const inList = (values: ReadonlyArray<string>, v: unknown): boolean => typeof v === 'string' && values.includes(v);
|
|
18
21
|
const enumValues = (e: object): string[] => Object.values(e);
|
|
19
22
|
/** The words a refusal names: the DRAWN ones only — a refusal is the model's next turn, and a waiting word is never offered. */
|
|
@@ -34,6 +37,14 @@ export interface LayoutListNever {
|
|
|
34
37
|
readonly say: ReadonlyArray<string>;
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
/** AW11: what the judge knows of where the list sits and who it is built for. */
|
|
41
|
+
export interface ListCheckOptions {
|
|
42
|
+
/** AW-D23: the tier the site is built at; absent: the builder (the owner's choice — no word is held back). */
|
|
43
|
+
readonly tier?: string | null;
|
|
44
|
+
/** The list is in the page's first screen (its first section): no arrival plays there (AW11-D15). */
|
|
45
|
+
readonly firstScreen?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
/** True when the type's art direction forbids nothing. */
|
|
38
49
|
export const listNeverIsEmpty = (never?: LayoutListNever | null): boolean => !never || (!never.arranges.length && !never.moves.length);
|
|
39
50
|
|
|
@@ -41,7 +52,7 @@ export const listNeverIsEmpty = (never?: LayoutListNever | null): boolean => !ne
|
|
|
41
52
|
* Judge one list section's mix against the list it shows (`shape`, from `layoutListShapes`; null when the source is no
|
|
42
53
|
* list — the source check says that). `layer` is the layer's path (`sections[1].layers[0]`).
|
|
43
54
|
*/
|
|
44
|
-
export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, layer: string, never?: LayoutListNever | null): LayoutIssue[] {
|
|
55
|
+
export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, layer: string, never?: LayoutListNever | null, options: ListCheckOptions = {}): LayoutIssue[] {
|
|
45
56
|
const at = `${layer}.gallery.list`;
|
|
46
57
|
const refused: LayoutIssue[] = [];
|
|
47
58
|
const refuse = (code: LayoutIssueCode, path: string, message: string) => refused.push({ code, path, message });
|
|
@@ -85,6 +96,27 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
85
96
|
const drawn = (next[k] as string[]).map(w => { const stand = waiting(k, w); return stand === undefined ? w : stand; }).filter((w): w is string => !!w);
|
|
86
97
|
(next as unknown as Record<string, string[]>)[k] = [...new Set(drawn)];
|
|
87
98
|
}
|
|
99
|
+
// AW-D23: a round-two word on a site built below the award tier is drawn as its stand-in (the contract's belowPro).
|
|
100
|
+
if (options.tier !== undefined && options.tier !== null && options.tier !== AWARD) {
|
|
101
|
+
const below = (k: 'item' | 'arrange' | 'arrive', fallback: string) => {
|
|
102
|
+
const stand = listBelowPro(k, next[k]);
|
|
103
|
+
if (stand === undefined) return;
|
|
104
|
+
repair(`${k} "${next[k]}" comes with the award plan: "${stand ?? fallback}" instead`);
|
|
105
|
+
(next as unknown as Record<string, string>)[k] = stand ?? fallback;
|
|
106
|
+
};
|
|
107
|
+
below('item', LayoutListItem.Card);
|
|
108
|
+
below('arrange', LayoutListArrange.Grid);
|
|
109
|
+
below('arrive', LayoutListArrive.Together);
|
|
110
|
+
for (const k of ['move', 'hover'] as const) {
|
|
111
|
+
const kept = (next[k] as string[]).flatMap(w => {
|
|
112
|
+
const stand = listBelowPro(k, w);
|
|
113
|
+
if (stand === undefined) return [w];
|
|
114
|
+
repair(`${k} "${w}" comes with the award plan: ${stand ? `"${stand}" instead` : 'left out'}`);
|
|
115
|
+
return stand ? [stand] : [];
|
|
116
|
+
});
|
|
117
|
+
(next as unknown as Record<string, string[]>)[k] = [...new Set(kept)];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
88
120
|
const roles = shape.roles as ReadonlyArray<string>;
|
|
89
121
|
const pictured = roles.includes(IMAGE);
|
|
90
122
|
|
|
@@ -105,6 +137,29 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
105
137
|
}
|
|
106
138
|
}
|
|
107
139
|
|
|
140
|
+
// AW11: round-two items — each needs what it shows (one table: listWordRefusal).
|
|
141
|
+
const itemRefusal = listWordRefusal('item', next.item, shape);
|
|
142
|
+
if (itemRefusal === ListWordRefusal.NoPictures) {
|
|
143
|
+
repair(`"${shape.alias}" has no pictures — ${listMeaning('item', next.item)} needs one: its items are cards`);
|
|
144
|
+
next.item = LayoutListItem.Card;
|
|
145
|
+
}
|
|
146
|
+
if (next.item === LayoutListItem.TitleOnPhoto && (shape.titleWords ?? 0) > LIST_RULES.titleOnPhotoWords) {
|
|
147
|
+
repair(`"${shape.alias}" has names of ${shape.titleWords} words — more than ${LIST_RULES.titleOnPhotoWords} would cover the picture: its items are cards`);
|
|
148
|
+
next.item = LayoutListItem.Card;
|
|
149
|
+
}
|
|
150
|
+
if (next.item === LayoutListItem.Packshot && shape.plainPictures === false) {
|
|
151
|
+
repair(`"${shape.alias}"'s pictures do not stand on a plain ground — a packshot needs one: its items are cards`);
|
|
152
|
+
next.item = LayoutListItem.Card;
|
|
153
|
+
}
|
|
154
|
+
if (next.item === LayoutListItem.TitleOnPhoto) {
|
|
155
|
+
const words = next.parts.filter(p => p === IMAGE || TITLE_ON_PHOTO_PARTS.has(p));
|
|
156
|
+
if (words.length !== next.parts.length) {
|
|
157
|
+
repair('a name on its picture shows the picture, the name and a short detail only');
|
|
158
|
+
next.parts = words;
|
|
159
|
+
}
|
|
160
|
+
if (!next.parts.includes(IMAGE)) next.parts = [IMAGE, ...next.parts];
|
|
161
|
+
}
|
|
162
|
+
|
|
108
163
|
// The arrangement first: what follows is judged against the one the list ends with.
|
|
109
164
|
if (next.arrange === LayoutListArrange.Strips && !pictured) {
|
|
110
165
|
repair('strips need a picture in every item — a still grid instead');
|
|
@@ -120,6 +175,34 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
120
175
|
repair(`${why} — ${say(LayoutListArrange.Row)}`);
|
|
121
176
|
next.arrange = LayoutListArrange.Row;
|
|
122
177
|
}
|
|
178
|
+
// AW11: round-two arrangements — pictures where they need them, the counts they are drawn at.
|
|
179
|
+
const arrangeRefusal = listWordRefusal('arrange', next.arrange, shape);
|
|
180
|
+
if (arrangeRefusal === ListWordRefusal.NoPictures) {
|
|
181
|
+
return [{ code: LayoutIssueCode.Content, path: `${at}.arrange`, message: `${say(next.arrange)} needs a picture in every item — "${shape.alias}" has none; arrange it another way` }];
|
|
182
|
+
}
|
|
183
|
+
const count = LIST_RULES.counts[next.arrange];
|
|
184
|
+
if (count && shape.items !== null) {
|
|
185
|
+
const [fewest, most] = count;
|
|
186
|
+
if (shape.items < fewest) {
|
|
187
|
+
const instead = next.arrange === LayoutListArrange.Hang ? LayoutListArrange.Masonry : LayoutListArrange.Grid;
|
|
188
|
+
repair(`${say(next.arrange)} needs ${fewest} items — "${shape.alias}" has ${shape.items}: ${say(instead)}`);
|
|
189
|
+
next.arrange = instead;
|
|
190
|
+
} else if (shape.items > most) {
|
|
191
|
+
repair(`${say(next.arrange)} shows the first ${most} of "${shape.alias}"'s ${shape.items}, then the link to all of them`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (next.arrange === LayoutListArrange.Bento && shape.items !== null) {
|
|
195
|
+
const fill = bentoFill(shape.items);
|
|
196
|
+
if (fill === null) {
|
|
197
|
+
repair(`a bento needs ${LIST_RULES.bento[0]} items — ${say(LayoutListArrange.Grid)}`);
|
|
198
|
+
next.arrange = LayoutListArrange.Grid;
|
|
199
|
+
} else if (fill < shape.items) {
|
|
200
|
+
repair(`a bento fits ${LIST_RULES.bento.join(', ')} — "${shape.alias}" has ${shape.items}, so it shows ${fill} and the link to all of them`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const tiltedText = next.arrange === LayoutListArrange.Tilted && next.item !== LayoutListItem.Photo ? shape.long.filter(role => next.parts.includes(role)) : [];
|
|
204
|
+
if (tiltedText.length) repair(`its ${tiltedText.join(' and ')} run long — a turned card shows their first lines`);
|
|
205
|
+
|
|
123
206
|
const longShown = shape.long.filter(role => next.parts.includes(role));
|
|
124
207
|
if (longShown.length && next.arrange === LayoutListArrange.Grid) {
|
|
125
208
|
repair(`its ${longShown.join(' and ')} run long — a grid would cut them: ${say(LayoutListArrange.Masonry)}`);
|
|
@@ -144,7 +227,7 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
144
227
|
if (next.standout.how) repair('nothing stands out — no way to stand out');
|
|
145
228
|
delete next.standout;
|
|
146
229
|
} else {
|
|
147
|
-
if (has(R.onlyRow.who, next.standout.who) && !row) {
|
|
230
|
+
if (has(R.onlyRow.who, next.standout.who) && !row && !has(LIST_RULES.middle ?? [], arrange)) {
|
|
148
231
|
repair(`"${next.standout.who}" is a row's — the first stands out`);
|
|
149
232
|
next.standout.who = LayoutListWho.First;
|
|
150
233
|
}
|
|
@@ -155,13 +238,29 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
155
238
|
}
|
|
156
239
|
}
|
|
157
240
|
|
|
241
|
+
if (arrange === LayoutListArrange.Rows && next.standout && (next.standout.who !== LIST_RULES.rowsStandout.who || next.standout.how !== LIST_RULES.rowsStandout.how)) {
|
|
242
|
+
repair('numbered rows stand out one way: the one pointed at, the rest dimmed');
|
|
243
|
+
next.standout = { who: LIST_RULES.rowsStandout.who as `${LayoutListWho}`, how: LIST_RULES.rowsStandout.how as `${LayoutListHow}` };
|
|
244
|
+
}
|
|
245
|
+
|
|
158
246
|
// How the visitor moves through them — never a way the business's lists never move (L-D12).
|
|
159
247
|
const banned = never ? next.move.filter(m => has(never.moves, m)) : [];
|
|
160
248
|
if (banned.length) {
|
|
161
249
|
repair(`${why} — no ${banned.join(', ')}`);
|
|
162
250
|
next.move = next.move.filter(m => !banned.includes(m));
|
|
163
251
|
}
|
|
164
|
-
|
|
252
|
+
// AW11: a fan moves only by being dragged, and only with enough cards to drag.
|
|
253
|
+
if (arrange === LayoutListArrange.Fan && next.move.length) {
|
|
254
|
+
const dragged = next.move.includes(LayoutListMove.Drag) && (shape.items === null || shape.items >= LIST_RULES.fanDragFrom);
|
|
255
|
+
const dropped = next.move.filter(m => m !== LayoutListMove.Drag || !dragged);
|
|
256
|
+
if (dropped.length) repair(dragged || !next.move.includes(LayoutListMove.Drag) ? `a fan is only dragged — no ${dropped.join(', ')}` : `a fan of fewer than ${LIST_RULES.fanDragFrom} cards stays still`);
|
|
257
|
+
next.move = dragged ? [LayoutListMove.Drag] : [];
|
|
258
|
+
}
|
|
259
|
+
if (next.move.includes(LayoutListMove.Rows) && !pictured) {
|
|
260
|
+
repair(`"${shape.alias}" has no pictures — no drifting rows`);
|
|
261
|
+
next.move = next.move.filter(m => m !== LayoutListMove.Rows);
|
|
262
|
+
}
|
|
263
|
+
const moving = has(R.moving, arrange) || (arrange === LayoutListArrange.Fan && next.move.length > 0);
|
|
165
264
|
if (!moving && next.move.length) {
|
|
166
265
|
repair(`${say(arrange)} does not move — no ${next.move.join(', ')}`);
|
|
167
266
|
next.move = [];
|
|
@@ -176,6 +275,15 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
176
275
|
repair('the page\'s scroll carries the row alone');
|
|
177
276
|
next.move = [LayoutListMove.Page];
|
|
178
277
|
}
|
|
278
|
+
if (next.move.includes(LayoutListMove.Rows) && next.move.length > 1) {
|
|
279
|
+
repair('drifting rows move by themselves alone');
|
|
280
|
+
next.move = [LayoutListMove.Rows];
|
|
281
|
+
}
|
|
282
|
+
if (next.move.includes(LayoutListMove.Rows) && next.item !== LayoutListItem.Photo) {
|
|
283
|
+
repair('drifting rows hold pictures only');
|
|
284
|
+
next.item = LayoutListItem.Photo;
|
|
285
|
+
next.parts = [IMAGE];
|
|
286
|
+
}
|
|
179
287
|
if (!next.move.length) {
|
|
180
288
|
repair(`${say(arrange)} — the visitor drags it`);
|
|
181
289
|
next.move = [LayoutListMove.Drag];
|
|
@@ -186,28 +294,59 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
186
294
|
repair(`"${stripHovers.join(', ')}" is a strip's`);
|
|
187
295
|
next.hover = next.hover.filter(h => !has(R.onlyStrips.hover, h));
|
|
188
296
|
}
|
|
297
|
+
// AW11: hover words that need what the list may not have (one table), and the hover tilt — a still card's.
|
|
298
|
+
const unread = next.hover.filter(h => listWordRefusal('hover', h, shape) !== null && listWordRefusal('hover', h, shape) !== ListWordRefusal.ProOnly);
|
|
299
|
+
if (unread.length) {
|
|
300
|
+
repair(unread.map(h => listWordRefusal('hover', h, shape) === ListWordRefusal.NoSecondPicture
|
|
301
|
+
? `"${h}" needs a second picture — "${shape.alias}" has one per item`
|
|
302
|
+
: `"${h}" needs a picture — "${shape.alias}" has none`).join('; '));
|
|
303
|
+
next.hover = next.hover.filter(h => !unread.includes(h));
|
|
304
|
+
}
|
|
305
|
+
if (next.hover.includes(LayoutListHover.Tilt) && (moving || next.item !== LayoutListItem.Card && next.item !== LayoutListItem.Packshot && next.item !== LayoutListItem.ColourBlock && next.item !== LayoutListItem.Numbered)) {
|
|
306
|
+
repair(moving ? `${say(arrange)} moves — its card rises instead of turning` : 'only a card turns its ground — it rises instead');
|
|
307
|
+
next.hover = [...new Set(next.hover.map(h => (h === LayoutListHover.Tilt ? LayoutListHover.Rise : h)))];
|
|
308
|
+
}
|
|
189
309
|
if (new Set(next.hover).size !== next.hover.length) next.hover = [...new Set(next.hover)];
|
|
190
310
|
|
|
311
|
+
// AW11-D15: what is seen at once is there at once — no clip-up in the first screen.
|
|
312
|
+
if (options.firstScreen && has(LIST_RULES.notFirstScreen.arrive ?? [], next.arrive)) {
|
|
313
|
+
repair(`the first screen shows its items at once — "${next.arrive}" plays further down the page`);
|
|
314
|
+
next.arrive = LayoutListArrive.Together;
|
|
315
|
+
}
|
|
316
|
+
|
|
191
317
|
// A phone.
|
|
192
318
|
if (has(R.neverSwipe, arrange) && next.phone === LayoutListPhone.Swipe) {
|
|
193
319
|
repair(`${say(arrange)} does not swipe on a phone — it stacks`);
|
|
194
320
|
next.phone = LayoutListPhone.Stack;
|
|
195
321
|
}
|
|
322
|
+
// AW11-D6: a stage is a row of cards you swipe on a phone; a fan swipes or stacks.
|
|
323
|
+
if (arrange === LayoutListArrange.Stage && next.phone !== LayoutListPhone.Swipe) {
|
|
324
|
+
repair('a stage is a row of cards you swipe on a phone');
|
|
325
|
+
next.phone = LayoutListPhone.Swipe;
|
|
326
|
+
}
|
|
327
|
+
if (arrange === LayoutListArrange.Fan && next.phone === LayoutListPhone.TwoUp) {
|
|
328
|
+
repair('a fan is a row you swipe on a phone');
|
|
329
|
+
next.phone = LayoutListPhone.Swipe;
|
|
330
|
+
}
|
|
196
331
|
|
|
197
332
|
return said.map(message => ({ code: LayoutIssueCode.Structure, path: at, message, mend: { kind: LayoutMendKind.List, layer, mix: next } }));
|
|
198
333
|
}
|
|
199
334
|
|
|
200
|
-
/** Two list sections of one page never share an arrangement (list-ingredients §7)
|
|
335
|
+
/** Two list sections of one page never share an arrangement (list-ingredients §7), and never two lean (AW11-D7): the
|
|
336
|
+
* later ones are the model's. */
|
|
201
337
|
export function pageListIssues(page: LayoutPage): LayoutIssue[] {
|
|
202
338
|
const issues: LayoutIssue[] = [];
|
|
203
339
|
const seen = new Map<string, string>();
|
|
340
|
+
let leaning: string | null = null;
|
|
204
341
|
(page?.sections ?? []).forEach((s, si) => (s.layers ?? []).forEach((l, li) => {
|
|
205
342
|
const mix = l.kind === LayoutLayerKind.Gallery ? l.gallery?.list : undefined;
|
|
206
343
|
if (!mix || typeof mix.arrange !== 'string') return;
|
|
207
344
|
const path = `sections[${si}].layers[${li}].gallery.list.arrange`;
|
|
208
345
|
const first = seen.get(mix.arrange);
|
|
209
346
|
if (first) issues.push({ code: LayoutIssueCode.Sameness, path, message: `${first} is already ${say(mix.arrange)} — arrange this list another way` });
|
|
347
|
+
else if (leaning && has(LIST_RULES.leaning, mix.arrange)) issues.push({ code: LayoutIssueCode.Sameness, path, message: `${leaning} already leans — one leaning list a page; arrange this one straight` });
|
|
210
348
|
else seen.set(mix.arrange, `sections[${si}]`);
|
|
349
|
+
if (!leaning && has(LIST_RULES.leaning, mix.arrange)) leaning = `sections[${si}]`;
|
|
211
350
|
}));
|
|
212
351
|
return issues;
|
|
213
352
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
buildCardRecipe, buildMarqueeRecipe, CardLayout, CardPart, CardRole, CompositeNode, CompositeNodeSpec, findByRole,
|
|
2
|
+
buildCardRecipe, buildMarqueeRecipe, CardLayout, CardPart, CardRole, CompositeNode, CompositeNodeSpec, findByRole, MarqueeDirection, MarqueeRole, MarqueeSpeed,
|
|
3
|
+
NO_ELEMENT_STYLE, SceneRole, setMarqueeSettings,
|
|
3
4
|
SLIDER_PLACEMENT_TRAIT, SliderPlacement, SliderRole, syncSliderParts, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget,
|
|
4
5
|
} from '@vectoriox/iox-ui/composite-core';
|
|
5
6
|
|
|
6
|
-
import { ColorScheme, DesignChoices, LinkType, scrubOfChoices, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
7
|
+
import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
7
8
|
import { TextRevealBy } from '@vectoriox/iox-ui/scene-core';
|
|
8
9
|
import { FORM_AFTER_SEND_TRAIT, FormAfterSend, FormPresetId } from '@vectoriox/iox-ui/forms-core';
|
|
9
10
|
import { composeNavHeader, composePresetForm } from './compose-site';
|
|
10
11
|
import { drawnHeaderMix, headerMixOfNavKind } from './header-mix';
|
|
11
|
-
import { listWait } from './list-table';
|
|
12
|
+
import { LIST_RULES, LIST_RHYTHMS, listWait } from './list-table';
|
|
13
|
+
import { listMixWords } from './layout-wire';
|
|
12
14
|
import {
|
|
13
15
|
LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_EASING, LAYOUT_GUTTER, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHOTO_ASPECT, LAYOUT_TOOLTIP_TRAIT,
|
|
14
16
|
LAYOUT_PHONE_PADDING, LAYOUT_RISE, LAYOUT_TEXT_KINDS, LayoutBleed, LayoutColour, LayoutEase, LayoutEnter, LayoutForm, LayoutGallery, LayoutLayer,
|
|
@@ -18,7 +20,7 @@ import {
|
|
|
18
20
|
} from './layout-language';
|
|
19
21
|
import { layoutGlideDepth } from './layout-drift';
|
|
20
22
|
import { isLayoutRule, layoutRuleEdge } from './layout-space';
|
|
21
|
-
import { LIST_DECK_MAX_PX, LIST_DECK_SHARE } from './list-space';
|
|
23
|
+
import { LIST_DECK_MAX_PX, LIST_DECK_SHARE, listOverhang } from './list-space';
|
|
22
24
|
import { layoutDesignOf, layoutElementStyle, layoutTextWidthEm, screenWordColumns } from './layout-type';
|
|
23
25
|
import { ComposeError, createSerializedNode, SerializedNode, setStyleProps, assertStyleSlots, walkSerialized } from './serialized-node';
|
|
24
26
|
import { BUTTON_LINK_PROPS, CarryKind, PageCarry } from './carry';
|
|
@@ -137,7 +139,33 @@ export enum LayoutListRole {
|
|
|
137
139
|
StripsSwipe = 'list.strips-swipe',
|
|
138
140
|
StripItem = 'list.strip-item',
|
|
139
141
|
Item = 'list.item',
|
|
140
|
-
|
|
142
|
+
// AW11 (board award-lists): the round-two arrangements — a Repeater's role, drawn by iox-design.css from each row's
|
|
143
|
+
// index (no runtime), each with its phone variant.
|
|
144
|
+
Hang = 'list.hang',
|
|
145
|
+
HangTwo = 'list.hang-two',
|
|
146
|
+
Bento = 'list.bento',
|
|
147
|
+
Rows = 'list.rows',
|
|
148
|
+
Stage = 'list.stage',
|
|
149
|
+
Fan = 'list.fan',
|
|
150
|
+
FanStack = 'list.fan-stack',
|
|
151
|
+
Tilted = 'list.tilted',
|
|
152
|
+
TiltedTwo = 'list.tilted-two',
|
|
153
|
+
/** AW11-D16: a band of drifting picture rows (two Marquees), its rows' Repeaters. */
|
|
154
|
+
DriftRows = 'list.drift',
|
|
155
|
+
DriftRow = 'list.drift-row',
|
|
156
|
+
/** AW11-D12: an item's second picture (swap, unveil), over the first inside its frame. */
|
|
157
|
+
Second = 'list.second',
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** A round-two arrangement's Repeater role, by the phone the mix asks for (AW11). */
|
|
161
|
+
const ARRANGE_ROLE: Readonly<Partial<Record<`${LayoutListArrange}`, Readonly<Record<`${LayoutListPhone}`, LayoutListRole>>>>> = {
|
|
162
|
+
hang: { stack: LayoutListRole.Hang, swipe: LayoutListRole.Hang, 'two-up': LayoutListRole.HangTwo },
|
|
163
|
+
bento: { stack: LayoutListRole.Bento, swipe: LayoutListRole.Bento, 'two-up': LayoutListRole.Bento },
|
|
164
|
+
rows: { stack: LayoutListRole.Rows, swipe: LayoutListRole.Rows, 'two-up': LayoutListRole.Rows },
|
|
165
|
+
stage: { stack: LayoutListRole.Stage, swipe: LayoutListRole.Stage, 'two-up': LayoutListRole.Stage },
|
|
166
|
+
fan: { stack: LayoutListRole.FanStack, swipe: LayoutListRole.Fan, 'two-up': LayoutListRole.Fan },
|
|
167
|
+
tilted: { stack: LayoutListRole.Tilted, swipe: LayoutListRole.Tilted, 'two-up': LayoutListRole.TiltedTwo },
|
|
168
|
+
};
|
|
141
169
|
|
|
142
170
|
/** A strips list's Repeater role by the phone the mix asks for. */
|
|
143
171
|
const STRIPS_ROLE: Readonly<Record<`${LayoutListPhone}`, LayoutListRole>> = {
|
|
@@ -782,11 +810,14 @@ function listArriveInteraction(nodeId: string, arrive: `${LayoutListArrive}`, ct
|
|
|
782
810
|
const action =
|
|
783
811
|
arrive === LayoutListArrive.Together ? { type: 'fadeIn', params: {} }
|
|
784
812
|
: arrive === LayoutListArrive.SlideIn ? { type: ctx.rtl ? 'moveRight' : 'moveLeft', params: { distance: LIST_SLIDE_DISTANCE, stagger, cap: LIST_STAGGER_CAP } }
|
|
785
|
-
:
|
|
813
|
+
// AW11-D15: each card opens from its bottom edge — the ONE keyframe map's clipReveal, with the shrinking stagger.
|
|
814
|
+
: arrive === LayoutListArrive.ClipUp ? { type: 'clipReveal', params: { from: LayoutSide.Bottom, stagger, cap: LIST_STAGGER_CAP } }
|
|
815
|
+
: { type: 'moveUp', params: { distance: LAYOUT_RISE[LayoutRole.Support], stagger, cap: LIST_STAGGER_CAP } };
|
|
816
|
+
const clip = arrive === LayoutListArrive.ClipUp;
|
|
786
817
|
return {
|
|
787
818
|
id: `${nodeId}-enter`,
|
|
788
819
|
trigger: 'viewportEnter',
|
|
789
|
-
actions: [{ type: action.type, target: 'self', duration, delay: 0, easing: ctx.ease, once: true, ...(Object.keys(action.params).length ? { params: action.params } : {}) }],
|
|
820
|
+
actions: [{ type: action.type, target: 'self', duration: clip ? Math.round(duration * CLIP_DURATION) : duration, delay: 0, easing: ctx.ease, once: true, ...(Object.keys(action.params).length ? { params: action.params } : {}) }],
|
|
790
821
|
};
|
|
791
822
|
}
|
|
792
823
|
|
|
@@ -886,6 +917,15 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
886
917
|
phone(frame, { height: 'auto' });
|
|
887
918
|
const scheme = layoutBandScheme(lc.section.ground);
|
|
888
919
|
if (scheme) setColorScheme(frame, scheme);
|
|
920
|
+
// AW11: the mix rides on the frame (design-core LIST_MIX_PROP) — the shared CSS draws its item and hover words from
|
|
921
|
+
// the classes it becomes, and Bindings ▸ List reads it back.
|
|
922
|
+
frame.props[LIST_MIX_PROP] = listMixWords(mix).join(' ');
|
|
923
|
+
// AW11 rule 2 (never cut): what leans, hangs or turns keeps its room inside the frame — its section clips.
|
|
924
|
+
const room = listOverhang(mix);
|
|
925
|
+
if (room.blockStart || room.blockEnd || room.inline) {
|
|
926
|
+
setStyleProps(frame, { padding: `${room.blockStart}px ${room.inline}px ${room.blockEnd}px ${room.inline}px` });
|
|
927
|
+
phone(frame, { padding: `${Math.round(room.blockStart / 2)}px ${Math.round(room.inline / 2)}px ${Math.round(room.blockEnd / 2)}px ${Math.round(room.inline / 2)}px` });
|
|
928
|
+
}
|
|
889
929
|
|
|
890
930
|
// A word the product does not draw yet (the contract's list table): drawn as its stand-in, and said.
|
|
891
931
|
let arrange = mix.arrange;
|
|
@@ -901,23 +941,27 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
901
941
|
if (standout && standWait) {
|
|
902
942
|
gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.standout`, `standing out (${standout.who}${standout.how ? ` · ${standout.how}` : ''}) is drawn in ${standWait.phase}`);
|
|
903
943
|
}
|
|
904
|
-
const masonry = arrange === LayoutListArrange.Masonry;
|
|
905
|
-
const item = mix.
|
|
906
|
-
? listCard(`${id}-item`, mix, source, list, masonry, lc.path, ctx, strips ? CardLayout.Overlay : CardLayout.Top)
|
|
907
|
-
: listPhoto(`${id}-item`, source, list, masonry);
|
|
944
|
+
const masonry = arrange === LayoutListArrange.Masonry || arrange === LayoutListArrange.Hang;
|
|
945
|
+
const item = listItem(`${id}-item`, mix, source, list, masonry, lc.path, ctx, strips);
|
|
908
946
|
if (strips) return composeStrips(id, frame, item, mix, source, ctx, listItemRadius(mix));
|
|
947
|
+
// AW11-D16: drifting picture rows — the Marquee holding the list's pictures, twice.
|
|
948
|
+
if (mix.move.includes(LayoutListMove.Rows) && arrange === LayoutListArrange.Row && !lc.held) return composeDriftRows(id, frame, item, source, l);
|
|
909
949
|
item.interactions = [...item.interactions, listArriveInteraction(item.id, mix.arrive, ctx)];
|
|
950
|
+
if (mix.arrive === LayoutListArrive.ClipUp) riseInside(item, ctx);
|
|
910
951
|
// LI4: the one that stands out — a deck's top card IS its standing out; strips draw their own (wider).
|
|
911
952
|
const shown = standout && !standWait && !deck ? standWrap(`${id}-stand`, item, standout) : item;
|
|
912
953
|
|
|
913
|
-
|
|
954
|
+
const fanDragged = arrange === LayoutListArrange.Fan && mix.move.includes(LayoutListMove.Drag);
|
|
955
|
+
if (arrange === LayoutListArrange.Row || deck || fanDragged) {
|
|
914
956
|
const scrollPlays = mix.move.includes(LayoutListMove.Page) && !lc.held;
|
|
915
957
|
const played = scrollPlays || lc.held;
|
|
916
958
|
const drag = mix.move.includes(LayoutListMove.Drag);
|
|
917
959
|
const slider = create(`${id}-slider`, T.Slider, {
|
|
918
960
|
// A deck (LI4) is Swiper's cards: one card on top, the rest waiting behind, dragged away or stepped.
|
|
919
|
-
|
|
920
|
-
|
|
961
|
+
// AW11-D1: a fan you drag is Swiper's creative effect, set by the ONE planSwiperOptions (`creativePreset: fan`).
|
|
962
|
+
dir: ctx.rtl ? 'rtl' : 'ltr', effect: deck ? 'cards' : fanDragged ? 'creative' : 'slide', slidesPerView: deck || fanDragged ? 1 : 'auto',
|
|
963
|
+
spaceBetween: deck || fanDragged ? 0 : SLIDE_GAP, ...(fanDragged ? { creativePreset: SLIDER_FAN_PRESET } : {}),
|
|
964
|
+
centeredSlides: !deck && !fanDragged && standout?.who === LayoutListWho.Middle, loop: 'off', freeMode: !deck && !fanDragged && drag && !played, grabCursor: drag && !played,
|
|
921
965
|
speed: deck ? Math.round(ctx.pace.support * LIST_DECK_TURN) : GALLERY_SPEED, enableParallax: false, enableAutoplay: mix.move.includes(LayoutListMove.Auto) && !played,
|
|
922
966
|
autoplayDelay: LIST_AUTOPLAY_MS, autoplayDisableOnInteraction: true, enableKeyboard: true, scrollPlays,
|
|
923
967
|
enableCaption: false, enableCount: false, enableNavigation: mix.move.includes(LayoutListMove.Arrows) && !played,
|
|
@@ -934,21 +978,34 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
934
978
|
phone(slider, scrollPlays || deck ? { height: 'auto' } : { position: 'relative', height: 'auto' });
|
|
935
979
|
// A row keeps its own slide width on a phone (most of the screen, the next item peeking): the slider's phone
|
|
936
980
|
// default is one slide the full width, unless the phone layer names its slides per view. A deck stays a deck.
|
|
937
|
-
if (!deck) slider.responsive![LAYOUT_PHONE_BREAKPOINT]!.inputs = { slidesPerView: 'auto' };
|
|
981
|
+
if (!deck && !fanDragged) slider.responsive![LAYOUT_PHONE_BREAKPOINT]!.inputs = { slidesPerView: 'auto' };
|
|
938
982
|
if (mix.phone !== LayoutListPhone.Swipe) gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.phone`, `a ${arrange} stays one you swipe on a phone (${mix.phone} is a grid's)`);
|
|
939
983
|
const slide = create(`${id}-slide`, T.Slide, { caption: '' }, NO_ELEMENT_STYLE);
|
|
940
|
-
|
|
984
|
+
const oneWide = deck || fanDragged;
|
|
985
|
+
setStyleProps(slide, { width: oneWide ? FULL : LIST_ROW_SLIDE, height: FULL, display: 'flex', aspectRatio: 'auto' });
|
|
941
986
|
// LI7: a deck's peeking cards and Swiper's shading over them wear the item's corner (the shared CSS rounds the
|
|
942
987
|
// shading to the slide's), and a picture's card the look's shadow.
|
|
943
|
-
if (
|
|
944
|
-
if (!
|
|
988
|
+
if (oneWide) setStyleProps(slide, { borderRadius: listItemRadius(mix), ...(mix.item !== LayoutListItem.Card ? { boxShadow: LIST_PHOTO_SHADOW } : {}) });
|
|
989
|
+
if (!oneWide) phone(slide, { width: LIST_ROW_SLIDE_PHONE });
|
|
945
990
|
slide.children = [shown];
|
|
946
991
|
slider.children = [slide];
|
|
947
992
|
syncSliderParts(slider as unknown as CompositeNode, partFactory(`${id}-slider`));
|
|
948
993
|
walkSerialized([slider], node => {
|
|
949
994
|
if (node.role === SliderRole.Prev || node.role === SliderRole.Next) node.props[LAYOUT_TOOLTIP_TRAIT] = node.props['ariaLabel'];
|
|
950
995
|
});
|
|
951
|
-
frame.children = [
|
|
996
|
+
frame.children = [oneWide ? deckHolder(`${id}-deck`, slider) : slider];
|
|
997
|
+
return frame;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// AW11: a round-two arrangement is a Repeater whose role the shared CSS draws from each row's index (D1).
|
|
1001
|
+
const roundTwo = ARRANGE_ROLE[arrange];
|
|
1002
|
+
if (roundTwo) {
|
|
1003
|
+
const items = create(`${id}-items`, 'Repeater', {}, 'box');
|
|
1004
|
+
items.role = roundTwo[mix.phone];
|
|
1005
|
+
items.bindings.push({ prop: 'source', source, path: '' });
|
|
1006
|
+
setStyleProps(items, { display: 'block', width: FULL });
|
|
1007
|
+
items.children = [shown];
|
|
1008
|
+
frame.children = [items];
|
|
952
1009
|
return frame;
|
|
953
1010
|
}
|
|
954
1011
|
|
|
@@ -1033,6 +1090,94 @@ function composeStrips(id: string, frame: SerializedNode, item: SerializedNode,
|
|
|
1033
1090
|
return frame;
|
|
1034
1091
|
}
|
|
1035
1092
|
|
|
1093
|
+
// ── AW11 (board award-lists): the round-two items, the second picture, the clip-up's inside, the drifting rows ──────
|
|
1094
|
+
|
|
1095
|
+
/** The fan's Swiper preset (AW11-D1): planSwiperOptions draws a dragged fan from it — the ONE slider planner. */
|
|
1096
|
+
const SLIDER_FAN_PRESET = 'fan';
|
|
1097
|
+
/** A colour block's ground and ink, set per row from its own colour (AW11-D10) — `style:` bindings the renderers apply
|
|
1098
|
+
* through iox-ui `boundStyleOf`, the shared CSS's fallback the look's ramp. */
|
|
1099
|
+
const ITEM_GROUND = 'style:--list-item-ground';
|
|
1100
|
+
const ITEM_INK = 'style:--list-item-ink';
|
|
1101
|
+
const GROUND_PIPE = 'aaGround';
|
|
1102
|
+
const INK_PIPE = 'inkOnGround';
|
|
1103
|
+
/** The parts a name set on its picture keeps (AW11-D8). */
|
|
1104
|
+
const TITLE_ON_PHOTO_PARTS: ReadonlySet<string> = new Set(['image', 'title', 'meta', 'date']);
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* One list item by the mix's item word: a picture, a card (Card v2 — the palette's recipe), a card whose name is set on
|
|
1108
|
+
* its picture (the Overlay layout, title + a short detail), or a card the shared CSS dresses by the frame's mix classes
|
|
1109
|
+
* (a packshot's even tile, a colour block's own ground, a numeral). Hover words that need a second picture get it here.
|
|
1110
|
+
*/
|
|
1111
|
+
function listItem(id: string, mix: LayoutListMix, source: string, list: LayoutListBinding, masonry: boolean, path: string, ctx: Ctx, strips: boolean): SerializedNode {
|
|
1112
|
+
if (mix.item === LayoutListItem.Photo) return listPhoto(id, source, list, masonry);
|
|
1113
|
+
const onPhoto = mix.item === LayoutListItem.TitleOnPhoto;
|
|
1114
|
+
const shown = onPhoto ? { ...mix, parts: mix.parts.filter(p => TITLE_ON_PHOTO_PARTS.has(p)) } : mix;
|
|
1115
|
+
const card = listCard(id, shown, source, list, masonry && !onPhoto, path, ctx, strips || onPhoto ? CardLayout.Overlay : CardLayout.Top);
|
|
1116
|
+
if (mix.hover.some(h => h === LayoutListHover.Swap || h === LayoutListHover.Unveil)) secondPicture(card, source, list);
|
|
1117
|
+
if (mix.item === LayoutListItem.ColourBlock && list.roles['colour']) {
|
|
1118
|
+
card.bindings.push({ prop: ITEM_GROUND, source, path: list.roles['colour'], pipes: [{ name: GROUND_PIPE }] });
|
|
1119
|
+
card.bindings.push({ prop: ITEM_INK, source, path: list.roles['colour'], pipes: [{ name: INK_PIPE }] });
|
|
1120
|
+
}
|
|
1121
|
+
return card;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/** The item's second picture (swap, unveil — AW11-D12): the gallery's second, over the first inside its frame. The first
|
|
1125
|
+
* stays drawn under it, so a second still loading shows the first, never a hole. */
|
|
1126
|
+
function secondPicture(card: SerializedNode, source: string, list: LayoutListBinding): void {
|
|
1127
|
+
const gallery = list.roles['gallery'];
|
|
1128
|
+
const media = findByRole(card as unknown as CompositeNode, CardRole.Media) as SerializedNode | undefined;
|
|
1129
|
+
if (!gallery || !media) return;
|
|
1130
|
+
const second = create(`${card.id}-second`, T.Image, { src: '', alt: '' }, NO_ELEMENT_STYLE);
|
|
1131
|
+
second.role = LayoutListRole.Second;
|
|
1132
|
+
setStyleProps(second, { position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: FULL, height: FULL, maxWidth: 'none', objectFit: 'cover' });
|
|
1133
|
+
second.bindings.push({ prop: 'src', source, path: `${gallery}.1` });
|
|
1134
|
+
if (list.roles['title']) second.bindings.push({ prop: 'alt', source, path: list.roles['title'] });
|
|
1135
|
+
setStyleProps(media, { position: 'relative', overflow: 'hidden' });
|
|
1136
|
+
media.children = [...(media.children ?? []), second];
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
/** The clip-up's inside (AW11-D15): the card's words rise the contract's distance as the card opens from its bottom edge. */
|
|
1140
|
+
function riseInside(item: SerializedNode, ctx: Ctx): void {
|
|
1141
|
+
const content = findByRole(item as unknown as CompositeNode, CardRole.Content) as SerializedNode | undefined;
|
|
1142
|
+
if (!content) return;
|
|
1143
|
+
const stagger = Math.round(LIST_STAGGER * ctx.pace.gap);
|
|
1144
|
+
content.interactions = [...content.interactions, {
|
|
1145
|
+
id: `${content.id}-enter`,
|
|
1146
|
+
trigger: 'viewportEnter',
|
|
1147
|
+
actions: [{ type: 'moveUp', target: 'self', duration: ctx.pace.support, delay: Math.round(ctx.pace.support / 3), easing: ctx.ease, once: true,
|
|
1148
|
+
params: { distance: LIST_RHYTHMS.clipUpRise, stagger, cap: LIST_STAGGER_CAP } }],
|
|
1149
|
+
}];
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Drifting picture rows (AW11-D16): two Marquees (the M6 recipe — a pause control first, still under reduced motion and a
|
|
1154
|
+
* look whose motion is Off, the ends faded), each holding the list's pictures, at different speeds and opposite ways.
|
|
1155
|
+
*/
|
|
1156
|
+
function composeDriftRows(id: string, frame: SerializedNode, item: SerializedNode, source: string, l: LayoutLayer): SerializedNode {
|
|
1157
|
+
frame.role = LayoutListRole.DriftRows;
|
|
1158
|
+
const rows: SerializedNode[] = [
|
|
1159
|
+
{ speed: MarqueeSpeed.Normal, direction: MarqueeDirection.Start },
|
|
1160
|
+
{ speed: MarqueeSpeed.Slow, direction: MarqueeDirection.End },
|
|
1161
|
+
].map((how, k) => {
|
|
1162
|
+
const band = buildMarqueeRecipe(partFactory(`${id}-row${k + 1}`), { words: [] }) as unknown as SerializedNode;
|
|
1163
|
+
setMarqueeSettings(band as unknown as CompositeNode, { ...how, fade: true });
|
|
1164
|
+
const track = findByRole(band as unknown as CompositeNode, MarqueeRole.Track) as SerializedNode | undefined;
|
|
1165
|
+
const items = create(`${id}-row${k + 1}-items`, 'Repeater', {}, 'box');
|
|
1166
|
+
items.role = LayoutListRole.DriftRow;
|
|
1167
|
+
items.bindings.push({ prop: 'source', source, path: '' });
|
|
1168
|
+
setStyleProps(items, { display: 'block', width: 'auto' });
|
|
1169
|
+
const copy = structuredClone(item);
|
|
1170
|
+
walkSerialized([copy], n => { n.id = n.id.replace(`${id}-item`, `${id}-row${k + 1}-item`); });
|
|
1171
|
+
items.children = [copy];
|
|
1172
|
+
if (track) track.children = [items];
|
|
1173
|
+
if (l.text) band.props['ariaLabel'] = l.text;
|
|
1174
|
+
return band;
|
|
1175
|
+
});
|
|
1176
|
+
setStyleProps(frame, { display: 'flex', flexDirection: 'column', gap: LIST_GAP });
|
|
1177
|
+
frame.children = rows;
|
|
1178
|
+
return frame;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1036
1181
|
/** Recipe parts stamped with this composer's ids (`<id>-<key>`). */
|
|
1037
1182
|
function partFactory(id: string): (spec: CompositeNodeSpec) => CompositeNode {
|
|
1038
1183
|
return spec => create(`${id}-${spec.key}`, spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as unknown as CompositeNode;
|
|
@@ -531,7 +531,7 @@ export function layoutGalleryLists(plan: SitePlan): LayoutGalleryList[] {
|
|
|
531
531
|
/** The words a list's roles are called in the brief — what a visitor would see, never the field name. */
|
|
532
532
|
export const LIST_ROLE_WORDS: Readonly<Record<`${ContentRole}`, string>> = {
|
|
533
533
|
title: 'name', summary: 'summary', image: 'picture', meta: 'detail', date: 'date', gallery: 'pictures',
|
|
534
|
-
logo: 'mark', icon: 'icon', quote: 'quote', person: 'person', link: 'link', price: 'price', compareAt: 'earlier price',
|
|
534
|
+
logo: 'mark', icon: 'icon', quote: 'quote', person: 'person', link: 'link', colour: 'colour', price: 'price', compareAt: 'earlier price',
|
|
535
535
|
};
|
|
536
536
|
/** A text role whose planned samples run past this many words (median) is called long: a small card would cut it. */
|
|
537
537
|
export const LIST_LONG_WORDS = 20;
|
|
@@ -556,7 +556,13 @@ export function layoutListShapes(plan: SitePlan): LayoutListShape[] {
|
|
|
556
556
|
});
|
|
557
557
|
// A shop list holds the plan's sample products (the build writes them unless the shop has its own).
|
|
558
558
|
const count = d.type === PlanDataSourceType.Shop ? plan.shop?.products?.length : type?.seed?.count;
|
|
559
|
-
|
|
559
|
+
// AW11: how long the planned names run (a long one is not set on its picture).
|
|
560
|
+
const titleField = roleField(type, ContentRole.Title);
|
|
561
|
+
const titles = titleField ? (perItem[titleField] ?? []).filter(s => typeof s === 'string') : [];
|
|
562
|
+
return {
|
|
563
|
+
alias: d.alias, label: type?.label ?? d.alias, items: typeof count === 'number' && count > 0 ? count : null, roles: played, long,
|
|
564
|
+
...(titles.length ? { titleWords: median(titles.map(wordCount)) } : {}),
|
|
565
|
+
};
|
|
560
566
|
});
|
|
561
567
|
}
|
|
562
568
|
|
|
@@ -4,6 +4,7 @@ import { layoutPresetColours, splitSide } from './check-layout';
|
|
|
4
4
|
import { LayoutColour, LayoutEnter, LayoutIssue, LayoutIssueCode, LayoutLayerKind, LayoutListMix, LayoutListWho, LayoutPage, LayoutRole, LayoutSection, LayoutSectionKind, LayoutSize, LayoutTrackProp } from './layout-language';
|
|
5
5
|
import { FooterMix, footerMixOfPlan, footerTokenOf } from './footer-mix';
|
|
6
6
|
import { HeaderMix, headerTokenOf, wornHeaderOfPlan } from './header-mix';
|
|
7
|
+
import { listWordTier } from './list-table';
|
|
7
8
|
import { PHOTO_LIGHT_LUMINANCE, PhotoTone } from './photo-inventory';
|
|
8
9
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
9
10
|
|
|
@@ -101,7 +102,10 @@ export const LAYOUT_LIST_TOKEN = 'list';
|
|
|
101
102
|
export function listTokenOf(mix: LayoutListMix): string {
|
|
102
103
|
const who = mix.standout && mix.standout.who !== LayoutListWho.None ? `${mix.standout.who}${mix.standout.how ? `-${mix.standout.how}` : ''}` : 'none';
|
|
103
104
|
const moves = Array.isArray(mix.move) && mix.move.length ? [...new Set(mix.move)].sort().join('+') : 'still';
|
|
104
|
-
|
|
105
|
+
// AW11-D18: a round-two item (a name on its picture, a packshot, a colour block, a numeral) is seen at once too — it
|
|
106
|
+
// joins the token; a round-one item adds nothing, so every fingerprint stored before AW11 reads as it did.
|
|
107
|
+
const item = typeof mix.item === 'string' && listWordTier('item', mix.item) === 'pro' ? `/${mix.item}` : '';
|
|
108
|
+
return `${LAYOUT_LIST_TOKEN}:${mix.arrange}/${who}/${moves}${item}`;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
/** A section's token in the sequence: a list section's mix, else its kind (`sequenceTokenOf`). */
|
|
@@ -516,6 +516,11 @@ export interface LayoutListShape {
|
|
|
516
516
|
roles: ReadonlyArray<string>;
|
|
517
517
|
/** Text roles whose planned samples run long (median over LIST_LONG_WORDS words). */
|
|
518
518
|
long: ReadonlyArray<string>;
|
|
519
|
+
/** AW11: the planned titles' median word count — a long name is not set on its picture (absent: not measured). */
|
|
520
|
+
titleWords?: number | null;
|
|
521
|
+
/** AW11-D9: every picture of the list stands on a plain, even ground (`assets.plainEdge`, measured at upload) — a
|
|
522
|
+
* packshot needs it; false: drawn as cards. Absent or null: not measured (the planned samples are). */
|
|
523
|
+
plainPictures?: boolean | null;
|
|
519
524
|
}
|
|
520
525
|
|
|
521
526
|
/** An accent band the accent mend may move, and the ground it takes. */
|