@maas/vue-equipment 1.0.0-beta.2 → 1.0.0-beta.21
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.d.mts +2 -1
- package/dist/nuxt/module.json +2 -2
- package/dist/nuxt/module.mjs +9 -2
- package/dist/nuxt/types.d.mts +3 -1
- package/dist/plugins/.turbo/turbo-lint.log +2 -10
- package/dist/plugins/MagicAccordion/nuxt.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue +59 -82
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +35 -22
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +17 -31
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +12 -21
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +57 -62
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +23 -59
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +34 -45
- 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/composables/private/useAccordionTrigger.mjs +1 -0
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionView.mjs +1 -0
- package/dist/plugins/MagicAccordion/src/composables/useMagicAccordion.mjs +1 -0
- package/dist/plugins/MagicAccordion/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicCommand/nuxt.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +146 -152
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +24 -13
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +42 -52
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +12 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +72 -87
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +29 -28
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +37 -47
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +12 -21
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +61 -77
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +12 -58
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +23 -39
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +80 -86
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +25 -60
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +36 -48
- 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/composables/private/useCommandTrigger.mjs +1 -0
- 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/nuxt.d.ts +1 -1
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue +34 -41
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +13 -22
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue +19 -36
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue.d.ts +9 -21
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue +40 -72
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +21 -12
- package/dist/plugins/MagicCookie/src/composables/private/useCookieItem.mjs +0 -1
- package/dist/plugins/MagicCookie/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicDraggable/nuxt.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +81 -100
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +94 -22
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +43 -63
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +34 -14
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +2 -15
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +117 -64
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.mjs +6 -5
- package/dist/plugins/MagicDraggable/src/types/index.d.ts +2 -1
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.mjs +1 -1
- package/dist/plugins/MagicDrawer/nuxt.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +271 -308
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +165 -23
- 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/MagicDrawer/src/composables/private/useDrawerWheel.mjs +1 -1
- package/dist/plugins/MagicDrawer/src/types/index.mjs +1 -0
- package/dist/plugins/MagicEmitter/nuxt.d.ts +1 -1
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +100 -100
- package/dist/plugins/MagicMarquee/nuxt.d.ts +1 -1
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +38 -72
- 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/MagicMarquee/src/composables/useMagicMarquee.d.ts +1 -1
- package/dist/plugins/MagicMenu/nuxt.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +51 -63
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +18 -21
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +178 -214
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +41 -24
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +171 -198
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +40 -25
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +87 -113
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +31 -28
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +82 -81
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +12 -58
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +63 -86
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +19 -23
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +94 -97
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +27 -60
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +49 -61
- 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/useMenuKeyListener.mjs +6 -2
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.mjs +2 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +18 -6
- package/dist/plugins/MagicMenu/src/composables/useMagicMenu.mjs +1 -0
- 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/nuxt.d.ts +1 -1
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +133 -168
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +44 -21
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +34 -14
- package/dist/plugins/MagicModal/src/types/index.mjs +1 -0
- package/dist/plugins/MagicNoise/nuxt.d.ts +1 -1
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +50 -81
- 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 +168 -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/nuxt.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +58 -63
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +99 -127
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +30 -26
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +32 -42
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +1 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +106 -105
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +1 -10
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +51 -76
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +29 -14
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +18 -37
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +12 -11
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +41 -55
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +23 -23
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +60 -109
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +74 -71
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +163 -209
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +63 -33
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.d.ts +0 -4
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +6 -47
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +7 -34
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +154 -235
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +3 -17
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +17 -157
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +2 -3
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +7 -25
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.d.ts +7 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.mjs +56 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +3 -8
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +7 -62
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +32 -51
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.mjs +49 -2
- package/dist/plugins/MagicPlayer/src/symbols/index.d.ts +5 -2
- package/dist/plugins/MagicPlayer/src/symbols/index.mjs +10 -1
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +29 -0
- package/dist/plugins/MagicScroll/nuxt.d.ts +1 -1
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +54 -61
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +9 -23
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +56 -71
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +9 -23
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +26 -33
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +45 -37
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +63 -71
- 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 +16 -6
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.d.ts +2 -2
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +41 -26
- package/dist/plugins/MagicScroll/src/symbols/index.d.ts +1 -1
- package/dist/plugins/MagicToast/nuxt.d.ts +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +94 -118
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue.d.ts +1 -10
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +54 -81
- 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/useToastListener.mjs +1 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.mjs +33 -15
- package/dist/plugins/MagicToast/src/composables/private/useToastView.mjs +1 -0
- 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 +17 -8
- package/dist/nuxt/module.cjs +0 -5
- package/dist/nuxt/module.d.ts +0 -9
- package/dist/nuxt/types.d.ts +0 -1
- package/dist/plugins/MagicAccordion/demo/data/footer.json +0 -117
- package/dist/plugins/MagicCommand/demo/data/about.json +0 -3
- package/dist/plugins/MagicCommand/demo/data/search.json +0 -594
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.d.ts +0 -15
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.mjs +0 -9
|
@@ -1,71 +1,66 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<primitive
|
|
3
|
+
ref="el"
|
|
4
|
+
:as-child="asChild"
|
|
5
|
+
:data-id="`${mappedViewId}-trigger`"
|
|
6
|
+
:data-disabled="mappedDisabled"
|
|
7
|
+
as="button"
|
|
8
|
+
class="magic-accordion-trigger"
|
|
9
|
+
@mouseenter="onMouseenter"
|
|
10
|
+
@click="onClick"
|
|
11
|
+
>
|
|
12
|
+
<slot :view-active="view?.active" />
|
|
13
|
+
</primitive>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { useTemplateRef, inject, computed, toValue } from "vue";
|
|
5
18
|
import { Primitive } from "@maas/vue-primitive";
|
|
6
19
|
import { onKeyStroke } from "@vueuse/core";
|
|
7
20
|
import { useAccordionTrigger } from "../composables/private/useAccordionTrigger";
|
|
8
|
-
import { MagicAccordionInstanceId, MagicAccordionViewId } from "../symbols";
|
|
9
21
|
import { useAccordionState } from "../composables/private/useAccordionState";
|
|
10
22
|
import { useAccordionView } from "../composables/private/useAccordionView";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ref: elRef,
|
|
51
|
-
"as-child": _ctx.asChild,
|
|
52
|
-
"data-disabled": mappedDisabled.value,
|
|
53
|
-
class: "magic-accordion-trigger",
|
|
54
|
-
as: "button",
|
|
55
|
-
onMouseenter: _unref(onMouseenter),
|
|
56
|
-
onClick: _unref(onClick)
|
|
57
|
-
}, {
|
|
58
|
-
default: _withCtx(() => [
|
|
59
|
-
_renderSlot(_ctx.$slots, "default", {
|
|
60
|
-
viewActive: _unref(view)?.active
|
|
61
|
-
})
|
|
62
|
-
]),
|
|
63
|
-
_: 3
|
|
64
|
-
/* FORWARDED */
|
|
65
|
-
}, 8, ["as-child", "data-disabled", "onMouseenter", "onClick"]);
|
|
66
|
-
};
|
|
67
|
-
}
|
|
23
|
+
import { MagicAccordionInstanceId, MagicAccordionViewId } from "../symbols";
|
|
24
|
+
const {
|
|
25
|
+
viewId,
|
|
26
|
+
disabled = false,
|
|
27
|
+
trigger = "click",
|
|
28
|
+
asChild = false
|
|
29
|
+
} = defineProps({
|
|
30
|
+
viewId: { type: String, required: false },
|
|
31
|
+
disabled: { type: null, required: false },
|
|
32
|
+
trigger: { type: String, required: false },
|
|
33
|
+
asChild: { type: Boolean, required: false }
|
|
34
|
+
});
|
|
35
|
+
const elRef = useTemplateRef("el");
|
|
36
|
+
const instanceId = inject(MagicAccordionInstanceId, void 0);
|
|
37
|
+
const injectedViewId = inject(MagicAccordionViewId, void 0);
|
|
38
|
+
const mappedViewId = computed(() => viewId ?? injectedViewId);
|
|
39
|
+
if (!instanceId) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
"MagicAccordionTrigger must be nested inside MagicAccordionProvider"
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (!mappedViewId.value) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
"MagicAccordionTrigger must be nested inside MagicAccordionView or a viewId must be provided"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
const { initializeState } = useAccordionState(instanceId);
|
|
50
|
+
const state = initializeState();
|
|
51
|
+
const { getView } = useAccordionView(instanceId);
|
|
52
|
+
const view = getView(mappedViewId.value);
|
|
53
|
+
const mappedDisabled = computed(
|
|
54
|
+
() => toValue(disabled) || state.options.disabled
|
|
55
|
+
);
|
|
56
|
+
const { onMouseenter, onClick, onEnter } = useAccordionTrigger({
|
|
57
|
+
elRef,
|
|
58
|
+
instanceId,
|
|
59
|
+
viewId: mappedViewId.value,
|
|
60
|
+
disabled,
|
|
61
|
+
trigger
|
|
68
62
|
});
|
|
63
|
+
onKeyStroke("Enter", onEnter);
|
|
69
64
|
</script>
|
|
70
65
|
|
|
71
66
|
<style>
|
|
@@ -1,71 +1,35 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
|
+
import { Primitive } from '@maas/vue-primitive';
|
|
2
3
|
import type { Interaction } from '../types/index.js';
|
|
3
4
|
interface MagicAccordionTriggerProps {
|
|
5
|
+
viewId?: string;
|
|
4
6
|
disabled?: MaybeRef<boolean>;
|
|
5
7
|
trigger?: Interaction;
|
|
6
8
|
asChild?: boolean;
|
|
7
9
|
}
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
refs: {
|
|
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/index.js").AccordionView | undefined;
|
|
12
|
+
declare const mappedDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
13
|
+
declare const onMouseenter: () => void, onClick: () => void;
|
|
14
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
15
|
+
declare var __VLS_12: {
|
|
16
|
+
viewActive: boolean | undefined;
|
|
54
17
|
};
|
|
55
|
-
type
|
|
56
|
-
|
|
57
|
-
|
|
18
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
19
|
+
default?: (props: typeof __VLS_12) => any;
|
|
20
|
+
}>;
|
|
21
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicAccordionTriggerProps, {
|
|
22
|
+
Primitive: typeof Primitive;
|
|
23
|
+
mappedViewId: typeof mappedViewId;
|
|
24
|
+
view: typeof view;
|
|
25
|
+
mappedDisabled: typeof mappedDisabled;
|
|
26
|
+
onMouseenter: typeof onMouseenter;
|
|
27
|
+
onClick: typeof onClick;
|
|
28
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicAccordionTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicAccordionTriggerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicAccordionTriggerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
58
31
|
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 & {
|
|
32
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
69
33
|
new (): {
|
|
70
34
|
$slots: S;
|
|
71
35
|
};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<primitive
|
|
3
|
+
:as-child="asChild"
|
|
4
|
+
:data-id="mappedId"
|
|
5
|
+
:data-active="view?.active"
|
|
6
|
+
class="magic-accordion-view"
|
|
7
|
+
>
|
|
8
|
+
<slot :view-active="view?.active" />
|
|
9
|
+
</primitive>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
4
13
|
import { computed, inject, onBeforeUnmount, provide, useId } from "vue";
|
|
5
14
|
import { Primitive } from "@maas/vue-primitive";
|
|
6
15
|
import {
|
|
@@ -9,47 +18,27 @@ import {
|
|
|
9
18
|
MagicAccordionViewId
|
|
10
19
|
} from "../symbols";
|
|
11
20
|
import { useAccordionView } from "../composables/private/useAccordionView";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
provide(MagicAccordionViewActive, mappedActive);
|
|
35
|
-
onBeforeUnmount(() => {
|
|
36
|
-
deleteView(mappedId.value);
|
|
37
|
-
});
|
|
38
|
-
return (_ctx, _cache) => {
|
|
39
|
-
return _openBlock(), _createBlock(_unref(Primitive), {
|
|
40
|
-
"as-child": _ctx.asChild,
|
|
41
|
-
"data-active": _unref(view)?.active,
|
|
42
|
-
class: "magic-accordion-view"
|
|
43
|
-
}, {
|
|
44
|
-
default: _withCtx(() => [
|
|
45
|
-
_renderSlot(_ctx.$slots, "default", {
|
|
46
|
-
viewActive: _unref(view)?.active
|
|
47
|
-
})
|
|
48
|
-
]),
|
|
49
|
-
_: 3
|
|
50
|
-
/* FORWARDED */
|
|
51
|
-
}, 8, ["as-child", "data-active"]);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
21
|
+
const { id, active } = defineProps({
|
|
22
|
+
id: { type: String, required: false },
|
|
23
|
+
asChild: { type: Boolean, required: false },
|
|
24
|
+
active: { type: Boolean, required: false }
|
|
25
|
+
});
|
|
26
|
+
const instanceId = inject(MagicAccordionInstanceId, void 0);
|
|
27
|
+
if (!instanceId) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
"MagicAccordionView must be nested inside MagicAccordionProvider"
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
const mappedId = computed(() => id ?? `magic-accordion-view-${useId()}`);
|
|
33
|
+
const mappedActive = computed(() => view.active);
|
|
34
|
+
const { initializeView, deleteView } = useAccordionView(instanceId);
|
|
35
|
+
const view = initializeView({
|
|
36
|
+
id: mappedId.value,
|
|
37
|
+
active: active ?? false
|
|
38
|
+
});
|
|
39
|
+
provide(MagicAccordionViewId, mappedId.value);
|
|
40
|
+
provide(MagicAccordionViewActive, mappedActive);
|
|
41
|
+
onBeforeUnmount(() => {
|
|
42
|
+
deleteView(mappedId.value);
|
|
54
43
|
});
|
|
55
44
|
</script>
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
+
import { Primitive } from '@maas/vue-primitive';
|
|
1
2
|
interface MagicAccordionViewProps {
|
|
2
3
|
id?: string;
|
|
3
4
|
asChild?: boolean;
|
|
4
5
|
active?: boolean;
|
|
5
6
|
}
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}): any;
|
|
12
|
-
};
|
|
13
|
-
refs: {};
|
|
14
|
-
rootEl: any;
|
|
7
|
+
declare const mappedId: import("vue").ComputedRef<string>;
|
|
8
|
+
declare const view: import("../types/index.js").AccordionView;
|
|
9
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
10
|
+
declare var __VLS_6: {
|
|
11
|
+
viewActive: boolean;
|
|
15
12
|
};
|
|
16
|
-
type
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
14
|
+
default?: (props: typeof __VLS_6) => any;
|
|
15
|
+
}>;
|
|
16
|
+
declare const __VLS_self: import("vue").DefineComponent<MagicAccordionViewProps, {
|
|
17
|
+
Primitive: typeof Primitive;
|
|
18
|
+
mappedId: typeof mappedId;
|
|
19
|
+
view: typeof view;
|
|
20
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicAccordionViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const __VLS_component: import("vue").DefineComponent<MagicAccordionViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicAccordionViewProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
19
23
|
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 & {
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
30
25
|
new (): {
|
|
31
26
|
$slots: S;
|
|
32
27
|
};
|
|
@@ -6,7 +6,7 @@ interface UseAccordionTriggerArgs {
|
|
|
6
6
|
viewId: string;
|
|
7
7
|
trigger: Interaction;
|
|
8
8
|
disabled: MaybeRef<boolean>;
|
|
9
|
-
elRef: Ref<InstanceType<typeof Primitive> |
|
|
9
|
+
elRef: Ref<InstanceType<typeof Primitive> | null>;
|
|
10
10
|
}
|
|
11
11
|
export declare function useAccordionTrigger(args: UseAccordionTriggerArgs): {
|
|
12
12
|
onMouseenter: () => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { reactive } from "vue";
|
|
2
2
|
import { useAccordionState } from "./useAccordionState.mjs";
|
|
3
|
+
import {} from "../../types/index.mjs";
|
|
3
4
|
export function useAccordionView(instanceId) {
|
|
4
5
|
const { initializeState } = useAccordionState(instanceId);
|
|
5
6
|
const state = initializeState();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InjectionKey, MaybeRef } from 'vue';
|
|
1
|
+
import type { InjectionKey, MaybeRef, Ref } from 'vue';
|
|
2
2
|
declare const MagicAccordionInstanceId: InjectionKey<MaybeRef<string>>;
|
|
3
3
|
declare const MagicAccordionViewId: InjectionKey<string>;
|
|
4
|
-
declare const MagicAccordionViewActive: InjectionKey<
|
|
4
|
+
declare const MagicAccordionViewActive: InjectionKey<Ref<boolean>>;
|
|
5
5
|
export { MagicAccordionInstanceId, MagicAccordionViewId, MagicAccordionViewActive, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("nuxt/schema").NuxtModule<import("nuxt/schema").ModuleOptions, import("nuxt/schema").ModuleOptions, false>;
|
|
2
2
|
export default _default;
|