@vectoriox/iox-ui 5.111.0 → 5.113.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.
@@ -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',
@@ -637,6 +637,8 @@ function galleryLayer(id: string, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): Seria
637
637
  /** The width a row's card takes: three across a laptop, most of a phone's width with the next one peeking. */
638
638
  const LIST_ROW_SLIDE = `calc((100% - ${2 * SLIDE_GAP}px) / 3)`;
639
639
  const LIST_ROW_SLIDE_PHONE = '82%';
640
+ /** A deck is one card wide (LI4): a laptop's card, most of a phone. */
641
+ const LIST_DECK_WIDTH = 'min(440px, 80%)';
640
642
  const LIST_GAP = 'var(--iox-space-gap)';
641
643
  const LIST_PHOTO_ASPECT = '4 / 3';
642
644
  /** A row or a deck turns by itself this often (the wire's autoplay). */
@@ -764,11 +766,11 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
764
766
  arrange = arrangeWait.drawnAs as LayoutListMix['arrange'];
765
767
  }
766
768
  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'}`);
769
+ const deck = arrange === LayoutListArrange.Deck;
770
+ const standout = mix.standout && mix.standout.who !== LayoutListWho.None ? mix.standout : null;
771
+ const standWait = standout ? listWait('who', standout.who) ?? (standout.how ? listWait('how', standout.how) : null) : null;
772
+ if (standout && standWait) {
773
+ gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.standout`, `standing out (${standout.who}${standout.how ? ` · ${standout.how}` : ''}) is drawn in ${standWait.phase}`);
772
774
  }
773
775
  const masonry = arrange === LayoutListArrange.Masonry;
774
776
  const item = mix.item === LayoutListItem.Card
@@ -776,39 +778,45 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
776
778
  : listPhoto(`${id}-item`, source, list, masonry);
777
779
  if (strips) return composeStrips(id, frame, item, mix, source, ctx);
778
780
  item.interactions = [...item.interactions, listArriveInteraction(item.id, mix.arrive, ctx)];
781
+ // LI4: the one that stands out — a deck's top card IS its standing out; strips draw their own (wider).
782
+ const shown = standout && !standWait && !deck ? standWrap(`${id}-stand`, item, standout) : item;
779
783
 
780
- if (arrange === LayoutListArrange.Row) {
784
+ if (arrange === LayoutListArrange.Row || deck) {
781
785
  const scrollPlays = mix.move.includes(LayoutListMove.Page) && !lc.held;
782
786
  const played = scrollPlays || lc.held;
783
787
  const drag = mix.move.includes(LayoutListMove.Drag);
784
788
  const slider = create(`${id}-slider`, T.Slider, {
785
- dir: ctx.rtl ? 'rtl' : 'ltr', effect: 'slide', slidesPerView: 'auto', spaceBetween: SLIDE_GAP,
786
- centeredSlides: mix.standout?.who === LayoutListWho.Middle, loop: 'off', freeMode: drag && !played, grabCursor: drag && !played,
789
+ // A deck (LI4) is Swiper's cards: one card on top, the rest waiting behind, dragged away or stepped.
790
+ dir: ctx.rtl ? 'rtl' : 'ltr', effect: deck ? 'cards' : 'slide', slidesPerView: deck ? 1 : 'auto', spaceBetween: deck ? 0 : SLIDE_GAP,
791
+ centeredSlides: !deck && standout?.who === LayoutListWho.Middle, loop: 'off', freeMode: !deck && drag && !played, grabCursor: drag && !played,
787
792
  speed: GALLERY_SPEED, enableParallax: false, enableAutoplay: mix.move.includes(LayoutListMove.Auto) && !played,
788
793
  autoplayDelay: LIST_AUTOPLAY_MS, autoplayDisableOnInteraction: true, enableKeyboard: true, scrollPlays,
789
794
  enableCaption: false, enableCount: false, enableNavigation: mix.move.includes(LayoutListMove.Arrows) && !played,
790
795
  [SLIDER_PLACEMENT_TRAIT]: SliderPlacement.Under, ariaLabel: l.text ?? '',
791
796
  }, NO_ELEMENT_STYLE);
792
797
  slider.bindings.push({ prop: 'source', source, path: '' });
793
- setStyleProps(slider, scrollPlays ? { width: FULL, height: FULL, minHeight: ZERO } : {
798
+ setStyleProps(slider, scrollPlays ? { width: FULL, height: FULL, minHeight: ZERO } : deck ? {
799
+ // A deck fills its holder (below); the cards behind show past its edges.
800
+ width: FULL, height: FULL, minHeight: ZERO, display: 'flex', flexDirection: 'column', overflow: 'visible',
801
+ } : {
794
802
  position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: FULL, height: FULL, minHeight: ZERO,
795
803
  display: 'flex', flexDirection: 'column',
796
804
  });
797
- phone(slider, scrollPlays ? { height: 'auto' } : { position: 'relative', height: 'auto' });
805
+ phone(slider, scrollPlays || deck ? { height: 'auto' } : { position: 'relative', height: 'auto' });
798
806
  // A row keeps its own slide width on a phone (most of the screen, the next item peeking): the slider's phone
799
- // default is one slide the full width, unless the phone layer names its slides per view.
800
- slider.responsive![LAYOUT_PHONE_BREAKPOINT]!.inputs = { slidesPerView: 'auto' };
801
- if (mix.phone !== LayoutListPhone.Swipe) gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.phone`, `a row stays a row you swipe on a phone (${mix.phone} is a grid's)`);
807
+ // default is one slide the full width, unless the phone layer names its slides per view. A deck stays a deck.
808
+ if (!deck) slider.responsive![LAYOUT_PHONE_BREAKPOINT]!.inputs = { slidesPerView: 'auto' };
809
+ if (mix.phone !== LayoutListPhone.Swipe) gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.phone`, `a ${arrange} stays one you swipe on a phone (${mix.phone} is a grid's)`);
802
810
  const slide = create(`${id}-slide`, T.Slide, { caption: '' }, NO_ELEMENT_STYLE);
803
- setStyleProps(slide, { width: LIST_ROW_SLIDE, height: FULL, display: 'flex', aspectRatio: 'auto' });
804
- phone(slide, { width: LIST_ROW_SLIDE_PHONE });
805
- slide.children = [item];
811
+ setStyleProps(slide, { width: deck ? FULL : LIST_ROW_SLIDE, height: FULL, display: 'flex', aspectRatio: 'auto' });
812
+ if (!deck) phone(slide, { width: LIST_ROW_SLIDE_PHONE });
813
+ slide.children = [shown];
806
814
  slider.children = [slide];
807
815
  syncSliderParts(slider as unknown as CompositeNode, partFactory(`${id}-slider`));
808
816
  walkSerialized([slider], node => {
809
817
  if (node.role === SliderRole.Prev || node.role === SliderRole.Next) node.props[LAYOUT_TOOLTIP_TRAIT] = node.props['ariaLabel'];
810
818
  });
811
- frame.children = [slider];
819
+ frame.children = [deck ? deckHolder(`${id}-deck`, slider) : slider];
812
820
  return frame;
813
821
  }
814
822
 
@@ -825,11 +833,42 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
825
833
  phone(items, { gridTemplateColumns: mix.phone === LayoutListPhone.TwoUp ? 'repeat(2, minmax(0, 1fr))' : 'minmax(0, 1fr)' });
826
834
  if (mix.phone === LayoutListPhone.Swipe) gap(ctx, LayoutGapCode.ListLater, `${lc.path}.gallery.list.phone`, 'a grid stacks on a phone; only a row swipes');
827
835
  }
828
- items.children = [item];
836
+ items.children = [shown];
829
837
  frame.children = [items];
830
838
  return frame;
831
839
  }
832
840
 
841
+ /**
842
+ * A deck (LI4) is a card wide, centred in its cell. The width sits on a holder, never the slider: the slider's own
843
+ * scoped `.swiper { width: 100% }` out-ranks a node's width class. On a phone the holder is the cell's width and the
844
+ * shared `.swiper.swiper-cards` rule (iox-design.css) makes the deck a centred card with its neighbours peeking.
845
+ */
846
+ function deckHolder(id: string, slider: SerializedNode): SerializedNode {
847
+ const holder = create(id, T.Container, {}, NO_ELEMENT_STYLE);
848
+ setStyleProps(holder, {
849
+ position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: LIST_DECK_WIDTH, maxWidth: FULL, height: FULL,
850
+ minHeight: ZERO, margin: '0px auto', display: 'flex', flexDirection: 'column',
851
+ });
852
+ phone(holder, { position: 'relative', height: 'auto', width: FULL });
853
+ holder.children = [slider];
854
+ return holder;
855
+ }
856
+
857
+ /**
858
+ * Standing out (LI4): the item inside a holder whose role names who and how (`list.first-bigger`) — the shared CSS
859
+ * (iox-design.css) finds the one that stands out (the first row, Swiper's active slide, the one pointed at or focused)
860
+ * and moves it by the look's tokens; `brighter` rests the others. The holder, never the card, moves: the card keeps
861
+ * its own hover and arrival.
862
+ */
863
+ function standWrap(id: string, item: SerializedNode, standout: NonNullable<LayoutListMix['standout']>): SerializedNode {
864
+ const holder = create(id, T.Container, {}, NO_ELEMENT_STYLE);
865
+ holder.role = `${LayoutListRole.List}.${standout.who}-${standout.how ?? LayoutListHow.Raised}`;
866
+ setStyleProps(holder, { position: 'relative', display: 'flex', flexDirection: 'column', width: FULL, minHeight: ZERO });
867
+ setStyleProps(item, { flexGrow: '1' });
868
+ holder.children = [item];
869
+ return holder;
870
+ }
871
+
833
872
  /**
834
873
  * Strips (LI3): a Repeater over the list whose ONE row is a strip item holding the card (picture filling it, words on
835
874
  * the scrim) or the picture. Everything strips DO — the open one wider, pointing and focus, the phone — is the shared
@@ -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;
@@ -7101,28 +7101,7 @@ export const SPEC_SITE_LAYOUT = {
7101
7101
  "phone.stack": "one under another",
7102
7102
  "phone.two-up": "two across"
7103
7103
  },
7104
- "waits": {
7105
- "arrange.deck": {
7106
- "phase": "LI4",
7107
- "drawnAs": "row"
7108
- },
7109
- "who.middle": {
7110
- "phase": "LI4",
7111
- "drawnAs": "none"
7112
- },
7113
- "how.bigger": {
7114
- "phase": "LI4",
7115
- "drawnAs": null
7116
- },
7117
- "how.raised": {
7118
- "phase": "LI4",
7119
- "drawnAs": null
7120
- },
7121
- "how.brighter": {
7122
- "phase": "LI4",
7123
- "drawnAs": null
7124
- }
7125
- },
7104
+ "waits": {},
7126
7105
  "defaults": {
7127
7106
  "item": "card",
7128
7107
  "arrange": "grid",
@@ -227,6 +227,45 @@ iox-gallery.iox-es-media[data-iox-empty] > .iox-gallery {
227
227
  :is(.iox-role-list-strips-swipe, .iox-role-list-strips-swipe > .repeater-wrapper) > .repeater-root > * { flex: 0 0 82%; scroll-snap-align: start; }
228
228
  }
229
229
 
230
+ /* LI4 (list-ingredients-plan.md §5): STANDING OUT — the one item a list's mix names (the first, the middle of a row =
231
+ Swiper's active slide, or the one pointed at / focused) grows (`bigger`), lifts (`raised`) or keeps its light while
232
+ the rest dim (`brighter`), by the look's tokens. The item sits in a holder whose role names who and how
233
+ (`list.first-bigger`); the HOLDER moves, never the card, so the card keeps its own hover and arrival. CSS only — the
234
+ canvas and both engine paths agree. Pointing is a mouse's (G1); focus is anyone's. Transform and opacity only. */
235
+ :where(.iox-role-list-first-bigger, .iox-role-list-first-raised, .iox-role-list-first-brighter, .iox-role-list-middle-bigger, .iox-role-list-middle-raised, .iox-role-list-middle-brighter, .iox-role-list-pointed-bigger, .iox-role-list-pointed-raised, .iox-role-list-pointed-brighter) {
236
+ transition-property: scale, translate, opacity;
237
+ transition-duration: var(--iox-dur-ui);
238
+ transition-timing-function: var(--iox-ease-standard);
239
+ }
240
+ :is(.repeater-root > :first-child, .swiper-slide:first-child) .iox-role-list-first-bigger,
241
+ .repeater-root > .iox-role-list-first-bigger:first-child,
242
+ .swiper-slide-active .iox-role-list-middle-bigger,
243
+ .iox-role-list-pointed-bigger:focus-within {
244
+ scale: var(--iox-list-focus-scale);
245
+ z-index: 1;
246
+ }
247
+ :is(.repeater-root > :first-child, .swiper-slide:first-child) .iox-role-list-first-raised,
248
+ .repeater-root > .iox-role-list-first-raised:first-child,
249
+ .swiper-slide-active .iox-role-list-middle-raised,
250
+ .iox-role-list-pointed-raised:focus-within {
251
+ translate: 0 var(--iox-list-rise);
252
+ z-index: 1;
253
+ }
254
+ :is(.repeater-root > :not(:first-child), .swiper-slide:not(:first-child)) .iox-role-list-first-brighter,
255
+ .repeater-root > .iox-role-list-first-brighter:not(:first-child),
256
+ .swiper-slide:not(.swiper-slide-active) .iox-role-list-middle-brighter,
257
+ :is(.iox-role-list, .iox-role-list-dim):has(.iox-role-list-pointed-brighter:focus-within) .iox-role-list-pointed-brighter:not(:focus-within) {
258
+ opacity: var(--iox-list-rest-opacity);
259
+ }
260
+ @media (hover: hover) and (pointer: fine) {
261
+ .iox-role-list-pointed-bigger:hover { scale: var(--iox-list-focus-scale); z-index: 1; }
262
+ .iox-role-list-pointed-raised:hover { translate: 0 var(--iox-list-rise); z-index: 1; }
263
+ :is(.iox-role-list, .iox-role-list-dim):has(.iox-role-list-pointed-brighter:hover) .iox-role-list-pointed-brighter:not(:hover) { opacity: var(--iox-list-rest-opacity); }
264
+ }
265
+ @media (prefers-reduced-motion: reduce) {
266
+ :where(.iox-role-list-first-bigger, .iox-role-list-first-raised, .iox-role-list-first-brighter, .iox-role-list-middle-bigger, .iox-role-list-middle-raised, .iox-role-list-middle-brighter, .iox-role-list-pointed-bigger, .iox-role-list-pointed-raised, .iox-role-list-pointed-brighter) { transition-property: opacity; }
267
+ }
268
+
230
269
  /* Link the whole card — the stretched link. The title's <a> is the card's ONE link (its words are the
231
270
  link's name); its ::after covers the card, so a click anywhere on it navigates. The Buttons sit above
232
271
  it and keep their own actions; the focus ring is drawn on the card. Never a link inside a link. On the