@maas/vue-equipment 0.39.2 → 1.0.0-beta.1
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 +6 -16
- package/dist/composables/index.d.ts +2 -13
- package/dist/composables/index.js +65 -128
- package/dist/composables/index.js.map +1 -1
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +26 -40
- package/dist/plugins/.turbo/turbo-build.log +0 -0
- package/dist/plugins/.turbo/turbo-lint.log +13 -0
- package/dist/plugins/.turbo/turbo-release.log +7 -0
- package/dist/plugins/MagicAccordion/demo/data/footer.json +117 -0
- package/dist/plugins/MagicAccordion/index.d.ts +2 -0
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue +103 -70
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +17 -2
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +36 -30
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +11 -2
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +71 -71
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +12 -7
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +51 -50
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +13 -4
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionCallback.d.ts +6 -6
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionCallback.mjs +6 -6
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionState.mjs +10 -10
- package/dist/plugins/MagicAccordion/src/composables/private/useAccordionView.mjs +11 -10
- package/dist/plugins/MagicAccordion/src/symbols/index.d.ts +1 -1
- package/dist/plugins/MagicAccordion/src/types/index.d.ts +4 -0
- package/dist/plugins/MagicAccordion/src/utils/defaultOptions.d.ts +2 -2
- package/dist/plugins/MagicAccordion/src/utils/defaultOptions.mjs +7 -2
- package/dist/plugins/MagicCommand/demo/data/about.json +3 -0
- package/dist/plugins/MagicCommand/demo/data/search.json +594 -0
- package/dist/plugins/MagicCommand/index.d.ts +2 -0
- package/dist/plugins/MagicCommand/index.mjs +9 -11
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +192 -0
- package/dist/plugins/MagicCommand/src/components/{MagicCommandBody.vue.d.ts → MagicCommandContent.vue.d.ts} +4 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +60 -53
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +12 -3
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +108 -79
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +18 -9
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +55 -53
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +11 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +94 -62
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +52 -7
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +63 -0
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue.d.ts +2 -0
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +110 -0
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +75 -0
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +56 -73
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +16 -9
- package/dist/plugins/MagicCommand/src/composables/private/useCommandCallback.d.ts +14 -0
- package/dist/plugins/MagicCommand/src/composables/private/useCommandCallback.mjs +32 -0
- package/dist/plugins/MagicCommand/src/composables/private/useCommandItem.d.ts +15 -6
- package/dist/plugins/MagicCommand/src/composables/private/useCommandItem.mjs +77 -44
- package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.d.ts +22 -4
- package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.mjs +45 -28
- package/dist/plugins/MagicCommand/src/composables/private/useCommandState.d.ts +7 -0
- package/dist/plugins/MagicCommand/src/composables/private/useCommandState.mjs +49 -0
- package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.d.ts +18 -0
- package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.mjs +76 -0
- package/dist/plugins/MagicCommand/src/composables/private/useCommandView.d.ts +21 -5
- package/dist/plugins/MagicCommand/src/composables/private/useCommandView.mjs +193 -18
- package/dist/plugins/MagicCommand/src/composables/useMagicCommand.d.ts +14 -5
- package/dist/plugins/MagicCommand/src/composables/useMagicCommand.mjs +43 -13
- package/dist/plugins/MagicCommand/src/symbols/index.d.ts +8 -1
- package/dist/plugins/MagicCommand/src/symbols/index.mjs +18 -1
- package/dist/plugins/MagicCommand/src/types/index.d.ts +73 -13
- package/dist/plugins/MagicCommand/src/utils/defaultOptions.d.ts +3 -5
- package/dist/plugins/MagicCommand/src/utils/defaultOptions.mjs +8 -3
- package/dist/plugins/MagicCookie/index.d.ts +5 -3
- package/dist/plugins/MagicCookie/index.mjs +7 -3
- package/dist/plugins/MagicCookie/nuxt.mjs +5 -9
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue +56 -0
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +33 -0
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue +43 -0
- package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue.d.ts +32 -0
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue +96 -0
- package/dist/plugins/{MagicCommand/src/components/MagicCommandHead.vue.d.ts → MagicCookie/src/components/MagicCookieView.vue.d.ts} +6 -2
- package/dist/plugins/MagicCookie/src/composables/private/useCookieCallback.d.ts +9 -0
- package/dist/plugins/MagicCookie/src/composables/private/useCookieCallback.mjs +31 -0
- package/dist/plugins/MagicCookie/src/composables/private/useCookieItem.d.ts +16 -0
- package/dist/plugins/MagicCookie/src/composables/private/useCookieItem.mjs +87 -0
- package/dist/plugins/MagicCookie/src/composables/private/useCookieState.d.ts +7 -0
- package/dist/plugins/MagicCookie/src/composables/private/useCookieState.mjs +43 -0
- package/dist/plugins/MagicCookie/src/composables/useMagicCookie.d.ts +15 -15
- package/dist/plugins/MagicCookie/src/composables/useMagicCookie.mjs +59 -60
- package/dist/plugins/MagicCookie/src/symbols/index.d.ts +5 -0
- package/dist/plugins/MagicCookie/src/symbols/index.mjs +4 -0
- package/dist/plugins/MagicCookie/src/types/index.d.ts +31 -13
- package/dist/plugins/MagicCookie/src/utils/defaultOptions.d.ts +4 -0
- package/dist/plugins/MagicCookie/src/utils/defaultOptions.mjs +10 -0
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +142 -97
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +12 -6
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +6 -6
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +3 -1
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +3 -4
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +11 -8
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.d.ts +2 -1
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.mjs +8 -8
- package/dist/plugins/MagicDraggable/src/types/index.d.ts +10 -5
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.d.ts +3 -8
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.mjs +5 -5
- package/dist/plugins/MagicDrawer/nuxt.mjs +1 -1
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +491 -336
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +12 -6
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.d.ts +6 -6
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.mjs +6 -6
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.d.ts +7 -9
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +26 -17
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.d.ts +2 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.mjs +4 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.d.ts +5 -6
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +46 -29
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +8 -8
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.mjs +23 -19
- package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.mjs +4 -3
- package/dist/plugins/MagicDrawer/src/types/index.d.ts +10 -3
- package/dist/plugins/MagicDrawer/src/utils/defaultOptions.d.ts +3 -11
- package/dist/plugins/MagicDrawer/src/utils/defaultOptions.mjs +2 -4
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +190 -46
- package/dist/plugins/MagicEmitter/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicMarquee/index.d.ts +4 -2
- package/dist/plugins/MagicMarquee/index.mjs +2 -1
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +121 -50
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +14 -10
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.d.ts +3 -7
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.mjs +52 -44
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeState.d.ts +7 -0
- package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeState.mjs +42 -0
- package/dist/plugins/MagicMarquee/src/composables/useMagicMarquee.d.ts +11 -0
- package/dist/plugins/MagicMarquee/src/composables/useMagicMarquee.mjs +45 -0
- package/dist/plugins/MagicMarquee/src/types/index.d.ts +9 -0
- package/dist/plugins/MagicMarquee/src/types/index.mjs +0 -0
- package/dist/plugins/MagicMarquee/src/utils/defaultOptions.d.ts +4 -0
- package/dist/plugins/MagicMarquee/src/utils/defaultOptions.mjs +5 -0
- package/dist/plugins/MagicMenu/index.d.ts +2 -0
- package/dist/plugins/MagicMenu/nuxt.mjs +1 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +79 -69
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +10 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +247 -215
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +12 -1
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +235 -211
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +12 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +126 -124
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +15 -6
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +94 -96
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +49 -4
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +98 -87
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +11 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +111 -112
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +11 -2
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +67 -70
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +13 -2
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.d.ts +6 -6
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.mjs +8 -8
- package/dist/plugins/MagicMenu/src/composables/private/useMenuChannel.mjs +35 -26
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.mjs +12 -6
- package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.d.ts +1 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.mjs +20 -14
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +20 -13
- package/dist/plugins/MagicMenu/src/composables/private/useMenuState.mjs +10 -10
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.mjs +6 -3
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +99 -75
- package/dist/plugins/MagicMenu/src/symbols/index.d.ts +3 -3
- package/dist/plugins/MagicMenu/src/types/index.d.ts +1 -2
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +265 -165
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +12 -6
- package/dist/plugins/MagicModal/src/composables/private/useModalCallback.d.ts +6 -6
- package/dist/plugins/MagicModal/src/composables/private/useModalCallback.mjs +6 -6
- package/dist/plugins/MagicModal/src/composables/private/useModalStore.mjs +1 -1
- package/dist/plugins/MagicModal/src/types/index.d.ts +2 -2
- package/dist/plugins/MagicModal/src/utils/defaultOptions.mjs +2 -2
- package/dist/plugins/MagicNoise/index.d.ts +3 -1
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +120 -63
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +11 -4
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +2 -2
- package/dist/plugins/MagicPlayer/index.d.ts +4 -9
- package/dist/plugins/MagicPlayer/index.mjs +11 -17
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +78 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue.d.ts +2 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +134 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +33 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +45 -41
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +11 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +116 -114
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +13 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +111 -58
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +1 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +42 -23
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +1 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +83 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +34 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +111 -65
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +1 -4
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +94 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue.d.ts +2 -0
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +222 -0
- package/dist/plugins/MagicPlayer/src/components/{MagicPlayerControls.vue.d.ts → MagicPlayerVideoControls.vue.d.ts} +12 -5
- 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 +23 -1
- package/dist/plugins/MagicPlayer/src/components/icons/Waiting.vue.d.ts +1 -1
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +5 -6
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +18 -22
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +13 -13
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +4 -4
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +6 -8
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +2 -6
- package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.mjs +5 -5
- package/dist/plugins/MagicPlayer/src/css/magic-player-audio-controls.css +95 -0
- package/dist/plugins/MagicPlayer/src/css/magic-player-display-time.css +10 -0
- package/dist/plugins/MagicPlayer/src/css/magic-player-timeline.css +89 -0
- package/dist/plugins/MagicPlayer/src/css/magic-player-video-controls.css +115 -0
- package/dist/plugins/MagicPlayer/src/symbols/index.d.ts +5 -0
- package/dist/plugins/MagicPlayer/src/symbols/index.mjs +3 -0
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +11 -1
- package/dist/plugins/MagicPlayer/src/utils/defaultOptions.d.ts +3 -0
- package/dist/plugins/MagicPlayer/src/utils/defaultOptions.mjs +12 -0
- package/dist/plugins/MagicScroll/index.d.ts +4 -10
- package/dist/plugins/MagicScroll/index.mjs +2 -11
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +67 -31
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +14 -4
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +78 -64
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +14 -7
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +39 -39
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +15 -9
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +76 -73
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +13 -7
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.d.ts +13 -0
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.mjs +130 -0
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.d.ts +3 -3
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +5 -3
- package/dist/plugins/MagicScroll/src/symbols/index.d.ts +2 -2
- package/dist/plugins/MagicScroll/src/symbols/index.mjs +2 -2
- package/dist/plugins/MagicScroll/src/types/index.d.ts +12 -22
- package/dist/plugins/MagicToast/index.d.ts +3 -2
- package/dist/plugins/MagicToast/index.mjs +3 -3
- package/dist/plugins/MagicToast/nuxt.mjs +2 -2
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +296 -0
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue.d.ts +23 -0
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +155 -0
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +33 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +7 -30
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +34 -29
- package/dist/plugins/MagicToast/src/composables/private/useToastDrag.d.ts +12 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastDrag.mjs +312 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastListener.d.ts +6 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastListener.mjs +25 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.d.ts +6 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.mjs +41 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastState.d.ts +7 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastState.mjs +45 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastView.d.ts +12 -0
- package/dist/plugins/MagicToast/src/composables/private/useToastView.mjs +51 -0
- package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +13 -8
- package/dist/plugins/MagicToast/src/composables/useMagicToast.mjs +26 -23
- package/dist/plugins/MagicToast/src/types/index.d.ts +58 -17
- package/dist/plugins/MagicToast/src/utils/defaultOptions.d.ts +2 -3
- package/dist/plugins/MagicToast/src/utils/defaultOptions.mjs +21 -4
- package/dist/plugins/MagicToast/symbols/index.d.ts +3 -0
- package/dist/plugins/MagicToast/symbols/index.mjs +2 -0
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/index.mjs +0 -1
- package/dist/utils/css/animations/auto-size-out.css +12 -0
- package/dist/utils/css/animations/squash-y.css +5 -0
- package/dist/utils/css/animations.css +2 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.js +2 -53
- package/dist/utils/index.js.map +1 -1
- package/package.json +52 -56
- package/dist/composables/index.d.mts +0 -108
- package/dist/composables/index.mjs +0 -383
- package/dist/composables/index.mjs.map +0 -1
- package/dist/plugins/MagicAutoSize/index.d.ts +0 -4
- package/dist/plugins/MagicAutoSize/index.mjs +0 -7
- package/dist/plugins/MagicAutoSize/nuxt.d.ts +0 -2
- package/dist/plugins/MagicAutoSize/nuxt.mjs +0 -14
- package/dist/plugins/MagicAutoSize/src/components/MagicAutoSize.vue +0 -152
- package/dist/plugins/MagicAutoSize/src/components/MagicAutoSize.vue.d.ts +0 -29
- package/dist/plugins/MagicCommand/src/components/MagicCommandBody.vue +0 -91
- package/dist/plugins/MagicCommand/src/components/MagicCommandFooter.vue +0 -5
- package/dist/plugins/MagicCommand/src/components/MagicCommandFooter.vue.d.ts +0 -17
- package/dist/plugins/MagicCommand/src/components/MagicCommandGroup.vue +0 -5
- package/dist/plugins/MagicCommand/src/components/MagicCommandGroup.vue.d.ts +0 -17
- package/dist/plugins/MagicCommand/src/components/MagicCommandHead.vue +0 -5
- package/dist/plugins/MagicCommand/src/composables/private/useCommandStore.d.ts +0 -35
- package/dist/plugins/MagicCommand/src/composables/private/useCommandStore.mjs +0 -67
- package/dist/plugins/MagicCookie/src/components/MagicCookie.vue +0 -117
- package/dist/plugins/MagicCookie/src/components/MagicCookie.vue.d.ts +0 -27
- package/dist/plugins/MagicCookie/src/composables/private/useCookieApi.d.ts +0 -29
- package/dist/plugins/MagicCookie/src/composables/private/useCookieApi.mjs +0 -22
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue +0 -89
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue.d.ts +0 -28
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue +0 -95
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue.d.ts +0 -24
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue +0 -125
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue.d.ts +0 -35
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue +0 -152
- package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue +0 -42
- package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue.d.ts +0 -36
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.d.ts +0 -56
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.mjs +0 -140
- package/dist/plugins/MagicToast/src/components/MagicToast.vue +0 -141
- package/dist/plugins/MagicToast/src/components/MagicToast.vue.d.ts +0 -14
- package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue +0 -64
- package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue.d.ts +0 -30
- package/dist/plugins/MagicToast/src/composables/private/useToastApi.d.ts +0 -5
- package/dist/plugins/MagicToast/src/composables/private/useToastApi.mjs +0 -22
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.d.ts +0 -4
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.mjs +0 -28
- package/dist/plugins/MagicToast/src/composables/private/useToastStore.d.ts +0 -27
- package/dist/plugins/MagicToast/src/composables/private/useToastStore.mjs +0 -41
- package/dist/utils/index.d.mts +0 -80
- package/dist/utils/index.mjs +0 -200
- package/dist/utils/index.mjs.map +0 -1
|
@@ -1,77 +1,60 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<script lang="ts" setup>
|
|
1
|
+
<script>
|
|
2
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
3
|
+
import { unref as _unref, renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
4
|
+
const _hoisted_1 = ["id"];
|
|
5
|
+
import { computed, inject, onBeforeUnmount, provide, useId, watch } from "vue";
|
|
6
|
+
import { useCommandView } from "../composables/private/useCommandView";
|
|
8
7
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const items = computed(() => {
|
|
45
|
-
return findInstance(toValue(commandId))?.items
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const { addView, removeView, findInstance, sortItems } = useCommandStore()
|
|
49
|
-
|
|
50
|
-
onMounted(() => {
|
|
51
|
-
if (toValue(commandId)) {
|
|
52
|
-
addView(toValue(commandId), mappedId.value)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (props.default) {
|
|
56
|
-
selectView(mappedId.value)
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
onUnmounted(() => {
|
|
61
|
-
if (toValue(commandId)) {
|
|
62
|
-
removeView(toValue(commandId), mappedId.value)
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
// Update sorting for MagicCommandItems
|
|
67
|
-
watch(
|
|
68
|
-
() => items.value?.length,
|
|
69
|
-
() => {
|
|
70
|
-
nextTick(() => {
|
|
71
|
-
if (elRef.value) {
|
|
72
|
-
sortItems(toValue(commandId), elRef.value)
|
|
8
|
+
MagicCommandInstanceId,
|
|
9
|
+
MagicCommandViewId,
|
|
10
|
+
MagicCommandParentTree,
|
|
11
|
+
MagicCommandItemId,
|
|
12
|
+
MagicCommandViewActive
|
|
13
|
+
} from "../symbols";
|
|
14
|
+
export default /* @__PURE__ */ _defineComponent({
|
|
15
|
+
__name: "MagicCommandView",
|
|
16
|
+
props: {
|
|
17
|
+
id: { type: String, required: false },
|
|
18
|
+
initial: { type: Boolean, required: false, default: false }
|
|
19
|
+
},
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const parentTree = inject(MagicCommandParentTree, []);
|
|
22
|
+
const instanceId = inject(MagicCommandInstanceId, void 0);
|
|
23
|
+
const itemId = inject(MagicCommandItemId, void 0);
|
|
24
|
+
if (!instanceId) {
|
|
25
|
+
throw new Error("MagicCommandView must be nested inside MagicCommandProvider");
|
|
26
|
+
}
|
|
27
|
+
const mappedId = computed(() => __props.id ?? `magic-command-view-${useId()}`);
|
|
28
|
+
const mappedParentTree = computed(() => [...parentTree, mappedId.value]);
|
|
29
|
+
const mappedActive = computed(() => view.active);
|
|
30
|
+
const { initializeView, deleteView, sortViewItems } = useCommandView(instanceId);
|
|
31
|
+
const view = initializeView({
|
|
32
|
+
id: mappedId.value,
|
|
33
|
+
parent: { views: parentTree, item: itemId ?? "" },
|
|
34
|
+
initial: __props.initial
|
|
35
|
+
});
|
|
36
|
+
provide(MagicCommandViewId, mappedId.value);
|
|
37
|
+
provide(MagicCommandViewActive, mappedActive);
|
|
38
|
+
provide(MagicCommandParentTree, mappedParentTree.value);
|
|
39
|
+
watch(
|
|
40
|
+
() => view?.items,
|
|
41
|
+
() => {
|
|
42
|
+
sortViewItems(mappedId.value);
|
|
73
43
|
}
|
|
74
|
-
|
|
44
|
+
);
|
|
45
|
+
onBeforeUnmount(() => {
|
|
46
|
+
deleteView(mappedId.value);
|
|
47
|
+
});
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
return _openBlock(), _createElementBlock("div", {
|
|
50
|
+
id: mappedId.value,
|
|
51
|
+
class: "magic-menu-view"
|
|
52
|
+
}, [
|
|
53
|
+
_renderSlot(_ctx.$slots, "default", {
|
|
54
|
+
viewActive: _unref(view).active
|
|
55
|
+
})
|
|
56
|
+
], 8, _hoisted_1);
|
|
57
|
+
};
|
|
75
58
|
}
|
|
76
|
-
)
|
|
59
|
+
});
|
|
77
60
|
</script>
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
interface MagicCommandViewProps {
|
|
2
2
|
id?: string;
|
|
3
|
-
|
|
3
|
+
initial?: boolean;
|
|
4
4
|
}
|
|
5
5
|
declare function __VLS_template(): {
|
|
6
6
|
attrs: Partial<{}>;
|
|
7
7
|
slots: {
|
|
8
|
-
default?(_: {
|
|
8
|
+
default?(_: {
|
|
9
|
+
viewActive: boolean;
|
|
10
|
+
}): any;
|
|
9
11
|
};
|
|
10
|
-
refs: {
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
rootEl: any;
|
|
12
|
+
refs: {};
|
|
13
|
+
rootEl: HTMLDivElement;
|
|
14
14
|
};
|
|
15
15
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
|
-
declare const __VLS_component: import("vue").DefineComponent<MagicCommandViewProps
|
|
17
|
-
default: boolean;
|
|
18
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicCommandViewProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicCommandViewProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
19
17
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
18
|
export default _default;
|
|
19
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
20
|
+
type __VLS_TypePropsToOption<T> = {
|
|
21
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
22
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
23
|
+
} : {
|
|
24
|
+
type: import('vue').PropType<T[K]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
21
28
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
29
|
new (): {
|
|
23
30
|
$slots: S;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type MaybeRef } from 'vue';
|
|
2
|
+
type UseCommandCallbackArgs = {
|
|
3
|
+
instanceId: MaybeRef<string>;
|
|
4
|
+
viewId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function useCommandCallback(args: UseCommandCallbackArgs): {
|
|
7
|
+
onBeforeEnter: () => void;
|
|
8
|
+
onEnter: () => void;
|
|
9
|
+
onAfterEnter: () => void;
|
|
10
|
+
onBeforeLeave: () => void;
|
|
11
|
+
onLeave: () => void;
|
|
12
|
+
onAfterLeave: () => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { toValue } from "vue";
|
|
2
|
+
import { useMagicEmitter } from "@maas/vue-equipment/plugins";
|
|
3
|
+
export function useCommandCallback(args) {
|
|
4
|
+
const { instanceId, viewId } = args;
|
|
5
|
+
const emitter = useMagicEmitter();
|
|
6
|
+
function onBeforeEnter() {
|
|
7
|
+
emitter.emit("beforeEnter", { id: toValue(instanceId), viewId });
|
|
8
|
+
}
|
|
9
|
+
function onEnter() {
|
|
10
|
+
emitter.emit("enter", { id: toValue(instanceId), viewId });
|
|
11
|
+
}
|
|
12
|
+
function onAfterEnter() {
|
|
13
|
+
emitter.emit("afterEnter", { id: toValue(instanceId), viewId });
|
|
14
|
+
}
|
|
15
|
+
function onBeforeLeave() {
|
|
16
|
+
emitter.emit("beforeLeave", { id: toValue(instanceId), viewId });
|
|
17
|
+
}
|
|
18
|
+
function onLeave() {
|
|
19
|
+
emitter.emit("leave", { id: toValue(instanceId), viewId });
|
|
20
|
+
}
|
|
21
|
+
function onAfterLeave() {
|
|
22
|
+
emitter.emit("afterLeave", { id: toValue(instanceId), viewId });
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
onBeforeEnter,
|
|
26
|
+
onEnter,
|
|
27
|
+
onAfterEnter,
|
|
28
|
+
onBeforeLeave,
|
|
29
|
+
onLeave,
|
|
30
|
+
onAfterLeave
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { CommandItem } from '../../types/index.js';
|
|
3
|
+
type UseCommandItemArgs = {
|
|
4
|
+
instanceId: MaybeRef<string>;
|
|
5
|
+
viewId: string;
|
|
6
|
+
};
|
|
7
|
+
type InitializeItemArgs = Pick<CommandItem, 'id' | 'disabled'>;
|
|
8
|
+
export declare function useCommandItem(args: UseCommandItemArgs): {
|
|
9
|
+
activeItem: import("vue").ComputedRef<CommandItem | undefined>;
|
|
10
|
+
initializeItem: (args: InitializeItemArgs) => CommandItem;
|
|
11
|
+
deleteItem: (id: string) => void;
|
|
12
|
+
getItem: (id: string) => CommandItem | undefined;
|
|
5
13
|
selectItem: (id: string) => void;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
selectNextItem: (loop?: boolean) => void;
|
|
15
|
+
selectPrevItem: (loop?: boolean) => void;
|
|
16
|
+
unselectItem: (id: string) => void;
|
|
9
17
|
};
|
|
18
|
+
export {};
|
|
@@ -1,57 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { reactive, computed } from "vue";
|
|
2
|
+
import { useCommandView } from "./useCommandView.mjs";
|
|
3
|
+
export function useCommandItem(args) {
|
|
4
|
+
const { instanceId, viewId } = args;
|
|
5
|
+
const { getView } = useCommandView(instanceId);
|
|
6
|
+
const view = getView(viewId);
|
|
7
|
+
const activeItem = computed(() => view?.items.find((item) => item.active));
|
|
8
|
+
function createItem(args2) {
|
|
9
|
+
const { id, disabled } = args2;
|
|
10
|
+
const item = {
|
|
11
|
+
id,
|
|
12
|
+
active: false,
|
|
13
|
+
disabled
|
|
14
|
+
};
|
|
15
|
+
return reactive(item);
|
|
16
|
+
}
|
|
17
|
+
function addItem(args2) {
|
|
18
|
+
const item = createItem(args2);
|
|
19
|
+
if (view?.items) {
|
|
20
|
+
view.items = [...view.items, item];
|
|
21
|
+
}
|
|
22
|
+
return item;
|
|
23
|
+
}
|
|
24
|
+
function unselectSiblings(id) {
|
|
25
|
+
return view?.items.filter((item) => item.id !== id).forEach((item) => item.active = false);
|
|
26
|
+
}
|
|
27
|
+
function initializeItem(args2) {
|
|
28
|
+
const { id } = args2;
|
|
29
|
+
const item = getItem(id) ?? addItem(args2);
|
|
30
|
+
return item;
|
|
31
|
+
}
|
|
32
|
+
function deleteItem(id) {
|
|
33
|
+
if (!view?.items) return;
|
|
34
|
+
view.items = view.items.filter((x) => x.id !== id);
|
|
35
|
+
}
|
|
36
|
+
function getItem(id) {
|
|
37
|
+
return view?.items.find((item) => {
|
|
38
|
+
return item.id === id;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function selectItem(id) {
|
|
42
|
+
const item = getItem(id);
|
|
43
|
+
if (item) {
|
|
44
|
+
item.active = true;
|
|
45
|
+
unselectSiblings(id);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function selectNextItem(loop = false) {
|
|
49
|
+
const index = view?.items.findIndex(
|
|
50
|
+
(item) => item.id === activeItem.value?.id
|
|
51
|
+
);
|
|
52
|
+
if (index !== void 0) {
|
|
53
|
+
const hasNext = view?.items[index + 1] !== void 0;
|
|
17
54
|
if (hasNext) {
|
|
18
|
-
selectItem(items
|
|
19
|
-
} else if (loop) {
|
|
20
|
-
selectItem(items
|
|
55
|
+
selectItem(view?.items[index + 1].id);
|
|
56
|
+
} else if (view && loop) {
|
|
57
|
+
selectItem(view.items[0].id);
|
|
21
58
|
}
|
|
22
59
|
}
|
|
23
60
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const hasPrev = items
|
|
61
|
+
function selectPrevItem(loop = false) {
|
|
62
|
+
const index = view?.items.findIndex(
|
|
63
|
+
(item) => item.id === activeItem.value?.id
|
|
64
|
+
);
|
|
65
|
+
if (index !== void 0) {
|
|
66
|
+
const hasPrev = view?.items[index - 1] !== void 0;
|
|
30
67
|
if (hasPrev) {
|
|
31
|
-
selectItem(items
|
|
32
|
-
} else if (loop) {
|
|
33
|
-
selectItem(items.
|
|
68
|
+
selectItem(view?.items[index - 1].id);
|
|
69
|
+
} else if (view && loop) {
|
|
70
|
+
selectItem(view.items[view.items.length - 1].id);
|
|
34
71
|
}
|
|
35
72
|
}
|
|
36
73
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
if (!watcherActive.value) {
|
|
44
|
-
watcherActive.value = true;
|
|
45
|
-
watch(activeItem, (_newItem, oldItem) => {
|
|
46
|
-
if (oldItem) lastActiveItem.value = oldItem;
|
|
47
|
-
});
|
|
74
|
+
function unselectItem(id) {
|
|
75
|
+
const item = getItem(id);
|
|
76
|
+
if (item) {
|
|
77
|
+
item.active = false;
|
|
78
|
+
}
|
|
48
79
|
}
|
|
49
80
|
return {
|
|
50
|
-
nextItem,
|
|
51
|
-
prevItem,
|
|
52
|
-
selectItem,
|
|
53
|
-
selectLastItem,
|
|
54
81
|
activeItem,
|
|
55
|
-
|
|
82
|
+
initializeItem,
|
|
83
|
+
deleteItem,
|
|
84
|
+
getItem,
|
|
85
|
+
selectItem,
|
|
86
|
+
selectNextItem,
|
|
87
|
+
selectPrevItem,
|
|
88
|
+
unselectItem
|
|
56
89
|
};
|
|
57
90
|
}
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
|
+
interface IsElementAboveArgs {
|
|
3
|
+
element: MaybeRef<HTMLElement>;
|
|
4
|
+
ancestor?: HTMLElement;
|
|
5
|
+
}
|
|
6
|
+
interface IsElementBelowArgs {
|
|
7
|
+
element: MaybeRef<HTMLElement>;
|
|
8
|
+
ancestor?: HTMLElement;
|
|
9
|
+
}
|
|
10
|
+
interface ScrollInFromTopArgs {
|
|
11
|
+
element: MaybeRef<HTMLElement>;
|
|
12
|
+
ancestor?: HTMLElement;
|
|
13
|
+
}
|
|
14
|
+
interface ScrollInFromBottomArgs {
|
|
15
|
+
element: MaybeRef<HTMLElement>;
|
|
16
|
+
ancestor?: HTMLElement;
|
|
17
|
+
}
|
|
2
18
|
export declare function useCommandScroll(parent: MaybeRef<HTMLElement | undefined>): {
|
|
3
|
-
isElementAbove: (element: MaybeRef<HTMLElement>) => boolean;
|
|
4
|
-
isElementBelow: (element: MaybeRef<HTMLElement>) => boolean;
|
|
5
19
|
findElement: (id: string) => HTMLElement | null;
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
findScrollableAncestor: (element: HTMLElement | null) => HTMLElement | undefined;
|
|
21
|
+
isElementAbove: (args: IsElementAboveArgs) => boolean;
|
|
22
|
+
isElementBelow: (args: IsElementBelowArgs) => boolean;
|
|
23
|
+
scrollInFromTop: (args: ScrollInFromTopArgs) => void;
|
|
24
|
+
scrollInFromBottom: (args: ScrollInFromBottomArgs) => void;
|
|
8
25
|
};
|
|
26
|
+
export {};
|
|
@@ -3,50 +3,67 @@ export function useCommandScroll(parent) {
|
|
|
3
3
|
const mappedParent = computed(
|
|
4
4
|
() => toValue(parent) || document.documentElement
|
|
5
5
|
);
|
|
6
|
-
const paddingTop = computed(
|
|
7
|
-
() => parseFloat(getCssValue(mappedParent.value, "padding-top"))
|
|
8
|
-
);
|
|
9
|
-
const paddingBottom = computed(
|
|
10
|
-
() => parseFloat(getCssValue(mappedParent.value, "padding-bottom"))
|
|
11
|
-
);
|
|
12
6
|
function getCssValue(el, style) {
|
|
13
|
-
return getComputedStyle(el, null).getPropertyValue(style);
|
|
7
|
+
return parseFloat(getComputedStyle(el, null).getPropertyValue(style));
|
|
14
8
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
const parentRect = mappedParent.value.getBoundingClientRect();
|
|
18
|
-
const parentTop = parentRect.top + paddingTop.value;
|
|
19
|
-
return elementRect.top < parentTop;
|
|
9
|
+
function getPaddingTop(el) {
|
|
10
|
+
return getCssValue(el, "padding-top");
|
|
20
11
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
const parentRect = mappedParent.value.getBoundingClientRect();
|
|
24
|
-
const parentBottom = parentRect.height + parentRect.top - paddingBottom.value;
|
|
25
|
-
return elementRect.bottom >= parentBottom;
|
|
12
|
+
function getPaddingBottom(el) {
|
|
13
|
+
return getCssValue(el, "padding-bottom");
|
|
26
14
|
}
|
|
27
15
|
function findElement(id) {
|
|
28
16
|
return mappedParent.value.querySelector(`[data-id="${id}"]`);
|
|
29
17
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
function findScrollableAncestor(element) {
|
|
19
|
+
if (!element || element === document.documentElement) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
const { overflowY } = window.getComputedStyle(element);
|
|
23
|
+
const isScrollable = overflowY !== "visible" && overflowY !== "hidden" && element.scrollHeight > element.clientHeight;
|
|
24
|
+
return isScrollable ? element : findScrollableAncestor(element.parentElement);
|
|
25
|
+
}
|
|
26
|
+
function isElementAbove(args) {
|
|
27
|
+
const { ancestor = mappedParent.value, element } = args;
|
|
28
|
+
const elementRect = toValue(element).getBoundingClientRect();
|
|
29
|
+
const ancestorRect = ancestor.getBoundingClientRect();
|
|
30
|
+
const ancestorPadding = getPaddingTop(ancestor);
|
|
31
|
+
const ancestorTop = ancestorRect.top + ancestorPadding;
|
|
32
|
+
return elementRect.top < ancestorTop;
|
|
33
|
+
}
|
|
34
|
+
function isElementBelow(args) {
|
|
35
|
+
const { ancestor = mappedParent.value, element } = args;
|
|
36
|
+
const elementRect = toValue(element).getBoundingClientRect();
|
|
37
|
+
const ancestorRect = ancestor.getBoundingClientRect();
|
|
38
|
+
const ancestorPadding = getPaddingBottom(ancestor);
|
|
39
|
+
const ancestorBottom = ancestorRect.height + ancestorRect.top - ancestorPadding;
|
|
40
|
+
return elementRect.bottom >= ancestorBottom;
|
|
41
|
+
}
|
|
42
|
+
function scrollInFromTop(args) {
|
|
43
|
+
const { ancestor = mappedParent.value, element } = args;
|
|
44
|
+
const elementRect = toValue(element).getBoundingClientRect();
|
|
45
|
+
const ancestorRect = ancestor.getBoundingClientRect();
|
|
46
|
+
const ancestorPadding = getPaddingTop(ancestor);
|
|
47
|
+
const scrollAmount = elementRect.top - ancestorRect.top - ancestorPadding;
|
|
48
|
+
ancestor.scrollBy({
|
|
35
49
|
top: scrollAmount
|
|
36
50
|
});
|
|
37
51
|
}
|
|
38
|
-
function scrollInFromBottom(
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
52
|
+
function scrollInFromBottom(args) {
|
|
53
|
+
const { ancestor = mappedParent.value, element } = args;
|
|
54
|
+
const elementRect = toValue(element).getBoundingClientRect();
|
|
55
|
+
const ancestorRect = ancestor.getBoundingClientRect();
|
|
56
|
+
const ancestorPadding = getPaddingBottom(ancestor);
|
|
57
|
+
const scrollAmount = elementRect.bottom - ancestorRect.bottom + ancestorPadding;
|
|
58
|
+
ancestor.scrollBy({
|
|
43
59
|
top: scrollAmount
|
|
44
60
|
});
|
|
45
61
|
}
|
|
46
62
|
return {
|
|
63
|
+
findElement,
|
|
64
|
+
findScrollableAncestor,
|
|
47
65
|
isElementAbove,
|
|
48
66
|
isElementBelow,
|
|
49
|
-
findElement,
|
|
50
67
|
scrollInFromTop,
|
|
51
68
|
scrollInFromBottom
|
|
52
69
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Ref, type MaybeRef } from 'vue';
|
|
2
|
+
import type { CommandState, MagicCommandOptions } from '../../types/index.js';
|
|
3
|
+
export declare function useCommandState(instanceId: MaybeRef<string>): {
|
|
4
|
+
initializeState: (options?: MagicCommandOptions) => CommandState;
|
|
5
|
+
deleteState: () => void;
|
|
6
|
+
commandStateStore: Ref<CommandState[], CommandState[]>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ref, reactive, toValue } from "vue";
|
|
2
|
+
import { defu } from "defu";
|
|
3
|
+
import { defaultOptions } from "../../utils/defaultOptions.mjs";
|
|
4
|
+
const commandStateStore = ref([]);
|
|
5
|
+
export function useCommandState(instanceId) {
|
|
6
|
+
function createState(id) {
|
|
7
|
+
const view = commandStateStore.value.find((state2) => state2.id === id)?.views.findLast((view2) => view2.active)?.id;
|
|
8
|
+
const state = {
|
|
9
|
+
id,
|
|
10
|
+
options: { ...defaultOptions },
|
|
11
|
+
views: [],
|
|
12
|
+
renderer: void 0,
|
|
13
|
+
active: false,
|
|
14
|
+
input: {
|
|
15
|
+
type: "pointer",
|
|
16
|
+
view
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return reactive(state);
|
|
20
|
+
}
|
|
21
|
+
function addState(id) {
|
|
22
|
+
const state = createState(id);
|
|
23
|
+
commandStateStore.value = [...commandStateStore.value, state];
|
|
24
|
+
return state;
|
|
25
|
+
}
|
|
26
|
+
function initializeState(options) {
|
|
27
|
+
let state = commandStateStore.value.find((entry) => {
|
|
28
|
+
return entry.id === toValue(instanceId);
|
|
29
|
+
});
|
|
30
|
+
if (!state) {
|
|
31
|
+
state = addState(toValue(instanceId));
|
|
32
|
+
}
|
|
33
|
+
if (options) {
|
|
34
|
+
const mappedOptions = defu(options, defaultOptions);
|
|
35
|
+
state.options = mappedOptions;
|
|
36
|
+
}
|
|
37
|
+
return state;
|
|
38
|
+
}
|
|
39
|
+
function deleteState() {
|
|
40
|
+
commandStateStore.value = commandStateStore.value.filter(
|
|
41
|
+
(x) => x.id !== toValue(instanceId)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
initializeState,
|
|
46
|
+
deleteState,
|
|
47
|
+
commandStateStore
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ComputedRef, type MaybeRef, type Ref } from 'vue';
|
|
2
|
+
import { Primitive } from '@maas/vue-primitive';
|
|
3
|
+
import type { Action, Interaction } from '../../types/index.js';
|
|
4
|
+
type UseCommandTriggerArgs = {
|
|
5
|
+
instanceId: MaybeRef<string>;
|
|
6
|
+
viewId: string;
|
|
7
|
+
mappedDisabled: ComputedRef<boolean>;
|
|
8
|
+
mappedActive?: ComputedRef<boolean>;
|
|
9
|
+
trigger: Interaction[];
|
|
10
|
+
action: Action;
|
|
11
|
+
elRef: Ref<InstanceType<typeof Primitive> | undefined>;
|
|
12
|
+
};
|
|
13
|
+
export declare function useCommandTrigger(args: UseCommandTriggerArgs): {
|
|
14
|
+
onMouseenter: () => Promise<void>;
|
|
15
|
+
onClick: (e: MouseEvent) => Promise<void>;
|
|
16
|
+
onEnter: (e?: KeyboardEvent) => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { nextTick } from "vue";
|
|
2
|
+
import { useFocus } from "@vueuse/core";
|
|
3
|
+
import { useCommandView } from "./useCommandView.mjs";
|
|
4
|
+
import { useCommandState } from "./useCommandState.mjs";
|
|
5
|
+
export function useCommandTrigger(args) {
|
|
6
|
+
const {
|
|
7
|
+
instanceId,
|
|
8
|
+
viewId,
|
|
9
|
+
trigger,
|
|
10
|
+
action,
|
|
11
|
+
mappedDisabled,
|
|
12
|
+
mappedActive,
|
|
13
|
+
elRef
|
|
14
|
+
} = args;
|
|
15
|
+
const { getView, selectView, unselectView } = useCommandView(instanceId);
|
|
16
|
+
const view = getView(viewId);
|
|
17
|
+
const { initializeState } = useCommandState(instanceId);
|
|
18
|
+
const state = initializeState();
|
|
19
|
+
const { focused } = useFocus(elRef);
|
|
20
|
+
async function onEnter(e) {
|
|
21
|
+
if ((focused.value || mappedActive?.value) && !mappedDisabled.value && !view?.active) {
|
|
22
|
+
e?.preventDefault();
|
|
23
|
+
e?.stopPropagation();
|
|
24
|
+
state.input.type = "keyboard";
|
|
25
|
+
switch (action) {
|
|
26
|
+
case "close":
|
|
27
|
+
unselectView(viewId);
|
|
28
|
+
break;
|
|
29
|
+
case "open":
|
|
30
|
+
if (!state.active) {
|
|
31
|
+
state.active = true;
|
|
32
|
+
await nextTick();
|
|
33
|
+
}
|
|
34
|
+
selectView(viewId);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function onMouseenter() {
|
|
40
|
+
if (trigger.includes("mouseenter") && !mappedDisabled.value && viewId && view) {
|
|
41
|
+
switch (action) {
|
|
42
|
+
case "close":
|
|
43
|
+
unselectView(viewId);
|
|
44
|
+
break;
|
|
45
|
+
case "open":
|
|
46
|
+
if (!state.active) {
|
|
47
|
+
state.active = true;
|
|
48
|
+
await nextTick();
|
|
49
|
+
}
|
|
50
|
+
selectView(viewId);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function onClick(e) {
|
|
56
|
+
if (trigger.includes("click") && !mappedDisabled.value && e.button === 0 && viewId) {
|
|
57
|
+
switch (action) {
|
|
58
|
+
case "close":
|
|
59
|
+
unselectView(viewId);
|
|
60
|
+
break;
|
|
61
|
+
case "open":
|
|
62
|
+
if (!state.active) {
|
|
63
|
+
state.active = true;
|
|
64
|
+
await nextTick();
|
|
65
|
+
}
|
|
66
|
+
selectView(viewId);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
onMouseenter,
|
|
73
|
+
onClick,
|
|
74
|
+
onEnter
|
|
75
|
+
};
|
|
76
|
+
}
|