@maas/vue-equipment 1.0.0-beta.1 → 1.0.0-beta.10
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/README.md +2 -2
- package/dist/composables/index.d.ts +5 -5
- package/dist/composables/index.js +23 -13
- package/dist/composables/index.js.map +1 -1
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +9 -2
- package/dist/plugins/.turbo/turbo-lint.log +1 -9
- package/dist/plugins/MagicAccordion/demo/data/footer.json +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +33 -22
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +2 -2
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +12 -21
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +15 -13
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +23 -59
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +2 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +17 -22
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +11 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +24 -13
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +12 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +0 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +29 -28
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +12 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +5 -7
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +12 -58
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +7 -7
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +7 -6
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +25 -60
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +15 -22
- package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/composables/private/useCommandState.mjs +1 -1
- package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/symbols/index.d.ts +4 -4
- package/dist/plugins/MagicCommand/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +13 -22
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue.d.ts +9 -21
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +21 -12
- package/dist/plugins/MagicCookie/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +18 -24
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +94 -23
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +9 -5
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +34 -14
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +6 -4
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +54 -19
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.mjs +4 -4
- package/dist/plugins/MagicDraggable/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.mjs +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +33 -24
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +165 -24
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +34 -14
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.mjs +28 -10
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.d.ts +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +16 -14
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.d.ts +1 -1
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +15 -15
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +14 -25
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.d.ts +1 -1
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.mjs +8 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +4 -5
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +18 -21
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +3 -6
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +41 -24
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +5 -7
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +40 -25
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +3 -14
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +31 -28
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +19 -8
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +12 -58
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +28 -38
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +19 -23
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +29 -19
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +27 -60
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +2 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +15 -22
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.mjs +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuChannel.mjs +15 -5
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.mjs +4 -4
- package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +35 -15
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +18 -6
- package/dist/plugins/MagicMenu/src/symbols/index.d.ts +4 -4
- package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.d.ts +2 -2
- package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.mjs +2 -2
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +9 -9
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +44 -22
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +34 -14
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +14 -14
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +1 -10
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.d.ts +3 -3
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +2 -2
- package/dist/plugins/MagicPie/index.d.ts +7 -0
- package/dist/plugins/MagicPie/index.mjs +8 -0
- package/dist/plugins/MagicPie/nuxt.d.ts +2 -0
- package/dist/plugins/MagicPie/nuxt.mjs +23 -0
- package/dist/plugins/MagicPie/src/components/MagicPie.vue +202 -0
- package/dist/plugins/MagicPie/src/components/MagicPie.vue.d.ts +7 -0
- package/dist/plugins/MagicPie/src/composables/private/usePieState.d.ts +6 -0
- package/dist/plugins/MagicPie/src/composables/private/usePieState.mjs +33 -0
- package/dist/plugins/MagicPie/src/composables/useMagicPie.d.ts +13 -0
- package/dist/plugins/MagicPie/src/composables/useMagicPie.mjs +43 -0
- package/dist/plugins/MagicPie/src/types/index.d.ts +9 -0
- package/dist/plugins/MagicPie/src/types/index.mjs +0 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +14 -8
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +32 -38
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +27 -26
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +1 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +19 -8
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +1 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +29 -14
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +13 -11
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +3 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +23 -23
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +3 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +24 -25
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +61 -33
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +10 -10
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +15 -9
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +13 -13
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +18 -11
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +3 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +6 -6
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +4 -4
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +20 -20
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +17 -8
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +9 -23
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +11 -11
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +9 -23
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +45 -37
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +18 -10
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +13 -24
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.d.ts +2 -2
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.mjs +3 -3
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +14 -4
- package/dist/plugins/MagicScroll/src/symbols/index.d.ts +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +23 -29
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue.d.ts +1 -10
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +8 -11
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +24 -23
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +2 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +5 -5
- package/dist/plugins/MagicToast/src/composables/private/useToastDrag.mjs +22 -22
- package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.mjs +33 -15
- package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +1 -0
- package/dist/plugins/MagicToast/src/composables/useMagicToast.mjs +10 -2
- package/dist/plugins/MagicToast/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicToast/src/utils/defaultOptions.mjs +1 -1
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/utils/index.d.ts +9 -4
- package/dist/utils/index.js +39 -3
- package/dist/utils/index.js.map +1 -1
- package/package.json +16 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
|
-
import { unref as _unref, renderSlot as _renderSlot,
|
|
3
|
+
import { unref as _unref, renderSlot as _renderSlot, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
4
4
|
import { computed, inject, watch } from "vue";
|
|
5
5
|
import { Primitive } from "@maas/vue-primitive";
|
|
6
6
|
import { useMenuView } from "../composables/private/useMenuView";
|
|
@@ -18,16 +18,18 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
18
18
|
asChild: { type: Boolean, required: false }
|
|
19
19
|
},
|
|
20
20
|
setup(__props) {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
21
|
+
const injectedInstanceId = inject(MagicMenuInstanceId, __props.instanceId);
|
|
22
|
+
const injectedViewId = inject(MagicMenuViewId, __props.viewId);
|
|
23
|
+
const mappedInstanceId = computed(() => __props.instanceId ?? injectedInstanceId);
|
|
24
|
+
const mappedViewId = computed(() => __props.viewId ?? injectedViewId);
|
|
25
|
+
if (!mappedInstanceId.value) {
|
|
24
26
|
throw new Error(
|
|
25
27
|
"MagicMenuRemote must be nested inside MagicMenuProvider or an instanceId must be provided"
|
|
26
28
|
);
|
|
27
29
|
}
|
|
28
|
-
if (!mappedViewId) {
|
|
30
|
+
if (!mappedViewId.value) {
|
|
29
31
|
throw new Error(
|
|
30
|
-
"
|
|
32
|
+
"MagicMenuRemote must be nested inside MagicMenuView or a viewId must be provided"
|
|
31
33
|
);
|
|
32
34
|
}
|
|
33
35
|
if (!__props.channelId) {
|
|
@@ -35,15 +37,15 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
35
37
|
}
|
|
36
38
|
const mappedChannelId = computed(() => `magic-menu-channel-${__props.channelId}`);
|
|
37
39
|
const mappedTrigger = computed(() => __props.trigger ?? ["mouseenter"]);
|
|
38
|
-
const { getView } = useMenuView(mappedInstanceId);
|
|
39
|
-
const view = getView(mappedViewId);
|
|
40
|
+
const { getView } = useMenuView(mappedInstanceId.value);
|
|
41
|
+
const view = getView(mappedViewId.value);
|
|
40
42
|
const { initializeChannel, deleteChannel } = useMenuChannel({
|
|
41
|
-
instanceId: mappedInstanceId,
|
|
42
|
-
viewId: mappedViewId
|
|
43
|
+
instanceId: mappedInstanceId.value,
|
|
44
|
+
viewId: mappedViewId.value
|
|
43
45
|
});
|
|
44
46
|
const { onClick, onMouseenter } = useMenuRemote({
|
|
45
|
-
instanceId: mappedInstanceId,
|
|
46
|
-
viewId: mappedViewId,
|
|
47
|
+
instanceId: mappedInstanceId.value,
|
|
48
|
+
viewId: mappedViewId.value,
|
|
47
49
|
mappedChannelId,
|
|
48
50
|
mappedTrigger
|
|
49
51
|
});
|
|
@@ -58,36 +60,24 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
58
60
|
}
|
|
59
61
|
);
|
|
60
62
|
return (_ctx, _cache) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
disabled: _ctx.disabled,
|
|
65
|
-
|
|
63
|
+
return _openBlock(), _createBlock(_unref(Primitive), {
|
|
64
|
+
class: "magic-menu-remote",
|
|
65
|
+
"data-id": `${_ctx.channelId}-remote`,
|
|
66
|
+
"data-disabled": _ctx.disabled,
|
|
67
|
+
"data-active": _unref(channel)?.active,
|
|
68
|
+
"as-child": _ctx.asChild,
|
|
69
|
+
onClick: _unref(onClick),
|
|
70
|
+
onMouseenter: _unref(onMouseenter)
|
|
66
71
|
}, {
|
|
67
72
|
default: _withCtx(() => [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
]),
|
|
73
|
-
"data-id": `${_ctx.channelId}-remote`,
|
|
74
|
-
"as-child": _ctx.asChild,
|
|
75
|
-
onClick: _unref(onClick),
|
|
76
|
-
onMouseenter: _unref(onMouseenter)
|
|
77
|
-
}, {
|
|
78
|
-
default: _withCtx(() => [
|
|
79
|
-
_renderSlot(_ctx.$slots, "default", {
|
|
80
|
-
channelActive: _unref(channel)?.active,
|
|
81
|
-
remoteDisabled: _ctx.disabled
|
|
82
|
-
})
|
|
83
|
-
]),
|
|
84
|
-
_: 3
|
|
85
|
-
/* FORWARDED */
|
|
86
|
-
}, 8, ["class", "data-id", "as-child", "onClick", "onMouseenter"])
|
|
73
|
+
_renderSlot(_ctx.$slots, "default", {
|
|
74
|
+
channelActive: _unref(channel)?.active,
|
|
75
|
+
remoteDisabled: _ctx.disabled
|
|
76
|
+
})
|
|
87
77
|
]),
|
|
88
78
|
_: 3
|
|
89
79
|
/* FORWARDED */
|
|
90
|
-
}, 8, ["
|
|
80
|
+
}, 8, ["data-id", "data-disabled", "data-active", "as-child", "onClick", "onMouseenter"]);
|
|
91
81
|
};
|
|
92
82
|
}
|
|
93
83
|
});
|
|
@@ -98,7 +88,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
98
88
|
cursor: var(--magic-menu-remote-cursor, pointer);
|
|
99
89
|
}
|
|
100
90
|
|
|
101
|
-
.magic-menu-remote
|
|
91
|
+
.magic-menu-remote[data-disabled='true'] {
|
|
102
92
|
pointer-events: none;
|
|
103
93
|
}
|
|
104
94
|
</style>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Primitive } from '@maas/vue-primitive';
|
|
1
2
|
import type { Interaction } from '../types/index.js';
|
|
2
3
|
interface MagicMenuRemoteProps {
|
|
3
4
|
channelId: string;
|
|
@@ -7,31 +8,26 @@ interface MagicMenuRemoteProps {
|
|
|
7
8
|
trigger?: Interaction[];
|
|
8
9
|
asChild?: boolean;
|
|
9
10
|
}
|
|
10
|
-
declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}): any;
|
|
17
|
-
};
|
|
18
|
-
refs: {};
|
|
19
|
-
rootEl: any;
|
|
11
|
+
declare const onClick: () => void, onMouseenter: () => void;
|
|
12
|
+
declare let channel: import("../types").MenuChannel;
|
|
13
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
14
|
+
declare var __VLS_11: {
|
|
15
|
+
channelActive: boolean;
|
|
16
|
+
remoteDisabled: boolean;
|
|
20
17
|
};
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
19
|
+
default?: (props: typeof __VLS_11) => any;
|
|
20
|
+
}>;
|
|
21
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicMenuRemoteProps, {
|
|
22
|
+
Primitive: typeof Primitive;
|
|
23
|
+
onClick: typeof onClick;
|
|
24
|
+
onMouseenter: typeof onMouseenter;
|
|
25
|
+
channel: typeof channel;
|
|
26
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuRemoteProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
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>;
|
|
28
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
24
29
|
export default _default;
|
|
25
|
-
type
|
|
26
|
-
type __VLS_TypePropsToOption<T> = {
|
|
27
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
28
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
29
|
-
} : {
|
|
30
|
-
type: import('vue').PropType<T[K]>;
|
|
31
|
-
required: true;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
35
31
|
new (): {
|
|
36
32
|
$slots: S;
|
|
37
33
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { unref as _unref, renderSlot as _renderSlot, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
4
|
-
import { computed, inject,
|
|
4
|
+
import { computed, inject, useTemplateRef, toValue, watch } from "vue";
|
|
5
5
|
import { Primitive } from "@maas/vue-primitive";
|
|
6
6
|
import { useMenuState } from "../composables/private/useMenuState";
|
|
7
7
|
import { useMenuView } from "../composables/private/useMenuView";
|
|
@@ -16,27 +16,38 @@ import { onKeyStroke } from "@vueuse/core";
|
|
|
16
16
|
export default /* @__PURE__ */ _defineComponent({
|
|
17
17
|
__name: "MagicMenuTrigger",
|
|
18
18
|
props: {
|
|
19
|
+
instanceId: { type: String, required: false },
|
|
20
|
+
viewId: { type: String, required: false },
|
|
19
21
|
disabled: { type: Boolean, required: false },
|
|
20
22
|
trigger: { type: Array, required: false },
|
|
21
23
|
asChild: { type: Boolean, required: false }
|
|
22
24
|
},
|
|
23
25
|
setup(__props) {
|
|
24
|
-
const elRef =
|
|
25
|
-
const
|
|
26
|
-
const
|
|
26
|
+
const elRef = useTemplateRef("el");
|
|
27
|
+
const injectedInstanceId = inject(MagicMenuInstanceId, void 0);
|
|
28
|
+
const injectedViewId = inject(MagicMenuViewId, void 0);
|
|
27
29
|
const itemId = inject(MagicMenuItemId, void 0);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
const mappedInstanceId = computed(() => __props.instanceId ?? injectedInstanceId);
|
|
31
|
+
const mappedViewId = computed(() => __props.viewId ?? injectedViewId);
|
|
32
|
+
if (!mappedInstanceId.value) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
"MagicMenuRemote must be nested inside MagicMenuProvider or an instanceId must be provided"
|
|
35
|
+
);
|
|
30
36
|
}
|
|
31
|
-
if (!
|
|
32
|
-
throw new Error(
|
|
37
|
+
if (!mappedViewId.value) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
"MagicMenuTrigger must be nested inside MagicMenuView or a viewId must be provided"
|
|
40
|
+
);
|
|
33
41
|
}
|
|
34
|
-
const { getView, getRelativeViewIndex } = useMenuView(
|
|
35
|
-
const view = getView(
|
|
36
|
-
const viewIndex = getRelativeViewIndex(
|
|
37
|
-
const { initializeState } = useMenuState(
|
|
42
|
+
const { getView, getRelativeViewIndex } = useMenuView(mappedInstanceId.value);
|
|
43
|
+
const view = getView(mappedViewId.value);
|
|
44
|
+
const viewIndex = getRelativeViewIndex(mappedViewId.value);
|
|
45
|
+
const { initializeState } = useMenuState(mappedInstanceId.value);
|
|
38
46
|
const state = initializeState();
|
|
39
|
-
const { getItem } = useMenuItem({
|
|
47
|
+
const { getItem } = useMenuItem({
|
|
48
|
+
instanceId: mappedInstanceId.value,
|
|
49
|
+
viewId: mappedViewId.value
|
|
50
|
+
});
|
|
40
51
|
const item = getItem(itemId ?? "");
|
|
41
52
|
const mappedDisabled = computed(() => __props.disabled ?? item?.disabled ?? false);
|
|
42
53
|
const mappedTrigger = computed(() => {
|
|
@@ -64,8 +75,8 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
64
75
|
}
|
|
65
76
|
});
|
|
66
77
|
const { onMouseenter, onClick, onEnter } = useMenuTrigger({
|
|
67
|
-
instanceId,
|
|
68
|
-
viewId,
|
|
78
|
+
instanceId: mappedInstanceId.value,
|
|
79
|
+
viewId: mappedViewId.value,
|
|
69
80
|
itemId,
|
|
70
81
|
mappedDisabled,
|
|
71
82
|
mappedTrigger,
|
|
@@ -83,9 +94,8 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
83
94
|
onKeyStroke("Enter", onEnter);
|
|
84
95
|
return (_ctx, _cache) => {
|
|
85
96
|
return _openBlock(), _createBlock(_unref(Primitive), {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"data-id": `${_unref(viewId)}-trigger`,
|
|
97
|
+
ref: "el",
|
|
98
|
+
"data-id": `${mappedViewId.value}-trigger`,
|
|
89
99
|
"data-active": _unref(view)?.active,
|
|
90
100
|
"data-disabled": mappedDisabled.value,
|
|
91
101
|
tabindex: mappedTabindex.value,
|
|
@@ -114,7 +124,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
114
124
|
cursor: var(--magic-menu-trigger-cursor, pointer);
|
|
115
125
|
}
|
|
116
126
|
|
|
117
|
-
.magic-menu-trigger
|
|
127
|
+
.magic-menu-trigger[data-disabled='true'] {
|
|
118
128
|
pointer-events: none;
|
|
119
129
|
}
|
|
120
130
|
</style>
|
|
@@ -1,71 +1,38 @@
|
|
|
1
|
+
import { Primitive } from '@maas/vue-primitive';
|
|
1
2
|
import type { Interaction } from '../types/index.js';
|
|
2
3
|
interface MagicMenuTriggerProps {
|
|
4
|
+
instanceId?: string;
|
|
5
|
+
viewId?: string;
|
|
3
6
|
disabled?: boolean;
|
|
4
7
|
trigger?: Interaction[];
|
|
5
8
|
asChild?: boolean;
|
|
6
9
|
}
|
|
7
|
-
declare
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
elRef: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
-
asChild: {
|
|
18
|
-
type: BooleanConstructor;
|
|
19
|
-
default: boolean;
|
|
20
|
-
};
|
|
21
|
-
as: {
|
|
22
|
-
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
23
|
-
default: string;
|
|
24
|
-
};
|
|
25
|
-
}>>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
28
|
-
asChild: boolean;
|
|
29
|
-
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
30
|
-
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
31
|
-
P: {};
|
|
32
|
-
B: {};
|
|
33
|
-
D: {};
|
|
34
|
-
C: {};
|
|
35
|
-
M: {};
|
|
36
|
-
Defaults: {};
|
|
37
|
-
}, Readonly<import("vue").ExtractPropTypes<{
|
|
38
|
-
asChild: {
|
|
39
|
-
type: BooleanConstructor;
|
|
40
|
-
default: boolean;
|
|
41
|
-
};
|
|
42
|
-
as: {
|
|
43
|
-
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
44
|
-
default: string;
|
|
45
|
-
};
|
|
46
|
-
}>>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
47
|
-
[key: string]: any;
|
|
48
|
-
}>, {}, {}, {}, {
|
|
49
|
-
asChild: boolean;
|
|
50
|
-
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
51
|
-
}> | null;
|
|
52
|
-
};
|
|
53
|
-
rootEl: any;
|
|
10
|
+
declare const mappedViewId: import("vue").ComputedRef<string | undefined>;
|
|
11
|
+
declare const view: import("../types").MenuView | undefined;
|
|
12
|
+
declare const mappedDisabled: import("vue").ComputedRef<boolean>;
|
|
13
|
+
declare const mappedTabindex: import("vue").ComputedRef<0 | undefined>;
|
|
14
|
+
declare const onMouseenter: () => void, onClick: (e: MouseEvent) => void;
|
|
15
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
16
|
+
declare var __VLS_13: {
|
|
17
|
+
viewActive: boolean | undefined;
|
|
18
|
+
triggerDisabled: boolean;
|
|
54
19
|
};
|
|
55
|
-
type
|
|
56
|
-
|
|
57
|
-
|
|
20
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
21
|
+
default?: (props: typeof __VLS_13) => any;
|
|
22
|
+
}>;
|
|
23
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicMenuTriggerProps, {
|
|
24
|
+
Primitive: typeof Primitive;
|
|
25
|
+
mappedViewId: typeof mappedViewId;
|
|
26
|
+
view: typeof view;
|
|
27
|
+
mappedDisabled: typeof mappedDisabled;
|
|
28
|
+
mappedTabindex: typeof mappedTabindex;
|
|
29
|
+
onMouseenter: typeof onMouseenter;
|
|
30
|
+
onClick: typeof onClick;
|
|
31
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
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>;
|
|
33
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
58
34
|
export default _default;
|
|
59
|
-
type
|
|
60
|
-
type __VLS_TypePropsToOption<T> = {
|
|
61
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
62
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
63
|
-
} : {
|
|
64
|
-
type: import('vue').PropType<T[K]>;
|
|
65
|
-
required: true;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
69
36
|
new (): {
|
|
70
37
|
$slots: S;
|
|
71
38
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { defineComponent as _defineComponent } from "vue";
|
|
3
3
|
import { unref as _unref, renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
|
-
const _hoisted_1 = ["id"];
|
|
4
|
+
const _hoisted_1 = ["data-id"];
|
|
5
5
|
import { computed, inject, onBeforeUnmount, provide, useId } from "vue";
|
|
6
6
|
import { useMenuView } from "../composables/private/useMenuView";
|
|
7
7
|
import {
|
|
@@ -61,7 +61,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
61
61
|
});
|
|
62
62
|
return (_ctx, _cache) => {
|
|
63
63
|
return _openBlock(), _createElementBlock("div", {
|
|
64
|
-
id: mappedId.value,
|
|
64
|
+
"data-id": mappedId.value,
|
|
65
65
|
class: "magic-menu-view"
|
|
66
66
|
}, [
|
|
67
67
|
_renderSlot(_ctx.$slots, "default", {
|
|
@@ -3,30 +3,23 @@ interface MagicMenuViewProps {
|
|
|
3
3
|
id?: string;
|
|
4
4
|
placement?: Placement;
|
|
5
5
|
}
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}): any;
|
|
12
|
-
};
|
|
13
|
-
refs: {};
|
|
14
|
-
rootEl: HTMLDivElement;
|
|
6
|
+
declare const mappedId: import("vue").ComputedRef<string>;
|
|
7
|
+
declare const view: import("../types").MenuView;
|
|
8
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
9
|
+
declare var __VLS_1: {
|
|
10
|
+
viewActive: boolean;
|
|
15
11
|
};
|
|
16
|
-
type
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
13
|
+
default?: (props: typeof __VLS_1) => any;
|
|
14
|
+
}>;
|
|
15
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicMenuViewProps, {
|
|
16
|
+
mappedId: typeof mappedId;
|
|
17
|
+
view: typeof view;
|
|
18
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
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>;
|
|
20
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
21
|
export default _default;
|
|
20
|
-
type
|
|
21
|
-
type __VLS_TypePropsToOption<T> = {
|
|
22
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
-
} : {
|
|
25
|
-
type: import('vue').PropType<T[K]>;
|
|
26
|
-
required: true;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
30
23
|
new (): {
|
|
31
24
|
$slots: S;
|
|
32
25
|
};
|
|
@@ -24,10 +24,10 @@ export function useMenuCallback(args) {
|
|
|
24
24
|
emitter.emit("afterEnter", { id: toValue(instanceId), viewId });
|
|
25
25
|
const scrollLock = state.options.scrollLock ?? ModeScrollLock[state.options.mode].value;
|
|
26
26
|
if (scrollLock) {
|
|
27
|
-
lockScroll();
|
|
28
27
|
if (typeof scrollLock === "object" && scrollLock.padding) {
|
|
29
28
|
addScrollLockPadding();
|
|
30
29
|
}
|
|
30
|
+
lockScroll();
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function onBeforeLeave() {
|
|
@@ -22,7 +22,9 @@ export function useMenuChannel(args) {
|
|
|
22
22
|
return channel;
|
|
23
23
|
}
|
|
24
24
|
function unselectSiblings(id) {
|
|
25
|
-
if (!view?.channels)
|
|
25
|
+
if (!view?.channels) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
26
28
|
for (const channel of view.channels) {
|
|
27
29
|
if (channel.id !== id) {
|
|
28
30
|
channel.active = false;
|
|
@@ -30,7 +32,9 @@ export function useMenuChannel(args) {
|
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
function getChannel(id) {
|
|
33
|
-
if (!view?.channels)
|
|
35
|
+
if (!view?.channels) {
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
34
38
|
const channel = view.channels.find((ch) => ch.id === id);
|
|
35
39
|
if (channel) {
|
|
36
40
|
channelMap.set(id, channel);
|
|
@@ -44,7 +48,9 @@ export function useMenuChannel(args) {
|
|
|
44
48
|
return channel;
|
|
45
49
|
}
|
|
46
50
|
function deleteChannel(id) {
|
|
47
|
-
if (!view?.channels)
|
|
51
|
+
if (!view?.channels) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
48
54
|
const index = view.channels.findIndex((channel) => channel.id === id);
|
|
49
55
|
if (index !== -1) {
|
|
50
56
|
view.channels.splice(index, 1);
|
|
@@ -53,13 +59,17 @@ export function useMenuChannel(args) {
|
|
|
53
59
|
}
|
|
54
60
|
function selectChannel(id) {
|
|
55
61
|
const channel = getChannel(id);
|
|
56
|
-
if (!channel)
|
|
62
|
+
if (!channel) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
57
65
|
channel.active = true;
|
|
58
66
|
unselectSiblings(id);
|
|
59
67
|
}
|
|
60
68
|
function unselectChannel(id) {
|
|
61
69
|
const channel = getChannel(id);
|
|
62
|
-
if (!channel)
|
|
70
|
+
if (!channel) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
63
73
|
channel.active = false;
|
|
64
74
|
}
|
|
65
75
|
return {
|
|
@@ -7,9 +7,9 @@ export declare function useMenuCursor(view: MenuView, debug?: boolean): {
|
|
|
7
7
|
x: number;
|
|
8
8
|
y: number;
|
|
9
9
|
}[]>;
|
|
10
|
-
isInsideFrom: import("vue").
|
|
11
|
-
isInsideTo: import("vue").
|
|
12
|
-
isInsideTriangle: import("vue").
|
|
10
|
+
isInsideFrom: import("vue").ShallowRef<boolean, boolean>;
|
|
11
|
+
isInsideTo: import("vue").ShallowRef<boolean, boolean>;
|
|
12
|
+
isInsideTriangle: import("vue").ShallowRef<boolean, boolean>;
|
|
13
13
|
initialize: () => void;
|
|
14
14
|
destroy: () => void;
|
|
15
15
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
1
|
+
import { ref, shallowRef } from "vue";
|
|
2
2
|
import { useEventListener } from "@vueuse/core";
|
|
3
3
|
export function useMenuCursor(view, debug = false) {
|
|
4
4
|
let cancelListener = new AbortController();
|
|
@@ -7,9 +7,9 @@ export function useMenuCursor(view, debug = false) {
|
|
|
7
7
|
{ x: 0, y: 0 },
|
|
8
8
|
{ x: 0, y: 0 }
|
|
9
9
|
]);
|
|
10
|
-
const isInsideFrom =
|
|
11
|
-
const isInsideTo =
|
|
12
|
-
const isInsideTriangle =
|
|
10
|
+
const isInsideFrom = shallowRef(false);
|
|
11
|
+
const isInsideTo = shallowRef(false);
|
|
12
|
+
const isInsideTriangle = shallowRef(false);
|
|
13
13
|
function extendTriangle(vertices, pixelAmount) {
|
|
14
14
|
const [a, b, c] = vertices;
|
|
15
15
|
switch (view?.placement) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
1
|
+
import { ref, shallowRef } from "vue";
|
|
2
2
|
import { useScrollLock } from "@vueuse/core";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
matchClass,
|
|
5
|
+
scrollbarGutterSupport,
|
|
6
|
+
scrollbarWidth
|
|
7
|
+
} from "@maas/vue-equipment/utils";
|
|
8
|
+
const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : shallowRef(false);
|
|
5
9
|
export function useMenuDOM() {
|
|
6
10
|
const positionFixedElements = ref([]);
|
|
7
11
|
function lockScroll() {
|
|
@@ -12,25 +16,41 @@ export function useMenuDOM() {
|
|
|
12
16
|
}
|
|
13
17
|
function addScrollLockPadding() {
|
|
14
18
|
if (typeof window === "undefined") return;
|
|
15
|
-
const exclude = new RegExp(/magic-menu
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const exclude = new RegExp(/magic-menu/);
|
|
20
|
+
document.body.style.setProperty(
|
|
21
|
+
"--scrollbar-width",
|
|
22
|
+
`${scrollbarWidth()}px`
|
|
23
|
+
);
|
|
19
24
|
positionFixedElements.value = [
|
|
20
25
|
...document.body.getElementsByTagName("*")
|
|
21
26
|
].filter(
|
|
22
|
-
(x) => getComputedStyle(x, null).getPropertyValue("position") === "fixed" && !matchClass(x, exclude)
|
|
23
|
-
);
|
|
24
|
-
positionFixedElements.value.forEach(
|
|
25
|
-
(elem) => elem.style.paddingRight = "var(--scrollbar-width)"
|
|
27
|
+
(x) => getComputedStyle(x, null).getPropertyValue("position") === "fixed" && getComputedStyle(x, null).getPropertyValue("right") === "0px" && !matchClass(x, exclude)
|
|
26
28
|
);
|
|
29
|
+
switch (scrollbarGutterSupport()) {
|
|
30
|
+
case true:
|
|
31
|
+
document.documentElement.style.scrollbarGutter = "stable";
|
|
32
|
+
positionFixedElements.value.forEach((elem) => {
|
|
33
|
+
elem.style.scrollbarGutter = "stable";
|
|
34
|
+
elem.style.overflow = "auto";
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
case false:
|
|
38
|
+
document.body.style.paddingRight = "var(--scrollbar-width)";
|
|
39
|
+
positionFixedElements.value.forEach(
|
|
40
|
+
(elem) => elem.style.paddingRight = "var(--scrollbar-width)"
|
|
41
|
+
);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
27
44
|
}
|
|
28
45
|
function removeScrollLockPadding() {
|
|
29
|
-
document.
|
|
46
|
+
document.documentElement.style.scrollbarGutter = "";
|
|
30
47
|
document.body.style.removeProperty("--scrollbar-width");
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
document.body.style.paddingRight = "";
|
|
49
|
+
positionFixedElements.value.forEach((elem) => {
|
|
50
|
+
elem.style.paddingRight = "";
|
|
51
|
+
elem.style.scrollbarGutter = "";
|
|
52
|
+
elem.style.overflow = "";
|
|
53
|
+
});
|
|
34
54
|
}
|
|
35
55
|
return {
|
|
36
56
|
lockScroll,
|
|
@@ -7,7 +7,7 @@ type UseMenuTriggerArgs = {
|
|
|
7
7
|
itemId?: string;
|
|
8
8
|
mappedDisabled: ComputedRef<boolean>;
|
|
9
9
|
mappedTrigger: ComputedRef<Interaction[]>;
|
|
10
|
-
elRef: Ref<InstanceType<typeof Primitive> |
|
|
10
|
+
elRef: Ref<InstanceType<typeof Primitive> | null>;
|
|
11
11
|
};
|
|
12
12
|
export declare function useMenuTrigger(args: UseMenuTriggerArgs): {
|
|
13
13
|
onMouseenter: () => void;
|