@vectoriox/iox-ui 5.196.0 → 5.198.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.
Files changed (67) hide show
  1. package/composite-core/index.d.ts +19 -2
  2. package/data-core/index.d.ts +101 -2
  3. package/design-core/index.d.ts +183 -30
  4. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +49 -10
  5. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  6. package/fesm2022/vectoriox-iox-ui-data-core.mjs +192 -2
  7. package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
  8. package/fesm2022/vectoriox-iox-ui-design-core.mjs +299 -74
  9. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  10. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +2287 -528
  11. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  12. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +3 -1
  13. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  14. package/fesm2022/vectoriox-iox-ui.mjs +32 -2
  15. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  16. package/generation-core/index.d.ts +1454 -200
  17. package/harness-core/index.d.ts +1 -1
  18. package/package.json +1 -1
  19. package/src/composite-core/header.ts +34 -1
  20. package/src/composite-core/slider-runtime.ts +16 -8
  21. package/src/data-core/placeholder-rows.ts +220 -0
  22. package/src/data-core/public-api.ts +2 -1
  23. package/src/design-core/brand.ts +58 -5
  24. package/src/design-core/contrast-audit.ts +49 -22
  25. package/src/design-core/design-apply.ts +34 -3
  26. package/src/design-core/flavor-fixtures.generated.ts +123 -123
  27. package/src/design-core/flavor-spec.generated.ts +44 -4
  28. package/src/design-core/flavor-tokens.ts +1 -1
  29. package/src/design-core/header-behaviour.ts +82 -15
  30. package/src/design-core/motion-language.ts +5 -14
  31. package/src/design-core/node-links.ts +34 -0
  32. package/src/design-core/preloader.ts +4 -5
  33. package/src/generation-core/audit-site.ts +10 -1
  34. package/src/generation-core/audit-words.ts +5 -0
  35. package/src/generation-core/body-mix.ts +40 -102
  36. package/src/generation-core/check-free.ts +26 -5
  37. package/src/generation-core/check-layout.ts +10 -4
  38. package/src/generation-core/check-list.ts +3 -25
  39. package/src/generation-core/colour-mix.ts +296 -0
  40. package/src/generation-core/compose-free.ts +40 -18
  41. package/src/generation-core/compose-site.ts +124 -22
  42. package/src/generation-core/footer-mix.ts +102 -54
  43. package/src/generation-core/free-fallback.ts +6 -4
  44. package/src/generation-core/free-opening.ts +57 -0
  45. package/src/generation-core/free-parts.ts +87 -0
  46. package/src/generation-core/free-slot-words.ts +30 -0
  47. package/src/generation-core/generation-tier.ts +6 -17
  48. package/src/generation-core/header-mix.ts +125 -4
  49. package/src/generation-core/item-fill.ts +42 -0
  50. package/src/generation-core/layout-drawers.ts +3 -2
  51. package/src/generation-core/layout-wire.ts +10 -16
  52. package/src/generation-core/list-panel.ts +3 -3
  53. package/src/generation-core/list-table.ts +5 -14
  54. package/src/generation-core/list-words.ts +2 -1
  55. package/src/generation-core/nav-shape.ts +45 -16
  56. package/src/generation-core/node-baselines.generated.ts +1 -0
  57. package/src/generation-core/opening-mix.ts +16 -33
  58. package/src/generation-core/part-tier.ts +14 -0
  59. package/src/generation-core/plan-wire.ts +31 -43
  60. package/src/generation-core/public-api.ts +4 -0
  61. package/src/generation-core/site-build-run.ts +4 -0
  62. package/src/generation-core/site-spec.generated.ts +1127 -93
  63. package/src/generation-core/stock-search.ts +106 -18
  64. package/src/generation-core/type-led.ts +19 -4
  65. package/src/generation-core/validate-site-plan.ts +4 -5
  66. package/src/harness-core/run-compose-context.ts +3 -1
  67. package/styles/iox-design.css +139 -4
@@ -4783,7 +4783,7 @@ declare function businessComposeContext(typeId: string | null | undefined): Pick
4783
4783
  * layouts' photos, its tier, the legal context its preflight read (AW1), whether its business is calm (AW6 — the body
4784
4784
  * takes no shaped edge), its kind of business for the footer (AW12), and — once the stock step has placed the pictures —
4785
4785
  * what fills them (iox-ui#129: a section nothing fills is composed type-led, an empty photo on a composed page a ground
4786
- * plate). ONE reading, so every compose of a run's plan — each step, a resumed step, a redesign, the builder's Re-fit —
4786
+ * plate), and whether the header's words read at rest over the home opening (HI3-D5, judged at preflight). ONE reading, so every compose of a run's plan — each step, a resumed step, a redesign, the builder's Re-fit —
4787
4787
  * composes the same site. Pure.
4788
4788
  */
4789
4789
  declare function runComposeContext(run: ComposeRun): ComposeContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-ui",
3
- "version": "5.196.0",
3
+ "version": "5.198.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -1,4 +1,4 @@
1
- import { HeaderBehaviour, HeaderEdge, headerBehaviourOf, headerEdgeOf, HeaderGround, headerGroundOf, HeaderInk, headerInkOf, headerStaysAtTop, HeaderTrait } from '@vectoriox/iox-ui/design-core';
1
+ import { HeaderBehaviour, HeaderBrand, headerBrandOf, HeaderEdge, headerBehaviourOf, headerEdgeOf, HeaderGround, headerGroundOf, HeaderInk, headerInkOf, HeaderShape, headerShapeFloats, headerShapeOf, headerStaysAtTop, HeaderTrait } from '@vectoriox/iox-ui/design-core';
2
2
 
3
3
  import { CompositeNode, readProp, readStyle, writeProp, writeStyles } from './composite-node';
4
4
 
@@ -62,3 +62,36 @@ export function setHeaderGround(node: CompositeNode, ground: HeaderGround | `${H
62
62
  export function headerGroundOfNode(node: CompositeNode | null | undefined): HeaderGround {
63
63
  return headerGroundOf(node ? readProp(node, HeaderTrait.Ground) : undefined);
64
64
  }
65
+
66
+ /**
67
+ * The header's outline (HI3 slice 2: bar · pill · islands) — ONE edit for the Header studio ▸ Bar and the composer. `bar`
68
+ * clears a stored word and writes nothing on a header that never had one (R-H4). A floating header draws its ground on
69
+ * the ground layer, so like a ground it is the containing block of it: a stored `static` becomes `relative`. False when
70
+ * nothing changed.
71
+ */
72
+ export function setHeaderShape(node: CompositeNode, shape: HeaderShape | `${HeaderShape}`): boolean {
73
+ const want = headerShapeOf(shape);
74
+ if (headerShapeOf(readProp(node, HeaderTrait.Shape)) === want) return false;
75
+ const changed = writeProp(node, HeaderTrait.Shape, want === HeaderShape.Bar ? '' : want);
76
+ const position = readStyle(node, 'position');
77
+ if (headerShapeFloats(want) && (position === undefined || position === null || position === '' || position === 'static')) writeStyles(node, { position: 'relative' });
78
+ return changed;
79
+ }
80
+
81
+ /** The header's outline as stored (Bar for a header that never chose). */
82
+ export function headerShapeOfNode(node: CompositeNode | null | undefined): HeaderShape {
83
+ return headerShapeOf(node ? readProp(node, HeaderTrait.Shape) : undefined);
84
+ }
85
+
86
+ /** How the header's name sits (HI3 slice 2: fits · hangs · later) — ONE edit for the studio and the composer; `fits`
87
+ * clears a stored word (R-H4). False when nothing changed. */
88
+ export function setHeaderBrand(node: CompositeNode, brand: HeaderBrand | `${HeaderBrand}`): boolean {
89
+ const want = headerBrandOf(brand);
90
+ if (headerBrandOf(readProp(node, HeaderTrait.Brand)) === want) return false;
91
+ return writeProp(node, HeaderTrait.Brand, want === HeaderBrand.Fits ? '' : want);
92
+ }
93
+
94
+ /** The header's brand as stored (Fits for a header that never chose). */
95
+ export function headerBrandOfNode(node: CompositeNode | null | undefined): HeaderBrand {
96
+ return headerBrandOf(node ? readProp(node, HeaderTrait.Brand) : undefined);
97
+ }
@@ -65,9 +65,13 @@ export class CarouselA11y {
65
65
  private readonly words: SliderWords;
66
66
  private readonly pause: HTMLElement | null;
67
67
  private readonly authorName: string | null;
68
+ /** The slider element, held from the start: Swiper's `destroy(true, true)` nulls every field of the instance, `el`
69
+ * included, so a re-init (a bound slider re-boots when its rows land) must never read it back (iox-ui#176). */
70
+ private readonly el: HTMLElement;
68
71
 
69
72
  constructor(private readonly swiper: CarouselSwiper, options: CarouselA11yOptions = {}) {
70
73
  const el = swiper.el;
74
+ this.el = el;
71
75
  this.words = options.words ?? sliderWords(el.ownerDocument?.documentElement?.getAttribute('lang'));
72
76
  this.pause = sliderPartElement(el, SliderRole.Pause);
73
77
  this.authorName = authorNameOf(this.pause);
@@ -114,7 +118,8 @@ export class CarouselA11y {
114
118
 
115
119
  destroy(): void {
116
120
  this.cleanups.splice(0).forEach(fn => fn());
117
- delete (this.swiper.el as unknown as Record<string, unknown>)[RUNTIME_KEY];
121
+ const host = this.el as unknown as Record<string, unknown>;
122
+ if (host[RUNTIME_KEY] === this) delete host[RUNTIME_KEY];
118
123
  }
119
124
 
120
125
  private listen(target: EventTarget, type: string, fn: (e: Event) => void): void {
@@ -130,7 +135,7 @@ export class CarouselA11y {
130
135
 
131
136
  private onFocusOut(e: FocusEvent): void {
132
137
  const next = e.relatedTarget as Node | null;
133
- if (next && this.swiper.el.contains(next)) return;
138
+ if (next && this.el.contains(next)) return;
134
139
  this.focusInside = false;
135
140
  if (!this.stoppedByVisitor && this.swiper.autoplay?.running && this.swiper.autoplay.paused) this.swiper.autoplay.resume();
136
141
  this.sync();
@@ -223,11 +228,13 @@ export interface BarSwiper {
223
228
  * Returns the stop; a slider with neither part gets a no-op.
224
229
  */
225
230
  export function attachSliderBar(swiper: BarSwiper): () => void {
226
- ((swiper.el as unknown as Record<string, () => void>)[BAR_RUNTIME_KEY])?.();
227
- const caption = sliderPartElement(swiper.el, SliderRole.Caption);
228
- const count = sliderPartElement(swiper.el, SliderRole.Count);
231
+ // Held now: a destroyed Swiper's fields are nulled, and the previous boot's stop runs after it (iox-ui#176).
232
+ const el = swiper.el;
233
+ ((el as unknown as Record<string, () => void>)[BAR_RUNTIME_KEY])?.();
234
+ const caption = sliderPartElement(el, SliderRole.Caption);
235
+ const count = sliderPartElement(el, SliderRole.Count);
229
236
  if (!caption && !count) return () => { /* nothing to keep */ };
230
- const view = swiper.el.ownerDocument?.defaultView;
237
+ const view = el.ownerDocument?.defaultView;
231
238
  const raf = (fn: () => void) => (view?.requestAnimationFrame ? view.requestAnimationFrame(() => view.requestAnimationFrame(fn)) : setTimeout(fn, 32));
232
239
  let first = true;
233
240
  const sync = () => {
@@ -255,8 +262,9 @@ export function attachSliderBar(swiper: BarSwiper): () => void {
255
262
  const stop = () => {
256
263
  swiper.off('slideChange', sync);
257
264
  swiper.off('slidesLengthChange', sync);
258
- delete (swiper.el as unknown as Record<string, unknown>)[BAR_RUNTIME_KEY];
265
+ const host = el as unknown as Record<string, unknown>;
266
+ if (host[BAR_RUNTIME_KEY] === stop) delete host[BAR_RUNTIME_KEY];
259
267
  };
260
- (swiper.el as unknown as Record<string, () => void>)[BAR_RUNTIME_KEY] = stop;
268
+ (el as unknown as Record<string, () => void>)[BAR_RUNTIME_KEY] = stop;
261
269
  return stop;
262
270
  }
@@ -0,0 +1,220 @@
1
+ import { resolveRepeaterItems } from './data-source-resolver';
2
+
3
+ /**
4
+ * Ghost cards (vectoriox/iox-ui#178, Doron 2026-11-28; board `architecture/ai/boards/ghost-cards.board.html`).
5
+ *
6
+ * A generated site keeps its sample items: every page, section and list stays, so the owner sees where things go.
7
+ * A sample the build could not name (it is still "Product 2") is a PLACEHOLDER ROW. The builder canvas and Preview draw
8
+ * it as a ghost card that asks the owner to add the first item. The live site never shows it. This file is the ONE
9
+ * reading of both, so the builder and the SSR engine agree:
10
+ *
11
+ * - `isNumberedPlaceholderTitle` — words and then a number (G-D1). The Publishable gate reads it as well.
12
+ * - `isPlaceholderRow(row, titleField)` — a row marked `isSample` whose title is such a placeholder.
13
+ * - `listTitleField(list)` — the field a list's card shows as its title.
14
+ * - `planPlaceholderHides(roots, resolved)` — what the live engine leaves out (G-D3): placeholder rows are dropped,
15
+ * a list with no live row is not drawn, and its top-level section hides when only its frame is left (heading,
16
+ * eyebrow, lead text, buttons). Pages and their nav links stay (G-D4).
17
+ *
18
+ * Pure and framework-free: no transport, no Angular.
19
+ */
20
+
21
+ /** The stored field that marks a seeded sample item (iox-cms `SAMPLE_FIELD`). */
22
+ export const SAMPLE_ROW_FIELD = 'isSample';
23
+
24
+ /** The fields a row's title is read from when its list names none (a hand-built list, a slider without a title part). */
25
+ export const PLACEHOLDER_TITLE_FALLBACK_FIELDS: readonly string[] = ['title', 'name', 'label'];
26
+
27
+ /**
28
+ * A title that is a numbered placeholder: words and then the item's number ("Product 2", "Room 2", "שם מעצבת השיער 1",
29
+ * "Sample name 3"). Read only on rows marked `isSample`, so a real item called "Studio 54" is never one.
30
+ */
31
+ export function isNumberedPlaceholderTitle(title: string | null | undefined): boolean {
32
+ return typeof title === 'string' && /^\D*\S\s+\d{1,3}$/u.test(title.trim());
33
+ }
34
+
35
+ /** The value at a dotted path of a row (`title`, `details.name`). */
36
+ function fieldOf(row: Record<string, unknown>, path: string): unknown {
37
+ let at: unknown = row;
38
+ for (const key of path.split('.').filter(Boolean)) {
39
+ if (at == null || typeof at !== 'object') return undefined;
40
+ at = (at as Record<string, unknown>)[key];
41
+ }
42
+ return at;
43
+ }
44
+
45
+ /**
46
+ * True when a row is a sample still titled "<words> <n>" — the builder draws a ghost card for it, the live site leaves it
47
+ * out. `titleField` is the list's title field (`listTitleField`); without one the row's `title` / `name` / `label` is
48
+ * read. A row with no title to read is never a placeholder: when in doubt, show it.
49
+ */
50
+ export function isPlaceholderRow(row: unknown, titleField?: string | null): boolean {
51
+ if (!row || typeof row !== 'object' || Array.isArray(row)) return false;
52
+ const r = row as Record<string, unknown>;
53
+ if (r[SAMPLE_ROW_FIELD] !== true) return false;
54
+ const field = titleField || PLACEHOLDER_TITLE_FALLBACK_FIELDS.find(f => typeof r[f] === 'string');
55
+ if (!field) return false;
56
+ const title = fieldOf(r, field);
57
+ return typeof title === 'string' && isNumberedPlaceholderTitle(title);
58
+ }
59
+
60
+ /** The node fields the plan reads — a saved layout node (builder serializer shape) or a live ComponentNode. */
61
+ export interface PlaceholderPlanNode {
62
+ id?: string;
63
+ type?: string;
64
+ role?: string;
65
+ props?: Record<string, unknown> | null;
66
+ bindings?: ReadonlyArray<{ prop?: string; source?: string; path?: string } | null | undefined> | null;
67
+ children?: ReadonlyArray<PlaceholderPlanNode | null | undefined> | null;
68
+ }
69
+
70
+ /** The node types that repeat a source's rows: a Repeater, and a slider whose slides repeat. */
71
+ export const LIST_NODE_TYPES: ReadonlySet<string> = new Set(['Repeater', 'SliderContainer']);
72
+
73
+ /**
74
+ * The data source whose ITEMS a node repeats — a Repeater's or slider's `source` binding with no path (or a slider's
75
+ * `props.source`) — else `null`. A list over an array inside one item (`project.gallery`) is not a list of items.
76
+ */
77
+ export function listSourceOf(node: PlaceholderPlanNode | null | undefined): string | null {
78
+ if (!node || !LIST_NODE_TYPES.has(node.type ?? '')) return null;
79
+ const bound = (node.bindings ?? []).find(b => b?.prop === 'source' && !!b.source);
80
+ if (bound) return bound.path ? null : bound.source!;
81
+ const prop = node.props?.['source'];
82
+ return typeof prop === 'string' && prop ? prop : null;
83
+ }
84
+
85
+ /** Depth-first walk of a node's descendants (not the node itself), stopping below `skip`. */
86
+ function descendants(node: PlaceholderPlanNode, skip?: (n: PlaceholderPlanNode) => boolean): PlaceholderPlanNode[] {
87
+ const out: PlaceholderPlanNode[] = [];
88
+ const walk = (n: PlaceholderPlanNode): void => {
89
+ for (const c of n.children ?? []) {
90
+ if (!c) continue;
91
+ out.push(c);
92
+ if (!skip?.(c)) walk(c);
93
+ }
94
+ };
95
+ walk(node);
96
+ return out;
97
+ }
98
+
99
+ /** The path a node's `content` binding reads from its list's rows, or '' when it has none. */
100
+ function contentPath(node: PlaceholderPlanNode, source: string): string {
101
+ const b = (node.bindings ?? []).find(x => x?.prop === 'content' && x.source === source && !!x.path);
102
+ return b?.path ?? '';
103
+ }
104
+
105
+ /**
106
+ * The row field a list shows as its title: the bound text of its card's title part (a role ending in `title`, e.g.
107
+ * `card.title`), else of its first bound Heading, else `null` (then `isPlaceholderRow` falls back to title/name/label).
108
+ * Nested lists are not looked into.
109
+ */
110
+ export function listTitleField(list: PlaceholderPlanNode | null | undefined): string | null {
111
+ const source = listSourceOf(list);
112
+ if (!list || !source) return null;
113
+ const inside = descendants(list, n => LIST_NODE_TYPES.has(n.type ?? ''));
114
+ const titled = inside.find(n => /(^|\.)title$/.test(n.role ?? '') && contentPath(n, source));
115
+ if (titled) return contentPath(titled, source);
116
+ const heading = inside.find(n => n.type === 'Heading' && contentPath(n, source));
117
+ return heading ? contentPath(heading, source) : null;
118
+ }
119
+
120
+ /**
121
+ * The node types that are only a list section's FRAME (G-D3): its heading, eyebrow, lead text, buttons, links, icons
122
+ * and the boxes around them. A section left with only these hides with its list. Anything else (a picture, a video, a
123
+ * form, a gallery, a static list, a slider that is not bound) is content of its own and keeps the section.
124
+ */
125
+ export const LIST_FRAME_TYPES: ReadonlySet<string> = new Set([
126
+ 'Section', 'Container', 'LinkedContainer', 'Card', 'Heading', 'Text', 'Button', 'ButtonBlock', 'Link', 'Icon',
127
+ 'Divider', 'Spacer', 'Dialog', 'Popover',
128
+ ]);
129
+
130
+ /** The words a list section's frame holds at most outside its list: an eyebrow and a lead line. A third Text is words
131
+ * of the section's own (board B), so it stays. */
132
+ export const LIST_FRAME_MAX_TEXTS = 2;
133
+
134
+ /** What the live engine leaves out of a page so a visitor never meets a placeholder (G-D3). */
135
+ export interface PlaceholderHidePlan {
136
+ /** Per list source alias: its rows without the placeholder rows. Only the aliases that lost a row are listed. */
137
+ rows: Record<string, unknown[]>;
138
+ /** Ids of the nodes not to draw: lists with no live row, and the top-level sections left with only their frame. */
139
+ hidden: Set<string>;
140
+ }
141
+
142
+ /**
143
+ * The ONE live rule (G-D3), shared by the SSR engine's renderers:
144
+ *
145
+ * 1. a list's placeholder rows are dropped (`rows`) — a mixed list shows only the owner's real items;
146
+ * 2. a list whose source resolved to no live row is not drawn (`hidden`);
147
+ * 3. the top-level root holding it hides too when everything else in it is frame (`LIST_FRAME_TYPES`, at most
148
+ * `LIST_FRAME_MAX_TEXTS` Texts) and no other list in it still has a live row.
149
+ *
150
+ * A source the engine did not resolve (`!(alias in resolved)`) is not judged — nothing is hidden on a guess. A page
151
+ * whose every section hid still renders with its header and footer, and its nav links stay (G-D4).
152
+ */
153
+ export function planPlaceholderHides(
154
+ roots: ReadonlyArray<PlaceholderPlanNode | null | undefined> | null | undefined,
155
+ resolved: Readonly<Record<string, unknown>> | null | undefined,
156
+ ): PlaceholderHidePlan {
157
+ const rows: Record<string, unknown[]> = {};
158
+ const hidden = new Set<string>();
159
+ const data = resolved ?? {};
160
+
161
+ /** Live rows of a list, or `null` when its source is not resolved (never judged). */
162
+ const liveRows = (list: PlaceholderPlanNode, source: string): unknown[] | null => {
163
+ if (!(source in data)) return null;
164
+ const all = resolveRepeaterItems(data[source]);
165
+ const title = listTitleField(list);
166
+ const live = all.filter(r => !isPlaceholderRow(r, title));
167
+ if (live.length !== all.length && Array.isArray(data[source])) rows[source] = live;
168
+ return live;
169
+ };
170
+
171
+ for (const root of roots ?? []) {
172
+ if (!root) continue;
173
+ const nodes = [root, ...descendants(root)];
174
+ const lists = nodes.filter(n => !!listSourceOf(n));
175
+ if (!lists.length) continue;
176
+
177
+ const emptyLists = lists.filter(l => liveRows(l, listSourceOf(l)!)?.length === 0);
178
+ for (const l of emptyLists) if (l.id) hidden.add(l.id);
179
+ if (!emptyLists.length || emptyLists.length !== lists.length) continue;
180
+
181
+ // Every list in this root is empty: the root hides unless something outside the lists is content of its own.
182
+ const outsideLists = [root, ...descendants(root, n => !!listSourceOf(n))].filter(n => !listSourceOf(n));
183
+ const onlyFrame = outsideLists.every(n => LIST_FRAME_TYPES.has(n.type ?? ''))
184
+ && outsideLists.filter(n => n.type === 'Text').length <= LIST_FRAME_MAX_TEXTS;
185
+ if (onlyFrame && root.id) hidden.add(root.id);
186
+ }
187
+ return { rows, hidden };
188
+ }
189
+
190
+ /** A page as the live engine draws it once the placeholder rule ran: the roots without the hidden nodes, and the data
191
+ * with each list's placeholder rows dropped. */
192
+ export interface PlaceholderHidden<N> {
193
+ roots: N[];
194
+ resolved: Record<string, unknown>;
195
+ }
196
+
197
+ /**
198
+ * `planPlaceholderHides` applied — what the SSR engine hands BOTH its renderers (the string renderer and the component
199
+ * tree), so they never disagree: the hidden nodes pruned out of the tree (a copy only where something was pruned; the
200
+ * input is never mutated) and the list sources replaced by their live rows.
201
+ */
202
+ export function applyPlaceholderHides<N extends PlaceholderPlanNode>(
203
+ roots: ReadonlyArray<N> | null | undefined,
204
+ resolved: Readonly<Record<string, unknown>> | null | undefined,
205
+ ): PlaceholderHidden<N> {
206
+ const plan = planPlaceholderHides(roots, resolved);
207
+ const data = { ...(resolved ?? {}), ...plan.rows };
208
+ if (!plan.hidden.size) return { roots: [...(roots ?? [])], resolved: data };
209
+ const prune = (nodes: ReadonlyArray<N | null | undefined>): N[] => {
210
+ const out: N[] = [];
211
+ for (const n of nodes) {
212
+ if (!n || (n.id && plan.hidden.has(n.id))) continue;
213
+ const kids = n.children as ReadonlyArray<N | null | undefined> | null | undefined;
214
+ const pruned = kids?.length ? prune(kids) : null;
215
+ out.push(pruned && pruned.length !== kids!.length ? { ...n, children: pruned } : n);
216
+ }
217
+ return out;
218
+ };
219
+ return { roots: prune(roots ?? []), resolved: data };
220
+ }
@@ -2,7 +2,7 @@
2
2
  * @vectoriox/iox-ui/data-core — the shared, FRAMEWORK-FREE data-source core (data-source-resolving.md): the ONE
3
3
  * decision of how a data source becomes a fetch (`planDataSource`), the route-param matcher, the derived /
4
4
  * relative (`$siblings`, `$related`) resolvers, the repeater item reader, and which sources a node tree
5
- * references (`referencedDataSourcesDeep`), and which saved page is the studio's home (`homePageOf`, #116). The builder and the SSR engine resolve with it; iox-cms reads it
5
+ * references (`referencedDataSourcesDeep`), and which saved page is the studio's home (`homePageOf`, #116), and which rows are placeholder samples the live site leaves out (`planPlaceholderHides`, #178). The builder and the SSR engine resolve with it; iox-cms reads it
6
6
  * under plain Node (W2's Undo: is a data source still in use). Pure: no transport, no Angular. The main
7
7
  * entry re-exports it by package path, so `@vectoriox/iox-ui` keeps working.
8
8
  * ⚠️ Consumers wire the usual trio — ng-package raw-ts assets, jest moduleNameMapper, tsconfig paths —
@@ -11,3 +11,4 @@
11
11
  export * from './data-source-resolver';
12
12
  export * from './relative-sources';
13
13
  export * from './home-page';
14
+ export * from './placeholder-rows';
@@ -256,12 +256,64 @@ const passesText = (fg: string, bg: AccentGround) => groundList(bg).every(g => w
256
256
  const bestInkHex = (bg: string) =>
257
257
  (wcagContrastRatio(WHITE_HEX, bg) >= wcagContrastRatio(BLACK_HEX, bg) ? WHITE_HEX : BLACK_HEX);
258
258
 
259
+ /** How `deriveAccentTokens` derives. */
260
+ export interface AccentDerivationOptions {
261
+ /** CV-D1: the light accent is the seed itself (default). `false`: brand-500 with its ink and the next step as hover —
262
+ * what the contract wrote before colour v2 CV1, kept ONLY to recognise rows a machine wrote then (`legacyFlavorTokens`,
263
+ * `preKeptSeedDesignTokenRows`). */
264
+ keepSeed?: boolean;
265
+ }
266
+
267
+ /** CV-D1 (colour-v2-plan.md): the accent's hover sits at least this much OKLab L away from the kept accent (away from its ink). */
268
+ export const KEPT_HOVER_DL = 0.06;
269
+ /** CV-D1: how far the hover may walk on (0.02 a step) to keep the brand band's surfaces readable. */
270
+ export const KEPT_HOVER_DL_MAX = 0.3;
271
+ /**
272
+ * CV-D1: the strongest ink tint the contract lays on a Brand band's surface. Inside the accent scheme `surface` IS the
273
+ * accent's hover and the ink is the band's words (the contract's SCHEMES.accent); Bloom's secondary button is
274
+ * `color-mix(accent 22%, surface)` there — the ink mixed 22% into the hover. The hover keeps the ink at AA under it.
275
+ */
276
+ export const BAND_SURFACE_INK_TINT = 0.22;
277
+
278
+ const mixSrgb = (a: Rgb, b: Rgb, share: number): Rgb =>
279
+ ({ r: a.r * share + b.r * (1 - share), g: a.g * share + b.g * (1 - share), b: a.b * share + b.b * (1 - share) });
280
+
281
+ /**
282
+ * CV-D1 (colour-v2-plan.md §2 cause 1, §5a): the light accent IS the brand colour — a navy stays navy, a berry stays
283
+ * berry (it used to be brand-500 at L 0.62: a pastel with a black label). On every sRGB colour the better of a white and a
284
+ * black label reads at least √21 ≈ 4.58:1, so the seed always carries one (R-H-CV1). `ink` is that label. `hover` walks
285
+ * away from the ink (white ink: darker; black ink: lighter) at the seed's hue and chroma, from `KEPT_HOVER_DL` in 0.02
286
+ * steps, until the ink reads on it even with `BAND_SURFACE_INK_TINT` of the ink mixed in (the hover is the Brand band's
287
+ * surface); never past `KEPT_HOVER_DL_MAX`. Mirror of the contract's colour.mjs `keptAccent` (derivationFixtures hold
288
+ * them equal).
289
+ */
290
+ export function keptAccent(seed: string): { accent: string; ink: string; hover: string } {
291
+ const own = parseHexColor(seed);
292
+ if (!own) throw new TypeError(`keptAccent: not a colour: "${seed}"`);
293
+ const lab = rgbToOklab(own);
294
+ const chroma = Math.hypot(lab.a, lab.b);
295
+ const ua = chroma > 1e-6 ? lab.a : 0.0, ub = chroma > 1e-6 ? lab.b : 1e-6;
296
+ const ink = wcagContrastRatio(WHITE, own) >= wcagContrastRatio(BLACK, own) ? WHITE : BLACK;
297
+ const away = ink === WHITE ? -1 : 1;
298
+ const tinted = (c: Rgb) => mixSrgb(ink, c, BAND_SURFACE_INK_TINT);
299
+ // judged on the float mix and on the hex it rounds to, whichever is lower (the audit and a browser may round either way)
300
+ const reads = (c: Rgb) => wcagContrastRatio(ink, c) >= WCAG_AA_TEXT
301
+ && Math.min(wcagContrastRatio(ink, tinted(c)), wcagContrastRatio(ink, quant(tinted(c)))) >= WCAG_AA_TEXT;
302
+ let hover: Rgb | null = null;
303
+ for (let i = 0; !hover; i++) {
304
+ const dl = Math.min(KEPT_HOVER_DL + i * 0.02, KEPT_HOVER_DL_MAX);
305
+ const c = quant(atLightness(Math.min(1, Math.max(0, lab.L + away * dl)), ua, ub, chroma));
306
+ if (reads(c) || dl >= KEPT_HOVER_DL_MAX) hover = c;
307
+ }
308
+ return { accent: toHexColor(own), ink: toHexColor(ink), hover: toHexColor(wcagContrastRatio(ink, hover) >= WCAG_AA_TEXT ? hover : own) };
309
+ }
310
+
259
311
  /**
260
312
  * The quartet a seed different from the pack's own becomes, built ON `deriveBrandTokens` (its
261
313
  * ramp and its WCAG-gated `brandInk`) — never a second colour model:
262
314
  *
263
- * - `accent` = brand-500 (already nudged until `brandInk` clears 4.5:1 on it), `accent-ink` = brandInk
264
- * - `accent-hover` = the neighbouring step AWAY from the ink, so ink-on-hover only gains contrast
315
+ * - `accent` = the seed itself (CV-D1, `keptAccent`), `accent-ink` = the label that reads on it
316
+ * - `accent-hover` = `KEPT_HOVER_DL` away from the ink, so ink-on-hover only gains contrast
265
317
  * - `accent-text` = the first step from 500 toward the far end that clears 4.5:1 on `bg`
266
318
  * - dark: the first of brand-300/200/400 an ink clears 4.5:1 on, the same hover rule, and
267
319
  * `accent-text` = the first light step that clears 4.5:1 on `bgDark`
@@ -278,6 +330,7 @@ export function deriveAccentTokens(
278
330
  seed: string,
279
331
  against: AccentBackgrounds,
280
332
  pack: Pick<FlavorPack, 'accentHueDeg'> = {},
333
+ options: AccentDerivationOptions = {},
281
334
  ): FlavorTokenDef[] {
282
335
  const derived = deriveBrandTokens(seed, pack);
283
336
  const hexOf = (name: string) => derived.find(t => t.name === name)!.value;
@@ -291,10 +344,10 @@ export function deriveAccentTokens(
291
344
  const firstOn = (steps: number[], bg: AccentGround) => step(steps.find(n => passesText(step(n), bg)) ?? steps[steps.length - 1]);
292
345
 
293
346
  const ink = hexOf('brandInk');
347
+ // CV-D1: the light accent is the seed itself; words keep the ramp's text step. (`ink` — the ramp's brandInk — still
348
+ // decides the inverse accent's label below, as before.)
294
349
  const light = {
295
- accent: step(500),
296
- ink,
297
- hover: hoverFor(500, ink),
350
+ ...(options.keepSeed === false ? { accent: step(500), ink, hover: hoverFor(500, ink) } : keptAccent(seed)),
298
351
  text: firstOn([500, 600, 700, 800, 900], against.bg),
299
352
  };
300
353
 
@@ -384,37 +384,64 @@ export function colourTabChecks(rows: ReadonlyArray<DesignTokenLike>, mode: Reso
384
384
 
385
385
  // ── Floating grounds (HI3 slice 1, R-H16, vectoriox/iox-ui#173) ──────────────────────────────────────────────────────
386
386
 
387
- interface FloatingGround { readonly ground: string; readonly ink: string; }
387
+ /** Where a floating ground's ink is read: `header` = inside the header's ink scope (vectoriox/iox-ui#173 a). */
388
+ export enum FloatingInkScope { Header = 'header' }
389
+ export interface FloatingGround { readonly ground: string; readonly ink: string; readonly scope?: FloatingInkScope | string; }
390
+ /** What the header re-declares for its words (the contract's `contrastAudit.headerInkScope`; iox-design.css, verbatim). */
391
+ export interface HeaderInkScope { readonly selectors: ReadonlyArray<string>; readonly set: Readonly<Record<string, string>>; }
392
+ const AUDIT_TABLES = SPEC_CONTRAST_AUDIT as unknown as { floatingGrounds?: ReadonlyArray<FloatingGround>; headerInkScope?: HeaderInkScope };
388
393
  /** The translucent grounds that carry words over ANYTHING (the header's bar and glass while the page moves under them, the
389
394
  * bottom bar, a dialog, a popover, the strong glass) — the contract's table (`contrastAudit.floatingGrounds`). */
390
- const FLOATING_GROUNDS: ReadonlyArray<FloatingGround> =
391
- (SPEC_CONTRAST_AUDIT as unknown as { floatingGrounds?: ReadonlyArray<FloatingGround> }).floatingGrounds ?? [];
395
+ const FLOATING_GROUNDS: ReadonlyArray<FloatingGround> = AUDIT_TABLES.floatingGrounds ?? [];
396
+ /** The contract's header ink scope — null on a contract generated before vectoriox/iox-ui#173 (a). */
397
+ export const HEADER_INK_SCOPE: HeaderInkScope | null = AUDIT_TABLES.headerInkScope ?? null;
398
+ const CURRENT_COLOR = 'currentcolor';
399
+ const INHERITED_INK = 'text';
400
+
401
+ /**
402
+ * An ink's value as the words on a floating ground wear it — the contract's `floatingInk`, 1:1. A header ground's ink is
403
+ * read INSIDE the header's ink scope: `currentColor` is the bar's own ink (`text` — the bar is `color: inherit`), a token
404
+ * reference reads that token, anything else is the value itself. Outside a scope the ink is the token's own value.
405
+ */
406
+ export function floatingInkValue(values: Readonly<Record<string, string>>, ink: string, scope?: string, header: HeaderInkScope | null = HEADER_INK_SCOPE): string | undefined {
407
+ const set = scope === FloatingInkScope.Header ? header?.set[ink] : undefined;
408
+ if (set === undefined) return values[ink];
409
+ if (set.trim().toLowerCase() === CURRENT_COLOR) return values[INHERITED_INK];
410
+ const ref = /^var\(--iox-([\w-]+)\)$/.exec(set.trim());
411
+ return ref ? values[ref[1]] : set;
412
+ }
392
413
  const BLACK: Rgba = { r: 0, g: 0, b: 0, a: 1 };
393
414
  /** The two backdrops that bound every picture: each channel of a blend is monotone in its backdrop's. */
394
415
  export const FLOATING_BACKDROPS: Readonly<Record<string, Rgba>> = Object.freeze({ black: BLACK, white: WHITE });
395
416
 
396
417
  /**
397
- * HI3 slice 1 (R-H16): each translucent ground's words over pure black AND pure white, in the page's own scheme (the one a
398
- * header on a ground and a top-layer dialog wear), in one mode — nothing a blur can lay under the bar is darker or
399
- * lighter, so a ground that holds AA over both holds it over any picture (iox-ui#173: the Glass look's bar dropped to
400
- * 3.55:1 over a light picture in dark mode). An opaque ground is not judged here (the DS9 audit judges it where it stands).
401
- * The contract's gate, 1:1 (build-spec `floatingGroundFailures`).
418
+ * HI3 slice 1 (R-H16): each translucent ground's words over pure black AND pure white, in EVERY section scheme (the page's
419
+ * own, and any an author dresses the header or a dialog in — vectoriox/iox-ui#174), in one mode — nothing a blur can lay
420
+ * under the bar is darker or lighter, so a ground that holds AA over both holds it over any picture (iox-ui#173: the Glass
421
+ * look's bar dropped to 3.55:1 over a light picture in dark mode). An opaque ground is not judged here (the DS9 audit
422
+ * judges it where it stands). The contract's gate, 1:1 (build-spec `floatingGroundFailures`).
402
423
  */
403
- export function floatingGroundFindings(rows: ReadonlyArray<DesignTokenLike>, mode: ResolvedMode): ContrastFinding[] {
404
- const values = schemeTokenResolver(rows, mode)(DEFAULT_SCHEME);
424
+ export function floatingGroundFindings(
425
+ rows: ReadonlyArray<DesignTokenLike>, mode: ResolvedMode,
426
+ table: ReadonlyArray<FloatingGround> = FLOATING_GROUNDS, header: HeaderInkScope | null = HEADER_INK_SCOPE,
427
+ ): ContrastFinding[] {
428
+ const valuesIn = schemeTokenResolver(rows, mode);
405
429
  const out: ContrastFinding[] = [];
406
- for (const { ground, ink } of FLOATING_GROUNDS) {
407
- const fg = parseCssColour(values[ink]);
408
- const bg = parseCssColour(values[ground], fg);
409
- if (!fg || !bg || bg.a >= 1) continue;
410
- const fgHex = toHexColor(quantizeRgb(fg));
411
- for (const [name, under] of Object.entries(FLOATING_BACKDROPS)) {
412
- const shown = quantizeRgb(compositeOver(bg, under));
413
- const ratio = wcagContrastRatio(fgHex, shown);
414
- out.push({
415
- scheme: DEFAULT_SCHEME, container: `over ${name}`, element: ground, part: ink, fg: fgHex, bg: toHexColor(shown),
416
- ratio: Math.round(ratio * 100) / 100, min: WCAG_AA_TEXT, pass: ratio >= WCAG_AA_TEXT - 1e-9,
417
- });
430
+ for (const scheme of SCHEME_IDS) {
431
+ const values = valuesIn(scheme);
432
+ for (const { ground, ink, scope } of table) {
433
+ const fg = parseCssColour(floatingInkValue(values, ink, scope, header));
434
+ const bg = parseCssColour(values[ground], fg);
435
+ if (!fg || !bg || bg.a >= 1) continue;
436
+ const fgHex = toHexColor(quantizeRgb(fg));
437
+ for (const [name, under] of Object.entries(FLOATING_BACKDROPS)) {
438
+ const shown = quantizeRgb(compositeOver(bg, under));
439
+ const ratio = wcagContrastRatio(fgHex, shown);
440
+ out.push({
441
+ scheme, container: `over ${name}`, element: ground, part: ink, fg: fgHex, bg: toHexColor(shown),
442
+ ratio: Math.round(ratio * 100) / 100, min: WCAG_AA_TEXT, pass: ratio >= WCAG_AA_TEXT - 1e-9,
443
+ });
444
+ }
418
445
  }
419
446
  }
420
447
  return out;
@@ -1,4 +1,4 @@
1
- import { deriveBrandTokens } from './brand';
1
+ import { deriveAccentTokens, deriveBrandTokens } from './brand';
2
2
  import { FLAVOR_SPEC_VERSION, SPEC_LEGACY_ALIASES } from './flavor-spec.generated';
3
3
  import { SWISS_FLAVOR } from './flavor';
4
4
  import { buildFlavorTokens, legacyFlavorTokens } from './flavor-tokens';
@@ -36,6 +36,29 @@ export function legacyDesignTokenRows(choices: DesignChoices): DesignTokenRow[]
36
36
  return pack ? legacyFlavorTokens(pack, { ...choices, flavorId: pack.id }) : [];
37
37
  }
38
38
 
39
+ /** The accent rows colour v2 CV1 (CV-D1) changed: in light mode the accent is the seed itself now. */
40
+ const KEPT_SEED_ROWS: ReadonlyArray<string> = ['accent', 'accent-ink', 'accent-hover'];
41
+
42
+ /**
43
+ * What a design wrote BEFORE colour v2 CV1 (guidance 8f61581, CV-D1): today's rows, but a seed ≠ the pack's own wore
44
+ * brand-500 (L 0.62, a pastel with a black label) as its light accent, ink and hover. Those three do not depend on the
45
+ * grounds, so only their light values differ; the dark values and every other row are today's. A studio whose rows a
46
+ * machine wrote then is healed to the kept seed on the builder's load (`designTokenRepairs`) and by its next Apply
47
+ * (`designBaseline`); a row the author edited is kept. Empty for an unknown pack.
48
+ */
49
+ export function preKeptSeedDesignTokenRows(choices: DesignChoices): DesignTokenRow[] {
50
+ const rows = designTokenRows(choices);
51
+ const pack = flavorPackById(choices.flavorId);
52
+ if (!pack || !choices.seed || choices.seed.toLowerCase() === pack.seed.toLowerCase()) return rows;
53
+ let old: ReadonlyArray<{ name: string; value: string }>;
54
+ try { old = deriveAccentTokens(choices.seed, { bg: [] }, {}, { keepSeed: false }); } catch { return rows; }
55
+ for (const row of rows) {
56
+ const was = KEPT_SEED_ROWS.includes(row.name) ? old.find(t => t.name === row.name) : undefined;
57
+ if (was) row.value = was.value.toUpperCase();
58
+ }
59
+ return rows;
60
+ }
61
+
39
62
  /** What the F1/F2 Swiss seeding wrote: the four Swiss rows + the brand set derived from its seed. */
40
63
  function swissExpectations(seed: string | null): Map<string, SeedExpectation> {
41
64
  const rows: Array<Pick<DesignTokenRow, 'name' | 'value' | 'values'>> =
@@ -69,6 +92,10 @@ function packDefaultsLookup(): (packId: string) => ReadonlyArray<Map<string, See
69
92
  * - guidance `39135c7` (no underlines, Doron 2026-11-22): a link and a ghost (text) button draw no line — Linen's ghost
70
93
  * button and every look's link were seeded `underline`, the current page's link a 2px accent line (vectoriox/iox-ui#118:
71
94
  * idos and the store kept underlined text buttons from the stored row).
95
+ * - vectoriox/iox-ui#173 (b), decided 2026-11-28 — no migration: the Glass bar stood on `surface-glass` (3.55:1 over a
96
+ * light picture in dark mode; HI3 slice 1 moved it to `surface-glass-strong`), and the Glass tab bar on
97
+ * `surface-glass-strong` (3.74–4.19:1; #174 gave it its own 92% ground). A Glass studio applied before either kept the
98
+ * old ground (iox-test-fresh's J10 sites, 2026-11-28); the next Apply or builder load heals it.
72
99
  * A spec pins every entry as no flavor's current value. Add one with every contract change of a seeded token's value.
73
100
  */
74
101
  export const SUPERSEDED_TOKEN_VALUES: Readonly<Record<string, ReadonlyArray<string>>> = {
@@ -77,6 +104,8 @@ export const SUPERSEDED_TOKEN_VALUES: Readonly<Record<string, ReadonlyArray<stri
77
104
  'button-ghost-decoration': ['underline'],
78
105
  'link-decoration': ['underline'],
79
106
  'link-current-decoration': ['underline 2px var(--iox-accent-text)'],
107
+ 'nav-bg': ['var(--iox-surface-glass)'],
108
+ 'tabbar-bg': ['var(--iox-surface-glass-strong)'],
80
109
  };
81
110
 
82
111
  const supersededOf = (name: string): SeedExpectation[] => (SUPERSEDED_TOKEN_VALUES[name] ?? []).map(value => ({ value }));
@@ -110,13 +139,14 @@ export function designBaseline(previous: StoredDesign): SeedBaseline {
110
139
  const wrote = retired ? packDesignChoices(previous.choices.flavorId) : previous.choices;
111
140
  const current = expectations(designTokenRows(wrote));
112
141
  const beforeTint = expectations(legacyDesignTokenRows(wrote));
142
+ const beforeKeptSeed = expectations(preKeptSeedDesignTokenRows(wrote));
113
143
  const swiss = swissExpectations(retired ? previous.storedSeed : null);
114
144
  const packDefaults = packDefaultsLookup();
115
145
  return (row: StoredDesignTokenRow) => {
116
146
  const stampedBy = SEED_STAMP.exec(row.source ?? '')?.[1];
117
147
  if (stampedBy === SWISS_FLAVOR.id) return swiss.get(row.name);
118
148
  const ownDefaults = stampedBy ? packDefaults(stampedBy).map(m => m.get(row.name)) : [];
119
- const expected = [current.get(row.name), beforeTint.get(row.name), ...ownDefaults];
149
+ const expected = [current.get(row.name), beforeTint.get(row.name), beforeKeptSeed.get(row.name), ...ownDefaults];
120
150
  return present([...expected, ...expected.map(e => beforeScriptPartners(row.name, e)), ...(stampedBy ? supersededOf(row.name) : [])]);
121
151
  };
122
152
  }
@@ -246,6 +276,7 @@ export function designTokenRepairs(existing: ReadonlyArray<StoredDesignTokenRow>
246
276
  const stamp = flavorSourceStamp(pack.id);
247
277
  const desired = new Map(designTokenRows(choices).map(r => [r.name, r]));
248
278
  const beforeTint = expectations(legacyDesignTokenRows(choices));
279
+ const beforeKeptSeed = expectations(preKeptSeedDesignTokenRows(choices));
249
280
  const packDefaults = packDefaultsLookup();
250
281
  const out: FlavorSeedPlan['update'] = [];
251
282
  for (const row of existing ?? []) {
@@ -256,7 +287,7 @@ export function designTokenRepairs(existing: ReadonlyArray<StoredDesignTokenRow>
256
287
  const darkOnly = row.source === stamp && row.value === want.value;
257
288
  const machineWrote = present([
258
289
  ...(stampedBy ? packDefaults(stampedBy).map(m => m.get(row.name)) : []),
259
- ...(stampedBy === pack.id ? [beforeTint.get(row.name), beforeScriptPartners(row.name, want), beforeScriptPartners(row.name, beforeTint.get(row.name))] : []),
290
+ ...(stampedBy === pack.id ? [beforeTint.get(row.name), beforeKeptSeed.get(row.name), beforeScriptPartners(row.name, want), beforeScriptPartners(row.name, beforeTint.get(row.name))] : []),
260
291
  ...(stampedBy ? supersededOf(row.name) : []),
261
292
  ]);
262
293
  if (!darkOnly && !untouchedSeedRow(row, machineWrote)) continue;