origam 2.17.1 → 2.18.1
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 +895 -0
- package/dist/src/assets/css/main.css +1 -1
- package/dist/src/assets/css/tokens/dark.css +193 -26
- package/dist/src/assets/css/tokens/light.css +78 -11
- package/dist/src/assets/locales/en.json +21 -6
- package/dist/src/assets/locales/fr.json +21 -6
- package/dist/src/assets/scss/main.scss +10 -2
- package/dist/src/assets/scss/tokens/_dark.scss +2914 -13
- package/dist/src/assets/scss/tokens/_light.scss +78 -11
- package/dist/src/components/Alert/OrigamAlert.vue +6 -6
- package/dist/src/components/Avatar/OrigamAvatar.vue +15 -2
- package/dist/src/components/Badge/OrigamBadge.vue +7 -7
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +23 -4
- package/dist/src/components/Btn/OrigamBtn.vue +22 -16
- package/dist/src/components/Btn/OrigamBtnGroup.vue +1 -1
- package/dist/src/components/Calendar/OrigamCalendar.vue +1 -1
- package/dist/src/components/Card/OrigamCard.vue +2 -0
- package/dist/src/components/Card/OrigamCardHeader.vue +7 -7
- package/dist/src/components/Carousel/OrigamCarousel.vue +14 -1
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +1 -1
- package/dist/src/components/Chart/OrigamChartBullet.vue +3 -2
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +2 -2
- package/dist/src/components/Chart/OrigamChartCartesian.vue +49 -4
- package/dist/src/components/Chart/OrigamChartLegend.vue +39 -18
- package/dist/src/components/Chart/OrigamChartPareto.vue +7 -1
- package/dist/src/components/Chart/OrigamChartPictorial.vue +2 -2
- package/dist/src/components/Chart/OrigamChartRadar.vue +3 -1
- package/dist/src/components/Chart/OrigamChartSparkline.vue +3 -1
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +2 -1
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +2 -0
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +36 -11
- package/dist/src/components/Chip/OrigamChip.vue +19 -4
- package/dist/src/components/Code/OrigamCode.vue +20 -3
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +30 -5
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +3 -3
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +6 -6
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +0 -4
- package/dist/src/components/DataList/OrigamDataList.vue +2 -0
- package/dist/src/components/DataList/OrigamDataText.vue +6 -6
- package/dist/src/components/DataList/OrigamDataTitle.vue +6 -6
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +1 -1
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +4 -1
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +2 -0
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +6 -6
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +21 -1
- package/dist/src/components/Dialog/OrigamDialog.vue +25 -0
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +6 -0
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +2 -0
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +6 -6
- package/dist/src/components/Field/OrigamField.vue +47 -15
- package/dist/src/components/FileField/OrigamFileField.vue +5 -1
- package/dist/src/components/Icon/OrigamSvgIcon.vue +3 -1
- package/dist/src/components/Img/OrigamImg.vue +9 -2
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +34 -18
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +46 -5
- package/dist/src/components/Input/OrigamInput.vue +6 -6
- package/dist/src/components/List/OrigamListGroup.vue +4 -0
- package/dist/src/components/List/OrigamListItem.vue +68 -4
- package/dist/src/components/Masonry/OrigamMasonry.vue +18 -2
- package/dist/src/components/Menu/OrigamMenu.vue +79 -9
- package/dist/src/components/NumberField/OrigamNumberField.vue +13 -3
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +35 -11
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +5 -1
- package/dist/src/components/Radio/OrigamRadio.vue +2 -0
- package/dist/src/components/Radio/OrigamRadioGroup.vue +36 -11
- package/dist/src/components/RatingField/OrigamRatingField.vue +58 -7
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +78 -30
- package/dist/src/components/Select/OrigamSelect.vue +44 -21
- package/dist/src/components/SliderField/OrigamSliderField.vue +20 -10
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +1 -1
- package/dist/src/components/Switch/OrigamSwitch.vue +2 -0
- package/dist/src/components/Tabs/OrigamTab.vue +7 -4
- package/dist/src/components/Tabs/OrigamTabPanel.vue +4 -2
- package/dist/src/components/Tabs/OrigamTabs.vue +7 -5
- package/dist/src/components/TextField/OrigamTextField.vue +5 -1
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +5 -1
- package/dist/src/components/Transition/OrigamExpandX.vue +19 -3
- package/dist/src/components/Transition/OrigamExpandY.vue +19 -3
- package/dist/src/components/Transition/OrigamTranslateScale.vue +26 -4
- package/dist/src/components/Video/OrigamVideo.vue +3 -2
- package/dist/src/components/Window/OrigamWindow.vue +20 -3
- package/dist/src/composables/Commons/accessibleCommand.composable.cjs +26 -0
- package/dist/src/composables/Commons/accessibleCommand.composable.d.ts +78 -0
- package/dist/src/composables/Commons/accessibleCommand.composable.js +20 -0
- package/dist/src/composables/Commons/activator.composable.cjs +10 -1
- package/dist/src/composables/Commons/activator.composable.js +11 -2
- package/dist/src/composables/Commons/adjacent.composable.cjs +17 -0
- package/dist/src/composables/Commons/adjacent.composable.d.ts +12 -0
- package/dist/src/composables/Commons/adjacent.composable.js +17 -0
- package/dist/src/composables/Commons/adjacentInner.composable.cjs +20 -0
- package/dist/src/composables/Commons/adjacentInner.composable.d.ts +24 -5
- package/dist/src/composables/Commons/adjacentInner.composable.js +20 -0
- package/dist/src/composables/Commons/audio.composable.cjs +14 -1
- package/dist/src/composables/Commons/audio.composable.js +14 -1
- package/dist/src/composables/Commons/backButton.composable.cjs +3 -1
- package/dist/src/composables/Commons/backButton.composable.js +3 -1
- package/dist/src/composables/Commons/border.composable.d.ts +13 -0
- package/dist/src/composables/Commons/colorEffect.composable.cjs +58 -46
- package/dist/src/composables/Commons/colorEffect.composable.d.ts +10 -5
- package/dist/src/composables/Commons/colorEffect.composable.js +70 -46
- package/dist/src/composables/Commons/createLayout.composable.cjs +21 -12
- package/dist/src/composables/Commons/createLayout.composable.js +21 -12
- package/dist/src/composables/Commons/delay.composable.d.ts +16 -0
- package/dist/src/composables/Commons/dimension.composable.d.ts +11 -0
- package/dist/src/composables/Commons/elevation.composable.cjs +6 -2
- package/dist/src/composables/Commons/elevation.composable.d.ts +37 -1
- package/dist/src/composables/Commons/elevation.composable.js +7 -2
- package/dist/src/composables/Commons/goTo.composable.cjs +4 -2
- package/dist/src/composables/Commons/goTo.composable.js +5 -3
- package/dist/src/composables/Commons/group.composable.cjs +14 -14
- package/dist/src/composables/Commons/group.composable.js +14 -14
- package/dist/src/composables/Commons/hotkey.composable.d.ts +18 -7
- package/dist/src/composables/Commons/hydration.composable.d.ts +8 -0
- package/dist/src/composables/Commons/link.composable.d.ts +20 -0
- package/dist/src/composables/Commons/locationStrategies.composable.d.ts +17 -0
- package/dist/src/composables/Commons/message.composable.d.ts +19 -5
- package/dist/src/composables/Commons/position.composable.d.ts +17 -6
- package/dist/src/composables/Commons/refs.composable.d.ts +11 -5
- package/dist/src/composables/Commons/rounded.composable.d.ts +11 -1
- package/dist/src/composables/Commons/scrolling.composable.cjs +15 -12
- package/dist/src/composables/Commons/scrolling.composable.js +15 -12
- package/dist/src/composables/Commons/size.composable.d.ts +15 -0
- package/dist/src/composables/Commons/ssrBoot.composable.cjs +9 -1
- package/dist/src/composables/Commons/ssrBoot.composable.js +10 -2
- package/dist/src/composables/Commons/stack.composable.cjs +13 -1
- package/dist/src/composables/Commons/stack.composable.js +13 -1
- package/dist/src/composables/Commons/theme-props-resolver.composable.cjs +41 -32
- package/dist/src/composables/Commons/theme-props-resolver.composable.js +41 -32
- package/dist/src/composables/Commons/validation.composable.cjs +3 -3
- package/dist/src/composables/Commons/validation.composable.js +3 -3
- package/dist/src/composables/Commons/virtual.composable.cjs +24 -8
- package/dist/src/composables/Commons/virtual.composable.js +24 -8
- package/dist/src/composables/Masonry/masonry.composable.cjs +18 -11
- package/dist/src/composables/Masonry/masonry.composable.js +18 -11
- package/dist/src/composables/Parallax/parallax.composable.cjs +1 -1
- package/dist/src/composables/Parallax/parallax.composable.js +1 -1
- package/dist/src/composables/index.cjs +36 -0
- package/dist/src/composables/index.d.ts +3 -0
- package/dist/src/composables/index.js +3 -0
- package/dist/src/consts/Chart/chart-cartesian.const.cjs +5 -2
- package/dist/src/consts/Chart/chart-cartesian.const.d.ts +42 -0
- package/dist/src/consts/Chart/chart-cartesian.const.js +3 -0
- package/dist/src/consts/Commons/elevation.const.cjs +5 -1
- package/dist/src/consts/Commons/elevation.const.d.ts +52 -2
- package/dist/src/consts/Commons/elevation.const.js +4 -0
- package/dist/src/consts/Commons/ripple.const.cjs +13 -3
- package/dist/src/consts/Commons/ripple.const.js +13 -3
- package/dist/src/consts/RatingField/rating-field.const.cjs +10 -0
- package/dist/src/consts/RatingField/rating-field.const.d.ts +36 -0
- package/dist/src/consts/RatingField/rating-field.const.js +12 -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/directives/ClickOutside/clickOutside.directive.cjs +2 -0
- package/dist/src/directives/ClickOutside/clickOutside.directive.js +2 -0
- package/dist/src/directives/Ripple/ripple.directive.cjs +2 -0
- package/dist/src/directives/Ripple/ripple.directive.js +2 -0
- package/dist/src/enums/Commons/color.enum.cjs +0 -1
- package/dist/src/enums/Commons/color.enum.d.ts +14 -5
- package/dist/src/enums/Commons/color.enum.js +0 -1
- package/dist/src/enums/Sheet/sheet.enum.d.ts +1 -1
- package/dist/src/interfaces/Btn/btn.interface.d.ts +7 -10
- package/dist/src/interfaces/Chart/chart-cartesian.interface.d.ts +6 -2
- package/dist/src/interfaces/Commons/activator.interface.d.ts +3 -2
- package/dist/src/interfaces/Commons/adjacent.interface.d.ts +29 -0
- package/dist/src/interfaces/Commons/group.interface.d.ts +13 -2
- package/dist/src/interfaces/Commons/ripple.interface.d.ts +16 -0
- package/dist/src/interfaces/Commons/scroll.interface.d.ts +3 -2
- package/dist/src/interfaces/DataTable/data-table-header.interface.d.ts +2 -2
- package/dist/src/interfaces/DatePicker/date-picker-month.interface.d.ts +2 -1
- package/dist/src/interfaces/Menu/menu.interface.d.ts +28 -1
- package/dist/src/interfaces/OtpInputField/otp-input-field.interface.d.ts +21 -1
- package/dist/src/interfaces/RatingField/rating-field-item.interface.d.ts +16 -1
- package/dist/src/interfaces/index.cjs +11 -0
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/interfaces/index.js +1 -0
- package/dist/src/nuxt/module.cjs +2 -1
- package/dist/src/nuxt/module.js +2 -1
- package/dist/src/origam.cjs +1 -2
- package/dist/src/origam.js +1 -2
- package/dist/src/themes/origam.theme.cjs +8 -14
- package/dist/src/themes/origam.theme.js +6 -8
- package/dist/src/types/Commons/color.type.d.ts +4 -3
- package/dist/src/types/Commons/commons.type.d.ts +33 -0
- package/dist/src/types/Commons/theme.type.d.ts +2 -1
- package/dist/src/types/Sheet/sheet.type.d.ts +2 -1
- package/dist/src/types/index.cjs +22 -0
- package/dist/src/types/index.d.ts +2 -0
- package/dist/src/types/index.js +2 -0
- package/dist/src/types/tokens.type.d.ts +1 -1
- package/dist/src/utils/Commons/a11y.util.cjs +35 -0
- package/dist/src/utils/Commons/a11y.util.d.ts +63 -0
- package/dist/src/utils/Commons/a11y.util.js +33 -0
- package/dist/src/utils/Commons/clickOutside.util.cjs +5 -1
- package/dist/src/utils/Commons/clickOutside.util.js +5 -1
- package/dist/src/utils/Commons/color.util.cjs +10 -15
- package/dist/src/utils/Commons/color.util.d.ts +34 -28
- package/dist/src/utils/Commons/color.util.js +9 -16
- package/dist/src/utils/Commons/goTo.util.cjs +31 -14
- package/dist/src/utils/Commons/goTo.util.d.ts +1 -1
- package/dist/src/utils/Commons/goTo.util.js +31 -16
- package/dist/src/utils/Commons/location.util.cjs +18 -3
- package/dist/src/utils/Commons/location.util.js +18 -3
- package/dist/src/utils/Commons/ripple.util.cjs +5 -1
- package/dist/src/utils/Commons/ripple.util.js +5 -1
- package/dist/src/utils/index.cjs +11 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/package.json +13 -2
- package/dist/src/consts/Btn/btn.const.cjs +0 -7
- package/dist/src/consts/Btn/btn.const.d.ts +0 -32
- package/dist/src/consts/Btn/btn.const.js +0 -1
- package/dist/src/types/Commons/locale.type.cjs +0 -1
- package/dist/src/types/Commons/locale.type.d.ts +0 -0
- package/dist/src/types/Commons/locale.type.js +0 -0
|
@@ -19,6 +19,10 @@ function isOrigamRung(value) {
|
|
|
19
19
|
function isUtilityRung(value) {
|
|
20
20
|
return typeof value === "string" && _elevation.UTILITY_SHADOW_RUNGS.has(value);
|
|
21
21
|
}
|
|
22
|
+
function shadowVar(rung) {
|
|
23
|
+
const fallback = _elevation.SHADOW_RUNG_FALLBACK[rung];
|
|
24
|
+
return `var(${_elevation.SHADOW_TOKEN_PREFIX}${rung}${fallback ? `, ${fallback}` : ""})`;
|
|
25
|
+
}
|
|
22
26
|
const _bgWarned = /* @__PURE__ */new WeakSet();
|
|
23
27
|
function warnBgColorUsage(bgColor) {
|
|
24
28
|
if (typeof console === "undefined" || !bgColor) return;
|
|
@@ -56,7 +60,7 @@ function useElevation(props, flat = (0, _vue.ref)(false), bgColor = (0, _vue.ref
|
|
|
56
60
|
const styles = [];
|
|
57
61
|
if (elevation == null || flat.value) return styles;
|
|
58
62
|
if (isOrigamRung(elevation)) {
|
|
59
|
-
styles.push(`box-shadow:
|
|
63
|
+
styles.push(`box-shadow: ${shadowVar(elevation)}`);
|
|
60
64
|
return styles;
|
|
61
65
|
}
|
|
62
66
|
if (typeof elevation === "string" && (0, _elevation2.isCustomBoxShadow)(elevation)) {
|
|
@@ -66,7 +70,7 @@ function useElevation(props, flat = (0, _vue.ref)(false), bgColor = (0, _vue.ref
|
|
|
66
70
|
const numeric = typeof elevation === "string" ? parseInt(elevation, 10) : elevation;
|
|
67
71
|
if (Number.isNaN(numeric)) return styles;
|
|
68
72
|
const tokenName = elevationToToken(numeric);
|
|
69
|
-
styles.push(`box-shadow:
|
|
73
|
+
styles.push(`box-shadow: ${shadowVar(tokenName)}`);
|
|
70
74
|
return styles;
|
|
71
75
|
});
|
|
72
76
|
return {
|
|
@@ -15,10 +15,46 @@ import { TElevation } from '../../types/Commons/elevation.type';
|
|
|
15
15
|
* jamais l'un a la place de l'autre (strategie A, cf. CLAUDE.md racine).
|
|
16
16
|
*
|
|
17
17
|
* @description
|
|
18
|
+
* ⚠️ `2xl` et `3xl` RENDENT COMME `xl` — #813, corrige par un repli.
|
|
19
|
+
* `ORIGAM_SHADOW_RUNGS` declare huit echelons, les feuilles n'en declarent
|
|
20
|
+
* que six : `--origam-shadow---2xl` et `---3xl` n'existent dans aucune
|
|
21
|
+
* feuille du DS. On emettait la reference NUE, et un `var()` non resolu
|
|
22
|
+
* rend la declaration invalide AU COMPUTED-VALUE TIME : la propriete
|
|
23
|
+
* calcule `unset`, et `box-shadow` n'etant pas heritee, cela vaut `none`.
|
|
24
|
+
* La declaration gagnait pourtant la cascade : elle ne cedait donc pas la
|
|
25
|
+
* place a la regle scopee du composant, elle l'EFFACAIT. Mesure Chromium —
|
|
26
|
+
* regle du composant seule `rgba(0,0,0,.9) 0px 1px 2px 0px`, avec
|
|
27
|
+
* `elevation="2xl"` : `none`.
|
|
28
|
+
*
|
|
29
|
+
* @description
|
|
30
|
+
* Ces deux echelons passent desormais par `SHADOW_RUNG_FALLBACK`, comme
|
|
31
|
+
* `useRounded` le fait depuis toujours via `UTILITY_RADIUS_FALLBACK` — ce
|
|
32
|
+
* qui explique que le canal `rounded` n'ait jamais eu ce defaut. ⚠️ Ils
|
|
33
|
+
* rendent donc EXACTEMENT comme `xl` : ils cessent d'effacer, ils ne
|
|
34
|
+
* deviennent pas deux echelons de plus. Declarer de vrais tokens est une
|
|
35
|
+
* decision de DESIGN — `xl` est deja le sommet de l'echelle Material 0..24
|
|
36
|
+
* que ce composable mappe (`MATERIAL_ELEVATION_TOP_RUNG`), il n'y a aucun
|
|
37
|
+
* echelon au-dessus a emprunter. Le jour ou ces tokens existeront, le repli
|
|
38
|
+
* deviendra inerte tout seul.
|
|
39
|
+
*
|
|
40
|
+
* @description
|
|
41
|
+
* ⛔ Le garde `token-var-channels` ne voit toujours RIEN de tout ceci : la
|
|
42
|
+
* reference est concatenee en TypeScript, pas ecrite dans une feuille.
|
|
43
|
+
* C'est l'angle mort structurel suivi par #823 — 90 references `var()`
|
|
44
|
+
* emises depuis du TS, aucune couverte par un garde.
|
|
45
|
+
*
|
|
46
|
+
* @description
|
|
18
47
|
* `bgColor` est accepte pour compatibilite mais IGNORE (n'affecte plus
|
|
19
48
|
* ni `elevationClasses` ni `elevationStyles`) — passer une valeur autre
|
|
20
49
|
* que `ELEVATION_LEGACY_BG_COLOR` declenche un `console.warn` de
|
|
21
|
-
* depreciation une seule fois
|
|
50
|
+
* depreciation. ⚠️ Cette banniere annoncait « une seule fois » : faux.
|
|
51
|
+
* Mesure — trois appels a `useElevation` avec un `bgColor` non defaut
|
|
52
|
+
* produisent TROIS avertissements. La deduplication de `warnBgColorUsage`
|
|
53
|
+
* est inerte : elle interroge un `WeakSet` avec un objet litteral
|
|
54
|
+
* reconstruit a chaque appel, donc `has()` rend toujours `false`. L'appel
|
|
55
|
+
* etant fait dans le corps de `useElevation` et non dans un `computed`,
|
|
56
|
+
* le plafond reste d'un avertissement par MONTAGE de composant, pas par
|
|
57
|
+
* rendu. La detection du
|
|
22
58
|
* `box-shadow` custom passe AVANT le `parseInt` de secours : sans cet
|
|
23
59
|
* ordre, `parseInt('0 4px 12px rgba(0,0,0,.24)', 10)` lirait `0` (chiffre
|
|
24
60
|
* de tete) et resoudrait silencieusement vers l'echelon `none`, perdant
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
MATERIAL_ELEVATION_LADDER,
|
|
7
7
|
MATERIAL_ELEVATION_TOP_RUNG,
|
|
8
8
|
ORIGAM_SHADOW_RUNGS,
|
|
9
|
+
SHADOW_RUNG_FALLBACK,
|
|
9
10
|
SHADOW_TOKEN_PREFIX,
|
|
10
11
|
SHADOW_UTILITY_CLASS_PREFIX,
|
|
11
12
|
UTILITY_SHADOW_RUNGS
|
|
@@ -21,6 +22,10 @@ function isOrigamRung(value) {
|
|
|
21
22
|
function isUtilityRung(value) {
|
|
22
23
|
return typeof value === "string" && UTILITY_SHADOW_RUNGS.has(value);
|
|
23
24
|
}
|
|
25
|
+
function shadowVar(rung) {
|
|
26
|
+
const fallback = SHADOW_RUNG_FALLBACK[rung];
|
|
27
|
+
return `var(${SHADOW_TOKEN_PREFIX}${rung}${fallback ? `, ${fallback}` : ""})`;
|
|
28
|
+
}
|
|
24
29
|
const _bgWarned = /* @__PURE__ */ new WeakSet();
|
|
25
30
|
function warnBgColorUsage(bgColor) {
|
|
26
31
|
if (typeof console === "undefined" || !bgColor) return;
|
|
@@ -56,7 +61,7 @@ export function useElevation(props, flat = ref(false), bgColor = ref(ELEVATION_L
|
|
|
56
61
|
const styles = [];
|
|
57
62
|
if (elevation == null || flat.value) return styles;
|
|
58
63
|
if (isOrigamRung(elevation)) {
|
|
59
|
-
styles.push(`box-shadow:
|
|
64
|
+
styles.push(`box-shadow: ${shadowVar(elevation)}`);
|
|
60
65
|
return styles;
|
|
61
66
|
}
|
|
62
67
|
if (typeof elevation === "string" && isCustomBoxShadow(elevation)) {
|
|
@@ -66,7 +71,7 @@ export function useElevation(props, flat = ref(false), bgColor = ref(ELEVATION_L
|
|
|
66
71
|
const numeric = typeof elevation === "string" ? parseInt(elevation, 10) : elevation;
|
|
67
72
|
if (Number.isNaN(numeric)) return styles;
|
|
68
73
|
const tokenName = elevationToToken(numeric);
|
|
69
|
-
styles.push(`box-shadow:
|
|
74
|
+
styles.push(`box-shadow: ${shadowVar(tokenName)}`);
|
|
70
75
|
return styles;
|
|
71
76
|
});
|
|
72
77
|
return { elevationClasses, elevationStyles };
|
|
@@ -26,11 +26,13 @@ function useGoTo(_options = {}) {
|
|
|
26
26
|
...goToInstance,
|
|
27
27
|
rtl: (0, _vue.computed)(() => goToInstance.rtl.value || isRtl.value)
|
|
28
28
|
};
|
|
29
|
+
const controller = new AbortController();
|
|
30
|
+
(0, _commons.tryOnScopeDispose)(() => controller.abort());
|
|
29
31
|
async function go(target, options) {
|
|
30
|
-
return (0, _goTo2.scrollTo)(target, (0, _commons.mergeDeep)(_options, options), false, goTo);
|
|
32
|
+
return (0, _goTo2.scrollTo)(target, (0, _commons.mergeDeep)(_options, options), false, goTo, controller.signal);
|
|
31
33
|
}
|
|
32
34
|
go.horizontal = async (target, options) => {
|
|
33
|
-
return (0, _goTo2.scrollTo)(target, (0, _commons.mergeDeep)(_options, options), true, goTo);
|
|
35
|
+
return (0, _goTo2.scrollTo)(target, (0, _commons.mergeDeep)(_options, options), true, goTo, controller.signal);
|
|
34
36
|
};
|
|
35
37
|
return go;
|
|
36
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, inject } from "vue";
|
|
2
2
|
import { useRtl } from "./rtl.composable.js";
|
|
3
3
|
import { ORIGAM_GO_TO_KEY } from "../../consts/Commons/goTo.const.js";
|
|
4
|
-
import { mergeDeep } from "../../utils/Commons/commons.util.js";
|
|
4
|
+
import { mergeDeep, tryOnScopeDispose } from "../../utils/Commons/commons.util.js";
|
|
5
5
|
import { genDefaults, scrollTo } from "../../utils/Commons/goTo.util.js";
|
|
6
6
|
export function createGoTo(options, locale) {
|
|
7
7
|
return {
|
|
@@ -17,11 +17,13 @@ export function useGoTo(_options = {}) {
|
|
|
17
17
|
...goToInstance,
|
|
18
18
|
rtl: computed(() => goToInstance.rtl.value || isRtl.value)
|
|
19
19
|
};
|
|
20
|
+
const controller = new AbortController();
|
|
21
|
+
tryOnScopeDispose(() => controller.abort());
|
|
20
22
|
async function go(target, options) {
|
|
21
|
-
return scrollTo(target, mergeDeep(_options, options), false, goTo);
|
|
23
|
+
return scrollTo(target, mergeDeep(_options, options), false, goTo, controller.signal);
|
|
22
24
|
}
|
|
23
25
|
go.horizontal = async (target, options) => {
|
|
24
|
-
return scrollTo(target, mergeDeep(_options, options), true, goTo);
|
|
26
|
+
return scrollTo(target, mergeDeep(_options, options), true, goTo, controller.signal);
|
|
25
27
|
};
|
|
26
28
|
return go;
|
|
27
29
|
}
|
|
@@ -75,21 +75,21 @@ function useGroup(props, injectKey) {
|
|
|
75
75
|
if (props.multiple) (0, _console.consoleWarn)('This method is not supported when using "multiple" prop');
|
|
76
76
|
if (!selected.value.length) {
|
|
77
77
|
const item = items.find(item2 => !item2.disabled);
|
|
78
|
-
if (item)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
if (newItem.disabled) return;
|
|
91
|
-
selected.value = [items[newIndex].id];
|
|
78
|
+
if (!item) return void 0;
|
|
79
|
+
selected.value = [item.id];
|
|
80
|
+
return item.id;
|
|
81
|
+
}
|
|
82
|
+
const currentId = selected.value[0];
|
|
83
|
+
const currentIndex = items.findIndex(i => i.id === currentId);
|
|
84
|
+
let newIndex = (currentIndex + offset) % items.length;
|
|
85
|
+
let newItem = items[newIndex];
|
|
86
|
+
while (newItem.disabled && newIndex !== currentIndex) {
|
|
87
|
+
newIndex = (newIndex + offset) % items.length;
|
|
88
|
+
newItem = items[newIndex];
|
|
92
89
|
}
|
|
90
|
+
if (newItem.disabled) return void 0;
|
|
91
|
+
selected.value = [items[newIndex].id];
|
|
92
|
+
return items[newIndex].id;
|
|
93
93
|
};
|
|
94
94
|
const state = {
|
|
95
95
|
register,
|
|
@@ -76,21 +76,21 @@ export function useGroup(props, injectKey) {
|
|
|
76
76
|
if (props.multiple) consoleWarn('This method is not supported when using "multiple" prop');
|
|
77
77
|
if (!selected.value.length) {
|
|
78
78
|
const item = items.find((item2) => !item2.disabled);
|
|
79
|
-
if (item)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
if (newItem.disabled) return;
|
|
92
|
-
selected.value = [items[newIndex].id];
|
|
79
|
+
if (!item) return void 0;
|
|
80
|
+
selected.value = [item.id];
|
|
81
|
+
return item.id;
|
|
82
|
+
}
|
|
83
|
+
const currentId = selected.value[0];
|
|
84
|
+
const currentIndex = items.findIndex((i) => i.id === currentId);
|
|
85
|
+
let newIndex = (currentIndex + offset) % items.length;
|
|
86
|
+
let newItem = items[newIndex];
|
|
87
|
+
while (newItem.disabled && newIndex !== currentIndex) {
|
|
88
|
+
newIndex = (newIndex + offset) % items.length;
|
|
89
|
+
newItem = items[newIndex];
|
|
93
90
|
}
|
|
91
|
+
if (newItem.disabled) return void 0;
|
|
92
|
+
selected.value = [items[newIndex].id];
|
|
93
|
+
return items[newIndex].id;
|
|
94
94
|
};
|
|
95
95
|
const state = {
|
|
96
96
|
register,
|
|
@@ -5,16 +5,27 @@ import { IHotkeyOptions } from '../../interfaces/Commons/hotkey.interface';
|
|
|
5
5
|
*
|
|
6
6
|
* @description
|
|
7
7
|
* Enregistre un raccourci clavier global (`window.addEventListener`) pour
|
|
8
|
-
* `keys` (une combinaison `"ctrl+k"
|
|
9
|
-
*
|
|
10
|
-
* selon la plateforme detectee (`navigator.userAgent`) :
|
|
11
|
-
* non-Mac, `meta` attendu sur Mac. Ignore l'evenement
|
|
12
|
-
* saisie a le focus, sauf `options.inputs`.
|
|
8
|
+
* `keys` (une combinaison `"ctrl+k"`, ou une SEQUENCE de groupes separes
|
|
9
|
+
* par un TIRET `"g-g"`, avec un `sequenceTimeout` entre chaque groupe).
|
|
10
|
+
* Traduit `cmd`/`meta` selon la plateforme detectee (`navigator.userAgent`) :
|
|
11
|
+
* `ctrl` attendu sur non-Mac, `meta` attendu sur Mac. Ignore l'evenement
|
|
12
|
+
* quand un champ de saisie a le focus, sauf `options.inputs`.
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* ⛔ Le separateur de SEQUENCE est le TIRET, pas l'espace — cette banniere
|
|
16
|
+
* a annonce `"g g"` pendant des mois et c'est faux. Mesure :
|
|
17
|
+
* `splitKeySequence('g-g')` rend `['g','g']` (deux groupes), tandis que
|
|
18
|
+
* `splitKeySequence('g g')` rend `['g g']` — un seul groupe dont la
|
|
19
|
+
* `actualKey` est la chaine `"g g"`, qu'aucun `e.key` n'egale jamais. Le
|
|
20
|
+
* raccourci est donc silencieusement MORT : deux `keydown` sur `g` ne
|
|
21
|
+
* declenchent rien du tout, sans avertissement. Les specs du depot
|
|
22
|
+
* utilisent la forme correcte (`a-b`).
|
|
13
23
|
*
|
|
14
24
|
* @description
|
|
15
25
|
* ⛔ En dehors d'un contexte `setup()` Vue, AUCUN nettoyage automatique
|
|
16
|
-
* n'est enregistre (pas de `onBeforeUnmount` possible) — un
|
|
17
|
-
*
|
|
26
|
+
* n'est enregistre (pas de `onBeforeUnmount` possible) — un avertissement
|
|
27
|
+
* (`HOTKEY_NO_AUTO_CLEANUP_WARNING`, via `consoleWarn`, donc rendu par le
|
|
28
|
+
* `warn()` de Vue : `[Vue warn]: Origam: Can't cleanup`) le signale, et
|
|
18
29
|
* l'appelant DOIT invoquer lui-meme la fonction `cleanup` retournee.
|
|
19
30
|
* Hors navigateur (`!IN_BROWSER`), la fonction est un no-op immediat, y
|
|
20
31
|
* compris pour le retour (fonction vide, pas d'erreur).
|
|
@@ -11,5 +11,13 @@
|
|
|
11
11
|
* jamais ete creee en mode SSR (`ssr` falsy), le Ref demarre directement a
|
|
12
12
|
* `true` — pas de delai artificiel dans une app 100% client. Hors
|
|
13
13
|
* navigateur (`!IN_BROWSER`), retourne un Ref fige a `false`.
|
|
14
|
+
*
|
|
15
|
+
* @description
|
|
16
|
+
* ⛔ Dans un navigateur, ce composable DEPEND de `createOrigam()` : il
|
|
17
|
+
* appelle `useDisplay()`, dont l'injection n'existe que si le plugin est
|
|
18
|
+
* installe. Mesure, montage d'un composant sans `createOrigam()` :
|
|
19
|
+
* `useHydration()` LEVE `Could not find Origam display injection`. Ce
|
|
20
|
+
* n'est donc pas un utilitaire autonome, contrairement a `useSsrBoot` qui
|
|
21
|
+
* n'injecte rien.
|
|
14
22
|
********************************************************/
|
|
15
23
|
export declare function useHydration(): import("vue").ShallowRef<boolean, boolean>;
|
|
@@ -10,5 +10,25 @@ import type { ILink, ILinkProps } from '../../interfaces/Commons/router.interfac
|
|
|
10
10
|
* Depends on `useRoute` for the exact-match `isActive` derivation —
|
|
11
11
|
* kept in its own file since it is a consumer of `useRoute`, not a
|
|
12
12
|
* variant of it.
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* ⚠️ DEUX FORMES DE RETOUR. Quand `resolveDynamicComponent('RouterLink')`
|
|
16
|
+
* ne resout pas un composant (pas de vue-router installe), la fonction
|
|
17
|
+
* sort tot et ne rend QUE `{ tag, isLink, isClickable, href }` — mesure,
|
|
18
|
+
* `Object.keys(...)` sur un montage sans routeur rend exactement ces
|
|
19
|
+
* quatre clefs. `route`, `navigate` et `isActive` sont ABSENTS, pas
|
|
20
|
+
* `undefined` : un consommateur qui les deballe doit rester optionnel.
|
|
21
|
+
*
|
|
22
|
+
* @description
|
|
23
|
+
* ⛔ ADR-005, angle mort residuel : `tag` a bien ete rendu paresseux (voir
|
|
24
|
+
* la banniere « TAG IS RESOLVED LAZILY » plus bas), mais `props.to` est
|
|
25
|
+
* ENCORE lu avidement dans le corps de `setup()`, a la ligne
|
|
26
|
+
* `const link = props.to ? RouterLink.useLink(...) : undefined`. Le
|
|
27
|
+
* detecteur `packages/ds/scripts/guards/lib/setup-reads.mjs` le compte
|
|
28
|
+
* toujours parmi ses deux lectures eager restantes (`useLink [to]`,
|
|
29
|
+
* `useNested [opened]`). Consequence : un theme qui nomme `to` sur Btn /
|
|
30
|
+
* Card / Chip / ListItem / BreadcrumbItem n'est jamais vu, puisque la
|
|
31
|
+
* decision « composant routeur ou pas » est prise une fois pour toutes
|
|
32
|
+
* avant `beforeCreate`.
|
|
13
33
|
********************************************************/
|
|
14
34
|
export declare function useLink(props: ILinkProps & ITagProps, attrs: SetupContext['attrs']): ILink;
|
|
@@ -8,6 +8,23 @@ import type { ILocationStrategyData, ILocationStrategyProps } from '../../interf
|
|
|
8
8
|
* and on strategy change, inside a disposable toggle scope.
|
|
9
9
|
* Independent from `useLocation` — no shared state or call
|
|
10
10
|
* dependency.
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* ⛔ `locationStrategy="static"` NE POSITIONNE RIEN. `staticLocationStrategy`
|
|
14
|
+
* (utils/Commons/location.util.ts) a un corps reduit a `// TODO` : elle rend
|
|
15
|
+
* `undefined`, donc `updateLocation` reste `undefined` et `contentStyles`
|
|
16
|
+
* reste `{}`. Mesure, contenu et cible reels attaches au document :
|
|
17
|
+
* `static` → `contentStyles = {}` / `updateLocation = undefined` ;
|
|
18
|
+
* `connected` → `contentStyles` rempli (`top`, `left`, `transformOrigin`,
|
|
19
|
+
* `maxHeight`…) / `updateLocation = function`. Seules la strategie
|
|
20
|
+
* `connected` et une fonction personnalisee font quelque chose.
|
|
21
|
+
*
|
|
22
|
+
* @description
|
|
23
|
+
* Cycle de vie : tout le cablage vit dans un `useToggleScope` arme sur
|
|
24
|
+
* `data.isActive && props.locationStrategy`. L'ecouteur `resize` est pose a
|
|
25
|
+
* l'entree du scope et retire par son `onScopeDispose` ; un changement de
|
|
26
|
+
* `props.locationStrategy` appelle le `reset` du scope, qui le rejoue en
|
|
27
|
+
* entier. Hors navigateur (`!IN_BROWSER`), aucun scope n'est cree du tout.
|
|
11
28
|
********************************************************/
|
|
12
29
|
export declare function useLocationStrategies(props: ILocationStrategyProps, data: ILocationStrategyData): {
|
|
13
30
|
contentStyles: import("vue").Ref<{}, {}>;
|
|
@@ -4,11 +4,25 @@ import type { IMessageProps } from '../../interfaces/Commons/message.interface';
|
|
|
4
4
|
* useMessage
|
|
5
5
|
*
|
|
6
6
|
* @description
|
|
7
|
-
* Resout les messages a afficher sous un champ
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
7
|
+
* Resout les messages a afficher sous un conteneur de champ par ordre de
|
|
8
|
+
* priorite : `props.errorMessages`/`otherMessages` (erreurs externes, ex.
|
|
9
|
+
* validation) d'abord, sinon `props.hint`, sinon `props.messages`.
|
|
10
|
+
* `hasMessages` vaut vrai des qu'une SOURCE existe — y compris le slot
|
|
11
|
+
* `#message`, meme si les props textuelles sont vides.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* ⛔ Un seul consommateur reel dans `packages/ds/src` : `OrigamForm`
|
|
15
|
+
* (verifie par import, pas par grep de nom). La famille Field affiche ses
|
|
16
|
+
* messages par un autre chemin — ne pas ecrire que ce composable est
|
|
17
|
+
* celui de `OrigamTextField`.
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* ⛔ La branche prioritaire rend `otherMessages.value`, PAS
|
|
21
|
+
* `props.errorMessages`. Mesure : avec `errorMessages: ['boum']` et le
|
|
22
|
+
* `otherMessages` par defaut (`ref([])`), `hasMessages` vaut `true` et
|
|
23
|
+
* `messages` vaut `[]` — la zone de message s'ouvre VIDE. La prop n'est
|
|
24
|
+
* donc qu'un DECLENCHEUR de priorite ; c'est a l'appelant de reinjecter
|
|
25
|
+
* ses erreurs par le second argument (ce que fait `OrigamForm`).
|
|
12
26
|
*
|
|
13
27
|
* @description
|
|
14
28
|
* `otherMessages` (typiquement les erreurs de `useValidation`) est un
|
|
@@ -8,12 +8,23 @@ import type { IPositionProps } from '../../interfaces/Commons/position.interface
|
|
|
8
8
|
* inline par cote present parmi `top`/`bottom`/`left`/`right`.
|
|
9
9
|
*
|
|
10
10
|
* @description
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* `top`/`bottom`/`left`/`right` passent par `convertToUnit`, comme les six
|
|
12
|
+
* props de `useDimension` : `top={8}` emet `top: 8px`, `top="8px"` reste
|
|
13
|
+
* verbatim. ⚠️ Cette banniere a longtemps annonce l'INVERSE (« AUCUNE
|
|
14
|
+
* conversion n'est appliquee ») — c'etait vrai jusqu'au correctif #557
|
|
15
|
+
* (`b357f7eba`), qui a change le code sans la mettre a jour.
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* ⛔ La garde d'emission est une garde de VERACITE (`if (props[layer])`),
|
|
19
|
+
* pas un test de presence : un cote a `0` est donc silencieusement omis.
|
|
20
|
+
* `top={0}` n'emet rien — mesure. Ecrire `top="0px"` pour un cote colle au
|
|
21
|
+
* bord. Meme forme que `useDimension`, meme consequence.
|
|
22
|
+
*
|
|
23
|
+
* @description
|
|
24
|
+
* `positionClasses` renvoie une CHAINE (ou `undefined`), pas un tableau —
|
|
25
|
+
* seul composable de l'axe dimension/espacement/forme dans ce cas ; tous
|
|
26
|
+
* ses voisins (`densityClasses`, `roundedClasses`, …) renvoient un
|
|
27
|
+
* `Array<string>`.
|
|
17
28
|
********************************************************/
|
|
18
29
|
export declare function usePosition(props: IPositionProps, name?: string): {
|
|
19
30
|
positionClasses: import("vue").ComputedRef<string | undefined>;
|
|
@@ -9,11 +9,17 @@ import type { Ref } from 'vue';
|
|
|
9
9
|
* stable.
|
|
10
10
|
*
|
|
11
11
|
* @description
|
|
12
|
-
* Le tableau est REINITIALISE a vide a chaque `onBeforeUpdate
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* Le tableau est REINITIALISE a vide a chaque `onBeforeUpdate`, puis Vue
|
|
13
|
+
* re-remplit les index via `updateRef` pendant le re-render qui suit.
|
|
14
|
+
*
|
|
15
|
+
* @description
|
|
16
|
+
* ⛔ Le tableau ne RETRECIT PAS pour autant. Mesure, liste de 3 items
|
|
17
|
+
* ramenee a 1 : `refs.value` vaut `[<li>, null, null]` et `refs.value.length`
|
|
18
|
+
* vaut toujours `3` — Vue rappelle la fonction `ref` des vnodes demontes
|
|
19
|
+
* avec `null`, donc les emplacements liberes sont REMIS A `null` (pas
|
|
20
|
+
* d'element perime conserve) mais restent presents. Un consommateur doit
|
|
21
|
+
* filtrer les trous et ne jamais deduire la longueur de la liste de
|
|
22
|
+
* `refs.value.length`.
|
|
17
23
|
********************************************************/
|
|
18
24
|
export declare function useRefs<T extends object>(): {
|
|
19
25
|
refs: Ref<(T | null | undefined)[], (T | null | undefined)[]>;
|
|
@@ -19,9 +19,19 @@ import type { TRounded } from '../../types/Commons/rounded.type';
|
|
|
19
19
|
* 2. per-corner `roundedTopLeft` / `roundedTopRight` /
|
|
20
20
|
* `roundedBottomLeft` / `roundedBottomRight`
|
|
21
21
|
*
|
|
22
|
-
* So `roundedTopLeft="
|
|
22
|
+
* So `roundedTopLeft="0px"` beats `rounded="lg"` for the top-left corner
|
|
23
23
|
* only; the other three keep the `lg` rung.
|
|
24
24
|
*
|
|
25
|
+
* ⚠️ This example used to read `roundedTopLeft="0"`, and that form does
|
|
26
|
+
* NOT work — measured: `{rounded:'lg', roundedTopLeft:'0'}` emits the
|
|
27
|
+
* shorthand declaration ALONE. The bare string `"0"` is neither a utility
|
|
28
|
+
* rung, nor a named variant, nor a match for `CUSTOM_BORDER_RADIUS_REGEX`
|
|
29
|
+
* (which requires a unit), so `resolveRoundedCornerValue` returns `null`
|
|
30
|
+
* and the corner is silently skipped. `0` (the NUMBER) and `"0px"` both
|
|
31
|
+
* resolve to `0px`. In a template `roundedTopLeft="0"` is a string, which
|
|
32
|
+
* is exactly the failing form — bind `:rounded-top-left="0"` or write
|
|
33
|
+
* `"0px"`.
|
|
34
|
+
*
|
|
25
35
|
* ⚠️ The per-corner props are only reachable through the PROPS-OBJECT
|
|
26
36
|
* overload. The `Ref` overload carries a single scalar — the `rounded`
|
|
27
37
|
* shorthand — by construction, so a caller that needs the corners must
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useScrolling = useScrolling;
|
|
7
7
|
var _vue = require("vue");
|
|
8
|
+
var _commons = require("../../utils/Commons/commons.util.cjs");
|
|
8
9
|
function useScrolling(listRef, textFieldRef) {
|
|
9
10
|
const isScrolling = (0, _vue.shallowRef)(false);
|
|
10
11
|
let scrollTimeout;
|
|
@@ -17,6 +18,10 @@ function useScrolling(listRef, textFieldRef) {
|
|
|
17
18
|
});
|
|
18
19
|
});
|
|
19
20
|
};
|
|
21
|
+
(0, _commons.tryOnScopeDispose)(() => {
|
|
22
|
+
cancelAnimationFrame(scrollTimeout);
|
|
23
|
+
isScrolling.value = false;
|
|
24
|
+
});
|
|
20
25
|
const finishScrolling = async () => {
|
|
21
26
|
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
22
27
|
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
@@ -30,6 +35,14 @@ function useScrolling(listRef, textFieldRef) {
|
|
|
30
35
|
} else resolve();
|
|
31
36
|
});
|
|
32
37
|
};
|
|
38
|
+
const focusFirstMatch = (children, matches) => {
|
|
39
|
+
for (const child of children) {
|
|
40
|
+
if (matches(child.getBoundingClientRect())) {
|
|
41
|
+
child.focus();
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
33
46
|
const onListKeydown = async e => {
|
|
34
47
|
if (e.key === "Tab") {
|
|
35
48
|
textFieldRef.value?.focus();
|
|
@@ -47,20 +60,10 @@ function useScrolling(listRef, textFieldRef) {
|
|
|
47
60
|
const children = el.querySelectorAll(":scope > :not(.origam-virtual-scroll__spacer)");
|
|
48
61
|
if (e.key === "PageDown" || e.key === "Home") {
|
|
49
62
|
const top = el.getBoundingClientRect().top;
|
|
50
|
-
|
|
51
|
-
if (child.getBoundingClientRect().top >= top) {
|
|
52
|
-
child.focus();
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
63
|
+
focusFirstMatch(children, rect => rect.top >= top);
|
|
56
64
|
} else {
|
|
57
65
|
const bottom = el.getBoundingClientRect().bottom;
|
|
58
|
-
|
|
59
|
-
if (child.getBoundingClientRect().bottom <= bottom) {
|
|
60
|
-
child.focus();
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
66
|
+
focusFirstMatch([...children].reverse(), rect => rect.bottom <= bottom);
|
|
64
67
|
}
|
|
65
68
|
};
|
|
66
69
|
return {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { shallowRef, watch } from "vue";
|
|
2
|
+
import { tryOnScopeDispose } from "../../utils/Commons/commons.util.js";
|
|
2
3
|
export function useScrolling(listRef, textFieldRef) {
|
|
3
4
|
const isScrolling = shallowRef(false);
|
|
4
5
|
let scrollTimeout;
|
|
@@ -11,6 +12,10 @@ export function useScrolling(listRef, textFieldRef) {
|
|
|
11
12
|
});
|
|
12
13
|
});
|
|
13
14
|
};
|
|
15
|
+
tryOnScopeDispose(() => {
|
|
16
|
+
cancelAnimationFrame(scrollTimeout);
|
|
17
|
+
isScrolling.value = false;
|
|
18
|
+
});
|
|
14
19
|
const finishScrolling = async () => {
|
|
15
20
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
16
21
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
@@ -24,6 +29,14 @@ export function useScrolling(listRef, textFieldRef) {
|
|
|
24
29
|
} else resolve();
|
|
25
30
|
});
|
|
26
31
|
};
|
|
32
|
+
const focusFirstMatch = (children, matches) => {
|
|
33
|
+
for (const child of children) {
|
|
34
|
+
if (matches(child.getBoundingClientRect())) {
|
|
35
|
+
child.focus();
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
27
40
|
const onListKeydown = async (e) => {
|
|
28
41
|
if (e.key === "Tab") {
|
|
29
42
|
textFieldRef.value?.focus();
|
|
@@ -41,20 +54,10 @@ export function useScrolling(listRef, textFieldRef) {
|
|
|
41
54
|
const children = el.querySelectorAll(":scope > :not(.origam-virtual-scroll__spacer)");
|
|
42
55
|
if (e.key === "PageDown" || e.key === "Home") {
|
|
43
56
|
const top = el.getBoundingClientRect().top;
|
|
44
|
-
|
|
45
|
-
if (child.getBoundingClientRect().top >= top) {
|
|
46
|
-
child.focus();
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
57
|
+
focusFirstMatch(children, (rect) => rect.top >= top);
|
|
50
58
|
} else {
|
|
51
59
|
const bottom = el.getBoundingClientRect().bottom;
|
|
52
|
-
|
|
53
|
-
if (child.getBoundingClientRect().bottom <= bottom) {
|
|
54
|
-
child.focus();
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
60
|
+
focusFirstMatch([...children].reverse(), (rect) => rect.bottom <= bottom);
|
|
58
61
|
}
|
|
59
62
|
};
|
|
60
63
|
return { onListScroll, onListKeydown };
|
|
@@ -17,6 +17,21 @@ import type { ISizeProps } from '../../interfaces/Commons/size.interface';
|
|
|
17
17
|
* composant qui traite `size` comme une pure dimension de boite ne doit
|
|
18
18
|
* pas consommer `sizeClasses` dans son `:class` : `sizeStyles` reste seul
|
|
19
19
|
* autoritaire pour la geometrie.
|
|
20
|
+
*
|
|
21
|
+
* @description
|
|
22
|
+
* ⛔ SURFACE ASYMETRIQUE — `sizeClasses` deballe un `Ref` (`isRef(props)
|
|
23
|
+
* ? props.value : props.size`), `sizeStyles` lit `props.size` directement.
|
|
24
|
+
* La signature ne type que `ISizeProps`, donc passer un `Ref` est
|
|
25
|
+
* hors-contrat ; mais le premier canal l'accepte a moitie et le second
|
|
26
|
+
* l'ignore. Mesure : `useSize(ref(24))` rend `{classes: [], styles: []}`
|
|
27
|
+
* — inerte des deux cotes — quand `useSize({size: 24})` rend bien
|
|
28
|
+
* `["width: 24px", "height: 24px"]`. Passer l'objet de props.
|
|
29
|
+
*
|
|
30
|
+
* @description
|
|
31
|
+
* ⚠️ Aucune validation de la valeur custom : `size="zzz"` ne figure pas
|
|
32
|
+
* dans `SIZES_ARRAY`, prend donc la branche inline et emet
|
|
33
|
+
* `width: zzz` / `height: zzz` — deux declarations invalides, sans
|
|
34
|
+
* avertissement. Meme absence de liste blanche que `useVariant`.
|
|
20
35
|
********************************************************/
|
|
21
36
|
export declare function useSize(props: ISizeProps, name?: string): {
|
|
22
37
|
sizeStyles: import("vue").ComputedRef<string[]>;
|
|
@@ -7,11 +7,19 @@ exports.useSsrBoot = useSsrBoot;
|
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
function useSsrBoot() {
|
|
9
9
|
const isBooted = (0, _vue.shallowRef)(false);
|
|
10
|
+
let frame = -1;
|
|
10
11
|
(0, _vue.onMounted)(() => {
|
|
11
|
-
window.requestAnimationFrame(() => {
|
|
12
|
+
frame = window.requestAnimationFrame(() => {
|
|
13
|
+
frame = -1;
|
|
12
14
|
isBooted.value = true;
|
|
13
15
|
});
|
|
14
16
|
});
|
|
17
|
+
(0, _vue.onScopeDispose)(() => {
|
|
18
|
+
if (frame !== -1) {
|
|
19
|
+
window.cancelAnimationFrame(frame);
|
|
20
|
+
frame = -1;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
15
23
|
const ssrBootStyles = (0, _vue.computed)(() => !isBooted.value ? {
|
|
16
24
|
transition: "none !important"
|
|
17
25
|
} : []);
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { computed, onMounted, readonly, shallowRef } from "vue";
|
|
1
|
+
import { computed, onMounted, onScopeDispose, readonly, shallowRef } from "vue";
|
|
2
2
|
export function useSsrBoot() {
|
|
3
3
|
const isBooted = shallowRef(false);
|
|
4
|
+
let frame = -1;
|
|
4
5
|
onMounted(() => {
|
|
5
|
-
window.requestAnimationFrame(() => {
|
|
6
|
+
frame = window.requestAnimationFrame(() => {
|
|
7
|
+
frame = -1;
|
|
6
8
|
isBooted.value = true;
|
|
7
9
|
});
|
|
8
10
|
});
|
|
11
|
+
onScopeDispose(() => {
|
|
12
|
+
if (frame !== -1) {
|
|
13
|
+
window.cancelAnimationFrame(frame);
|
|
14
|
+
frame = -1;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
9
17
|
const ssrBootStyles = computed(() => !isBooted.value ? {
|
|
10
18
|
transition: "none !important"
|
|
11
19
|
} : []);
|