@maas/vue-equipment 1.0.0-beta.35 → 1.0.0-beta.37
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/dist/composables/useScrollTo/index.js +6 -2
- package/dist/composables/useScrollTo/index.js.map +1 -1
- package/dist/nuxt/module.d.mts +2 -2
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +1 -1
- package/dist/plugins/.turbo/turbo-lint.log +2 -93
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +2 -2
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +4 -4
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.d.ts +2 -2
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.mjs +5 -5
- package/dist/plugins/MagicAccordion/src/composables/useMagicAccordion.d.ts +1 -5
- package/dist/plugins/MagicAccordion/src/composables/useMagicAccordion.mjs +2 -3
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +13 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +8 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +3 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +17 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +8 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +1 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/composables/private/useCommandItem.mjs +11 -13
- package/dist/plugins/MagicCommand/src/composables/private/useCommandView.mjs +25 -11
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/composables/private/useCookieItem.mjs +3 -1
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +0 -1
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +3 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +3 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +55 -21
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +3 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerUtils.mjs +21 -8
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +4 -4
- package/dist/plugins/MagicError/package.json +1 -1
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +4 -3
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +8 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +3 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +3 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.mjs +3 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +22 -7
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +6 -2
- package/dist/plugins/MagicMenu/src/types/index.d.ts +2 -2
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +1 -1
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +3 -1
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +1 -1
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +7 -3
- package/dist/plugins/MagicPie/src/components/MagicPie.vue.d.ts +1 -1
- package/dist/plugins/MagicPie/src/composables/private/usePieState.mjs +3 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/FullscreenEnter.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/FullscreenExit.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Pause.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Play.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/VolumeOff.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/VolumeOn.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Waiting.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.mjs +3 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue.d.ts +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +7 -3
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +1 -1
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +1 -1
- package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.mjs +3 -1
- package/dist/plugins/MagicToast/src/types/index.d.ts +8 -8
- package/dist/utils/index.js +3 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +22 -30
- /package/dist/plugins/MagicToast/{symbols → src/symbols}/index.d.ts +0 -0
- /package/dist/plugins/MagicToast/{symbols → src/symbols}/index.mjs +0 -0
|
@@ -30,7 +30,9 @@ export function useCommandItem(args) {
|
|
|
30
30
|
return item;
|
|
31
31
|
}
|
|
32
32
|
function deleteItem(id) {
|
|
33
|
-
if (!view?.items)
|
|
33
|
+
if (!view?.items) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
34
36
|
view.items = view.items.filter((x) => x.id !== id);
|
|
35
37
|
}
|
|
36
38
|
function getItem(id) {
|
|
@@ -49,12 +51,10 @@ export function useCommandItem(args) {
|
|
|
49
51
|
const index = view?.items.findIndex(
|
|
50
52
|
(item) => item.id === activeItem.value?.id
|
|
51
53
|
);
|
|
52
|
-
if (index !== void 0) {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
selectItem(
|
|
56
|
-
} else if (view && loop) {
|
|
57
|
-
selectItem(view.items[0].id);
|
|
54
|
+
if (index !== void 0 && view) {
|
|
55
|
+
const nextItem = view.items[index + 1] ?? (loop ? view.items[0] : void 0);
|
|
56
|
+
if (nextItem) {
|
|
57
|
+
selectItem(nextItem.id);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -62,12 +62,10 @@ export function useCommandItem(args) {
|
|
|
62
62
|
const index = view?.items.findIndex(
|
|
63
63
|
(item) => item.id === activeItem.value?.id
|
|
64
64
|
);
|
|
65
|
-
if (index !== void 0) {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
selectItem(
|
|
69
|
-
} else if (view && loop) {
|
|
70
|
-
selectItem(view.items[view.items.length - 1].id);
|
|
65
|
+
if (index !== void 0 && view) {
|
|
66
|
+
const prevItem = view.items[index - 1] ?? (loop ? view.items[view.items.length - 1] : void 0);
|
|
67
|
+
if (prevItem) {
|
|
68
|
+
selectItem(prevItem.id);
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
}
|
|
@@ -4,18 +4,22 @@ import { useCommandState } from "./useCommandState.mjs";
|
|
|
4
4
|
function isAbortError(error) {
|
|
5
5
|
return error instanceof DOMException && error.name === "AbortError";
|
|
6
6
|
}
|
|
7
|
+
const { logWarning } = useMagicError({
|
|
8
|
+
prefix: "MagicCommand",
|
|
9
|
+
source: "useCommandView"
|
|
10
|
+
});
|
|
7
11
|
export function useCommandView(id) {
|
|
8
12
|
const { initializeState } = useCommandState(id);
|
|
9
|
-
const { logWarning } = useMagicError({
|
|
10
|
-
prefix: "MagicCommand",
|
|
11
|
-
source: "useCommandView"
|
|
12
|
-
});
|
|
13
13
|
const state = initializeState();
|
|
14
14
|
const currentInstanceId = toValue(id);
|
|
15
15
|
const currentView = computed(() => {
|
|
16
16
|
const activeViews = state.views.filter((view) => view.active);
|
|
17
|
-
if (activeViews.length === 0)
|
|
18
|
-
|
|
17
|
+
if (activeViews.length === 0) {
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
if (activeViews.length === 1) {
|
|
21
|
+
return activeViews[0];
|
|
22
|
+
}
|
|
19
23
|
return activeViews.reduce(
|
|
20
24
|
(a, b) => a.parent.views.length >= b.parent.views.length ? a : b
|
|
21
25
|
);
|
|
@@ -77,7 +81,9 @@ export function useCommandView(id) {
|
|
|
77
81
|
}
|
|
78
82
|
function getRelativeViewIndex(id2) {
|
|
79
83
|
const view = getView(id2);
|
|
80
|
-
if (!view)
|
|
84
|
+
if (!view) {
|
|
85
|
+
return -1;
|
|
86
|
+
}
|
|
81
87
|
const nestingLevel = view.parent.views.length;
|
|
82
88
|
return state.views.findIndex(
|
|
83
89
|
(v) => v.parent.views.length === nestingLevel && v.id === id2
|
|
@@ -99,19 +105,25 @@ export function useCommandView(id) {
|
|
|
99
105
|
}
|
|
100
106
|
function getParentView(id2) {
|
|
101
107
|
const view = getView(id2);
|
|
102
|
-
if (!view)
|
|
108
|
+
if (!view) {
|
|
109
|
+
return void 0;
|
|
110
|
+
}
|
|
103
111
|
const parentId = view.parent.views[view.parent.views.length - 1];
|
|
104
112
|
return parentId ? getView(parentId) : void 0;
|
|
105
113
|
}
|
|
106
114
|
function getUnrelatedViews(id2) {
|
|
107
115
|
const view = getView(id2);
|
|
108
|
-
if (!view)
|
|
116
|
+
if (!view) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
109
119
|
const parentViewsSet = new Set(view.parent.views);
|
|
110
120
|
return state.views.filter((v) => v.id !== id2 && !parentViewsSet.has(v.id));
|
|
111
121
|
}
|
|
112
122
|
async function selectView(id2, delayMs = 0) {
|
|
113
123
|
const view = getView(id2);
|
|
114
|
-
if (!view)
|
|
124
|
+
if (!view) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
115
127
|
if (view.state.unselectAbortController) {
|
|
116
128
|
view.state.unselectAbortController.abort();
|
|
117
129
|
}
|
|
@@ -138,7 +150,9 @@ export function useCommandView(id) {
|
|
|
138
150
|
}
|
|
139
151
|
async function unselectView(id2, delayMs = 0) {
|
|
140
152
|
const view = getView(id2);
|
|
141
|
-
if (!view)
|
|
153
|
+
if (!view) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
142
156
|
if (view.state.selectAbortController) {
|
|
143
157
|
view.state.selectAbortController.abort();
|
|
144
158
|
}
|
|
@@ -9,7 +9,7 @@ declare var __VLS_1: {
|
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_1) => any;
|
|
11
11
|
};
|
|
12
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicCookieItemProps,
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicCookieItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicCookieItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
14
|
export default _default;
|
|
15
15
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -8,7 +8,7 @@ declare var __VLS_7: {};
|
|
|
8
8
|
type __VLS_Slots = {} & {
|
|
9
9
|
default?: (props: typeof __VLS_7) => any;
|
|
10
10
|
};
|
|
11
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicCookieProviderProps,
|
|
11
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicCookieProviderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicCookieProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
12
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
13
13
|
export default _default;
|
|
14
14
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -6,7 +6,7 @@ declare var __VLS_19: {
|
|
|
6
6
|
type __VLS_Slots = {} & {
|
|
7
7
|
default?: (props: typeof __VLS_19) => any;
|
|
8
8
|
};
|
|
9
|
-
declare const __VLS_component: import("vue").DefineComponent<{},
|
|
9
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
10
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
11
11
|
export default _default;
|
|
12
12
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -8,7 +8,7 @@ declare var __VLS_12: {};
|
|
|
8
8
|
type __VLS_Slots = {} & {
|
|
9
9
|
default?: (props: typeof __VLS_12) => any;
|
|
10
10
|
};
|
|
11
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicDraggableProps,
|
|
11
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicDraggableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicDraggableProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
12
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
13
13
|
export default _default;
|
|
14
14
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -15,7 +15,9 @@ export function useDraggableScrollLock() {
|
|
|
15
15
|
scrollLock.value = false;
|
|
16
16
|
}
|
|
17
17
|
function addScrollLockPadding() {
|
|
18
|
-
if (typeof window === "undefined")
|
|
18
|
+
if (typeof window === "undefined") {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
19
21
|
const exclude = new RegExp(/magic-draggable/);
|
|
20
22
|
document.body.style.setProperty(
|
|
21
23
|
"--scrollbar-width",
|
|
@@ -206,7 +206,7 @@ function convertToPixels(value) {
|
|
|
206
206
|
);
|
|
207
207
|
return 0;
|
|
208
208
|
}
|
|
209
|
-
const numericValue = parseFloat(match[1]);
|
|
209
|
+
const numericValue = parseFloat(match[1] ?? "");
|
|
210
210
|
const unit = match[2];
|
|
211
211
|
const bodyFontSize = window.getComputedStyle(document.body).fontSize;
|
|
212
212
|
const rootFontSize = parseFloat(bodyFontSize) || 16;
|
|
@@ -20,7 +20,7 @@ type __VLS_Slots = {} & {
|
|
|
20
20
|
} & {
|
|
21
21
|
default?: (props: typeof __VLS_37) => any;
|
|
22
22
|
};
|
|
23
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicDrawerProps,
|
|
23
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicDrawerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicDrawerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
24
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
25
25
|
export default _default;
|
|
26
26
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -38,7 +38,9 @@ export function useDrawerDOM(args) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function addScrollLockPadding() {
|
|
41
|
-
if (typeof window === "undefined")
|
|
41
|
+
if (typeof window === "undefined") {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
42
44
|
const exclude = new RegExp(/magic-drawer(__backdrop)?/);
|
|
43
45
|
document.body.style.setProperty(
|
|
44
46
|
"--scrollbar-width",
|
|
@@ -36,13 +36,16 @@ export function useDrawerSnap(args) {
|
|
|
36
36
|
() => toValue(snapPoints),
|
|
37
37
|
() => {
|
|
38
38
|
const extended = toValue(preventDragClose) ? toValue(snapPoints) : [...toValue(snapPoints), 0];
|
|
39
|
-
const mapped = extended.reduce(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
const mapped = extended.reduce(
|
|
40
|
+
(acc, current) => {
|
|
41
|
+
const key = mapSnapPoint(current);
|
|
42
|
+
if (key || key === 0) {
|
|
43
|
+
acc[key] = current;
|
|
44
|
+
}
|
|
45
|
+
return acc;
|
|
46
|
+
},
|
|
47
|
+
{}
|
|
48
|
+
);
|
|
46
49
|
return mapped;
|
|
47
50
|
}
|
|
48
51
|
);
|
|
@@ -104,30 +107,54 @@ export function useDrawerSnap(args) {
|
|
|
104
107
|
switch (position) {
|
|
105
108
|
case "bottom": {
|
|
106
109
|
const rect = toValue(wrapperRect);
|
|
107
|
-
if (reversedSnapPoint === 1)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
if (reversedSnapPoint === 1) {
|
|
111
|
+
return drawerHeight.value;
|
|
112
|
+
}
|
|
113
|
+
if (reversedSnapPoint === 0) {
|
|
114
|
+
return 0;
|
|
115
|
+
}
|
|
116
|
+
if (!rect) {
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
110
119
|
return vh * reversedSnapPoint - rect.top;
|
|
111
120
|
}
|
|
112
121
|
case "top": {
|
|
113
122
|
const rect = toValue(wrapperRect);
|
|
114
|
-
if (reversedSnapPoint === 1)
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
if (reversedSnapPoint === 1) {
|
|
124
|
+
return drawerHeight.value * -1;
|
|
125
|
+
}
|
|
126
|
+
if (reversedSnapPoint === 0) {
|
|
127
|
+
return 0;
|
|
128
|
+
}
|
|
129
|
+
if (!rect) {
|
|
130
|
+
return 0;
|
|
131
|
+
}
|
|
117
132
|
return vh * reversedSnapPoint - rect.bottom;
|
|
118
133
|
}
|
|
119
134
|
case "right": {
|
|
120
135
|
const rect = toValue(wrapperRect);
|
|
121
|
-
if (reversedSnapPoint === 1)
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
if (reversedSnapPoint === 1) {
|
|
137
|
+
return drawerWidth.value;
|
|
138
|
+
}
|
|
139
|
+
if (reversedSnapPoint === 0) {
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
142
|
+
if (!rect) {
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
124
145
|
return vw * reversedSnapPoint - rect.left;
|
|
125
146
|
}
|
|
126
147
|
case "left": {
|
|
127
148
|
const rect = toValue(wrapperRect);
|
|
128
|
-
if (reversedSnapPoint === 1)
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
if (reversedSnapPoint === 1) {
|
|
150
|
+
return drawerWidth.value * -1;
|
|
151
|
+
}
|
|
152
|
+
if (reversedSnapPoint === 0) {
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
155
|
+
if (!rect) {
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
131
158
|
return vw * reversedSnapPoint - rect.right;
|
|
132
159
|
}
|
|
133
160
|
default:
|
|
@@ -159,7 +186,9 @@ export function useDrawerSnap(args) {
|
|
|
159
186
|
case "top":
|
|
160
187
|
case "bottom": {
|
|
161
188
|
const mappedSnapPointY = mapSnapPoint(snapPoint);
|
|
162
|
-
if (!mappedSnapPointY && mappedSnapPointY !== 0)
|
|
189
|
+
if (!mappedSnapPointY && mappedSnapPointY !== 0) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
163
192
|
const closestY = findClosestSnapPoint({
|
|
164
193
|
draggedX,
|
|
165
194
|
draggedY: mappedSnapPointY
|
|
@@ -176,7 +205,9 @@ export function useDrawerSnap(args) {
|
|
|
176
205
|
case "left":
|
|
177
206
|
case "right": {
|
|
178
207
|
const mappedSnapPointX = mapSnapPoint(toValue(snapPoint));
|
|
179
|
-
if (!mappedSnapPointX && mappedSnapPointX !== 0)
|
|
208
|
+
if (!mappedSnapPointX && mappedSnapPointX !== 0) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
180
211
|
const closestX = findClosestSnapPoint({
|
|
181
212
|
draggedX: mappedSnapPointX,
|
|
182
213
|
draggedY
|
|
@@ -200,6 +231,9 @@ export function useDrawerSnap(args) {
|
|
|
200
231
|
easing
|
|
201
232
|
} = args2;
|
|
202
233
|
const snapPoint = snapPointsMap.value[to];
|
|
234
|
+
if (!snapPoint && snapPoint !== 0) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
203
237
|
emitter.emit("beforeSnap", { id: toValue(id), snapPoint });
|
|
204
238
|
switch (position) {
|
|
205
239
|
case "bottom":
|
|
@@ -38,7 +38,9 @@ export function useDrawerState(id) {
|
|
|
38
38
|
let state = drawerStateStore.value.find((entry) => {
|
|
39
39
|
return entry.id === id;
|
|
40
40
|
});
|
|
41
|
-
if (!state)
|
|
41
|
+
if (!state) {
|
|
42
|
+
state = addState(toValue(id));
|
|
43
|
+
}
|
|
42
44
|
return state;
|
|
43
45
|
}
|
|
44
46
|
function deleteState() {
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
export function useDrawerUtils() {
|
|
2
2
|
function clamp(value, from, to) {
|
|
3
3
|
if (from > to) {
|
|
4
|
-
if (value > from)
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
if (value > from) {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
if (value < to) {
|
|
8
|
+
return to;
|
|
9
|
+
} else {
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
7
12
|
} else if (from < to) {
|
|
8
|
-
if (value < from)
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
if (value < from) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if (value > to) {
|
|
17
|
+
return to;
|
|
18
|
+
} else {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
11
21
|
} else {
|
|
12
|
-
if (value < to)
|
|
13
|
-
|
|
22
|
+
if (value < to) {
|
|
23
|
+
return to;
|
|
24
|
+
} else {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
14
27
|
}
|
|
15
28
|
}
|
|
16
29
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function useMagicEmitter(): {
|
|
2
2
|
on: {
|
|
3
|
-
<Key extends "progress" | "
|
|
3
|
+
<Key extends "progress" | "collision" | keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents | keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents | "acceptAll" | "rejectAll" | "acceptSelected" | keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>(type: Key, handler: import("mitt").Handler<({
|
|
4
4
|
beforeEnter: string | {
|
|
5
5
|
id: string;
|
|
6
6
|
viewId: string;
|
|
@@ -536,7 +536,7 @@ export declare function useMagicEmitter(): {
|
|
|
536
536
|
} & Omit<object, keyof import("../../../MagicToast/src/types/index.js").ToastEvents>, "collision">, keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents>, keyof import("../../../MagicMenu/src/types/index.js").MenuEvents>, keyof import("../../../MagicModal/src/types/index.js").ModalEvents>, keyof import("../../../MagicDrawer/src/types/index.js").DrawerEvents>, keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents>, keyof import("../../../MagicCookie/src/types/index.js").CookieEvents>, keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>>): void;
|
|
537
537
|
};
|
|
538
538
|
off: {
|
|
539
|
-
<Key extends "progress" | "
|
|
539
|
+
<Key extends "progress" | "collision" | keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents | keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents | "acceptAll" | "rejectAll" | "acceptSelected" | keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>(type: Key, handler?: import("mitt").Handler<({
|
|
540
540
|
beforeEnter: string | {
|
|
541
541
|
id: string;
|
|
542
542
|
viewId: string;
|
|
@@ -1072,7 +1072,7 @@ export declare function useMagicEmitter(): {
|
|
|
1072
1072
|
} & Omit<object, keyof import("../../../MagicToast/src/types/index.js").ToastEvents>, "collision">, keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents>, keyof import("../../../MagicMenu/src/types/index.js").MenuEvents>, keyof import("../../../MagicModal/src/types/index.js").ModalEvents>, keyof import("../../../MagicDrawer/src/types/index.js").DrawerEvents>, keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents>, keyof import("../../../MagicCookie/src/types/index.js").CookieEvents>, keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>>): void;
|
|
1073
1073
|
};
|
|
1074
1074
|
emit: {
|
|
1075
|
-
<Key extends "progress" | "
|
|
1075
|
+
<Key extends "progress" | "collision" | keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents | keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents | "acceptAll" | "rejectAll" | "acceptSelected" | keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>(type: Key, event: ({
|
|
1076
1076
|
beforeEnter: string | {
|
|
1077
1077
|
id: string;
|
|
1078
1078
|
viewId: string;
|
|
@@ -1339,7 +1339,7 @@ export declare function useMagicEmitter(): {
|
|
|
1339
1339
|
leave: string;
|
|
1340
1340
|
afterLeave: string;
|
|
1341
1341
|
} & Omit<object, keyof import("../../../MagicToast/src/types/index.js").ToastEvents>, "collision">, keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents>, keyof import("../../../MagicMenu/src/types/index.js").MenuEvents>, keyof import("../../../MagicModal/src/types/index.js").ModalEvents>, keyof import("../../../MagicDrawer/src/types/index.js").DrawerEvents>, keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents>, keyof import("../../../MagicCookie/src/types/index.js").CookieEvents>, keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>)[Key]): void;
|
|
1342
|
-
<Key extends "progress" | "
|
|
1342
|
+
<Key extends "progress" | "collision" | keyof import("../../../MagicPlayer/src/types/index.js").PlayerEvents | keyof import("../../../MagicDraggable/src/types/index.js").DraggableEvents | "acceptAll" | "rejectAll" | "acceptSelected" | keyof import("../../../MagicAccordion/src/types/index.js").AccordionEvents>(type: undefined extends ({
|
|
1343
1343
|
beforeEnter: string | {
|
|
1344
1344
|
id: string;
|
|
1345
1345
|
viewId: string;
|
|
@@ -10,7 +10,7 @@ type __VLS_Slots = {} & {
|
|
|
10
10
|
} & {
|
|
11
11
|
default?: (props: typeof __VLS_3) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMarqueeProps,
|
|
13
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMarqueeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMarqueeProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
15
15
|
export default _default;
|
|
16
16
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -6,7 +6,7 @@ declare var __VLS_6: {};
|
|
|
6
6
|
type __VLS_Slots = {} & {
|
|
7
7
|
default?: (props: typeof __VLS_6) => any;
|
|
8
8
|
};
|
|
9
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMenuChannelProps,
|
|
9
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuChannelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuChannelProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
10
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
11
11
|
export default _default;
|
|
12
12
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -14,7 +14,7 @@ type __VLS_Slots = {} & {
|
|
|
14
14
|
} & {
|
|
15
15
|
default?: (props: typeof __VLS_28) => any;
|
|
16
16
|
};
|
|
17
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMenuContentProps,
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuContentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuContentProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
19
|
export default _default;
|
|
20
20
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -41,7 +41,7 @@ import { useMenuView } from "../composables/private/useMenuView";
|
|
|
41
41
|
import { useMenuState } from "../composables/private/useMenuState";
|
|
42
42
|
import { ModeFloatingStrategy } from "../utils/modeFloatingStrategyDefaults";
|
|
43
43
|
const { placement, middleware, arrow, referenceEl } = defineProps({
|
|
44
|
-
placement: { type:
|
|
44
|
+
placement: { type: String, required: false },
|
|
45
45
|
middleware: { type: Array, required: false },
|
|
46
46
|
arrow: { type: Boolean, required: false },
|
|
47
47
|
referenceEl: { type: null, required: false }
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type MaybeRef, type ComponentPublicInstance } from 'vue';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Middleware } from '@floating-ui/vue';
|
|
3
|
+
import type { MenuPlacement } from '../types/index.js';
|
|
3
4
|
interface MagicMenuFloatProps {
|
|
4
|
-
placement?:
|
|
5
|
+
placement?: MenuPlacement;
|
|
5
6
|
middleware?: Middleware[];
|
|
6
7
|
arrow?: boolean;
|
|
7
8
|
referenceEl?: MaybeRef<HTMLElement | ComponentPublicInstance>;
|
|
@@ -12,7 +13,7 @@ type __VLS_Slots = {} & {
|
|
|
12
13
|
} & {
|
|
13
14
|
default?: (props: typeof __VLS_3) => any;
|
|
14
15
|
};
|
|
15
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMenuFloatProps,
|
|
16
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuFloatProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuFloatProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
17
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
17
18
|
export default _default;
|
|
18
19
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup>
|
|
20
|
+
import { onKeyStroke } from "@vueuse/core";
|
|
20
21
|
import { computed, inject, provide, onBeforeUnmount, watch, useId } from "vue";
|
|
21
22
|
import {
|
|
22
23
|
useMagicError
|
|
@@ -35,7 +36,7 @@ const { id, disabled } = defineProps({
|
|
|
35
36
|
id: { type: String, required: false },
|
|
36
37
|
disabled: { type: Boolean, required: false }
|
|
37
38
|
});
|
|
38
|
-
const emit = defineEmits(["click"]);
|
|
39
|
+
const emit = defineEmits(["click", "enter"]);
|
|
39
40
|
const magicError = useMagicError({
|
|
40
41
|
prefix: "MagicMenu",
|
|
41
42
|
source: "MagicMenu"
|
|
@@ -102,8 +103,14 @@ function onClick(event) {
|
|
|
102
103
|
unselectAllViews();
|
|
103
104
|
}
|
|
104
105
|
}
|
|
106
|
+
function onReturn() {
|
|
107
|
+
if (!item.disabled && item.active) {
|
|
108
|
+
emit("enter");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
105
111
|
provide(MagicMenuItemId, mappedId.value);
|
|
106
112
|
provide(MagicMenuItemActive, mappedActive);
|
|
113
|
+
onKeyStroke("Enter", onReturn);
|
|
107
114
|
onBeforeUnmount(() => {
|
|
108
115
|
deleteItem(mappedId.value);
|
|
109
116
|
});
|
|
@@ -9,10 +9,12 @@ declare var __VLS_1: {
|
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_1) => any;
|
|
11
11
|
};
|
|
12
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMenuItemProps,
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
13
13
|
click: (event: MouseEvent) => any;
|
|
14
|
+
enter: () => any;
|
|
14
15
|
}, string, import("vue").PublicProps, Readonly<MagicMenuItemProps> & Readonly<{
|
|
15
16
|
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
17
|
+
onEnter?: (() => any) | undefined;
|
|
16
18
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
19
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
18
20
|
export default _default;
|
|
@@ -9,7 +9,7 @@ declare var __VLS_8: {};
|
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_8) => any;
|
|
11
11
|
};
|
|
12
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMenuProviderProps,
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuProviderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
14
|
export default _default;
|
|
15
15
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -14,7 +14,7 @@ declare var __VLS_11: {
|
|
|
14
14
|
type __VLS_Slots = {} & {
|
|
15
15
|
default?: (props: typeof __VLS_11) => any;
|
|
16
16
|
};
|
|
17
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMenuRemoteProps,
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuRemoteProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuRemoteProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
19
|
export default _default;
|
|
20
20
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -13,7 +13,7 @@ declare var __VLS_13: {
|
|
|
13
13
|
type __VLS_Slots = {} & {
|
|
14
14
|
default?: (props: typeof __VLS_13) => any;
|
|
15
15
|
};
|
|
16
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMenuTriggerProps,
|
|
16
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuTriggerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
18
18
|
export default _default;
|
|
19
19
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { useMenuState } from "../composables/private/useMenuState";
|
|
21
21
|
const { id, placement } = defineProps({
|
|
22
22
|
id: { type: String, required: false },
|
|
23
|
-
placement: { type:
|
|
23
|
+
placement: { type: String, required: false }
|
|
24
24
|
});
|
|
25
25
|
const magicError = useMagicError({
|
|
26
26
|
prefix: "MagicMenu",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MenuPlacement } from '../types/index.js';
|
|
2
2
|
interface MagicMenuViewProps {
|
|
3
3
|
id?: string;
|
|
4
|
-
placement?:
|
|
4
|
+
placement?: MenuPlacement;
|
|
5
5
|
}
|
|
6
6
|
declare var __VLS_1: {
|
|
7
7
|
viewActive: boolean;
|
|
@@ -9,7 +9,7 @@ declare var __VLS_1: {
|
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_1) => any;
|
|
11
11
|
};
|
|
12
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicMenuViewProps,
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
14
|
export default _default;
|
|
15
15
|
type __VLS_WithSlots<T, S> = T & {
|