@maas/vue-equipment 1.0.0-beta.2 → 1.0.0-beta.20

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 (217) hide show
  1. package/README.md +2 -2
  2. package/dist/composables/index.d.ts +5 -5
  3. package/dist/composables/index.js +23 -13
  4. package/dist/composables/index.js.map +1 -1
  5. package/dist/nuxt/module.d.mts +2 -1
  6. package/dist/nuxt/module.json +2 -2
  7. package/dist/nuxt/module.mjs +9 -2
  8. package/dist/nuxt/types.d.mts +3 -1
  9. package/dist/plugins/.turbo/turbo-lint.log +2 -10
  10. package/dist/plugins/MagicAccordion/nuxt.d.ts +1 -1
  11. package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue +59 -82
  12. package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +35 -22
  13. package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +17 -31
  14. package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue.d.ts +12 -21
  15. package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +57 -62
  16. package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +23 -59
  17. package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +34 -45
  18. package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +17 -22
  19. package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.d.ts +1 -1
  20. package/dist/plugins/MagicAccordion/src/composables/private/useAccordionTrigger.mjs +1 -0
  21. package/dist/plugins/MagicAccordion/src/composables/private/useAccordionView.mjs +1 -0
  22. package/dist/plugins/MagicAccordion/src/composables/useMagicAccordion.mjs +1 -0
  23. package/dist/plugins/MagicAccordion/src/symbols/index.d.ts +2 -2
  24. package/dist/plugins/MagicCommand/nuxt.d.ts +1 -1
  25. package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +146 -152
  26. package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +24 -13
  27. package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +42 -52
  28. package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +12 -21
  29. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +72 -87
  30. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +29 -28
  31. package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +37 -47
  32. package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +12 -21
  33. package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +61 -77
  34. package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +12 -58
  35. package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +23 -39
  36. package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +80 -86
  37. package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +25 -60
  38. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +36 -48
  39. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +15 -22
  40. package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.d.ts +2 -2
  41. package/dist/plugins/MagicCommand/src/composables/private/useCommandState.mjs +1 -1
  42. package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.d.ts +1 -1
  43. package/dist/plugins/MagicCommand/src/composables/private/useCommandTrigger.mjs +1 -0
  44. package/dist/plugins/MagicCommand/src/symbols/index.d.ts +4 -4
  45. package/dist/plugins/MagicCommand/src/types/index.d.ts +1 -1
  46. package/dist/plugins/MagicCookie/nuxt.d.ts +1 -1
  47. package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue +34 -41
  48. package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +13 -22
  49. package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue +19 -36
  50. package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue.d.ts +9 -21
  51. package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue +40 -72
  52. package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +21 -12
  53. package/dist/plugins/MagicCookie/src/composables/private/useCookieItem.mjs +0 -1
  54. package/dist/plugins/MagicCookie/src/symbols/index.d.ts +2 -2
  55. package/dist/plugins/MagicDraggable/nuxt.d.ts +1 -1
  56. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +81 -100
  57. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +94 -22
  58. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.d.ts +2 -2
  59. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +43 -63
  60. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableScrollLock.mjs +34 -14
  61. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +2 -15
  62. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +117 -64
  63. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.mjs +6 -5
  64. package/dist/plugins/MagicDraggable/src/types/index.d.ts +2 -1
  65. package/dist/plugins/MagicDraggable/src/utils/defaultOptions.mjs +1 -1
  66. package/dist/plugins/MagicDrawer/nuxt.d.ts +1 -1
  67. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +271 -308
  68. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +165 -23
  69. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +34 -14
  70. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.d.ts +2 -2
  71. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +3 -3
  72. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.d.ts +1 -1
  73. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.mjs +28 -10
  74. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.d.ts +2 -2
  75. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.d.ts +3 -3
  76. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.mjs +16 -14
  77. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.d.ts +1 -1
  78. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.mjs +1 -1
  79. package/dist/plugins/MagicDrawer/src/types/index.mjs +1 -0
  80. package/dist/plugins/MagicEmitter/nuxt.d.ts +1 -1
  81. package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +100 -100
  82. package/dist/plugins/MagicMarquee/nuxt.d.ts +1 -1
  83. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +38 -72
  84. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +14 -25
  85. package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.d.ts +1 -1
  86. package/dist/plugins/MagicMarquee/src/composables/private/useMarqueeApi.mjs +8 -2
  87. package/dist/plugins/MagicMarquee/src/composables/useMagicMarquee.d.ts +1 -1
  88. package/dist/plugins/MagicMenu/nuxt.d.ts +1 -1
  89. package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +51 -63
  90. package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +18 -21
  91. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +178 -214
  92. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +41 -24
  93. package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +171 -198
  94. package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +40 -25
  95. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +87 -113
  96. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +31 -28
  97. package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +82 -81
  98. package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +12 -58
  99. package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +63 -86
  100. package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +19 -23
  101. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +94 -97
  102. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +27 -60
  103. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +49 -61
  104. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +15 -22
  105. package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.mjs +1 -1
  106. package/dist/plugins/MagicMenu/src/composables/private/useMenuChannel.mjs +15 -5
  107. package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.d.ts +3 -3
  108. package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.mjs +4 -4
  109. package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +35 -15
  110. package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +1 -0
  111. package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.d.ts +1 -1
  112. package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.mjs +2 -0
  113. package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +18 -6
  114. package/dist/plugins/MagicMenu/src/composables/useMagicMenu.mjs +1 -0
  115. package/dist/plugins/MagicMenu/src/symbols/index.d.ts +4 -4
  116. package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.d.ts +2 -2
  117. package/dist/plugins/MagicMenu/src/utils/modeDelayDefaults.mjs +2 -2
  118. package/dist/plugins/MagicModal/nuxt.d.ts +1 -1
  119. package/dist/plugins/MagicModal/src/components/MagicModal.vue +133 -168
  120. package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +44 -21
  121. package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +34 -14
  122. package/dist/plugins/MagicModal/src/types/index.mjs +1 -0
  123. package/dist/plugins/MagicNoise/nuxt.d.ts +1 -1
  124. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +50 -81
  125. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +1 -10
  126. package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.d.ts +3 -3
  127. package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.mjs +2 -2
  128. package/dist/plugins/MagicPie/index.d.ts +7 -0
  129. package/dist/plugins/MagicPie/index.mjs +8 -0
  130. package/dist/plugins/MagicPie/nuxt.d.ts +2 -0
  131. package/dist/plugins/MagicPie/nuxt.mjs +23 -0
  132. package/dist/plugins/MagicPie/src/components/MagicPie.vue +168 -0
  133. package/dist/plugins/MagicPie/src/components/MagicPie.vue.d.ts +7 -0
  134. package/dist/plugins/MagicPie/src/composables/private/usePieState.d.ts +6 -0
  135. package/dist/plugins/MagicPie/src/composables/private/usePieState.mjs +33 -0
  136. package/dist/plugins/MagicPie/src/composables/useMagicPie.d.ts +13 -0
  137. package/dist/plugins/MagicPie/src/composables/useMagicPie.mjs +43 -0
  138. package/dist/plugins/MagicPie/src/types/index.d.ts +9 -0
  139. package/dist/plugins/MagicPie/src/types/index.mjs +0 -0
  140. package/dist/plugins/MagicPlayer/nuxt.d.ts +1 -1
  141. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +58 -63
  142. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +99 -127
  143. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue.d.ts +30 -26
  144. package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +32 -42
  145. package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +1 -10
  146. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +106 -105
  147. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +1 -10
  148. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +51 -76
  149. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +29 -14
  150. package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +18 -37
  151. package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue.d.ts +12 -11
  152. package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +41 -55
  153. package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue.d.ts +23 -23
  154. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +60 -109
  155. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +74 -71
  156. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +163 -209
  157. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue.d.ts +63 -33
  158. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.d.ts +0 -4
  159. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerAudioApi.mjs +6 -47
  160. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.d.ts +7 -34
  161. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerControlsApi.mjs +154 -235
  162. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.d.ts +3 -17
  163. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +17 -157
  164. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +2 -3
  165. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +7 -25
  166. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.d.ts +7 -0
  167. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerState.mjs +56 -0
  168. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.d.ts +3 -8
  169. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +7 -62
  170. package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +32 -51
  171. package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.mjs +49 -2
  172. package/dist/plugins/MagicPlayer/src/symbols/index.d.ts +5 -2
  173. package/dist/plugins/MagicPlayer/src/symbols/index.mjs +10 -1
  174. package/dist/plugins/MagicPlayer/src/types/index.d.ts +29 -0
  175. package/dist/plugins/MagicScroll/nuxt.d.ts +1 -1
  176. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +54 -61
  177. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +9 -23
  178. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +56 -71
  179. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +9 -23
  180. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +26 -33
  181. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +45 -37
  182. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +63 -71
  183. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +13 -24
  184. package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.d.ts +2 -2
  185. package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetection.mjs +16 -6
  186. package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.d.ts +2 -2
  187. package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.mjs +41 -26
  188. package/dist/plugins/MagicScroll/src/symbols/index.d.ts +1 -1
  189. package/dist/plugins/MagicToast/nuxt.d.ts +1 -1
  190. package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +94 -118
  191. package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue.d.ts +1 -10
  192. package/dist/plugins/MagicToast/src/components/MagicToastView.vue +54 -81
  193. package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +24 -23
  194. package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +2 -2
  195. package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +5 -5
  196. package/dist/plugins/MagicToast/src/composables/private/useToastDrag.mjs +22 -22
  197. package/dist/plugins/MagicToast/src/composables/private/useToastListener.mjs +1 -0
  198. package/dist/plugins/MagicToast/src/composables/private/useToastScrollLock.mjs +33 -15
  199. package/dist/plugins/MagicToast/src/composables/private/useToastView.mjs +1 -0
  200. package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +1 -0
  201. package/dist/plugins/MagicToast/src/composables/useMagicToast.mjs +10 -2
  202. package/dist/plugins/MagicToast/src/types/index.d.ts +1 -1
  203. package/dist/plugins/MagicToast/src/utils/defaultOptions.mjs +1 -1
  204. package/dist/plugins/index.d.ts +1 -0
  205. package/dist/plugins/index.mjs +1 -0
  206. package/dist/utils/index.d.ts +9 -4
  207. package/dist/utils/index.js +39 -3
  208. package/dist/utils/index.js.map +1 -1
  209. package/package.json +17 -8
  210. package/dist/nuxt/module.cjs +0 -5
  211. package/dist/nuxt/module.d.ts +0 -9
  212. package/dist/nuxt/types.d.ts +0 -1
  213. package/dist/plugins/MagicAccordion/demo/data/footer.json +0 -117
  214. package/dist/plugins/MagicCommand/demo/data/about.json +0 -3
  215. package/dist/plugins/MagicCommand/demo/data/search.json +0 -594
  216. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.d.ts +0 -15
  217. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStateEmitter.mjs +0 -9
@@ -1,87 +1,56 @@
1
- <script>
2
- import { defineComponent as _defineComponent } from "vue";
3
- import { unref as _unref, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
- const _hoisted_1 = ["data-loading"];
5
- const _hoisted_2 = { class: "magic-noise__inner" };
6
- import { onMounted, onUnmounted, watch, shallowRef } from "vue";
1
+ <template>
2
+ <div class="magic-noise" :data-loading="!isReady">
3
+ <div class="magic-noise__inner">
4
+ <canvas ref="canvas" class="magic-noise__canvas" />
5
+ <canvas ref="offCanvas" class="magic-noise__off-canvas" />
6
+ </div>
7
+ </div>
8
+ </template>
9
+
10
+ <script setup>
11
+ import { onMounted, onUnmounted, watch, useTemplateRef } from "vue";
7
12
  import { useResizeObserver, useDebounceFn } from "@vueuse/core";
8
13
  import { useNoiseApi } from "../composables/private/useNoiseApi";
9
- export default /* @__PURE__ */ _defineComponent({
10
- __name: "MagicNoise",
11
- props: {
12
- options: { type: Object, required: false },
13
- pause: { type: Boolean, required: false, default: false }
14
- },
15
- setup(__props) {
16
- const canvasRef = shallowRef(void 0);
17
- const offCanvasRef = shallowRef(void 0);
18
- const noiseApi = useNoiseApi({
19
- canvasRef,
20
- offCanvasRef,
21
- options: __props.options
22
- });
23
- const {
24
- initialize,
25
- drawControls,
26
- transferControls,
27
- throttledDraw,
28
- throttledRotateAndTransfer,
29
- isReady
30
- } = noiseApi;
31
- useResizeObserver(canvasRef, useDebounceFn(initialize, 100));
32
- watch(
33
- () => __props.pause,
34
- (pause) => {
35
- if (pause) {
36
- drawControls.value?.pause();
37
- transferControls.value?.pause();
38
- } else {
39
- drawControls.value?.resume();
40
- transferControls.value?.resume();
41
- }
42
- }
43
- );
44
- onMounted(() => {
45
- throttledDraw();
46
- throttledRotateAndTransfer();
47
- });
48
- onUnmounted(() => {
49
- isReady.value = false;
50
- transferControls.value?.pause();
14
+ const { pause = false, options } = defineProps({
15
+ options: { type: Object, required: false },
16
+ pause: { type: Boolean, required: false }
17
+ });
18
+ const canvasRef = useTemplateRef("canvas");
19
+ const offCanvasRef = useTemplateRef("offCanvas");
20
+ const noiseApi = useNoiseApi({
21
+ canvasRef,
22
+ offCanvasRef,
23
+ options
24
+ });
25
+ const {
26
+ initialize,
27
+ drawControls,
28
+ transferControls,
29
+ throttledDraw,
30
+ throttledRotateAndTransfer,
31
+ isReady
32
+ } = noiseApi;
33
+ useResizeObserver(canvasRef, useDebounceFn(initialize, 100));
34
+ watch(
35
+ () => pause,
36
+ (pause2) => {
37
+ if (pause2) {
51
38
  drawControls.value?.pause();
52
- });
53
- return (_ctx, _cache) => {
54
- return _openBlock(), _createElementBlock("div", {
55
- class: "magic-noise",
56
- "data-loading": !_unref(isReady)
57
- }, [
58
- _createElementVNode("div", _hoisted_2, [
59
- _createElementVNode(
60
- "canvas",
61
- {
62
- ref_key: "canvasRef",
63
- ref: canvasRef,
64
- class: "magic-noise__canvas"
65
- },
66
- null,
67
- 512
68
- /* NEED_PATCH */
69
- ),
70
- _createElementVNode(
71
- "canvas",
72
- {
73
- ref_key: "offCanvasRef",
74
- ref: offCanvasRef,
75
- class: "magic-noise__off-canvas"
76
- },
77
- null,
78
- 512
79
- /* NEED_PATCH */
80
- )
81
- ])
82
- ], 8, _hoisted_1);
83
- };
39
+ transferControls.value?.pause();
40
+ } else {
41
+ drawControls.value?.resume();
42
+ transferControls.value?.resume();
43
+ }
84
44
  }
45
+ );
46
+ onMounted(() => {
47
+ throttledDraw();
48
+ throttledRotateAndTransfer();
49
+ });
50
+ onUnmounted(() => {
51
+ isReady.value = false;
52
+ transferControls.value?.pause();
53
+ drawControls.value?.pause();
85
54
  });
86
55
  </script>
87
56
 
@@ -94,7 +63,7 @@ export default /* @__PURE__ */ _defineComponent({
94
63
  position: relative;
95
64
  user-select: none;
96
65
  transition: var(--magic-noise-loading-transition);
97
- background: var(--magic-noise-background, transparent);
66
+ background: var(--magic-noise-background, #000);
98
67
  &[data-loading='true'] {
99
68
  background: var(--magic-noise-loading-background, #000);
100
69
  & > .magic-noise__inner {
@@ -3,14 +3,5 @@ interface MagicNoiseProps {
3
3
  options?: MagicNoiseOptions;
4
4
  pause?: boolean;
5
5
  }
6
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicNoiseProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicNoiseProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const _default: import("vue").DefineComponent<MagicNoiseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicNoiseProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
7
  export default _default;
8
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
9
- type __VLS_TypePropsToOption<T> = {
10
- [K in keyof T]-?: {} extends Pick<T, K> ? {
11
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
12
- } : {
13
- type: import('vue').PropType<T[K]>;
14
- required: true;
15
- };
16
- };
@@ -1,8 +1,8 @@
1
1
  import { type Ref, type MaybeRef } from 'vue';
2
2
  import type { MagicNoiseOptions, RafControls } from '../../types/index.js';
3
3
  type UseNoiseApiArgs = {
4
- canvasRef: Ref<HTMLCanvasElement | undefined>;
5
- offCanvasRef: Ref<HTMLCanvasElement | undefined>;
4
+ canvasRef: Ref<HTMLCanvasElement | null>;
5
+ offCanvasRef: Ref<HTMLCanvasElement | null>;
6
6
  options?: MaybeRef<MagicNoiseOptions>;
7
7
  };
8
8
  export declare function useNoiseApi({ canvasRef, offCanvasRef, options, }: UseNoiseApiArgs): {
@@ -11,7 +11,7 @@ export declare function useNoiseApi({ canvasRef, offCanvasRef, options, }: UseNo
11
11
  rotateAndTransfer: () => void;
12
12
  throttledDraw: () => void;
13
13
  throttledRotateAndTransfer: () => void;
14
- isReady: Ref<boolean, boolean>;
14
+ isReady: import("vue").ShallowRef<boolean, boolean>;
15
15
  drawControls: import("vue").ShallowRef<RafControls | undefined, RafControls | undefined>;
16
16
  transferControls: import("vue").ShallowRef<RafControls | undefined, RafControls | undefined>;
17
17
  };
@@ -1,4 +1,4 @@
1
- import { shallowRef, ref, reactive } from "vue";
1
+ import { shallowRef, reactive } from "vue";
2
2
  import { defu } from "defu";
3
3
  import {
4
4
  useElementSize,
@@ -14,7 +14,7 @@ export function useNoiseApi({
14
14
  }) {
15
15
  const tiles = shallowRef([]);
16
16
  const pixels = shallowRef([]);
17
- const isReady = ref(false);
17
+ const isReady = shallowRef(false);
18
18
  const context = shallowRef(null);
19
19
  const offContext = shallowRef(null);
20
20
  const { width, height } = useElementSize(canvasRef);
@@ -0,0 +1,7 @@
1
+ import MagicPie from './src/components/MagicPie.vue.js';
2
+ import { useMagicPie } from './src/composables/useMagicPie.js';
3
+ import type { Plugin } from 'vue';
4
+ import type { MagicPieOptions } from './src/types/index.js';
5
+ declare const MagicPiePlugin: Plugin;
6
+ export { MagicPiePlugin, MagicPie, useMagicPie };
7
+ export type { MagicPieOptions };
@@ -0,0 +1,8 @@
1
+ import MagicPie from "./src/components/MagicPie.vue";
2
+ import { useMagicPie } from "./src/composables/useMagicPie.mjs";
3
+ const MagicPiePlugin = {
4
+ install: (app) => {
5
+ app.component("MagicPie", MagicPie);
6
+ }
7
+ };
8
+ export { MagicPiePlugin, MagicPie, useMagicPie };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("nuxt/schema").NuxtModule<import("nuxt/schema").ModuleOptions, import("nuxt/schema").ModuleOptions, false>;
2
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import {
2
+ defineNuxtModule,
3
+ createResolver,
4
+ addComponent,
5
+ addImports
6
+ } from "@nuxt/kit";
7
+ export default defineNuxtModule({
8
+ meta: {
9
+ name: "@maas/vue-equipment/nuxt/MagicPie"
10
+ },
11
+ setup() {
12
+ const resolver = createResolver(import.meta.url);
13
+ addComponent({
14
+ filePath: resolver.resolve("src/components/MagicPie.vue"),
15
+ name: "MagicPie",
16
+ global: true
17
+ });
18
+ addImports({
19
+ from: "@maas/vue-equipment/plugins/MagicPie",
20
+ name: "useMagicPie"
21
+ });
22
+ }
23
+ });
@@ -0,0 +1,168 @@
1
+ <template>
2
+ <div class="magic-pie" :data-flip="options?.flip" :data-id="id">
3
+ <svg
4
+ id="magic-pie__svg"
5
+ viewBox="0 0 100 100"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ >
8
+ <mask id="magic-pie__mask">
9
+ <circle cx="50" cy="50" r="50" fill="white" />
10
+ </mask>
11
+ <g mask="url(#magic-pie__mask)">
12
+ <rect width="100" height="100" />
13
+ <path :d="path" />
14
+ </g>
15
+ </svg>
16
+ </div>
17
+ </template>
18
+
19
+ <script setup>
20
+ import { computed, toRefs, onBeforeUnmount } from "vue";
21
+ import { usePieState } from "../composables/private/usePieState";
22
+ const { id, options } = defineProps({
23
+ id: { type: String, required: true },
24
+ options: { type: Object, required: false }
25
+ });
26
+ const { initializeState, deleteState } = usePieState(id);
27
+ const state = initializeState();
28
+ const { percentage } = toRefs(state);
29
+ function generatePath(points) {
30
+ if (points.length < 2) {
31
+ throw new Error("At least two points are required to generate a path.");
32
+ }
33
+ let path2 = `M ${points[0][0]} ${points[0][1]}`;
34
+ for (let i = 1; i < points.length; i++) {
35
+ path2 += ` L ${points[i][0]} ${points[i][1]}`;
36
+ }
37
+ return path2;
38
+ }
39
+ function generatePie(percentage2, flip) {
40
+ if (percentage2 < 0 || percentage2 > 100) {
41
+ throw new Error("percentage needs to be between 0 and 100");
42
+ }
43
+ const size = 100;
44
+ const points = [
45
+ [size / 2, size / 2],
46
+ [size / 2, 0]
47
+ ];
48
+ function getEndpoint(percentage3, size2) {
49
+ const circumference = size2 * 4;
50
+ const distance = percentage3 / 100 * circumference;
51
+ if (distance === 0) {
52
+ return [size2 / 2, 0];
53
+ }
54
+ const position = Math.floor(distance / (size2 / 2)) % 8;
55
+ const remainingDistance = distance % (size2 / 2);
56
+ let x = 0;
57
+ let y = 0;
58
+ switch (position) {
59
+ case 0:
60
+ x = size2 / 2 + remainingDistance;
61
+ y = 0;
62
+ break;
63
+ case 1:
64
+ x = size2;
65
+ y = remainingDistance;
66
+ break;
67
+ case 2:
68
+ x = size2;
69
+ y = size2 / 2 + remainingDistance;
70
+ break;
71
+ case 3:
72
+ x = size2 - remainingDistance;
73
+ y = size2;
74
+ break;
75
+ case 4:
76
+ x = size2 / 2 - remainingDistance;
77
+ y = size2;
78
+ break;
79
+ case 5:
80
+ x = 0;
81
+ y = size2 - remainingDistance;
82
+ break;
83
+ case 6:
84
+ x = 0;
85
+ y = size2 / 2 - remainingDistance;
86
+ break;
87
+ case 7:
88
+ x = remainingDistance;
89
+ y = 0;
90
+ }
91
+ return [x, y];
92
+ }
93
+ if (flip) {
94
+ if (100 - percentage2 >= 12.5) {
95
+ points.push([0, 0]);
96
+ }
97
+ if (100 - percentage2 >= 25) {
98
+ points.push([0, size / 2]);
99
+ }
100
+ if (100 - percentage2 >= 37.5) {
101
+ points.push([0, size]);
102
+ }
103
+ if (100 - percentage2 >= 50) {
104
+ points.push([size / 2, size]);
105
+ }
106
+ if (100 - percentage2 >= 62.5) {
107
+ points.push([size, size]);
108
+ }
109
+ if (100 - percentage2 >= 75) {
110
+ points.push([size, size / 2]);
111
+ }
112
+ if (100 - percentage2 >= 87.5) {
113
+ points.push([size, 0]);
114
+ }
115
+ } else {
116
+ if (percentage2 >= 12.5) {
117
+ points.push([size, 0]);
118
+ }
119
+ if (percentage2 >= 25) {
120
+ points.push([size, size / 2]);
121
+ }
122
+ if (percentage2 >= 37.5) {
123
+ points.push([size, size]);
124
+ }
125
+ if (percentage2 >= 50) {
126
+ points.push([size / 2, size]);
127
+ }
128
+ if (percentage2 >= 62.5) {
129
+ points.push([0, size]);
130
+ }
131
+ if (percentage2 >= 75) {
132
+ points.push([0, size / 2]);
133
+ }
134
+ if (percentage2 >= 87.5) {
135
+ points.push([0, 0]);
136
+ }
137
+ }
138
+ points.push(getEndpoint(percentage2, size));
139
+ return generatePath(points);
140
+ }
141
+ const path = computed(() => {
142
+ return generatePie(percentage.value, options?.flip);
143
+ });
144
+ onBeforeUnmount(() => {
145
+ deleteState();
146
+ });
147
+ </script>
148
+
149
+ <style>
150
+ .magic-pie {
151
+ position: relative;
152
+
153
+ & path {
154
+ fill: var(--magic-pie-foreground, currentColor);
155
+ }
156
+
157
+ & rect {
158
+ fill: var(--magic-pie-background, transparent);
159
+ }
160
+ }
161
+
162
+ #magic-pie__svg {
163
+ width: 100%;
164
+ height: 100%;
165
+ margin-left: auto;
166
+ margin-right: auto;
167
+ }
168
+ </style>
@@ -0,0 +1,7 @@
1
+ import type { MagicPieOptions } from '../types/index.js';
2
+ interface MagicPieProps {
3
+ id: string;
4
+ options?: MagicPieOptions;
5
+ }
6
+ declare const _default: import("vue").DefineComponent<MagicPieProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MagicPieProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { type MaybeRef } from 'vue';
2
+ import type { PieState } from '../../types/index.js';
3
+ export declare function usePieState(id: MaybeRef<string>): {
4
+ initializeState: () => PieState;
5
+ deleteState: () => void;
6
+ };
@@ -0,0 +1,33 @@
1
+ import { ref, reactive, toValue } from "vue";
2
+ const pieStateStore = ref([]);
3
+ export function usePieState(id) {
4
+ function createState(id2) {
5
+ const state = {
6
+ id: id2,
7
+ percentage: 0,
8
+ interpolationId: void 0
9
+ };
10
+ return reactive(state);
11
+ }
12
+ function addState(id2) {
13
+ const state = createState(id2);
14
+ pieStateStore.value = [...pieStateStore.value, state];
15
+ return state;
16
+ }
17
+ function initializeState() {
18
+ let state = pieStateStore.value.find((entry) => {
19
+ return entry.id === id;
20
+ });
21
+ if (!state) state = addState(toValue(id));
22
+ return state;
23
+ }
24
+ function deleteState() {
25
+ pieStateStore.value = pieStateStore.value.filter(
26
+ (x) => x.id !== id
27
+ );
28
+ }
29
+ return {
30
+ initializeState,
31
+ deleteState
32
+ };
33
+ }
@@ -0,0 +1,13 @@
1
+ import { type MaybeRef } from 'vue';
2
+ interface InterpolatePercentageArgs {
3
+ value: number;
4
+ duration: number;
5
+ easing?: (t: number) => number;
6
+ }
7
+ export declare function useMagicPie(id: MaybeRef<string>): {
8
+ percentage: import("vue").Ref<number, number>;
9
+ setPercentage: (value: number) => void;
10
+ interpolatePercentage: (args: InterpolatePercentageArgs) => void;
11
+ cancelInterpolatePercentage: () => void;
12
+ };
13
+ export {};
@@ -0,0 +1,43 @@
1
+ import { toValue, toRefs } from "vue";
2
+ import { interpolate, linear } from "@maas/vue-equipment/utils";
3
+ import { usePieState } from "./private/usePieState.mjs";
4
+ export function useMagicPie(id) {
5
+ const { initializeState } = usePieState(toValue(id));
6
+ const state = initializeState();
7
+ const { percentage, interpolationId } = toRefs(state);
8
+ function setPercentage(value) {
9
+ percentage.value = Math.min(Math.max(0, value), 100);
10
+ }
11
+ function interpolatePercentage(args) {
12
+ const { value, duration = 1e3, easing = linear } = args;
13
+ const mappedValue = Math.min(Math.max(0, value), 100);
14
+ if (interpolationId.value) {
15
+ cancelAnimationFrame(interpolationId.value);
16
+ }
17
+ const mappedDuration = duration - duration * percentage.value / 100;
18
+ interpolationId.value = interpolate({
19
+ from: percentage.value,
20
+ to: mappedValue,
21
+ duration: mappedDuration,
22
+ easing,
23
+ callback: (value2) => {
24
+ percentage.value = value2;
25
+ },
26
+ interpolationIdCallback: (id2) => {
27
+ interpolationId.value = id2;
28
+ }
29
+ });
30
+ }
31
+ function cancelInterpolatePercentage() {
32
+ if (interpolationId.value) {
33
+ cancelAnimationFrame(interpolationId.value);
34
+ interpolationId.value = void 0;
35
+ }
36
+ }
37
+ return {
38
+ percentage,
39
+ setPercentage,
40
+ interpolatePercentage,
41
+ cancelInterpolatePercentage
42
+ };
43
+ }
@@ -0,0 +1,9 @@
1
+ export interface MagicPieOptions {
2
+ flip?: boolean;
3
+ }
4
+ export interface PieState {
5
+ id: string;
6
+ percentage: number;
7
+ interpolationId: number | undefined;
8
+ }
9
+ export type PiePoint = [number, number];
File without changes
@@ -1,2 +1,2 @@
1
- declare const _default: import("@nuxt/schema").NuxtModule<import("@nuxt/schema").ModuleOptions, import("@nuxt/schema").ModuleOptions, false>;
1
+ declare const _default: import("nuxt/schema").NuxtModule<import("nuxt/schema").ModuleOptions, import("nuxt/schema").ModuleOptions, false>;
2
2
  export default _default;
@@ -1,73 +1,68 @@
1
- <script>
2
- import { defineComponent as _defineComponent } from "vue";
3
- import { openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
- import { ref, inject, onMounted, onBeforeUnmount } from "vue";
1
+ <template>
2
+ <audio ref="el" class="magic-player-audio" />
3
+ </template>
4
+
5
+ <script setup>
6
+ import {
7
+ toRefs,
8
+ useTemplateRef,
9
+ shallowRef,
10
+ inject,
11
+ onMounted,
12
+ onBeforeUnmount
13
+ } from "vue";
5
14
  import { useIntersectionObserver } from "@vueuse/core";
6
15
  import { usePlayerAudioApi } from "../composables/private/usePlayerAudioApi";
7
16
  import { usePlayerMediaApi } from "../composables/private/usePlayerMediaApi";
8
17
  import { usePlayerRuntime } from "../composables/private/usePlayerRuntime";
18
+ import { usePlayerState } from "../composables/private/usePlayerState";
9
19
  import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
10
- export default /* @__PURE__ */ _defineComponent({
11
- __name: "MagicPlayerAudio",
12
- setup(__props) {
13
- const injectedId = inject(MagicPlayerInstanceId, void 0);
14
- const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
15
- if (!injectedId) {
16
- throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
17
- }
18
- if (!injectedOptions) {
19
- throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
20
+ const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
21
+ const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
22
+ if (!injectedInstanceId) {
23
+ throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
24
+ }
25
+ if (!injectedOptions) {
26
+ throw new Error("MagicPlayerVideo must be used within a MagicPlayerProvider");
27
+ }
28
+ const elRef = useTemplateRef("el");
29
+ const pausedByIntersection = shallowRef(false);
30
+ const { initialize, destroy } = usePlayerRuntime({
31
+ id: injectedInstanceId,
32
+ mediaRef: elRef,
33
+ src: injectedOptions.src,
34
+ srcType: injectedOptions.srcType
35
+ });
36
+ usePlayerMediaApi({
37
+ id: injectedInstanceId,
38
+ mediaRef: elRef
39
+ });
40
+ const { play, pause } = usePlayerAudioApi({
41
+ id: injectedInstanceId
42
+ });
43
+ const { initializeState } = usePlayerState(injectedInstanceId);
44
+ const state = initializeState();
45
+ const { playing } = toRefs(state);
46
+ useIntersectionObserver(
47
+ elRef,
48
+ ([{ isIntersecting }]) => {
49
+ if (!isIntersecting && playing.value) {
50
+ pause();
51
+ pausedByIntersection.value = true;
52
+ } else if (isIntersecting && !playing.value && pausedByIntersection.value) {
53
+ pausedByIntersection.value = false;
54
+ play();
20
55
  }
21
- const elRef = ref(void 0);
22
- const pausedByIntersection = ref(false);
23
- const { initialize, destroy } = usePlayerRuntime({
24
- id: injectedId,
25
- mediaRef: elRef,
26
- src: injectedOptions.src,
27
- srcType: injectedOptions.srcType
28
- });
29
- const { playing } = usePlayerMediaApi({
30
- id: injectedId,
31
- mediaRef: elRef
32
- });
33
- const { play, pause } = usePlayerAudioApi({
34
- id: injectedId
35
- });
36
- useIntersectionObserver(
37
- elRef,
38
- ([{ isIntersecting }]) => {
39
- if (!isIntersecting && playing.value) {
40
- pause();
41
- pausedByIntersection.value = true;
42
- } else if (isIntersecting && !playing.value && pausedByIntersection.value) {
43
- pausedByIntersection.value = false;
44
- play();
45
- }
46
- },
47
- {
48
- immediate: true
49
- }
50
- );
51
- onMounted(() => {
52
- initialize();
53
- });
54
- onBeforeUnmount(() => {
55
- destroy();
56
- });
57
- return (_ctx, _cache) => {
58
- return _openBlock(), _createElementBlock(
59
- "audio",
60
- {
61
- ref_key: "elRef",
62
- ref: elRef,
63
- class: "magic-player-audio"
64
- },
65
- null,
66
- 512
67
- /* NEED_PATCH */
68
- );
69
- };
56
+ },
57
+ {
58
+ immediate: true
70
59
  }
60
+ );
61
+ onMounted(() => {
62
+ initialize();
63
+ });
64
+ onBeforeUnmount(() => {
65
+ destroy();
71
66
  });
72
67
  </script>
73
68