@vectoriox/iox-ui 5.194.0 → 5.196.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 (53) hide show
  1. package/actions-core/index.d.ts +1 -0
  2. package/commerce-core/index.d.ts +0 -1
  3. package/composite-core/index.d.ts +39 -12
  4. package/design-core/index.d.ts +396 -9
  5. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +1 -0
  6. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +0 -2
  8. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +89 -36
  10. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-design-core.mjs +864 -335
  12. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  13. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +885 -513
  14. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  15. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +221 -2
  16. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  17. package/fesm2022/vectoriox-iox-ui-identity-core.mjs +11 -5
  18. package/fesm2022/vectoriox-iox-ui-identity-core.mjs.map +1 -1
  19. package/fesm2022/vectoriox-iox-ui.mjs +83 -31
  20. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  21. package/generation-core/index.d.ts +322 -95
  22. package/harness-core/index.d.ts +165 -3
  23. package/identity-core/index.d.ts +8 -1
  24. package/index.d.ts +30 -8
  25. package/package.json +1 -1
  26. package/src/actions-core/public-api.ts +3 -0
  27. package/src/commerce-core/shop-display.ts +0 -2
  28. package/src/composite-core/account-runtime.ts +2 -2
  29. package/src/composite-core/header.ts +23 -1
  30. package/src/composite-core/lightbox.ts +27 -8
  31. package/src/composite-core/shop.ts +45 -28
  32. package/src/design-core/close-word.ts +18 -0
  33. package/src/design-core/contrast-audit.ts +62 -14
  34. package/src/design-core/flavor-spec.generated.ts +275 -1
  35. package/src/design-core/header-behaviour.ts +172 -3
  36. package/src/design-core/locale-direction.ts +17 -0
  37. package/src/design-core/node-classes.ts +9 -2
  38. package/src/design-core/public-api.ts +1 -0
  39. package/src/design-core/token-css.ts +62 -3
  40. package/src/generation-core/audit-site.ts +26 -5
  41. package/src/generation-core/audit-words.ts +8 -0
  42. package/src/generation-core/compose-site.ts +28 -10
  43. package/src/generation-core/header-mix.ts +165 -12
  44. package/src/generation-core/import-plan.ts +41 -0
  45. package/src/generation-core/public-api.ts +1 -0
  46. package/src/generation-core/site-spec.generated.ts +41 -9
  47. package/src/generation-core/stock-photos.ts +23 -4
  48. package/src/generation-core/stock-search.ts +235 -0
  49. package/src/harness-core/business-types.ts +11 -0
  50. package/src/harness-core/harness-spec.generated.ts +213 -0
  51. package/src/harness-core/run-compose-context.ts +9 -3
  52. package/src/identity-core/site-auth-transport.ts +11 -4
  53. package/styles/iox-design.css +148 -6
@@ -1,7 +1,8 @@
1
- import { repeatedRowIndex, ROW_INDEX_ATTRIBUTE, setColorScheme } from '@vectoriox/iox-ui/design-core';
1
+ import { closeWord, repeatedRowIndex, ROW_INDEX_ATTRIBUTE, setColorScheme } from '@vectoriox/iox-ui/design-core';
2
2
 
3
3
  import { CompositeNode, CompositeNodeFactory, makeCompositePart, NO_ELEMENT_STYLE, readProp, writeProp, writeStyles } from './composite-node';
4
- import { buildSliderPart, SLIDE_TYPE, SLIDER_TYPE, SliderRole } from './slider';
4
+ import { recipeLang, RecipeLang } from './recipe-parts';
5
+ import { buildSliderPart, SLIDE_TYPE, SLIDER_NAME_TRAIT, SLIDER_TYPE, SliderRole, sliderWords } from './slider';
5
6
 
6
7
  /**
7
8
  * THE LIGHTBOX (CC3 — complex-components plan §7d, board 6). Not a component: a Dialog holding a Slider bound to the
@@ -17,6 +18,11 @@ import { buildSliderPart, SLIDE_TYPE, SLIDER_TYPE, SliderRole } from './slider';
17
18
  *
18
19
  * Keyboard ← → are the Slider's Keyboard module; Esc and the focus trap are the `<dialog>`'s; focus returns to the
19
20
  * thumbnail that opened it (the dialog opener's own rule).
21
+ *
22
+ * Its words are stored in the node, so they are stamped in the SITE's language (`LightboxOptions.lang`, vectoriox/iox-ui#170):
23
+ * Close's name is the ONE close word (design-core `closeWord`), the arrows' the slider's (`sliderWords`), the gallery's
24
+ * name and the sample caption `LIGHTBOX_WORDS`. The layer names stay the builder's (`LIGHTBOX_LABEL` is how the composer
25
+ * finds the lightbox it wires).
20
26
  */
21
27
 
22
28
  export const SLIDE_TO_ROW = 'row';
@@ -38,8 +44,16 @@ export interface LightboxOptions {
38
44
  captionField?: string;
39
45
  /** The image's alt binding; '' = decorative (a bare URL row has no words of its own). */
40
46
  altField?: string;
47
+ /** The site's language (a locale: `he`, `he-IL`) — the words the recipe stores (iox-ui#170). English when not given. */
48
+ lang?: string | null;
41
49
  }
42
50
 
51
+ /** The lightbox's own stored words per recipe language: the gallery's accessible name and the manual slides' caption. */
52
+ export const LIGHTBOX_WORDS: Readonly<Record<RecipeLang, { name: string; caption: string }>> = Object.freeze({
53
+ en: { name: 'Gallery', caption: 'Caption' },
54
+ he: { name: 'גלריה', caption: 'כיתוב' },
55
+ });
56
+
43
57
  const ZERO = '0px 0px 0px 0px';
44
58
  const DIALOG_BASE: Readonly<Record<string, string>> = {
45
59
  width: '100vw', maxWidth: '100vw', height: '100dvh', maxHeight: '100dvh', borderRadius: '0px', padding: '18px 18px 18px 18px',
@@ -80,10 +94,10 @@ function bindRow(node: CompositeNode, prop: string, source: string, field: strin
80
94
  (node as { bindings?: unknown[] }).bindings = bindings;
81
95
  }
82
96
 
83
- function buildSlide(create: CompositeNodeFactory, key: string, options: LightboxOptions, rowAlias: string | null): CompositeNode {
97
+ function buildSlide(create: CompositeNodeFactory, key: string, options: LightboxOptions, rowAlias: string | null, captionWord: string): CompositeNode {
84
98
  const slide = makeCompositePart(create, { key, type: SLIDE_TYPE, props: {}, elementStyle: NO_ELEMENT_STYLE }, null, 'Slide', SLIDE_BASE);
85
99
  const image = makeCompositePart(create, { key: `${key}-image`, type: 'Image', props: { src: '', alt: '' }, elementStyle: 'media' }, null, 'Image', IMAGE_BASE);
86
- const caption = makeCompositePart(create, { key: `${key}-caption`, type: 'Text', props: { content: 'Caption', tag: 'p' }, elementStyle: 'small' }, null, 'Caption', CAPTION_BASE);
100
+ const caption = makeCompositePart(create, { key: `${key}-caption`, type: 'Text', props: { content: captionWord, tag: 'p' }, elementStyle: 'small' }, null, 'Caption', CAPTION_BASE);
87
101
  if (rowAlias) {
88
102
  bindRow(image, 'src', rowAlias, options.imageField ?? 'item');
89
103
  if (options.altField) bindRow(image, 'alt', rowAlias, options.altField);
@@ -95,21 +109,23 @@ function buildSlide(create: CompositeNodeFactory, key: string, options: Lightbox
95
109
 
96
110
  /** A fresh lightbox: the Dialog, its Close part and the Slider (bound to `source`, or three manual slides). */
97
111
  export function buildLightboxRecipe(create: CompositeNodeFactory, options: LightboxOptions = {}): CompositeNode {
112
+ const words = LIGHTBOX_WORDS[recipeLang(options.lang)];
113
+ const arrows = sliderWords(options.lang);
98
114
  const dialog = makeCompositePart(create, { key: 'lightbox', type: DIALOG, props: {}, elementStyle: 'dialog' }, null, LIGHTBOX_LABEL, DIALOG_BASE);
99
115
  writeProp(dialog, 'placement', 'center');
100
116
  writeProp(dialog, 'closeOnBackdrop', true);
101
117
  writeProp(dialog, 'showCloseButton', false);
102
- writeProp(dialog, 'ariaLabel', 'Gallery');
118
+ writeProp(dialog, 'ariaLabel', words.name);
103
119
  setColorScheme(dialog, 'inverse');
104
120
 
105
- const close = makeCompositePart(create, { key: 'close', type: 'ButtonBlock', props: { tag: 'button', type: 'button', ariaLabel: 'Close' }, elementStyle: 'button-ghost' }, null, 'Close', CLOSE_BASE);
121
+ const close = makeCompositePart(create, { key: 'close', type: 'ButtonBlock', props: { tag: 'button', type: 'button', ariaLabel: closeWord(options.lang) }, elementStyle: 'button-ghost' }, null, 'Close', CLOSE_BASE);
106
122
  close.children = [makeCompositePart(create, { key: 'close-icon', type: 'Icon', props: { iconClass: 'ph ph-x' }, elementStyle: 'icon' }, null, 'Icon', { fontSize: '22px', color: 'inherit' })];
107
123
  onClick(close, 'closeDialog', dialog.id ?? '');
108
124
 
109
125
  const slider = makeCompositePart(create, { key: 'slider', type: SLIDER_TYPE, props: {}, elementStyle: NO_ELEMENT_STYLE }, null, 'Slider', SLIDER_BASE);
110
126
  for (const [name, value] of Object.entries({
111
127
  slidesPerView: 1, spaceBetween: 0, loop: 'off', enableNavigation: true, enablePagination: true, paginationType: 'fraction',
112
- enableKeyboard: true, ariaLabel: 'Gallery', limit: 50,
128
+ enableKeyboard: true, [SLIDER_NAME_TRAIT]: words.name, limit: 50,
113
129
  })) writeProp(slider, name, value);
114
130
  const rowAlias = options.source ? lastSegment(options.sourcePath) || options.source : null;
115
131
  if (options.source) {
@@ -118,6 +134,8 @@ export function buildLightboxRecipe(create: CompositeNodeFactory, options: Light
118
134
  }
119
135
  const prev = buildSliderPart(create, SliderRole.Prev);
120
136
  const next = buildSliderPart(create, SliderRole.Next);
137
+ writeProp(prev, SLIDER_NAME_TRAIT, arrows.prev);
138
+ writeProp(next, SLIDER_NAME_TRAIT, arrows.next);
121
139
  for (const arrow of [prev, next]) {
122
140
  const layers = { ...(arrow.responsive ?? {}) };
123
141
  layers[LIGHTBOX_ARROWS_HIDE_AT] = { styleProps: { display: 'none' } };
@@ -126,7 +144,8 @@ export function buildLightboxRecipe(create: CompositeNodeFactory, options: Light
126
144
  const counter = buildSliderPart(create, SliderRole.Pagination);
127
145
  counter.label = 'Counter';
128
146
  writeStyles(counter, COUNTER_BASE);
129
- const slides = rowAlias ? [buildSlide(create, 'slide', options, rowAlias)] : [1, 2, 3].map(n => buildSlide(create, `slide-${n}`, options, null));
147
+ const slides = rowAlias ? [buildSlide(create, 'slide', options, rowAlias, words.caption)]
148
+ : [1, 2, 3].map(n => buildSlide(create, `slide-${n}`, options, null, words.caption));
130
149
  slider.children = [prev, next, ...slides, counter];
131
150
  dialog.children = [close, slider];
132
151
  return dialog;
@@ -1,9 +1,9 @@
1
1
  import { ShopWord, shopWord } from '@vectoriox/iox-ui/commerce-core';
2
2
  import type { ProductOption } from '@vectoriox/iox-ui/commerce-core';
3
- import { roleClass } from '@vectoriox/iox-ui/design-core';
3
+ import { closeWord, roleClass } from '@vectoriox/iox-ui/design-core';
4
4
 
5
5
  import { CompositeNode, CompositeNodeFactory, findByRole, writeProp } from './composite-node';
6
- import { bindSlot, COLUMN, onClick, recipeButton, recipeIcon, recipePart, recipeText, ROW, WORDS, ZERO } from './recipe-parts';
6
+ import { bindSlot, COLUMN, onClick, recipeButton, recipeIcon, recipeLang, RecipeLang, recipePart, recipeText, ROW, WORDS, ZERO } from './recipe-parts';
7
7
 
8
8
  /**
9
9
  * THE SHOP PARTS (commerce E1c, C-D16 — commerce board 10). Not components: recipes of ordinary builder nodes, each part
@@ -206,26 +206,39 @@ enum Style {
206
206
  Title = 'h3',
207
207
  }
208
208
 
209
+ /** The sample product a fresh recipe shows (board 10's vase) — the runtime replaces it with the page's product and the
210
+ * bag's lines, but the canvas and a page's first paint show it, so it is in the site's language too (vectoriox/iox-ui#100). */
211
+ const SHOP_SAMPLES: Readonly<Record<RecipeLang, { option: string; value: string; swatch: string; soldOut: string; lineTitle: string }>> = Object.freeze({
212
+ en: { option: 'Glaze — Sand', value: '32 cm', swatch: 'Sand', soldOut: 'Charcoal', lineTitle: 'Tall speckled vase' },
213
+ he: { option: 'זיגוג — חול', value: '32 ס״מ', swatch: 'חול', soldOut: 'פחם', lineTitle: 'אגרטל גבוה מנומר' },
214
+ });
215
+
209
216
  /** The words a fresh recipe shows, in the site's language (vectoriox/iox-ui#100 — a Hebrew store's bag, buttons and drawer
210
- * speak Hebrew, as its header does). The sample product's own words (board 10's vase) are the runtime's to replace. */
217
+ * speak Hebrew, as its header does; so do the sample product's words and the names a screen reader hears). */
211
218
  export function shopRecipeWords(lang: string | null | undefined = 'en') {
212
219
  const w = (word: ShopWord, fill: Readonly<Record<string, string | number>> = {}) => shopWord(word, lang, fill);
220
+ const sample = SHOP_SAMPLES[recipeLang(lang)];
213
221
  return Object.freeze({
214
222
  price: '₪240.00',
215
223
  compareAt: '₪280.00',
216
- option: 'Glaze — Sand',
217
- value: '32 cm',
218
- note: 'Charcoal is sold out',
224
+ option: sample.option,
225
+ value: sample.value,
226
+ swatch: sample.swatch,
227
+ note: w(ShopWord.ValueSoldOut, { name: sample.soldOut }),
219
228
  quantity: '1',
229
+ quantityLabel: w(ShopWord.Quantity),
230
+ decrease: w(ShopWord.Decrease),
231
+ increase: w(ShopWord.Increase),
220
232
  add: w(ShopWord.AddToCart),
221
233
  added: w(ShopWord.Added),
222
234
  buyNow: w(ShopWord.BuyNow),
223
235
  cart: w(ShopWord.Cart),
224
236
  count: '2',
225
237
  drawer: w(ShopWord.YourBag),
226
- close: w(ShopWord.Close),
227
- lineTitle: 'Tall speckled vase',
228
- lineVariant: 'Sand · 32 cm',
238
+ // The drawer's × is named by the ONE close word (design-core `closeWord`, iox-ui#170) — never a shop word of its own.
239
+ close: closeWord(lang),
240
+ lineTitle: sample.lineTitle,
241
+ lineVariant: `${sample.swatch} · ${sample.value}`,
229
242
  lineTotal: '₪240.00',
230
243
  remove: w(ShopWord.RemoveLine),
231
244
  empty: w(ShopWord.EmptyBag),
@@ -270,45 +283,49 @@ function button(create: CompositeNodeFactory, key: string, role: ShopRole, style
270
283
  }
271
284
 
272
285
  /** Price: the variant's price and, when it is higher, its earlier price struck through (board 10). */
273
- export function buildPriceRecipe(create: CompositeNodeFactory): CompositeNode {
286
+ export function buildPriceRecipe(create: CompositeNodeFactory, lang: string | null = 'en'): CompositeNode {
287
+ const t = shopRecipeWords(lang);
274
288
  const root = part(create, 'price', Type.Container, ShopRole.Price, null, {}, SHOP_LABELS.price,
275
289
  { ...ROW, alignItems: 'baseline', flexWrap: 'wrap', gap: '8px' });
276
- const amount = text(create, 'price-amount', ShopRole.PriceAmount, Style.Price, SHOP_RECIPE_WORDS.price, 'Price');
290
+ const amount = text(create, 'price-amount', ShopRole.PriceAmount, Style.Price, t.price, 'Price');
277
291
  bindSlot(amount, 'content', '$variant', 'price', true);
278
- const compare = text(create, 'price-compare', ShopRole.PriceCompare, Style.PriceCompare, SHOP_RECIPE_WORDS.compareAt, 'Price before');
292
+ const compare = text(create, 'price-compare', ShopRole.PriceCompare, Style.PriceCompare, t.compareAt, 'Price before');
279
293
  bindSlot(compare, 'content', '$variant', 'compareAt', true);
280
294
  root.children = [amount, compare];
281
295
  return root;
282
296
  }
283
297
 
284
298
  /** Options: one group per option, each a radio group of chips, swatches or a select (T26). */
285
- export function buildVariantPickerRecipe(create: CompositeNodeFactory): CompositeNode {
299
+ export function buildVariantPickerRecipe(create: CompositeNodeFactory, lang: string | null = 'en'): CompositeNode {
300
+ const t = shopRecipeWords(lang);
286
301
  const root = part(create, 'variants', Type.Container, ShopRole.Variants, null, {}, SHOP_LABELS.variants, { ...COLUMN, gap: '16px' });
287
302
  const group = part(create, 'variant-group', Type.Container, ShopRole.VariantGroup, null, {}, 'Option', { ...COLUMN, gap: '6px' });
288
- const label = text(create, 'variant-label', ShopRole.VariantLabel, Style.Small, SHOP_RECIPE_WORDS.option, 'Option name');
303
+ const label = text(create, 'variant-label', ShopRole.VariantLabel, Style.Small, t.option, 'Option name');
289
304
  const values = part(create, 'variant-values', Type.Container, ShopRole.VariantValues, null, {}, 'Values',
290
305
  { ...ROW, flexWrap: 'wrap', gap: '8px' });
291
306
  const chip = button(create, 'variant-value', ShopRole.VariantValue, Style.Chip, 'Value', '', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto' });
292
- chip.children = [text(create, 'variant-value-text', null, Style.Label, SHOP_RECIPE_WORDS.value, 'Text', WORDS, 'span')];
293
- const swatch = button(create, 'variant-swatch', ShopRole.VariantSwatch, Style.Swatch, 'Swatch', 'Sand', {}); // the swatch style owns its size and padding (iox-cms-client#89)
307
+ chip.children = [text(create, 'variant-value-text', null, Style.Label, t.value, 'Text', WORDS, 'span')];
308
+ const swatch = button(create, 'variant-swatch', ShopRole.VariantSwatch, Style.Swatch, 'Swatch', t.swatch, {}); // the swatch style owns its size and padding (iox-cms-client#89)
294
309
  values.children = [chip, swatch];
295
- const note = text(create, 'variant-note', ShopRole.VariantNote, Style.Small, SHOP_RECIPE_WORDS.note, 'Sold-out note');
310
+ const note = text(create, 'variant-note', ShopRole.VariantNote, Style.Small, t.note, 'Sold-out note');
296
311
  group.children = [label, values, note];
297
312
  root.children = [group];
298
313
  return root;
299
314
  }
300
315
 
301
- /** Quantity: − · the count · + (min 1, max from the variant's stock). `compact` = a cart line's. */
302
- export function buildQuantityRecipe(create: CompositeNodeFactory, compact = false, key = 'quantity'): CompositeNode {
316
+ /** Quantity: − · the count · + (min 1, max from the variant's stock). `compact` = a cart line's. The − and + are named in
317
+ * the site's language (the runtime names them again once it fills them; a page's first paint already speaks it). */
318
+ export function buildQuantityRecipe(create: CompositeNodeFactory, compact = false, key = 'quantity', lang: string | null = 'en'): CompositeNode {
319
+ const t = shopRecipeWords(lang);
303
320
  const size = compact ? '30px' : 'var(--iox-stepper-size)';
304
321
  const root = part(create, key, Type.Container, ShopRole.Quantity, Style.Quantity, {}, SHOP_LABELS.quantity,
305
322
  { ...ROW, alignItems: 'stretch', gap: '0px', minHeight: size });
306
- const down = button(create, `${key}-down`, ShopRole.QuantityDown, Style.QuantityButton, 'Decrease', 'Decrease quantity',
323
+ const down = button(create, `${key}-down`, ShopRole.QuantityDown, Style.QuantityButton, 'Decrease', t.decrease,
307
324
  { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
308
325
  down.children = [icon(create, `${key}-down-icon`, 'ph ph-minus', compact ? '14px' : '16px')];
309
- const value = text(create, `${key}-value`, ShopRole.QuantityValue, Style.Body, SHOP_RECIPE_WORDS.quantity, 'Count',
326
+ const value = text(create, `${key}-value`, ShopRole.QuantityValue, Style.Body, t.quantity, 'Count',
310
327
  { ...WORDS, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: compact ? '32px' : '40px', fontVariantNumeric: 'tabular-nums' }, 'span');
311
- const up = button(create, `${key}-up`, ShopRole.QuantityUp, Style.QuantityButton, 'Increase', 'Increase quantity',
328
+ const up = button(create, `${key}-up`, ShopRole.QuantityUp, Style.QuantityButton, 'Increase', t.increase,
312
329
  { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
313
330
  up.children = [icon(create, `${key}-up-icon`, 'ph ph-plus', compact ? '14px' : '16px')];
314
331
  root.children = [down, value, up];
@@ -353,7 +370,7 @@ export function buildCartButtonRecipe(create: CompositeNodeFactory, lang: string
353
370
  }
354
371
 
355
372
  /** One cart line: thumbnail · title, variant, quantity and Remove · line total (board 10). */
356
- function buildCartLine(create: CompositeNodeFactory, t: ShopRecipeWords): CompositeNode {
373
+ function buildCartLine(create: CompositeNodeFactory, t: ShopRecipeWords, lang: string | null): CompositeNode {
357
374
  const line = part(create, 'cart-line', Type.Container, ShopRole.CartLine, Style.CartLine, {}, 'Line',
358
375
  { display: 'grid', gridTemplateColumns: 'var(--iox-cart-thumb-size) minmax(0, 1fr) auto', alignItems: 'start', gap: '12px', width: '100%', height: 'auto', minHeight: 'auto', padding: ZERO });
359
376
  const image = part(create, 'cart-line-image', Type.Image, ShopRole.CartLineImage, Style.Media, { src: '', alt: '' }, 'Image',
@@ -364,7 +381,7 @@ function buildCartLine(create: CompositeNodeFactory, t: ShopRecipeWords): Compos
364
381
  const actions = part(create, 'cart-line-actions', Type.Container, null, null, {}, 'Actions', { ...ROW, gap: '12px' });
365
382
  const remove = button(create, 'cart-line-remove', ShopRole.CartLineRemove, Style.Ghost, 'Remove', '', { padding: '4px 4px 4px 4px', width: 'auto', height: 'auto', minHeight: 'auto' });
366
383
  remove.children = [text(create, 'cart-line-remove-text', null, Style.Small, t.remove, 'Text', WORDS, 'span')];
367
- actions.children = [buildQuantityRecipe(create, true, 'cart-line-quantity'), remove];
384
+ actions.children = [buildQuantityRecipe(create, true, 'cart-line-quantity', lang), remove];
368
385
  info.children = [title, variant, actions];
369
386
  const total = text(create, 'cart-line-total', ShopRole.CartLineTotal, Style.Price, t.lineTotal, 'Line total',
370
387
  { ...WORDS, fontSize: 'var(--iox-size-body)', textAlign: 'end' });
@@ -390,7 +407,7 @@ export function buildCartDrawerRecipe(create: CompositeNodeFactory, lang: string
390
407
  head.children = [title, close];
391
408
 
392
409
  const lines = part(create, 'cart-lines', Type.Container, ShopRole.CartLines, null, {}, 'Lines', { ...COLUMN, gap: '16px' });
393
- lines.children = [buildCartLine(create, t)];
410
+ lines.children = [buildCartLine(create, t, lang)];
394
411
  const issues = text(create, 'cart-issues', ShopRole.CartIssues, Style.Small, '', 'Issues', { ...WORDS, color: 'var(--iox-danger)' });
395
412
  const empty = text(create, 'cart-empty', ShopRole.CartEmpty, Style.Body, t.empty, 'Empty');
396
413
  const note = text(create, 'cart-shipping-note', ShopRole.CartShippingNote, Style.CartNote, t.shippingNote, 'Free delivery note',
@@ -422,9 +439,9 @@ export enum ShopRecipe {
422
439
 
423
440
  /** Each recipe in the site's language (`lang` — vectoriox/iox-ui#100; English when the host has none). */
424
441
  export const SHOP_RECIPES: Readonly<Record<ShopRecipe, (create: CompositeNodeFactory, lang?: string | null) => CompositeNode>> = Object.freeze({
425
- [ShopRecipe.Price]: buildPriceRecipe,
426
- [ShopRecipe.Variants]: buildVariantPickerRecipe,
427
- [ShopRecipe.Quantity]: (create: CompositeNodeFactory) => buildQuantityRecipe(create),
442
+ [ShopRecipe.Price]: (create: CompositeNodeFactory, lang?: string | null) => buildPriceRecipe(create, lang ?? 'en'),
443
+ [ShopRecipe.Variants]: (create: CompositeNodeFactory, lang?: string | null) => buildVariantPickerRecipe(create, lang ?? 'en'),
444
+ [ShopRecipe.Quantity]: (create: CompositeNodeFactory, lang?: string | null) => buildQuantityRecipe(create, false, 'quantity', lang ?? 'en'),
428
445
  [ShopRecipe.Add]: (create: CompositeNodeFactory, lang?: string | null) => buildAddToCartRecipe(create, lang ?? 'en'),
429
446
  [ShopRecipe.BuyNow]: (create: CompositeNodeFactory, lang?: string | null) => buildBuyNowRecipe(create, lang ?? 'en'),
430
447
  [ShopRecipe.CartButton]: (create: CompositeNodeFactory, lang?: string | null) => buildCartButtonRecipe(create, lang ?? 'en'),
@@ -0,0 +1,18 @@
1
+ import { languageOf } from './locale-direction';
2
+
3
+ /**
4
+ * "Close" in the page's language — the accessible name of every × the platform names: the Dialog's close button (the
5
+ * iox-ui component path AND the engine's string path, vectoriox/iox-ui#167), the toast's close control (premium M5) and
6
+ * the Lightbox recipe's stamped Close part (composite-core, vectoriox/iox-ui#170). ONE table, so no overlay on a Hebrew
7
+ * site is ever named "Close". It lives in design-core — the entry every other one may import (composite-core cannot
8
+ * import actions-core, which imports it); actions-core re-exports it. Framework-free (the engine's string renderer and
9
+ * iox-cms read it); a locale is read by its language subtag (`he-IL` → `he`).
10
+ */
11
+
12
+ /** The close word by language subtag. English is the fallback for every language the table lacks. */
13
+ export const CLOSE_WORDS: Readonly<Record<string, string>> = Object.freeze({ en: 'Close', he: 'סגירה' });
14
+
15
+ /** "Close" in `lang` (its base language), else English. */
16
+ export function closeWord(lang: string | null | undefined): string {
17
+ return CLOSE_WORDS[languageOf(lang)] ?? CLOSE_WORDS['en'];
18
+ }
@@ -4,7 +4,7 @@ import { compositeOver, paintColours, parseCssColour, quantizeRgb, Rgba, ringCol
4
4
  import { ElementStyle, ELEMENT_STYLES } from './element-styles';
5
5
  import { SPEC_CONTRAST_AUDIT, SPEC_INK_SCOPES, SPEC_SCHEMES } from './flavor-spec.generated';
6
6
  import { SCHEME_INK } from './node-classes';
7
- import { DesignTokenLike, ResolvedMode, resolveSchemeTokenValues } from './token-css';
7
+ import { DesignTokenLike, ResolvedMode, schemeTokenResolver } from './token-css';
8
8
 
9
9
  /**
10
10
  * The contrast AUDIT (design-system DS9). The contract's token pairs were all AA and Doron still found a
@@ -12,7 +12,7 @@ import { DesignTokenLike, ResolvedMode, resolveSchemeTokenValues } from './token
12
12
  * Icon dropped into a Primary button painted `icon-color` (accent-text) on the accent fill, 1:1 in a Brand
13
13
  * section. So this resolves what each element style actually paints, the way CSS resolves it:
14
14
  *
15
- * - in every section scheme (`resolveSchemeTokenValues`), directly on the section and inside every
15
+ * - in every section scheme (`resolveSchemeTokenValues`, one `schemeTokenResolver` per look), directly on the section and inside every
16
16
  * container style (Card, Panel, Navigation bar, Dialog);
17
17
  * - `inherit` → the container's ink, a transparent fill → what is under it, translucent fills composited,
18
18
  * a gradient ground (Glass's mesh, Midnight's glow) checked at its worst stop;
@@ -90,6 +90,8 @@ const TOKEN_REF = /var\(\s*--iox-([\w-]+)\s*(?:,([^()]*))?\)/g;
90
90
 
91
91
  type Values = Readonly<Record<string, string>>;
92
92
  type StyleMap = Readonly<Record<string, string>>;
93
+ /** One look's token values in a scheme (or a chain), in the audited mode. */
94
+ type SchemeValues = ReturnType<typeof schemeTokenResolver>;
93
95
 
94
96
  /** A style value with its var() references resolved against `values` (already-resolved tokens). */
95
97
  function resolveIn(values: Values, v: string | undefined): string {
@@ -163,9 +165,10 @@ function sweepDesignContrast(rows: ReadonlyArray<DesignTokenLike>, mode: Resolve
163
165
  const section = ownStyle(byId.get(SECTION_STYLE) as ElementStyle);
164
166
  const iconColour = ownStyle(byId.get(ICON_STYLE) as ElementStyle)['color'];
165
167
  const bodyWeight = ownStyle(byId.get(BODY_STYLE) as ElementStyle)['fontWeight'];
168
+ const valuesIn = schemeTokenResolver(rows, mode);
166
169
 
167
170
  for (const schemeId of SCHEME_IDS) {
168
- const values = resolveSchemeTokenValues(rows, mode, schemeId);
171
+ const values = valuesIn(schemeId);
169
172
  const pageInk = parseCssColour(values['text']);
170
173
  const page = paintColours(values['page-bg'], pageInk);
171
174
  const sectionPaint = paintColours(values['section-bg'], pageInk);
@@ -173,15 +176,23 @@ function sweepDesignContrast(rows: ReadonlyArray<DesignTokenLike>, mode: Resolve
173
176
  ? sectionPaint.map(c => (c.a < 1 ? compositeOver(c, page[0] ?? WHITE) : c))
174
177
  : page;
175
178
  const sectionInk = parseCssColour(resolveIn(values, section['color']), pageInk);
179
+ // What an ink-scoped element's Icon paints depends on the scheme alone, never the box: resolved once per scheme.
180
+ const scopedIcon = new Map<string, string>();
181
+ const iconIn = (styleId: string) => {
182
+ let v = scopedIcon.get(styleId);
183
+ if (v === undefined) scopedIcon.set(styleId, v = resolveIn(inkScoped(values, styleId), iconColour));
184
+ return v;
185
+ };
176
186
 
177
187
  for (const box of containers) {
178
188
  const boxStyle = box ? ownStyle(box) : null;
179
189
  const bgs = boxStyle ? overAll(paintColours(resolveIn(values, boxStyle['backgroundColor']), sectionInk), ground) : ground;
180
190
  const boxInk = boxStyle?.['color'] && boxStyle['color'] !== 'inherit'
181
191
  ? parseCssColour(resolveIn(values, boxStyle['color']), sectionInk) : sectionInk;
182
- const where = { scheme: schemeId, container: box?.id ?? SECTION };
192
+ const container = box?.id ?? SECTION;
193
+ // A plain literal, one shape for every finding (a `{ ...where }` spread here was a fifth of the sweep's time).
183
194
  const record = (element: string, part: string, fg: string, bg: string, ratio: number, min: number) =>
184
- findings.push({ ...where, element, part, fg, bg, ratio: Math.round(ratio * 100) / 100, min, pass: ratio >= min - 1e-9 });
195
+ findings.push({ scheme: schemeId, container, element, part, fg, bg, ratio: Math.round(ratio * 100) / 100, min, pass: ratio >= min - 1e-9 });
185
196
  const check = (element: string, part: string, fg: Rgba | null, under: Rgba[], min: number) => {
186
197
  if (!fg) return;
187
198
  for (const g of under) {
@@ -223,7 +234,7 @@ function sweepDesignContrast(rows: ReadonlyArray<DesignTokenLike>, mode: Resolve
223
234
  if (state === 'selected' && (e.selected as StyleMap | undefined)?.['backgroundColor']) for (const f of fill) check(e.id, 'selected mark', f, bgs, WCAG_AA_UI);
224
235
  // What a filled element HOLDS (inkScopes): a button's or a badge's icon reads its ink.
225
236
  if (state === 'base' && INK_SCOPES.some(sc => sc.styles.includes(e.id))) {
226
- check(e.id, 'icon', parseCssColour(resolveIn(inkScoped(values, e.id), iconColour), ink), under, WCAG_AA_UI);
237
+ check(e.id, 'icon', parseCssColour(iconIn(e.id), ink), under, WCAG_AA_UI);
227
238
  }
228
239
  // Every focus ring an element style draws, on every ground the element sits on (CC4b: a Segmented
229
240
  // option on its track — not only the buttons).
@@ -260,8 +271,8 @@ function sweepDesignContrast(rows: ReadonlyArray<DesignTokenLike>, mode: Resolve
260
271
  }
261
272
  }
262
273
  }
263
- findings.push(...schemedContainerFindings(rows, mode, section, containers.filter((c): c is ElementStyle => !!c)));
264
- for (const scrim of SCRIMS) findings.push(...scrimFindings(rows, mode, scrim, byId.get(scrim.style)));
274
+ findings.push(...schemedContainerFindings(valuesIn, section, containers.filter((c): c is ElementStyle => !!c)));
275
+ for (const scrim of SCRIMS) findings.push(...scrimFindings(valuesIn, scrim, byId.get(scrim.style)));
265
276
  return findings;
266
277
  }
267
278
 
@@ -279,13 +290,12 @@ function sectionGround(values: Values): Rgba[] {
279
290
  * section's (what it does not set, it inherits); a translucent fill composites over the OUTER section; the running text it holds (`body`, `lead`, a label: `color: inherit`)
280
291
  * reads the scheme's ink, which is what the scheme-ink rule and `withSchemeInk` make CSS compute.
281
292
  */
282
- function schemedContainerFindings(rows: ReadonlyArray<DesignTokenLike>, mode: ResolvedMode, section: StyleMap,
283
- containers: ReadonlyArray<ElementStyle>): ContrastFinding[] {
293
+ function schemedContainerFindings(valuesIn: SchemeValues, section: StyleMap, containers: ReadonlyArray<ElementStyle>): ContrastFinding[] {
284
294
  const out: ContrastFinding[] = [];
285
295
  for (const outer of SCHEME_IDS) {
286
- const ground = sectionGround(resolveSchemeTokenValues(rows, mode, outer));
296
+ const ground = sectionGround(valuesIn(outer));
287
297
  for (const inner of SCHEME_IDS.filter(id => id !== DEFAULT_SCHEME)) {
288
- const values = resolveSchemeTokenValues(rows, mode, [outer, inner]);
298
+ const values = valuesIn([outer, inner]);
289
299
  const schemeInk = parseCssColour(resolveIn(values, SCHEME_INK), parseCssColour(resolveIn(values, section['color'])));
290
300
  for (const box of containers) {
291
301
  const style = ownStyle(box);
@@ -310,8 +320,8 @@ function schemedContainerFindings(rows: ReadonlyArray<DesignTokenLike>, mode: Re
310
320
  /** Text over an image: the block's ink — and every token its ink scope pins to it — over the scrim
311
321
  * composited on the WORST-CASE image, in the scheme the block wears. Never over the section: the image
312
322
  * covers it. */
313
- function scrimFindings(rows: ReadonlyArray<DesignTokenLike>, mode: ResolvedMode, scrim: Scrim, style: ElementStyle | undefined): ContrastFinding[] {
314
- const values = resolveSchemeTokenValues(rows, mode, scrim.scheme);
323
+ function scrimFindings(valuesIn: SchemeValues, scrim: Scrim, style: ElementStyle | undefined): ContrastFinding[] {
324
+ const values = valuesIn(scrim.scheme);
315
325
  const layer = parseCssColour(values[scrim.token]);
316
326
  const image = parseCssColour(scrim.image);
317
327
  if (!style || !layer || !image) return [];
@@ -371,3 +381,41 @@ export function colourTabChecks(rows: ReadonlyArray<DesignTokenLike>, mode: Reso
371
381
  }
372
382
  return out;
373
383
  }
384
+
385
+ // ── Floating grounds (HI3 slice 1, R-H16, vectoriox/iox-ui#173) ──────────────────────────────────────────────────────
386
+
387
+ interface FloatingGround { readonly ground: string; readonly ink: string; }
388
+ /** The translucent grounds that carry words over ANYTHING (the header's bar and glass while the page moves under them, the
389
+ * 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 ?? [];
392
+ const BLACK: Rgba = { r: 0, g: 0, b: 0, a: 1 };
393
+ /** The two backdrops that bound every picture: each channel of a blend is monotone in its backdrop's. */
394
+ export const FLOATING_BACKDROPS: Readonly<Record<string, Rgba>> = Object.freeze({ black: BLACK, white: WHITE });
395
+
396
+ /**
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`).
402
+ */
403
+ export function floatingGroundFindings(rows: ReadonlyArray<DesignTokenLike>, mode: ResolvedMode): ContrastFinding[] {
404
+ const values = schemeTokenResolver(rows, mode)(DEFAULT_SCHEME);
405
+ 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
+ });
418
+ }
419
+ }
420
+ return out;
421
+ }