@maas/vue-equipment 0.29.2 → 0.29.4

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 (171) hide show
  1. package/dist/composables/index.js +5 -10
  2. package/dist/composables/index.js.map +1 -1
  3. package/dist/composables/index.mjs +5 -10
  4. package/dist/composables/index.mjs.map +1 -1
  5. package/dist/nuxt/module.json +5 -1
  6. package/dist/nuxt/module.mjs +16 -9
  7. package/dist/nuxt/types.d.mts +1 -16
  8. package/dist/nuxt/types.d.ts +1 -16
  9. package/dist/plugins/MagicCommand/index.d.ts +2 -4
  10. package/dist/plugins/MagicCommand/index.mjs +2 -2
  11. package/dist/plugins/MagicCommand/src/components/MagicCommandBody.vue +3 -3
  12. package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +7 -4
  13. package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +2 -4
  14. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +4 -4
  15. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +5 -5
  16. package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +9 -6
  17. package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +2 -4
  18. package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +4 -4
  19. package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +5 -5
  20. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +4 -2
  21. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +3 -3
  22. package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.mjs +1 -1
  23. package/dist/plugins/MagicCommand/src/composables/private/useCommandStore.mjs +1 -1
  24. package/dist/plugins/MagicCommand/src/symbols/index.d.ts +3 -3
  25. package/dist/plugins/MagicCommand/src/symbols/index.mjs +2 -2
  26. package/dist/plugins/MagicCommand/src/types/index.d.ts +5 -5
  27. package/dist/plugins/MagicCommand/src/utils/defaultOptions.d.ts +2 -2
  28. package/dist/plugins/MagicCookie/index.d.ts +0 -2
  29. package/dist/plugins/MagicCookie/src/components/MagicCookie.vue +6 -7
  30. package/dist/plugins/MagicCookie/src/components/MagicCookie.vue.d.ts +6 -6
  31. package/dist/plugins/MagicCookie/src/composables/private/useCookieApi.d.ts +17 -0
  32. package/dist/plugins/MagicCookie/src/composables/private/{defineCookieApi.mjs → useCookieApi.mjs} +4 -4
  33. package/dist/plugins/MagicCookie/src/composables/useMagicCookie.d.ts +5 -5
  34. package/dist/plugins/MagicCookie/src/composables/useMagicCookie.mjs +4 -4
  35. package/dist/plugins/MagicCookie/src/types/index.d.ts +6 -10
  36. package/dist/plugins/MagicDraggable/index.d.ts +2 -2
  37. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +10 -9
  38. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +6 -8
  39. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.d.ts +1 -2
  40. package/dist/plugins/MagicDraggable/src/types/index.d.ts +1 -1
  41. package/dist/plugins/MagicDraggable/src/utils/defaultOptions.d.ts +4 -4
  42. package/dist/plugins/MagicDrawer/index.d.ts +2 -2
  43. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +9 -8
  44. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +3 -5
  45. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.d.ts +2 -2
  46. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.d.ts +3 -3
  47. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +2 -2
  48. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +3 -1
  49. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.mjs +3 -1
  50. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +1 -3
  51. package/dist/plugins/MagicDrawer/src/types/index.d.ts +1 -1
  52. package/dist/plugins/MagicDrawer/src/utils/defaultOptions.d.ts +7 -7
  53. package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +494 -170
  54. package/dist/plugins/MagicEmitter/src/types/index.d.ts +9 -9
  55. package/dist/plugins/MagicMarquee/nuxt.mjs +1 -5
  56. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +3 -3
  57. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +3 -3
  58. package/dist/plugins/MagicMenu/index.d.ts +4 -0
  59. package/dist/plugins/MagicMenu/index.mjs +27 -0
  60. package/dist/plugins/MagicMenu/nuxt.d.ts +2 -0
  61. package/dist/plugins/MagicMenu/nuxt.mjs +14 -0
  62. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +144 -0
  63. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +26 -0
  64. package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +169 -0
  65. package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +24 -0
  66. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +137 -0
  67. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +29 -0
  68. package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +106 -0
  69. package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +24 -0
  70. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +122 -0
  71. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +26 -0
  72. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +53 -0
  73. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +21 -0
  74. package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.d.ts +18 -0
  75. package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.mjs +52 -0
  76. package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.d.ts +6 -0
  77. package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +42 -0
  78. package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.d.ts +15 -0
  79. package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.mjs +75 -0
  80. package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.d.ts +10 -0
  81. package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +178 -0
  82. package/dist/plugins/MagicMenu/src/composables/private/useMenuState.d.ts +7 -0
  83. package/dist/plugins/MagicMenu/src/composables/private/useMenuState.mjs +48 -0
  84. package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.d.ts +18 -0
  85. package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.mjs +262 -0
  86. package/dist/plugins/MagicMenu/src/composables/private/useMenuUtils.d.ts +3 -0
  87. package/dist/plugins/MagicMenu/src/composables/private/useMenuUtils.mjs +16 -0
  88. package/dist/plugins/MagicMenu/src/composables/private/useMenuView.d.ts +20 -0
  89. package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +116 -0
  90. package/dist/plugins/MagicMenu/src/symbols/index.d.ts +9 -0
  91. package/dist/plugins/MagicMenu/src/symbols/index.mjs +16 -0
  92. package/dist/plugins/MagicMenu/src/types/index.d.ts +72 -0
  93. package/dist/plugins/MagicMenu/src/types/index.mjs +0 -0
  94. package/dist/plugins/MagicMenu/src/utils/defaultOptions.d.ts +4 -0
  95. package/dist/plugins/MagicMenu/src/utils/defaultOptions.mjs +9 -0
  96. package/dist/plugins/MagicModal/index.d.ts +2 -2
  97. package/dist/plugins/MagicModal/src/components/MagicModal.vue +9 -6
  98. package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +5 -6
  99. package/dist/plugins/MagicModal/src/composables/private/useModalCallback.d.ts +2 -2
  100. package/dist/plugins/MagicModal/src/composables/private/useModalDOM.d.ts +3 -3
  101. package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +2 -2
  102. package/dist/plugins/MagicModal/src/types/index.d.ts +1 -1
  103. package/dist/plugins/MagicModal/src/utils/defaultOptions.d.ts +2 -2
  104. package/dist/plugins/MagicNoise/index.d.ts +1 -2
  105. package/dist/plugins/MagicNoise/index.mjs +1 -2
  106. package/dist/plugins/MagicNoise/nuxt.mjs +1 -5
  107. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +4 -4
  108. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +5 -5
  109. package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.d.ts +2 -2
  110. package/dist/plugins/MagicNoise/src/types/index.d.ts +1 -1
  111. package/dist/plugins/MagicNoise/src/utils/defaultOptions.d.ts +2 -2
  112. package/dist/plugins/MagicPlayer/index.d.ts +0 -1
  113. package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue +2 -2
  114. package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue.d.ts +3 -3
  115. package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue +2 -2
  116. package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue.d.ts +2 -2
  117. package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue +9 -30
  118. package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue.d.ts +10 -14
  119. package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue +79 -56
  120. package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue.d.ts +20 -2
  121. package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +2 -2
  122. package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +3 -3
  123. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +9 -7
  124. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +2 -2
  125. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +2 -2
  126. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +2 -2
  127. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +2 -3
  128. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +2 -2
  129. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +3 -0
  130. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +2 -2
  131. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +23 -4
  132. package/dist/plugins/MagicPlayer/src/types/index.d.ts +1 -1
  133. package/dist/plugins/MagicScroll/index.d.ts +3 -3
  134. package/dist/plugins/MagicScroll/index.mjs +1 -2
  135. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +11 -7
  136. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +2 -2
  137. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +2 -2
  138. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +3 -3
  139. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +2 -2
  140. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +3 -3
  141. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +2 -2
  142. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +3 -3
  143. package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue +2 -2
  144. package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue.d.ts +3 -3
  145. package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.d.ts +28 -0
  146. package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.mjs +144 -0
  147. package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.d.ts +0 -1
  148. package/dist/plugins/MagicScroll/src/types/index.d.ts +19 -25
  149. package/dist/plugins/MagicToast/index.d.ts +0 -2
  150. package/dist/plugins/MagicToast/src/components/MagicToast.vue +4 -4
  151. package/dist/plugins/MagicToast/src/components/MagicToast.vue.d.ts +2 -2
  152. package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue +4 -4
  153. package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue.d.ts +5 -5
  154. package/dist/plugins/MagicToast/src/composables/private/useToastApi.d.ts +1 -1
  155. package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +3 -3
  156. package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +5 -7
  157. package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.d.ts +2 -2
  158. package/dist/plugins/MagicToast/src/composables/private/useToastStore.d.ts +4 -14
  159. package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +6 -6
  160. package/dist/plugins/MagicToast/src/types/index.d.ts +20 -21
  161. package/dist/plugins/MagicToast/src/utils/defaultOptions.d.ts +2 -2
  162. package/dist/plugins/index.d.ts +1 -0
  163. package/dist/plugins/index.mjs +1 -0
  164. package/dist/utils/index.js +4 -8
  165. package/dist/utils/index.js.map +1 -1
  166. package/dist/utils/index.mjs +4 -8
  167. package/dist/utils/index.mjs.map +1 -1
  168. package/package.json +9 -4
  169. package/dist/plugins/MagicCookie/src/composables/private/defineCookieApi.d.ts +0 -12
  170. package/dist/plugins/MagicScroll/src/composables/useCollisionDetect.d.ts +0 -6
  171. package/dist/plugins/MagicScroll/src/composables/useCollisionDetect.mjs +0 -119
@@ -10,9 +10,9 @@ import { createDefu } from 'defu'
10
10
  import { useMagicKeys } from '@vueuse/core'
11
11
  import { defaultOptions } from '../utils/defaultOptions'
12
12
  import { useMagicCommand } from '../composables/useMagicCommand'
13
- import { MagicCommandInstanceId, MagicCommandOptions } from '../symbols'
13
+ import { MagicCommandInstanceId, MagicCommandProviderOptions } from '../symbols'
14
14
 
15
- import type { CommandOptions } from './../types/index'
15
+ import type { MagicCommandOptions } from './../types/index'
16
16
 
17
17
  // Prevent keys arrays from being merged with default
18
18
  const customDefu = createDefu((obj, key, value) => {
@@ -24,7 +24,7 @@ const customDefu = createDefu((obj, key, value) => {
24
24
 
25
25
  interface MagicCommandProps {
26
26
  id: MaybeRef<string>
27
- options?: CommandOptions
27
+ options?: MagicCommandOptions
28
28
  }
29
29
 
30
30
  const props = withDefaults(defineProps<MagicCommandProps>(), {
@@ -62,5 +62,5 @@ onBeforeUnmount(() => {
62
62
  })
63
63
 
64
64
  provide(MagicCommandInstanceId, props.id)
65
- provide(MagicCommandOptions, mappedOptions)
65
+ provide(MagicCommandProviderOptions, mappedOptions)
66
66
  </script>
@@ -1,15 +1,15 @@
1
1
  import { type MaybeRef } from 'vue';
2
- import type { CommandOptions } from './../types/index';
2
+ import type { MagicCommandOptions } from './../types/index';
3
3
  interface MagicCommandProps {
4
4
  id: MaybeRef<string>;
5
- options?: CommandOptions;
5
+ options?: MagicCommandOptions;
6
6
  }
7
7
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicCommandProps>, {
8
- options: () => CommandOptions;
8
+ options: () => MagicCommandOptions;
9
9
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicCommandProps>, {
10
- options: () => CommandOptions;
10
+ options: () => MagicCommandOptions;
11
11
  }>>>, {
12
- options: CommandOptions;
12
+ options: MagicCommandOptions;
13
13
  }, {}>, {
14
14
  default?(_: {}): any;
15
15
  }>;
@@ -20,12 +20,14 @@ import { useCommandStore } from '../composables/private/useCommandStore'
20
20
  import { useCommandView } from '../composables/private/useCommandView'
21
21
  import { MagicCommandInstanceId } from '../symbols'
22
22
 
23
- interface Props {
23
+ interface MagicCommandViewProps {
24
24
  id?: string
25
25
  default?: boolean
26
26
  }
27
27
 
28
- const props = withDefaults(defineProps<Props>(), { default: false })
28
+ const props = withDefaults(defineProps<MagicCommandViewProps>(), {
29
+ default: false,
30
+ })
29
31
  const commandId = inject(MagicCommandInstanceId, '')
30
32
  const elRef = ref<HTMLElement | undefined>(undefined)
31
33
 
@@ -1,10 +1,10 @@
1
- interface Props {
1
+ interface MagicCommandViewProps {
2
2
  id?: string;
3
3
  default?: boolean;
4
4
  }
5
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
5
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicCommandViewProps>, {
6
6
  default: boolean;
7
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
7
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicCommandViewProps>, {
8
8
  default: boolean;
9
9
  }>>>, {
10
10
  default: boolean;
@@ -25,7 +25,7 @@ export function useCommandScroll(parent) {
25
25
  return elementRect.bottom >= parentBottom;
26
26
  }
27
27
  function findElement(id) {
28
- return mappedParent.value.querySelector(`[data-item-id="${id}"]`);
28
+ return mappedParent.value.querySelector(`[data-id="${id}"]`);
29
29
  }
30
30
  function scrollInFromTop(element) {
31
31
  const elementRect = element.getBoundingClientRect();
@@ -18,7 +18,7 @@ export function useCommandStore() {
18
18
  function sortItems(id, parent) {
19
19
  const instance = findInstance(id);
20
20
  if (instance) {
21
- const itemElements = parent.querySelectorAll("[data-item-id]");
21
+ const itemElements = parent.querySelectorAll("[data-id]");
22
22
  itemElements.forEach((el, index) => {
23
23
  const itemId = el.dataset.itemId;
24
24
  const item = instance.items?.find((item2) => item2.id === itemId);
@@ -1,5 +1,5 @@
1
1
  import type { InjectionKey, MaybeRef } from 'vue';
2
- import type { CommandOptions } from '../types.js';
2
+ import type { MagicCommandOptions } from '../types.js';
3
3
  declare const MagicCommandInstanceId: InjectionKey<MaybeRef<string>>;
4
- declare const MagicCommandOptions: InjectionKey<CommandOptions>;
5
- export { MagicCommandInstanceId, MagicCommandOptions };
4
+ declare const MagicCommandProviderOptions: InjectionKey<MagicCommandOptions>;
5
+ export { MagicCommandInstanceId, MagicCommandProviderOptions };
@@ -1,3 +1,3 @@
1
1
  const MagicCommandInstanceId = Symbol();
2
- const MagicCommandOptions = Symbol();
3
- export { MagicCommandInstanceId, MagicCommandOptions };
2
+ const MagicCommandProviderOptions = Symbol();
3
+ export { MagicCommandInstanceId, MagicCommandProviderOptions };
@@ -1,6 +1,6 @@
1
- import type { ModalOptions } from '../../../MagicModal.js';
2
- import type { DrawerOptions } from '../../../MagicDrawer.js';
3
- export type CommandOptions = {
1
+ import type { MagicModalOptions } from '../../../MagicModal.js';
2
+ import type { MagicDrawerOptions } from '../../../MagicDrawer.js';
3
+ export type MagicCommandOptions = {
4
4
  keys?: {
5
5
  open?: string[] | false;
6
6
  close?: string[] | false;
@@ -17,7 +17,7 @@ export type CommandEvents = {
17
17
  leave: string;
18
18
  afterLeave: string;
19
19
  };
20
- export interface CommandModalOptions extends ModalOptions {
20
+ export interface MagicCommandModalOptions extends MagicModalOptions {
21
21
  }
22
- export interface CommandDrawerOptions extends DrawerOptions {
22
+ export interface MagicCommandDrawerOptions extends MagicDrawerOptions {
23
23
  }
@@ -1,5 +1,5 @@
1
- import type { CommandOptions } from '../types.js';
1
+ import type { MagicCommandOptions } from '../types.js';
2
2
  import type { RequireAllNested } from '@maas/vue-equipment/utils';
3
- declare const defaultOptions: RequireAllNested<CommandOptions>;
3
+ declare const defaultOptions: RequireAllNested<MagicCommandOptions>;
4
4
  type DefaultOptions = typeof defaultOptions;
5
5
  export { defaultOptions, type DefaultOptions };
@@ -1,7 +1,5 @@
1
1
  import type { Plugin } from 'vue';
2
2
  import MagicCookie from './src/components/MagicCookie.vue.js';
3
3
  import { useMagicCookie } from './src/composables/useMagicCookie.js';
4
- import type { CookieEvents } from './src/types/index.js';
5
4
  declare const MagicCookiePlugin: Plugin;
6
5
  export { MagicCookiePlugin, MagicCookie, useMagicCookie };
7
- export type { CookieEvents };
@@ -82,27 +82,26 @@
82
82
  </template>
83
83
 
84
84
  <script lang="ts" setup>
85
- import { defineCookieApi } from '../composables/private/defineCookieApi'
85
+ import { useCookieApi } from '../composables/private/useCookieApi'
86
86
  import { useMagicCookie } from '../composables/useMagicCookie'
87
- import type { CookieRecord } from '../types'
87
+ import type { MagicCookieRecord } from '../types'
88
88
 
89
89
  // Define the props and their default values
90
- type Props = {
91
- cookies: CookieRecord[]
90
+ type MagicCookieProps = {
91
+ cookies: MagicCookieRecord[]
92
92
  maxAge?: number
93
93
  }
94
94
 
95
- const props = withDefaults(defineProps<Props>(), {
95
+ const props = withDefaults(defineProps<MagicCookieProps>(), {
96
96
  maxAge: 60 * 60 * 24 * 30,
97
97
  })
98
98
 
99
99
  // Initialize the Cookie API
100
- defineCookieApi({
100
+ useCookieApi({
101
101
  cookies: props.cookies,
102
102
  maxAge: props.maxAge,
103
103
  })
104
104
 
105
- // Use the Cookie API
106
105
  const {
107
106
  preferencesVisible,
108
107
  selectedCookies,
@@ -1,16 +1,16 @@
1
- import type { CookieRecord } from '../types';
2
- type Props = {
3
- cookies: CookieRecord[];
1
+ import type { MagicCookieRecord } from '../types';
2
+ type MagicCookieProps = {
3
+ cookies: MagicCookieRecord[];
4
4
  maxAge?: number;
5
5
  };
6
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
6
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicCookieProps>, {
7
7
  maxAge: number;
8
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
8
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicCookieProps>, {
9
9
  maxAge: number;
10
10
  }>>>, {
11
11
  maxAge: number;
12
12
  }, {}>, Partial<Record<string, (_: {
13
- cookie: CookieRecord;
13
+ cookie: MagicCookieRecord;
14
14
  }) => any>> & {
15
15
  default?(_: {}): any;
16
16
  actions?(_: {}): any;
@@ -0,0 +1,17 @@
1
+ import type { MagicCookieRecord } from '../../types.js';
2
+ type UseCookieApiArgs = {
3
+ cookies: MagicCookieRecord[];
4
+ maxAge?: number;
5
+ };
6
+ export declare const cookieApiStore: import("vue").Ref<{
7
+ cookies: {
8
+ [x: string]: unknown;
9
+ key: string;
10
+ optional?: boolean | undefined;
11
+ title?: string | undefined;
12
+ text?: string | undefined;
13
+ }[];
14
+ maxAge: number | undefined;
15
+ }>;
16
+ export declare function useCookieApi({ cookies, maxAge }: UseCookieApiArgs): void;
17
+ export {};
@@ -1,14 +1,14 @@
1
1
  import { ref } from "vue";
2
2
  import { slugify } from "@maas/vue-equipment/utils";
3
- export const globalApiState = ref({
3
+ export const cookieApiStore = ref({
4
4
  cookies: [],
5
5
  maxAge: void 0
6
6
  });
7
- export function defineCookieApi({ cookies, maxAge }) {
7
+ export function useCookieApi({ cookies, maxAge }) {
8
8
  if (!Array.isArray(cookies)) {
9
9
  console.warn('Invalid configuration. "cookies" must be an array.');
10
10
  }
11
- globalApiState.value.cookies = cookies?.map((cookie) => {
11
+ cookieApiStore.value.cookies = cookies?.map((cookie) => {
12
12
  return {
13
13
  ...cookie,
14
14
  key: slugify(cookie.key, {
@@ -18,5 +18,5 @@ export function defineCookieApi({ cookies, maxAge }) {
18
18
  })
19
19
  };
20
20
  });
21
- globalApiState.value.maxAge = maxAge;
21
+ cookieApiStore.value.maxAge = maxAge;
22
22
  }
@@ -1,16 +1,16 @@
1
- import type { CookieConsent } from '../types.js';
1
+ import type { MagicCookieConsent } from '../types.js';
2
2
  export declare function useMagicCookie(): {
3
3
  preferencesVisible: import("vue").Ref<boolean>;
4
4
  selectedCookies: import("vue").Ref<{
5
5
  [key: string]: boolean;
6
6
  }>;
7
- cookieConsent: import("vue").WritableComputedRef<CookieConsent>;
7
+ cookieConsent: import("vue").WritableComputedRef<MagicCookieConsent>;
8
8
  toggleSelection: (key: string) => void;
9
9
  accept: () => void;
10
10
  acceptSelected: () => void;
11
11
  reject: () => void;
12
- onAccept: (handler: (args: CookieConsent) => void) => void;
13
- onAcceptSelected: (handler: (args: CookieConsent) => void) => void;
14
- onReject: (handler: (args: CookieConsent) => void) => void;
12
+ onAccept: (handler: (args: MagicCookieConsent) => void) => void;
13
+ onAcceptSelected: (handler: (args: MagicCookieConsent) => void) => void;
14
+ onReject: (handler: (args: MagicCookieConsent) => void) => void;
15
15
  };
16
16
  export type UseMagicCookieReturn = ReturnType<typeof useMagicCookie>;
@@ -2,7 +2,7 @@ import { computed, ref } from "vue";
2
2
  import { useCookies } from "@vueuse/integrations/useCookies";
3
3
  import { toValue } from "@vueuse/core";
4
4
  import { useMagicEmitter } from "@maas/vue-equipment/plugins";
5
- import { globalApiState } from "./private/defineCookieApi.mjs";
5
+ import { cookieApiStore } from "./private/useCookieApi.mjs";
6
6
  const preferencesVisible = ref(false);
7
7
  const selectedCookies = ref({});
8
8
  export function useMagicCookie() {
@@ -13,7 +13,7 @@ export function useMagicCookie() {
13
13
  },
14
14
  set: (value) => {
15
15
  universalCookies.set("cookie_consent", value, {
16
- maxAge: globalApiState.value?.maxAge
16
+ maxAge: cookieApiStore.value?.maxAge
17
17
  });
18
18
  }
19
19
  });
@@ -26,7 +26,7 @@ export function useMagicCookie() {
26
26
  };
27
27
  }
28
28
  function accept() {
29
- const cookies = globalApiState.value?.cookies?.reduce((result, cookie) => {
29
+ const cookies = cookieApiStore.value?.cookies?.reduce((result, cookie) => {
30
30
  result[cookie.key] = true;
31
31
  return result;
32
32
  }, {});
@@ -44,7 +44,7 @@ export function useMagicCookie() {
44
44
  emitter.emit("acceptSelected", cookieConsent.value);
45
45
  }
46
46
  function reject() {
47
- const cookies = globalApiState.value?.cookies?.reduce((result, cookie) => {
47
+ const cookies = cookieApiStore.value?.cookies?.reduce((result, cookie) => {
48
48
  result[cookie.key] = cookie.optional === false ? true : false;
49
49
  return result;
50
50
  }, {});
@@ -1,20 +1,16 @@
1
- export type CookieApiDefinition = {
2
- cookies: CookieRecord[];
3
- maxAge?: number;
4
- };
5
- export type CookieRecord = {
1
+ export type MagicCookieRecord = {
6
2
  key: string;
7
3
  optional?: boolean;
8
4
  title?: string;
9
5
  text?: string;
10
- [key: string]: any;
6
+ [key: string]: unknown;
11
7
  };
12
- export type CookieConsent = {
8
+ export type MagicCookieConsent = {
13
9
  timestamp: number | undefined;
14
10
  cookies: Record<string, boolean>;
15
11
  };
16
12
  export type CookieEvents = {
17
- accept: CookieConsent;
18
- reject: CookieConsent;
19
- acceptSelected: CookieConsent;
13
+ accept: MagicCookieConsent;
14
+ reject: MagicCookieConsent;
15
+ acceptSelected: MagicCookieConsent;
20
16
  };
@@ -1,6 +1,6 @@
1
1
  import type { Plugin } from 'vue';
2
2
  import MagicDraggable from './src/components/MagicDraggable.vue.js';
3
- import type { DraggableOptions, DraggableEvents } from './src/types.js';
3
+ import type { MagicDraggableOptions } from './src/types.js';
4
4
  declare const MagicDraggablePlugin: Plugin;
5
5
  export { MagicDraggablePlugin, MagicDraggable };
6
- export type { DraggableOptions, DraggableEvents };
6
+ export type { MagicDraggableOptions };
@@ -1,16 +1,15 @@
1
1
  <template>
2
2
  <div
3
3
  ref="drawerRef"
4
- class="magic-draggable"
5
4
  :id="toValue(id)"
6
5
  :class="[
7
- toValue(props.class),
8
-
6
+ 'magic-draggable',
9
7
  {
10
8
  '-dragging': dragging,
11
9
  '-disabled': disabled,
12
10
  },
13
11
  ]"
12
+ v-bind="$attrs"
14
13
  >
15
14
  <div class="magic-draggable__wrapper" ref="wrapperRef">
16
15
  <component
@@ -43,17 +42,19 @@ import { useDraggableDrag } from '../composables/private/useDraggableDrag'
43
42
  import { useDraggableState } from '../composables/private/useDraggableState'
44
43
  import { defaultOptions } from '../utils/defaultOptions'
45
44
 
46
- import type { DraggableOptions } from '../types'
45
+ import type { MagicDraggableOptions } from '../types'
46
+
47
+ defineOptions({
48
+ inheritAttrs: false,
49
+ })
47
50
 
48
- interface MagicDrawerProps {
51
+ interface MagicDraggableProps {
49
52
  id: MaybeRef<string>
50
- class?: MaybeRef<string>
51
53
  component?: Component
52
- props?: Record<string, unknown>
53
- options?: DraggableOptions
54
+ options?: MagicDraggableOptions
54
55
  }
55
56
 
56
- const props = withDefaults(defineProps<MagicDrawerProps>(), {
57
+ const props = withDefaults(defineProps<MagicDraggableProps>(), {
57
58
  options: () => defaultOptions,
58
59
  })
59
60
 
@@ -1,18 +1,16 @@
1
1
  import { type Component, type MaybeRef } from 'vue';
2
- import type { DraggableOptions } from '../types';
3
- interface MagicDrawerProps {
2
+ import type { MagicDraggableOptions } from '../types';
3
+ interface MagicDraggableProps {
4
4
  id: MaybeRef<string>;
5
- class?: MaybeRef<string>;
6
5
  component?: Component;
7
- props?: Record<string, unknown>;
8
- options?: DraggableOptions;
6
+ options?: MagicDraggableOptions;
9
7
  }
10
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDrawerProps>, {
8
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDraggableProps>, {
11
9
  options: () => any;
12
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDrawerProps>, {
10
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDraggableProps>, {
13
11
  options: () => any;
14
12
  }>>>, {
15
- options: DraggableOptions;
13
+ options: MagicDraggableOptions;
16
14
  }, {}>, {
17
15
  default?(_: {}): any;
18
16
  }>;
@@ -1,6 +1,5 @@
1
1
  import { type MaybeRef } from 'vue';
2
- import type { DraggableState } from '../../types/index.js';
3
2
  export declare function useDraggableState(id: MaybeRef<string>): {
4
- initializeState: () => import("vue").ToRefs<DraggableState>;
3
+ initializeState: () => import("vue").ToRefs<any>;
5
4
  deleteState: () => void;
6
5
  };
@@ -10,7 +10,7 @@ export type DraggableSnapPoint = [
10
10
  y?: number;
11
11
  }
12
12
  ] | Position;
13
- export interface DraggableOptions {
13
+ export interface MagicDraggableOptions {
14
14
  tag?: 'dialog' | 'div';
15
15
  threshold?: {
16
16
  distance?: number;
@@ -1,8 +1,8 @@
1
- import type { DraggableOptions } from '../types.js';
1
+ import type { MagicDraggableOptions } from '../types.js';
2
2
  import type { RequireAll } from '@maas/vue-equipment/utils';
3
- type DefaultOptions = RequireAll<DraggableOptions> & {
4
- threshold: RequireAll<DraggableOptions['threshold']>;
5
- animation: RequireAll<DraggableOptions['animation']>;
3
+ type DefaultOptions = RequireAll<MagicDraggableOptions> & {
4
+ threshold: RequireAll<MagicDraggableOptions['threshold']>;
5
+ animation: RequireAll<MagicDraggableOptions['animation']>;
6
6
  };
7
7
  declare const defaultOptions: DefaultOptions;
8
8
  export { defaultOptions, type DefaultOptions };
@@ -1,7 +1,7 @@
1
1
  import MagicDrawer from './src/components/MagicDrawer.vue.js';
2
2
  import { useMagicDrawer } from './src/composables/useMagicDrawer.js';
3
3
  import type { Plugin } from 'vue';
4
- import type { DrawerEvents, DrawerOptions } from './src/types/index.js';
4
+ import type { MagicDrawerOptions } from './src/types/index.js';
5
5
  declare const MagicDrawerPlugin: Plugin;
6
6
  export { MagicDrawerPlugin, MagicDrawer, useMagicDrawer };
7
- export type { DrawerEvents, DrawerOptions };
7
+ export type { MagicDrawerOptions };
@@ -6,10 +6,9 @@
6
6
  >
7
7
  <div
8
8
  ref="drawerRef"
9
- class="magic-drawer"
10
9
  :id="toValue(id)"
11
10
  :class="[
12
- toValue(props.class),
11
+ 'magic-drawer',
13
12
  `-${mappedOptions.position}`,
14
13
  {
15
14
  '-dragging': dragging,
@@ -17,6 +16,7 @@
17
16
  '-disabled': disabled,
18
17
  },
19
18
  ]"
19
+ v-bind="$attrs"
20
20
  aria-modal="true"
21
21
  >
22
22
  <transition
@@ -75,7 +75,6 @@ import {
75
75
  nextTick,
76
76
  toValue,
77
77
  onBeforeMount,
78
- onMounted,
79
78
  onBeforeUnmount,
80
79
  onUnmounted,
81
80
  type Component,
@@ -92,7 +91,7 @@ import { useDrawerDrag } from '../composables/private/useDrawerDrag'
92
91
  import { useDrawerWheel } from '../composables/private/useDrawerWheel'
93
92
  import { useDrawerState } from '../composables/private/useDrawerState'
94
93
 
95
- import type { DrawerOptions } from '../types/index'
94
+ import type { MagicDrawerOptions } from '../types/index'
96
95
 
97
96
  import '@maas/vue-equipment/utils/css/animations/fade-in.css'
98
97
  import '@maas/vue-equipment/utils/css/animations/fade-out.css'
@@ -106,10 +105,14 @@ import '@maas/vue-equipment/utils/css/animations/slide-ttb-out.css'
106
105
  import '@maas/vue-equipment/utils/css/animations/slide-btt-out.css'
107
106
  import { useMagicDrawer } from '../composables/useMagicDrawer'
108
107
 
108
+ defineOptions({
109
+ inheritAttrs: false,
110
+ })
111
+
109
112
  // Prevent deep merge of certain options
110
113
  // In this case, don’t merge the `close` and `points` options
111
114
  const customDefu = createDefu((obj, key, value) => {
112
- if (key === 'close' || key === 'points') {
115
+ if (key === 'close' || key === 'snapPoints') {
113
116
  obj[key] = value
114
117
  return true
115
118
  }
@@ -117,10 +120,8 @@ const customDefu = createDefu((obj, key, value) => {
117
120
 
118
121
  interface MagicDrawerProps {
119
122
  id: MaybeRef<string>
120
- class?: MaybeRef<string>
121
123
  component?: Component
122
- props?: Record<string, unknown>
123
- options?: DrawerOptions
124
+ options?: MagicDrawerOptions
124
125
  }
125
126
 
126
127
  const props = withDefaults(defineProps<MagicDrawerProps>(), {
@@ -1,5 +1,5 @@
1
1
  import { type Component, type MaybeRef } from 'vue';
2
- import type { DrawerOptions } from '../types/index';
2
+ import type { MagicDrawerOptions } from '../types/index';
3
3
  import '@maas/vue-equipment/utils/css/animations/fade-in.css';
4
4
  import '@maas/vue-equipment/utils/css/animations/fade-out.css';
5
5
  import '@maas/vue-equipment/utils/css/animations/slide-ltr-in.css';
@@ -12,17 +12,15 @@ import '@maas/vue-equipment/utils/css/animations/slide-ttb-out.css';
12
12
  import '@maas/vue-equipment/utils/css/animations/slide-btt-out.css';
13
13
  interface MagicDrawerProps {
14
14
  id: MaybeRef<string>;
15
- class?: MaybeRef<string>;
16
15
  component?: Component;
17
- props?: Record<string, unknown>;
18
- options?: DrawerOptions;
16
+ options?: MagicDrawerOptions;
19
17
  }
20
18
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDrawerProps>, {
21
19
  options: () => any;
22
20
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDrawerProps>, {
23
21
  options: () => any;
24
22
  }>>>, {
25
- options: DrawerOptions;
23
+ options: MagicDrawerOptions;
26
24
  }, {}>, {
27
25
  backdrop?(_: {}): any;
28
26
  default?(_: {}): any;
@@ -1,8 +1,8 @@
1
1
  import { type Ref, type MaybeRef } from 'vue';
2
- import type { DrawerOptions } from '../../types.js';
2
+ import type { MagicDrawerOptions } from '../../types.js';
3
3
  type UseDrawerCallbackArgs = {
4
4
  id: MaybeRef<string>;
5
- mappedOptions: DrawerOptions;
5
+ mappedOptions: MagicDrawerOptions;
6
6
  addScrollLockPadding: () => void;
7
7
  removeScrollLockPadding: () => void;
8
8
  lockScroll: () => void;
@@ -1,9 +1,9 @@
1
1
  import { type MaybeElementRef } from '@vueuse/core';
2
- import type { DrawerOptions } from '../../types/index.js';
3
- export type UseDrawerDOMOptions = Pick<DrawerOptions, 'scrollLock' | 'focusTrap'> & {
2
+ import type { MagicDrawerOptions } from '../../types/index.js';
3
+ export type UseDrawerDOMArgs = Pick<MagicDrawerOptions, 'scrollLock' | 'focusTrap'> & {
4
4
  focusTarget: MaybeElementRef;
5
5
  };
6
- export declare function useDrawerDOM(options?: UseDrawerDOMOptions): {
6
+ export declare function useDrawerDOM(args?: UseDrawerDOMArgs): {
7
7
  trapFocus: () => void;
8
8
  releaseFocus: () => void;
9
9
  lockScroll: () => void;
@@ -9,9 +9,9 @@ const defaultOptions = {
9
9
  scrollLock: true
10
10
  };
11
11
  const scrollLock = typeof window !== "undefined" ? useScrollLock(document?.documentElement) : ref(false);
12
- export function useDrawerDOM(options) {
12
+ export function useDrawerDOM(args) {
13
13
  const positionFixedElements = ref([]);
14
- const mappedOptions = defu(options, defaultOptions);
14
+ const mappedOptions = defu(args, defaultOptions);
15
15
  const focusTrap = mappedOptions.focusTarget ? typeof mappedOptions.focusTrap === "boolean" ? useFocusTrap(mappedOptions.focusTarget) : useFocusTrap(mappedOptions.focusTarget, mappedOptions.focusTrap) : void 0;
16
16
  function trapFocus() {
17
17
  if (focusTrap) {
@@ -14,7 +14,9 @@ import {
14
14
  useScrollLock
15
15
  } from "@vueuse/core";
16
16
  import { isIOS, isWithinRange } from "@maas/vue-equipment/utils";
17
- import { useMagicEmitter } from "@maas/vue-equipment/plugins";
17
+ import {
18
+ useMagicEmitter
19
+ } from "@maas/vue-equipment/plugins";
18
20
  import { useDrawerSnap } from "./useDrawerSnap.mjs";
19
21
  import { useDrawerGuards } from "./useDrawerGuards.mjs";
20
22
  import { useDrawerUtils } from "./useDrawerUtils.mjs";
@@ -8,7 +8,9 @@ import {
8
8
  } from "vue";
9
9
  import { useElementBounding, useRafFn } from "@vueuse/core";
10
10
  import { clampValue, mapValue } from "@maas/vue-equipment/utils";
11
- import { useMagicEmitter } from "@maas/vue-equipment/plugins";
11
+ import {
12
+ useMagicEmitter
13
+ } from "@maas/vue-equipment/plugins";
12
14
  import { useDrawerState } from "./useDrawerState.mjs";
13
15
  export function useDrawerProgress(args) {
14
16
  const { id, drawerRef, elRef, position, overshoot } = args;