@maas/vue-equipment 0.30.7 → 0.32.0
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/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +8 -1
- package/dist/plugins/MagicAccordion/index.d.ts +5 -0
- package/dist/plugins/MagicAccordion/index.mjs +25 -0
- package/dist/plugins/MagicAccordion/nuxt.d.ts +2 -0
- package/dist/plugins/MagicAccordion/nuxt.mjs +23 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue +72 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +26 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +31 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +27 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +71 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +47 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +55 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +25 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionCallback.d.ts +14 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionCallback.mjs +32 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionState.d.ts +7 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionState.mjs +42 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.d.ts +16 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.mjs +35 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionView.d.ts +12 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionView.mjs +60 -0
- package/dist/plugins/MagicAccordion/src/composables/useMagicAccordion.d.ts +10 -0
- package/dist/plugins/MagicAccordion/src/composables/useMagicAccordion.mjs +9 -0
- package/dist/plugins/MagicAccordion/src/symbols/index.d.ts +5 -0
- package/dist/plugins/MagicAccordion/src/symbols/index.mjs +8 -0
- package/dist/plugins/MagicAccordion/src/types/index.d.ts +43 -0
- package/dist/plugins/MagicAccordion/src/types/index.mjs +0 -0
- package/dist/plugins/MagicAccordion/src/utils/defaultOptions.d.ts +4 -0
- package/dist/plugins/MagicAccordion/src/utils/defaultOptions.mjs +6 -0
- package/dist/plugins/MagicAutoSize/src/components/MagicAutoSize.vue +43 -4
- package/dist/plugins/MagicAutoSize/src/components/MagicAutoSize.vue.d.ts +5 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +3 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.d.ts +2 -45
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +3 -2
- package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.mjs +5 -8
- package/dist/plugins/MagicDrawer/src/types/index.d.ts +1 -0
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +376 -118
- package/dist/plugins/MagicEmitter/src/types/index.d.ts +2 -0
- package/dist/plugins/MagicMenu/index.d.ts +2 -2
- package/dist/plugins/MagicMenu/index.mjs +14 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +15 -4
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +8 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.d.ts +3 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.mjs +29 -29
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.mjs +9 -13
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +6 -6
- package/dist/plugins/MagicMenu/src/types/index.d.ts +33 -8
- package/dist/plugins/MagicMenu/src/utils/defaultOptions.d.ts +2 -3
- package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.d.ts +15 -0
- package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.mjs +18 -0
- package/dist/plugins/MagicMenu/src/utils/modeFloatingStrategyDefaults.d.ts +6 -0
- package/dist/plugins/MagicMenu/src/utils/modeFloatingStrategyDefaults.mjs +7 -0
- package/dist/plugins/MagicMenu/src/utils/modeScrollLockDefaults.d.ts +12 -0
- package/dist/plugins/MagicMenu/src/utils/modeScrollLockDefaults.mjs +13 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +1 -1
- package/dist/plugins/MagicScroll/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastApi.d.ts +1 -1
- package/dist/plugins/MagicToast/src/composables/private/useToastStore.d.ts +14 -4
- package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +5 -5
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/utils/css/easings.css +4 -0
- package/package.json +1 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerStore.d.ts +0 -5
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerStore.mjs +0 -15
- /package/dist/plugins/MagicMenu/src/utils/{modeTransitions.d.ts → modeTransitionDefaults.d.ts} +0 -0
- /package/dist/plugins/MagicMenu/src/utils/{modeTransitions.mjs → modeTransitionDefaults.mjs} +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AccordionEvents } from '../../../MagicAccordion/src/types/index.js';
|
|
1
2
|
import type { CookieEvents } from '../../../MagicCookie/src/types/index.js';
|
|
2
3
|
import type { DraggableEvents } from '../../../MagicDraggable/src/types/index.js';
|
|
3
4
|
import type { DrawerEvents } from '../../../MagicDrawer/src/types/index.js';
|
|
@@ -10,6 +11,7 @@ type MergeTypes<T, U> = {
|
|
|
10
11
|
} & Omit<U, keyof T>;
|
|
11
12
|
type Merge<T extends unknown[]> = T extends [infer First, ...infer Rest] ? MergeTypes<First, Merge<Rest>> : {};
|
|
12
13
|
export type MagicEmitterEvents = Merge<[
|
|
14
|
+
AccordionEvents,
|
|
13
15
|
CookieEvents,
|
|
14
16
|
DraggableEvents,
|
|
15
17
|
DrawerEvents,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMagicMenu } from './src/composables/useMagicMenu.js';
|
|
2
|
-
import { MagicMenuInstanceId, MagicMenuItemActive, MagicMenuParentTree } from './src/symbols/index.js';
|
|
2
|
+
import { MagicMenuInstanceId, MagicMenuViewId, MagicMenuViewActive, MagicMenuItemId, MagicMenuItemActive, MagicMenuParentTree, MagicMenuChannelId, MagicMenuChannelActive, MagicMenuContentId } from './src/symbols/index.js';
|
|
3
3
|
import type { Plugin } from 'vue';
|
|
4
4
|
declare const MagicMenuPlugin: Plugin;
|
|
5
|
-
export { MagicMenuPlugin, useMagicMenu, MagicMenuInstanceId, MagicMenuItemActive, MagicMenuParentTree, };
|
|
5
|
+
export { MagicMenuPlugin, useMagicMenu, MagicMenuInstanceId, MagicMenuViewId, MagicMenuViewActive, MagicMenuItemId, MagicMenuItemActive, MagicMenuParentTree, MagicMenuChannelId, MagicMenuChannelActive, MagicMenuContentId, };
|
|
@@ -9,8 +9,14 @@ import MagicMenuView from "./src/components/MagicMenuView.vue";
|
|
|
9
9
|
import { useMagicMenu } from "./src/composables/useMagicMenu.mjs";
|
|
10
10
|
import {
|
|
11
11
|
MagicMenuInstanceId,
|
|
12
|
+
MagicMenuViewId,
|
|
13
|
+
MagicMenuViewActive,
|
|
14
|
+
MagicMenuItemId,
|
|
12
15
|
MagicMenuItemActive,
|
|
13
|
-
MagicMenuParentTree
|
|
16
|
+
MagicMenuParentTree,
|
|
17
|
+
MagicMenuChannelId,
|
|
18
|
+
MagicMenuChannelActive,
|
|
19
|
+
MagicMenuContentId
|
|
14
20
|
} from "./src/symbols/index.mjs";
|
|
15
21
|
const MagicMenuPlugin = {
|
|
16
22
|
install: (app) => {
|
|
@@ -28,6 +34,12 @@ export {
|
|
|
28
34
|
MagicMenuPlugin,
|
|
29
35
|
useMagicMenu,
|
|
30
36
|
MagicMenuInstanceId,
|
|
37
|
+
MagicMenuViewId,
|
|
38
|
+
MagicMenuViewActive,
|
|
39
|
+
MagicMenuItemId,
|
|
31
40
|
MagicMenuItemActive,
|
|
32
|
-
MagicMenuParentTree
|
|
41
|
+
MagicMenuParentTree,
|
|
42
|
+
MagicMenuChannelId,
|
|
43
|
+
MagicMenuChannelActive,
|
|
44
|
+
MagicMenuContentId
|
|
33
45
|
};
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
</transition>
|
|
38
38
|
<span
|
|
39
39
|
v-for="point in coords"
|
|
40
|
+
v-if="state.options.debug"
|
|
40
41
|
:style="{
|
|
41
42
|
background: 'red',
|
|
42
43
|
position: 'fixed',
|
|
@@ -69,6 +70,8 @@ import { useMenuState } from '../composables/private/useMenuState'
|
|
|
69
70
|
import { useMenuCallback } from '../composables/private/useMenuCallback'
|
|
70
71
|
import { useMenuDOM } from '../composables/private/useMenuDOM'
|
|
71
72
|
import { useMenuCursor } from '../composables/private/useMenuCursor'
|
|
73
|
+
import { ModeTransitions } from '../utils/modeTransitionDefaults'
|
|
74
|
+
import { ModeDelayMouseleave } from '../utils/modeDelayDefaults'
|
|
72
75
|
import {
|
|
73
76
|
MagicMenuInstanceId,
|
|
74
77
|
MagicMenuViewId,
|
|
@@ -77,7 +80,6 @@ import {
|
|
|
77
80
|
|
|
78
81
|
import '@maas/vue-equipment/utils/css/animations/fade-in.css'
|
|
79
82
|
import '@maas/vue-equipment/utils/css/animations/fade-out.css'
|
|
80
|
-
import { ModeTransitions } from '../utils/modeTransitions'
|
|
81
83
|
|
|
82
84
|
defineOptions({
|
|
83
85
|
inheritAttrs: false,
|
|
@@ -126,7 +128,12 @@ const mappedTransition = computed(() => {
|
|
|
126
128
|
const innerActive = ref(false)
|
|
127
129
|
const wrapperActive = ref(false)
|
|
128
130
|
|
|
129
|
-
const {
|
|
131
|
+
const {
|
|
132
|
+
lockScroll,
|
|
133
|
+
unlockScroll,
|
|
134
|
+
addScrollLockPadding,
|
|
135
|
+
removeScrollLockPadding,
|
|
136
|
+
} = useMenuDOM()
|
|
130
137
|
const {
|
|
131
138
|
onBeforeEnter,
|
|
132
139
|
onEnter,
|
|
@@ -138,9 +145,11 @@ const {
|
|
|
138
145
|
state,
|
|
139
146
|
instanceId,
|
|
140
147
|
viewId,
|
|
148
|
+
wrapperActive,
|
|
141
149
|
lockScroll,
|
|
142
150
|
unlockScroll,
|
|
143
|
-
|
|
151
|
+
addScrollLockPadding,
|
|
152
|
+
removeScrollLockPadding,
|
|
144
153
|
})
|
|
145
154
|
|
|
146
155
|
// Handle state
|
|
@@ -208,7 +217,9 @@ watch(isOutside, (value, oldValue) => {
|
|
|
208
217
|
if (value && !oldValue) {
|
|
209
218
|
switch (state.options.mode) {
|
|
210
219
|
case 'navigation':
|
|
211
|
-
|
|
220
|
+
const delay =
|
|
221
|
+
state.options.delay?.mouseleave ?? ModeDelayMouseleave.navigation
|
|
222
|
+
unselectView(viewId, delay)
|
|
212
223
|
}
|
|
213
224
|
}
|
|
214
225
|
})
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
import { MagicMenuInstanceId, MagicMenuViewId } from '../symbols'
|
|
43
43
|
import { useMenuView } from '../composables/private/useMenuView'
|
|
44
44
|
import { useMenuState } from '../composables/private/useMenuState'
|
|
45
|
+
import { ModeFloatingStrategy } from '../utils/modeFloatingStrategyDefaults'
|
|
45
46
|
|
|
46
47
|
interface MagicMenuFloatProps {
|
|
47
48
|
placement?: Placement
|
|
@@ -165,11 +166,18 @@ const mappedReferenceEl = computed(() => {
|
|
|
165
166
|
}
|
|
166
167
|
})
|
|
167
168
|
|
|
169
|
+
const mappedStrategy = computed(() => {
|
|
170
|
+
return (
|
|
171
|
+
state.options.floating?.strategy ?? ModeFloatingStrategy[state.options.mode]
|
|
172
|
+
)
|
|
173
|
+
})
|
|
174
|
+
|
|
168
175
|
const { floatingStyles, placement, middlewareData } = useFloating(
|
|
169
176
|
mappedReferenceEl,
|
|
170
177
|
elRef,
|
|
171
178
|
{
|
|
172
179
|
placement: mappedPlacement,
|
|
180
|
+
strategy: mappedStrategy,
|
|
173
181
|
whileElementsMounted: autoUpdate,
|
|
174
182
|
middleware: mappedMiddleware,
|
|
175
183
|
}
|
|
@@ -4,9 +4,11 @@ type UseMenuCallbackArgs = {
|
|
|
4
4
|
state: MenuState;
|
|
5
5
|
instanceId: MaybeRef<string>;
|
|
6
6
|
viewId: string;
|
|
7
|
+
wrapperActive: Ref<boolean>;
|
|
7
8
|
lockScroll: () => void;
|
|
8
9
|
unlockScroll: () => void;
|
|
9
|
-
|
|
10
|
+
addScrollLockPadding: () => void;
|
|
11
|
+
removeScrollLockPadding: () => void;
|
|
10
12
|
};
|
|
11
13
|
export declare function useMenuCallback(args: UseMenuCallbackArgs): {
|
|
12
14
|
onBeforeEnter: (_el: Element) => void;
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
import { toValue } from "vue";
|
|
2
2
|
import { useMagicEmitter } from "@maas/vue-equipment/plugins";
|
|
3
|
+
import { ModeScrollLock } from "../../utils/modeScrollLockDefaults.mjs";
|
|
3
4
|
export function useMenuCallback(args) {
|
|
4
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
state,
|
|
7
|
+
instanceId,
|
|
8
|
+
viewId,
|
|
9
|
+
wrapperActive,
|
|
10
|
+
lockScroll,
|
|
11
|
+
unlockScroll,
|
|
12
|
+
addScrollLockPadding,
|
|
13
|
+
removeScrollLockPadding
|
|
14
|
+
} = args;
|
|
5
15
|
const emitter = useMagicEmitter();
|
|
6
16
|
function onBeforeEnter(_el) {
|
|
7
|
-
emitter.emit("beforeEnter", { id: toValue(instanceId),
|
|
17
|
+
emitter.emit("beforeEnter", { id: toValue(instanceId), viewId });
|
|
8
18
|
}
|
|
9
19
|
function onEnter(_el) {
|
|
10
|
-
emitter.emit("enter", { id: toValue(instanceId),
|
|
20
|
+
emitter.emit("enter", { id: toValue(instanceId), viewId });
|
|
11
21
|
}
|
|
12
22
|
function onAfterEnter(_el) {
|
|
13
|
-
emitter.emit("afterEnter", { id: toValue(instanceId),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
case "navigation":
|
|
21
|
-
break;
|
|
22
|
-
case "context":
|
|
23
|
-
lockScroll();
|
|
24
|
-
break;
|
|
23
|
+
emitter.emit("afterEnter", { id: toValue(instanceId), viewId });
|
|
24
|
+
const scrollLock = state.options.scrollLock ?? ModeScrollLock[state.options.mode].value;
|
|
25
|
+
if (!!scrollLock) {
|
|
26
|
+
lockScroll();
|
|
27
|
+
if (typeof scrollLock === "object" && scrollLock.padding) {
|
|
28
|
+
addScrollLockPadding();
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
function onBeforeLeave(_el) {
|
|
28
|
-
emitter.emit("beforeLeave", { id: toValue(instanceId),
|
|
33
|
+
emitter.emit("beforeLeave", { id: toValue(instanceId), viewId });
|
|
29
34
|
}
|
|
30
35
|
function onLeave(_el) {
|
|
31
|
-
emitter.emit("leave", { id: toValue(instanceId),
|
|
36
|
+
emitter.emit("leave", { id: toValue(instanceId), viewId });
|
|
32
37
|
}
|
|
33
38
|
function onAfterLeave(_el) {
|
|
34
|
-
emitter.emit("afterLeave", { id: toValue(instanceId),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
case "navigation":
|
|
42
|
-
break;
|
|
43
|
-
case "context":
|
|
44
|
-
unlockScroll();
|
|
45
|
-
break;
|
|
39
|
+
emitter.emit("afterLeave", { id: toValue(instanceId), viewId });
|
|
40
|
+
const scrollLock = state.options.scrollLock ?? ModeScrollLock[state.options.mode].value;
|
|
41
|
+
if (!!scrollLock) {
|
|
42
|
+
unlockScroll();
|
|
43
|
+
if (typeof scrollLock === "object" && scrollLock.padding) {
|
|
44
|
+
removeScrollLockPadding();
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
wrapperActive.value = false;
|
|
48
48
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useMagicKeys, useFocus } from "@vueuse/core";
|
|
2
2
|
import { useMenuView } from "./useMenuView.mjs";
|
|
3
3
|
import { useMenuState } from "./useMenuState.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ModeDelayClick,
|
|
6
|
+
ModeDelayMouseenter
|
|
7
|
+
} from "../../utils/modeDelayDefaults.mjs";
|
|
4
8
|
export function useMenuTrigger(args) {
|
|
5
9
|
const { instanceId, viewId, itemId, mappedTrigger, mappedDisabled, elRef } = args;
|
|
6
10
|
const { getView, selectView, unselectView } = useMenuView(instanceId);
|
|
@@ -12,7 +16,8 @@ export function useMenuTrigger(args) {
|
|
|
12
16
|
function onRightClick(e) {
|
|
13
17
|
switch (e.button) {
|
|
14
18
|
case 2:
|
|
15
|
-
|
|
19
|
+
const delay = state.options.delay?.rightClick ?? 0;
|
|
20
|
+
selectView(viewId, delay);
|
|
16
21
|
state.active = true;
|
|
17
22
|
if (view) {
|
|
18
23
|
view.state.clicked = { x: e.clientX, y: e.clientY };
|
|
@@ -41,13 +46,8 @@ export function useMenuTrigger(args) {
|
|
|
41
46
|
if (mappedTrigger.value[0] === "mouseenter") {
|
|
42
47
|
state.active = true;
|
|
43
48
|
}
|
|
44
|
-
let delay = 0;
|
|
45
|
-
switch (state.options.mode) {
|
|
46
|
-
case "navigation":
|
|
47
|
-
delay = 200;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
49
|
if (state.active) {
|
|
50
|
+
const delay = state.options.delay?.mouseenter ?? ModeDelayMouseenter[state.options.mode];
|
|
51
51
|
selectView(viewId, delay);
|
|
52
52
|
if (!itemId) {
|
|
53
53
|
state.input.view = viewId;
|
|
@@ -57,14 +57,9 @@ export function useMenuTrigger(args) {
|
|
|
57
57
|
}
|
|
58
58
|
function onClick(e) {
|
|
59
59
|
if (mappedTrigger.value.includes("click") && !mappedDisabled.value && e.button === 0 && viewId) {
|
|
60
|
-
let delay = 0;
|
|
61
|
-
switch (state.options.mode) {
|
|
62
|
-
case "navigation":
|
|
63
|
-
delay = 200;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
60
|
switch (true) {
|
|
67
61
|
case !state.active:
|
|
62
|
+
const delay = state.options.delay?.click ?? ModeDelayClick[state.options.mode];
|
|
68
63
|
state.active = true;
|
|
69
64
|
selectView(viewId, delay);
|
|
70
65
|
if (!itemId) {
|
|
@@ -79,6 +74,7 @@ export function useMenuTrigger(args) {
|
|
|
79
74
|
}
|
|
80
75
|
if (mappedTrigger.value.includes("right-click") && viewId) {
|
|
81
76
|
e.preventDefault();
|
|
77
|
+
e.stopPropagation();
|
|
82
78
|
if (control.value || shift.value) {
|
|
83
79
|
onRightClick(
|
|
84
80
|
new MouseEvent(e.type, {
|
|
@@ -101,13 +101,13 @@ export function useMenuView(instanceId) {
|
|
|
101
101
|
await delay(delayMs, abortController.signal);
|
|
102
102
|
instance.active = true;
|
|
103
103
|
unselectUnrelatedViews(id);
|
|
104
|
-
} catch (
|
|
105
|
-
if (
|
|
104
|
+
} catch (error) {
|
|
105
|
+
if (error.name === "AbortError") {
|
|
106
106
|
console.log(
|
|
107
107
|
`selectView() was interrupted by a call to unselectView()`
|
|
108
108
|
);
|
|
109
109
|
} else {
|
|
110
|
-
throw
|
|
110
|
+
throw error;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -123,13 +123,13 @@ export function useMenuView(instanceId) {
|
|
|
123
123
|
try {
|
|
124
124
|
await delay(delayMs, abortController.signal);
|
|
125
125
|
instance.active = false;
|
|
126
|
-
} catch (
|
|
127
|
-
if (
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if (error.name === "AbortError") {
|
|
128
128
|
console.log(
|
|
129
129
|
`unselectView() was interrupted by a call to selectView()`
|
|
130
130
|
);
|
|
131
131
|
} else {
|
|
132
|
-
throw
|
|
132
|
+
throw error;
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Placement } from '@floating-ui/vue';
|
|
2
|
-
import type { RequireAllNested } from '@maas/vue-equipment/utils';
|
|
3
2
|
type MenuMode = 'dropdown' | 'menubar' | 'context' | 'navigation';
|
|
4
3
|
export interface MagicMenuOptions {
|
|
5
4
|
mode?: MenuMode;
|
|
6
5
|
debug?: boolean;
|
|
6
|
+
scrollLock?: boolean | {
|
|
7
|
+
padding: boolean;
|
|
8
|
+
};
|
|
7
9
|
transition?: {
|
|
8
10
|
content?: {
|
|
9
11
|
default?: string;
|
|
@@ -11,7 +13,30 @@ export interface MagicMenuOptions {
|
|
|
11
13
|
};
|
|
12
14
|
channel?: string;
|
|
13
15
|
};
|
|
16
|
+
floating?: {
|
|
17
|
+
strategy: 'fixed' | 'absolute';
|
|
18
|
+
};
|
|
19
|
+
delay?: {
|
|
20
|
+
mouseenter?: number;
|
|
21
|
+
mouseleave?: number;
|
|
22
|
+
click?: number;
|
|
23
|
+
rightClick?: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface RequiredMagicMenuOptions {
|
|
27
|
+
mode: MenuMode;
|
|
28
|
+
debug: boolean;
|
|
29
|
+
transition: {
|
|
30
|
+
content: {
|
|
31
|
+
default: string;
|
|
32
|
+
nested: string;
|
|
33
|
+
};
|
|
34
|
+
channel: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface OptionalMagicMenuOptions extends Pick<MagicMenuOptions, 'scrollLock' | 'floating' | 'delay'> {
|
|
14
38
|
}
|
|
39
|
+
export type CombinedMagicMenuOptions = RequiredMagicMenuOptions & OptionalMagicMenuOptions;
|
|
15
40
|
export type Interaction = 'click' | 'mouseenter' | 'right-click';
|
|
16
41
|
export type Coordinates = {
|
|
17
42
|
x: number;
|
|
@@ -46,7 +71,7 @@ export interface MenuState {
|
|
|
46
71
|
id: string;
|
|
47
72
|
active: boolean;
|
|
48
73
|
views: MenuView[];
|
|
49
|
-
options:
|
|
74
|
+
options: CombinedMagicMenuOptions;
|
|
50
75
|
input: {
|
|
51
76
|
type: 'keyboard' | 'pointer';
|
|
52
77
|
disabled: ('keyboard' | 'pointer')[];
|
|
@@ -56,27 +81,27 @@ export interface MenuState {
|
|
|
56
81
|
export type MenuEvents = {
|
|
57
82
|
beforeEnter: {
|
|
58
83
|
id: string;
|
|
59
|
-
|
|
84
|
+
viewId: string;
|
|
60
85
|
};
|
|
61
86
|
enter: {
|
|
62
87
|
id: string;
|
|
63
|
-
|
|
88
|
+
viewId: string;
|
|
64
89
|
};
|
|
65
90
|
afterEnter: {
|
|
66
91
|
id: string;
|
|
67
|
-
|
|
92
|
+
viewId: string;
|
|
68
93
|
};
|
|
69
94
|
beforeLeave: {
|
|
70
95
|
id: string;
|
|
71
|
-
|
|
96
|
+
viewId: string;
|
|
72
97
|
};
|
|
73
98
|
leave: {
|
|
74
99
|
id: string;
|
|
75
|
-
|
|
100
|
+
viewId: string;
|
|
76
101
|
};
|
|
77
102
|
afterLeave: {
|
|
78
103
|
id: string;
|
|
79
|
-
|
|
104
|
+
viewId: string;
|
|
80
105
|
};
|
|
81
106
|
};
|
|
82
107
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
declare const defaultOptions: RequireAllNested<MagicMenuOptions>;
|
|
1
|
+
import type { RequiredMagicMenuOptions } from '../types.js';
|
|
2
|
+
declare const defaultOptions: RequiredMagicMenuOptions;
|
|
4
3
|
export { defaultOptions };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum ModeDelayMouseenter {
|
|
2
|
+
menubar = 0,
|
|
3
|
+
dropdown = 0,
|
|
4
|
+
context = 0,
|
|
5
|
+
navigation = 200
|
|
6
|
+
}
|
|
7
|
+
export declare enum ModeDelayMouseleave {
|
|
8
|
+
navigation = 200
|
|
9
|
+
}
|
|
10
|
+
export declare enum ModeDelayClick {
|
|
11
|
+
menubar = 0,
|
|
12
|
+
dropdown = 0,
|
|
13
|
+
context = 0,
|
|
14
|
+
navigation = 0
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export var ModeDelayMouseenter = /* @__PURE__ */ ((ModeDelayMouseenter2) => {
|
|
2
|
+
ModeDelayMouseenter2[ModeDelayMouseenter2["menubar"] = 0] = "menubar";
|
|
3
|
+
ModeDelayMouseenter2[ModeDelayMouseenter2["dropdown"] = 0] = "dropdown";
|
|
4
|
+
ModeDelayMouseenter2[ModeDelayMouseenter2["context"] = 0] = "context";
|
|
5
|
+
ModeDelayMouseenter2[ModeDelayMouseenter2["navigation"] = 200] = "navigation";
|
|
6
|
+
return ModeDelayMouseenter2;
|
|
7
|
+
})(ModeDelayMouseenter || {});
|
|
8
|
+
export var ModeDelayMouseleave = /* @__PURE__ */ ((ModeDelayMouseleave2) => {
|
|
9
|
+
ModeDelayMouseleave2[ModeDelayMouseleave2["navigation"] = 200] = "navigation";
|
|
10
|
+
return ModeDelayMouseleave2;
|
|
11
|
+
})(ModeDelayMouseleave || {});
|
|
12
|
+
export var ModeDelayClick = /* @__PURE__ */ ((ModeDelayClick2) => {
|
|
13
|
+
ModeDelayClick2[ModeDelayClick2["menubar"] = 0] = "menubar";
|
|
14
|
+
ModeDelayClick2[ModeDelayClick2["dropdown"] = 0] = "dropdown";
|
|
15
|
+
ModeDelayClick2[ModeDelayClick2["context"] = 0] = "context";
|
|
16
|
+
ModeDelayClick2[ModeDelayClick2["navigation"] = 0] = "navigation";
|
|
17
|
+
return ModeDelayClick2;
|
|
18
|
+
})(ModeDelayClick || {});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var ModeFloatingStrategy = /* @__PURE__ */ ((ModeFloatingStrategy2) => {
|
|
2
|
+
ModeFloatingStrategy2["menubar"] = "absolute";
|
|
3
|
+
ModeFloatingStrategy2["dropdown"] = "absolute";
|
|
4
|
+
ModeFloatingStrategy2["context"] = "absolute";
|
|
5
|
+
ModeFloatingStrategy2["navigation"] = "fixed";
|
|
6
|
+
return ModeFloatingStrategy2;
|
|
7
|
+
})(ModeFloatingStrategy || {});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class ModeScrollLock {
|
|
2
|
+
private readonly key;
|
|
3
|
+
readonly value: false | {
|
|
4
|
+
padding: boolean;
|
|
5
|
+
};
|
|
6
|
+
static readonly menubar: ModeScrollLock;
|
|
7
|
+
static readonly dropdown: ModeScrollLock;
|
|
8
|
+
static readonly context: ModeScrollLock;
|
|
9
|
+
static readonly navigation: ModeScrollLock;
|
|
10
|
+
private constructor();
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class ModeScrollLock {
|
|
2
|
+
constructor(key, value) {
|
|
3
|
+
this.key = key;
|
|
4
|
+
this.value = value;
|
|
5
|
+
}
|
|
6
|
+
static menubar = new ModeScrollLock("menubar", false);
|
|
7
|
+
static dropdown = new ModeScrollLock("dropdown", { padding: true });
|
|
8
|
+
static context = new ModeScrollLock("context", { padding: true });
|
|
9
|
+
static navigation = new ModeScrollLock("navigation", false);
|
|
10
|
+
toString() {
|
|
11
|
+
return this.key;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -60,5 +60,5 @@ const { idle } = useIdle(3000)
|
|
|
60
60
|
</script>
|
|
61
61
|
|
|
62
62
|
<style>
|
|
63
|
-
:root{--magic-player-overlay-background:rgba(0,0,0,.3);--magic-player-overlay-color:#fff;--magic-player-overlay-button-size:2.5rem}.magic-player-overlay{align-items:center;background-color:var(--magic-player-overlay-background);color:var(--magic-player-overlay-color);cursor:pointer;display:flex;inset:0;justify-content:center;position:absolute;transition-
|
|
63
|
+
:root{--magic-player-overlay-background:rgba(0,0,0,.3);--magic-player-overlay-color:#fff;--magic-player-overlay-button-size:2.5rem;--magic-player-overlay-transition:opacity 300ms ease}.magic-player-overlay{align-items:center;background-color:var(--magic-player-overlay-background);color:var(--magic-player-overlay-color);cursor:pointer;display:flex;inset:0;justify-content:center;position:absolute;transition:var(--magic-player-overlay-transition)}.magic-player-overlay__button{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:0;border-radius:0;color:inherit;cursor:pointer;height:var(--magic-player-overlay-button-size);outline:none;padding:0;width:var(--magic-player-overlay-button-size)}.magic-player-overlay.-playing.-idle,.magic-player-overlay.-playing.-not-hover{opacity:0}
|
|
64
64
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { InjectionKey, Ref,
|
|
1
|
+
import type { InjectionKey, Ref, MaybeRef } from 'vue';
|
|
2
2
|
import type { UseScrollReturn } from '@vueuse/core';
|
|
3
|
-
declare const MagicScrollParent: InjectionKey<
|
|
3
|
+
declare const MagicScrollParent: InjectionKey<MaybeRef<HTMLElement | undefined>>;
|
|
4
4
|
declare const MagicScrollProgress: InjectionKey<Ref<number>>;
|
|
5
5
|
declare const MagicScrollReturn: InjectionKey<UseScrollReturn | undefined>;
|
|
6
6
|
export { MagicScrollParent, MagicScrollProgress, MagicScrollReturn };
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ToastInstance, AddToastArgs } from '../../types.js';
|
|
2
2
|
export declare function useToastStore(): {
|
|
3
|
-
toastStore: import("vue").Ref<
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
toastStore: import("vue").Ref<{
|
|
4
|
+
id: string;
|
|
5
|
+
toasts: {
|
|
6
|
+
id: string;
|
|
7
|
+
component: Object;
|
|
8
|
+
props?: Record<string, any> | undefined;
|
|
9
|
+
remove: Function;
|
|
10
|
+
}[];
|
|
11
|
+
add: (args: AddToastArgs) => string;
|
|
12
|
+
remove: (id: string) => void;
|
|
13
|
+
}[]>;
|
|
14
|
+
findInstance: (id: string) => ToastInstance | undefined;
|
|
15
|
+
addInstance: (id: string) => ToastInstance;
|
|
6
16
|
removeInstance: (id: string) => void;
|
|
7
17
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
2
|
import type { AddToastArgs } from './../types.js';
|
|
3
3
|
export declare function useMagicToast(id: MaybeRef<string>): {
|
|
4
|
-
toasts: import("vue").ComputedRef<
|
|
5
|
-
count: import("vue").ComputedRef<
|
|
6
|
-
firstToast: import("vue").ComputedRef<
|
|
7
|
-
lastToast: import("vue").ComputedRef<
|
|
8
|
-
add: (options: AddToastArgs) => Promise<
|
|
4
|
+
toasts: import("vue").ComputedRef<import("./../types").Toast[] | undefined>;
|
|
5
|
+
count: import("vue").ComputedRef<number | undefined>;
|
|
6
|
+
firstToast: import("vue").ComputedRef<import("./../types").Toast | undefined>;
|
|
7
|
+
lastToast: import("vue").ComputedRef<import("./../types").Toast | undefined>;
|
|
8
|
+
add: (options: AddToastArgs) => Promise<string | undefined>;
|
|
9
9
|
remove: (toastId: string) => void;
|
|
10
10
|
clear: () => void;
|
|
11
11
|
};
|
package/dist/plugins/index.d.ts
CHANGED
package/dist/plugins/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maas/vue-equipment",
|
|
3
3
|
"description": "A magic collection of Vue composables, plugins, components and directives",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.32.0",
|
|
5
5
|
"author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
let drawerStore = ref([]);
|
|
3
|
-
export function useDrawerStore() {
|
|
4
|
-
function addInstance(id) {
|
|
5
|
-
drawerStore.value.push(id);
|
|
6
|
-
}
|
|
7
|
-
function removeInstance(id) {
|
|
8
|
-
drawerStore.value = drawerStore.value.filter((x) => x !== id);
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
drawerStore,
|
|
12
|
-
addInstance,
|
|
13
|
-
removeInstance
|
|
14
|
-
};
|
|
15
|
-
}
|
/package/dist/plugins/MagicMenu/src/utils/{modeTransitions.d.ts → modeTransitionDefaults.d.ts}
RENAMED
|
File without changes
|
/package/dist/plugins/MagicMenu/src/utils/{modeTransitions.mjs → modeTransitionDefaults.mjs}
RENAMED
|
File without changes
|