@maas/vue-equipment 0.30.3 → 0.30.4
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/plugins/MagicAutoSize/src/components/MagicAutoSize.vue +1 -0
- package/dist/plugins/MagicAutoSize/src/components/MagicAutoSize.vue.d.ts +6 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandBody.vue.d.ts +4 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +4 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandFooter.vue.d.ts +4 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandGroup.vue.d.ts +4 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandHead.vue.d.ts +4 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +8 -6
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +4 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +6 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +6 -4
- package/dist/plugins/MagicCommand/src/composables/private/useCommandItem.mjs +1 -2
- package/dist/plugins/MagicCommand/src/composables/private/useCommandView.mjs +1 -2
- package/dist/plugins/MagicCookie/src/components/MagicCookie.vue.d.ts +9 -7
- package/dist/plugins/MagicCookie/src/composables/private/useCookieApi.d.ts +3 -3
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +6 -4
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +1 -2
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.mjs +1 -2
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +7 -5
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +1 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +4 -8
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +14 -28
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.d.ts +1 -64
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +1 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerUtils.mjs +8 -16
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +30 -30
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +7 -5
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +21 -15
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +4 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +16 -11
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +7 -5
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +7 -7
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +4 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +8 -6
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +4 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +11 -7
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +4 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +4 -4
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +4 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +4 -2
- package/dist/plugins/MagicMenu/src/composables/private/useMenuChannel.mjs +1 -8
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.mjs +29 -10
- package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +1 -2
- package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.mjs +1 -2
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +2 -4
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.mjs +16 -4
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.d.ts +2 -2
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +53 -13
- package/dist/plugins/MagicMenu/src/composables/useMagicMenu.d.ts +2 -2
- package/dist/plugins/MagicMenu/src/types/index.d.ts +11 -4
- package/dist/plugins/MagicMenu/src/utils/defaultOptions.mjs +6 -3
- package/dist/plugins/MagicMenu/src/utils/modeTransitions.d.ts +6 -0
- package/dist/plugins/MagicMenu/src/utils/modeTransitions.mjs +7 -0
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +7 -5
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +1 -2
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +3 -6
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue.d.ts +6 -4
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue.d.ts +4 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue.d.ts +7 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue.d.ts +10 -8
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +4 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +4 -2
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +1 -2
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +5 -10
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +8 -16
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +3 -6
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.d.ts +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +2 -4
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +4 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +6 -4
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +10 -8
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +8 -6
- package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue.d.ts +6 -4
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.mjs +4 -8
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +2 -4
- package/dist/plugins/MagicScroll/src/symbols/index.d.ts +2 -18
- package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue.d.ts +6 -4
- package/dist/plugins/MagicToast/src/composables/private/useToastApi.mjs +1 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastStore.d.ts +1 -1
- package/dist/plugins/MagicToast/src/composables/useMagicToast.mjs +1 -2
- package/package.json +2 -1
|
@@ -3,12 +3,14 @@ interface MagicMenuTriggerProps {
|
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
trigger?: Interaction[];
|
|
5
5
|
}
|
|
6
|
-
declare
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
7
|
default?(_: {
|
|
8
8
|
isActive: boolean | undefined;
|
|
9
9
|
isDisabled: boolean;
|
|
10
10
|
}): any;
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<MagicMenuTriggerProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicMenuTriggerProps>>>, {}, {}>;
|
|
13
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
12
14
|
export default _default;
|
|
13
15
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
14
16
|
new (): {
|
|
@@ -3,9 +3,11 @@ interface MagicMenuViewProps {
|
|
|
3
3
|
id?: string;
|
|
4
4
|
placement?: Placement;
|
|
5
5
|
}
|
|
6
|
-
declare
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
7
|
default?(_: {}): any;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<MagicMenuViewProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicMenuViewProps>>>, {}, {}>;
|
|
10
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
9
11
|
export default _default;
|
|
10
12
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
11
13
|
new (): {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { reactive } from "vue";
|
|
2
2
|
import { useMenuView } from "./useMenuView.mjs";
|
|
3
|
-
import { useMenuState } from "./useMenuState.mjs";
|
|
4
3
|
export function useMenuChannel(args) {
|
|
5
4
|
const { instanceId, viewId } = args;
|
|
6
|
-
const { initializeState } = useMenuState(instanceId);
|
|
7
|
-
const state = initializeState();
|
|
8
5
|
const { getView } = useMenuView(instanceId);
|
|
9
6
|
const view = getView(viewId);
|
|
10
7
|
function createChannel(args2) {
|
|
@@ -35,8 +32,7 @@ export function useMenuChannel(args) {
|
|
|
35
32
|
return instance;
|
|
36
33
|
}
|
|
37
34
|
function deleteChannel(id) {
|
|
38
|
-
if (!view?.channels)
|
|
39
|
-
return;
|
|
35
|
+
if (!view?.channels) return;
|
|
40
36
|
view.channels = view.channels.filter((x) => x.id !== id);
|
|
41
37
|
}
|
|
42
38
|
function getChannel(id) {
|
|
@@ -49,9 +45,6 @@ export function useMenuChannel(args) {
|
|
|
49
45
|
if (instance) {
|
|
50
46
|
instance.active = true;
|
|
51
47
|
unselectSiblings(id);
|
|
52
|
-
if (view) {
|
|
53
|
-
state.input.view = view.id;
|
|
54
|
-
}
|
|
55
48
|
}
|
|
56
49
|
}
|
|
57
50
|
function unselectChannel(id) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
2
|
import { useEventListener } from "@vueuse/core";
|
|
3
|
-
export function useMenuCursor(view) {
|
|
3
|
+
export function useMenuCursor(view, debug = false) {
|
|
4
4
|
let cancelListener = new AbortController();
|
|
5
5
|
const coords = ref([
|
|
6
6
|
{ x: 0, y: 0 },
|
|
@@ -56,7 +56,6 @@ export function useMenuCursor(view) {
|
|
|
56
56
|
}
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
59
|
-
coords.value = [a, b, c];
|
|
60
59
|
return [a, b, c];
|
|
61
60
|
}
|
|
62
61
|
function isPointInTriangle(args) {
|
|
@@ -78,9 +77,9 @@ export function useMenuCursor(view) {
|
|
|
78
77
|
const { p, top, left, bottom, right } = args;
|
|
79
78
|
return p.x >= left && p.x <= right && p.y >= top && p.y <= bottom;
|
|
80
79
|
}
|
|
81
|
-
function
|
|
80
|
+
function getTriangle(fromBounding, toBounding) {
|
|
82
81
|
const { top, left, bottom, right } = toBounding;
|
|
83
|
-
const centerPoint = view.
|
|
82
|
+
const centerPoint = view.state.clicked ? view.state.clicked : {
|
|
84
83
|
x: (fromBounding.left + fromBounding.right) / 2,
|
|
85
84
|
y: (fromBounding.top + fromBounding.bottom) / 2
|
|
86
85
|
};
|
|
@@ -115,6 +114,10 @@ export function useMenuCursor(view) {
|
|
|
115
114
|
[centerPoint, sidePoints[0], sidePoints[1]],
|
|
116
115
|
16
|
|
117
116
|
);
|
|
117
|
+
return [a, b, c];
|
|
118
|
+
}
|
|
119
|
+
function triangleOverlap(cursor, fromBounding, toBounding) {
|
|
120
|
+
const [a, b, c] = getTriangle(fromBounding, toBounding);
|
|
118
121
|
return isPointInTriangle({
|
|
119
122
|
p: cursor,
|
|
120
123
|
a,
|
|
@@ -133,19 +136,35 @@ export function useMenuCursor(view) {
|
|
|
133
136
|
});
|
|
134
137
|
}
|
|
135
138
|
function onMousemove(e) {
|
|
136
|
-
const from =
|
|
137
|
-
`[data-id="${view?.id}-trigger"]`
|
|
139
|
+
const from = Array.from(
|
|
140
|
+
document.querySelectorAll(`[data-id="${view?.id}-trigger"]`)
|
|
138
141
|
);
|
|
139
142
|
const to = document.querySelector(
|
|
140
143
|
`[data-id="${view?.id}-content"] .magic-menu-content__inner`
|
|
141
144
|
);
|
|
142
|
-
if (from && to) {
|
|
145
|
+
if (from.length && to) {
|
|
143
146
|
const cursor = { x: e.clientX, y: e.clientY };
|
|
144
|
-
const fromBounding = from.getBoundingClientRect();
|
|
145
147
|
const toBounding = to.getBoundingClientRect();
|
|
146
|
-
isInsideFrom.value = elementOverlap(cursor, fromBounding);
|
|
147
148
|
isInsideTo.value = elementOverlap(cursor, toBounding);
|
|
148
|
-
|
|
149
|
+
isInsideFrom.value = from.some((trigger) => {
|
|
150
|
+
const fromBounding = trigger.getBoundingClientRect();
|
|
151
|
+
const overlap = elementOverlap(cursor, fromBounding);
|
|
152
|
+
return overlap;
|
|
153
|
+
});
|
|
154
|
+
isInsideTriangle.value = from.some((trigger) => {
|
|
155
|
+
const fromBounding = trigger.getBoundingClientRect();
|
|
156
|
+
const overlap = triangleOverlap(cursor, fromBounding, toBounding);
|
|
157
|
+
return overlap;
|
|
158
|
+
});
|
|
159
|
+
if (debug) {
|
|
160
|
+
const allCoords = [];
|
|
161
|
+
from.forEach((trigger) => {
|
|
162
|
+
const fromBounding = trigger.getBoundingClientRect();
|
|
163
|
+
const [a, b, c] = getTriangle(fromBounding, toBounding);
|
|
164
|
+
allCoords.push(a, b, c);
|
|
165
|
+
});
|
|
166
|
+
coords.value = allCoords;
|
|
167
|
+
}
|
|
149
168
|
}
|
|
150
169
|
}
|
|
151
170
|
function initialize() {
|
|
@@ -11,8 +11,7 @@ export function useMenuDOM() {
|
|
|
11
11
|
scrollLock.value = false;
|
|
12
12
|
}
|
|
13
13
|
function addScrollLockPadding() {
|
|
14
|
-
if (typeof window === "undefined")
|
|
15
|
-
return;
|
|
14
|
+
if (typeof window === "undefined") return;
|
|
16
15
|
const exclude = new RegExp(/magic-menu?/);
|
|
17
16
|
const scrollbarWidth = window.innerWidth - document.body.offsetWidth;
|
|
18
17
|
document.body.style.setProperty("--scrollbar-width", `${scrollbarWidth}px`);
|
|
@@ -94,8 +94,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
94
94
|
}
|
|
95
95
|
const viewId = state.input.view;
|
|
96
96
|
const inputView = getView(viewId);
|
|
97
|
-
if (!inputView)
|
|
98
|
-
return;
|
|
97
|
+
if (!inputView) return;
|
|
99
98
|
const enabledItems = getEnabledItems(inputView);
|
|
100
99
|
const prevIndex = enabledItems.findIndex((item) => item.active) - 1;
|
|
101
100
|
if (prevIndex >= 0) {
|
|
@@ -118,8 +117,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
118
117
|
}
|
|
119
118
|
const viewId = state.input.view;
|
|
120
119
|
const inputView = getView(viewId);
|
|
121
|
-
if (!inputView)
|
|
122
|
-
return;
|
|
120
|
+
if (!inputView) return;
|
|
123
121
|
const enabledItems = getEnabledItems(inputView);
|
|
124
122
|
const nextIndex = enabledItems.findIndex((item) => item.active) + 1;
|
|
125
123
|
if (nextIndex >= 0) {
|
|
@@ -15,7 +15,7 @@ export function useMenuTrigger(args) {
|
|
|
15
15
|
selectView(viewId);
|
|
16
16
|
state.active = true;
|
|
17
17
|
if (view) {
|
|
18
|
-
view.
|
|
18
|
+
view.state.clicked = { x: e.clientX, y: e.clientY };
|
|
19
19
|
}
|
|
20
20
|
if (!itemId) {
|
|
21
21
|
state.input.view = viewId;
|
|
@@ -38,11 +38,17 @@ export function useMenuTrigger(args) {
|
|
|
38
38
|
}
|
|
39
39
|
function onMouseenter() {
|
|
40
40
|
if (mappedTrigger.value.includes("mouseenter") && !mappedDisabled.value && viewId && view) {
|
|
41
|
-
if (mappedTrigger.value[0]
|
|
41
|
+
if (mappedTrigger.value[0] === "mouseenter") {
|
|
42
42
|
state.active = true;
|
|
43
43
|
}
|
|
44
|
+
let delay = 0;
|
|
45
|
+
switch (state.options.mode) {
|
|
46
|
+
case "navigation":
|
|
47
|
+
delay = 200;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
44
50
|
if (state.active) {
|
|
45
|
-
selectView(viewId);
|
|
51
|
+
selectView(viewId, delay);
|
|
46
52
|
if (!itemId) {
|
|
47
53
|
state.input.view = viewId;
|
|
48
54
|
}
|
|
@@ -51,10 +57,16 @@ export function useMenuTrigger(args) {
|
|
|
51
57
|
}
|
|
52
58
|
function onClick(e) {
|
|
53
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
|
+
}
|
|
54
66
|
switch (true) {
|
|
55
67
|
case !state.active:
|
|
56
68
|
state.active = true;
|
|
57
|
-
selectView(viewId);
|
|
69
|
+
selectView(viewId, delay);
|
|
58
70
|
if (!itemId) {
|
|
59
71
|
state.input.view = viewId;
|
|
60
72
|
}
|
|
@@ -12,8 +12,8 @@ export declare function useMenuView(instanceId: MaybeRef<string>): {
|
|
|
12
12
|
getTopLevelView: () => MenuView | undefined;
|
|
13
13
|
getNestedView: (itemId: string) => MenuView | undefined;
|
|
14
14
|
getParentView: (id: string) => MenuView | undefined;
|
|
15
|
-
selectView: (id: string) => void
|
|
16
|
-
unselectView: (id: string) => void
|
|
15
|
+
selectView: (id: string, delayMs?: number) => Promise<void>;
|
|
16
|
+
unselectView: (id: string, delayMs?: number) => Promise<void>;
|
|
17
17
|
unselectUnrelatedViews: (id: string) => void;
|
|
18
18
|
unselectDescendingViews: (id: string) => void;
|
|
19
19
|
unselectAllViews: () => void;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
reactive,
|
|
3
|
-
computed,
|
|
4
|
-
toValue
|
|
5
|
-
} from "vue";
|
|
1
|
+
import { reactive, computed, toValue } from "vue";
|
|
6
2
|
import { useMenuState } from "./useMenuState.mjs";
|
|
7
3
|
export function useMenuView(instanceId) {
|
|
8
4
|
const { initializeState } = useMenuState(instanceId);
|
|
@@ -23,7 +19,11 @@ export function useMenuView(instanceId) {
|
|
|
23
19
|
active: false,
|
|
24
20
|
items: [],
|
|
25
21
|
channels: [],
|
|
26
|
-
placement
|
|
22
|
+
placement,
|
|
23
|
+
state: {
|
|
24
|
+
selectAbortController: new AbortController(),
|
|
25
|
+
unselectAbortController: new AbortController()
|
|
26
|
+
}
|
|
27
27
|
};
|
|
28
28
|
return reactive(view);
|
|
29
29
|
}
|
|
@@ -32,11 +32,19 @@ export function useMenuView(instanceId) {
|
|
|
32
32
|
state.views = [...state.views, view];
|
|
33
33
|
return view;
|
|
34
34
|
}
|
|
35
|
+
function delay(ms, signal) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const timer = setTimeout(resolve, ms);
|
|
38
|
+
signal.addEventListener("abort", () => {
|
|
39
|
+
clearTimeout(timer);
|
|
40
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
35
44
|
function initializeView(args) {
|
|
36
45
|
const { id } = args;
|
|
37
46
|
let instance = getView(id);
|
|
38
|
-
if (!instance)
|
|
39
|
-
instance = addView(args);
|
|
47
|
+
if (!instance) instance = addView(args);
|
|
40
48
|
return instance;
|
|
41
49
|
}
|
|
42
50
|
function deleteView(id) {
|
|
@@ -81,17 +89,49 @@ export function useMenuView(instanceId) {
|
|
|
81
89
|
(view) => view.id !== id && !argView?.parent.views.includes(view.id)
|
|
82
90
|
);
|
|
83
91
|
}
|
|
84
|
-
function selectView(id) {
|
|
92
|
+
async function selectView(id, delayMs = 0) {
|
|
85
93
|
const instance = getView(id);
|
|
86
94
|
if (instance) {
|
|
87
|
-
instance.
|
|
88
|
-
|
|
95
|
+
if (instance.state.unselectAbortController) {
|
|
96
|
+
instance.state.unselectAbortController.abort();
|
|
97
|
+
}
|
|
98
|
+
const abortController = new AbortController();
|
|
99
|
+
instance.state.selectAbortController = abortController;
|
|
100
|
+
try {
|
|
101
|
+
await delay(delayMs, abortController.signal);
|
|
102
|
+
instance.active = true;
|
|
103
|
+
unselectUnrelatedViews(id);
|
|
104
|
+
} catch (err) {
|
|
105
|
+
if (err.name === "AbortError") {
|
|
106
|
+
console.log(
|
|
107
|
+
`selectView() was interrupted by a call to unselectView()`
|
|
108
|
+
);
|
|
109
|
+
} else {
|
|
110
|
+
throw err;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
89
113
|
}
|
|
90
114
|
}
|
|
91
|
-
function unselectView(id) {
|
|
115
|
+
async function unselectView(id, delayMs = 0) {
|
|
92
116
|
const instance = getView(id);
|
|
93
117
|
if (instance) {
|
|
94
|
-
instance.
|
|
118
|
+
if (instance.state.selectAbortController) {
|
|
119
|
+
instance.state.selectAbortController.abort();
|
|
120
|
+
}
|
|
121
|
+
const abortController = new AbortController();
|
|
122
|
+
instance.state.unselectAbortController = abortController;
|
|
123
|
+
try {
|
|
124
|
+
await delay(delayMs, abortController.signal);
|
|
125
|
+
instance.active = false;
|
|
126
|
+
} catch (err) {
|
|
127
|
+
if (err.name === "AbortError") {
|
|
128
|
+
console.log(
|
|
129
|
+
`unselectView() was interrupted by a call to selectView()`
|
|
130
|
+
);
|
|
131
|
+
} else {
|
|
132
|
+
throw err;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
95
135
|
}
|
|
96
136
|
}
|
|
97
137
|
function unselectUnrelatedViews(id) {
|
|
@@ -4,8 +4,8 @@ interface UseMagicMenuArgs {
|
|
|
4
4
|
viewId: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function useMagicMenu(args: UseMagicMenuArgs): {
|
|
7
|
-
selectView: (id: string) => void
|
|
8
|
-
unselectView: (id: string) => void
|
|
7
|
+
selectView: (id: string, delayMs?: number) => Promise<void>;
|
|
8
|
+
unselectView: (id: string, delayMs?: number) => Promise<void>;
|
|
9
9
|
selectChannel: (id: string) => void;
|
|
10
10
|
unselectChannel: (id: string) => void;
|
|
11
11
|
};
|
|
@@ -3,10 +3,13 @@ import type { RequireAllNested } from '@maas/vue-equipment/utils';
|
|
|
3
3
|
type MenuMode = 'dropdown' | 'menubar' | 'context' | 'navigation';
|
|
4
4
|
export interface MagicMenuOptions {
|
|
5
5
|
mode?: MenuMode;
|
|
6
|
+
debug?: boolean;
|
|
6
7
|
transition?: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
content?: {
|
|
9
|
+
default?: string;
|
|
10
|
+
nested?: string;
|
|
11
|
+
};
|
|
12
|
+
channel: string;
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
15
|
export type Interaction = 'click' | 'mouseenter' | 'right-click';
|
|
@@ -33,7 +36,11 @@ export interface MenuView {
|
|
|
33
36
|
views: string[];
|
|
34
37
|
};
|
|
35
38
|
placement: Placement;
|
|
36
|
-
|
|
39
|
+
state: {
|
|
40
|
+
selectAbortController: AbortController;
|
|
41
|
+
unselectAbortController: AbortController;
|
|
42
|
+
clicked?: Coordinates;
|
|
43
|
+
};
|
|
37
44
|
}
|
|
38
45
|
export interface MenuState {
|
|
39
46
|
id: string;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
const defaultOptions = {
|
|
2
2
|
mode: "menubar",
|
|
3
|
+
debug: false,
|
|
3
4
|
transition: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
content: {
|
|
6
|
+
default: "",
|
|
7
|
+
nested: "magic-menu-content--fade"
|
|
8
|
+
},
|
|
9
|
+
channel: "magic-menu-channel"
|
|
7
10
|
}
|
|
8
11
|
};
|
|
9
12
|
export { defaultOptions };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var ModeTransitions = /* @__PURE__ */ ((ModeTransitions2) => {
|
|
2
|
+
ModeTransitions2["menubar"] = "magic-menu-content--default";
|
|
3
|
+
ModeTransitions2["dropdown"] = "magic-menu-content--default";
|
|
4
|
+
ModeTransitions2["context"] = "magic-menu-content--default";
|
|
5
|
+
ModeTransitions2["navigation"] = "magic-menu-content--fade";
|
|
6
|
+
return ModeTransitions2;
|
|
7
|
+
})(ModeTransitions || {});
|
|
@@ -8,16 +8,18 @@ interface MagicModalProps {
|
|
|
8
8
|
props?: Record<string, unknown>;
|
|
9
9
|
options?: MagicModalOptions;
|
|
10
10
|
}
|
|
11
|
-
declare
|
|
11
|
+
declare function __VLS_template(): {
|
|
12
|
+
backdrop?(_: {}): any;
|
|
13
|
+
default?(_: {}): any;
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicModalProps>, {
|
|
12
16
|
options: () => MagicModalOptions;
|
|
13
17
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicModalProps>, {
|
|
14
18
|
options: () => MagicModalOptions;
|
|
15
19
|
}>>>, {
|
|
16
20
|
options: MagicModalOptions;
|
|
17
|
-
}, {}
|
|
18
|
-
|
|
19
|
-
default?(_: {}): any;
|
|
20
|
-
}>;
|
|
21
|
+
}, {}>;
|
|
22
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
21
23
|
export default _default;
|
|
22
24
|
type __VLS_WithDefaults<P, D> = {
|
|
23
25
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
@@ -34,8 +34,7 @@ export function useModalDOM(args) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function addScrollLockPadding() {
|
|
37
|
-
if (typeof window === "undefined")
|
|
38
|
-
return;
|
|
37
|
+
if (typeof window === "undefined") return;
|
|
39
38
|
const exclude = new RegExp(/magic-modal(__backdrop)?/);
|
|
40
39
|
const scrollbarWidth = window.innerWidth - document.body.offsetWidth;
|
|
41
40
|
document.body.style.setProperty("--scrollbar-width", `${scrollbarWidth}px`);
|
|
@@ -75,8 +75,7 @@ export function useNoiseApi({
|
|
|
75
75
|
function calculate() {
|
|
76
76
|
const offCanvasHeight = offCanvasRef.value?.height;
|
|
77
77
|
const offCanvasWidth = offCanvasRef.value?.width;
|
|
78
|
-
if (!offCanvasHeight || !offCanvasWidth)
|
|
79
|
-
return;
|
|
78
|
+
if (!offCanvasHeight || !offCanvasWidth) return;
|
|
80
79
|
pixels.value = calculatePixels({
|
|
81
80
|
width: offCanvasWidth,
|
|
82
81
|
height: offCanvasHeight,
|
|
@@ -94,8 +93,7 @@ export function useNoiseApi({
|
|
|
94
93
|
}
|
|
95
94
|
function initialize() {
|
|
96
95
|
resetContexts();
|
|
97
|
-
if (!canvasRef.value || !offCanvasRef.value)
|
|
98
|
-
return;
|
|
96
|
+
if (!canvasRef.value || !offCanvasRef.value) return;
|
|
99
97
|
const maxCanvasDim = Math.max(width.value, height.value) * pixelRatio.value;
|
|
100
98
|
const maxOffCanvasDim = maxCanvasDim / Math.sqrt(mappedOptions.tiles);
|
|
101
99
|
const adjustedOffCanvasDim = findBiggerNumber(
|
|
@@ -142,8 +140,7 @@ export function useNoiseApi({
|
|
|
142
140
|
transferControls.value = useRafFn(throttled);
|
|
143
141
|
}
|
|
144
142
|
function draw() {
|
|
145
|
-
if (!offContext.value || !offCanvasRef.value)
|
|
146
|
-
return;
|
|
143
|
+
if (!offContext.value || !offCanvasRef.value) return;
|
|
147
144
|
offContext.value.clearRect(
|
|
148
145
|
0,
|
|
149
146
|
0,
|
|
@@ -3,7 +3,10 @@ interface MagicAudioPlayerProps {
|
|
|
3
3
|
src: string;
|
|
4
4
|
loop?: boolean;
|
|
5
5
|
}
|
|
6
|
-
declare
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
default?(_: {}): any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicAudioPlayerProps>, {
|
|
7
10
|
src: string;
|
|
8
11
|
loop: boolean;
|
|
9
12
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicAudioPlayerProps>, {
|
|
@@ -12,9 +15,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
12
15
|
}>>>, {
|
|
13
16
|
src: string;
|
|
14
17
|
loop: boolean;
|
|
15
|
-
}, {}
|
|
16
|
-
|
|
17
|
-
}>;
|
|
18
|
+
}, {}>;
|
|
19
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
18
20
|
export default _default;
|
|
19
21
|
type __VLS_WithDefaults<P, D> = {
|
|
20
22
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
interface MagicAudioPlayerControlsProps {
|
|
2
2
|
id: string;
|
|
3
3
|
}
|
|
4
|
-
declare
|
|
4
|
+
declare function __VLS_template(): {
|
|
5
5
|
playIcon?(_: {}): any;
|
|
6
6
|
pauseIcon?(_: {}): any;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<MagicAudioPlayerControlsProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicAudioPlayerControlsProps>>>, {}, {}>;
|
|
9
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
8
10
|
export default _default;
|
|
9
11
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
10
12
|
new (): {
|
|
@@ -7,7 +7,10 @@ interface MagicPlayerProps {
|
|
|
7
7
|
preload?: 'auto' | 'metadata' | 'none';
|
|
8
8
|
loop?: boolean;
|
|
9
9
|
}
|
|
10
|
-
declare
|
|
10
|
+
declare function __VLS_template(): {
|
|
11
|
+
default?(_: {}): any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicPlayerProps>, {
|
|
11
14
|
srcType: string;
|
|
12
15
|
src: string;
|
|
13
16
|
autoplay: boolean;
|
|
@@ -24,10 +27,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
24
27
|
loop: boolean;
|
|
25
28
|
srcType: MagicPlayerSourceType;
|
|
26
29
|
autoplay: boolean;
|
|
27
|
-
preload: "
|
|
28
|
-
}, {}
|
|
29
|
-
|
|
30
|
-
}>;
|
|
30
|
+
preload: "auto" | "metadata" | "none";
|
|
31
|
+
}, {}>;
|
|
32
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
31
33
|
export default _default;
|
|
32
34
|
type __VLS_WithDefaults<P, D> = {
|
|
33
35
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
@@ -5,13 +5,7 @@ interface MagicPlayerControlsProps {
|
|
|
5
5
|
standalone?: boolean;
|
|
6
6
|
transition?: string;
|
|
7
7
|
}
|
|
8
|
-
declare
|
|
9
|
-
transition: string;
|
|
10
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicPlayerControlsProps>, {
|
|
11
|
-
transition: string;
|
|
12
|
-
}>>>, {
|
|
13
|
-
transition: string;
|
|
14
|
-
}, {}>, {
|
|
8
|
+
declare function __VLS_template(): {
|
|
15
9
|
seekPopover?(_: {}): any;
|
|
16
10
|
playIcon?(_: {}): any;
|
|
17
11
|
pauseIcon?(_: {}): any;
|
|
@@ -19,7 +13,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
19
13
|
volumeOnIcon?(_: {}): any;
|
|
20
14
|
fullscreenExitIcon?(_: {}): any;
|
|
21
15
|
fullscreenEnterIcon?(_: {}): any;
|
|
22
|
-
}
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicPlayerControlsProps>, {
|
|
18
|
+
transition: string;
|
|
19
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicPlayerControlsProps>, {
|
|
20
|
+
transition: string;
|
|
21
|
+
}>>>, {
|
|
22
|
+
transition: string;
|
|
23
|
+
}, {}>;
|
|
24
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
23
25
|
export default _default;
|
|
24
26
|
type __VLS_WithDefaults<P, D> = {
|
|
25
27
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
@@ -7,7 +7,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
7
7
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicPlayerDisplayTimeProps>, {
|
|
8
8
|
type: string;
|
|
9
9
|
}>>>, {
|
|
10
|
-
type: "current" | "
|
|
10
|
+
type: "current" | "remaining" | "duration";
|
|
11
11
|
}, {}>;
|
|
12
12
|
export default _default;
|
|
13
13
|
type __VLS_WithDefaults<P, D> = {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
interface MagicPlayerOverlayProps {
|
|
2
2
|
id: string;
|
|
3
3
|
}
|
|
4
|
-
declare
|
|
4
|
+
declare function __VLS_template(): {
|
|
5
5
|
default?(_: {}): any;
|
|
6
6
|
waitingIcon?(_: {}): any;
|
|
7
7
|
playIcon?(_: {}): any;
|
|
8
8
|
pauseIcon?(_: {}): any;
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<MagicPlayerOverlayProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicPlayerOverlayProps>>>, {}, {}>;
|
|
11
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
10
12
|
export default _default;
|
|
11
13
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
12
14
|
new (): {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type MagicPlayerPosterProps = {
|
|
2
2
|
id: string;
|
|
3
3
|
};
|
|
4
|
-
declare
|
|
4
|
+
declare function __VLS_template(): {
|
|
5
5
|
default?(_: {}): any;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<MagicPlayerPosterProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicPlayerPosterProps>>>, {}, {}>;
|
|
8
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
7
9
|
export default _default;
|
|
8
10
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
9
11
|
new (): {
|
|
@@ -38,8 +38,7 @@ export function usePlayerAudioApi(args) {
|
|
|
38
38
|
});
|
|
39
39
|
const emitter = usePlayerStateEmitter();
|
|
40
40
|
emitter.on("update", (payload) => {
|
|
41
|
-
if (payload.id !== toValue(args.id))
|
|
42
|
-
return;
|
|
41
|
+
if (payload.id !== toValue(args.id)) return;
|
|
43
42
|
if (payload.api === "player") {
|
|
44
43
|
switch (payload.key) {
|
|
45
44
|
case "mouseEntered":
|