@vectoriox/iox-ui 5.110.0 → 5.112.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.
@@ -0,0 +1,235 @@
1
+ import { AiStep } from '@vectoriox/iox-ui/generation-core';
2
+
3
+ /**
4
+ * The surfaces AI Assist runs on (ai-assist-plan §2, §4): each screen that offers a prompt registers ONE spec — what it
5
+ * may change (families), how an accepted change is committed, which model steps a turn uses, the role actions the
6
+ * server re-checks, whether it reads photos and the focus ladder its chip widens along.
7
+ */
8
+
9
+ export enum AssistSurface {
10
+ BuilderPage = 'builderPage',
11
+ ContentItem = 'contentItem',
12
+ ContentFromPhotos = 'contentFromPhotos',
13
+ ContentList = 'contentList',
14
+ SchemaType = 'schemaType',
15
+ ShopProduct = 'shopProduct',
16
+ Media = 'media',
17
+ BuilderSite = 'builderSite',
18
+ FormInbox = 'formInbox',
19
+ }
20
+
21
+ /** How an accepted turn reaches the studio (plan §3e). */
22
+ export enum CommitKind {
23
+ /** One builder history step. */
24
+ BuilderStep = 'builderStep',
25
+ /** Written into the screen's form; Save stays the owner's. */
26
+ FormFill = 'formFill',
27
+ /** A server run that writes drafts, with its own Undo. */
28
+ Run = 'run',
29
+ /** Nothing is written: filters, a copied reply. */
30
+ View = 'view',
31
+ }
32
+
33
+ /** The closed edit families a sentence may be answered in — one strict request each. */
34
+ export enum EditFamily {
35
+ Words = 'words',
36
+ Sections = 'sections',
37
+ Style = 'style',
38
+ Look = 'look',
39
+ Fields = 'fields',
40
+ Items = 'items',
41
+ View = 'view',
42
+ Schema = 'schema',
43
+ Media = 'media',
44
+ Plan = 'plan',
45
+ }
46
+
47
+ /** The model steps of a turn — generation-core's `AiStep` rows (Settings ▸ AI ▸ Models), never a second spelling. */
48
+ export const AssistStep = {
49
+ AssistRoute: AiStep.AssistRoute,
50
+ AssistEdit: AiStep.AssistEdit,
51
+ AssistRead: AiStep.AssistRead,
52
+ } as const;
53
+ export type AssistStep = typeof AssistStep[keyof typeof AssistStep];
54
+
55
+ /** One rung of a surface's focus ladder — the chip's ✕ widens to the next rung. */
56
+ export enum AssistScope {
57
+ Field = 'field',
58
+ Item = 'item',
59
+ Type = 'type',
60
+ Types = 'types',
61
+ Node = 'node',
62
+ Section = 'section',
63
+ Page = 'page',
64
+ Site = 'site',
65
+ Photo = 'photo',
66
+ Photos = 'photos',
67
+ Rows = 'rows',
68
+ Slot = 'slot',
69
+ Library = 'library',
70
+ Submission = 'submission',
71
+ }
72
+
73
+ /** iox-cms role actions (`roles/enums.ts` `Permissions`) a surface needs — the server re-checks them, never only the client. */
74
+ export enum AssistPermission {
75
+ SchemaAll = 'schema_all',
76
+ ContentRead = 'content_read',
77
+ ContentCreate = 'content_create',
78
+ ContentUpdate = 'content_update',
79
+ PageRead = 'page_read',
80
+ PageCreate = 'page_create',
81
+ PageUpdate = 'page_update',
82
+ PageDelete = 'page_delete',
83
+ StorageAll = 'storage_all',
84
+ ProductsAll = 'products_all',
85
+ }
86
+
87
+ export enum SurfaceStatus {
88
+ Built = 'built',
89
+ Planned = 'planned',
90
+ }
91
+
92
+ export interface SurfaceSpec {
93
+ readonly surface: AssistSurface;
94
+ readonly families: ReadonlyArray<EditFamily>;
95
+ readonly commit: CommitKind;
96
+ /** A family committed differently from the surface (the list's items are a Run; its filters a View). */
97
+ readonly familyCommits?: Readonly<Partial<Record<EditFamily, CommitKind>>>;
98
+ /** Model steps a turn may use. Media (S7) uses the picture steps of generation-core, none of these. */
99
+ readonly steps: ReadonlyArray<AssistStep>;
100
+ /** Every one is required. `content_<action>` is specialised per content type when `perContentType`. */
101
+ readonly permissions: ReadonlyArray<AssistPermission>;
102
+ /** A family that needs more than the surface does. */
103
+ readonly familyPermissions?: Readonly<Partial<Record<EditFamily, ReadonlyArray<AssistPermission>>>>;
104
+ /** The content permissions name a type (`content_<type>_<action>`), as the iox-cms guard specialises them. */
105
+ readonly perContentType: boolean;
106
+ readonly readsPhotos: boolean;
107
+ /** The focus ladder, narrowest first. */
108
+ readonly scopes: ReadonlyArray<AssistScope>;
109
+ readonly status: SurfaceStatus;
110
+ }
111
+
112
+ const spec = (s: Omit<SurfaceSpec, 'perContentType' | 'readsPhotos'> & Partial<Pick<SurfaceSpec, 'perContentType' | 'readsPhotos'>>): SurfaceSpec => ({
113
+ perContentType: false,
114
+ readsPhotos: false,
115
+ ...s,
116
+ });
117
+
118
+ export const SURFACES: Readonly<Record<AssistSurface, SurfaceSpec>> = {
119
+ [AssistSurface.BuilderPage]: spec({
120
+ surface: AssistSurface.BuilderPage,
121
+ families: [EditFamily.Words, EditFamily.Sections, EditFamily.Style, EditFamily.Look],
122
+ commit: CommitKind.BuilderStep,
123
+ steps: [AssistStep.AssistRoute, AssistStep.AssistEdit],
124
+ permissions: [AssistPermission.PageUpdate],
125
+ scopes: [AssistScope.Node, AssistScope.Section, AssistScope.Page],
126
+ status: SurfaceStatus.Planned,
127
+ }),
128
+ [AssistSurface.ContentItem]: spec({
129
+ surface: AssistSurface.ContentItem,
130
+ families: [EditFamily.Fields],
131
+ commit: CommitKind.FormFill,
132
+ steps: [AssistStep.AssistRoute, AssistStep.AssistEdit],
133
+ permissions: [AssistPermission.ContentUpdate],
134
+ perContentType: true,
135
+ scopes: [AssistScope.Field, AssistScope.Item, AssistScope.Type],
136
+ status: SurfaceStatus.Built,
137
+ }),
138
+ [AssistSurface.ContentFromPhotos]: spec({
139
+ surface: AssistSurface.ContentFromPhotos,
140
+ families: [EditFamily.Fields, EditFamily.Media],
141
+ commit: CommitKind.Run,
142
+ steps: [AssistStep.AssistRoute, AssistStep.AssistRead, AssistStep.AssistEdit],
143
+ permissions: [AssistPermission.ContentCreate, AssistPermission.StorageAll],
144
+ perContentType: true,
145
+ readsPhotos: true,
146
+ scopes: [AssistScope.Photo, AssistScope.Photos, AssistScope.Type],
147
+ status: SurfaceStatus.Planned,
148
+ }),
149
+ [AssistSurface.ContentList]: spec({
150
+ surface: AssistSurface.ContentList,
151
+ families: [EditFamily.View, EditFamily.Items],
152
+ commit: CommitKind.View,
153
+ familyCommits: { [EditFamily.Items]: CommitKind.Run },
154
+ steps: [AssistStep.AssistRoute, AssistStep.AssistEdit],
155
+ permissions: [AssistPermission.ContentRead],
156
+ familyPermissions: { [EditFamily.Items]: [AssistPermission.ContentCreate, AssistPermission.ContentUpdate] },
157
+ perContentType: true,
158
+ scopes: [AssistScope.Rows, AssistScope.Type],
159
+ status: SurfaceStatus.Planned,
160
+ }),
161
+ [AssistSurface.SchemaType]: spec({
162
+ surface: AssistSurface.SchemaType,
163
+ families: [EditFamily.Schema],
164
+ commit: CommitKind.FormFill,
165
+ steps: [AssistStep.AssistRoute, AssistStep.AssistEdit],
166
+ permissions: [AssistPermission.SchemaAll],
167
+ scopes: [AssistScope.Field, AssistScope.Type, AssistScope.Types],
168
+ status: SurfaceStatus.Planned,
169
+ }),
170
+ [AssistSurface.ShopProduct]: spec({
171
+ surface: AssistSurface.ShopProduct,
172
+ families: [EditFamily.Fields],
173
+ commit: CommitKind.FormFill,
174
+ steps: [AssistStep.AssistRoute, AssistStep.AssistRead, AssistStep.AssistEdit],
175
+ permissions: [AssistPermission.ProductsAll],
176
+ readsPhotos: true,
177
+ scopes: [AssistScope.Field, AssistScope.Item],
178
+ status: SurfaceStatus.Planned,
179
+ }),
180
+ [AssistSurface.Media]: spec({
181
+ surface: AssistSurface.Media,
182
+ families: [EditFamily.Media],
183
+ commit: CommitKind.Run,
184
+ steps: [],
185
+ permissions: [AssistPermission.StorageAll],
186
+ readsPhotos: true,
187
+ scopes: [AssistScope.Slot, AssistScope.Library],
188
+ status: SurfaceStatus.Planned,
189
+ }),
190
+ [AssistSurface.BuilderSite]: spec({
191
+ surface: AssistSurface.BuilderSite,
192
+ families: [EditFamily.Plan, EditFamily.Sections],
193
+ commit: CommitKind.Run,
194
+ steps: [AssistStep.AssistRoute, AssistStep.AssistEdit],
195
+ permissions: [AssistPermission.PageCreate, AssistPermission.PageUpdate, AssistPermission.PageDelete],
196
+ familyPermissions: { [EditFamily.Plan]: [AssistPermission.SchemaAll] },
197
+ scopes: [AssistScope.Page, AssistScope.Site],
198
+ status: SurfaceStatus.Planned,
199
+ }),
200
+ [AssistSurface.FormInbox]: spec({
201
+ surface: AssistSurface.FormInbox,
202
+ families: [EditFamily.Words],
203
+ commit: CommitKind.View,
204
+ steps: [AssistStep.AssistRoute, AssistStep.AssistEdit],
205
+ permissions: [AssistPermission.PageRead],
206
+ scopes: [AssistScope.Submission],
207
+ status: SurfaceStatus.Planned,
208
+ }),
209
+ };
210
+
211
+ export const surfaceSpec = (surface: AssistSurface): SurfaceSpec => SURFACES[surface];
212
+
213
+ export const builtSurfaces = (): AssistSurface[] =>
214
+ Object.values(SURFACES).filter(s => s.status === SurfaceStatus.Built).map(s => s.surface);
215
+
216
+ export const commitOf = (surface: AssistSurface, family: EditFamily): CommitKind =>
217
+ SURFACES[surface].familyCommits?.[family] ?? SURFACES[surface].commit;
218
+
219
+ const CONTENT_PERMISSION_PREFIX = 'content_';
220
+ const ALL_SUFFIX = '_all';
221
+
222
+ /**
223
+ * The permission strings the server checks for a turn on this surface (and these families): `content_<action>` becomes
224
+ * `content_<type>_<action>` on a per-type surface — the same specialisation iox-cms's AuthorizationGuard applies to a
225
+ * `:resource` route, so a user granted only `content_posts_update` may assist on posts and nowhere else.
226
+ */
227
+ export function surfacePermissions(surface: AssistSurface, contentType?: string, families: ReadonlyArray<EditFamily> = []): string[] {
228
+ const s = SURFACES[surface];
229
+ const all = [...s.permissions, ...families.flatMap(f => s.familyPermissions?.[f] ?? [])];
230
+ const named = all.map(p => {
231
+ if (!s.perContentType || !contentType || !p.startsWith(CONTENT_PERMISSION_PREFIX) || p.endsWith(ALL_SUFFIX)) return p as string;
232
+ return `${CONTENT_PERMISSION_PREFIX}${contentType}_${p.slice(CONTENT_PERMISSION_PREFIX.length)}`;
233
+ });
234
+ return [...new Set(named)];
235
+ }
@@ -32,6 +32,12 @@ export enum AiStep {
32
32
  NameStructures = 'scanNaming',
33
33
  /** M8 gate 2: each composed page's layout, one strict request a page, after the plan (M8-G2-D2). */
34
34
  ComposePages = 'composePages',
35
+ /** AI Assist (A-D7): which edit families a sentence on a screen asks for — or that it cannot be done. Fast, small. */
36
+ AssistRoute = 'assistRoute',
37
+ /** AI Assist: the edits themselves, one strict request per routed family. */
38
+ AssistEdit = 'assistEdit',
39
+ /** AI Assist: photos read into content (≤ 6 a request, S3). */
40
+ AssistRead = 'assistRead',
35
41
  }
36
42
 
37
43
  export const AI_STEPS: ReadonlyArray<AiStep> = Object.values(AiStep);
@@ -45,6 +51,9 @@ export const AI_STEP_LABELS: Readonly<Record<AiStep, string>> = {
45
51
  [AiStep.CheckPictures]: 'Check pictures',
46
52
  [AiStep.NameStructures]: 'Name repeated structures',
47
53
  [AiStep.ComposePages]: 'Compose your pages',
54
+ [AiStep.AssistRoute]: 'Understand your request',
55
+ [AiStep.AssistEdit]: 'Make the change',
56
+ [AiStep.AssistRead]: 'Read your photos',
48
57
  };
49
58
 
50
59
  /** What a model must be able to do for a step to run on it. */
@@ -62,6 +71,9 @@ export const AI_STEP_NEEDS: Readonly<Record<AiStep, ReadonlyArray<AiCapability>>
62
71
  [AiStep.CheckPictures]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
63
72
  [AiStep.NameStructures]: [AiCapability.StructuredOutput],
64
73
  [AiStep.ComposePages]: [AiCapability.StructuredOutput],
74
+ [AiStep.AssistRoute]: [AiCapability.StructuredOutput],
75
+ [AiStep.AssistEdit]: [AiCapability.StructuredOutput],
76
+ [AiStep.AssistRead]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
65
77
  };
66
78
 
67
79
  /**
@@ -128,6 +140,12 @@ export const AI_STEP_TYPICAL_TOKENS: Readonly<Record<AiStep, AiTokenCounts>> = {
128
140
  // for the two pages and their repairs, where 14k / 18k (41.6) had been counted. Counted as plain input so the Start
129
141
  // gate holds the whole cost (iox-cms#43).
130
142
  [AiStep.ComposePages]: { input: 36_000, output: 22_000, cacheWrite: 0, cacheRead: 0 },
143
+ // AI Assist (plan §3c): the route reads the brief's names and the sentence and answers ≤ 12 properties; an edit reads
144
+ // the focus in full (a content item, a page summary) and writes ≤ 40 properties of values; a read takes ≤ 6 photos
145
+ // downscaled (~1.6k tokens each) with the type's fields. Not yet measured live — counted high, as every first estimate.
146
+ [AiStep.AssistRoute]: { input: 3_000, output: 300, cacheWrite: 0, cacheRead: 0 },
147
+ [AiStep.AssistEdit]: { input: 8_000, output: 2_000, cacheWrite: 0, cacheRead: 0 },
148
+ [AiStep.AssistRead]: { input: 12_000, output: 2_000, cacheWrite: 0, cacheRead: 0 },
131
149
  };
132
150
 
133
151
  /** Tokens by the class a provider prices them in. */
@@ -300,8 +318,24 @@ export interface AiMeter {
300
318
  /** The plan entitlements AI reads (the control plane's `features` / `limits` keys) — ONE spelling. */
301
319
  export enum AiFeature {
302
320
  SiteGeneration = 'aiSiteGeneration',
321
+ /** AI Assist on every screen (ai-assist-plan A-D6): its own switch, the plan's shared credits. */
322
+ Assist = 'aiAssist',
303
323
  }
304
324
 
325
+ /** The feature a step belongs to — the gate refuses a step whose feature the plan does not include. */
326
+ export const AI_STEP_FEATURE: Readonly<Record<AiStep, AiFeature>> = {
327
+ [AiStep.ReadMessage]: AiFeature.SiteGeneration,
328
+ [AiStep.PlanSite]: AiFeature.SiteGeneration,
329
+ [AiStep.ChangePlan]: AiFeature.SiteGeneration,
330
+ [AiStep.MakePictures]: AiFeature.SiteGeneration,
331
+ [AiStep.CheckPictures]: AiFeature.SiteGeneration,
332
+ [AiStep.NameStructures]: AiFeature.SiteGeneration,
333
+ [AiStep.ComposePages]: AiFeature.SiteGeneration,
334
+ [AiStep.AssistRoute]: AiFeature.Assist,
335
+ [AiStep.AssistEdit]: AiFeature.Assist,
336
+ [AiStep.AssistRead]: AiFeature.Assist,
337
+ };
338
+
305
339
  export enum AiLimit {
306
340
  CreditsPerMonth = 'aiCreditsPerMonth',
307
341
  CreditsPerGeneration = 'aiCreditsPerGeneration',
@@ -2,6 +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 { listMeaning } from './list-table';
5
6
  import { SPEC_SITE_LAYOUT } from './site-spec.generated';
6
7
 
7
8
  /**
@@ -18,7 +19,7 @@ const enumValues = (e: object): string[] => Object.values(e);
18
19
  const has = <T extends string>(list: ReadonlyArray<T>, v: string): boolean => (list as ReadonlyArray<string>).includes(v);
19
20
 
20
21
  /** The words a repaired mix is said in (the brief and the owner read them). */
21
- const say = (v: string) => SPEC_SITE_LAYOUT.list.meanings[v as keyof typeof SPEC_SITE_LAYOUT.list.meanings] ?? v;
22
+ const say = (arrange: string) => listMeaning('arrange', arrange);
22
23
 
23
24
  /**
24
25
  * Judge one list section's mix against the list it shows (`shape`, from `layoutListShapes`; null when the source is no
@@ -104,11 +105,11 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
104
105
  if (next.standout.how) repair('nothing stands out — no way to stand out');
105
106
  delete next.standout;
106
107
  } else {
107
- if (has(R.onlyRow.standoutWho, next.standout.who) && !row) {
108
+ if (has(R.onlyRow.who, next.standout.who) && !row) {
108
109
  repair(`"${next.standout.who}" is a row's — the first stands out`);
109
110
  next.standout.who = LayoutListWho.First;
110
111
  }
111
- if (next.standout.how && has(R.onlyStrips.standoutHow, next.standout.how)) {
112
+ if (next.standout.how && has(R.onlyStrips.how, next.standout.how)) {
112
113
  repair(`"${next.standout.how}" is a strip's — bigger instead`);
113
114
  next.standout.how = LayoutListHow.Bigger;
114
115
  }
@@ -122,10 +123,10 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
122
123
  next.move = [];
123
124
  }
124
125
  if (moving) {
125
- const onlyRow = next.move.filter(m => has(R.onlyRow.moves, m));
126
+ const onlyRow = next.move.filter(m => has(R.onlyRow.move, m));
126
127
  if (onlyRow.length && !row) {
127
128
  repair(`"${onlyRow.join(', ')}" carries a row only`);
128
- next.move = next.move.filter(m => !has(R.onlyRow.moves, m));
129
+ next.move = next.move.filter(m => !has(R.onlyRow.move, m));
129
130
  }
130
131
  if (next.move.includes(LayoutListMove.Page) && next.move.length > 1) {
131
132
  repair('the page\'s scroll carries the row alone');
@@ -136,10 +137,10 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
136
137
  next.move = [LayoutListMove.Drag];
137
138
  }
138
139
  }
139
- const stripHovers = next.hover.filter(h => has(R.onlyStrips.hovers, h));
140
+ const stripHovers = next.hover.filter(h => has(R.onlyStrips.hover, h));
140
141
  if (stripHovers.length && !strips) {
141
142
  repair(`"${stripHovers.join(', ')}" is a strip's`);
142
- next.hover = next.hover.filter(h => !has(R.onlyStrips.hovers, h));
143
+ next.hover = next.hover.filter(h => !has(R.onlyStrips.hover, h));
143
144
  }
144
145
  if (new Set(next.hover).size !== next.hover.length) next.hover = [...new Set(next.hover)];
145
146
 
@@ -7,11 +7,12 @@ import { ColorScheme, DesignChoices, LinkType, setColorScheme } from '@vectoriox
7
7
  import { FORM_AFTER_SEND_TRAIT, FormAfterSend, FormPresetId } from '@vectoriox/iox-ui/forms-core';
8
8
  import { composeNavHeader, composePresetForm } from './compose-site';
9
9
  import { drawnHeaderMix, HeaderIngredient, headerMixOfNavKind } from './header-mix';
10
+ import { listWait } from './list-table';
10
11
  import { NavShape, planNavShape } from './nav-shape';
11
12
  import {
12
13
  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,
13
14
  LAYOUT_PHONE_PADDING, LAYOUT_RISE, LAYOUT_TEXT_KINDS, LayoutBleed, LayoutColour, LayoutEase, LayoutEnter, LayoutForm, LayoutGallery, LayoutLayer,
14
- LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListItem, LayoutListMix, LayoutListMove, LayoutListPhone, LayoutListWho,
15
+ LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListHow, LayoutListItem, LayoutListMix, LayoutListMove, LayoutListPhone, LayoutListWho,
15
16
  LayoutLayerKind, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutRole, LayoutSection, LayoutSide, LayoutSite, LayoutTrack, LayoutTrackProp, LayoutTransition, phoneGapBefore,
16
17
  screenFontSize,
17
18
  } from './layout-language';
@@ -120,9 +121,19 @@ export enum LayoutListRole {
120
121
  Dim = 'list.dim',
121
122
  Masonry = 'list.masonry',
122
123
  MasonryTwo = 'list.masonry-two',
124
+ /** LI3: strips (the Repeater) — stacked on a phone, two across, or a row to swipe; each row a strip item. */
125
+ Strips = 'list.strips',
126
+ StripsTwo = 'list.strips-two',
127
+ StripsSwipe = 'list.strips-swipe',
128
+ StripItem = 'list.strip-item',
123
129
  Item = 'list.item',
124
130
  }
125
131
 
132
+ /** A strips list's Repeater role by the phone the mix asks for. */
133
+ const STRIPS_ROLE: Readonly<Record<`${LayoutListPhone}`, LayoutListRole>> = {
134
+ stack: LayoutListRole.Strips, 'two-up': LayoutListRole.StripsTwo, swipe: LayoutListRole.StripsSwipe,
135
+ };
136
+
126
137
  /** A list role → the Card v2 part that shows it (the title is the card's locked title; `link` links the card). */
127
138
  export const LIST_CARD_PART: Readonly<Record<string, CardPart>> = {
128
139
  image: CardPart.Media,
@@ -671,7 +682,8 @@ function linkToDetail(node: SerializedNode, source: string, detail: NonNullable<
671
682
  }
672
683
 
673
684
  /** A card item: Card v2 (the palette's recipe) with a part per role the mix shows, each bound to the row's field. */
674
- function listCard(id: string, mix: LayoutListMix, source: string, list: LayoutListBinding, masonry: boolean, path: string, ctx: Ctx): SerializedNode {
685
+ function listCard(id: string, mix: LayoutListMix, source: string, list: LayoutListBinding, masonry: boolean, path: string, ctx: Ctx,
686
+ layout: CardLayout = CardLayout.Top): SerializedNode {
675
687
  const shown = new Set(mix.parts.filter(r => !!list.roles[r]));
676
688
  const field = (role: string) => (shown.has(role) ? list.roles[role] : undefined);
677
689
  const eyebrow = field('meta') ?? field('date');
@@ -681,7 +693,7 @@ function listCard(id: string, mix: LayoutListMix, source: string, list: LayoutLi
681
693
  partOn(CardPart.Eyebrow, eyebrow), partOn(CardPart.Text, field('summary')), partOn(CardPart.Quote, field('quote')),
682
694
  partOn(CardPart.Person, field('person')), [CardPart.Badge, false], [CardPart.Actions, false],
683
695
  ]) as Partial<Record<CardPart, boolean>>;
684
- const card = buildCardRecipe(partFactory(id), { layout: CardLayout.Top, parts }) as unknown as SerializedNode;
696
+ const card = buildCardRecipe(partFactory(id), { layout, parts }) as unknown as SerializedNode;
685
697
  card.id = id;
686
698
  const bind = (role: CardRole, prop: string, f: string | undefined) => {
687
699
  const part = findByRole(card as unknown as CompositeNode, role) as SerializedNode | undefined;
@@ -744,19 +756,25 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
744
756
  const scheme = layoutBandScheme(lc.section.ground);
745
757
  if (scheme) setColorScheme(frame, scheme);
746
758
 
759
+ // A word the product does not draw yet (the contract's list table): drawn as its stand-in, and said.
747
760
  let arrange = mix.arrange;
748
- if (arrange === LayoutListArrange.Strips || arrange === LayoutListArrange.Deck) {
749
- const nearest = arrange === LayoutListArrange.Deck ? LayoutListArrange.Row : LayoutListArrange.Grid;
750
- gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.arrange`, `${arrange} is drawn in a later phase: laid out as a ${nearest}`);
751
- arrange = nearest;
761
+ const arrangeWait = listWait('arrange', arrange);
762
+ if (arrangeWait?.drawnAs) {
763
+ gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.arrange`, `${arrange} is drawn in ${arrangeWait.phase}: laid out as a ${arrangeWait.drawnAs}`);
764
+ arrange = arrangeWait.drawnAs as LayoutListMix['arrange'];
752
765
  }
753
- if (mix.standout && mix.standout.who !== LayoutListWho.None) {
754
- gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.standout`, `standing out (${mix.standout.who}) is drawn in a later phase`);
766
+ const strips = arrange === LayoutListArrange.Strips;
767
+ // Strips draw their own standing out (the open one, wider); any other is said until its phase draws it.
768
+ if (mix.standout && mix.standout.who !== LayoutListWho.None && !(strips && mix.standout.how === LayoutListHow.Wider)) {
769
+ const wait = listWait('who', mix.standout.who) ?? (mix.standout.how ? listWait('how', mix.standout.how) : null);
770
+ gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.standout`,
771
+ `standing out (${mix.standout.who}${mix.standout.how ? ` · ${mix.standout.how}` : ''}) is drawn ${wait ? `in ${wait.phase}` : 'by strips only'}`);
755
772
  }
756
773
  const masonry = arrange === LayoutListArrange.Masonry;
757
774
  const item = mix.item === LayoutListItem.Card
758
- ? listCard(`${id}-item`, mix, source, list, masonry, lc.path, ctx)
775
+ ? listCard(`${id}-item`, mix, source, list, masonry, lc.path, ctx, strips ? CardLayout.Overlay : CardLayout.Top)
759
776
  : listPhoto(`${id}-item`, source, list, masonry);
777
+ if (strips) return composeStrips(id, frame, item, mix, source, ctx);
760
778
  item.interactions = [...item.interactions, listArriveInteraction(item.id, mix.arrive, ctx)];
761
779
 
762
780
  if (arrange === LayoutListArrange.Row) {
@@ -812,6 +830,32 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
812
830
  return frame;
813
831
  }
814
832
 
833
+ /**
834
+ * Strips (LI3): a Repeater over the list whose ONE row is a strip item holding the card (picture filling it, words on
835
+ * the scrim) or the picture. Everything strips DO — the open one wider, pointing and focus, the phone — is the shared
836
+ * CSS's (iox-design.css, by the Repeater's role), so the canvas and the live site draw the same strips with no runtime.
837
+ */
838
+ function composeStrips(id: string, frame: SerializedNode, item: SerializedNode, mix: LayoutListMix, source: string, ctx: Ctx): SerializedNode {
839
+ const strip = create(`${id}-strip`, T.Container, {}, NO_ELEMENT_STYLE);
840
+ strip.role = LayoutListRole.StripItem;
841
+ setStyleProps(strip, { position: 'relative', display: 'block', width: FULL, height: FULL, minHeight: ZERO, overflow: 'hidden' });
842
+ setStyleProps(item, { width: FULL, height: FULL, minHeight: ZERO });
843
+ if (item.role === LayoutListRole.Item) {
844
+ const image = item.children?.[0];
845
+ if (image) setStyleProps(image, { height: FULL, aspectRatio: 'auto' });
846
+ }
847
+ // The arrival plays on the card, never on the strip: the strip's own transform is the strips' geometry.
848
+ item.interactions = [...item.interactions, listArriveInteraction(item.id, mix.arrive, ctx)];
849
+ strip.children = [item];
850
+ const items = create(`${id}-items`, 'Repeater', {}, 'box');
851
+ items.role = STRIPS_ROLE[mix.phone];
852
+ items.bindings.push({ prop: 'source', source, path: '' });
853
+ setStyleProps(items, { display: 'block', width: FULL });
854
+ items.children = [strip];
855
+ frame.children = [items];
856
+ return frame;
857
+ }
858
+
815
859
  /** Recipe parts stamped with this composer's ids (`<id>-<key>`). */
816
860
  function partFactory(id: string): (spec: CompositeNodeSpec) => CompositeNode {
817
861
  return spec => create(`${id}-${spec.key}`, spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as unknown as CompositeNode;
@@ -4,6 +4,7 @@ import {
4
4
  LayoutListHow, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutListWho, LayoutPage, LayoutSection, LayoutTrack,
5
5
  } from './layout-language';
6
6
  import { isPlainObject, PlainObject } from './shape-check';
7
+ import { LIST_INGREDIENTS, LIST_TABLE, listBuiltWords, listIngredientWords } from './list-table';
7
8
  import { SPEC_SITE_LAYOUT } from './site-spec.generated';
8
9
 
9
10
  /**
@@ -35,7 +36,6 @@ const VARIANT_ON_WIRE: ReadonlyArray<string> = [NONE, ...V.buttonVariants, ...V.
35
36
  * request stays inside the 40 the budget allows, and the parts enum is generated from the plan's own lists: a model
36
37
  * cannot name a part its list does not have (R-H2).
37
38
  */
38
- const L = SPEC_SITE_LAYOUT.list;
39
39
  export enum LayoutMixIngredient {
40
40
  Item = 'item',
41
41
  Arrange = 'arrange',
@@ -46,21 +46,14 @@ export enum LayoutMixIngredient {
46
46
  Arrive = 'arrive',
47
47
  Phone = 'phone',
48
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
49
  const MIX_SEPARATOR = ':';
60
50
  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}`));
51
+ /** Every word a stored mix may hold, ingredient by ingredient (a waiting word too: a stored answer still reads). */
52
+ export const LAYOUT_MIX_WORDS: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listIngredientWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
53
+ /** The words the wire OFFERS — the built ones only (ingredients.md §3.3): a waiting word would put its stand-in on every
54
+ * site that asked for it. */
55
+ export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
56
+ const MIX_HINT = LIST_INGREDIENTS.map(k => `${k}:${listBuiltWords(k).join('|')}${(LIST_TABLE.many as ReadonlyArray<string>).includes(k) ? ' (any)' : ''}`).join(' · ');
64
57
 
65
58
  /** A list a composed page may show, as the wire's parts enum needs it (`layoutListShapes` gives these). */
66
59
  export interface LayoutWireList { alias: string; roles: ReadonlyArray<string> }
@@ -103,7 +96,7 @@ export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchem
103
96
  const partWords = options.lists ? layoutWirePartWords(options.lists) : [];
104
97
  const lists: Record<string, JsonSchema> = options.lists
105
98
  ? {
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"),
99
+ mix: listOf(jsonOneOf(LAYOUT_MIX_OFFERED), `gallery showing a list (source): how its items are shown, one word per choice — ${MIX_HINT}; [] for none`),
107
100
  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
101
  }
109
102
  : {};
@@ -0,0 +1,39 @@
1
+ import { SPEC_SITE_LAYOUT } from './site-spec.generated';
2
+
3
+ /**
4
+ * THE LIST TABLE (list-ingredients-plan.md; the contract's `layout.mjs` `LIST`, in the shape every mixed part shares —
5
+ * ingredients.md §2): the words of each ingredient, what each means, and which wait for a later phase and are drawn as
6
+ * a built word meanwhile. Everything that offers, says or draws a list word reads it here; nothing retypes one.
7
+ */
8
+ export const LIST_TABLE = SPEC_SITE_LAYOUT.list;
9
+
10
+ export type ListIngredient = keyof typeof LIST_TABLE.ingredients;
11
+
12
+ /** The ingredients, in the table's order. */
13
+ export const LIST_INGREDIENTS = Object.keys(LIST_TABLE.ingredients) as ListIngredient[];
14
+
15
+ /** A word that is not drawn yet: the phase it waits for and the built word it is drawn as (null: drawn without it). */
16
+ export interface ListWait { phase: string; drawnAs: string | null }
17
+
18
+ const WAITS = LIST_TABLE.waits as Readonly<Record<string, ListWait>>;
19
+ const MEANINGS = LIST_TABLE.meanings as Readonly<Record<string, string>>;
20
+
21
+ /** Every word of an ingredient. */
22
+ export function listIngredientWords(k: ListIngredient): ReadonlyArray<string> {
23
+ return LIST_TABLE.ingredients[k] as ReadonlyArray<string>;
24
+ }
25
+
26
+ /** The wait of a word, or null when the product draws it. */
27
+ export function listWait(k: ListIngredient, word: string): ListWait | null {
28
+ return WAITS[`${k}.${word}`] ?? null;
29
+ }
30
+
31
+ /** The words of an ingredient the product draws — the only ones the wire offers (ingredients.md §3.3). */
32
+ export function listBuiltWords(k: ListIngredient): string[] {
33
+ return listIngredientWords(k).filter(w => !listWait(k, w));
34
+ }
35
+
36
+ /** What a word means, in the words the model and the owner read (the word itself when the table has none). */
37
+ export function listMeaning(k: ListIngredient, word: string): string {
38
+ return MEANINGS[`${k}.${word}`] ?? word;
39
+ }
@@ -107,12 +107,15 @@ function ownedKeys(facts: PlanWordContext['facts']): Set<string> {
107
107
  return keys;
108
108
  }
109
109
 
110
- /** The words to avoid and the facts never given, in every written text of the plan. */
111
- export function planWordIssues(plan: SitePlan, ctx: PlanWordContext): PlanWordIssue[] {
110
+ /**
111
+ * The words to avoid and the facts never given, in any texts a model wrote — the plan's (`planWordIssues`) and an AI
112
+ * Assist turn's field values (assist-core, R-H2): ONE judge of what a model may write.
113
+ */
114
+ export function factIssues(texts: ReadonlyArray<WrittenText>, ctx: PlanWordContext): PlanWordIssue[] {
112
115
  const issues: PlanWordIssue[] = [];
113
116
  const avoid = [...new Set(ctx.avoidWords.map(w => w.trim()).filter(Boolean))].map(w => ({ word: w, pattern: wordPattern(w) }));
114
117
  const owned = ownedKeys(ctx.facts);
115
- for (const { path, text } of writtenTexts(plan)) {
118
+ for (const { path, text } of texts) {
116
119
  const words = normalise(text);
117
120
  for (const a of avoid) if (a.pattern.test(words)) issues.push({ code: PlanWordIssueCode.AvoidWord, path, message: `uses "${a.word}" — a word this site must not use` });
118
121
  for (const shape of FACT_SHAPES) {
@@ -123,6 +126,12 @@ export function planWordIssues(plan: SitePlan, ctx: PlanWordContext): PlanWordIs
123
126
  }
124
127
  }
125
128
  }
129
+ return issues;
130
+ }
131
+
132
+ /** The words to avoid and the facts never given, in every written text of the plan. */
133
+ export function planWordIssues(plan: SitePlan, ctx: PlanWordContext): PlanWordIssue[] {
134
+ const issues = factIssues(writtenTexts(plan), ctx);
126
135
  for (const [key, value] of Object.entries(plan.business?.facts ?? {})) {
127
136
  const own = ctx.facts[key as FactKey];
128
137
  if (!(FACT_KEYS as ReadonlyArray<string>).includes(key)) continue;
@@ -52,6 +52,7 @@ export * from './layout-photos';
52
52
  export * from './photo-inventory';
53
53
  export * from './check-layout';
54
54
  export * from './check-list';
55
+ export * from './list-table';
55
56
  export * from './layout-space';
56
57
  export * from './layout-fingerprint';
57
58
  export * from './header-mix';