origam 2.18.18 → 2.18.20

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 (81) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/dist/src/assets/css/main.css +1 -1
  3. package/dist/src/assets/css/tokens/dark.css +124 -6
  4. package/dist/src/assets/css/tokens/light.css +62 -3
  5. package/dist/src/assets/css/tokens/origam-utilities.css +30 -0
  6. package/dist/src/assets/css/tokens/primitive.css +5 -0
  7. package/dist/src/assets/scss/tokens/_dark.scss +124 -6
  8. package/dist/src/assets/scss/tokens/_light.scss +62 -3
  9. package/dist/src/assets/scss/tokens/_origam-utilities.scss +30 -0
  10. package/dist/src/assets/scss/tokens/_primitive.scss +5 -0
  11. package/dist/src/components/Audio/OrigamAudio.vue +66 -2
  12. package/dist/src/components/Chip/OrigamChip.vue +34 -0
  13. package/dist/src/components/Field/OrigamField.vue +76 -3
  14. package/dist/src/components/List/OrigamList.vue +90 -3
  15. package/dist/src/components/Main/OrigamMain.vue +2 -2
  16. package/dist/src/components/Media/OrigamMediaScrubber.vue +11 -1
  17. package/dist/src/components/SliderField/OrigamSliderField.vue +138 -3
  18. package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +12 -1
  19. package/dist/src/components/Snackbar/OrigamSnackbar.vue +2 -2
  20. package/dist/src/components/Switch/OrigamSwitch.vue +32 -0
  21. package/dist/src/components/TextField/OrigamTextField.vue +3 -1
  22. package/dist/src/components/Video/OrigamVideo.vue +11 -1
  23. package/dist/src/composables/Commons/backdrop.composable.cjs +50 -0
  24. package/dist/src/composables/Commons/backdrop.composable.d.ts +32 -0
  25. package/dist/src/composables/Commons/backdrop.composable.js +33 -0
  26. package/dist/src/composables/Commons/layout.composable.cjs +2 -2
  27. package/dist/src/composables/Commons/layout.composable.d.ts +16 -2
  28. package/dist/src/composables/Commons/layout.composable.js +1 -1
  29. package/dist/src/composables/Commons/opacity.composable.cjs +50 -0
  30. package/dist/src/composables/Commons/opacity.composable.d.ts +33 -0
  31. package/dist/src/composables/Commons/opacity.composable.js +34 -0
  32. package/dist/src/composables/Commons/stateEffect.composable.cjs +17 -2
  33. package/dist/src/composables/Commons/stateEffect.composable.d.ts +7 -2
  34. package/dist/src/composables/Commons/stateEffect.composable.js +23 -2
  35. package/dist/src/composables/Commons/theme-props-resolver.composable.cjs +44 -9
  36. package/dist/src/composables/Commons/theme-props-resolver.composable.d.ts +33 -1
  37. package/dist/src/composables/Commons/theme-props-resolver.composable.js +42 -10
  38. package/dist/src/composables/index.cjs +24 -0
  39. package/dist/src/composables/index.d.ts +2 -0
  40. package/dist/src/composables/index.js +2 -0
  41. package/dist/src/consts/Commons/backdrop.const.cjs +15 -0
  42. package/dist/src/consts/Commons/backdrop.const.d.ts +47 -0
  43. package/dist/src/consts/Commons/backdrop.const.js +9 -0
  44. package/dist/src/consts/Commons/opacity.const.cjs +20 -0
  45. package/dist/src/consts/Commons/opacity.const.d.ts +58 -0
  46. package/dist/src/consts/Commons/opacity.const.js +14 -0
  47. package/dist/src/consts/Commons/variant-preset.const.cjs +8 -0
  48. package/dist/src/consts/Commons/variant-preset.const.d.ts +60 -0
  49. package/dist/src/consts/Commons/variant-preset.const.js +2 -0
  50. package/dist/src/consts/index.cjs +33 -0
  51. package/dist/src/consts/index.d.ts +3 -0
  52. package/dist/src/consts/index.js +3 -0
  53. package/dist/src/interfaces/Commons/backdrop.interface.cjs +1 -0
  54. package/dist/src/interfaces/Commons/backdrop.interface.d.ts +49 -0
  55. package/dist/src/interfaces/Commons/backdrop.interface.js +0 -0
  56. package/dist/src/interfaces/Commons/opacity.interface.cjs +1 -0
  57. package/dist/src/interfaces/Commons/opacity.interface.d.ts +37 -0
  58. package/dist/src/interfaces/Commons/opacity.interface.js +0 -0
  59. package/dist/src/interfaces/Commons/state-effect.interface.d.ts +31 -0
  60. package/dist/src/interfaces/Commons/theme.interface.d.ts +33 -0
  61. package/dist/src/interfaces/Masonry/masonry.interface.d.ts +2 -2
  62. package/dist/src/interfaces/index.cjs +22 -0
  63. package/dist/src/interfaces/index.d.ts +2 -0
  64. package/dist/src/interfaces/index.js +2 -0
  65. package/dist/src/origam.cjs +2 -1
  66. package/dist/src/origam.js +8 -2
  67. package/dist/src/types/Commons/backdrop.type.cjs +1 -0
  68. package/dist/src/types/Commons/backdrop.type.d.ts +23 -0
  69. package/dist/src/types/Commons/backdrop.type.js +0 -0
  70. package/dist/src/types/Commons/opacity.type.cjs +1 -0
  71. package/dist/src/types/Commons/opacity.type.d.ts +36 -0
  72. package/dist/src/types/Commons/opacity.type.js +0 -0
  73. package/dist/src/types/Commons/state-effect.type.d.ts +2 -1
  74. package/dist/src/types/Commons/variant-preset.type.cjs +1 -0
  75. package/dist/src/types/Commons/variant-preset.type.d.ts +73 -0
  76. package/dist/src/types/Commons/variant-preset.type.js +0 -0
  77. package/dist/src/types/index.cjs +33 -0
  78. package/dist/src/types/index.d.ts +3 -0
  79. package/dist/src/types/index.js +3 -0
  80. package/dist/src/types/tokens.type.d.ts +1 -1
  81. package/package.json +1 -1
@@ -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");
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useOpacity = useOpacity;
7
+ var _vue = require("vue");
8
+ var _opacity = require("../../consts/Commons/opacity.const.cjs");
9
+ function resolveNumericOpacity(value) {
10
+ if (value <= _opacity.OPACITY_FRACTION_CEILING) return {
11
+ rung: null,
12
+ css: String(value)
13
+ };
14
+ const rung = String(value);
15
+ const rungVar = _opacity.OPACITY_RUNG_VARS[rung];
16
+ if (rungVar) return {
17
+ rung,
18
+ css: rungVar
19
+ };
20
+ return {
21
+ rung: null,
22
+ css: String(value / _opacity.OPACITY_PERCENT_SCALE)
23
+ };
24
+ }
25
+ function resolveOpacity(value) {
26
+ if (value == null || value === "") return null;
27
+ const numeric = typeof value === "number" ? value : Number(String(value).trim());
28
+ if (Number.isFinite(numeric)) return resolveNumericOpacity(numeric);
29
+ return {
30
+ rung: null,
31
+ css: String(value).trim()
32
+ };
33
+ }
34
+ function useOpacity(props) {
35
+ const resolved = (0, _vue.computed)(() => {
36
+ return resolveOpacity((0, _vue.isRef)(props) ? props.value : props.opacity);
37
+ });
38
+ const opacityClasses = (0, _vue.computed)(() => {
39
+ const rung = resolved.value?.rung;
40
+ return rung ? [`${_opacity.OPACITY_UTILITY_CLASS_PREFIX}${rung}`] : [];
41
+ });
42
+ const opacityStyles = (0, _vue.computed)(() => {
43
+ const current = resolved.value;
44
+ return current ? [`opacity: ${current.css}`] : [];
45
+ });
46
+ return {
47
+ opacityClasses,
48
+ opacityStyles
49
+ };
50
+ }
@@ -0,0 +1,33 @@
1
+ import { Ref } from 'vue';
2
+ import type { IOpacityProps } from '../../interfaces/Commons/opacity.interface';
3
+ import { TOpacity } from '../../types/Commons/opacity.type';
4
+ /*********************************************************
5
+ * useOpacity
6
+ *
7
+ * @description
8
+ * Translates the `opacity` prop into `opacityClasses` (the global utility
9
+ * class, when the value lands on a token rung) AND `opacityStyles`
10
+ * (always an `opacity:` declaration). Both channels are emitted in
11
+ * PARALLEL, never one instead of the other — strategy A, the same
12
+ * contract `useElevation` and `useRounded` honour.
13
+ *
14
+ * @description
15
+ * ⛔ THE STYLE IS NOT REDUNDANT WITH THE CLASS, and dropping it would
16
+ * break the prop on most components. A utility class is `(0,1,0)`; a Vue
17
+ * scoped component rule is `.class[data-v-hash]` = `(0,2,0)` and wins
18
+ * regardless of load order. `OrigamBtn` already declares `opacity` in its
19
+ * own scoped SCSS (`--variant-plain`, `--disabled`), so on Btn the class
20
+ * alone would paint nothing. This is the measured lesson of #514 on the
21
+ * foreground channel, applied here before it can be re-learned.
22
+ *
23
+ * @description
24
+ * REUSES the primitive ladder that already existed
25
+ * (`--origam-opacity---{0,12,26,32,50,60,70,87,100}`, `primitive.css`);
26
+ * this composable declares no token of its own. See
27
+ * {@link IOpacityProps} for why ADR-005's "add a token group" was already
28
+ * half-done.
29
+ ********************************************************/
30
+ export declare function useOpacity(props: IOpacityProps | Ref<TOpacity | undefined>): {
31
+ opacityClasses: import("vue").ComputedRef<string[]>;
32
+ opacityStyles: import("vue").ComputedRef<string[]>;
33
+ };
@@ -0,0 +1,34 @@
1
+ import { computed, isRef } from "vue";
2
+ import {
3
+ OPACITY_FRACTION_CEILING,
4
+ OPACITY_PERCENT_SCALE,
5
+ OPACITY_RUNG_VARS,
6
+ OPACITY_UTILITY_CLASS_PREFIX
7
+ } from "../../consts/Commons/opacity.const.js";
8
+ function resolveNumericOpacity(value) {
9
+ if (value <= OPACITY_FRACTION_CEILING) return { rung: null, css: String(value) };
10
+ const rung = String(value);
11
+ const rungVar = OPACITY_RUNG_VARS[rung];
12
+ if (rungVar) return { rung, css: rungVar };
13
+ return { rung: null, css: String(value / OPACITY_PERCENT_SCALE) };
14
+ }
15
+ function resolveOpacity(value) {
16
+ if (value == null || value === "") return null;
17
+ const numeric = typeof value === "number" ? value : Number(String(value).trim());
18
+ if (Number.isFinite(numeric)) return resolveNumericOpacity(numeric);
19
+ return { rung: null, css: String(value).trim() };
20
+ }
21
+ export function useOpacity(props) {
22
+ const resolved = computed(() => {
23
+ return resolveOpacity(isRef(props) ? props.value : props.opacity);
24
+ });
25
+ const opacityClasses = computed(() => {
26
+ const rung = resolved.value?.rung;
27
+ return rung ? [`${OPACITY_UTILITY_CLASS_PREFIX}${rung}`] : [];
28
+ });
29
+ const opacityStyles = computed(() => {
30
+ const current = resolved.value;
31
+ return current ? [`opacity: ${current.css}`] : [];
32
+ });
33
+ return { opacityClasses, opacityStyles };
34
+ }
@@ -8,6 +8,7 @@ var _vue = require("vue");
8
8
  var _border = require("./border.composable.cjs");
9
9
  var _elevation = require("./elevation.composable.cjs");
10
10
  var _margin = require("./margin.composable.cjs");
11
+ var _opacity = require("./opacity.composable.cjs");
11
12
  var _padding = require("./padding.composable.cjs");
12
13
  var _rounded = require("./rounded.composable.cjs");
13
14
  var _color = require("../../utils/Commons/color.util.cjs");
@@ -44,6 +45,8 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
44
45
  const padding = pickEffective(() => props.padding, isHover, isActive, hoverState, activeState, "padding");
45
46
  const margin = pickEffective(() => props.margin, isHover, isActive, hoverState, activeState, "margin");
46
47
  const gap = pickEffective(() => props.gap, isHover, isActive, hoverState, activeState, "gap");
48
+ const opacity = pickEffective(() => props.opacity, isHover, isActive, hoverState, activeState, "opacity");
49
+ const borderColor = pickEffective(() => props.borderColor, isHover, isActive, hoverState, activeState, "borderColor");
47
50
  const sameIntent = (a, b) => {
48
51
  return !!a && !!b && a === b && (0, _color.isIntent)(a);
49
52
  };
@@ -105,7 +108,7 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
105
108
  return border.value;
106
109
  },
107
110
  get borderColor() {
108
- return props.borderColor;
111
+ return borderColor.value;
109
112
  },
110
113
  get borderStyle() {
111
114
  return props.borderStyle;
@@ -225,6 +228,14 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
225
228
  return [`gap: ${v}`];
226
229
  });
227
230
  const gapClasses = (0, _vue.computed)(() => []);
231
+ const {
232
+ opacityClasses,
233
+ opacityStyles
234
+ } = (0, _opacity.useOpacity)((0, _vue.reactive)({
235
+ get opacity() {
236
+ return opacity.value;
237
+ }
238
+ }));
228
239
  return {
229
240
  // Resolved scalar refs (so consumers can read the effective value)
230
241
  color,
@@ -235,6 +246,8 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
235
246
  padding,
236
247
  margin,
237
248
  gap,
249
+ opacity,
250
+ borderColor,
238
251
  // Per-axis classes + styles (state-aware)
239
252
  colorClasses,
240
253
  colorStyles,
@@ -249,6 +262,8 @@ function useStateEffect(props, isHover = noopRef, isActive = noopRef, hoverState
249
262
  marginClasses,
250
263
  marginStyles,
251
264
  gapClasses,
252
- gapStyles
265
+ gapStyles,
266
+ opacityClasses,
267
+ opacityStyles
253
268
  };
254
269
  }
@@ -10,8 +10,9 @@ import type { TStateEffectProps } from '../../types/Commons/state-effect.type';
10
10
  * `useBorder` + `useRounded` + `useElevation` + `usePadding` + `useMargin`
11
11
  * que chaque composant visuel devait repeter. Lit les etats `isHover`/
12
12
  * `isActive`/`isDisabled` (et leurs overrides `hoverState`/`activeState`)
13
- * et resout 8 axes state-aware : color, bgColor, border, rounded,
14
- * elevation, padding, margin, gap — chacun avec classes ET styles.
13
+ * et resout 10 axes state-aware : color, bgColor, border, borderColor,
14
+ * rounded, elevation, padding, margin, gap, opacity — chacun avec
15
+ * classes ET styles.
15
16
  * Priorite de resolution par axe : HOVER gagne sur ACTIVE (survoler un
16
17
  * element presse/selectionne montre la surface hover), qui gagne sur la
17
18
  * valeur de repos (`props.xxx`).
@@ -43,6 +44,8 @@ flat?: Ref<boolean> | ComputedRef<boolean>): {
43
44
  padding: ComputedRef<string | number | boolean | undefined>;
44
45
  margin: ComputedRef<string | number | boolean | undefined>;
45
46
  gap: ComputedRef<string | number | boolean | undefined>;
47
+ opacity: ComputedRef<string | number | undefined>;
48
+ borderColor: ComputedRef<string | undefined>;
46
49
  colorClasses: ComputedRef<string[]>;
47
50
  colorStyles: ComputedRef<string[]>;
48
51
  borderClasses: ComputedRef<string[]>;
@@ -57,4 +60,6 @@ flat?: Ref<boolean> | ComputedRef<boolean>): {
57
60
  marginStyles: ComputedRef<string[]>;
58
61
  gapClasses: ComputedRef<string[]>;
59
62
  gapStyles: ComputedRef<string[]>;
63
+ opacityClasses: ComputedRef<string[]>;
64
+ opacityStyles: ComputedRef<string[]>;
60
65
  };
@@ -2,6 +2,7 @@ import { computed, reactive } from "vue";
2
2
  import { useBorder } from "./border.composable.js";
3
3
  import { useElevation } from "./elevation.composable.js";
4
4
  import { useMargin } from "./margin.composable.js";
5
+ import { useOpacity } from "./opacity.composable.js";
5
6
  import { usePadding } from "./padding.composable.js";
6
7
  import { useRounded } from "./rounded.composable.js";
7
8
  import { getForeground, intentBgExpr, isCssColor, isIntent, isParsableColor, isUtilityIntent, parseColor, rawBgExprWithState, tokenForegroundForIntent, tokenStylesForIntent, warnLegacyColor } from "../../utils/Commons/color.util.js";
@@ -45,6 +46,15 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
45
46
  activeState,
46
47
  "gap"
47
48
  );
49
+ const opacity = pickEffective(() => props.opacity, isHover, isActive, hoverState, activeState, "opacity");
50
+ const borderColor = pickEffective(
51
+ () => props.borderColor,
52
+ isHover,
53
+ isActive,
54
+ hoverState,
55
+ activeState,
56
+ "borderColor"
57
+ );
48
58
  const sameIntent = (a, b) => {
49
59
  return !!a && !!b && a === b && isIntent(a);
50
60
  };
@@ -104,7 +114,7 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
104
114
  return border.value;
105
115
  },
106
116
  get borderColor() {
107
- return props.borderColor;
117
+ return borderColor.value;
108
118
  },
109
119
  get borderStyle() {
110
120
  return props.borderStyle;
@@ -222,6 +232,13 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
222
232
  return [`gap: ${v}`];
223
233
  });
224
234
  const gapClasses = computed(() => []);
235
+ const { opacityClasses, opacityStyles } = useOpacity(
236
+ reactive({
237
+ get opacity() {
238
+ return opacity.value;
239
+ }
240
+ })
241
+ );
225
242
  return {
226
243
  // Resolved scalar refs (so consumers can read the effective value)
227
244
  color,
@@ -232,6 +249,8 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
232
249
  padding,
233
250
  margin,
234
251
  gap,
252
+ opacity,
253
+ borderColor,
235
254
  // Per-axis classes + styles (state-aware)
236
255
  colorClasses,
237
256
  colorStyles,
@@ -246,6 +265,8 @@ export function useStateEffect(props, isHover = noopRef, isActive = noopRef, hov
246
265
  marginClasses,
247
266
  marginStyles,
248
267
  gapClasses,
249
- gapStyles
268
+ gapStyles,
269
+ opacityClasses,
270
+ opacityStyles
250
271
  };
251
272
  }
@@ -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
  });
@@ -168,6 +168,18 @@ Object.keys(_dimension).forEach(function (key) {
168
168
  }
169
169
  });
170
170
  });
171
+ var _backdrop = require("./Commons/backdrop.composable.cjs");
172
+ Object.keys(_backdrop).forEach(function (key) {
173
+ if (key === "default" || key === "__esModule") return;
174
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
175
+ if (key in exports && exports[key] === _backdrop[key]) return;
176
+ Object.defineProperty(exports, key, {
177
+ enumerable: true,
178
+ get: function () {
179
+ return _backdrop[key];
180
+ }
181
+ });
182
+ });
171
183
  var _elevation = require("./Commons/elevation.composable.cjs");
172
184
  Object.keys(_elevation).forEach(function (key) {
173
185
  if (key === "default" || key === "__esModule") return;
@@ -180,6 +192,18 @@ Object.keys(_elevation).forEach(function (key) {
180
192
  }
181
193
  });
182
194
  });
195
+ var _opacity = require("./Commons/opacity.composable.cjs");
196
+ Object.keys(_opacity).forEach(function (key) {
197
+ if (key === "default" || key === "__esModule") return;
198
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
199
+ if (key in exports && exports[key] === _opacity[key]) return;
200
+ Object.defineProperty(exports, key, {
201
+ enumerable: true,
202
+ get: function () {
203
+ return _opacity[key];
204
+ }
205
+ });
206
+ });
183
207
  var _group = require("./Commons/group.composable.cjs");
184
208
  Object.keys(_group).forEach(function (key) {
185
209
  if (key === "default" || key === "__esModule") return;
@@ -11,7 +11,9 @@ export * from './Commons/date-picker-calendar.composable';
11
11
  export * from './Commons/date.composable';
12
12
  export * from './Commons/density.composable';
13
13
  export * from './Commons/dimension.composable';
14
+ export * from './Commons/backdrop.composable';
14
15
  export * from './Commons/elevation.composable';
16
+ export * from './Commons/opacity.composable';
15
17
  export * from './Commons/group.composable';
16
18
  export * from './Commons/groupItem.composable';
17
19
  export * from './Commons/groupSiblingLink.composable';
@@ -11,7 +11,9 @@ export * from "./Commons/date-picker-calendar.composable.js";
11
11
  export * from "./Commons/date.composable.js";
12
12
  export * from "./Commons/density.composable.js";
13
13
  export * from "./Commons/dimension.composable.js";
14
+ export * from "./Commons/backdrop.composable.js";
14
15
  export * from "./Commons/elevation.composable.js";
16
+ export * from "./Commons/opacity.composable.js";
15
17
  export * from "./Commons/group.composable.js";
16
18
  export * from "./Commons/groupItem.composable.js";
17
19
  export * from "./Commons/groupSiblingLink.composable.js";
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BACKDROP_UTILITY_CLASS_PREFIX = exports.BACKDROP_BLUR_RUNG_VARS = exports.BACKDROP_BLUR_DEFAULT_RUNG = void 0;
7
+ const BACKDROP_BLUR_RUNG_VARS = exports.BACKDROP_BLUR_RUNG_VARS = {
8
+ xs: "var(--origam-blur---xs, 4px)",
9
+ sm: "var(--origam-blur---sm, 6px)",
10
+ md: "var(--origam-blur---md, 8px)",
11
+ lg: "var(--origam-blur---lg, 16px)",
12
+ xl: "var(--origam-blur---xl, 24px)"
13
+ };
14
+ const BACKDROP_BLUR_DEFAULT_RUNG = exports.BACKDROP_BLUR_DEFAULT_RUNG = "md";
15
+ const BACKDROP_UTILITY_CLASS_PREFIX = exports.BACKDROP_UTILITY_CLASS_PREFIX = "origam--backdrop-blur-";