@vectoriox/iox-ui 5.140.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/assist-core/index.d.ts +19 -2
- package/design-core/index.d.ts +171 -2
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +29 -3
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- 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 +1671 -861
- 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-scene-core.mjs +32 -9
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +85 -4
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +525 -144
- package/harness-core/index.d.ts +18 -18
- package/index.d.ts +92 -2
- package/package.json +1 -1
- package/scene-core/index.d.ts +17 -1
- package/src/assist-core/assist-turn.ts +34 -2
- 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 +23 -1
- package/src/generation-core/check-list.ts +144 -5
- package/src/generation-core/compose-layout.ts +188 -23
- package/src/generation-core/compose-site.ts +14 -2
- package/src/generation-core/header-edit.ts +15 -11
- package/src/generation-core/layout-fingerprint.ts +5 -1
- package/src/generation-core/layout-language.ts +10 -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 +205 -0
- 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 +2 -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/src/scene-core/split-text.ts +31 -7
- package/styles/iox-design.css +438 -4
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A COMPOSED LIST'S MIX ON ITS FRAME (award-ingredients-plan §7.1f AW11, board award-lists): the words a list section was
|
|
3
|
+
* composed as ride on its frame as ONE prop, `listMix` (`item:packshot arrange:grid hover:swap …`, the wire's words), and
|
|
4
|
+
* become marker classes — `iox-list-item-packshot`, `iox-list-hover-swap` — that the shared iox-design.css draws. The
|
|
5
|
+
* same decision in all three render paths (`nodeDesignClasses`), so a word is drawn by CSS alone and the canvas, both
|
|
6
|
+
* engine paths and the raw SSR agree. Bindings ▸ List reads and writes the same prop. Pure.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** The prop (a Container's trait) the mix is stored under. */
|
|
10
|
+
export const LIST_MIX_PROP = 'listMix';
|
|
11
|
+
/** Every class a mix writes starts with this — what a live re-sync removes. */
|
|
12
|
+
export const LIST_CLASS_PREFIX = 'iox-list-';
|
|
13
|
+
|
|
14
|
+
const WORD = /^[a-z]+:[a-z0-9-]+$/;
|
|
15
|
+
|
|
16
|
+
interface ListMixSource {
|
|
17
|
+
props?: Readonly<Record<string, unknown>> | null;
|
|
18
|
+
traits?: ReadonlyArray<{ name?: string; default?: unknown }> | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The stored mix's words (`item:packshot`), from `props` (saved) or the trait (builder); [] for none. */
|
|
22
|
+
export function listMixWordsOf(node: ListMixSource | null | undefined): string[] {
|
|
23
|
+
if (!node) return [];
|
|
24
|
+
const raw = node.props?.[LIST_MIX_PROP] ?? node.traits?.find(t => t?.name === LIST_MIX_PROP)?.default;
|
|
25
|
+
const words = Array.isArray(raw) ? raw : typeof raw === 'string' ? raw.split(/\s+/) : [];
|
|
26
|
+
return words.filter((w): w is string => typeof w === 'string' && WORD.test(w));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The marker classes a list frame renders (`iox-list-arrange-hang iox-list-hover-swap`), or '' for none. */
|
|
30
|
+
export function listMixClasses(node: ListMixSource | null | undefined): string {
|
|
31
|
+
return [...new Set(listMixWordsOf(node))].map(w => `${LIST_CLASS_PREFIX}${w.replace(':', '-')}`).join(' ');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** True for a class this module writes. */
|
|
35
|
+
export function isListMixClass(c: string): boolean {
|
|
36
|
+
return c.startsWith(LIST_CLASS_PREFIX);
|
|
37
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ELEMENT_STYLE_MARKER_CLASS, elementStyleClass } from './element-styles';
|
|
2
2
|
import { SPEC_SCHEME_INK, SPEC_SCHEMES } from './flavor-spec.generated';
|
|
3
|
+
import { isListMixClass, listMixClasses } from './list-classes';
|
|
3
4
|
import { isSectionDesignClass, sectionDesignClasses } from './section-edge';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -192,13 +193,13 @@ export function hasElementStyleMarker(node: { elementStyle?: string | null } | n
|
|
|
192
193
|
export function nodeDesignClasses(node: DesignClassSource | null | undefined): string {
|
|
193
194
|
const marker = elementStyleClass(node?.elementStyle);
|
|
194
195
|
return [marker ? `${ELEMENT_STYLE_MARKER_CLASS} ${marker}` : '', colorSchemeClass(colorSchemeOf(node)) ?? '', roleClass(node?.role) ?? '', barReserveClass(node) ?? '',
|
|
195
|
-
sectionDesignClasses(node)]
|
|
196
|
+
sectionDesignClasses(node), listMixClasses(node)]
|
|
196
197
|
.filter(Boolean).join(' ');
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
const isDesignClass = (c: string) =>
|
|
200
201
|
c === ELEMENT_STYLE_MARKER_CLASS || c.startsWith(MARKER_PREFIX) || c.startsWith(SCHEME_PREFIX) || c.startsWith(ROLE_PREFIX) || c.startsWith(BAR_RESERVE_CLASS)
|
|
201
|
-
|| isSectionDesignClass(c);
|
|
202
|
+
|| isSectionDesignClass(c) || isListMixClass(c);
|
|
202
203
|
|
|
203
204
|
/** Make an element's design classes match the node — the live switch on the canvas and the
|
|
204
205
|
* component path's one-time stamp. Removes stale ones; touches no other class. */
|
|
@@ -20,6 +20,8 @@ export * from './element-styles';
|
|
|
20
20
|
export * from './adopt';
|
|
21
21
|
export * from './node-classes';
|
|
22
22
|
export * from './section-edge';
|
|
23
|
+
export * from './list-classes';
|
|
24
|
+
export * from './ink-on-ground';
|
|
23
25
|
export * from './field-classes';
|
|
24
26
|
export * from './empty-image';
|
|
25
27
|
export * from './node-links';
|
|
@@ -16,6 +16,7 @@ import { calmParts, calmUnder, FrameRegion, PhotoInventory, PHOTO_LIGHT_LUMINANC
|
|
|
16
16
|
import { SerializedNode, walkSerialized } from './serialized-node';
|
|
17
17
|
import { SPEC_SITE_FACTS, SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
18
18
|
import { checkList, LayoutListNever, pageListIssues } from './check-list';
|
|
19
|
+
import { LIST_WORDS_BESIDE_RULE, LayoutListSide, layoutListBare, layoutListPair } from './list-space';
|
|
19
20
|
import { GroundTone, groundToneOf, rhythmIssues } from './body-mix';
|
|
20
21
|
import {
|
|
21
22
|
LAYOUT_CHECK_VIEWPORT, LAYOUT_DRIFT, LAYOUT_KINETIC_KINDS, LAYOUT_LINE_HEIGHT, layoutBoxPx, layoutDriftPhoto, layoutHeldStill, layoutOpeningDisplayMend, layoutOpeningDisplays, layoutShapeHasPurpose,
|
|
@@ -53,6 +54,9 @@ export interface CheckLayoutContext {
|
|
|
53
54
|
listShapes?: ReadonlyArray<LayoutListShape>;
|
|
54
55
|
/** What this business type's lists never do (L-D12 — harness-core `BusinessType.lists`): repaired by `checkList`. */
|
|
55
56
|
listNever?: LayoutListNever;
|
|
57
|
+
/** AW-D23 (AW11): the tier the site is built at — a list's round-two word below the award tier is drawn as its
|
|
58
|
+
* stand-in (`checkList`). Absent: no word is held back. */
|
|
59
|
+
tier?: string | null;
|
|
56
60
|
/** The lists this page is where the site shows (`layoutListsShownOn` — a shop page's products): one of its list sections
|
|
57
61
|
* shows one of them, its items linking to their own page (vectoriox/iox-ui#99). */
|
|
58
62
|
shows?: ReadonlyArray<string>;
|
|
@@ -589,7 +593,7 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
589
593
|
if (g.scroll && !s.pin) add(LayoutIssueCode.Motion, `${lp}.gallery.scroll`, 'a scroll-turned gallery sits in a held section');
|
|
590
594
|
if (g.list) {
|
|
591
595
|
if (g.source === undefined) add(LayoutIssueCode.Content, `${lp}.gallery.source`, 'a list section names the list it shows');
|
|
592
|
-
issues.push(...checkList(g.list, ctx.listShapes?.find(x => x.alias === g.source) ?? null, lp, ctx.listNever));
|
|
596
|
+
issues.push(...checkList(g.list, ctx.listShapes?.find(x => x.alias === g.source) ?? null, lp, ctx.listNever, { tier: ctx.tier, firstScreen: i === 0 }));
|
|
593
597
|
}
|
|
594
598
|
if (!g.scroll) swappable++;
|
|
595
599
|
slides.forEach((slide, k) => photoId(slide.photo?.id, `${lp}.gallery.slides[${k}]`));
|
|
@@ -736,6 +740,18 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
736
740
|
add(LayoutIssueCode.Look, `sections[${v.sections[0]}]`, `${Math.round(v.to - v.from)}px of the laptop's screen with nothing on it (${v.sections.map(i => sections[i].id).join(' → ')}) — a section that flows fills its screens: fewer screens, or layers where the eye would land`,
|
|
737
741
|
voidScreens ? { kind: LayoutMendKind.Screens, sections: voidScreens } : undefined);
|
|
738
742
|
}
|
|
743
|
+
// LI7: a list section never reads empty — its words beside the list, or the list centred under them.
|
|
744
|
+
sections.forEach((s, i) => {
|
|
745
|
+
const bare = layoutListBare(s);
|
|
746
|
+
if (!bare) return;
|
|
747
|
+
const source = s.layers[bare.layer].gallery?.source;
|
|
748
|
+
const heading = ctx.listShapes?.find(x => x.alias === source)?.label;
|
|
749
|
+
const paired = layoutListPair(s, bare.layer, bare.side, heading);
|
|
750
|
+
add(LayoutIssueCode.Look, `sections[${i}].layers[${bare.layer}].col`,
|
|
751
|
+
bare.reads ? `the list leaves the ${bare.side === LayoutListSide.Start ? 'first' : 'last'} columns of its section empty — ${LIST_WORDS_BESIDE_RULE}`
|
|
752
|
+
: `the list stands alone, nothing in its section reads — ${LIST_WORDS_BESIDE_RULE}`,
|
|
753
|
+
paired ? { kind: LayoutMendKind.ListWords, section: i, layer: bare.layer, side: bare.side, ...(heading && !bare.reads ? { heading } : {}) } : undefined);
|
|
754
|
+
});
|
|
739
755
|
const opening = layoutOpeningDisplays(page);
|
|
740
756
|
if ((daring || ctx.design?.animate === SCENE_LEVEL) && sections[0] && !sections[0].readyMade) {
|
|
741
757
|
if (!opening.length) {
|
|
@@ -1128,6 +1144,12 @@ export function mendLayout(page: LayoutPage, issues: ReadonlyArray<LayoutIssue>)
|
|
|
1128
1144
|
if (!layer?.gallery) continue;
|
|
1129
1145
|
layer.gallery.list = structuredClone(mend.mix);
|
|
1130
1146
|
mended.push(issue);
|
|
1147
|
+
} else if (mend?.kind === LayoutMendKind.ListWords) {
|
|
1148
|
+
const section = next.sections?.[mend.section];
|
|
1149
|
+
const paired = section ? layoutListPair(section, mend.layer, mend.side, mend.heading) : null;
|
|
1150
|
+
if (!paired) continue;
|
|
1151
|
+
next.sections[mend.section] = paired;
|
|
1152
|
+
mended.push(issue);
|
|
1131
1153
|
} else if (mend?.kind === LayoutMendKind.Words) {
|
|
1132
1154
|
const layer = layerAt(mend.layer);
|
|
1133
1155
|
if (!layer) continue;
|
|
@@ -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
|
}
|