@maas/vue-equipment 1.0.0-beta.4 → 1.0.0-beta.5
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/nuxt/module.json +1 -1
- package/dist/plugins/.turbo/turbo-lint.log +2 -10
- 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.d.ts +139 -24
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +15 -22
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +0 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +12 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +34 -28
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +12 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +60 -22
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue.d.ts +4 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +144 -25
- 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/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 +22 -13
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +8 -12
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +114 -22
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +13 -3
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +0 -47
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +0 -36
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +2 -3
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +0 -30
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +0 -39
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +0 -38
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +2 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +36 -28
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +14 -3
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +60 -22
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +27 -37
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +19 -23
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +26 -15
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +146 -25
- 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/useMenuChannel.mjs +15 -5
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +18 -6
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +3 -3
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +0 -38
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +1 -1
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +5 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue.d.ts +4 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +3 -9
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +0 -33
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +1 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +4 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +0 -20
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +14 -12
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +27 -22
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue.d.ts +4 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +0 -45
- package/dist/plugins/MagicPlayer/src/components/icons/FullscreenEnter.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/FullscreenExit.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Pause.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Play.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/VolumeOff.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/VolumeOn.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Waiting.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +14 -22
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +14 -22
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +45 -37
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +18 -24
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +2 -2
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue.d.ts +59 -10
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +2 -2
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +28 -22
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +2 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +2 -2
- package/package.json +4 -2
|
@@ -1,17 +1,53 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
|
+
import { Primitive } from '@maas/vue-primitive';
|
|
2
3
|
import type { MagicMenuOptions } from '../types/index.js';
|
|
3
4
|
interface MagicMenuProviderProps {
|
|
4
5
|
id: MaybeRef<string>;
|
|
5
6
|
asChild?: boolean;
|
|
6
7
|
options?: MagicMenuOptions;
|
|
7
8
|
}
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
declare const elRef: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
10
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
11
|
+
declare const __VLS_0: import("vue").DefineComponent<{
|
|
12
|
+
asChild: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: boolean;
|
|
12
15
|
};
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
as: {
|
|
17
|
+
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
asChild: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
as: {
|
|
28
|
+
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
}>>, {
|
|
32
|
+
asChild: boolean;
|
|
33
|
+
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
declare const __VLS_2: import("vue/jsx-runtime").JSX.Element & {
|
|
36
|
+
__ctx?: ({
|
|
37
|
+
attrs?: any;
|
|
38
|
+
slots?: Readonly<{
|
|
39
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
40
|
+
}> | undefined;
|
|
41
|
+
emit?: ((event: string, ...args: any[]) => void) | undefined;
|
|
42
|
+
} & {
|
|
43
|
+
props?: (Partial<{
|
|
44
|
+
asChild: boolean;
|
|
45
|
+
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
46
|
+
}> & Omit<{
|
|
47
|
+
readonly asChild: boolean;
|
|
48
|
+
readonly as: import("@maas/vue-primitive").ElementOrComponent;
|
|
49
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "asChild" | "as"> & Record<string, unknown>) | undefined;
|
|
50
|
+
expose?(exposed: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
15
51
|
asChild: {
|
|
16
52
|
type: BooleanConstructor;
|
|
17
53
|
default: boolean;
|
|
@@ -46,24 +82,26 @@ declare function __VLS_template(): {
|
|
|
46
82
|
}>, {}, {}, {}, {
|
|
47
83
|
asChild: boolean;
|
|
48
84
|
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
49
|
-
}>
|
|
50
|
-
};
|
|
51
|
-
rootEl: any;
|
|
85
|
+
}>): void;
|
|
86
|
+
}) | undefined;
|
|
52
87
|
};
|
|
53
|
-
|
|
54
|
-
declare
|
|
55
|
-
declare
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} : {
|
|
62
|
-
type: import('vue').PropType<T[K]>;
|
|
63
|
-
required: true;
|
|
64
|
-
};
|
|
88
|
+
declare var __VLS_6: (Parameters<NonNullable<(typeof __VLS_5)["expose"]>>[0] | null);
|
|
89
|
+
declare var __VLS_7: {};
|
|
90
|
+
declare var __VLS_5: __VLS_PickFunctionalComponentCtx<typeof __VLS_0, typeof __VLS_2>;
|
|
91
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
92
|
+
default?: (props: typeof __VLS_7) => any;
|
|
93
|
+
}>;
|
|
94
|
+
type __VLS_TemplateRefs = {
|
|
95
|
+
elRef: typeof __VLS_6;
|
|
65
96
|
};
|
|
66
|
-
|
|
97
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicMenuProviderProps, {
|
|
98
|
+
Primitive: typeof Primitive;
|
|
99
|
+
elRef: typeof elRef;
|
|
100
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
101
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicMenuProviderProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, __VLS_TemplateRefs, any>;
|
|
102
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
103
|
+
export default _default;
|
|
104
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
67
105
|
new (): {
|
|
68
106
|
$slots: S;
|
|
69
107
|
};
|
|
@@ -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,14 +18,16 @@ 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
|
"MagicMenuTrigger must be nested inside MagicMenuView or a viewId must be provided"
|
|
31
33
|
);
|
|
@@ -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_10: {
|
|
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_10) => 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
|
};
|
|
@@ -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
26
|
const elRef = ref(void 0);
|
|
25
|
-
const
|
|
26
|
-
const
|
|
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,
|
|
@@ -85,7 +96,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
85
96
|
return _openBlock(), _createBlock(_unref(Primitive), {
|
|
86
97
|
ref_key: "elRef",
|
|
87
98
|
ref: elRef,
|
|
88
|
-
"data-id": `${
|
|
99
|
+
"data-id": `${mappedViewId.value}-trigger`,
|
|
89
100
|
"data-active": _unref(view)?.active,
|
|
90
101
|
"data-disabled": mappedDisabled.value,
|
|
91
102
|
tabindex: mappedTabindex.value,
|
|
@@ -114,7 +125,7 @@ export default /* @__PURE__ */ _defineComponent({
|
|
|
114
125
|
cursor: var(--magic-menu-trigger-cursor, pointer);
|
|
115
126
|
}
|
|
116
127
|
|
|
117
|
-
.magic-menu-trigger
|
|
128
|
+
.magic-menu-trigger[data-disabled='true'] {
|
|
118
129
|
pointer-events: none;
|
|
119
130
|
}
|
|
120
131
|
</style>
|
|
@@ -1,19 +1,129 @@
|
|
|
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
|
-
default
|
|
11
|
-
viewActive: boolean | undefined;
|
|
12
|
-
triggerDisabled: boolean;
|
|
13
|
-
}): any;
|
|
10
|
+
declare const elRef: import("vue").Ref<import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
11
|
+
asChild: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
default: boolean;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
as: {
|
|
16
|
+
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
}>>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
22
|
+
asChild: boolean;
|
|
23
|
+
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
24
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
25
|
+
P: {};
|
|
26
|
+
B: {};
|
|
27
|
+
D: {};
|
|
28
|
+
C: {};
|
|
29
|
+
M: {};
|
|
30
|
+
Defaults: {};
|
|
31
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
32
|
+
asChild: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
as: {
|
|
37
|
+
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
}>>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}>, {}, {}, {}, {
|
|
43
|
+
asChild: boolean;
|
|
44
|
+
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
45
|
+
}> | undefined, import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
46
|
+
asChild: {
|
|
47
|
+
type: BooleanConstructor;
|
|
48
|
+
default: boolean;
|
|
49
|
+
};
|
|
50
|
+
as: {
|
|
51
|
+
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
52
|
+
default: string;
|
|
53
|
+
};
|
|
54
|
+
}>>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
57
|
+
asChild: boolean;
|
|
58
|
+
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
59
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
60
|
+
P: {};
|
|
61
|
+
B: {};
|
|
62
|
+
D: {};
|
|
63
|
+
C: {};
|
|
64
|
+
M: {};
|
|
65
|
+
Defaults: {};
|
|
66
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
67
|
+
asChild: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
as: {
|
|
72
|
+
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
73
|
+
default: string;
|
|
74
|
+
};
|
|
75
|
+
}>>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}>, {}, {}, {}, {
|
|
78
|
+
asChild: boolean;
|
|
79
|
+
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
80
|
+
}> | undefined>;
|
|
81
|
+
declare const mappedViewId: import("vue").ComputedRef<string | undefined>;
|
|
82
|
+
declare const view: import("../types").MenuView | undefined;
|
|
83
|
+
declare const mappedDisabled: import("vue").ComputedRef<boolean>;
|
|
84
|
+
declare const mappedTabindex: import("vue").ComputedRef<0 | undefined>;
|
|
85
|
+
declare const onMouseenter: () => void, onClick: (e: MouseEvent) => void;
|
|
86
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
87
|
+
declare const __VLS_0: import("vue").DefineComponent<{
|
|
88
|
+
asChild: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: boolean;
|
|
91
|
+
};
|
|
92
|
+
as: {
|
|
93
|
+
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
94
|
+
default: string;
|
|
95
|
+
};
|
|
96
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
99
|
+
asChild: {
|
|
100
|
+
type: BooleanConstructor;
|
|
101
|
+
default: boolean;
|
|
102
|
+
};
|
|
103
|
+
as: {
|
|
104
|
+
type: import("vue").PropType<import("@maas/vue-primitive").ElementOrComponent>;
|
|
105
|
+
default: string;
|
|
106
|
+
};
|
|
107
|
+
}>>, {
|
|
108
|
+
asChild: boolean;
|
|
109
|
+
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
110
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
111
|
+
declare const __VLS_2: import("vue/jsx-runtime").JSX.Element & {
|
|
112
|
+
__ctx?: ({
|
|
113
|
+
attrs?: any;
|
|
114
|
+
slots?: Readonly<{
|
|
115
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
116
|
+
}> | undefined;
|
|
117
|
+
emit?: ((event: string, ...args: any[]) => void) | undefined;
|
|
118
|
+
} & {
|
|
119
|
+
props?: (Partial<{
|
|
120
|
+
asChild: boolean;
|
|
121
|
+
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
122
|
+
}> & Omit<{
|
|
123
|
+
readonly asChild: boolean;
|
|
124
|
+
readonly as: import("@maas/vue-primitive").ElementOrComponent;
|
|
125
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "asChild" | "as"> & Record<string, unknown>) | undefined;
|
|
126
|
+
expose?(exposed: import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
17
127
|
asChild: {
|
|
18
128
|
type: BooleanConstructor;
|
|
19
129
|
default: boolean;
|
|
@@ -48,24 +158,35 @@ declare function __VLS_template(): {
|
|
|
48
158
|
}>, {}, {}, {}, {
|
|
49
159
|
asChild: boolean;
|
|
50
160
|
as: import("@maas/vue-primitive").ElementOrComponent;
|
|
51
|
-
}>
|
|
52
|
-
};
|
|
53
|
-
rootEl: any;
|
|
161
|
+
}>): void;
|
|
162
|
+
}) | undefined;
|
|
54
163
|
};
|
|
55
|
-
|
|
56
|
-
declare
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
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
|
-
};
|
|
164
|
+
declare var __VLS_6: (Parameters<NonNullable<(typeof __VLS_5)["expose"]>>[0] | null);
|
|
165
|
+
declare var __VLS_11: {
|
|
166
|
+
viewActive: boolean | undefined;
|
|
167
|
+
triggerDisabled: boolean;
|
|
67
168
|
};
|
|
68
|
-
|
|
169
|
+
declare var __VLS_5: __VLS_PickFunctionalComponentCtx<typeof __VLS_0, typeof __VLS_2>;
|
|
170
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
171
|
+
default?: (props: typeof __VLS_11) => any;
|
|
172
|
+
}>;
|
|
173
|
+
type __VLS_TemplateRefs = {
|
|
174
|
+
elRef: typeof __VLS_6;
|
|
175
|
+
};
|
|
176
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicMenuTriggerProps, {
|
|
177
|
+
Primitive: typeof Primitive;
|
|
178
|
+
elRef: typeof elRef;
|
|
179
|
+
mappedViewId: typeof mappedViewId;
|
|
180
|
+
view: typeof view;
|
|
181
|
+
mappedDisabled: typeof mappedDisabled;
|
|
182
|
+
mappedTabindex: typeof mappedTabindex;
|
|
183
|
+
onMouseenter: typeof onMouseenter;
|
|
184
|
+
onClick: typeof onClick;
|
|
185
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicMenuTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
186
|
+
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, __VLS_TemplateRefs, any>;
|
|
187
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
188
|
+
export default _default;
|
|
189
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
69
190
|
new (): {
|
|
70
191
|
$slots: S;
|
|
71
192
|
};
|
|
@@ -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_0: {
|
|
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_0) => 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, {}, HTMLDivElement>;
|
|
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
|
};
|
|
@@ -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 {
|