@vectoriox/iox-ui 5.106.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
 
@@ -96,6 +96,16 @@ export enum ContentRole {
96
96
  Meta = 'meta',
97
97
  Date = 'date',
98
98
  Gallery = 'gallery',
99
+ /** List ingredients LI0: a mark — a client's or maker's logo or wordmark (a picture). */
100
+ Logo = 'logo',
101
+ /** LI0: a small symbol, named from the icon set. */
102
+ Icon = 'icon',
103
+ /** LI0: someone's words — a testimonial or a story's line. */
104
+ Quote = 'quote',
105
+ /** LI0: who said or made it (their role or place goes in `meta`). */
106
+ Person = 'person',
107
+ /** LI0: where the item leads — its own page or an address. */
108
+ Link = 'link',
99
109
  /** Commerce C-D21: the shop's own price — played only by the shop's fields (`SHOP_ROLES`), never a content type's. */
100
110
  Price = 'price',
101
111
  /** Commerce C-D21: the shop's earlier price, struck through. */
@@ -82,7 +82,12 @@ export const SPEC_SITE_PLAN_SHAPE = {
82
82
  "image?": "string — a field: its picture",
83
83
  "meta?": "string — a field: a short line beside its name (a place, a price)",
84
84
  "date?": "string — a field: when",
85
- "gallery?": "string — an array field: its pictures"
85
+ "gallery?": "string — an array field: its pictures",
86
+ "logo?": "string — a field: a mark (a picture)",
87
+ "icon?": "string — a field: an icon name",
88
+ "quote?": "string — a field: someone's words",
89
+ "person?": "string — a field: who said or made it",
90
+ "link?": "string — a field: where the item leads (a route or an address)"
86
91
  },
87
92
  "field": {
88
93
  "name": "string — unique in the type",
@@ -185,6 +190,11 @@ export const SPEC_SITE_ROLES = {
185
190
  "meta": "a short line beside its name — a place, a price, a duration",
186
191
  "date": "when — a year or a date",
187
192
  "gallery": "its pictures (a list) — the item page's gallery",
193
+ "logo": "a mark — a client's or maker's logo or wordmark (a picture), on the card's top line",
194
+ "icon": "a small symbol, named from the icon set — beside the name on a card",
195
+ "quote": "someone's words — a testimonial or a story's line, shown in quotation marks",
196
+ "person": "who said or made it — a name (their role or place goes in meta)",
197
+ "link": "where the item leads — its own page or an address; the card's arrow goes there",
188
198
  "price": "its price — the shop's own field, shown through the money pipe in the studio currency",
189
199
  "compareAt": "its earlier price, struck through beside the price (the shop's own field)"
190
200
  } as const;
@@ -7007,5 +7017,113 @@ export const SPEC_SITE_LAYOUT = {
7007
7017
  "festival": "playful",
7008
7018
  "zine": "type-as-image",
7009
7019
  "fresh-market": "warm-craft"
7020
+ },
7021
+ "list": {
7022
+ "items": [
7023
+ "photo",
7024
+ "card"
7025
+ ],
7026
+ "arranges": [
7027
+ "row",
7028
+ "grid",
7029
+ "masonry",
7030
+ "strips",
7031
+ "deck"
7032
+ ],
7033
+ "standoutWho": [
7034
+ "none",
7035
+ "middle",
7036
+ "first",
7037
+ "pointed"
7038
+ ],
7039
+ "standoutHow": [
7040
+ "bigger",
7041
+ "wider",
7042
+ "raised",
7043
+ "brighter"
7044
+ ],
7045
+ "moves": [
7046
+ "arrows",
7047
+ "drag",
7048
+ "auto",
7049
+ "page"
7050
+ ],
7051
+ "hovers": [
7052
+ "rise",
7053
+ "open",
7054
+ "zoom",
7055
+ "dim"
7056
+ ],
7057
+ "arrives": [
7058
+ "together",
7059
+ "one-by-one",
7060
+ "slide-in"
7061
+ ],
7062
+ "phones": [
7063
+ "swipe",
7064
+ "stack",
7065
+ "two-up"
7066
+ ],
7067
+ "meanings": {
7068
+ "photo": "pictures only",
7069
+ "card": "a card built from the list's own fields (its parts)",
7070
+ "row": "side by side in one line you move through",
7071
+ "grid": "a still grid",
7072
+ "masonry": "a still wall that keeps every picture's own shape",
7073
+ "strips": "tall strips, one always open wide with its whole story",
7074
+ "deck": "a stack, one card on top, the rest waiting behind",
7075
+ "middle": "the one in the middle of the row",
7076
+ "first": "the first one",
7077
+ "pointed": "the one the visitor points at or taps",
7078
+ "bigger": "larger than the rest",
7079
+ "wider": "open wide (strips only)",
7080
+ "raised": "lifted above the rest",
7081
+ "brighter": "the rest dimmed",
7082
+ "arrows": "arrow buttons",
7083
+ "drag": "dragged with a mouse or a finger",
7084
+ "auto": "turns by itself (pauses under a mouse)",
7085
+ "page": "the page's scroll carries it sideways (alone)",
7086
+ "rise": "an item rises under the mouse",
7087
+ "open": "a strip opens under the mouse (strips only)",
7088
+ "zoom": "the picture grows inside its frame",
7089
+ "dim": "the others dim",
7090
+ "together": "all at once",
7091
+ "one-by-one": "one after another",
7092
+ "slide-in": "sliding in from the side",
7093
+ "swipe": "a row you swipe",
7094
+ "stack": "one under another",
7095
+ "two-up": "two across"
7096
+ },
7097
+ "rules": {
7098
+ "minItems": 3,
7099
+ "strips": [
7100
+ 3,
7101
+ 6
7102
+ ],
7103
+ "onlyStrips": {
7104
+ "standoutHow": [
7105
+ "wider"
7106
+ ],
7107
+ "hovers": [
7108
+ "open"
7109
+ ]
7110
+ },
7111
+ "onlyRow": {
7112
+ "standoutWho": [
7113
+ "middle"
7114
+ ],
7115
+ "moves": [
7116
+ "page"
7117
+ ]
7118
+ },
7119
+ "moving": [
7120
+ "row",
7121
+ "deck"
7122
+ ],
7123
+ "neverSwipe": [
7124
+ "grid",
7125
+ "masonry"
7126
+ ]
7127
+ }
7010
7128
  }
7011
7129
  } as const;
@@ -106,6 +106,13 @@ export interface GoodFit {
106
106
  readonly reasonHe: string;
107
107
  }
108
108
 
109
+ /** What a type's lists never do (contract harness `businessTypes[].lists`, from harness.mjs LIST_NEVER). */
110
+ export interface BusinessTypeLists {
111
+ readonly arranges: ReadonlyArray<string>;
112
+ readonly moves: ReadonlyArray<string>;
113
+ readonly say: ReadonlyArray<string>;
114
+ }
115
+
109
116
  export interface BusinessType {
110
117
  readonly id: string;
111
118
  readonly label: string;
@@ -126,6 +133,9 @@ export interface BusinessType {
126
133
  /** SC6: the most How animated a GENERATED site of this type may start at (`motionFor`). A Scene needs Expressive,
127
134
  * so a type capped below it never gets one. Binds generated output only — the owner may choose any level. */
128
135
  readonly ceiling: DesignMotion['animate'];
136
+ /** List ingredients LI0 (list-ingredients-plan.md L-D12): what this type's lists never do — arrangements and moves
137
+ * the layout's list section is not offered, and the sentences saying why. Binds generated output only. */
138
+ readonly lists: BusinessTypeLists;
129
139
  readonly imagery: string;
130
140
  /** M7: the picture world a site's made pictures start in (generation-core `artDirectionFor`; contract site.pictureWorlds). */
131
141
  readonly world: `${PictureWorld}`;