@vectoriox/iox-ui 5.107.0 → 5.108.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.
@@ -1,6 +1,7 @@
1
1
  import { JsonSchema, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonText } from './json-schema';
2
2
  import {
3
- LAYOUT_BEAT_DELAY, LayoutDial, LayoutForm, LayoutGallery, LayoutIssue, LayoutIssueCode, LayoutLayer, LayoutPage, LayoutSection, LayoutTrack,
3
+ LAYOUT_BEAT_DELAY, LayoutDial, LayoutForm, LayoutGallery, LayoutIssue, LayoutIssueCode, LayoutLayer, LayoutListArrange, LayoutListArrive,
4
+ LayoutListHow, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutListWho, LayoutPage, LayoutSection, LayoutTrack,
4
5
  } from './layout-language';
5
6
  import { isPlainObject, PlainObject } from './shape-check';
6
7
  import { SPEC_SITE_LAYOUT } from './site-spec.generated';
@@ -28,12 +29,62 @@ const SLOT_NAMES: ReadonlyArray<string> = [...V.formSlots, ...CHIP_SLOTS];
28
29
  const ENTER_ON_WIRE: ReadonlyArray<string> = V.enters.flatMap((e: string) => (e === CLIP ? V.sides.map((s: string) => `${CLIP_SIDE}${s}`) : [e]));
29
30
  const VARIANT_ON_WIRE: ReadonlyArray<string> = [NONE, ...V.buttonVariants, ...V.galleryEffects, ...V.formPresets];
30
31
 
32
+ /**
33
+ * List ingredients (list-ingredients-plan.md §2, LI1): a list section's mix travels as ONE list of `<ingredient>:<word>`
34
+ * words (`arrange:strips`, `hover:dim`) and its parts as `<list>.<role>` (`stories.quote`) — two properties, so the
35
+ * request stays inside the 40 the budget allows, and the parts enum is generated from the plan's own lists: a model
36
+ * cannot name a part its list does not have (R-H2).
37
+ */
38
+ const L = SPEC_SITE_LAYOUT.list;
39
+ export enum LayoutMixIngredient {
40
+ Item = 'item',
41
+ Arrange = 'arrange',
42
+ Who = 'who',
43
+ How = 'how',
44
+ Move = 'move',
45
+ Hover = 'hover',
46
+ Arrive = 'arrive',
47
+ Phone = 'phone',
48
+ }
49
+ const MIX_WORDS: Readonly<Record<LayoutMixIngredient, ReadonlyArray<string>>> = {
50
+ [LayoutMixIngredient.Item]: L.items,
51
+ [LayoutMixIngredient.Arrange]: L.arranges,
52
+ [LayoutMixIngredient.Who]: L.standoutWho,
53
+ [LayoutMixIngredient.How]: L.standoutHow,
54
+ [LayoutMixIngredient.Move]: L.moves,
55
+ [LayoutMixIngredient.Hover]: L.hovers,
56
+ [LayoutMixIngredient.Arrive]: L.arrives,
57
+ [LayoutMixIngredient.Phone]: L.phones,
58
+ };
59
+ const MIX_SEPARATOR = ':';
60
+ const PART_SEPARATOR = '.';
61
+ /** Every word the wire's `mix` may hold, ingredient by ingredient. */
62
+ export const LAYOUT_MIX_WORDS: ReadonlyArray<string> = (Object.keys(MIX_WORDS) as LayoutMixIngredient[])
63
+ .flatMap(k => MIX_WORDS[k].map(w => `${k}${MIX_SEPARATOR}${w}`));
64
+
65
+ /** A list a composed page may show, as the wire's parts enum needs it (`layoutListShapes` gives these). */
66
+ export interface LayoutWireList { alias: string; roles: ReadonlyArray<string> }
67
+
68
+ export interface LayoutWireOptions {
69
+ /** The plan's lists: given, every layer carries `mix` and `parts` (LI1 — the list ingredients); absent, the wire is
70
+ * the gate-2 one (37 properties). */
71
+ lists?: ReadonlyArray<LayoutWireList>;
72
+ }
73
+
74
+ /** `<list>.<role>` for every role of every list — what a list section's `parts` may name. */
75
+ export function layoutWirePartWords(lists: ReadonlyArray<LayoutWireList>): string[] {
76
+ return lists.flatMap(l => l.roles.map(r => `${l.alias}${PART_SEPARATOR}${r}`));
77
+ }
78
+
31
79
  export interface LayoutWireSlot { slot: string; text: string }
32
80
  export interface LayoutWireTrack { prop: string; ease: string; values: number[] }
33
81
  export interface LayoutWireLayer {
34
82
  kind: string; role: string; text: string; items: string[]; photos: string[]; source: string; box: number[];
35
83
  size: string; color: string; align: string; z: number; bleed: string; rotate: number; to: string; variant: string;
36
84
  enter: string; depth: string; inner: number; flags: string[]; perView: number; slots: LayoutWireSlot[]; motion: LayoutWireTrack[];
85
+ /** LI1, with `LayoutWireOptions.lists`: a list section's mix (`arrange:grid`…) and its parts (`stories.quote`…). */
86
+ mix?: string[];
87
+ parts?: string[];
37
88
  }
38
89
  export interface LayoutWireSection {
39
90
  id: string; kind: string; screens: number; hold: number; ground: string; rows: number; transition: string; phone: number[];
@@ -47,8 +98,15 @@ const oneOf = (values: ReadonlyArray<string>, d: string) => ({ ...jsonOneOf(valu
47
98
  const listOf = (items: JsonSchema, d: string) => ({ ...jsonListOf(items), description: d });
48
99
  const closed = (properties: Record<string, JsonSchema>, d?: string) => jsonClosedObject(properties, Object.keys(properties), d);
49
100
 
50
- /** The strict format for one composed page. */
51
- export function layoutWireJsonSchema(): JsonSchema {
101
+ /** The strict format for one composed page — with the list ingredients when `options.lists` is given. */
102
+ export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchema {
103
+ const partWords = options.lists ? layoutWirePartWords(options.lists) : [];
104
+ const lists: Record<string, JsonSchema> = options.lists
105
+ ? {
106
+ mix: listOf(jsonOneOf(LAYOUT_MIX_WORDS), "gallery showing a list (source): how its items are shown, one word per choice — item:photo|card · arrange:row|grid|masonry|strips|deck · who:none|middle|first|pointed (which stands out) · how:bigger|wider|raised|brighter · move:… (any; none for a still list) · hover:… (any) · arrive:together|one-by-one|slide-in · phone:swipe|stack|two-up; [] for none"),
107
+ parts: listOf(jsonOneOf(partWords.length ? partWords : [NONE]), "gallery showing a list as cards: the list's fields each card shows, <list>.<role>, the source's own; [] for none"),
108
+ }
109
+ : {};
52
110
  const layer = closed({
53
111
  kind: oneOf(V.kinds, 'what the layer is'),
54
112
  role: oneOf(V.roles, 'lead: the ONE thing the eye finds first in its section · support: follows it · decoration: only fades · static: never moves'),
@@ -76,6 +134,7 @@ export function layoutWireJsonSchema(): JsonSchema {
76
134
  ease: oneOf(V.eases, 'how'),
77
135
  values: listOf({ type: 'number' }, '[from, to, at0, at1]: values and the part of the hold it plays over (0..1)'),
78
136
  }), 'held sections only: tracks the scroll plays; [] for none'),
137
+ ...lists,
79
138
  });
80
139
  const section = closed({
81
140
  id: text('a short slug, unique on the page'),
@@ -121,9 +180,57 @@ function expandGallery(l: PlainObject, flags: ReadonlySet<string>, variant: stri
121
180
  for (const f of ['centered', 'freeMode', 'loop', 'drift', 'scroll'] as const) if (flags.has(f)) gallery[f] = true;
122
181
  if (flags.has('autoplay')) gallery.autoplay = LAYOUT_WIRE_AUTOPLAY_MS;
123
182
  if (nonEmpty(l['source'])) gallery.source = String(l['source']).trim();
183
+ const list = expandListMix(l, gallery);
184
+ if (list) gallery.list = list;
124
185
  return gallery;
125
186
  }
126
187
 
188
+ /** `mix` + `parts` → a list mix, or null when the wire names no mix. Words are kept as written (`checkList` judges them);
189
+ * parts of another list than the gallery's are left out, and the first part names the list when `source` is empty. */
190
+ function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix | null {
191
+ const words = strings(l['mix']);
192
+ if (!words.length) return null;
193
+ const picked = new Map<string, string[]>();
194
+ for (const w of words) {
195
+ const at = w.indexOf(MIX_SEPARATOR);
196
+ if (at > 0) (picked.get(w.slice(0, at)) ?? picked.set(w.slice(0, at), []).get(w.slice(0, at))!).push(w.slice(at + 1));
197
+ }
198
+ const one = (k: LayoutMixIngredient) => picked.get(k)?.[0];
199
+ const parts = strings(l['parts']).filter(p => p !== NONE).map(p => {
200
+ const at = p.lastIndexOf(PART_SEPARATOR);
201
+ return at > 0 ? { list: p.slice(0, at), role: p.slice(at + 1) } : null;
202
+ }).filter((p): p is { list: string; role: string } => !!p);
203
+ if (!gallery.source && parts[0]) gallery.source = parts[0].list;
204
+ const own = parts.filter(p => p.list === gallery.source).map(p => p.role);
205
+ const arrange = (one(LayoutMixIngredient.Arrange) ?? LayoutListArrange.Row) as LayoutListMix['arrange'];
206
+ const who = one(LayoutMixIngredient.Who);
207
+ const how = one(LayoutMixIngredient.How);
208
+ return {
209
+ item: (one(LayoutMixIngredient.Item) ?? (own.length ? LayoutListItem.Card : LayoutListItem.Photo)) as LayoutListMix['item'],
210
+ parts: Array.from(new Set(own)),
211
+ arrange,
212
+ ...(who && who !== LayoutListWho.None ? { standout: { who: who as LayoutListWho, ...(how ? { how: how as LayoutListHow } : {}) } } : {}),
213
+ move: Array.from(new Set(picked.get(LayoutMixIngredient.Move) ?? [])) as LayoutListMix['move'],
214
+ hover: Array.from(new Set(picked.get(LayoutMixIngredient.Hover) ?? [])) as LayoutListMix['hover'],
215
+ arrive: (one(LayoutMixIngredient.Arrive) ?? LayoutListArrive.Together) as LayoutListMix['arrive'],
216
+ phone: (one(LayoutMixIngredient.Phone) ?? (arrange === LayoutListArrange.Row ? LayoutListPhone.Swipe : LayoutListPhone.Stack)) as LayoutListMix['phone'],
217
+ };
218
+ }
219
+
220
+ /** A list mix → the wire's `mix` words and `parts`. */
221
+ function listMixToWire(mix: LayoutListMix, source: string): { mix: string[]; parts: string[] } {
222
+ const w = (k: LayoutMixIngredient, v: string) => `${k}${MIX_SEPARATOR}${v}`;
223
+ return {
224
+ mix: [
225
+ w(LayoutMixIngredient.Item, mix.item), w(LayoutMixIngredient.Arrange, mix.arrange),
226
+ ...(mix.standout ? [w(LayoutMixIngredient.Who, mix.standout.who), ...(mix.standout.how ? [w(LayoutMixIngredient.How, mix.standout.how)] : [])] : []),
227
+ ...mix.move.map(m => w(LayoutMixIngredient.Move, m)), ...mix.hover.map(h => w(LayoutMixIngredient.Hover, h)),
228
+ w(LayoutMixIngredient.Arrive, mix.arrive), w(LayoutMixIngredient.Phone, mix.phone),
229
+ ],
230
+ parts: mix.parts.map(r => `${source}${PART_SEPARATOR}${r}`),
231
+ };
232
+ }
233
+
127
234
  function expandTrack(t: PlainObject): LayoutTrack {
128
235
  const v = Array.isArray(t['values']) ? (t['values'] as unknown[]).map(x => num(x)) : [];
129
236
  return { prop: String(t['prop']) as LayoutTrack['prop'], from: v[0] ?? 0, to: v[1] ?? 0, at: [v[2] ?? 0, v[3] ?? 1], ease: String(t['ease']) as LayoutTrack['ease'] };
@@ -261,6 +368,7 @@ function layerToWire(l: LayoutLayer): LayoutWireLayer {
261
368
  perView: typeof g?.perView === 'number' ? g.perView : 0,
262
369
  slots,
263
370
  motion: (l.motion ?? []).map(t => ({ prop: t.prop, ease: t.ease ?? 'out', values: [t.from, t.to, ...(t.at ?? [0, 1])] })),
371
+ ...(g?.list ? listMixToWire(g.list, g.source ?? '') : {}),
264
372
  };
265
373
  }
266
374
 
@@ -86,6 +86,26 @@ iox-gallery.iox-es-media[data-iox-empty] > .iox-gallery {
86
86
  z-index: 1;
87
87
  }
88
88
 
89
+ /* LI1 (list-ingredients-plan.md): a card's Quote is someone's words — in the page language's own marks (`quotes`
90
+ follows `lang`: “…” in English, „…“ in German), never marks typed into the words a list field holds. */
91
+ .iox-role-card-quote::before { content: open-quote; }
92
+ .iox-role-card-quote::after { content: close-quote; }
93
+
94
+ /* LI1: a list whose mix says `dim` (its frame plays `list.dim`) — when the visitor points at one item, the others rest at
95
+ the look's list-rest-opacity. A mouse only (Emil G1). The item's PARTS fade, never the item itself: an item's own
96
+ transition (a linked card's lift and shadow) is the element style's, and naming opacity on it would replace that list.
97
+ Zero specificity for the timing, so an author's own transition on a part wins. */
98
+ :where(.iox-role-list-dim) :where(.iox-role-card, .iox-role-list-item) > * {
99
+ transition-property: opacity;
100
+ transition-duration: var(--iox-dur-ui);
101
+ transition-timing-function: var(--iox-ease-hover);
102
+ }
103
+ @media (hover: hover) and (pointer: fine) {
104
+ .iox-role-list-dim:has(:is(.iox-role-card, .iox-role-list-item):hover) :is(.iox-role-card, .iox-role-list-item):not(:hover) > * {
105
+ opacity: var(--iox-list-rest-opacity);
106
+ }
107
+ }
108
+
89
109
  /* Link the whole card — the stretched link. The title's <a> is the card's ONE link (its words are the
90
110
  link's name); its ::after covers the card, so a click anywhere on it navigates. The Buttons sit above
91
111
  it and keep their own actions; the focus ring is drawn on the card. Never a link inside a link. On the