origam 2.18.18 → 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 (42) hide show
  1. package/CHANGELOG.md +142 -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/scss/tokens/_dark.scss +124 -6
  6. package/dist/src/assets/scss/tokens/_light.scss +62 -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/SliderField/OrigamSliderField.vue +138 -3
  14. package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +12 -1
  15. package/dist/src/components/Snackbar/OrigamSnackbar.vue +2 -2
  16. package/dist/src/components/Switch/OrigamSwitch.vue +32 -0
  17. package/dist/src/components/TextField/OrigamTextField.vue +3 -1
  18. package/dist/src/components/Video/OrigamVideo.vue +11 -1
  19. package/dist/src/composables/Commons/layout.composable.cjs +2 -2
  20. package/dist/src/composables/Commons/layout.composable.d.ts +16 -2
  21. package/dist/src/composables/Commons/layout.composable.js +1 -1
  22. package/dist/src/composables/Commons/theme-props-resolver.composable.cjs +44 -9
  23. package/dist/src/composables/Commons/theme-props-resolver.composable.d.ts +33 -1
  24. package/dist/src/composables/Commons/theme-props-resolver.composable.js +42 -10
  25. package/dist/src/consts/Commons/variant-preset.const.cjs +8 -0
  26. package/dist/src/consts/Commons/variant-preset.const.d.ts +60 -0
  27. package/dist/src/consts/Commons/variant-preset.const.js +2 -0
  28. package/dist/src/consts/index.cjs +11 -0
  29. package/dist/src/consts/index.d.ts +1 -0
  30. package/dist/src/consts/index.js +1 -0
  31. package/dist/src/interfaces/Commons/theme.interface.d.ts +33 -0
  32. package/dist/src/interfaces/Masonry/masonry.interface.d.ts +2 -2
  33. package/dist/src/origam.cjs +2 -1
  34. package/dist/src/origam.js +8 -2
  35. package/dist/src/types/Commons/variant-preset.type.cjs +1 -0
  36. package/dist/src/types/Commons/variant-preset.type.d.ts +73 -0
  37. package/dist/src/types/Commons/variant-preset.type.js +0 -0
  38. package/dist/src/types/index.cjs +11 -0
  39. package/dist/src/types/index.d.ts +1 -0
  40. package/dist/src/types/index.js +1 -0
  41. package/dist/src/types/tokens.type.d.ts +1 -1
  42. package/package.json +1 -1
@@ -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";
@@ -0,0 +1,73 @@
1
+ /*********************************************************
2
+ * TVariantPresets
3
+ *
4
+ * @description
5
+ * ADR-005 (D1) — un `variant` EST une preconfiguration de props nommee,
6
+ * pas une couche CSS : `Record<valeur du variant, Partial<props>>`.
7
+ *
8
+ * @description
9
+ * C'est le type d'AUTORAT, celui qu'une table
10
+ * `consts/{Composant}/{composant}-variant.const.ts` annote pour que le
11
+ * compilateur refuse une valeur de variant inconnue ou un nom de prop que
12
+ * le composant ne declare pas :
13
+ *
14
+ * export const KBD_VARIANT_PRESETS: TVariantPresets<TKbdVariant, IKbdProps> = {
15
+ * outlined: { bgColor: '...', border: 1 },
16
+ * filled: { bgColor: '...' },
17
+ * tonal: { bgColor: '...', border: 0 }
18
+ * }
19
+ *
20
+ * @description
21
+ * ⛔ AUCUN SCSS N'ACCOMPAGNE UNE TABLE DE PRESETS. La classe
22
+ * `{nom}--variant-{valeur}` que `useVariant()` emet continue d'exister,
23
+ * mais le DS ne lui attache plus aucune regle : elle appartient au
24
+ * CONSOMMATEUR, comme crochet d'override. Le garde `no-variant-css` tient
25
+ * cette moitie du contrat.
26
+ *
27
+ * @description
28
+ * ⛔ LES VALEURS NE SE RE-EXPRIMENT PAS EN ECHELON SEMANTIQUE. Mesure
29
+ * (2026-09-30) : les 8 themes de marque
30
+ * (`packages/marketing/src/themes/*.theme.ts`) habillent leurs boutons A
31
+ * TRAVERS les tokens de composant que la regle de variant lisait —
32
+ * `cartoon` pose `--origam-btn---box-shadow-elevated: 4px 4px 0 #171717`,
33
+ * `glass` une ombre de verre a quatre couches. Un preset ecrit
34
+ * `elevation: 'md'` emet `var(--origam-shadow---md)` et jette donc
35
+ * silencieusement l'ombre de la marque sur les 8 identites x 2 modes.
36
+ * @description
37
+ * Un preset porte la MEME chaine `var(--origam-{cmp}---{...}, <repli>)`
38
+ * que portait la regle, jamais sa traduction en echelon : le canal
39
+ * d'override des themes survit, et le rendu est identique par
40
+ * construction. `TElevation` documente le `box-shadow` libre (dont
41
+ * `var()`, multi-couches, `inset`) rendu verbatim, et `isCssColor`
42
+ * accepte `var(--…)` comme `color-mix(…)` en les routant vers le canal
43
+ * de style « valeur custom ».
44
+ ********************************************************/
45
+ export type TVariantPresets<V extends string, P> = Record<V, Partial<P>>;
46
+ /*********************************************************
47
+ * TVariantPresetTable
48
+ *
49
+ * @description
50
+ * La meme table, vue par le RESOLVEUR : valeur du variant -> sac de props.
51
+ *
52
+ * @description
53
+ * Type efface a dessein. Le resolveur est generique sur les 217
54
+ * composants et ne peut etre parametre par aucun `IXxxProps` en
55
+ * particulier ; c'est la table d'autorat qui porte le typage fort, au
56
+ * point d'ecriture, ou il sert reellement a quelque chose.
57
+ ********************************************************/
58
+ export type TVariantPresetTable = Record<string, Record<string, unknown>>;
59
+ /*********************************************************
60
+ * TVariantPresetRegistry
61
+ *
62
+ * @description
63
+ * Nom kebab du composant (`'origam-btn'`) -> sa table de presets.
64
+ *
65
+ * @description
66
+ * Meme forme que ce qu'un theme peut declarer sous `IOrigamTheme.variants`
67
+ * (ADR-005 D4). C'est une exigence, pas une coincidence : la directive
68
+ * d'implementation de l'ADR veut qu'un preset soit « une config par defaut
69
+ * comme avec le theme, la meme logique ». Si les deux formes divergeaient,
70
+ * la fusion du lot 1 et les variants definis par le consommateur
71
+ * demanderaient deux chemins de resolution au lieu d'un.
72
+ ********************************************************/
73
+ export type TVariantPresetRegistry = Record<string, TVariantPresetTable>;
File without changes
@@ -619,6 +619,17 @@ Object.keys(_variant).forEach(function (key) {
619
619
  }
620
620
  });
621
621
  });
622
+ var _variantPreset = require("./Commons/variant-preset.type.cjs");
623
+ Object.keys(_variantPreset).forEach(function (key) {
624
+ if (key === "default" || key === "__esModule") return;
625
+ if (key in exports && exports[key] === _variantPreset[key]) return;
626
+ Object.defineProperty(exports, key, {
627
+ enumerable: true,
628
+ get: function () {
629
+ return _variantPreset[key];
630
+ }
631
+ });
632
+ });
622
633
  var _direction = require("./Commons/direction.type.cjs");
623
634
  Object.keys(_direction).forEach(function (key) {
624
635
  if (key === "default" || key === "__esModule") return;
@@ -54,6 +54,7 @@ export * from './Commons/rounded.type';
54
54
  export * from './Commons/dimension.type';
55
55
  export * from './Commons/elevation.type';
56
56
  export * from './Commons/variant.type';
57
+ export * from './Commons/variant-preset.type';
57
58
  export * from './Commons/direction.type';
58
59
  export * from './Commons/display.type';
59
60
  export * from './Commons/event.type';
@@ -54,6 +54,7 @@ export * from "./Commons/rounded.type.js";
54
54
  export * from "./Commons/dimension.type.js";
55
55
  export * from "./Commons/elevation.type.js";
56
56
  export * from "./Commons/variant.type.js";
57
+ export * from "./Commons/variant-preset.type.js";
57
58
  export * from "./Commons/direction.type.js";
58
59
  export * from "./Commons/display.type.js";
59
60
  export * from "./Commons/event.type.js";