@vectoriox/iox-ui 5.139.0 → 5.141.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/composite-core/index.d.ts +3 -1
- 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-composite-core.mjs +3 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +813 -595
- package/fesm2022/vectoriox-iox-ui-generation-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 +17 -1
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +63 -2
- package/index.d.ts +22 -1
- package/package.json +1 -1
- package/scene-core/index.d.ts +17 -1
- package/src/assist-core/assist-turn.ts +34 -2
- package/src/composite-core/consent.ts +4 -2
- package/src/generation-core/check-layout.ts +19 -0
- package/src/generation-core/compose-layout.ts +51 -7
- package/src/generation-core/compose-site.ts +6 -0
- package/src/generation-core/header-edit.ts +15 -11
- package/src/generation-core/layout-language.ts +5 -0
- package/src/generation-core/list-space.ts +152 -0
- package/src/generation-core/public-api.ts +1 -0
- package/src/scene-core/split-text.ts +31 -7
- package/styles/iox-design.css +62 -4
|
@@ -31,8 +31,8 @@ const STORE_SLOT_ROLES: ReadonlySet<string> = new Set([ShopRole.CartButton, Acco
|
|
|
31
31
|
/** The roles that link to one of the site's pages (the bar's row, the drawer's list, the bottom bar's items). */
|
|
32
32
|
const PAGE_LINK_ROLES: ReadonlySet<string> = new Set([NavRole.Link, NavRole.DrawerLink, NavRole.BarItem]);
|
|
33
33
|
|
|
34
|
-
/** The pages a header and its companions link to, in their order, once each — what the header is recomposed with
|
|
35
|
-
*
|
|
34
|
+
/** The pages a header and its companions link to, in their order, once each — what the header is recomposed with: a mix
|
|
35
|
+
* change never takes the owner's links away, nor adds the studio's other pages (CC1's `phoneMenuPages`; iox-cms-client#82). */
|
|
36
36
|
function pagesOfHeader(current: SerializedNode, companions: ReadonlyArray<SerializedNode>): HeaderSite['pages'] {
|
|
37
37
|
const out: { name: string; route: string }[] = [];
|
|
38
38
|
const walk = (n: SerializedNode): void => {
|
|
@@ -44,14 +44,18 @@ function pagesOfHeader(current: SerializedNode, companions: ReadonlyArray<Serial
|
|
|
44
44
|
return out;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The site a header is read, recomposed and advised for (`readHeader`, `applyHeaderMix`, and the studio's `headerAdvice`):
|
|
49
|
+
* the pages are the ones the header links to — every ingredient is HOW the header shows its pages, never WHICH (the
|
|
50
|
+
* Pages word is inline / menu / menu-pinned), so an Apply keeps the bar's links exactly (iox-cms-client#82: changing only
|
|
51
|
+
* "Its colours follow" re-made the bar with every page the studio ever had — drafts, archived `-previous` copies, legal
|
|
52
|
+
* pages). Only a header that links to no page takes the studio's. A header that holds the bag or the account entry is a
|
|
53
|
+
* selling site's (unless the site says). Pure.
|
|
54
|
+
*/
|
|
55
|
+
export function headerSiteFor(site: HeaderSite, current: SerializedNode, companions: ReadonlyArray<SerializedNode> = []): HeaderSite {
|
|
50
56
|
let at = site;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (own.length) at = { ...at, pages: own };
|
|
54
|
-
}
|
|
57
|
+
const own = pagesOfHeader(current, companions);
|
|
58
|
+
if (own.length) at = { ...at, pages: own };
|
|
55
59
|
if (at.storeSlots !== undefined) return at;
|
|
56
60
|
let sells = false;
|
|
57
61
|
const walk = (n: SerializedNode): void => { if (n.role && STORE_SLOT_ROLES.has(n.role)) sells = true; (n.children ?? []).forEach(walk); };
|
|
@@ -189,7 +193,7 @@ function compose(mix: HeaderMix, site: HeaderSite, id: string, options: HeaderEd
|
|
|
189
193
|
export function readHeader(root: SerializedNode, site: HeaderSite, options: HeaderEditOptions = {}): HeaderReading {
|
|
190
194
|
const stored = storedHeaderMix(root);
|
|
191
195
|
const mix = stored ?? nearestHeaderMix(root, options.companions ?? []);
|
|
192
|
-
const custom = headerShape(root) !== headerShape(compose(mix,
|
|
196
|
+
const custom = headerShape(root) !== headerShape(compose(mix, headerSiteFor(site, root, options.companions), root.id, options).header);
|
|
193
197
|
return { mix, stored: !!stored, custom, galleryId: headerGalleryIdOf(mix) };
|
|
194
198
|
}
|
|
195
199
|
|
|
@@ -240,7 +244,7 @@ function wordsOf(n: SerializedNode): string {
|
|
|
240
244
|
export function applyHeaderMix(current: SerializedNode, next: HeaderMix, site: HeaderSite, options: HeaderEditOptions = {}): HeaderApplied {
|
|
241
245
|
const curCompanions = options.companions ?? [];
|
|
242
246
|
const baseMix = storedHeaderMix(current) ?? nearestHeaderMix(current, curCompanions);
|
|
243
|
-
const at =
|
|
247
|
+
const at = headerSiteFor(site, current, curCompanions);
|
|
244
248
|
const baseComposed = compose(baseMix, at, current.id, options);
|
|
245
249
|
const composed = compose(next, at, current.id, options);
|
|
246
250
|
const freshGroup = clone(grouped(composed.header, composed.companions));
|
|
@@ -470,6 +470,10 @@ export enum LayoutMendKind {
|
|
|
470
470
|
/** A list section's mix that breaks a list rule the composer can settle (list-ingredients §6, `checkList`): the layer
|
|
471
471
|
* takes the repaired mix — every repair of one list carries the same one. */
|
|
472
472
|
List = 'list',
|
|
473
|
+
/** LI7: a list section that reads empty — the list beside an empty side of its section, or on its own with nothing that
|
|
474
|
+
* reads (`layoutListBare`): its words are set beside it, the list's own name as its heading where none reads
|
|
475
|
+
* (`layoutListPair`). Places change, words never (the name is the plan's). */
|
|
476
|
+
ListWords = 'list-words',
|
|
473
477
|
/** A carried part whose action points at a node the new page no longer has (RD1 — a scroll link to a section that
|
|
474
478
|
* left): the action is dropped from the carry and the drop is said (`mendCarry`), never refused. */
|
|
475
479
|
Link = 'link',
|
|
@@ -531,6 +535,7 @@ export type LayoutMend =
|
|
|
531
535
|
| { kind: LayoutMendKind.Unpin; section: number }
|
|
532
536
|
| { kind: LayoutMendKind.Screens; sections: ReadonlyArray<{ section: number; screens: number }> }
|
|
533
537
|
| { kind: LayoutMendKind.List; layer: string; mix: LayoutListMix }
|
|
538
|
+
| { kind: LayoutMendKind.ListWords; section: number; layer: number; side: 'start' | 'end'; heading?: string }
|
|
534
539
|
| { kind: LayoutMendKind.Link; handle: string; from: string; to: string }
|
|
535
540
|
| { kind: LayoutMendKind.ShowList; layer: string; source: string; mix: LayoutListMix };
|
|
536
541
|
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LAYOUT_TEXT_KINDS, LayoutLayer, LayoutLayerKind, LayoutListArrange, LayoutRole, LayoutSection, LayoutSize,
|
|
3
|
+
} from './layout-language';
|
|
4
|
+
import { LAYOUT_CHECK_VIEWPORT, layoutTextFits } from './layout-space';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where a list sits in its section (list-ingredients-plan.md LI7, Doron 2026-11-22: "the page looks very empty"): a list
|
|
8
|
+
* whose items take less than its section's width — a deck is one card wide, any list can be set in a few columns — leaves
|
|
9
|
+
* a stretch of the section with nothing on it unless its words stand beside it. The judge reads the grid on the check's
|
|
10
|
+
* laptop (`LAYOUT_CHECK_VIEWPORT`); the pairing sets the section's words beside the list. Pure.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** A deck is one card wide (LI4): at most this many px, and this share of its cell (the composer draws exactly this). */
|
|
14
|
+
export const LIST_DECK_MAX_PX = 440;
|
|
15
|
+
export const LIST_DECK_SHARE = 0.8;
|
|
16
|
+
/** The prompt's line for it (the layout brief reads it — one sentence, said once). */
|
|
17
|
+
export const LIST_WORDS_BESIDE_RULE =
|
|
18
|
+
'a list that takes part of its section (a deck is one card wide) has its words beside it — a heading, a line, the link to all of it — or is centred under them; never a list beside an empty half';
|
|
19
|
+
|
|
20
|
+
/** The side of the section a list leaves empty: towards grid line 1 (`start`) or line 13 (`end`). */
|
|
21
|
+
export enum LayoutListSide {
|
|
22
|
+
Start = 'start',
|
|
23
|
+
End = 'end',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A list section that reads empty: the list layer, the side it leaves empty, and whether the section has words that read. */
|
|
27
|
+
export interface LayoutListBare {
|
|
28
|
+
layer: number;
|
|
29
|
+
side: `${LayoutListSide}`;
|
|
30
|
+
reads: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const GRID = 12;
|
|
34
|
+
const COLUMN_PX = LAYOUT_CHECK_VIEWPORT.width / GRID;
|
|
35
|
+
/** Columns with nothing on them at a list's rows, on one side, before the section reads empty (more than a third)… */
|
|
36
|
+
const BARE_COLUMNS = 5;
|
|
37
|
+
/** …unless the other side is as empty (a list centred under its words is a composition, not a gap). */
|
|
38
|
+
const BARE_SKEW = 2;
|
|
39
|
+
/** A list this many columns wide or fewer, with no words in its section, is a list on its own in the middle of nothing. */
|
|
40
|
+
const NARROW_COLUMNS = GRID / 2;
|
|
41
|
+
/** Paired: the words take the empty side's five columns, one column apart from the list's six. */
|
|
42
|
+
const PAIR_WORDS: Readonly<Record<LayoutListSide, [number, number]>> = { [LayoutListSide.Start]: [1, 6], [LayoutListSide.End]: [8, 13] };
|
|
43
|
+
const PAIR_LIST: Readonly<Record<LayoutListSide, [number, number]>> = { [LayoutListSide.Start]: [7, 13], [LayoutListSide.End]: [1, 7] };
|
|
44
|
+
/** The size a heading the pairing writes (the list's own name) is set at. */
|
|
45
|
+
const PAIR_HEADING_SIZE = LayoutSize.L;
|
|
46
|
+
|
|
47
|
+
const isList = (l: LayoutLayer) => l.kind === LayoutLayerKind.Gallery && !!l.gallery?.list && !!l.gallery?.source;
|
|
48
|
+
/** Words that read: a word, a heading, a line of text, a label, a number, a list of lines. */
|
|
49
|
+
const reads = (l: LayoutLayer) => LAYOUT_TEXT_KINDS.has(l.kind);
|
|
50
|
+
/** The section's words: what reads, and its buttons (the link to all of it). */
|
|
51
|
+
const isWords = (l: LayoutLayer) => reads(l) || l.kind === LayoutLayerKind.Button;
|
|
52
|
+
const placed = (l: LayoutLayer) => Array.isArray(l.col) && Array.isArray(l.row);
|
|
53
|
+
const overlaps = (p: readonly number[], q: readonly number[]) => p[0] < q[1] && q[0] < p[1];
|
|
54
|
+
|
|
55
|
+
/** The columns a list's items take on the laptop (grid lines, fractional): a deck a card wide in its cell's middle, any
|
|
56
|
+
* other arrangement its cell. */
|
|
57
|
+
export function layoutListDrawnCols(l: LayoutLayer): [number, number] {
|
|
58
|
+
const [a, b] = l.col;
|
|
59
|
+
if (l.gallery?.list?.arrange !== LayoutListArrange.Deck) return [a, b];
|
|
60
|
+
const cols = Math.min((b - a) * LIST_DECK_SHARE, LIST_DECK_MAX_PX / COLUMN_PX);
|
|
61
|
+
const mid = (a + b) / 2;
|
|
62
|
+
return [mid - cols / 2, mid + cols / 2];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The first list layer of a section that reads empty on the laptop, or null: at the list's rows, one side of the section
|
|
67
|
+
* has more than a third of its columns with nothing on them and the other side is not as empty, or the list is half the
|
|
68
|
+
* width or less and nothing in the section reads. A section that is not a grid of its own (ready-made, carried,
|
|
69
|
+
* sideways) is never judged.
|
|
70
|
+
*/
|
|
71
|
+
export function layoutListBare(s: LayoutSection): LayoutListBare | null {
|
|
72
|
+
if (s.readyMade || s.carry || (s.track ?? 1) > 1 || !Array.isArray(s.layers)) return null;
|
|
73
|
+
const anyReads = s.layers.some(l => reads(l) && !!String(l.text ?? (l.items ?? []).join('')).trim());
|
|
74
|
+
for (let li = 0; li < s.layers.length; li++) {
|
|
75
|
+
const l = s.layers[li];
|
|
76
|
+
if (!isList(l) || !placed(l)) continue;
|
|
77
|
+
const [d0, d1] = layoutListDrawnCols(l);
|
|
78
|
+
const covered = Array.from({ length: GRID }, (_, k) => {
|
|
79
|
+
const centre = k + 1.5;
|
|
80
|
+
if (centre > d0 && centre < d1) return true;
|
|
81
|
+
return s.layers.some((o, oi) => oi !== li && placed(o) && overlaps(o.row, l.row) && centre > o.col[0] && centre < o.col[1]);
|
|
82
|
+
});
|
|
83
|
+
const start = covered.findIndex(c => c);
|
|
84
|
+
if (start < 0) continue;
|
|
85
|
+
const end = GRID - 1 - [...covered].reverse().findIndex(c => c);
|
|
86
|
+
const startRun = start;
|
|
87
|
+
const endRun = GRID - 1 - end;
|
|
88
|
+
const lopsided = Math.max(startRun, endRun) >= BARE_COLUMNS && Math.abs(startRun - endRun) >= BARE_SKEW;
|
|
89
|
+
const alone = !anyReads && d1 - d0 <= NARROW_COLUMNS;
|
|
90
|
+
if (lopsided || alone) return { layer: li, side: startRun >= endRun ? LayoutListSide.Start : LayoutListSide.End, reads: anyReads };
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The pairing (LI7): the list takes six columns on its own side, the section's words — every word, heading, line and
|
|
97
|
+
* button, in reading order — the other five, stacked in the middle of the rows the list and its words spanned, each as
|
|
98
|
+
* tall as its words need. A section where nothing reads gets the list's own name as its heading (`heading` — the plan's
|
|
99
|
+
* name for the list, never a word made up). On a phone the words come first, then the list, then the rest as they were.
|
|
100
|
+
* Null when it cannot: another layer (a photo, a shape) stands where the words or the list would go, no words and no
|
|
101
|
+
* name, or more words than rows.
|
|
102
|
+
*/
|
|
103
|
+
export function layoutListPair(s: LayoutSection, li: number, side: `${LayoutListSide}`, heading?: string | null): LayoutSection | null {
|
|
104
|
+
const list = s.layers?.[li];
|
|
105
|
+
if (!list || !isList(list) || !placed(list)) return null;
|
|
106
|
+
const next = structuredClone(s) as LayoutSection;
|
|
107
|
+
const name = String(heading ?? '').trim();
|
|
108
|
+
const anyReads = next.layers.some(l => reads(l) && !!String(l.text ?? (l.items ?? []).join('')).trim());
|
|
109
|
+
// What the words spanned before (the list's rows and theirs) is the pairing's height; a heading it writes has no place yet.
|
|
110
|
+
const before = next.layers.filter((l, i) => i !== li && isWords(l) && placed(l));
|
|
111
|
+
const r0 = Math.min(list.row[0], ...before.map(l => l.row[0]));
|
|
112
|
+
const r1 = Math.max(list.row[1], ...before.map(l => l.row[1]));
|
|
113
|
+
const rows = r1 - r0;
|
|
114
|
+
const added = anyReads ? -1 : next.layers.length;
|
|
115
|
+
if (!anyReads) {
|
|
116
|
+
if (!name) return null;
|
|
117
|
+
next.layers.push({ kind: LayoutLayerKind.Heading, role: LayoutRole.Support, text: name, size: PAIR_HEADING_SIZE, col: [1, 2], row: [r0, r0 + 1] });
|
|
118
|
+
}
|
|
119
|
+
const words = next.layers
|
|
120
|
+
.map((l, i) => ({ l, i }))
|
|
121
|
+
.filter(({ l, i }) => i !== li && isWords(l) && placed(l))
|
|
122
|
+
// The list's name it writes leads; the rest in reading order.
|
|
123
|
+
.sort((a, b) => Number(b.i === added) - Number(a.i === added) || a.l.row[0] - b.l.row[0] || a.l.col[0] - b.l.col[0] || a.i - b.i);
|
|
124
|
+
if (words.length > rows) return null;
|
|
125
|
+
const wordsCol = PAIR_WORDS[side as LayoutListSide];
|
|
126
|
+
const listCol = PAIR_LIST[side as LayoutListSide];
|
|
127
|
+
const others = next.layers.filter((l, i) => i !== li && !isWords(l) && placed(l));
|
|
128
|
+
if (others.some(o => overlaps(o.row, [r0, r1]) && (overlaps(o.col, wordsCol) || overlaps(o.col, listCol)))) return null;
|
|
129
|
+
|
|
130
|
+
// Each word as tall as its words need (one row at least), the block in the middle of the span.
|
|
131
|
+
const heights = words.map(() => 1);
|
|
132
|
+
const fits = (k: number) => layoutTextFits({ ...words[k].l, col: wordsCol, row: [0, heights[k]] }, next);
|
|
133
|
+
for (let grow = true; grow && heights.reduce((a, b) => a + b, 0) < rows;) {
|
|
134
|
+
const k = words.findIndex((_, j) => !fits(j));
|
|
135
|
+
grow = k >= 0;
|
|
136
|
+
if (grow) heights[k]++;
|
|
137
|
+
}
|
|
138
|
+
let at = r0 + Math.floor((rows - heights.reduce((a, b) => a + b, 0)) / 2);
|
|
139
|
+
words.forEach((w, k) => {
|
|
140
|
+
w.l.col = [...wordsCol];
|
|
141
|
+
w.l.row = [at, at + heights[k]];
|
|
142
|
+
at += heights[k];
|
|
143
|
+
});
|
|
144
|
+
next.layers[li].col = [...listCol];
|
|
145
|
+
next.layers[li].row = [r0, r1];
|
|
146
|
+
|
|
147
|
+
// A phone reads the words, then the list, then the rest in the order it had.
|
|
148
|
+
const was = Array.isArray(s.phone) && s.phone.length === s.layers.length ? s.phone : s.layers.map((_, i) => i);
|
|
149
|
+
const first = [...words.map(w => w.i), li];
|
|
150
|
+
next.phone = [...first, ...was.filter(i => !first.includes(i)), ...next.layers.map((_, i) => i).filter(i => !first.includes(i) && !was.includes(i))];
|
|
151
|
+
return next;
|
|
152
|
+
}
|
|
@@ -63,6 +63,7 @@ export * from './check-layout';
|
|
|
63
63
|
export * from './check-list';
|
|
64
64
|
export * from './list-table';
|
|
65
65
|
export * from './layout-space';
|
|
66
|
+
export * from './list-space';
|
|
66
67
|
export * from './layout-fingerprint';
|
|
67
68
|
export * from './header-mix';
|
|
68
69
|
export * from './header-edit';
|
|
@@ -51,6 +51,32 @@ export function lettersSplittable(text: string): boolean {
|
|
|
51
51
|
return !JOINED_SCRIPTS.test(text);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/** The pieces a letter split makes of `text`: the letters of its words (a letter with its points or a joined emoji is
|
|
55
|
+
* one). The spaces are no piece. */
|
|
56
|
+
export function letterCount(text: string): number {
|
|
57
|
+
const words: string[] = text.match(/\S+/g) ?? [];
|
|
58
|
+
return words.reduce((n, word) => n + graphemes(word).length, 0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Why a reveal set to Letter by letter comes in by word for a text (AW10-D2). The values are the panel's words' keys. */
|
|
62
|
+
export enum LetterRefusal {
|
|
63
|
+
/** A script whose letters join (Arabic, Indic, Thai…): pulled apart, each would show its isolated form. */
|
|
64
|
+
Joined = 'letterJoined',
|
|
65
|
+
/** Longer than a display line: over `LETTER_PIECE_CAP` letters. */
|
|
66
|
+
Long = 'letterLong',
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* THE rule a letter split follows (AW10-D2): why `text` cannot come in letter by letter, or null when it can (an empty
|
|
71
|
+
* text refuses nothing — there is nothing to split). `splitForReveal` asks it before splitting, and the builder's panel
|
|
72
|
+
* asks it to SAY so before the text plays — one rule, so the two never disagree (vectoriox/iox-ui#107).
|
|
73
|
+
*/
|
|
74
|
+
export function letterRefusalOf(text: string | null | undefined): LetterRefusal | null {
|
|
75
|
+
if (!text) return null;
|
|
76
|
+
if (!lettersSplittable(text)) return LetterRefusal.Joined;
|
|
77
|
+
return letterCount(text) > LETTER_PIECE_CAP ? LetterRefusal.Long : null;
|
|
78
|
+
}
|
|
79
|
+
|
|
54
80
|
const SKIPPED_TAGS: ReadonlySet<string> = new Set(['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'SELECT', 'OPTION']);
|
|
55
81
|
const SHOW_TEXT = 4;
|
|
56
82
|
/** Hebrew through Arabic Extended, and their presentation forms. */
|
|
@@ -152,7 +178,7 @@ export function splitText(root: HTMLElement, options: SplitTextOptions): SplitTe
|
|
|
152
178
|
const planned = texts.map(original => ({
|
|
153
179
|
original, parts: textPieces(original.nodeValue ?? '', keepRuns && !!options.rtl, keepRuns && !options.rtl),
|
|
154
180
|
}));
|
|
155
|
-
const pieceCount = (part: TextPiece): number => (!part.word ? 0 : letters ?
|
|
181
|
+
const pieceCount = (part: TextPiece): number => (!part.word ? 0 : letters ? letterCount(part.text) : 1);
|
|
156
182
|
const count = planned.reduce((sum, { parts }) => sum + parts.reduce((n, part) => n + pieceCount(part), 0), 0);
|
|
157
183
|
if (!count || count > options.cap) return null;
|
|
158
184
|
|
|
@@ -263,12 +289,10 @@ export function splitForReveal(el: HTMLElement, by: TextRevealBy, look: TextReve
|
|
|
263
289
|
if (el.isContentEditable) return null;
|
|
264
290
|
const rtl = el.ownerDocument.defaultView?.getComputedStyle(el).direction === 'rtl';
|
|
265
291
|
const mask = look === TextRevealLook.Rise;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
split = splitText(el, { cap: REVEAL_PIECE_CAP, mask, rtl });
|
|
271
|
-
}
|
|
292
|
+
// The text a split reads: its text nodes, apart (a letter never joins across two of them).
|
|
293
|
+
const used = by === TextRevealBy.Letter && letterRefusalOf(textNodesOf(el).map(t => t.nodeValue ?? '').join(' ')) ? TextRevealBy.Word : by;
|
|
294
|
+
const letters = used === TextRevealBy.Letter;
|
|
295
|
+
const split = splitText(el, { cap: letters ? LETTER_PIECE_CAP : REVEAL_PIECE_CAP, mask, rtl, letters });
|
|
272
296
|
if (!split) return null;
|
|
273
297
|
const boxes = used === TextRevealBy.Line ? split.pieces.map(piece => ((mask ? piece.parentElement : piece) as HTMLElement).getBoundingClientRect()) : [];
|
|
274
298
|
const order = used === TextRevealBy.Line ? lineIndexes(boxes.map(box => box.top), boxes.map(box => box.height)) : split.pieces.map((_, i) => i);
|
package/styles/iox-design.css
CHANGED
|
@@ -140,6 +140,7 @@ iox-gallery.iox-es-media[data-iox-empty] > .iox-gallery {
|
|
|
140
140
|
--strip-k: 0;
|
|
141
141
|
--strip-dir: 1;
|
|
142
142
|
--strip-gap: var(--iox-space-gap);
|
|
143
|
+
--strip-radius: var(--iox-card-radius);
|
|
143
144
|
/* A closed strip's width, and an open one's: the open strip takes what the closed ones leave. */
|
|
144
145
|
--strip-c: calc((100cqi - (var(--strip-n) - 1) * var(--strip-gap)) / (var(--strip-n) + 2.5));
|
|
145
146
|
--strip-o: calc(100cqi - (var(--strip-n) - 1) * (var(--strip-c) + var(--strip-gap)));
|
|
@@ -161,13 +162,15 @@ iox-gallery.iox-es-media[data-iox-empty] > .iox-gallery {
|
|
|
161
162
|
min-width: 0;
|
|
162
163
|
margin: 0;
|
|
163
164
|
transform: translateX(calc(var(--strip-dir) * (var(--strip-i) * (var(--strip-c) + var(--strip-gap)) + var(--strip-after) * (var(--strip-o) - var(--strip-c)))));
|
|
164
|
-
/* 8px outside the box stays painted: the focus ring and the card's own shadow.
|
|
165
|
-
|
|
165
|
+
/* 8px outside the box stays painted: the focus ring and the card's own shadow. LI7: the cut keeps the item's corner
|
|
166
|
+
(a card's radius, a picture's) — a closed strip is a rounded strip, never a square cut through a card. */
|
|
167
|
+
clip-path: inset(-8px calc(var(--strip-cut) - 8px) -8px -8px round var(--strip-radius));
|
|
166
168
|
transition-property: transform, clip-path;
|
|
167
169
|
transition-duration: var(--iox-dur-base);
|
|
168
170
|
transition-timing-function: var(--iox-ease-standard);
|
|
169
171
|
}
|
|
170
|
-
:is([class*="iox-role-list-strips"], [class*="iox-role-list-strips"] > .repeater-wrapper) > .repeater-root:dir(rtl) > * { clip-path: inset(-8px -8px -8px calc(var(--strip-cut) - 8px)); }
|
|
172
|
+
:is([class*="iox-role-list-strips"], [class*="iox-role-list-strips"] > .repeater-wrapper) > .repeater-root:dir(rtl) > * { clip-path: inset(-8px -8px -8px calc(var(--strip-cut) - 8px) round var(--strip-radius)); }
|
|
173
|
+
:is([class*="iox-role-list-strips"], [class*="iox-role-list-strips"] > .repeater-wrapper) > .repeater-root > :has(> .iox-role-list-item) { --strip-radius: var(--iox-image-radius); }
|
|
171
174
|
:is([class*="iox-role-list-strips"], [class*="iox-role-list-strips"] > .repeater-wrapper) > .repeater-root > :nth-child(n+7) { display: none; }
|
|
172
175
|
:is([class*="iox-role-list-strips"], [class*="iox-role-list-strips"] > .repeater-wrapper) > .repeater-root > :nth-child(1) { --strip-i: 0; }
|
|
173
176
|
:is([class*="iox-role-list-strips"], [class*="iox-role-list-strips"] > .repeater-wrapper) > .repeater-root > :nth-child(2) { --strip-i: 1; }
|
|
@@ -1320,10 +1323,65 @@ span.iox-video__play { pointer-events: none; }
|
|
|
1320
1323
|
@media (max-width: 767px) {
|
|
1321
1324
|
/* :root out-ranks the component path's own scoped `.swiper { width: 100% }`. */
|
|
1322
1325
|
:root .swiper.swiper-cards {
|
|
1323
|
-
|
|
1326
|
+
/* LI7: narrow enough that the two cards peeking past it stay on the phone's page. */
|
|
1327
|
+
width: 78%;
|
|
1324
1328
|
margin-inline: auto;
|
|
1325
1329
|
}
|
|
1326
1330
|
}
|
|
1331
|
+
/* LI7 (list-ingredients-plan.md): a list's DECK, drawn whole and turned on the look's curve. Swiper's slides clip square
|
|
1332
|
+
(overflow hidden) and the bar's rule clips the track, which cut the turned cards behind straight at the card's bottom:
|
|
1333
|
+
a list's deck clips nothing, and its track keeps room under the stack for the turned corners and the look's shadow (a
|
|
1334
|
+
share of the card's width — the turn grows with it). Each card peeks with the item's own corner (the composer stamps
|
|
1335
|
+
it on the slide) and Swiper's shading over it is rounded to it and fades toward the section's ground, never Swiper's
|
|
1336
|
+
grey; at most two cards wait on each side. Transform and opacity only, on the look's slider curve; a new step starts
|
|
1337
|
+
from where the cards are (CSS transitions retarget). Under reduced motion the cards are stepped, never turned
|
|
1338
|
+
(planSwiperOptions' SLIDER_CARDS). */
|
|
1339
|
+
:is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-cards {
|
|
1340
|
+
overflow: visible;
|
|
1341
|
+
}
|
|
1342
|
+
:is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-cards > .swiper-wrapper {
|
|
1343
|
+
overflow: visible;
|
|
1344
|
+
padding-block-end: 7%;
|
|
1345
|
+
}
|
|
1346
|
+
:is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-cards > .swiper-wrapper > .swiper-slide {
|
|
1347
|
+
overflow: visible;
|
|
1348
|
+
transition-property: transform, opacity;
|
|
1349
|
+
transition-timing-function: var(--iox-slider-ease, ease);
|
|
1350
|
+
will-change: transform;
|
|
1351
|
+
}
|
|
1352
|
+
:is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-cards .swiper-slide-shadow {
|
|
1353
|
+
border-radius: inherit;
|
|
1354
|
+
background: color-mix(in srgb, var(--iox-bg) 55%, transparent);
|
|
1355
|
+
transition-property: opacity;
|
|
1356
|
+
transition-timing-function: var(--iox-slider-ease, ease);
|
|
1357
|
+
}
|
|
1358
|
+
:is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-cards > .swiper-wrapper > .swiper-slide:not(.swiper-slide-active, .swiper-slide-prev, .swiper-slide-next, .swiper-slide-next + .swiper-slide, :has(+ .swiper-slide-prev)) {
|
|
1359
|
+
opacity: 0;
|
|
1360
|
+
}
|
|
1361
|
+
/* LI7: a list's ROW keeps room for what its cards paint past their box — a raised or bigger card, one risen under the
|
|
1362
|
+
mouse, the look's shadow — over and under its track, which still clips (a slide taller than its track never spills
|
|
1363
|
+
over the bar). The room is padding the track gives back as a negative margin: nothing moves, nothing is cut straight.
|
|
1364
|
+
Under the track the room is the bar's own top space (12px), so the arrows stay pressable; the track lets the pointer
|
|
1365
|
+
through its room to whatever is under it, its slides take it. A row's first card that stands bigger grows away from
|
|
1366
|
+
the row's edge. */
|
|
1367
|
+
:is(.iox-role-list, .iox-role-list-dim) .swiper-horizontal:not(.swiper-cards) {
|
|
1368
|
+
overflow: clip visible;
|
|
1369
|
+
}
|
|
1370
|
+
:is(.iox-role-list, .iox-role-list-dim) .swiper-horizontal:not(.swiper-cards) > .swiper-wrapper {
|
|
1371
|
+
overflow: visible clip;
|
|
1372
|
+
padding-block: 24px 12px;
|
|
1373
|
+
margin-block: -24px -12px;
|
|
1374
|
+
pointer-events: none;
|
|
1375
|
+
}
|
|
1376
|
+
:is(.iox-role-list, .iox-role-list-dim) .swiper-horizontal:not(.swiper-cards) > .swiper-wrapper > .swiper-slide {
|
|
1377
|
+
pointer-events: auto;
|
|
1378
|
+
}
|
|
1379
|
+
.swiper-slide:first-child .iox-role-list-first-bigger {
|
|
1380
|
+
transform-origin: 0% 50%;
|
|
1381
|
+
}
|
|
1382
|
+
.swiper-slide:first-child:dir(rtl) .iox-role-list-first-bigger {
|
|
1383
|
+
transform-origin: 100% 50%;
|
|
1384
|
+
}
|
|
1327
1385
|
/* A Slider the SCROLL plays: its runway holds the slider mid-screen while the page scrolls past half a screen per
|
|
1328
1386
|
picture; the ONE scene driver moves it, resting on each picture (scene-core `heldProgress`). `--slider-steps` is
|
|
1329
1387
|
written by the renderers (no layout shift), `--slider-h` by the slider's boot. On the canvas the driver pins it
|