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.
- package/CHANGELOG.md +142 -0
- package/dist/src/assets/css/main.css +1 -1
- package/dist/src/assets/css/tokens/dark.css +124 -6
- package/dist/src/assets/css/tokens/light.css +62 -3
- package/dist/src/assets/scss/tokens/_dark.scss +124 -6
- package/dist/src/assets/scss/tokens/_light.scss +62 -3
- package/dist/src/components/Audio/OrigamAudio.vue +66 -2
- package/dist/src/components/Chip/OrigamChip.vue +34 -0
- package/dist/src/components/Field/OrigamField.vue +76 -3
- package/dist/src/components/List/OrigamList.vue +90 -3
- package/dist/src/components/Main/OrigamMain.vue +2 -2
- package/dist/src/components/Media/OrigamMediaScrubber.vue +11 -1
- package/dist/src/components/SliderField/OrigamSliderField.vue +138 -3
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +12 -1
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +2 -2
- package/dist/src/components/Switch/OrigamSwitch.vue +32 -0
- package/dist/src/components/TextField/OrigamTextField.vue +3 -1
- package/dist/src/components/Video/OrigamVideo.vue +11 -1
- package/dist/src/composables/Commons/layout.composable.cjs +2 -2
- package/dist/src/composables/Commons/layout.composable.d.ts +16 -2
- package/dist/src/composables/Commons/layout.composable.js +1 -1
- package/dist/src/composables/Commons/theme-props-resolver.composable.cjs +44 -9
- package/dist/src/composables/Commons/theme-props-resolver.composable.d.ts +33 -1
- package/dist/src/composables/Commons/theme-props-resolver.composable.js +42 -10
- package/dist/src/consts/Commons/variant-preset.const.cjs +8 -0
- package/dist/src/consts/Commons/variant-preset.const.d.ts +60 -0
- package/dist/src/consts/Commons/variant-preset.const.js +2 -0
- package/dist/src/consts/index.cjs +11 -0
- package/dist/src/consts/index.d.ts +1 -0
- package/dist/src/consts/index.js +1 -0
- package/dist/src/interfaces/Commons/theme.interface.d.ts +33 -0
- package/dist/src/interfaces/Masonry/masonry.interface.d.ts +2 -2
- package/dist/src/origam.cjs +2 -1
- package/dist/src/origam.js +8 -2
- package/dist/src/types/Commons/variant-preset.type.cjs +1 -0
- package/dist/src/types/Commons/variant-preset.type.d.ts +73 -0
- package/dist/src/types/Commons/variant-preset.type.js +0 -0
- package/dist/src/types/index.cjs +11 -0
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/index.js +1 -0
- package/dist/src/types/tokens.type.d.ts +1 -1
- package/package.json +1 -1
|
@@ -981,14 +981,67 @@ defineExpose({
|
|
|
981
981
|
position: absolute;
|
|
982
982
|
pointer-events: none;
|
|
983
983
|
bottom: calc(100% + 6px);
|
|
984
|
+
/*
|
|
985
|
+
* ⛔ #595 — FAUX POSITIF de `token-var-channels`, a laisser en
|
|
986
|
+
* baseline. `--origam-slider-field---hover-x` est ECRIT PAR
|
|
987
|
+
* INSTANCE, en style inline, par le `pointermove` de ce meme
|
|
988
|
+
* composant (`container.style.setProperty(...)`, ~l.680) et RETIRE
|
|
989
|
+
* au `pointerleave` (`removeProperty`, ~l.703). Une custom property
|
|
990
|
+
* est substituee SUR L ELEMENT QUI LA DECLARE : la declarer a
|
|
991
|
+
* `:root` ferait que, apres `removeProperty`, l infobulle ne
|
|
992
|
+
* retomberait plus sur le repli `0%` mais sur la valeur de la
|
|
993
|
+
* feuille — l infobulle resterait collee a sa derniere position au
|
|
994
|
+
* lieu de revenir au depart. La garde compare des noms, pas des
|
|
995
|
+
* chaines de repli : elle ne peut pas voir la difference.
|
|
996
|
+
*/
|
|
984
997
|
inset-inline-start: var(--origam-slider-field---hover-x, 0%);
|
|
985
998
|
transform: translateX(-50%);
|
|
986
999
|
padding: 3px 6px;
|
|
987
|
-
|
|
988
|
-
|
|
1000
|
+
/*
|
|
1001
|
+
* #595 — EFFONDREMENT. Ces deux lignes lisaient
|
|
1002
|
+
* `var(RUNG1, var(--origam-color__{surface--inverse---bg,
|
|
1003
|
+
* on--inverse---fg}, T))`. Les deux RUNG1 viennent d etre declares
|
|
1004
|
+
* dans les feuilles — AVEC leur `var()` interne recopie verbatim,
|
|
1005
|
+
* donc le canal `--inverse` reste atteignable PAR LA FEUILLE. Le
|
|
1006
|
+
* garder aussi ici etait du poids mort : RUNG1 etant declare,
|
|
1007
|
+
* l echelon 2 du site de lecture est inatteignable par
|
|
1008
|
+
* construction. Retire : zero pixel deplace, deux canaux morts en
|
|
1009
|
+
* moins.
|
|
1010
|
+
*
|
|
1011
|
+
* ⛔ Et les deux noms de l echelon 2 etaient FAUX. Forme d ETAT
|
|
1012
|
+
* (`--inverse---`) d une famille qui n existe pas : zero
|
|
1013
|
+
* declaration dans tout `assets/`. L infobulle retombait donc
|
|
1014
|
+
* eternellement sur son repli sombre en dur, qui n inversait
|
|
1015
|
+
* JAMAIS. Les vrais noms existaient a cote depuis toujours, et ils
|
|
1016
|
+
* inversent — mesure en Chromium le 2026-09-29, data-theme pilote :
|
|
1017
|
+
*
|
|
1018
|
+
* --origam-color__surface---inverse light #171717 dark #ffffff
|
|
1019
|
+
* --origam-color__text---inverse light #ffffff dark #0a0a0a
|
|
1020
|
+
*
|
|
1021
|
+
* La DECLARATION de chaque RUNG1, dans les quatre feuilles, pointe
|
|
1022
|
+
* maintenant sur eux. C est la que vit la correction : RUNG1 etant
|
|
1023
|
+
* declare, le repli ecrit ici ne serait jamais atteint — corriger
|
|
1024
|
+
* ce fichier seul n aurait rien change.
|
|
1025
|
+
*
|
|
1026
|
+
* ⚠️ Ceci CHANGE le rendu, volontairement : l infobulle inverse
|
|
1027
|
+
* enfin (surface claire + texte sombre en mode sombre). Avant, les
|
|
1028
|
+
* deux tokens rendaient la MEME valeur dans les deux modes.
|
|
1029
|
+
*/
|
|
1030
|
+
background: var(--origam-slider-field__hover-tooltip---background-color, rgba(0, 0, 0, 0.85));
|
|
1031
|
+
color: var(--origam-slider-field__hover-tooltip---color, #ffffff);
|
|
989
1032
|
font-size: 11px;
|
|
990
1033
|
font-weight: 600;
|
|
991
|
-
|
|
1034
|
+
/*
|
|
1035
|
+
* #595 — REFERENCE CORRIGEE : lisait `var(--origam-font---family, …)`,
|
|
1036
|
+
* un nom que AUCUNE feuille ne declare (zero occurrence en partie
|
|
1037
|
+
* gauche dans `assets/`). Ce composant retombait donc toujours sur
|
|
1038
|
+
* `system-ui` et ignorait la police du DS. Le barreau reel est
|
|
1039
|
+
* `--origam-font__family---sans` (primitive.css) = `Inter, 'Helvetica
|
|
1040
|
+
* Neue', Arial, sans-serif`. ⚠️ Change le rendu, volontairement. Le
|
|
1041
|
+
* repli `system-ui, sans-serif` reste en ceinture de securite si la
|
|
1042
|
+
* feuille de primitives n est pas chargee.
|
|
1043
|
+
*/
|
|
1044
|
+
font-family: var(--origam-font__family---sans, system-ui, sans-serif);
|
|
992
1045
|
border-radius: 3px;
|
|
993
1046
|
white-space: nowrap;
|
|
994
1047
|
z-index: 4;
|
|
@@ -1099,6 +1152,22 @@ defineExpose({
|
|
|
1099
1152
|
height: 100%;
|
|
1100
1153
|
display: flex;
|
|
1101
1154
|
justify-content: center;
|
|
1155
|
+
/*
|
|
1156
|
+
* ⛔ #595, trouvaille hors perimetre : le repli `2` est SANS
|
|
1157
|
+
* UNITE. `width: 2` est invalide et `calc(2 + 2px)` aussi — le
|
|
1158
|
+
* navigateur jette la declaration entiere. Tant que
|
|
1159
|
+
* `OrigamSliderFieldTrack` n ecrit pas
|
|
1160
|
+
* `--origam-slider-field-track---size` en inline (il ne le fait
|
|
1161
|
+
* que si la prop `size` est fournie), TOUTES les regles de
|
|
1162
|
+
* largeur du mode vertical sont mortes. Meme famille que la
|
|
1163
|
+
* gouttiere d `OrigamRow` (#568) et que le garde
|
|
1164
|
+
* `unitless-zero-in-calc`.
|
|
1165
|
+
*
|
|
1166
|
+
* Non corrige ici : declarer le token ou unifier le repli a
|
|
1167
|
+
* `2px` REPARERAIT le rendu, donc le changerait — hors du
|
|
1168
|
+
* contrat « zero pixel deplace » de ce lot. Signale sans
|
|
1169
|
+
* ticket (consigne du lot).
|
|
1170
|
+
*/
|
|
1102
1171
|
width: calc(var(--origam-slider-field-track---size, 2) + 2px);
|
|
1103
1172
|
|
|
1104
1173
|
.origam-slider-field-track__background {
|
|
@@ -1334,6 +1403,72 @@ defineExpose({
|
|
|
1334
1403
|
}
|
|
1335
1404
|
}
|
|
1336
1405
|
|
|
1406
|
+
/*
|
|
1407
|
+
* ⛔ #595 — SEIZE tokens `--origam-slider-field*` que les feuilles
|
|
1408
|
+
* declarent et que ce SCSS ne lit pas. Ils restent en baseline
|
|
1409
|
+
* `token-var-channels-dormant.json` ; raison par famille :
|
|
1410
|
+
*
|
|
1411
|
+
* · `__thumb---border-color` (surface---default) — DEUXIEME grammaire
|
|
1412
|
+
* pour la meme propriete. La grammaire VIVANTE est
|
|
1413
|
+
* `--origam-slider-field-thumb__surface---border-color`, lue trois
|
|
1414
|
+
* lignes plus bas, et `packages/marketing/src/themes/ecom.theme.ts`
|
|
1415
|
+
* la surcharge deja (`#e11d48`). Renommer la lecture casserait ce
|
|
1416
|
+
* theme ; c est donc le nom `-thumb__surface-` qui vient d etre
|
|
1417
|
+
* declare, et celui-ci qui reste dormant ;
|
|
1418
|
+
* · `__thumb---border-width` (border__width---2 = 2px) — le pouce livre
|
|
1419
|
+
* `border: 1px solid` ; `__thumb---box-shadow` (shadow---sm) — il
|
|
1420
|
+
* livre `box-shadow: none`. Cabler l un ou l autre change le rendu ;
|
|
1421
|
+
* · `__thumb---focus-ring-color`, `---focus-ring-width`,
|
|
1422
|
+
* `---scale-hover`, `---scale-active` — l anneau et l agrandissement
|
|
1423
|
+
* sont dessines par `&__surface:before` (`transform: scale(2)`,
|
|
1424
|
+
* `opacity: .12/.04`), pas par un anneau dimensionne : aucune
|
|
1425
|
+
* declaration a remplacer ;
|
|
1426
|
+
* · `---opacity-disabled` (opacity---32 = 0.32) — le rendu desactive est
|
|
1427
|
+
* `opacity: 0.38` ;
|
|
1428
|
+
* · `---padding-block` (space---2) — aucune declaration `padding-block`
|
|
1429
|
+
* sur la racine ;
|
|
1430
|
+
* · `---transition-duration` (motion---fast), `---transition-timing-
|
|
1431
|
+
* function` (easing---standard) — les transitions sont des raccourcis
|
|
1432
|
+
* multi-proprietes ecrits en dur (0.15s/0.2s/0.3s/120ms) ;
|
|
1433
|
+
* · les trois `__label---{color,font-size,padding}` — le libelle est
|
|
1434
|
+
* rendu par `OrigamLabel`, qui lit `--origam-label---*` ;
|
|
1435
|
+
* · `__tick---size` (4px) — la taille du tick est ECRITE EN INLINE par
|
|
1436
|
+
* `OrigamSliderFieldTrack` (`convertToUnit(props.tickSize)`) sous le
|
|
1437
|
+
* nom `--origam-slider-field-track__tick---size` : c est une valeur
|
|
1438
|
+
* d instance, pas un canal de theme ;
|
|
1439
|
+
* · `__track---height` (4px) — `.origam-slider-field__track` existe dans
|
|
1440
|
+
* le template mais aucune regle ne lui donne de hauteur ; la hauteur
|
|
1441
|
+
* vivante est celle de `.origam-slider-field-track` (sous-composant).
|
|
1442
|
+
*
|
|
1443
|
+
* ⛔ `--origam-slider-field---track-size` : FAUX POSITIF de la garde, a
|
|
1444
|
+
* laisser en baseline et surtout a NE PAS declarer.
|
|
1445
|
+
*
|
|
1446
|
+
* Il est ECRIT PAR INSTANCE, inconditionnellement, par `sliderFieldStyles`
|
|
1447
|
+
* (~l.1018) : `convertToUnit(trackProps.size ?? 4)`. Ce style inline est
|
|
1448
|
+
* pose sur la RACINE des deux variantes (`<origam-input>` et `<section>`),
|
|
1449
|
+
* donc tout le sous-arbre en herite et les HUIT sites de lecture prennent
|
|
1450
|
+
* cette valeur. Mesure en Chromium le 2026-09-29, trois variants de la
|
|
1451
|
+
* story, bloc `--horizontal` present :
|
|
1452
|
+
*
|
|
1453
|
+
* style inline sur la racine --origam-slider-field---track-size: 4px
|
|
1454
|
+
* token relu sur la racine 4px
|
|
1455
|
+
* token relu sur la piste 4px
|
|
1456
|
+
* hauteur rendue de la piste 4px <- la regle au repli 14px
|
|
1457
|
+
*
|
|
1458
|
+
* ⚠️ Deux consequences, contre-intuitives toutes les deux :
|
|
1459
|
+
*
|
|
1460
|
+
* 1. Les replis `14px` des six lignes du bloc `--horizontal` sont du CODE
|
|
1461
|
+
* MORT : ils ne sont jamais atteints, la piste horizontale mesure 4px.
|
|
1462
|
+
* Il n y a donc PAS « deux camps » a arbitrer — la lecture precedente
|
|
1463
|
+
* de ce commentaire, qui annoncait un arbitrage entre 4px et 14px,
|
|
1464
|
+
* etait fausse : elle comparait des textes de repli sans verifier
|
|
1465
|
+
* lequel s applique.
|
|
1466
|
+
* 2. Le declarer a `:root` serait INERTE : l ecriture inline sur la
|
|
1467
|
+
* racine bat une declaration de feuille pour tout le sous-arbre. Un
|
|
1468
|
+
* theme qui le reglerait ne verrait RIEN changer — on annoncerait un
|
|
1469
|
+
* canal qui ne fonctionne pas. C est exactement le motif que la
|
|
1470
|
+
* campagne interdit de cabler.
|
|
1471
|
+
*/
|
|
1337
1472
|
.origam-slider-field-thumb {
|
|
1338
1473
|
$this: &;
|
|
1339
1474
|
|
|
@@ -271,7 +271,18 @@ defineExpose({
|
|
|
271
271
|
position: absolute;
|
|
272
272
|
opacity: 0;
|
|
273
273
|
transition: 0.2s opacity cubic-bezier(0.4, 0, 0.2, 1);
|
|
274
|
-
|
|
274
|
+
// #595 — remplacement litteral : la valeur livree (`2px`) est
|
|
275
|
+
// desormais lue depuis son token, dont la feuille a ete realignee
|
|
276
|
+
// sur elle (elle annoncait `radius---full`, soit 9999px). Zero
|
|
277
|
+
// pixel deplace, un canal de theme de plus.
|
|
278
|
+
//
|
|
279
|
+
// ⛔ `--origam-slider-field-track__tick---size` juste en dessous
|
|
280
|
+
// reste NON declare a dessein : OrigamSliderFieldTrack l ecrit en
|
|
281
|
+
// style INLINE par instance (`convertToUnit(props.tickSize)`,
|
|
282
|
+
// ligne ~152). Le declarer a `:root` remplacerait le repli par une
|
|
283
|
+
// valeur de feuille des que la prop est absente — un changement de
|
|
284
|
+
// rendu, pas un canal.
|
|
285
|
+
border-radius: var(--origam-slider-field__tick---border-radius, 2px);
|
|
275
286
|
width: var(--origam-slider-field-track__tick---size, 2);
|
|
276
287
|
height: var(--origam-slider-field-track__tick---size, 2);
|
|
277
288
|
transform: translate(calc(var(--origam-slider-field-track__tick---size, 2) / -2), calc(var(--origam-slider-field-track__tick---size, 2) / -2));
|
|
@@ -92,7 +92,7 @@ import OrigamOverlay from "../Overlay/OrigamOverlay.vue";
|
|
|
92
92
|
import OrigamSnack from "../Transition/OrigamSnack.vue";
|
|
93
93
|
import OrigamSnackbarItem from "./OrigamSnackbarItem.vue";
|
|
94
94
|
import { useBothColor } from "../../composables/Commons/bothColor.composable";
|
|
95
|
-
import {
|
|
95
|
+
import { useLayoutMain } from "../../composables/Commons/layout.composable";
|
|
96
96
|
import { usePosition } from "../../composables/Commons/position.composable";
|
|
97
97
|
import { useProps } from "../../composables/Commons/props.composable";
|
|
98
98
|
import { useScopeId } from "../../composables/Commons/scopeId.composable";
|
|
@@ -216,7 +216,7 @@ const mainStyles = ref();
|
|
|
216
216
|
const hasLayout = inject(ORIGAM_LAYOUT_KEY, void 0);
|
|
217
217
|
const timerKey = shallowRef(0);
|
|
218
218
|
useToggleScope(() => !!hasLayout, () => {
|
|
219
|
-
const layout =
|
|
219
|
+
const layout = useLayoutMain();
|
|
220
220
|
watchEffect(() => {
|
|
221
221
|
mainStyles.value = layout.mainStyles.value;
|
|
222
222
|
});
|
|
@@ -571,6 +571,38 @@ defineExpose({
|
|
|
571
571
|
background-color: currentColor;
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
+
/*
|
|
575
|
+
* ⛔ #595 — DOUZE tokens `--origam-switch__*` que les feuilles declarent
|
|
576
|
+
* et que ce SCSS ne lit PAS. Mesure du 2026-09-27 : dans les douze cas la
|
|
577
|
+
* feuille decrit une intention de design que le SCSS n a jamais
|
|
578
|
+
* implementee, et la cabler DEPLACERAIT le rendu. Ils restent donc en
|
|
579
|
+
* baseline `token-var-channels-dormant.json`, ici est la raison :
|
|
580
|
+
*
|
|
581
|
+
* · `__thumb---background-color-checked` (surface---default) — le pouce
|
|
582
|
+
* coche est peint `currentColor` par les regles `:has()` ci-dessus, pas
|
|
583
|
+
* par un token : la valeur declaree est une AUTRE couleur ;
|
|
584
|
+
* · `__thumb---background-color-disabled` (surface---overlay),
|
|
585
|
+
* `__thumb---box-shadow` (shadow---sm) — aucune declaration
|
|
586
|
+
* correspondante n existe sur le pouce (ni fond desactive, ni ombre) :
|
|
587
|
+
* les ajouter serait ajouter une propriete ABSENTE du rendu, ce que la
|
|
588
|
+
* regle de securite de #550 interdit apres un revert ;
|
|
589
|
+
* · `__thumb---transition-duration` (motion---medium) — la transition du
|
|
590
|
+
* pouce est un raccourci multi-proprietes ecrit en dur a 0.15s/0.2s ;
|
|
591
|
+
* · `__thumb---translate-distance` (20px) — le deplacement est pose en
|
|
592
|
+
* `translateX(±10px)` sur `.origam-selection-control__input`, soit la
|
|
593
|
+
* MOITIE du token. Cabler par le nom exigerait un `calc()` derive ;
|
|
594
|
+
* · `__track---background-color-checked` (action--primary---bg) — le rail
|
|
595
|
+
* coche est peint par `bgColor` / la classe utilitaire, pas par une
|
|
596
|
+
* regle `--dirty` ;
|
|
597
|
+
* · `__input---opacity` (0) — aucune classe `.origam-switch__input` :
|
|
598
|
+
* l input natif appartient a `OrigamSelectionControl` ;
|
|
599
|
+
* · les cinq `__label---*` (color, color-disabled, color-error,
|
|
600
|
+
* font-size, padding-inline) — le libelle est rendu par `OrigamLabel`,
|
|
601
|
+
* qui lit `--origam-label---*`. La seule regle que Switch pose sur lui
|
|
602
|
+
* est `padding-inline-start: 10px`, quand le token vaut `space---2`
|
|
603
|
+
* (8px) : cabler decalerait chaque libelle de 2px, et le nom
|
|
604
|
+
* `padding-inline` mentirait sur une regle qui ne touche que `-start`.
|
|
605
|
+
*/
|
|
574
606
|
&__thumb {
|
|
575
607
|
align-items: center;
|
|
576
608
|
background-color: var(--origam-switch__thumb---background-color, rgb(255, 255, 255));
|
|
@@ -487,7 +487,9 @@ const enrichedRules = computed(() => {
|
|
|
487
487
|
}
|
|
488
488
|
return base;
|
|
489
489
|
});
|
|
490
|
-
const
|
|
490
|
+
const filteredAttrs = computed(() => filterInputAttrs(attrs));
|
|
491
|
+
const rootAttrs = computed(() => filteredAttrs.value[0]);
|
|
492
|
+
const inputAttrs = computed(() => filteredAttrs.value[1]);
|
|
491
493
|
const inputProps = computed(() => {
|
|
492
494
|
return origamInputRef.value?.filterProps(props, ["modelValue", "class", "style", "focused", ...BORDER_PROP_KEYS]);
|
|
493
495
|
});
|
|
@@ -956,7 +956,17 @@ defineExpose({
|
|
|
956
956
|
.origam-video__skip-ripple-label {
|
|
957
957
|
font-size: 13px;
|
|
958
958
|
font-weight: 600;
|
|
959
|
-
|
|
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.
|
|
6
|
+
exports.useLayoutMain = useLayoutMain;
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
var _layout = require("../../consts/Commons/layout.const.cjs");
|
|
9
|
-
function
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
70
|
+
addSetKeys(globalKeys, targetKeys);
|
|
71
|
+
addObjectKeys(providerOwnKeys, targetKeys);
|
|
72
|
+
addObjectKeys(providerGlobalKeys, targetKeys);
|
|
73
|
+
addPresetKeys(presetTable, targetKeys);
|
|
48
74
|
return targetKeys;
|
|
49
75
|
}
|
|
50
|
-
function
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
addSetKeys(globalKeys, targetKeys);
|
|
61
|
+
addObjectKeys(providerOwnKeys, targetKeys);
|
|
62
|
+
addObjectKeys(providerGlobalKeys, targetKeys);
|
|
63
|
+
addPresetKeys(presetTable, targetKeys);
|
|
41
64
|
return targetKeys;
|
|
42
65
|
}
|
|
43
|
-
function
|
|
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
|
|
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 = {};
|