@maas/vue-equipment 0.40.0 → 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/README.md +6 -16
  2. package/dist/composables/index.d.ts +7 -18
  3. package/dist/composables/index.js +79 -132
  4. package/dist/composables/index.js.map +1 -1
  5. package/dist/nuxt/module.json +1 -1
  6. package/dist/nuxt/module.mjs +35 -42
  7. package/dist/plugins/.turbo/turbo-build.log +0 -0
  8. package/dist/plugins/.turbo/turbo-lint.log +5 -0
  9. package/dist/plugins/.turbo/turbo-release.log +7 -0
  10. package/dist/plugins/MagicAccordion/demo/data/footer.json +117 -0
  11. package/dist/plugins/MagicAccordion/index.d.ts +2 -0
  12. package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue +103 -70
  13. package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +39 -13
  14. package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +36 -30
  15. package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +12 -12
  16. package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +73 -71
  17. package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +24 -55
  18. package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +52 -50
  19. package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +18 -14
  20. package/dist/plugins/MagicAccordion/src/composables/private/useAccordionCallback.d.ts +6 -6
  21. package/dist/plugins/MagicAccordion/src/composables/private/useAccordionCallback.mjs +6 -6
  22. package/dist/plugins/MagicAccordion/src/composables/private/useAccordionState.mjs +10 -10
  23. package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.d.ts +1 -1
  24. package/dist/plugins/MagicAccordion/src/composables/private/useAccordionView.mjs +11 -10
  25. package/dist/plugins/MagicAccordion/src/symbols/index.d.ts +2 -2
  26. package/dist/plugins/MagicAccordion/src/types/index.d.ts +4 -0
  27. package/dist/plugins/MagicAccordion/src/utils/defaultOptions.d.ts +2 -2
  28. package/dist/plugins/MagicAccordion/src/utils/defaultOptions.mjs +7 -2
  29. package/dist/plugins/MagicCommand/demo/data/about.json +3 -0
  30. package/dist/plugins/MagicCommand/demo/data/search.json +594 -0
  31. package/dist/plugins/MagicCommand/index.d.ts +2 -0
  32. package/dist/plugins/MagicCommand/index.mjs +9 -11
  33. package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +199 -0
  34. package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +32 -0
  35. package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +60 -53
  36. package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +14 -14
  37. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +105 -80
  38. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +32 -22
  39. package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +55 -53
  40. package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +12 -12
  41. package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +92 -62
  42. package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +15 -16
  43. package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +63 -0
  44. package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue.d.ts +2 -0
  45. package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +111 -0
  46. package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +40 -0
  47. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +56 -73
  48. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +16 -16
  49. package/dist/plugins/MagicCommand/src/composables/private/useCommandCallback.d.ts +14 -0
  50. package/dist/plugins/MagicCommand/src/composables/private/useCommandCallback.mjs +32 -0
  51. package/dist/plugins/MagicCommand/src/composables/private/useCommandItem.d.ts +15 -6
  52. package/dist/plugins/MagicCommand/src/composables/private/useCommandItem.mjs +77 -44
  53. package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.d.ts +24 -6
  54. package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.mjs +45 -28
  55. package/dist/plugins/MagicCommand/src/composables/private/useCommandState.d.ts +7 -0
  56. package/dist/plugins/MagicCommand/src/composables/private/useCommandState.mjs +49 -0
  57. package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.d.ts +18 -0
  58. package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.mjs +76 -0
  59. package/dist/plugins/MagicCommand/src/composables/private/useCommandView.d.ts +21 -5
  60. package/dist/plugins/MagicCommand/src/composables/private/useCommandView.mjs +193 -18
  61. package/dist/plugins/MagicCommand/src/composables/useMagicCommand.d.ts +14 -5
  62. package/dist/plugins/MagicCommand/src/composables/useMagicCommand.mjs +43 -13
  63. package/dist/plugins/MagicCommand/src/symbols/index.d.ts +9 -2
  64. package/dist/plugins/MagicCommand/src/symbols/index.mjs +18 -1
  65. package/dist/plugins/MagicCommand/src/types/index.d.ts +73 -13
  66. package/dist/plugins/MagicCommand/src/utils/defaultOptions.d.ts +3 -5
  67. package/dist/plugins/MagicCommand/src/utils/defaultOptions.mjs +8 -3
  68. package/dist/plugins/MagicCookie/index.d.ts +5 -3
  69. package/dist/plugins/MagicCookie/index.mjs +7 -3
  70. package/dist/plugins/MagicCookie/nuxt.mjs +5 -9
  71. package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue +56 -0
  72. package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +24 -0
  73. package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue +43 -0
  74. package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue.d.ts +20 -0
  75. package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue +96 -0
  76. package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +30 -0
  77. package/dist/plugins/MagicCookie/src/composables/private/useCookieCallback.d.ts +9 -0
  78. package/dist/plugins/MagicCookie/src/composables/private/useCookieCallback.mjs +31 -0
  79. package/dist/plugins/MagicCookie/src/composables/private/useCookieItem.d.ts +16 -0
  80. package/dist/plugins/MagicCookie/src/composables/private/useCookieItem.mjs +87 -0
  81. package/dist/plugins/MagicCookie/src/composables/private/useCookieState.d.ts +7 -0
  82. package/dist/plugins/MagicCookie/src/composables/private/useCookieState.mjs +43 -0
  83. package/dist/plugins/MagicCookie/src/composables/useMagicCookie.d.ts +15 -15
  84. package/dist/plugins/MagicCookie/src/composables/useMagicCookie.mjs +59 -60
  85. package/dist/plugins/MagicCookie/src/symbols/index.d.ts +5 -0
  86. package/dist/plugins/MagicCookie/src/symbols/index.mjs +4 -0
  87. package/dist/plugins/MagicCookie/src/types/index.d.ts +31 -13
  88. package/dist/plugins/MagicCookie/src/utils/defaultOptions.d.ts +4 -0
  89. package/dist/plugins/MagicCookie/src/utils/defaultOptions.mjs +10 -0
  90. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +136 -97
  91. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +95 -18
  92. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +8 -8
  93. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +12 -6
  94. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +34 -14
  95. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +9 -8
  96. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +46 -8
  97. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.d.ts +2 -1
  98. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.mjs +10 -10
  99. package/dist/plugins/MagicDraggable/src/types/index.d.ts +11 -6
  100. package/dist/plugins/MagicDraggable/src/utils/defaultOptions.d.ts +3 -8
  101. package/dist/plugins/MagicDraggable/src/utils/defaultOptions.mjs +6 -6
  102. package/dist/plugins/MagicDrawer/nuxt.mjs +1 -1
  103. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +501 -337
  104. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +166 -19
  105. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.d.ts +6 -6
  106. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.mjs +6 -6
  107. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +34 -14
  108. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.d.ts +9 -11
  109. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +29 -19
  110. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.d.ts +3 -4
  111. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.mjs +28 -10
  112. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.d.ts +4 -4
  113. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.mjs +4 -2
  114. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.d.ts +8 -9
  115. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +45 -26
  116. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.d.ts +1 -1
  117. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +8 -8
  118. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.d.ts +3 -3
  119. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.mjs +23 -19
  120. package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.mjs +4 -3
  121. package/dist/plugins/MagicDrawer/src/types/index.d.ts +10 -3
  122. package/dist/plugins/MagicDrawer/src/utils/defaultOptions.d.ts +3 -11
  123. package/dist/plugins/MagicDrawer/src/utils/defaultOptions.mjs +1 -3
  124. package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +190 -46
  125. package/dist/plugins/MagicEmitter/src/types/index.d.ts +1 -1
  126. package/dist/plugins/MagicMarquee/index.d.ts +4 -2
  127. package/dist/plugins/MagicMarquee/index.mjs +2 -1
  128. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +121 -50
  129. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +18 -25
  130. package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.d.ts +4 -8
  131. package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.mjs +57 -43
  132. package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeState.d.ts +7 -0
  133. package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeState.mjs +42 -0
  134. package/dist/plugins/MagicMarquee/src/composables/useMagicMarquee.d.ts +11 -0
  135. package/dist/plugins/MagicMarquee/src/composables/useMagicMarquee.mjs +45 -0
  136. package/dist/plugins/MagicMarquee/src/types/index.d.ts +9 -0
  137. package/dist/plugins/MagicMarquee/src/types/index.mjs +0 -0
  138. package/dist/plugins/MagicMarquee/src/utils/defaultOptions.d.ts +4 -0
  139. package/dist/plugins/MagicMarquee/src/utils/defaultOptions.mjs +5 -0
  140. package/dist/plugins/MagicMenu/index.d.ts +2 -0
  141. package/dist/plugins/MagicMenu/nuxt.mjs +1 -1
  142. package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +78 -69
  143. package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +17 -11
  144. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +245 -216
  145. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +42 -14
  146. package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +234 -212
  147. package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +42 -17
  148. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +115 -124
  149. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +28 -16
  150. package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +105 -96
  151. package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +14 -15
  152. package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +88 -87
  153. package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +19 -14
  154. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +121 -112
  155. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +27 -51
  156. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +67 -70
  157. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +15 -11
  158. package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.d.ts +6 -6
  159. package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.mjs +9 -9
  160. package/dist/plugins/MagicMenu/src/composables/private/useMenuChannel.mjs +44 -25
  161. package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.d.ts +3 -3
  162. package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.mjs +16 -10
  163. package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +35 -15
  164. package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.d.ts +1 -1
  165. package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.mjs +20 -14
  166. package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +20 -13
  167. package/dist/plugins/MagicMenu/src/composables/private/useMenuState.mjs +10 -10
  168. package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.d.ts +1 -1
  169. package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.mjs +6 -3
  170. package/dist/plugins/MagicMenu/src/composables/private/useMenuView.d.ts +3 -3
  171. package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +111 -75
  172. package/dist/plugins/MagicMenu/src/symbols/index.d.ts +4 -4
  173. package/dist/plugins/MagicMenu/src/types/index.d.ts +1 -2
  174. package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.d.ts +2 -2
  175. package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.mjs +2 -2
  176. package/dist/plugins/MagicModal/src/components/MagicModal.vue +266 -166
  177. package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +45 -17
  178. package/dist/plugins/MagicModal/src/composables/private/useModalCallback.d.ts +6 -6
  179. package/dist/plugins/MagicModal/src/composables/private/useModalCallback.mjs +6 -6
  180. package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +34 -14
  181. package/dist/plugins/MagicModal/src/composables/private/useModalStore.mjs +1 -1
  182. package/dist/plugins/MagicModal/src/types/index.d.ts +2 -2
  183. package/dist/plugins/MagicModal/src/utils/defaultOptions.mjs +2 -2
  184. package/dist/plugins/MagicNoise/index.d.ts +3 -1
  185. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +120 -63
  186. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +2 -4
  187. package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.d.ts +3 -3
  188. package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +4 -4
  189. package/dist/plugins/MagicPie/index.d.ts +7 -0
  190. package/dist/plugins/MagicPie/index.mjs +8 -0
  191. package/dist/plugins/MagicPie/nuxt.mjs +23 -0
  192. package/dist/plugins/MagicPie/src/components/MagicPie.vue +202 -0
  193. package/dist/plugins/MagicPie/src/components/MagicPie.vue.d.ts +7 -0
  194. package/dist/plugins/MagicPie/src/composables/private/usePieState.d.ts +6 -0
  195. package/dist/plugins/MagicPie/src/composables/private/usePieState.mjs +33 -0
  196. package/dist/plugins/MagicPie/src/composables/useMagicPie.d.ts +13 -0
  197. package/dist/plugins/MagicPie/src/composables/useMagicPie.mjs +43 -0
  198. package/dist/plugins/MagicPie/src/types/index.d.ts +9 -0
  199. package/dist/plugins/MagicPie/src/types/index.mjs +0 -0
  200. package/dist/plugins/MagicPlayer/index.d.ts +4 -9
  201. package/dist/plugins/MagicPlayer/index.mjs +11 -17
  202. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +84 -0
  203. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue.d.ts +2 -0
  204. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +128 -0
  205. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +34 -0
  206. package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +45 -41
  207. package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +2 -5
  208. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +127 -114
  209. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +4 -5
  210. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +111 -58
  211. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +30 -18
  212. package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +42 -23
  213. package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +14 -15
  214. package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +82 -0
  215. package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +34 -0
  216. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +111 -65
  217. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +1 -4
  218. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +93 -0
  219. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue.d.ts +2 -0
  220. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +221 -0
  221. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +73 -0
  222. package/dist/plugins/MagicPlayer/src/components/icons/FullscreenEnter.vue.d.ts +1 -1
  223. package/dist/plugins/MagicPlayer/src/components/icons/FullscreenExit.vue.d.ts +1 -1
  224. package/dist/plugins/MagicPlayer/src/components/icons/Pause.vue.d.ts +1 -1
  225. package/dist/plugins/MagicPlayer/src/components/icons/Play.vue.d.ts +1 -1
  226. package/dist/plugins/MagicPlayer/src/components/icons/VolumeOff.vue.d.ts +1 -1
  227. package/dist/plugins/MagicPlayer/src/components/icons/VolumeOn.vue.d.ts +1 -1
  228. package/dist/plugins/MagicPlayer/src/components/icons/Waiting.vue +23 -1
  229. package/dist/plugins/MagicPlayer/src/components/icons/Waiting.vue.d.ts +1 -1
  230. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.d.ts +2 -2
  231. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +8 -9
  232. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +10 -10
  233. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +33 -31
  234. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +13 -13
  235. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +31 -24
  236. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +5 -5
  237. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +7 -7
  238. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +6 -6
  239. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +10 -12
  240. package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +22 -26
  241. package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.mjs +5 -5
  242. package/dist/plugins/MagicPlayer/src/css/magic-player-audio-controls.css +95 -0
  243. package/dist/plugins/MagicPlayer/src/css/magic-player-display-time.css +10 -0
  244. package/dist/plugins/MagicPlayer/src/css/magic-player-timeline.css +89 -0
  245. package/dist/plugins/MagicPlayer/src/css/magic-player-video-controls.css +115 -0
  246. package/dist/plugins/MagicPlayer/src/symbols/index.d.ts +5 -0
  247. package/dist/plugins/MagicPlayer/src/symbols/index.mjs +3 -0
  248. package/dist/plugins/MagicPlayer/src/types/index.d.ts +11 -1
  249. package/dist/plugins/MagicPlayer/src/utils/defaultOptions.d.ts +3 -0
  250. package/dist/plugins/MagicPlayer/src/utils/defaultOptions.mjs +12 -0
  251. package/dist/plugins/MagicScroll/index.d.ts +4 -10
  252. package/dist/plugins/MagicScroll/index.mjs +2 -11
  253. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +76 -31
  254. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +13 -17
  255. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +78 -64
  256. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +13 -20
  257. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +39 -39
  258. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +48 -34
  259. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +84 -73
  260. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +16 -21
  261. package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.d.ts +13 -0
  262. package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.mjs +130 -0
  263. package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.d.ts +3 -3
  264. package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +19 -7
  265. package/dist/plugins/MagicScroll/src/symbols/index.d.ts +2 -2
  266. package/dist/plugins/MagicScroll/src/symbols/index.mjs +2 -2
  267. package/dist/plugins/MagicScroll/src/types/index.d.ts +12 -22
  268. package/dist/plugins/MagicToast/index.d.ts +3 -2
  269. package/dist/plugins/MagicToast/index.mjs +3 -3
  270. package/dist/plugins/MagicToast/nuxt.mjs +2 -2
  271. package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +290 -0
  272. package/dist/plugins/MagicToast/src/components/{MagicToast.vue.d.ts → MagicToastProvider.vue.d.ts} +4 -4
  273. package/dist/plugins/MagicToast/src/components/MagicToastView.vue +152 -0
  274. package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +34 -0
  275. package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +8 -31
  276. package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +33 -28
  277. package/dist/plugins/MagicToast/src/composables/private/useToastDrag.d.ts +12 -0
  278. package/dist/plugins/MagicToast/src/composables/private/useToastDrag.mjs +312 -0
  279. package/dist/plugins/MagicToast/src/composables/private/useToastListener.d.ts +6 -0
  280. package/dist/plugins/MagicToast/src/composables/private/useToastListener.mjs +25 -0
  281. package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.d.ts +6 -0
  282. package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.mjs +59 -0
  283. package/dist/plugins/MagicToast/src/composables/private/useToastState.d.ts +7 -0
  284. package/dist/plugins/MagicToast/src/composables/private/useToastState.mjs +45 -0
  285. package/dist/plugins/MagicToast/src/composables/private/useToastView.d.ts +12 -0
  286. package/dist/plugins/MagicToast/src/composables/private/useToastView.mjs +51 -0
  287. package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +14 -8
  288. package/dist/plugins/MagicToast/src/composables/useMagicToast.mjs +34 -23
  289. package/dist/plugins/MagicToast/src/types/index.d.ts +58 -17
  290. package/dist/plugins/MagicToast/src/utils/defaultOptions.d.ts +2 -3
  291. package/dist/plugins/MagicToast/src/utils/defaultOptions.mjs +21 -4
  292. package/dist/plugins/MagicToast/symbols/index.d.ts +3 -0
  293. package/dist/plugins/MagicToast/symbols/index.mjs +2 -0
  294. package/dist/plugins/index.d.ts +1 -1
  295. package/dist/plugins/index.mjs +1 -1
  296. package/dist/utils/css/animations/auto-size-out.css +12 -0
  297. package/dist/utils/css/animations/squash-y.css +5 -0
  298. package/dist/utils/css/animations.css +2 -1
  299. package/dist/utils/index.d.ts +10 -6
  300. package/dist/utils/index.js +41 -56
  301. package/dist/utils/index.js.map +1 -1
  302. package/package.json +62 -58
  303. package/dist/composables/index.d.mts +0 -108
  304. package/dist/composables/index.mjs +0 -383
  305. package/dist/composables/index.mjs.map +0 -1
  306. package/dist/plugins/MagicAutoSize/index.d.ts +0 -4
  307. package/dist/plugins/MagicAutoSize/index.mjs +0 -7
  308. package/dist/plugins/MagicAutoSize/nuxt.mjs +0 -14
  309. package/dist/plugins/MagicAutoSize/src/components/MagicAutoSize.vue +0 -152
  310. package/dist/plugins/MagicAutoSize/src/components/MagicAutoSize.vue.d.ts +0 -29
  311. package/dist/plugins/MagicCommand/src/components/MagicCommandBody.vue +0 -91
  312. package/dist/plugins/MagicCommand/src/components/MagicCommandBody.vue.d.ts +0 -19
  313. package/dist/plugins/MagicCommand/src/components/MagicCommandFooter.vue +0 -5
  314. package/dist/plugins/MagicCommand/src/components/MagicCommandFooter.vue.d.ts +0 -17
  315. package/dist/plugins/MagicCommand/src/components/MagicCommandGroup.vue +0 -5
  316. package/dist/plugins/MagicCommand/src/components/MagicCommandGroup.vue.d.ts +0 -17
  317. package/dist/plugins/MagicCommand/src/components/MagicCommandHead.vue +0 -5
  318. package/dist/plugins/MagicCommand/src/components/MagicCommandHead.vue.d.ts +0 -17
  319. package/dist/plugins/MagicCommand/src/composables/private/useCommandStore.d.ts +0 -35
  320. package/dist/plugins/MagicCommand/src/composables/private/useCommandStore.mjs +0 -67
  321. package/dist/plugins/MagicCookie/src/components/MagicCookie.vue +0 -117
  322. package/dist/plugins/MagicCookie/src/components/MagicCookie.vue.d.ts +0 -27
  323. package/dist/plugins/MagicCookie/src/composables/private/useCookieApi.d.ts +0 -29
  324. package/dist/plugins/MagicCookie/src/composables/private/useCookieApi.mjs +0 -22
  325. package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue +0 -89
  326. package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue.d.ts +0 -28
  327. package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue +0 -95
  328. package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue.d.ts +0 -24
  329. package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue +0 -125
  330. package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue.d.ts +0 -35
  331. package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue +0 -152
  332. package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue.d.ts +0 -38
  333. package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue +0 -42
  334. package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue.d.ts +0 -36
  335. package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.d.ts +0 -56
  336. package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.mjs +0 -140
  337. package/dist/plugins/MagicToast/src/components/MagicToast.vue +0 -141
  338. package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue +0 -64
  339. package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue.d.ts +0 -30
  340. package/dist/plugins/MagicToast/src/composables/private/useToastApi.d.ts +0 -5
  341. package/dist/plugins/MagicToast/src/composables/private/useToastApi.mjs +0 -22
  342. package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.d.ts +0 -4
  343. package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.mjs +0 -28
  344. package/dist/plugins/MagicToast/src/composables/private/useToastStore.d.ts +0 -27
  345. package/dist/plugins/MagicToast/src/composables/private/useToastStore.mjs +0 -41
  346. package/dist/utils/index.d.mts +0 -80
  347. package/dist/utils/index.mjs +0 -200
  348. package/dist/utils/index.mjs.map +0 -1
  349. /package/dist/plugins/{MagicAutoSize → MagicPie}/nuxt.d.ts +0 -0
@@ -1,12 +1,11 @@
1
- import MagicCommandBody from "./src/components/MagicCommandBody.vue";
2
1
  import MagicCommandDrawer from "./src/components/MagicCommandDrawer.vue";
3
- import MagicCommandFooter from "./src/components/MagicCommandFooter.vue";
4
- import MagicCommandGroup from "./src/components/MagicCommandGroup.vue";
5
- import MagicCommandHead from "./src/components/MagicCommandHead.vue";
6
2
  import MagicCommandItem from "./src/components/MagicCommandItem.vue";
7
3
  import MagicCommandModal from "./src/components/MagicCommandModal.vue";
8
4
  import MagicCommandProvider from "./src/components/MagicCommandProvider.vue";
9
5
  import MagicCommandView from "./src/components/MagicCommandView.vue";
6
+ import MagicCommandRenderer from "./src/components/MagicCommandRenderer.vue";
7
+ import MagicCommandContent from "./src/components/MagicCommandContent.vue";
8
+ import MagicCommandTrigger from "./src/components/MagicCommandTrigger.vue";
10
9
  import { useMagicCommand } from "./src/composables/useMagicCommand.mjs";
11
10
  import {
12
11
  MagicCommandInstanceId,
@@ -14,15 +13,14 @@ import {
14
13
  } from "./src/symbols/index.mjs";
15
14
  const MagicCommandPlugin = {
16
15
  install: (app) => {
17
- app.component("MagicCommandBody", MagicCommandBody);
18
- app.component("MagicCommandDrawer", MagicCommandDrawer);
19
- app.component("MagicCommandFooter", MagicCommandFooter);
20
- app.component("MagicCommandGroup", MagicCommandGroup);
21
- app.component("MagicCommandHead", MagicCommandHead);
22
- app.component("MagicCommandItem", MagicCommandItem);
23
- app.component("MagicCommandModal", MagicCommandModal);
24
16
  app.component("MagicCommandProvider", MagicCommandProvider);
25
17
  app.component("MagicCommandView", MagicCommandView);
18
+ app.component("MagicCommandRenderer", MagicCommandRenderer);
19
+ app.component("MagicCommandContent", MagicCommandContent);
20
+ app.component("MagicCommandTrigger", MagicCommandTrigger);
21
+ app.component("MagicCommandItem", MagicCommandItem);
22
+ app.component("MagicCommandDrawer", MagicCommandDrawer);
23
+ app.component("MagicCommandModal", MagicCommandModal);
26
24
  }
27
25
  };
28
26
  export {
@@ -0,0 +1,199 @@
1
+ <script>
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { unref as _unref, renderSlot as _renderSlot, vShow as _vShow, mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives, createCommentVNode as _createCommentVNode, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, Teleport as _Teleport, createBlock as _createBlock } from "vue";
4
+ const _hoisted_1 = ["data-id", "data-idle"];
5
+ import {
6
+ ref,
7
+ inject,
8
+ watch,
9
+ nextTick,
10
+ provide,
11
+ computed,
12
+ useTemplateRef
13
+ } from "vue";
14
+ import { useMagicKeys } from "@vueuse/core";
15
+ import { useCommandItem } from "../composables/private/useCommandItem";
16
+ import { useCommandScroll } from "../composables/private/useCommandScroll";
17
+ import { useCommandCallback } from "../composables/private/useCommandCallback";
18
+ import {
19
+ MagicCommandInstanceId,
20
+ MagicCommandViewId,
21
+ MagicCommandContentId,
22
+ MagicCommandProviderOptions
23
+ } from "../symbols";
24
+ import { useCommandView } from "../composables/private/useCommandView";
25
+ import { useCommandState } from "../composables/private/useCommandState";
26
+ import "@maas/vue-equipment/utils/css/animations/fade-in.css";
27
+ import "@maas/vue-equipment/utils/css/animations/fade-out.css";
28
+ export default /* @__PURE__ */ _defineComponent({
29
+ ...{
30
+ inheritAttrs: false
31
+ },
32
+ __name: "MagicCommandContent",
33
+ setup(__props) {
34
+ const instanceId = inject(MagicCommandInstanceId, void 0);
35
+ const viewId = inject(MagicCommandViewId, void 0);
36
+ const elRef = useTemplateRef("el");
37
+ if (!instanceId) {
38
+ throw new Error(
39
+ "MagicCommandContent must be nested inside MagicCommandProvider"
40
+ );
41
+ }
42
+ if (!viewId) {
43
+ throw new Error("MagicCommandContent must be nested inside MagicCommandView");
44
+ }
45
+ const { getView } = useCommandView(instanceId);
46
+ const view = getView(viewId);
47
+ const { initializeState } = useCommandState(instanceId);
48
+ const state = initializeState();
49
+ const isActive = computed(() => view?.active && state.active && state.renderer);
50
+ const isIdle = computed(() => state.input.view !== viewId);
51
+ const options = inject(MagicCommandProviderOptions, void 0);
52
+ const { activeItem, selectNextItem, selectPrevItem } = useCommandItem({
53
+ instanceId,
54
+ viewId
55
+ });
56
+ const {
57
+ onBeforeEnter,
58
+ onEnter,
59
+ onAfterEnter,
60
+ onBeforeLeave,
61
+ onLeave,
62
+ onAfterLeave
63
+ } = useCommandCallback({
64
+ instanceId,
65
+ viewId
66
+ });
67
+ const {
68
+ findElement,
69
+ findScrollableAncestor,
70
+ isElementAbove,
71
+ isElementBelow,
72
+ scrollInFromBottom,
73
+ scrollInFromTop
74
+ } = useCommandScroll(elRef);
75
+ const keys = useMagicKeys();
76
+ const nextTimeout = ref(void 0);
77
+ const prevTimeout = ref(void 0);
78
+ const nextInterval = ref(void 0);
79
+ const prevInterval = ref(void 0);
80
+ if (options?.keyListener?.next) {
81
+ for (const key of options.keyListener.next) {
82
+ watch(keys[key], (value) => {
83
+ if (isIdle.value) {
84
+ return;
85
+ }
86
+ if (value) {
87
+ state.input.type = "keyboard";
88
+ selectNextItem(options.loop);
89
+ nextTimeout.value = setTimeout(() => {
90
+ nextInterval.value = setInterval(() => {
91
+ selectNextItem(options.loop);
92
+ }, 100);
93
+ }, 500);
94
+ } else {
95
+ clearTimeout(nextTimeout.value);
96
+ clearInterval(nextInterval.value);
97
+ }
98
+ });
99
+ }
100
+ }
101
+ if (options?.keyListener?.prev) {
102
+ for (const key of options.keyListener.prev) {
103
+ watch(keys[key], (value) => {
104
+ if (isIdle.value) {
105
+ return;
106
+ }
107
+ if (value) {
108
+ state.input.type = "keyboard";
109
+ selectPrevItem(options.loop);
110
+ prevTimeout.value = setTimeout(() => {
111
+ prevInterval.value = setInterval(() => {
112
+ selectPrevItem(options.loop);
113
+ }, 100);
114
+ }, 500);
115
+ } else {
116
+ clearTimeout(prevTimeout.value);
117
+ clearInterval(prevInterval.value);
118
+ }
119
+ });
120
+ }
121
+ }
122
+ watch(
123
+ activeItem,
124
+ async (value) => {
125
+ if (!value || isIdle.value || state.input.type !== "keyboard") {
126
+ return;
127
+ }
128
+ nextTick(() => {
129
+ const element = findElement(value.id);
130
+ if (element) {
131
+ const ancestor = findScrollableAncestor(element);
132
+ switch (true) {
133
+ case isElementAbove({ element, ancestor }):
134
+ scrollInFromTop({ element, ancestor });
135
+ break;
136
+ case isElementBelow({ element, ancestor }):
137
+ scrollInFromBottom({ element, ancestor });
138
+ break;
139
+ }
140
+ }
141
+ });
142
+ },
143
+ { deep: true }
144
+ );
145
+ provide(MagicCommandContentId, `${viewId}-content`);
146
+ return (_ctx, _cache) => {
147
+ return _unref(state).renderer && _unref(state).active ? (_openBlock(), _createBlock(_Teleport, {
148
+ key: 0,
149
+ to: _unref(state).renderer
150
+ }, [
151
+ _createVNode(_Transition, {
152
+ name: _unref(state).options.transition?.content,
153
+ "on-before-enter": _unref(onBeforeEnter),
154
+ "on-enter": _unref(onEnter),
155
+ "on-after-enter": _unref(onAfterEnter),
156
+ "on-before-leave": _unref(onBeforeLeave),
157
+ "on-leave": _unref(onLeave),
158
+ "on-after-leave": _unref(onAfterLeave)
159
+ }, {
160
+ default: _withCtx(() => [
161
+ isActive.value ? _withDirectives((_openBlock(), _createElementBlock("div", _mergeProps({
162
+ ref: "el",
163
+ key: `${_unref(viewId)}-content`,
164
+ class: "magic-command-content",
165
+ "data-id": `${_unref(viewId)}-content`,
166
+ "data-idle": isIdle.value
167
+ }, _ctx.$attrs), [
168
+ _renderSlot(_ctx.$slots, "default")
169
+ ], 16, _hoisted_1)), [
170
+ [_vShow, !isIdle.value]
171
+ ]) : _createCommentVNode("v-if", true)
172
+ ]),
173
+ _: 3
174
+ /* FORWARDED */
175
+ }, 8, ["name", "on-before-enter", "on-enter", "on-after-enter", "on-before-leave", "on-leave", "on-after-leave"])
176
+ ], 8, ["to"])) : _createCommentVNode("v-if", true);
177
+ };
178
+ }
179
+ });
180
+ </script>
181
+
182
+ <style>
183
+ .magic-command-content {
184
+ position: absolute;
185
+ inset: 0;
186
+ }
187
+
188
+ .magic-command-content[data-idle='true'] {
189
+ pointer-events: none;
190
+ }
191
+
192
+ .magic-command-content-enter-active {
193
+ animation: fade-in 150ms ease;
194
+ }
195
+
196
+ .magic-command-content-leave-active {
197
+ animation: fade-out 150ms ease;
198
+ }
199
+ </style>
@@ -0,0 +1,32 @@
1
+ import '@maas/vue-equipment/utils/css/animations/fade-in.css';
2
+ import '@maas/vue-equipment/utils/css/animations/fade-out.css';
3
+ declare const viewId: string | undefined;
4
+ declare const state: import("../types").CommandState;
5
+ declare const isActive: import("vue").ComputedRef<false | HTMLElement | null | undefined>;
6
+ declare const isIdle: import("vue").ComputedRef<boolean>;
7
+ declare const onBeforeEnter: () => void, onEnter: () => void, onAfterEnter: () => void, onBeforeLeave: () => void, onLeave: () => void, onAfterLeave: () => void;
8
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
9
+ declare var __VLS_9: {};
10
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
11
+ default?: (props: typeof __VLS_9) => any;
12
+ }>;
13
+ declare const __VLS_self: import("vue").DefineComponent<{}, {
14
+ viewId: typeof viewId;
15
+ state: typeof state;
16
+ isActive: typeof isActive;
17
+ isIdle: typeof isIdle;
18
+ onBeforeEnter: typeof onBeforeEnter;
19
+ onEnter: typeof onEnter;
20
+ onAfterEnter: typeof onAfterEnter;
21
+ onBeforeLeave: typeof onBeforeLeave;
22
+ onLeave: typeof onLeave;
23
+ onAfterLeave: typeof onAfterLeave;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
25
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -1,55 +1,62 @@
1
- <template>
2
- <magic-drawer
3
- :id="commandId"
4
- class="magic-command-drawer"
5
- :options="options"
6
- v-bind="$attrs"
7
- >
8
- <slot />
9
- </magic-drawer>
10
- </template>
11
-
12
- <script setup lang="ts">
13
- import { inject, watch, onBeforeUnmount } from 'vue'
14
- import { useMagicEmitter } from '@maas/vue-equipment/plugins'
15
- import { useMagicDrawer } from '../../../MagicDrawer/src/composables/useMagicDrawer'
16
- import { useMagicCommand } from '../composables/useMagicCommand'
17
- import { MagicCommandInstanceId } from './../symbols'
18
-
19
- import type { MagicCommandDrawerOptions } from '../types'
20
-
21
- defineOptions({
22
- inheritAttrs: false,
23
- })
24
-
25
- interface MagicCommandProps {
26
- options?: MagicCommandDrawerOptions
27
- }
28
-
29
- defineProps<MagicCommandProps>()
30
-
31
- const commandId = inject(MagicCommandInstanceId, '')
32
- const emitter = useMagicEmitter()
33
-
34
- function afterLeaveCallback() {
35
- close()
36
- }
37
-
38
- const { close, isActive } = useMagicCommand(commandId)
39
- const drawerApi = useMagicDrawer(commandId)
40
-
41
- watch(isActive, (value) => {
42
- if (value) {
43
- drawerApi.open()
44
- } else {
45
- drawerApi.close()
1
+ <script>
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { unref as _unref, renderSlot as _renderSlot, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
4
+ import { inject, watch, onBeforeUnmount } from "vue";
5
+ import {
6
+ useMagicDrawer,
7
+ useMagicEmitter
8
+ } from "@maas/vue-equipment/plugins";
9
+ import { useMagicCommand } from "../composables/useMagicCommand";
10
+ import { MagicCommandInstanceId } from "../symbols";
11
+ export default /* @__PURE__ */ _defineComponent({
12
+ ...{
13
+ inheritAttrs: false
14
+ },
15
+ __name: "MagicCommandDrawer",
16
+ props: {
17
+ options: { type: null, required: false }
18
+ },
19
+ setup(__props) {
20
+ const instanceId = inject(MagicCommandInstanceId, "");
21
+ const emitter = useMagicEmitter();
22
+ if (!instanceId) {
23
+ throw new Error(
24
+ "MagicCommandDrawer must be nested inside MagicCommandProvider"
25
+ );
26
+ }
27
+ function afterLeaveCallback(payload) {
28
+ if (typeof payload === "string" && payload === instanceId) {
29
+ close();
30
+ }
31
+ }
32
+ const { close, isActive } = useMagicCommand(instanceId);
33
+ const drawerApi = useMagicDrawer(instanceId);
34
+ watch(isActive, (value) => {
35
+ if (value) {
36
+ drawerApi.open();
37
+ } else {
38
+ drawerApi.close();
39
+ }
40
+ });
41
+ emitter.on("afterLeave", afterLeaveCallback);
42
+ onBeforeUnmount(() => {
43
+ emitter.off("afterLeave", afterLeaveCallback);
44
+ close();
45
+ });
46
+ return (_ctx, _cache) => {
47
+ const _component_magic_drawer = _resolveComponent("magic-drawer");
48
+ return _openBlock(), _createBlock(_component_magic_drawer, _mergeProps({
49
+ id: _unref(instanceId),
50
+ class: "magic-command-drawer",
51
+ options: _ctx.options
52
+ }, _ctx.$attrs), {
53
+ default: _withCtx(() => [
54
+ _renderSlot(_ctx.$slots, "default")
55
+ ]),
56
+ _: 3
57
+ /* FORWARDED */
58
+ }, 16, ["id", "options"]);
59
+ };
46
60
  }
47
- })
48
-
49
- emitter.on('afterLeave', afterLeaveCallback)
50
-
51
- onBeforeUnmount(() => {
52
- emitter.off('afterLeave', afterLeaveCallback)
53
- close()
54
- })
61
+ });
55
62
  </script>
@@ -1,20 +1,20 @@
1
- import type { MagicCommandDrawerOptions } from '../types';
2
- interface MagicCommandProps {
1
+ import type { MagicCommandDrawerOptions } from '../types/index.js';
2
+ interface MagicCommandDrawerProps {
3
3
  options?: MagicCommandDrawerOptions;
4
4
  }
5
- declare function __VLS_template(): {
6
- attrs: Partial<{}>;
7
- slots: {
8
- default?(_: {}): any;
9
- };
10
- refs: {};
11
- rootEl: any;
12
- };
13
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
- declare const __VLS_component: import("vue").DefineComponent<MagicCommandProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicCommandProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
5
+ declare const instanceId: import("vue").MaybeRef<string>;
6
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
7
+ declare var __VLS_6: {};
8
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
9
+ default?: (props: typeof __VLS_6) => any;
10
+ }>;
11
+ declare const __VLS_self: import("vue").DefineComponent<MagicCommandDrawerProps, {
12
+ instanceId: typeof instanceId;
13
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicCommandDrawerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const __VLS_component: import("vue").DefineComponent<MagicCommandDrawerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicCommandDrawerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
16
16
  export default _default;
17
- type __VLS_WithTemplateSlots<T, S> = T & {
17
+ type __VLS_WithSlots<T, S> = T & {
18
18
  new (): {
19
19
  $slots: S;
20
20
  };
@@ -1,91 +1,116 @@
1
- <template>
2
- <div
3
- class="magic-command-item"
4
- ref="elRef"
5
- :data-id="mappedId"
6
- :aria-selected="isActive"
7
- >
8
- <slot :is-active="isActive" />
9
- </div>
10
- </template>
11
-
12
- <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, createCommentVNode as _createCommentVNode } from "vue";
4
+ const _hoisted_1 = ["data-id", "data-disabled", "data-active", "data-pointer-disabled"];
5
+ const _hoisted_2 = {
6
+ key: 0,
7
+ class: "magic-command-item__pointer-guard"
8
+ };
13
9
  import {
14
- ref,
15
10
  computed,
16
11
  inject,
17
- toValue,
18
- nextTick,
19
- onMounted,
20
- onUnmounted,
12
+ provide,
13
+ onBeforeUnmount,
21
14
  useId,
22
- } from 'vue'
23
- import { useEventListener, onKeyStroke } from '@vueuse/core'
24
- import { useCommandStore } from '../composables/private/useCommandStore'
25
- import { useCommandItem } from '../composables/private/useCommandItem'
26
- import { MagicCommandInstanceId } from '../symbols'
27
-
28
- interface MagicCommandItemProps {
29
- id?: string
30
- default?: boolean
31
- callback: Function | false
32
- listener?: ('click' | 'mouseenter' | 'touchstart')[]
33
- keys?: string[]
34
- }
35
-
36
- const props = withDefaults(defineProps<MagicCommandItemProps>(), {
37
- listener: () => ['click'],
38
- keys: () => ['Enter'],
39
- })
40
- const elRef = ref<HTMLElement | undefined>(undefined)
41
-
42
- const commandId = inject(MagicCommandInstanceId, '')
43
- const { selectItem, activeItem } = useCommandItem(commandId)
44
-
45
- const mappedId = computed(() => {
46
- return props.id ?? useId() ?? ''
47
- })
48
-
49
- const isActive = computed(() => {
50
- return toValue(mappedId) === activeItem.value
51
- })
52
-
53
- function listenerCallback() {
54
- selectItem(mappedId.value)
55
- nextTick(() => {
56
- if (props.callback) {
57
- props.callback()
15
+ onMounted
16
+ } from "vue";
17
+ import { useCommandItem } from "../composables/private/useCommandItem";
18
+ import { useCommandState } from "../composables/private/useCommandState";
19
+ import {
20
+ MagicCommandInstanceId,
21
+ MagicCommandViewId,
22
+ MagicCommandContentId,
23
+ MagicCommandItemId,
24
+ MagicCommandItemActive,
25
+ MagicCommandItemDisabled
26
+ } from "../symbols";
27
+ export default /* @__PURE__ */ _defineComponent({
28
+ __name: "MagicCommandItem",
29
+ props: {
30
+ id: { type: String, required: false },
31
+ initial: { type: Boolean, required: false, default: false },
32
+ disabled: { type: Boolean, required: false, default: false }
33
+ },
34
+ emits: ["click"],
35
+ setup(__props, { emit: __emit }) {
36
+ const emit = __emit;
37
+ const instanceId = inject(MagicCommandInstanceId, void 0);
38
+ const viewId = inject(MagicCommandViewId, void 0);
39
+ const contentId = inject(MagicCommandContentId, void 0);
40
+ if (!instanceId) {
41
+ throw new Error("MagicCommandItem must be nested inside MagicCommandProvider");
58
42
  }
59
- })
60
- }
61
-
62
- useEventListener(elRef, props.listener, listenerCallback)
63
-
64
- if (props.keys.length) {
65
- onKeyStroke(props.keys, () => (isActive.value ? listenerCallback() : null))
66
- }
67
-
68
- const { addItem, removeItem } = useCommandStore()
69
-
70
- onMounted(() => {
71
- if (toValue(commandId)) {
72
- addItem(toValue(commandId), mappedId.value)
73
- }
74
-
75
- nextTick(() => {
76
- if (props.default) {
77
- selectItem(mappedId.value)
43
+ if (!viewId) {
44
+ throw new Error("MagicCommandItem must be nested inside MagicCommandView");
78
45
  }
79
- })
80
- })
81
-
82
- onUnmounted(() => {
83
- if (toValue(commandId)) {
84
- removeItem(toValue(commandId), mappedId.value)
46
+ if (!contentId) {
47
+ throw new Error("MagicCommandItem must be nested inside MagicCommandContent");
48
+ }
49
+ const mappedId = computed(() => __props.id ?? `magic-command-item-${useId()}`);
50
+ const { initializeItem, deleteItem, selectItem } = useCommandItem({
51
+ instanceId,
52
+ viewId
53
+ });
54
+ const { initializeState } = useCommandState(instanceId);
55
+ const state = initializeState();
56
+ const item = initializeItem({
57
+ id: mappedId.value,
58
+ disabled: __props.disabled ?? false
59
+ });
60
+ const pointerDisabled = computed(() => state.input.type !== "pointer");
61
+ const mappedDisabled = computed(() => __props.disabled ?? item?.disabled);
62
+ const mappedActive = computed(() => item?.active);
63
+ function guardedSelect() {
64
+ if (state.input.type === "pointer" && !item.disabled && !item.active) {
65
+ selectItem(mappedId.value);
66
+ }
67
+ }
68
+ function onClick(event) {
69
+ emit("click", event);
70
+ guardedSelect();
71
+ }
72
+ provide(MagicCommandItemId, mappedId.value);
73
+ provide(MagicCommandItemActive, mappedActive);
74
+ provide(MagicCommandItemDisabled, mappedDisabled);
75
+ onMounted(() => {
76
+ if (__props.initial) {
77
+ selectItem(mappedId.value);
78
+ }
79
+ });
80
+ onBeforeUnmount(() => {
81
+ deleteItem(mappedId.value);
82
+ });
83
+ return (_ctx, _cache) => {
84
+ return _openBlock(), _createElementBlock("div", {
85
+ class: "magic-command-item",
86
+ "data-id": mappedId.value,
87
+ "data-disabled": _ctx.disabled,
88
+ "data-active": _unref(item).active,
89
+ "data-pointer-disabled": pointerDisabled.value,
90
+ onMouseenter: guardedSelect,
91
+ onMousemove: guardedSelect,
92
+ onTouchstartPassive: guardedSelect,
93
+ onClick
94
+ }, [
95
+ _renderSlot(_ctx.$slots, "default", {
96
+ itemActive: _unref(item).active,
97
+ itemDisabled: _ctx.disabled
98
+ }),
99
+ pointerDisabled.value ? (_openBlock(), _createElementBlock("div", _hoisted_2)) : _createCommentVNode("v-if", true)
100
+ ], 40, _hoisted_1);
101
+ };
85
102
  }
86
- })
103
+ });
87
104
  </script>
88
105
 
89
106
  <style>
90
- .magic-command-item{cursor:pointer}
107
+ .magic-command-item {
108
+ position: relative;
109
+ cursor: var(--magic-command-item-cursor, default);
110
+ }
111
+
112
+ .magic-command-item__pointer-guard {
113
+ position: absolute;
114
+ inset: 0;
115
+ }
91
116
  </style>