origam 2.18.17 → 2.18.19

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 (44) hide show
  1. package/CHANGELOG.md +981 -0
  2. package/dist/src/assets/css/main.css +1 -1
  3. package/dist/src/assets/css/tokens/dark.css +212 -6
  4. package/dist/src/assets/css/tokens/light.css +106 -3
  5. package/dist/src/assets/scss/tokens/_dark.scss +212 -6
  6. package/dist/src/assets/scss/tokens/_light.scss +106 -3
  7. package/dist/src/components/Audio/OrigamAudio.vue +66 -2
  8. package/dist/src/components/Chip/OrigamChip.vue +34 -0
  9. package/dist/src/components/Field/OrigamField.vue +76 -3
  10. package/dist/src/components/List/OrigamList.vue +90 -3
  11. package/dist/src/components/Main/OrigamMain.vue +2 -2
  12. package/dist/src/components/Media/OrigamMediaScrubber.vue +11 -1
  13. package/dist/src/components/Pagination/OrigamPagination.vue +64 -2
  14. package/dist/src/components/SliderField/OrigamSliderField.vue +138 -3
  15. package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +12 -1
  16. package/dist/src/components/Snackbar/OrigamSnackbar.vue +2 -2
  17. package/dist/src/components/Switch/OrigamSwitch.vue +32 -0
  18. package/dist/src/components/TextField/OrigamTextField.vue +3 -1
  19. package/dist/src/components/Toolbar/OrigamToolbar.vue +58 -0
  20. package/dist/src/components/Video/OrigamVideo.vue +11 -1
  21. package/dist/src/composables/Commons/layout.composable.cjs +2 -2
  22. package/dist/src/composables/Commons/layout.composable.d.ts +16 -2
  23. package/dist/src/composables/Commons/layout.composable.js +1 -1
  24. package/dist/src/composables/Commons/theme-props-resolver.composable.cjs +44 -9
  25. package/dist/src/composables/Commons/theme-props-resolver.composable.d.ts +33 -1
  26. package/dist/src/composables/Commons/theme-props-resolver.composable.js +42 -10
  27. package/dist/src/consts/Commons/variant-preset.const.cjs +8 -0
  28. package/dist/src/consts/Commons/variant-preset.const.d.ts +60 -0
  29. package/dist/src/consts/Commons/variant-preset.const.js +2 -0
  30. package/dist/src/consts/index.cjs +11 -0
  31. package/dist/src/consts/index.d.ts +1 -0
  32. package/dist/src/consts/index.js +1 -0
  33. package/dist/src/interfaces/Commons/theme.interface.d.ts +33 -0
  34. package/dist/src/interfaces/Masonry/masonry.interface.d.ts +2 -2
  35. package/dist/src/origam.cjs +2 -1
  36. package/dist/src/origam.js +8 -2
  37. package/dist/src/types/Commons/variant-preset.type.cjs +1 -0
  38. package/dist/src/types/Commons/variant-preset.type.d.ts +73 -0
  39. package/dist/src/types/Commons/variant-preset.type.js +0 -0
  40. package/dist/src/types/index.cjs +11 -0
  41. package/dist/src/types/index.d.ts +1 -0
  42. package/dist/src/types/index.js +1 -0
  43. package/dist/src/types/tokens.type.d.ts +1 -1
  44. package/package.json +1 -1
@@ -229,6 +229,22 @@ defineExpose({
229
229
  // the toolbar's own gutter (16 px) with whatever the layout
230
230
  // reserved on each side (defaults to 0 when no layout item is
231
231
  // present, so the standalone case still gets the 16 px gutter).
232
+ //
233
+ // ⛔ #596 — `--origam-layout---position-{left,right}` STAY UNDECLARED
234
+ // in the token sheets, deliberately. They are not theme tokens: they
235
+ // are runtime MEASUREMENTS, written as INLINE STYLES on the layout
236
+ // root by `useCreateLayout`'s `layoutStyles` (and on main by
237
+ // `mainStyles`) from `mainRect`, via `LAYOUT_POSITION_VARS` — see
238
+ // `composables/Commons/createLayout.composable.ts`. Descendants
239
+ // inherit them from that element, which is how this toolbar receives
240
+ // them. Declaring them at `:root` would publish a themeable channel
241
+ // that the layout's inline style overrides on every real instance —
242
+ // dead by construction — and `LAYOUT_DEFAULT_OFFSET` already is the
243
+ // `0px` written below. The guard flags them only because it compares
244
+ // names against the SHEETS; `OrigamMain` reads the same four vars and
245
+ // is absent from the baseline solely because it declares its own
246
+ // `0px` block locally. They stay in
247
+ // `baseline/token-var-channels.json` as known false positives.
232
248
  padding-inline-start: calc(
233
249
  var(--origam-toolbar---padding-inline, 16px) +
234
250
  var(--origam-layout---position-left, 0px)
@@ -267,6 +283,28 @@ defineExpose({
267
283
  border-end-start-radius: var(--origam-toolbar---border-end-start-radius, 0);
268
284
 
269
285
  background: var(--origam-toolbar---background);
286
+ // ⛔ #596 — `--origam-appbar---backdrop-filter` STAYS UNDECLARED in the
287
+ // token sheets, and that is a NAMING decision left open on purpose,
288
+ // not an oversight. Measured: the DS's canonical AppBar family is
289
+ // spelt with a hyphen — `--origam-app-bar---*`, 11 tokens declared in
290
+ // all four sheets and listed in `TTokenName`, every one of them
291
+ // DORMANT because `OrigamAppBar.vue` contains no `var(--origam-…)` at
292
+ // all and delegates its whole surface to this component. This read
293
+ // uses a THIRD spelling, `--origam-appbar---`, which is also the
294
+ // namespace `packages/marketing` adopted locally (7 themes set
295
+ // `--origam-appbar---bg`, read by `marketing/src/layouts/default.vue`;
296
+ // 5 of them additionally set `--origam-appbar---backdrop-filter`, and
297
+ // it does reach this line today).
298
+ // Declaring `none` here would engrave a SECOND grammar for one
299
+ // component into the public token surface, three lines from the
300
+ // `--origam-app-bar---*` block. The two defensible renames —
301
+ // `--origam-app-bar---backdrop-filter` (matches the authoring intent
302
+ // and marketing's naming) or `--origam-toolbar---backdrop-filter`
303
+ // (matches the component that actually reads it, per the
304
+ // `--origam-{component}---{property}` rule) — both break the 5
305
+ // marketing themes unless they move in the same commit, i.e. a
306
+ // cross-package decision. Left in `baseline/token-var-channels.json`
307
+ // until that call is made.
270
308
  backdrop-filter: var(--origam-appbar---backdrop-filter, none);
271
309
  -webkit-backdrop-filter: var(--origam-appbar---backdrop-filter, none);
272
310
  box-shadow: var(--origam-toolbar---box-shadow);
@@ -471,6 +509,26 @@ defineExpose({
471
509
  //
472
510
  // Shape: rounded SQUARE (8 px), overrides Btn's default
473
511
  // `&--icon { border-radius: 50% }`.
512
+ //
513
+ // ⛔ #596 — the two DERIVED channels,
514
+ // `--origam-toolbar---btn-background-color-{hover,active}`, STAY
515
+ // UNDECLARED in the token sheets. Their fallbacks are
516
+ // `color-mix(in srgb, var(--btn-bg-base), black {20,30}%)`, and
517
+ // `--btn-bg-base` is synthesised PER INSTANCE at the top of this block
518
+ // from `--origam-toolbar---btn-background-color` (which #596 DID
519
+ // declare, its fallback being the plain literal `transparent`). A
520
+ // custom property's computed value is its specified value with `var()`
521
+ // already substituted ON THE DECLARING ELEMENT, so a `:root`
522
+ // declaration of that `color-mix()` would be substituted where
523
+ // `--btn-bg-base` does not exist → guaranteed-invalid → every read
524
+ // falls back to the inline fallback anyway. Identical rendering, green
525
+ // guard, dead channel: a lie, not a fix. Freezing them to a static
526
+ // colour instead would be worse — it would sever the derivation from
527
+ // whatever base colour the consumer sets, which is the whole point of
528
+ // the block above. They stay in `baseline/token-var-channels.json` as
529
+ // known false positives; the guard compares NAMES, not fallback
530
+ // chains. A theme overriding them on the toolbar element itself (or
531
+ // deeper) still works, because `--btn-bg-base` resolves there.
474
532
  :deep(.origam-btn:not(:hover):not(.origam-btn--active)) {
475
533
  --origam-btn---background-color: var(--btn-bg-base);
476
534
  --origam-btn---color: var(--btn-fg-base);
@@ -956,7 +956,17 @@ defineExpose({
956
956
  .origam-video__skip-ripple-label {
957
957
  font-size: 13px;
958
958
  font-weight: 600;
959
- font-family: var(--origam-font---family, system-ui, sans-serif);
959
+ /*
960
+ * #595 — REFERENCE CORRIGEE : lisait `var(--origam-font---family, …)`,
961
+ * un nom que AUCUNE feuille ne declare (zero occurrence en partie
962
+ * gauche dans `assets/`). Ce composant retombait donc toujours sur
963
+ * `system-ui` et ignorait la police du DS. Le barreau reel est
964
+ * `--origam-font__family---sans` (primitive.css) = `Inter, 'Helvetica
965
+ * Neue', Arial, sans-serif`. ⚠️ Change le rendu, volontairement. Le
966
+ * repli `system-ui, sans-serif` reste en ceinture de securite si la
967
+ * feuille de primitives n est pas chargee.
968
+ */
969
+ font-family: var(--origam-font__family---sans, system-ui, sans-serif);
960
970
  letter-spacing: 0.02em;
961
971
  white-space: nowrap;
962
972
  user-select: none;
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useLayout = useLayout;
6
+ exports.useLayoutMain = useLayoutMain;
7
7
  var _vue = require("vue");
8
8
  var _layout = require("../../consts/Commons/layout.const.cjs");
9
- function useLayout() {
9
+ function useLayoutMain() {
10
10
  const layout = (0, _vue.inject)(_layout.ORIGAM_LAYOUT_KEY);
11
11
  if (!layout) {
12
12
  throw new Error("[Origam] Could not find injected layout");
@@ -1,5 +1,19 @@
1
1
  /*********************************************************
2
- * useLayout
2
+ * useLayoutMain
3
+ *
4
+ * @description
5
+ * ⛔ RENOMME depuis `useLayout`, qui ECRASAIT le composable natif de Nuxt.
6
+ * Nuxt expose `useLayout` en auto-import (`#app/composables/layout`) ; le nôtre
7
+ * portant le même nom, c'est LE NOTRE QUI GAGNAIT et celui du framework qui
8
+ * était ignoré. Relevé sur le serveur de dev de l'utilisateur :
9
+ * WARN [NUXT_B6002] useLayout is already auto-imported by Nuxt as a built-in,
10
+ * and overriding it will likely cause issues.
11
+ * WARN Duplicated imports "useLayout", the one from "#app/composables/layout"
12
+ * has been ignored
13
+ * Ce n'était pas cosmétique : notre version LEVE une exception sans provider
14
+ * Origam, donc tout code Nuxt attendant `useLayout` plantait au lieu de recevoir
15
+ * le composable du framework. Le nom `useLayoutMain` dit ce qu'il fait — il
16
+ * expose la zone MAIN — et s'aligne sur `useLayoutItem`.
3
17
  *
4
18
  * @description
5
19
  * Reads the nearest `ORIGAM_LAYOUT_KEY` injection provided by
@@ -11,7 +25,7 @@
11
25
  * level (no direct function dependency) — the three only share the
12
26
  * `ORIGAM_LAYOUT_KEY` provide/inject contract.
13
27
  ********************************************************/
14
- export declare function useLayout(): {
28
+ export declare function useLayoutMain(): {
15
29
  getLayoutItem: (id: string) => import("../../interfaces").ILayerItem | undefined;
16
30
  mainRect: import("vue").Ref<import("../../interfaces").ILayer, import("../../interfaces").ILayer>;
17
31
  mainStyles: import("vue").Ref<import("vue").CSSProperties, import("vue").CSSProperties>;
@@ -1,6 +1,6 @@
1
1
  import { inject } from "vue";
2
2
  import { ORIGAM_LAYOUT_KEY } from "../../consts/Commons/layout.const.js";
3
- export function useLayout() {
3
+ export function useLayoutMain() {
4
4
  const layout = inject(ORIGAM_LAYOUT_KEY);
5
5
  if (!layout) {
6
6
  throw new Error("[Origam] Could not find injected layout");
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.installThemePropsResolver = installThemePropsResolver;
7
+ exports.resolveVariantPresetRegistry = resolveVariantPresetRegistry;
7
8
  exports.themedPropKeysUnion = themedPropKeysUnion;
8
9
  var _vue = require("vue");
9
10
  var _defaults = require("../../consts/Commons/defaults.const.cjs");
11
+ var _variantPreset = require("../../consts/Commons/variant-preset.const.cjs");
10
12
  var _commons = require("../../utils/Commons/commons.util.cjs");
11
13
  var _color = require("../../utils/Commons/color.util.cjs");
12
14
  var _getCurrentInstance = require("../../utils/Commons/getCurrentInstance.util.cjs");
@@ -28,6 +30,15 @@ function themedPropKeysUnion(themes) {
28
30
  }
29
31
  return union;
30
32
  }
33
+ function resolveVariantPresetRegistry(shipped, themeVariants) {
34
+ let out = {
35
+ ...shipped
36
+ };
37
+ for (const variants of themeVariants) {
38
+ out = (0, _commons.mergeDeep)(out, variants);
39
+ }
40
+ return out;
41
+ }
31
42
  function passedPropValue(vnodeProps, key) {
32
43
  if (!vnodeProps) return void 0;
33
44
  for (const rawKey in vnodeProps) {
@@ -35,19 +46,40 @@ function passedPropValue(vnodeProps, key) {
35
46
  }
36
47
  return void 0;
37
48
  }
38
- function collectTargetKeys(themedKeysUnion, defaults, name) {
49
+ function addSetKeys(source, target) {
50
+ if (!source) return;
51
+ for (const key of source) target.add(key);
52
+ }
53
+ function addObjectKeys(source, target) {
54
+ if (!source) return;
55
+ for (const key in source) target.add(key);
56
+ }
57
+ function addPresetKeys(presetTable, target) {
58
+ if (!presetTable) return;
59
+ for (const variantValue in presetTable) {
60
+ for (const key in presetTable[variantValue]) target.add(key);
61
+ }
62
+ }
63
+ function collectTargetKeys(themedKeysUnion, defaults, name, presetTable) {
39
64
  const ownKeys = themedKeysUnion.get(name);
40
65
  const globalKeys = themedKeysUnion.get("global");
41
66
  const providerOwnKeys = defaults.value?.[name];
42
67
  const providerGlobalKeys = defaults.value?.global;
43
- if (!ownKeys?.size && !globalKeys?.size && !providerOwnKeys && !providerGlobalKeys) return null;
68
+ if (!ownKeys?.size && !globalKeys?.size && !providerOwnKeys && !providerGlobalKeys && !presetTable) return null;
44
69
  const targetKeys = ownKeys ? new Set(ownKeys) : /* @__PURE__ */new Set();
45
- if (globalKeys) for (const key of globalKeys) targetKeys.add(key);
46
- if (providerOwnKeys) for (const key in providerOwnKeys) targetKeys.add(key);
47
- if (providerGlobalKeys) for (const key in providerGlobalKeys) targetKeys.add(key);
70
+ addSetKeys(globalKeys, targetKeys);
71
+ addObjectKeys(providerOwnKeys, targetKeys);
72
+ addObjectKeys(providerGlobalKeys, targetKeys);
73
+ addPresetKeys(presetTable, targetKeys);
48
74
  return targetKeys;
49
75
  }
50
- function patchThemedPropSlot(instance, defaults, name, key) {
76
+ function readVariantPreset(presetTable, rawProps, key) {
77
+ if (!presetTable || key === _variantPreset.VARIANT_PROP_KEY) return void 0;
78
+ const activeVariant = rawProps[_variantPreset.VARIANT_PROP_KEY];
79
+ if (typeof activeVariant !== "string") return void 0;
80
+ return presetTable[activeVariant]?.[key];
81
+ }
82
+ function patchThemedPropSlot(instance, defaults, name, key, presetTable) {
51
83
  const rawProps = instance.props;
52
84
  const fallbackValue = (0, _vue.shallowRef)(rawProps[key]);
53
85
  let wasPassed = passedPropValue(instance.vnode.props, key) !== void 0;
@@ -65,6 +97,8 @@ function patchThemedPropSlot(instance, defaults, name, key) {
65
97
  if (globalDefaults && globalDefaults[key] !== void 0) {
66
98
  return globalDefaults[key];
67
99
  }
100
+ const fromPreset = readVariantPreset(presetTable, rawProps, key);
101
+ if (fromPreset !== void 0) return fromPreset;
68
102
  return fallback;
69
103
  },
70
104
  set(value) {
@@ -73,14 +107,15 @@ function patchThemedPropSlot(instance, defaults, name, key) {
73
107
  }
74
108
  });
75
109
  }
76
- function installThemePropsResolver(app, themedKeysUnion) {
110
+ function installThemePropsResolver(app, themedKeysUnion, variantPresets = {}) {
77
111
  app.mixin({
78
112
  beforeCreate() {
79
113
  const instance = (0, _vue.getCurrentInstance)();
80
114
  if (!instance) return;
81
115
  const name = (0, _getCurrentInstance.getCurrentInstanceName)("theme-props-resolver");
82
116
  const defaults = (0, _vue.inject)(_defaults.ORIGAM_DEFAULTS_KEY, (0, _vue.ref)({}));
83
- const targetKeys = collectTargetKeys(themedKeysUnion, defaults, name);
117
+ const presetTable = variantPresets[name];
118
+ const targetKeys = collectTargetKeys(themedKeysUnion, defaults, name, presetTable);
84
119
  if (!targetKeys) return;
85
120
  const rawProps = instance.props;
86
121
  for (const key of targetKeys) {
@@ -88,7 +123,7 @@ function installThemePropsResolver(app, themedKeysUnion) {
88
123
  (0, _color.warnUnsupportedProp)(name, key, `theme names this prop but <${name}> does not declare it`);
89
124
  continue;
90
125
  }
91
- patchThemedPropSlot(instance, defaults, name, key);
126
+ patchThemedPropSlot(instance, defaults, name, key, presetTable);
92
127
  }
93
128
  }
94
129
  });
@@ -1,5 +1,6 @@
1
1
  import { type App } from 'vue';
2
2
  import type { IDefault } from '../../interfaces/DefaultsProvider/defaults-provider.interface';
3
+ import type { TVariantPresetRegistry } from '../../types/Commons/variant-preset.type';
3
4
  /*********************************************************
4
5
  * themedPropKeysUnion
5
6
  *
@@ -21,6 +22,37 @@ import type { IDefault } from '../../interfaces/DefaultsProvider/defaults-provid
21
22
  * `createOrigam()` install time.
22
23
  ********************************************************/
23
24
  export declare function themedPropKeysUnion(themes: IDefault[]): Map<string, Set<string>>;
25
+ /*********************************************************
26
+ * resolveVariantPresetRegistry
27
+ *
28
+ * @description
29
+ * ADR-005 D4 — collapse les tables de presets que le DS livre avec celles
30
+ * que les themes enregistres redefinissent, en un seul registre.
31
+ *
32
+ * @description
33
+ * Un theme retune ce que `outlined` VEUT DIRE en changeant des valeurs de
34
+ * PROPS, et ne descend aux `vars` / `cssVars` que pour ce que les props
35
+ * n'expriment pas. C'est ce qui reconcilie les variants avec la regle
36
+ * PROPS-D'ABORD : le seul API du DS qui la violait structurellement.
37
+ *
38
+ * @description
39
+ * `variants` est un FRERE de `components`, pas une cle imbriquee dedans.
40
+ * `components` est type `IDefault` (composant -> map de props) ; y nicher
41
+ * un niveau de variant rendrait `{ 'origam-btn': { outlined: … } }`
42
+ * ambigu avec un prop qui s'appellerait litteralement `outlined`.
43
+ *
44
+ * @description
45
+ * Fusion par `mergeDeep`, celui-la meme que `provideDefaults` utilise —
46
+ * le theme gagne, prop par prop. Consequence a connaitre : un preset
47
+ * d'ETAT (`active: { … }`, autorise par Q3) est donc FUSIONNE et non
48
+ * remplace, comme l'est deja un bloc `components` de theme. Une marque qui
49
+ * veut effacer une cle d'etat la repose explicitement.
50
+ *
51
+ * @description
52
+ * Pure — aucun acces Vue/DOM — donc appelee une fois, synchronement, a
53
+ * l'installation par `createOrigam()`, comme `themedPropKeysUnion`.
54
+ ********************************************************/
55
+ export declare function resolveVariantPresetRegistry(shipped: TVariantPresetRegistry, themeVariants: Array<TVariantPresetRegistry>): TVariantPresetRegistry;
24
56
  /*********************************************************
25
57
  * installThemePropsResolver
26
58
  *
@@ -46,4 +78,4 @@ export declare function themedPropKeysUnion(themes: IDefault[]): Map<string, Set
46
78
  * carries the cost argument: an instance that neither a theme nor an ancestor
47
79
  * provider names returns after a Map lookup and one property lookup.
48
80
  ********************************************************/
49
- export declare function installThemePropsResolver(app: App, themedKeysUnion: Map<string, Set<string>>): void;
81
+ export declare function installThemePropsResolver(app: App, themedKeysUnion: Map<string, Set<string>>, variantPresets?: TVariantPresetRegistry): void;
@@ -1,6 +1,7 @@
1
1
  import { getCurrentInstance, inject, ref, shallowRef } from "vue";
2
2
  import { ORIGAM_DEFAULTS_KEY } from "../../consts/Commons/defaults.const.js";
3
- import { camelize } from "../../utils/Commons/commons.util.js";
3
+ import { VARIANT_PROP_KEY } from "../../consts/Commons/variant-preset.const.js";
4
+ import { camelize, mergeDeep } from "../../utils/Commons/commons.util.js";
4
5
  import { warnUnsupportedProp } from "../../utils/Commons/color.util.js";
5
6
  import { getCurrentInstanceName } from "../../utils/Commons/getCurrentInstance.util.js";
6
7
  export function themedPropKeysUnion(themes) {
@@ -21,6 +22,13 @@ export function themedPropKeysUnion(themes) {
21
22
  }
22
23
  return union;
23
24
  }
25
+ export function resolveVariantPresetRegistry(shipped, themeVariants) {
26
+ let out = { ...shipped };
27
+ for (const variants of themeVariants) {
28
+ out = mergeDeep(out, variants);
29
+ }
30
+ return out;
31
+ }
24
32
  function passedPropValue(vnodeProps, key) {
25
33
  if (!vnodeProps) return void 0;
26
34
  for (const rawKey in vnodeProps) {
@@ -28,19 +36,40 @@ function passedPropValue(vnodeProps, key) {
28
36
  }
29
37
  return void 0;
30
38
  }
31
- function collectTargetKeys(themedKeysUnion, defaults, name) {
39
+ function addSetKeys(source, target) {
40
+ if (!source) return;
41
+ for (const key of source) target.add(key);
42
+ }
43
+ function addObjectKeys(source, target) {
44
+ if (!source) return;
45
+ for (const key in source) target.add(key);
46
+ }
47
+ function addPresetKeys(presetTable, target) {
48
+ if (!presetTable) return;
49
+ for (const variantValue in presetTable) {
50
+ for (const key in presetTable[variantValue]) target.add(key);
51
+ }
52
+ }
53
+ function collectTargetKeys(themedKeysUnion, defaults, name, presetTable) {
32
54
  const ownKeys = themedKeysUnion.get(name);
33
55
  const globalKeys = themedKeysUnion.get("global");
34
56
  const providerOwnKeys = defaults.value?.[name];
35
57
  const providerGlobalKeys = defaults.value?.global;
36
- if (!ownKeys?.size && !globalKeys?.size && !providerOwnKeys && !providerGlobalKeys) return null;
58
+ if (!ownKeys?.size && !globalKeys?.size && !providerOwnKeys && !providerGlobalKeys && !presetTable) return null;
37
59
  const targetKeys = ownKeys ? new Set(ownKeys) : /* @__PURE__ */ new Set();
38
- if (globalKeys) for (const key of globalKeys) targetKeys.add(key);
39
- if (providerOwnKeys) for (const key in providerOwnKeys) targetKeys.add(key);
40
- if (providerGlobalKeys) for (const key in providerGlobalKeys) targetKeys.add(key);
60
+ addSetKeys(globalKeys, targetKeys);
61
+ addObjectKeys(providerOwnKeys, targetKeys);
62
+ addObjectKeys(providerGlobalKeys, targetKeys);
63
+ addPresetKeys(presetTable, targetKeys);
41
64
  return targetKeys;
42
65
  }
43
- function patchThemedPropSlot(instance, defaults, name, key) {
66
+ function readVariantPreset(presetTable, rawProps, key) {
67
+ if (!presetTable || key === VARIANT_PROP_KEY) return void 0;
68
+ const activeVariant = rawProps[VARIANT_PROP_KEY];
69
+ if (typeof activeVariant !== "string") return void 0;
70
+ return presetTable[activeVariant]?.[key];
71
+ }
72
+ function patchThemedPropSlot(instance, defaults, name, key, presetTable) {
44
73
  const rawProps = instance.props;
45
74
  const fallbackValue = shallowRef(rawProps[key]);
46
75
  let wasPassed = passedPropValue(instance.vnode.props, key) !== void 0;
@@ -58,6 +87,8 @@ function patchThemedPropSlot(instance, defaults, name, key) {
58
87
  if (globalDefaults && globalDefaults[key] !== void 0) {
59
88
  return globalDefaults[key];
60
89
  }
90
+ const fromPreset = readVariantPreset(presetTable, rawProps, key);
91
+ if (fromPreset !== void 0) return fromPreset;
61
92
  return fallback;
62
93
  },
63
94
  set(value) {
@@ -66,14 +97,15 @@ function patchThemedPropSlot(instance, defaults, name, key) {
66
97
  }
67
98
  });
68
99
  }
69
- export function installThemePropsResolver(app, themedKeysUnion) {
100
+ export function installThemePropsResolver(app, themedKeysUnion, variantPresets = {}) {
70
101
  app.mixin({
71
102
  beforeCreate() {
72
103
  const instance = getCurrentInstance();
73
104
  if (!instance) return;
74
105
  const name = getCurrentInstanceName("theme-props-resolver");
75
106
  const defaults = inject(ORIGAM_DEFAULTS_KEY, ref({}));
76
- const targetKeys = collectTargetKeys(themedKeysUnion, defaults, name);
107
+ const presetTable = variantPresets[name];
108
+ const targetKeys = collectTargetKeys(themedKeysUnion, defaults, name, presetTable);
77
109
  if (!targetKeys) return;
78
110
  const rawProps = instance.props;
79
111
  for (const key of targetKeys) {
@@ -81,7 +113,7 @@ export function installThemePropsResolver(app, themedKeysUnion) {
81
113
  warnUnsupportedProp(name, key, `theme names this prop but <${name}> does not declare it`);
82
114
  continue;
83
115
  }
84
- patchThemedPropSlot(instance, defaults, name, key);
116
+ patchThemedPropSlot(instance, defaults, name, key, presetTable);
85
117
  }
86
118
  }
87
119
  });
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.VARIANT_PROP_KEY = exports.VARIANT_PRESETS = void 0;
7
+ const VARIANT_PROP_KEY = exports.VARIANT_PROP_KEY = "variant";
8
+ const VARIANT_PRESETS = exports.VARIANT_PRESETS = {};
@@ -0,0 +1,60 @@
1
+ import type { TVariantPresetRegistry } from '../../types/Commons/variant-preset.type';
2
+ /*********************************************************
3
+ * VARIANT_PROP_KEY
4
+ *
5
+ * @description
6
+ * Le nom du prop discriminant qu'une table de presets indexe. ADR-005
7
+ * n'en prevoit qu'un, et le resolveur a besoin de le nommer pour deux
8
+ * raisons distinctes.
9
+ *
10
+ * @description
11
+ * ⛔ C'EST AUSSI LA GARDE ANTI-RECURSION. Le getter installe sur un prop
12
+ * lit `props.variant` pour savoir quelle entree de la table consulter. Si
13
+ * ce getter etait AUSSI installe sur `variant` lui-meme, cette lecture se
14
+ * rappellerait indefiniment. Un preset ne pose jamais `variant` — il n'y
15
+ * a donc rien a resoudre pour cette cle, et `patchThemedPropSlot` la
16
+ * saute explicitement sur le canal preset.
17
+ ********************************************************/
18
+ export declare const VARIANT_PROP_KEY = "variant";
19
+ /*********************************************************
20
+ * VARIANT_PRESETS
21
+ *
22
+ * @description
23
+ * Les tables de presets que le DS LIVRE, par nom kebab de composant. Un
24
+ * theme les surcharge via `IOrigamTheme.variants` (ADR-005 D4) ; il ne les
25
+ * constitue pas.
26
+ *
27
+ * @description
28
+ * ⛔ VIDE A DESSEIN DANS CE LOT, et ce n'est pas du code mort. Le lot 1
29
+ * d'ADR-005 livre le MECANISME (type partage, rang dans le resolveur,
30
+ * canal `theme.variants`) et aucune conversion de composant : chaque
31
+ * composant arrive avec son propre lot, parce qu'aucun ne se convertit
32
+ * mecaniquement. Mesure a l'appui (2026-09-30), la taxonomie « famille A »
33
+ * de D5 est optimiste sur trois des quatre composants qu'elle liste :
34
+ * @description
35
+ * - `OrigamKbd` — ses regles de variant posent des PROPRIETES CUSTOM que
36
+ * `key-surface` consomme sur la racine ET sur les descendants `__key`
37
+ * (`&--variant-outlined &__key`). Un prop de racine emet
38
+ * `background-color`, qui n'herite pas jusqu'a `__key` ; et la
39
+ * declaration de `key-surface` siege a (0,2,0), donc une valeur de
40
+ * preset TOKENISEE lui perdrait. Conversion fidele = revoir par ou
41
+ * `key-surface` recoit sa couleur.
42
+ * - `OrigamBtnGroup` — recopie `--origam-btn-group---border-width` dans
43
+ * une propriete custom qui alimente un `calc()` de rayon interieur.
44
+ * Inexprimable en prop de racine.
45
+ * - `OrigamBlockquote` — `padding-inline-start: calc(var(--…) + var(--…))`
46
+ * et des regles imbriquees sur `__body` / `__attribution`.
47
+ * @description
48
+ * Seul `OrigamBtn` ne peint que des proprietes de racine — mais il depend
49
+ * de `IOpacityProps` / `IBackdropProps` (Q1, absents) et son `ghost` porte
50
+ * une branche `@supports not (backdrop-filter)` qui echange le fond de
51
+ * 12 % a 18 % : aucune prop n'exprime une valeur conditionnee a une
52
+ * feature query.
53
+ *
54
+ * @description
55
+ * Le pilote est `OrigamKbd`, pour une raison que D7 ne donne pas : AUCUN
56
+ * theme de marque ne touche un seul token `origam-kbd` (verifie, zero
57
+ * occurrence sur les 8 themes), donc le zero-changement y est prouvable en
58
+ * isolation. `OrigamBtn` vient au lot 4.
59
+ ********************************************************/
60
+ export declare const VARIANT_PRESETS: TVariantPresetRegistry;
@@ -0,0 +1,2 @@
1
+ export const VARIANT_PROP_KEY = "variant";
2
+ export const VARIANT_PRESETS = {};
@@ -959,4 +959,15 @@ Object.keys(_elevation).forEach(function (key) {
959
959
  return _elevation[key];
960
960
  }
961
961
  });
962
+ });
963
+ var _variantPreset = require("./Commons/variant-preset.const.cjs");
964
+ Object.keys(_variantPreset).forEach(function (key) {
965
+ if (key === "default" || key === "__esModule") return;
966
+ if (key in exports && exports[key] === _variantPreset[key]) return;
967
+ Object.defineProperty(exports, key, {
968
+ enumerable: true,
969
+ get: function () {
970
+ return _variantPreset[key];
971
+ }
972
+ });
962
973
  });
@@ -85,3 +85,4 @@ export * from './Audio/audio-waveform.const';
85
85
  export * from './Clipboard/clipboard.const';
86
86
  export * from './Commons/css-support.const';
87
87
  export * from './Commons/elevation.const';
88
+ export * from './Commons/variant-preset.const';
@@ -85,3 +85,4 @@ export * from "./Audio/audio-waveform.const.js";
85
85
  export * from "./Clipboard/clipboard.const.js";
86
86
  export * from "./Commons/css-support.const.js";
87
87
  export * from "./Commons/elevation.const.js";
88
+ export * from "./Commons/variant-preset.const.js";
@@ -2,6 +2,7 @@ import type { Ref } from 'vue';
2
2
  import type { IThemeVars } from './semantic-tree.interface';
3
3
  import type { TThemeVars } from '../../types/Commons/token-tree.type';
4
4
  import type { TMode, TTheme } from '../../types/Commons/theme.type';
5
+ import type { TVariantPresetRegistry } from '../../types/Commons/variant-preset.type';
5
6
  import type { IDefault } from '../DefaultsProvider/defaults-provider.interface';
6
7
  /**
7
8
  * Shape of the `useTheme()` singleton state.
@@ -127,4 +128,36 @@ export interface IOrigamTheme {
127
128
  * }
128
129
  */
129
130
  components?: IDefault;
131
+ /*********************************************************
132
+ * variants
133
+ *
134
+ * @description
135
+ * ADR-005 D4 — redefinit en PROPS ce qu'un `variant` veut dire, par
136
+ * composant puis par valeur de variant :
137
+ *
138
+ * variants: {
139
+ * 'origam-btn': { outlined: { border: 3, rounded: 'lg' } }
140
+ * }
141
+ *
142
+ * @description
143
+ * C'est ce qui rend les variants conformes a la regle PROPS-D'ABORD :
144
+ * un theme retune `outlined` en changeant des valeurs de props, et ne
145
+ * descend a `vars` / `cssVars` que pour ce que les props n'expriment
146
+ * pas. Les variants etaient le seul API du DS a violer cette regle
147
+ * structurellement.
148
+ *
149
+ * @description
150
+ * FRERE de `components`, pas une cle imbriquee dedans : `components`
151
+ * est type `IDefault` (composant -> map de props), donc y nicher un
152
+ * niveau de variant rendrait `{ 'origam-btn': { outlined: … } }`
153
+ * ambigu avec un prop qui s'appellerait litteralement `outlined`.
154
+ *
155
+ * @description
156
+ * Fusionne par-dessus la table livree par le DS a l'installation
157
+ * (`resolveVariantPresetRegistry`), avec le `mergeDeep` que
158
+ * `provideDefaults` utilise deja. Le preset resultant reste le rang
159
+ * LE PLUS FAIBLE de la resolution (arbitrage Q2) : un prop ecrit au
160
+ * site d'appel, comme un defaut de `components`, le battent tous deux.
161
+ ********************************************************/
162
+ variants?: TVariantPresetRegistry;
130
163
  }
@@ -59,8 +59,8 @@ export interface IMasonryProps extends ICommonsComponentProps, ITagProps, IDimen
59
59
  * Gap between items, both vertically and horizontally. Accepts:
60
60
  *
61
61
  * - one of the grid size tokens `'xs' | 'sm' | 'md' | 'lg' | 'xl'`
62
- * (resolved via `tokens/component/grid.json`, same matrix as
63
- * `<OrigamGrid>` for visual consistency).
62
+ * (resolved via `GRID_GAP_SIZE_VAR` to `--origam-grid---gap-{size}`,
63
+ * same matrix as `<OrigamGrid>` for visual consistency).
64
64
  * - any CSS length string (`'24px'`, `'1rem'`).
65
65
  * - a plain `number` interpreted as pixels.
66
66
  *
@@ -32,6 +32,7 @@ function createOrigam(origam = {}) {
32
32
  const defaultsRef = (0, _composables.createDefaults)({});
33
33
  defaultsRef.value = activeDefaultsFor(allThemes, allThemes[0]?.name ?? "", void 0);
34
34
  const themedKeysUnion = (0, _composables.themedPropKeysUnion)(allThemes.map(theme => theme.components).filter(components2 => !!components2));
35
+ const variantPresets = (0, _composables.resolveVariantPresetRegistry)(_consts.VARIANT_PRESETS, allThemes.map(theme => theme.variants).filter(variants => !!variants));
35
36
  const scope = (0, _vue.effectScope)();
36
37
  return scope.run(() => {
37
38
  const icons = (0, _composables.createIcons)(options.icons);
@@ -67,7 +68,7 @@ function createOrigam(origam = {}) {
67
68
  app.provide(_consts.ORIGAM_GO_TO_KEY, goTo);
68
69
  app.provide(_consts.ORIGAM_THEMES_KEY, installedThemes);
69
70
  app.provide(_consts.ORIGAM_DEFAULTS_KEY, defaultsRef);
70
- (0, _composables.installThemePropsResolver)(app, themedKeysUnion);
71
+ (0, _composables.installThemePropsResolver)(app, themedKeysUnion, variantPresets);
71
72
  app.provide(_consts.ORIGAM_THEME_DEFAULTS_KEY, (brand, mode) => activeDefaultsFor(allThemes, brand, mode));
72
73
  if (_consts.IN_BROWSER && options.ssr) {
73
74
  const nuxt = app.$nuxt;
@@ -7,6 +7,7 @@ import {
7
7
  createIcons,
8
8
  createLocale,
9
9
  installThemePropsResolver,
10
+ resolveVariantPresetRegistry,
10
11
  themedPropKeysUnion
11
12
  } from "./composables/index.js";
12
13
  import {
@@ -19,7 +20,8 @@ import {
19
20
  ORIGAM_ICONS_KEY,
20
21
  ORIGAM_LOCALE_KEY,
21
22
  ORIGAM_THEME_DEFAULTS_KEY,
22
- ORIGAM_THEMES_KEY
23
+ ORIGAM_THEMES_KEY,
24
+ VARIANT_PRESETS
23
25
  } from "./consts/index.js";
24
26
  import * as origamDirectives from "./directives/index.js";
25
27
  import { setContrastConfig } from "./directives/Contrast/contrast.directive.js";
@@ -45,6 +47,10 @@ export function createOrigam(origam = {}) {
45
47
  const themedKeysUnion = themedPropKeysUnion(
46
48
  allThemes.map((theme) => theme.components).filter((components2) => !!components2)
47
49
  );
50
+ const variantPresets = resolveVariantPresetRegistry(
51
+ VARIANT_PRESETS,
52
+ allThemes.map((theme) => theme.variants).filter((variants) => !!variants)
53
+ );
48
54
  const scope = effectScope();
49
55
  return scope.run(() => {
50
56
  const icons = createIcons(options.icons);
@@ -80,7 +86,7 @@ export function createOrigam(origam = {}) {
80
86
  app.provide(ORIGAM_GO_TO_KEY, goTo);
81
87
  app.provide(ORIGAM_THEMES_KEY, installedThemes);
82
88
  app.provide(ORIGAM_DEFAULTS_KEY, defaultsRef);
83
- installThemePropsResolver(app, themedKeysUnion);
89
+ installThemePropsResolver(app, themedKeysUnion, variantPresets);
84
90
  app.provide(ORIGAM_THEME_DEFAULTS_KEY, (brand, mode) => activeDefaultsFor(allThemes, brand, mode));
85
91
  if (IN_BROWSER && options.ssr) {
86
92
  const nuxt = app.$nuxt;
@@ -0,0 +1 @@
1
+ "use strict";