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
|
@@ -14,13 +14,32 @@ import type { IAdjacentInnerProps } from '../../interfaces/Commons/adjacent.inte
|
|
|
14
14
|
* `click:appendInner` only ever fired from a literal DOM click inside
|
|
15
15
|
* the zone, never from a keyboard activation of an ancestor. See the
|
|
16
16
|
* long comment on `useAdjacent` for the full reasoning; mirrored here
|
|
17
|
-
* for the inner zone.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* for the inner zone.
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* ⛔ Cette banniere a longtemps decrit un `isClearClickable` — il
|
|
21
|
+
* n'existe NULLE PART dans le code, ni ici ni ailleurs dans
|
|
22
|
+
* `packages/ds/src` (verifie par recherche : la seule occurrence du depot
|
|
23
|
+
* etait cette phrase). Le generateur de `packages/docs/composables/Commons.md`
|
|
24
|
+
* recopie les bannieres, donc la doc publiee nommait un symbole
|
|
25
|
+
* inexistant — le defaut #493 exactement. La zone « clear » n'expose que
|
|
26
|
+
* `hasClear` et le handler `clickClear` ; elle ne passe par
|
|
27
|
+
* `useAccessibleCommand` ni par aucun test de clicabilite, parce qu'elle
|
|
28
|
+
* ne rend (`v-show="dirty"`) que lorsqu'il y a quelque chose a effacer.
|
|
29
|
+
*
|
|
30
|
+
* @description
|
|
31
|
+
* ⚠️ `hasPrependInner` / `hasAppendInner` / `hasClear` ne sont PAS des
|
|
32
|
+
* booleens : ils rendent la FONCTION de slot quand le slot correspondant
|
|
33
|
+
* existe (`slots.prependInner || …`), sinon le booleen du media, et
|
|
34
|
+
* `hasClear` rend `undefined` quand ni `clearable` ni le slot `clear` ne
|
|
35
|
+
* sont fournis. Les trois sont a consommer en verite/faussete, jamais en
|
|
36
|
+
* comparaison stricte a `true`/`false`. `useAdjacent`, lui, normalise
|
|
37
|
+
* (`!!slots.prepend || …`) et rend de vrais booleens — les deux jumeaux
|
|
38
|
+
* ne se comportent pas pareil sur ce point.
|
|
22
39
|
********************************************************/
|
|
23
40
|
export declare function useAdjacentInner(props: IAdjacentInnerProps): {
|
|
41
|
+
prependInnerCommandAttrs: import("vue").ComputedRef<Record<string, unknown>>;
|
|
42
|
+
appendInnerCommandAttrs: import("vue").ComputedRef<Record<string, unknown>>;
|
|
24
43
|
hasPrependInnerMedia: import("vue").ComputedRef<boolean>;
|
|
25
44
|
hasPrependInner: import("vue").ComputedRef<boolean | import("vue").Slot<any>>;
|
|
26
45
|
hasAppendInnerMedia: import("vue").ComputedRef<boolean>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, useSlots } from "vue";
|
|
2
2
|
import { KEYBOARD_VALUES } from "../../enums/Commons/hotkey.enum.js";
|
|
3
3
|
import { hasEvent } from "../../utils/Commons/commons.util.js";
|
|
4
|
+
import { useAccessibleCommand } from "./accessibleCommand.composable.js";
|
|
4
5
|
import { getCurrentInstance } from "../../utils/Commons/getCurrentInstance.util.js";
|
|
5
6
|
export function useAdjacentInner(props) {
|
|
6
7
|
const vm = getCurrentInstance("OrigamAdjacentInner");
|
|
@@ -35,19 +36,38 @@ export function useAdjacentInner(props) {
|
|
|
35
36
|
const isAppendInnerClickable = computed(() => {
|
|
36
37
|
return hasEvent(vm.attrs, "click:appendInner") || hasEvent(vm.vnode.props ?? {}, "click:appendInner");
|
|
37
38
|
});
|
|
39
|
+
const ownsKey = (e) => e.target === e.currentTarget;
|
|
38
40
|
const onKeydownPrependInner = (e) => {
|
|
39
41
|
if (!isPrependInnerClickable.value) return;
|
|
42
|
+
if (!ownsKey(e)) return;
|
|
40
43
|
if (e.key !== KEYBOARD_VALUES.ENTER && e.key !== KEYBOARD_VALUES.EMPTY) return;
|
|
41
44
|
e.preventDefault();
|
|
42
45
|
onClickPrependInner(e);
|
|
43
46
|
};
|
|
44
47
|
const onKeydownAppendInner = (e) => {
|
|
45
48
|
if (!isAppendInnerClickable.value) return;
|
|
49
|
+
if (!ownsKey(e)) return;
|
|
46
50
|
if (e.key !== KEYBOARD_VALUES.ENTER && e.key !== KEYBOARD_VALUES.EMPTY) return;
|
|
47
51
|
e.preventDefault();
|
|
48
52
|
onClickAppendInner(e);
|
|
49
53
|
};
|
|
54
|
+
const prependInnerCommandAttrs = useAccessibleCommand({
|
|
55
|
+
component: vm.type?.__name ?? "Origam",
|
|
56
|
+
zone: "prependInner",
|
|
57
|
+
prop: "prependInnerAriaLabel",
|
|
58
|
+
active: isPrependInnerClickable,
|
|
59
|
+
label: () => props.prependInnerAriaLabel
|
|
60
|
+
});
|
|
61
|
+
const appendInnerCommandAttrs = useAccessibleCommand({
|
|
62
|
+
component: vm.type?.__name ?? "Origam",
|
|
63
|
+
zone: "appendInner",
|
|
64
|
+
prop: "appendInnerAriaLabel",
|
|
65
|
+
active: isAppendInnerClickable,
|
|
66
|
+
label: () => props.appendInnerAriaLabel
|
|
67
|
+
});
|
|
50
68
|
return {
|
|
69
|
+
prependInnerCommandAttrs,
|
|
70
|
+
appendInnerCommandAttrs,
|
|
51
71
|
hasPrependInnerMedia,
|
|
52
72
|
hasPrependInner,
|
|
53
73
|
hasAppendInnerMedia,
|
|
@@ -6,18 +6,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useAudio = useAudio;
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
var _audio = require("../../consts/Audio/audio.const.cjs");
|
|
9
|
+
var _commons = require("../../utils/Commons/commons.util.cjs");
|
|
9
10
|
function useAudio(props) {
|
|
10
11
|
const analyser = (0, _vue.ref)(null);
|
|
11
12
|
const audioArray = (0, _vue.shallowRef)(null);
|
|
12
13
|
const audioRef = (0, _vue.ref)();
|
|
13
14
|
const wasPlayed = (0, _vue.ref)(false);
|
|
14
15
|
const isPlaying = (0, _vue.ref)(false);
|
|
16
|
+
let frame = -1;
|
|
17
|
+
let disposed = false;
|
|
15
18
|
const getSongData = () => {
|
|
19
|
+
if (disposed) return;
|
|
16
20
|
if (isPlaying.value && audioArray.value) {
|
|
17
21
|
analyser.value?.getByteFrequencyData(audioArray.value);
|
|
18
|
-
requestAnimationFrame(getSongData);
|
|
22
|
+
frame = requestAnimationFrame(getSongData);
|
|
23
|
+
} else {
|
|
24
|
+
frame = -1;
|
|
19
25
|
}
|
|
20
26
|
};
|
|
27
|
+
(0, _commons.tryOnScopeDispose)(() => {
|
|
28
|
+
disposed = true;
|
|
29
|
+
if (frame !== -1) {
|
|
30
|
+
cancelAnimationFrame(frame);
|
|
31
|
+
frame = -1;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
21
34
|
const onPlay = () => {
|
|
22
35
|
if (!wasPlayed.value) {
|
|
23
36
|
onAudio();
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import { ref, shallowRef, watch } from "vue";
|
|
2
2
|
import { AUDIO_ANALYSER_FFT_SIZE } from "../../consts/Audio/audio.const.js";
|
|
3
|
+
import { tryOnScopeDispose } from "../../utils/Commons/commons.util.js";
|
|
3
4
|
export function useAudio(props) {
|
|
4
5
|
const analyser = ref(null);
|
|
5
6
|
const audioArray = shallowRef(null);
|
|
6
7
|
const audioRef = ref();
|
|
7
8
|
const wasPlayed = ref(false);
|
|
8
9
|
const isPlaying = ref(false);
|
|
10
|
+
let frame = -1;
|
|
11
|
+
let disposed = false;
|
|
9
12
|
const getSongData = () => {
|
|
13
|
+
if (disposed) return;
|
|
10
14
|
if (isPlaying.value && audioArray.value) {
|
|
11
15
|
analyser.value?.getByteFrequencyData(audioArray.value);
|
|
12
|
-
requestAnimationFrame(getSongData);
|
|
16
|
+
frame = requestAnimationFrame(getSongData);
|
|
17
|
+
} else {
|
|
18
|
+
frame = -1;
|
|
13
19
|
}
|
|
14
20
|
};
|
|
21
|
+
tryOnScopeDispose(() => {
|
|
22
|
+
disposed = true;
|
|
23
|
+
if (frame !== -1) {
|
|
24
|
+
cancelAnimationFrame(frame);
|
|
25
|
+
frame = -1;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
15
28
|
const onPlay = () => {
|
|
16
29
|
if (!wasPlayed.value) {
|
|
17
30
|
onAudio();
|
|
@@ -11,6 +11,7 @@ function useBackButton(router, cb) {
|
|
|
11
11
|
let popped = false;
|
|
12
12
|
let removeBefore;
|
|
13
13
|
let removeAfter;
|
|
14
|
+
let poppedReset;
|
|
14
15
|
if (_commons.IN_BROWSER) {
|
|
15
16
|
(0, _vue.nextTick)(() => {
|
|
16
17
|
window.addEventListener("popstate", onPopstate);
|
|
@@ -42,11 +43,12 @@ function useBackButton(router, cb) {
|
|
|
42
43
|
window.removeEventListener("popstate", onPopstate);
|
|
43
44
|
removeBefore?.();
|
|
44
45
|
removeAfter?.();
|
|
46
|
+
clearTimeout(poppedReset);
|
|
45
47
|
});
|
|
46
48
|
}
|
|
47
49
|
const onPopstate = e => {
|
|
48
50
|
if (e.state?.replaced) return;
|
|
49
51
|
popped = true;
|
|
50
|
-
setTimeout(() => popped = false);
|
|
52
|
+
poppedReset = setTimeout(() => popped = false);
|
|
51
53
|
};
|
|
52
54
|
}
|
|
@@ -5,6 +5,7 @@ export function useBackButton(router, cb) {
|
|
|
5
5
|
let popped = false;
|
|
6
6
|
let removeBefore;
|
|
7
7
|
let removeAfter;
|
|
8
|
+
let poppedReset;
|
|
8
9
|
if (IN_BROWSER) {
|
|
9
10
|
nextTick(() => {
|
|
10
11
|
window.addEventListener("popstate", onPopstate);
|
|
@@ -36,11 +37,12 @@ export function useBackButton(router, cb) {
|
|
|
36
37
|
window.removeEventListener("popstate", onPopstate);
|
|
37
38
|
removeBefore?.();
|
|
38
39
|
removeAfter?.();
|
|
40
|
+
clearTimeout(poppedReset);
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
const onPopstate = (e) => {
|
|
42
44
|
if (e.state?.replaced) return;
|
|
43
45
|
popped = true;
|
|
44
|
-
setTimeout(() => popped = false);
|
|
46
|
+
poppedReset = setTimeout(() => popped = false);
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -53,6 +53,19 @@ import { TDirectionBoth } from '../../types/Commons/anchor.type';
|
|
|
53
53
|
* variables.
|
|
54
54
|
*
|
|
55
55
|
* @description
|
|
56
|
+
* ⛔ LA FORME TABLEAU (`:border="['top', 'bottom']"`) N'EST QU'A MOITIE
|
|
57
|
+
* IMPLEMENTEE. Elle est portee par le type du parametre `Ref` et traversee
|
|
58
|
+
* par `borderClasses`, mais `borderStyles` ne la teste nulle part : ni
|
|
59
|
+
* `isUtilityBorder`, ni `isDirectionBorder`, ni `typeof === 'string'`, ni
|
|
60
|
+
* `typeof === 'number'` ne matchent un tableau. Mesure —
|
|
61
|
+
* `useBorder({border: ['top','bottom']})` rend
|
|
62
|
+
* `classes: ['{name}--border', '{name}--border-top,bottom']` et
|
|
63
|
+
* `styles: []` : la classe est interpolee depuis le tableau, donc porte la
|
|
64
|
+
* VIRGULE du `Array.prototype.toString`, et aucune feuille ne la declare.
|
|
65
|
+
* Aucune largeur n'est emise. Documente ici, non corrige : voir le lot de
|
|
66
|
+
* doc #600.
|
|
67
|
+
*
|
|
68
|
+
* @description
|
|
56
69
|
* WHEN #514 IS SETTLED, THIS INLINE PATH IS THE THING TO REMOVE. If the DS
|
|
57
70
|
* adopts `@layer` (measured in `packages/tests/e2e/btn-cascade-layer-probe.spec.ts`),
|
|
58
71
|
* the utility wins on its own and these `styles.push` calls become dead.
|
|
@@ -7,6 +7,60 @@ exports.useColorEffect = useColorEffect;
|
|
|
7
7
|
var _vue = require("vue");
|
|
8
8
|
var _color = require("../../utils/Commons/color.util.cjs");
|
|
9
9
|
var _gradient = require("../../utils/Commons/gradient.util.cjs");
|
|
10
|
+
function trackReactiveDependency(_value) {}
|
|
11
|
+
function resolveBackground(bgColorValue, bgRole) {
|
|
12
|
+
if (bgColorValue && (0, _gradient.isGradient)(bgColorValue)) {
|
|
13
|
+
const grad = (0, _gradient.resolveGradient)(bgColorValue);
|
|
14
|
+
if (grad) return [`background-image: ${grad}`, null, true];
|
|
15
|
+
return [null, null, false];
|
|
16
|
+
}
|
|
17
|
+
if (bgColorValue && (0, _color.isIntent)(bgColorValue)) {
|
|
18
|
+
const m = (0, _color.tokenStylesForIntent)(bgColorValue, bgRole);
|
|
19
|
+
return [`background-color: ${m["background-color"]}`, (0, _color.tokenStylesForIntent)(bgColorValue, "default").color, false];
|
|
20
|
+
}
|
|
21
|
+
if (bgColorValue === "transparent") {
|
|
22
|
+
return [`background-color: ${(0, _color.rawBgExprWithState)("transparent", bgRole)}`, null, false];
|
|
23
|
+
}
|
|
24
|
+
if (bgColorValue && typeof bgColorValue === "string" && (0, _color.isCssColor)(bgColorValue)) {
|
|
25
|
+
(0, _color.warnLegacyColor)("bgColor", bgColorValue);
|
|
26
|
+
return [`background-color: ${(0, _color.rawBgExprWithState)(bgColorValue, bgRole)}`, null, false];
|
|
27
|
+
}
|
|
28
|
+
return [null, null, false];
|
|
29
|
+
}
|
|
30
|
+
function isSameIntentOnBothAxes(colorValue, bgColorValue, bgIntentFg) {
|
|
31
|
+
return Boolean(bgIntentFg && bgColorValue && (0, _color.isIntent)(bgColorValue) && colorValue === bgColorValue);
|
|
32
|
+
}
|
|
33
|
+
function resolveAutoContrastForeground(bgColorValue, bgIntentFg, bgIsGradient) {
|
|
34
|
+
if (bgIsGradient) return null;
|
|
35
|
+
if (bgIntentFg) return `color: ${bgIntentFg}`;
|
|
36
|
+
if (bgColorValue && typeof bgColorValue === "string" && bgColorValue !== "transparent" && (0, _color.isParsableColor)(bgColorValue)) {
|
|
37
|
+
const parsed = (0, _color.parseColor)(bgColorValue);
|
|
38
|
+
if (parsed.a == null || parsed.a === 1) return `color: ${(0, _color.getForeground)(parsed)}`;
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
function resolveForeground(colorValue, bgColorValue, bgIntentFg, bgIsGradient) {
|
|
43
|
+
if (colorValue && (0, _gradient.isGradient)(colorValue)) {
|
|
44
|
+
const grad = (0, _gradient.resolveGradient)(colorValue);
|
|
45
|
+
if (grad) return ["color: transparent", `background-image: ${grad}`, true];
|
|
46
|
+
return [null, null, false];
|
|
47
|
+
}
|
|
48
|
+
if (colorValue && (0, _color.isIntent)(colorValue)) {
|
|
49
|
+
if (isSameIntentOnBothAxes(colorValue, bgColorValue, bgIntentFg)) {
|
|
50
|
+
return [`color: ${bgIntentFg}`, null, false];
|
|
51
|
+
}
|
|
52
|
+
return [`color: ${(0, _color.tokenForegroundForIntent)(colorValue)}`, null, false];
|
|
53
|
+
}
|
|
54
|
+
if (colorValue && typeof colorValue === "string" && (0, _color.isCssColor)(colorValue)) {
|
|
55
|
+
if (colorValue !== "transparent") (0, _color.warnLegacyColor)("color", colorValue);
|
|
56
|
+
return [`color: ${colorValue}`, null, false];
|
|
57
|
+
}
|
|
58
|
+
if (!colorValue) {
|
|
59
|
+
const autoFg = resolveAutoContrastForeground(bgColorValue, bgIntentFg, bgIsGradient);
|
|
60
|
+
if (autoFg) return [autoFg, null, false];
|
|
61
|
+
}
|
|
62
|
+
return [null, null, false];
|
|
63
|
+
}
|
|
10
64
|
function useColorEffect(props, isHover = (0, _vue.ref)(false), isActive = (0, _vue.ref)(false), isDisabled = (0, _vue.ref)(false)) {
|
|
11
65
|
const color = (0, _vue.computed)(() => props.color);
|
|
12
66
|
const bgColor = (0, _vue.computed)(() => props.bgColor);
|
|
@@ -24,53 +78,11 @@ function useColorEffect(props, isHover = (0, _vue.ref)(false), isActive = (0, _v
|
|
|
24
78
|
return classes;
|
|
25
79
|
});
|
|
26
80
|
const colorStyles = (0, _vue.computed)(() => {
|
|
27
|
-
|
|
81
|
+
trackReactiveDependency(isDisabled.value);
|
|
28
82
|
const bgRole = isHover.value ? "hover" : isActive.value ? "active" : "default";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let bgIsGradient = false;
|
|
33
|
-
let clipText = false;
|
|
34
|
-
if (bgColor.value && (0, _gradient.isGradient)(bgColor.value)) {
|
|
35
|
-
const grad = (0, _gradient.resolveGradient)(bgColor.value);
|
|
36
|
-
if (grad) {
|
|
37
|
-
bgDecl = `background-image: ${grad}`;
|
|
38
|
-
bgIsGradient = true;
|
|
39
|
-
}
|
|
40
|
-
} else if (bgColor.value && (0, _color.isIntent)(bgColor.value)) {
|
|
41
|
-
const m = (0, _color.tokenStylesForIntent)(bgColor.value, bgRole);
|
|
42
|
-
bgDecl = `background-color: ${m["background-color"]}`;
|
|
43
|
-
bgIntentFg = (0, _color.tokenStylesForIntent)(bgColor.value, "default").color;
|
|
44
|
-
} else if (bgColor.value === "transparent") {
|
|
45
|
-
bgDecl = `background-color: ${(0, _color.rawBgExprWithState)("transparent", bgRole)}`;
|
|
46
|
-
} else if (bgColor.value && typeof bgColor.value === "string" && (0, _color.isCssColor)(bgColor.value)) {
|
|
47
|
-
(0, _color.warnLegacyColor)("bgColor", bgColor.value);
|
|
48
|
-
bgDecl = `background-color: ${(0, _color.rawBgExprWithState)(bgColor.value, bgRole)}`;
|
|
49
|
-
}
|
|
50
|
-
if (color.value && (0, _gradient.isGradient)(color.value)) {
|
|
51
|
-
const grad = (0, _gradient.resolveGradient)(color.value);
|
|
52
|
-
if (grad) {
|
|
53
|
-
fgDecl = "color: transparent";
|
|
54
|
-
bgDecl = `background-image: ${grad}`;
|
|
55
|
-
clipText = true;
|
|
56
|
-
}
|
|
57
|
-
} else if (color.value && (0, _color.isIntent)(color.value)) {
|
|
58
|
-
if (bgIntentFg && bgColor.value && (0, _color.isIntent)(bgColor.value) && color.value === bgColor.value) {
|
|
59
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
60
|
-
} else {
|
|
61
|
-
fgDecl = `color: ${(0, _color.tokenForegroundForIntent)(color.value)}`;
|
|
62
|
-
}
|
|
63
|
-
} else if (color.value && typeof color.value === "string" && (0, _color.isCssColor)(color.value)) {
|
|
64
|
-
if (color.value !== "transparent") (0, _color.warnLegacyColor)("color", color.value);
|
|
65
|
-
fgDecl = `color: ${color.value}`;
|
|
66
|
-
} else if (!color.value && bgIntentFg && !bgIsGradient) {
|
|
67
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
68
|
-
} else if (!color.value && !bgIsGradient && bgColor.value && typeof bgColor.value === "string" && bgColor.value !== "transparent" && (0, _color.isParsableColor)(bgColor.value)) {
|
|
69
|
-
const parsed = (0, _color.parseColor)(bgColor.value);
|
|
70
|
-
if (parsed.a == null || parsed.a === 1) {
|
|
71
|
-
fgDecl = `color: ${(0, _color.getForeground)(parsed)}`;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
83
|
+
const [bgDeclBase, bgIntentFg, bgIsGradient] = resolveBackground(bgColor.value, bgRole);
|
|
84
|
+
const [fgDecl, bgDeclOverride, clipText] = resolveForeground(color.value, bgColor.value, bgIntentFg, bgIsGradient);
|
|
85
|
+
const bgDecl = bgDeclOverride ?? bgDeclBase;
|
|
74
86
|
const styles = [];
|
|
75
87
|
if (bgDecl) styles.push(bgDecl);
|
|
76
88
|
if (fgDecl) styles.push(fgDecl);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComputedRef, Ref } from 'vue';
|
|
2
2
|
import type { IBgColorProps, IColorProps } from '../../interfaces/Commons/color.interface';
|
|
3
|
+
import type { TColor } from '../../types/Commons/color.type';
|
|
3
4
|
/*********************************************************
|
|
4
5
|
* useColorEffect
|
|
5
6
|
*
|
|
@@ -11,9 +12,13 @@ import type { IBgColorProps, IColorProps } from '../../interfaces/Commons/color.
|
|
|
11
12
|
* legacy static resolver, not a variant of it — kept in its own file
|
|
12
13
|
* rather than forced to share a base.
|
|
13
14
|
*
|
|
14
|
-
* Returns
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Returns `{ colorClasses, colorStyles, color, bgColor }`. `color` and
|
|
16
|
+
* `bgColor` are pass-through computeds over the raw props, not resolved
|
|
17
|
+
* declarations. The two real callers are `OrigamAudio` and `OrigamVideo`.
|
|
18
|
+
*
|
|
19
|
+
* `colorClasses` is EMPTY as soon as `isHover` / `isActive` / `isDisabled`
|
|
20
|
+
* is true: utility classes are static, and the resolved token is no longer
|
|
21
|
+
* the resting one `.origam--bg-{intent}` names.
|
|
17
22
|
*
|
|
18
23
|
* `colorStyles` is an array of CSS declarations like
|
|
19
24
|
* `'background-color: …'`, either pointing to a token
|
|
@@ -34,6 +39,6 @@ import type { IBgColorProps, IColorProps } from '../../interfaces/Commons/color.
|
|
|
34
39
|
export declare function useColorEffect(props: IColorProps & IBgColorProps, isHover?: Ref<boolean> | ComputedRef<boolean>, isActive?: Ref<boolean> | ComputedRef<boolean>, isDisabled?: Ref<boolean> | ComputedRef<boolean>): {
|
|
35
40
|
colorClasses: ComputedRef<string[]>;
|
|
36
41
|
colorStyles: ComputedRef<string[]>;
|
|
37
|
-
color: ComputedRef<
|
|
38
|
-
bgColor: ComputedRef<
|
|
42
|
+
color: ComputedRef<TColor>;
|
|
43
|
+
bgColor: ComputedRef<TColor>;
|
|
39
44
|
};
|
|
@@ -12,6 +12,67 @@ import {
|
|
|
12
12
|
warnLegacyColor
|
|
13
13
|
} from "../../utils/Commons/color.util.js";
|
|
14
14
|
import { isGradient, resolveGradient } from "../../utils/Commons/gradient.util.js";
|
|
15
|
+
function trackReactiveDependency(_value) {
|
|
16
|
+
}
|
|
17
|
+
function resolveBackground(bgColorValue, bgRole) {
|
|
18
|
+
if (bgColorValue && isGradient(bgColorValue)) {
|
|
19
|
+
const grad = resolveGradient(bgColorValue);
|
|
20
|
+
if (grad) return [`background-image: ${grad}`, null, true];
|
|
21
|
+
return [null, null, false];
|
|
22
|
+
}
|
|
23
|
+
if (bgColorValue && isIntent(bgColorValue)) {
|
|
24
|
+
const m = tokenStylesForIntent(bgColorValue, bgRole);
|
|
25
|
+
return [
|
|
26
|
+
`background-color: ${m["background-color"]}`,
|
|
27
|
+
tokenStylesForIntent(bgColorValue, "default").color,
|
|
28
|
+
false
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
if (bgColorValue === "transparent") {
|
|
32
|
+
return [`background-color: ${rawBgExprWithState("transparent", bgRole)}`, null, false];
|
|
33
|
+
}
|
|
34
|
+
if (bgColorValue && typeof bgColorValue === "string" && isCssColor(bgColorValue)) {
|
|
35
|
+
warnLegacyColor("bgColor", bgColorValue);
|
|
36
|
+
return [`background-color: ${rawBgExprWithState(bgColorValue, bgRole)}`, null, false];
|
|
37
|
+
}
|
|
38
|
+
return [null, null, false];
|
|
39
|
+
}
|
|
40
|
+
function isSameIntentOnBothAxes(colorValue, bgColorValue, bgIntentFg) {
|
|
41
|
+
return Boolean(
|
|
42
|
+
bgIntentFg && bgColorValue && isIntent(bgColorValue) && colorValue === bgColorValue
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function resolveAutoContrastForeground(bgColorValue, bgIntentFg, bgIsGradient) {
|
|
46
|
+
if (bgIsGradient) return null;
|
|
47
|
+
if (bgIntentFg) return `color: ${bgIntentFg}`;
|
|
48
|
+
if (bgColorValue && typeof bgColorValue === "string" && bgColorValue !== "transparent" && isParsableColor(bgColorValue)) {
|
|
49
|
+
const parsed = parseColor(bgColorValue);
|
|
50
|
+
if (parsed.a == null || parsed.a === 1) return `color: ${getForeground(parsed)}`;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function resolveForeground(colorValue, bgColorValue, bgIntentFg, bgIsGradient) {
|
|
55
|
+
if (colorValue && isGradient(colorValue)) {
|
|
56
|
+
const grad = resolveGradient(colorValue);
|
|
57
|
+
if (grad) return ["color: transparent", `background-image: ${grad}`, true];
|
|
58
|
+
return [null, null, false];
|
|
59
|
+
}
|
|
60
|
+
if (colorValue && isIntent(colorValue)) {
|
|
61
|
+
if (isSameIntentOnBothAxes(colorValue, bgColorValue, bgIntentFg)) {
|
|
62
|
+
return [`color: ${bgIntentFg}`, null, false];
|
|
63
|
+
}
|
|
64
|
+
return [`color: ${tokenForegroundForIntent(colorValue)}`, null, false];
|
|
65
|
+
}
|
|
66
|
+
if (colorValue && typeof colorValue === "string" && isCssColor(colorValue)) {
|
|
67
|
+
if (colorValue !== "transparent") warnLegacyColor("color", colorValue);
|
|
68
|
+
return [`color: ${colorValue}`, null, false];
|
|
69
|
+
}
|
|
70
|
+
if (!colorValue) {
|
|
71
|
+
const autoFg = resolveAutoContrastForeground(bgColorValue, bgIntentFg, bgIsGradient);
|
|
72
|
+
if (autoFg) return [autoFg, null, false];
|
|
73
|
+
}
|
|
74
|
+
return [null, null, false];
|
|
75
|
+
}
|
|
15
76
|
export function useColorEffect(props, isHover = ref(false), isActive = ref(false), isDisabled = ref(false)) {
|
|
16
77
|
const color = computed(() => props.color);
|
|
17
78
|
const bgColor = computed(() => props.bgColor);
|
|
@@ -30,53 +91,16 @@ export function useColorEffect(props, isHover = ref(false), isActive = ref(false
|
|
|
30
91
|
return classes;
|
|
31
92
|
});
|
|
32
93
|
const colorStyles = computed(() => {
|
|
33
|
-
|
|
94
|
+
trackReactiveDependency(isDisabled.value);
|
|
34
95
|
const bgRole = isHover.value ? "hover" : isActive.value ? "active" : "default";
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
bgDecl = `background-image: ${grad}`;
|
|
44
|
-
bgIsGradient = true;
|
|
45
|
-
}
|
|
46
|
-
} else if (bgColor.value && isIntent(bgColor.value)) {
|
|
47
|
-
const m = tokenStylesForIntent(bgColor.value, bgRole);
|
|
48
|
-
bgDecl = `background-color: ${m["background-color"]}`;
|
|
49
|
-
bgIntentFg = tokenStylesForIntent(bgColor.value, "default").color;
|
|
50
|
-
} else if (bgColor.value === "transparent") {
|
|
51
|
-
bgDecl = `background-color: ${rawBgExprWithState("transparent", bgRole)}`;
|
|
52
|
-
} else if (bgColor.value && typeof bgColor.value === "string" && isCssColor(bgColor.value)) {
|
|
53
|
-
warnLegacyColor("bgColor", bgColor.value);
|
|
54
|
-
bgDecl = `background-color: ${rawBgExprWithState(bgColor.value, bgRole)}`;
|
|
55
|
-
}
|
|
56
|
-
if (color.value && isGradient(color.value)) {
|
|
57
|
-
const grad = resolveGradient(color.value);
|
|
58
|
-
if (grad) {
|
|
59
|
-
fgDecl = "color: transparent";
|
|
60
|
-
bgDecl = `background-image: ${grad}`;
|
|
61
|
-
clipText = true;
|
|
62
|
-
}
|
|
63
|
-
} else if (color.value && isIntent(color.value)) {
|
|
64
|
-
if (bgIntentFg && bgColor.value && isIntent(bgColor.value) && color.value === bgColor.value) {
|
|
65
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
66
|
-
} else {
|
|
67
|
-
fgDecl = `color: ${tokenForegroundForIntent(color.value)}`;
|
|
68
|
-
}
|
|
69
|
-
} else if (color.value && typeof color.value === "string" && isCssColor(color.value)) {
|
|
70
|
-
if (color.value !== "transparent") warnLegacyColor("color", color.value);
|
|
71
|
-
fgDecl = `color: ${color.value}`;
|
|
72
|
-
} else if (!color.value && bgIntentFg && !bgIsGradient) {
|
|
73
|
-
fgDecl = `color: ${bgIntentFg}`;
|
|
74
|
-
} else if (!color.value && !bgIsGradient && bgColor.value && typeof bgColor.value === "string" && bgColor.value !== "transparent" && isParsableColor(bgColor.value)) {
|
|
75
|
-
const parsed = parseColor(bgColor.value);
|
|
76
|
-
if (parsed.a == null || parsed.a === 1) {
|
|
77
|
-
fgDecl = `color: ${getForeground(parsed)}`;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
96
|
+
const [bgDeclBase, bgIntentFg, bgIsGradient] = resolveBackground(bgColor.value, bgRole);
|
|
97
|
+
const [fgDecl, bgDeclOverride, clipText] = resolveForeground(
|
|
98
|
+
color.value,
|
|
99
|
+
bgColor.value,
|
|
100
|
+
bgIntentFg,
|
|
101
|
+
bgIsGradient
|
|
102
|
+
);
|
|
103
|
+
const bgDecl = bgDeclOverride ?? bgDeclBase;
|
|
80
104
|
const styles = [];
|
|
81
105
|
if (bgDecl) styles.push(bgDecl);
|
|
82
106
|
if (fgDecl) styles.push(fgDecl);
|
|
@@ -141,19 +141,33 @@ function useCreateLayout(props) {
|
|
|
141
141
|
if (instanceIndex > -1) registered.value.splice(instanceIndex, 0, id);else registered.value.push(id);
|
|
142
142
|
const index = (0, _vue.computed)(() => items.value.findIndex(i => i.id === id));
|
|
143
143
|
const zIndex = (0, _vue.computed)(() => rootZIndex.value + layers.value.length * _layout.LAYOUT_ITEM_ZINDEX_STEP - index.value * _layout.LAYOUT_ITEM_ZINDEX_STEP);
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
const styles = {
|
|
144
|
+
const isHorizontalPosition = () => position.value === "left" || position.value === "right";
|
|
145
|
+
const baseItemStyles = () => {
|
|
146
|
+
const isOpposite = position.value === "right" || position.value === "bottom";
|
|
147
|
+
return {
|
|
149
148
|
[position.value]: 0,
|
|
150
149
|
"z-index": zIndex.value,
|
|
151
|
-
"transform": `translate${
|
|
150
|
+
"transform": `translate${isHorizontalPosition() ? "X" : "Y"}(${(active.value ? 0 : _layout.LAYOUT_ITEM_HIDDEN_OFFSET) * (isOpposite ? -1 : 1)}%)`,
|
|
152
151
|
"position": absolute.value || rootZIndex.value !== _layout.ROOT_ZINDEX ? "absolute" : "fixed",
|
|
153
152
|
...(transitionsEnabled.value ? void 0 : {
|
|
154
153
|
"transition": "none"
|
|
155
154
|
})
|
|
156
155
|
};
|
|
156
|
+
};
|
|
157
|
+
const itemOffsetStyles = item => {
|
|
158
|
+
const isHorizontal = isHorizontalPosition();
|
|
159
|
+
const isOppositeHorizontal = position.value === "right";
|
|
160
|
+
return {
|
|
161
|
+
"height": isHorizontal ? `calc(100% - ${(0, _commons.convertToUnit)(item.top)} - ${(0, _commons.convertToUnit)(item.bottom)})` : elementSize.value ? `${(0, _commons.convertToUnit)(elementSize.value)}` : void 0,
|
|
162
|
+
left: isOppositeHorizontal ? void 0 : (0, _commons.convertToUnit)(item.left),
|
|
163
|
+
right: isOppositeHorizontal ? (0, _commons.convertToUnit)(item.right) : void 0,
|
|
164
|
+
top: position.value !== "bottom" ? (0, _commons.convertToUnit)(item.top) : void 0,
|
|
165
|
+
bottom: position.value !== "top" ? (0, _commons.convertToUnit)(item.bottom) : void 0,
|
|
166
|
+
"width": !isHorizontal ? `calc(100% - ${(0, _commons.convertToUnit)(item.left)} - ${(0, _commons.convertToUnit)(item.right)})` : elementSize.value ? `${(0, _commons.convertToUnit)(elementSize.value)}` : void 0
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
const layoutItemStyles = (0, _vue.computed)(() => {
|
|
170
|
+
const styles = baseItemStyles();
|
|
157
171
|
if (!isMounted.value) return styles;
|
|
158
172
|
const item = items.value[index.value];
|
|
159
173
|
if (!item) return styles;
|
|
@@ -163,12 +177,7 @@ function useCreateLayout(props) {
|
|
|
163
177
|
}
|
|
164
178
|
return {
|
|
165
179
|
...styles,
|
|
166
|
-
|
|
167
|
-
left: isOppositeHorizontal ? void 0 : (0, _commons.convertToUnit)(item.left),
|
|
168
|
-
right: isOppositeHorizontal ? (0, _commons.convertToUnit)(item.right) : void 0,
|
|
169
|
-
top: position.value !== "bottom" ? (0, _commons.convertToUnit)(item.top) : void 0,
|
|
170
|
-
bottom: position.value !== "top" ? (0, _commons.convertToUnit)(item.bottom) : void 0,
|
|
171
|
-
"width": !isHorizontal ? `calc(100% - ${(0, _commons.convertToUnit)(item.left)} - ${(0, _commons.convertToUnit)(item.right)})` : elementSize.value ? `${(0, _commons.convertToUnit)(elementSize.value)}` : void 0
|
|
180
|
+
...itemOffsetStyles(item)
|
|
172
181
|
};
|
|
173
182
|
});
|
|
174
183
|
const layoutItemScrimStyles = (0, _vue.computed)(() => ({
|
|
@@ -136,17 +136,31 @@ export function useCreateLayout(props) {
|
|
|
136
136
|
else registered.value.push(id);
|
|
137
137
|
const index = computed(() => items.value.findIndex((i) => i.id === id));
|
|
138
138
|
const zIndex = computed(() => rootZIndex.value + layers.value.length * LAYOUT_ITEM_ZINDEX_STEP - index.value * LAYOUT_ITEM_ZINDEX_STEP);
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
const styles = {
|
|
139
|
+
const isHorizontalPosition = () => position.value === "left" || position.value === "right";
|
|
140
|
+
const baseItemStyles = () => {
|
|
141
|
+
const isOpposite = position.value === "right" || position.value === "bottom";
|
|
142
|
+
return {
|
|
144
143
|
[position.value]: 0,
|
|
145
144
|
"z-index": zIndex.value,
|
|
146
|
-
"transform": `translate${
|
|
145
|
+
"transform": `translate${isHorizontalPosition() ? "X" : "Y"}(${(active.value ? 0 : LAYOUT_ITEM_HIDDEN_OFFSET) * (isOpposite ? -1 : 1)}%)`,
|
|
147
146
|
"position": absolute.value || rootZIndex.value !== ROOT_ZINDEX ? "absolute" : "fixed",
|
|
148
147
|
...transitionsEnabled.value ? void 0 : { "transition": "none" }
|
|
149
148
|
};
|
|
149
|
+
};
|
|
150
|
+
const itemOffsetStyles = (item) => {
|
|
151
|
+
const isHorizontal = isHorizontalPosition();
|
|
152
|
+
const isOppositeHorizontal = position.value === "right";
|
|
153
|
+
return {
|
|
154
|
+
"height": isHorizontal ? `calc(100% - ${convertToUnit(item.top)} - ${convertToUnit(item.bottom)})` : elementSize.value ? `${convertToUnit(elementSize.value)}` : void 0,
|
|
155
|
+
left: isOppositeHorizontal ? void 0 : convertToUnit(item.left),
|
|
156
|
+
right: isOppositeHorizontal ? convertToUnit(item.right) : void 0,
|
|
157
|
+
top: position.value !== "bottom" ? convertToUnit(item.top) : void 0,
|
|
158
|
+
bottom: position.value !== "top" ? convertToUnit(item.bottom) : void 0,
|
|
159
|
+
"width": !isHorizontal ? `calc(100% - ${convertToUnit(item.left)} - ${convertToUnit(item.right)})` : elementSize.value ? `${convertToUnit(elementSize.value)}` : void 0
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
const layoutItemStyles = computed(() => {
|
|
163
|
+
const styles = baseItemStyles();
|
|
150
164
|
if (!isMounted.value) return styles;
|
|
151
165
|
const item = items.value[index.value];
|
|
152
166
|
if (!item) return styles;
|
|
@@ -156,12 +170,7 @@ export function useCreateLayout(props) {
|
|
|
156
170
|
}
|
|
157
171
|
return {
|
|
158
172
|
...styles,
|
|
159
|
-
|
|
160
|
-
left: isOppositeHorizontal ? void 0 : convertToUnit(item.left),
|
|
161
|
-
right: isOppositeHorizontal ? convertToUnit(item.right) : void 0,
|
|
162
|
-
top: position.value !== "bottom" ? convertToUnit(item.top) : void 0,
|
|
163
|
-
bottom: position.value !== "top" ? convertToUnit(item.bottom) : void 0,
|
|
164
|
-
"width": !isHorizontal ? `calc(100% - ${convertToUnit(item.left)} - ${convertToUnit(item.right)})` : elementSize.value ? `${convertToUnit(elementSize.value)}` : void 0
|
|
173
|
+
...itemOffsetStyles(item)
|
|
165
174
|
};
|
|
166
175
|
});
|
|
167
176
|
const layoutItemScrimStyles = computed(() => ({
|
|
@@ -14,6 +14,22 @@ import type { IDelayProps } from '../../interfaces/Commons/delay.interface';
|
|
|
14
14
|
* (`cancelRef.current()`) avant d'en programmer un nouveau — un
|
|
15
15
|
* enter/leave rapide (survol qui repasse) ne declenche donc jamais les
|
|
16
16
|
* deux callbacks empiles, seul le dernier delai programme aboutit.
|
|
17
|
+
*
|
|
18
|
+
* @description
|
|
19
|
+
* ⛔ `0` et « absent » ne se comportent PAS pareil, parce que `defer` teste
|
|
20
|
+
* `timeout === 0` : avec `openDelay: 0`, `cb` est appele SYNCHRONEMENT
|
|
21
|
+
* pendant `runOpenDelay()` et le « canceller » rendu est un no-op — donc
|
|
22
|
+
* `clearDelay()` ne peut plus rien annuler. Avec la prop ABSENTE,
|
|
23
|
+
* `Number(undefined)` vaut `NaN`, le test `=== 0` echoue et on passe par
|
|
24
|
+
* `setTimeout(cb, NaN)`, que le navigateur traite comme 0 ms : le callback
|
|
25
|
+
* part au tick suivant, et reste annulable. Mesure : delai 0 → callback vu
|
|
26
|
+
* avant le retour de `runOpenDelay()` ; delai absent → rien a 0 ms, vu
|
|
27
|
+
* apres 1 ms.
|
|
28
|
+
*
|
|
29
|
+
* @description
|
|
30
|
+
* Aucun nettoyage automatique n'est enregistre : un delai arme juste avant
|
|
31
|
+
* le demontage n'est pas annule par ce composable. `useActivator`, son seul
|
|
32
|
+
* consommateur, ne l'annule pas non plus a la destruction du scope.
|
|
17
33
|
********************************************************/
|
|
18
34
|
export declare function useDelay(props: IDelayProps, cb?: (value: boolean) => void): {
|
|
19
35
|
clearDelay: () => void;
|
|
@@ -16,6 +16,17 @@ import type { IDimensionProps } from '../../interfaces/Commons/dimension.interfa
|
|
|
16
16
|
* inline, jamais de classe utilitaire — c'est le composable de reference a
|
|
17
17
|
* `extends`-er (cf. CLAUDE.md racine) plutot que de parser `height`/`width`
|
|
18
18
|
* a la main dans un nouveau composant.
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* ⛔ La garde d'emission est `if (props[dimension])` — une garde de
|
|
22
|
+
* VERACITE, pas un test de presence. Toute valeur falsy est donc omise
|
|
23
|
+
* SILENCIEUSEMENT, y compris celles que `convertToUnit` sait pourtant
|
|
24
|
+
* traduire : mesure — `height={0}` n'emet RIEN (alors que
|
|
25
|
+
* `convertToUnit(0)` rend `"0px"`), et `height={NaN}` non plus. Pour une
|
|
26
|
+
* dimension nulle, passer la chaine `"0px"`. Symetriquement, `Infinity`
|
|
27
|
+
* est truthy et traverse la garde : `convertToUnit` rend `undefined` et la
|
|
28
|
+
* declaration emise est la chaine `"height: undefined"` — invalide, donc
|
|
29
|
+
* ignoree par le navigateur.
|
|
19
30
|
********************************************************/
|
|
20
31
|
export declare function useDimension(props: IDimensionProps): {
|
|
21
32
|
dimensionStyles: import("vue").ComputedRef<string[]>;
|