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