@maas/vue-equipment 0.12.0 → 0.13.0

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 (74) hide show
  1. package/dist/composables/index.d.mts +2 -2
  2. package/dist/composables/index.d.ts +2 -2
  3. package/dist/composables/index.js +5 -6
  4. package/dist/composables/index.js.map +1 -1
  5. package/dist/composables/index.mjs +0 -1
  6. package/dist/composables/index.mjs.map +1 -1
  7. package/dist/nuxt/module.json +2 -2
  8. package/dist/nuxt/module.mjs +2 -2
  9. package/dist/plugins/MagicConsent/nuxt.mjs +1 -1
  10. package/dist/plugins/MagicConsent/src/components/MagicConsent.vue +2 -189
  11. package/dist/plugins/MagicConsent/src/components/MagicConsent.vue.d.ts +26 -19
  12. package/dist/plugins/MagicConsent/src/composables/private/defineConsentApi.mjs +1 -1
  13. package/dist/plugins/MagicMarquee/nuxt.mjs +1 -1
  14. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +2 -54
  15. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +29 -20
  16. package/dist/plugins/MagicModal/nuxt.mjs +1 -3
  17. package/dist/plugins/MagicModal/src/components/MagicModal.vue +4 -101
  18. package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +31 -37
  19. package/dist/plugins/MagicModal/src/composables/useModalApi.d.ts +1 -1
  20. package/dist/plugins/MagicModal/src/composables/useModalApi.mjs +1 -1
  21. package/dist/plugins/MagicModal/src/utils/defaultOptions.d.ts +1 -1
  22. package/dist/plugins/MagicNoise/nuxt.mjs +1 -1
  23. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +4 -42
  24. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +26 -19
  25. package/dist/plugins/MagicNoise/src/utils/defaultOptions.d.ts +1 -1
  26. package/dist/plugins/MagicPlayer/nuxt.mjs +1 -1
  27. package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue +22 -31
  28. package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue.d.ts +32 -45
  29. package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue +7 -138
  30. package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue.d.ts +13 -11
  31. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +4 -16
  32. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +13 -18
  33. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +5 -42
  34. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +13 -11
  35. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +4 -103
  36. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +12 -10
  37. package/dist/plugins/MagicPlayer/src/components/icons/Waiting.vue +1 -23
  38. package/dist/plugins/MagicPlayer/src/composables/private/useControlsApi.d.ts +1 -1
  39. package/dist/plugins/MagicPlayer/src/composables/private/useControlsApi.mjs +3 -3
  40. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerInternalApi.mjs +3 -3
  41. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStore.d.ts +4 -2
  42. package/dist/plugins/MagicPlayer/src/composables/private/usePlayerStore.mjs +12 -6
  43. package/dist/plugins/MagicPlayer/src/composables/usePlayerApi.d.ts +2 -1
  44. package/dist/plugins/MagicPlayer/src/composables/usePlayerApi.mjs +1 -1
  45. package/dist/plugins/MagicPlayer/src/types/index.d.ts +2 -2
  46. package/dist/plugins/MagicScroll/nuxt.mjs +1 -1
  47. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +13 -11
  48. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +31 -29
  49. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +26 -17
  50. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +3 -3
  51. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +30 -26
  52. package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue.d.ts +46 -67
  53. package/dist/plugins/MagicScroll/src/composables/useScrollApi.d.ts +1 -1
  54. package/dist/plugins/MagicScroll/src/composables/useScrollApi.mjs +1 -1
  55. package/dist/plugins/MagicToast/demo/DemoToast.vue.d.ts +14 -12
  56. package/dist/plugins/MagicToast/nuxt.mjs +1 -1
  57. package/dist/plugins/MagicToast/src/components/MagicToast.vue +10 -118
  58. package/dist/plugins/MagicToast/src/components/MagicToast.vue.d.ts +19 -24
  59. package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue +2 -41
  60. package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue.d.ts +17 -36
  61. package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.d.ts +1 -1
  62. package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.mjs +1 -1
  63. package/dist/plugins/MagicToast/src/composables/useToastApi.mjs +1 -1
  64. package/dist/plugins/MagicToast/src/types/index.d.ts +1 -1
  65. package/dist/plugins/MagicToast/src/utils/defaultOptions.d.ts +1 -1
  66. package/dist/utils/{index.mjs → index.cjs} +38 -6
  67. package/dist/utils/index.cjs.map +1 -0
  68. package/dist/utils/{index.d.mts → index.d.cts} +1 -1
  69. package/dist/utils/index.d.ts +1 -1
  70. package/dist/utils/index.js +5 -37
  71. package/dist/utils/index.js.map +1 -1
  72. package/dist/utils/types/index.ts +2 -0
  73. package/package.json +15 -34
  74. package/dist/utils/index.mjs.map +0 -1
@@ -6,7 +6,7 @@ import {
6
6
  } from "@nuxt/kit";
7
7
  export default defineNuxtModule({
8
8
  meta: {
9
- name: "@maas/vue-equipment/MagicMarquee"
9
+ name: "@maas/vue-equipment/nuxt/MagicMarquee"
10
10
  },
11
11
  setup() {
12
12
  const resolver = createResolver(import.meta.url);
@@ -48,58 +48,6 @@ defineExpose({
48
48
  })
49
49
  </script>
50
50
 
51
- <style lang="css">
52
- :root {
53
- --magic-marquee-gap: 1rem;
54
- --magic-marquee-content-width: unset;
55
- --magic-marquee-transform-target-x: -100%;
56
- }
57
-
58
- @keyframes magicMarqueeScrollX {
59
- 0% {
60
- transform: translate3d(0, 0, 0);
61
- }
62
- 100% {
63
- transform: translate3d(-100%, 0, 0);
64
- }
65
- }
66
-
67
- @keyframes magicMarqueeScrollY {
68
- 0% {
69
- transform: translate3d(0, 0, 0);
70
- }
71
- 100% {
72
- transform: translate3d(0, -100%, 0);
73
- }
74
- }
75
-
76
- .magic-marquee {
77
- position: relative;
78
- width: 100%;
79
- overflow: hidden;
80
- user-select: none;
81
- }
82
-
83
- .magic-marquee__track {
84
- position: relative;
85
- width: 100%;
86
- display: flex;
87
- justify-content: flex-start;
88
- }
89
-
90
- .magic-marquee__content {
91
- white-space: nowrap;
92
- backface-visibility: hidden;
93
- padding-right: var(--magic-marquee-gap);
94
- width: var(--magic-marquee-content-width);
95
- animation-name: var(--magic-marquee-animation-name);
96
- animation-duration: var(--magic-marquee-animation-duration);
97
- animation-play-state: var(--magic-marquee-animation-play-state, running);
98
- animation-direction: var(--magic-marquee-animation-direction, normal);
99
- animation-timing-function: linear;
100
- animation-iteration-count: infinite;
101
- animation-delay: 0;
102
- flex-shrink: 0;
103
- flex-grow: 0;
104
- }
51
+ <style>
52
+ :root{--magic-marquee-gap:1rem;--magic-marquee-content-width:unset;--magic-marquee-transform-target-x:-100%}@keyframes magicMarqueeScrollX{0%{transform:translateZ(0)}to{transform:translate3d(-100%,0,0)}}@keyframes magicMarqueeScrollY{0%{transform:translateZ(0)}to{transform:translate3d(0,-100%,0)}}.magic-marquee{overflow:hidden;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.magic-marquee__track{display:flex;justify-content:flex-start;position:relative;width:100%}.magic-marquee__content{animation-direction:var(--magic-marquee-animation-direction,normal);animation-duration:var(--magic-marquee-animation-duration);animation-iteration-count:infinite;animation-name:var(--magic-marquee-animation-name);animation-play-state:var(--magic-marquee-animation-play-state,running);animation-timing-function:linear;backface-visibility:hidden;flex-grow:0;flex-shrink:0;padding-right:var(--magic-marquee-gap);white-space:nowrap;width:var(--magic-marquee-content-width)}
105
53
  </style>
@@ -1,32 +1,41 @@
1
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
- direction: {
3
- type: import("vue").PropType<"reverse" | "normal">;
4
- default: string;
5
- };
6
- speed: {
7
- type: import("vue").PropType<number>;
8
- default: number;
9
- };
10
- }, {
1
+ interface Props {
2
+ direction?: 'reverse' | 'normal';
3
+ speed?: number;
4
+ }
5
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
6
+ direction: string;
7
+ speed: number;
8
+ }>, {
11
9
  playing: import("vue").Ref<boolean>;
12
10
  play: () => void;
13
11
  pause: () => void;
14
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
- direction: {
16
- type: import("vue").PropType<"reverse" | "normal">;
17
- default: string;
18
- };
19
- speed: {
20
- type: import("vue").PropType<number>;
21
- default: number;
22
- };
23
- }>>, {
12
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
13
+ direction: string;
14
+ speed: number;
15
+ }>>>, {
24
16
  direction: "reverse" | "normal";
25
17
  speed: number;
26
18
  }, {}>, {
27
19
  default?(_: {}): any;
28
20
  }>;
29
21
  export default _default;
22
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
+ type __VLS_TypePropsToRuntimeProps<T> = {
24
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
25
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
26
+ } : {
27
+ type: import('vue').PropType<T[K]>;
28
+ required: true;
29
+ };
30
+ };
31
+ type __VLS_WithDefaults<P, D> = {
32
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
33
+ default: D[K];
34
+ }> : P[K];
35
+ };
36
+ type __VLS_Prettify<T> = {
37
+ [K in keyof T]: T[K];
38
+ } & {};
30
39
  type __VLS_WithTemplateSlots<T, S> = T & {
31
40
  new (): {
32
41
  $slots: S;
@@ -6,7 +6,7 @@ import {
6
6
  } from "@nuxt/kit";
7
7
  export default defineNuxtModule({
8
8
  meta: {
9
- name: "@maas/vue-equipment/MagicModal"
9
+ name: "@maas/vue-equipment/nuxt/MagicModal"
10
10
  },
11
11
  setup() {
12
12
  const resolver = createResolver(import.meta.url);
@@ -17,12 +17,10 @@ export default defineNuxtModule({
17
17
  });
18
18
  addImports({
19
19
  from: "@maas/vue-equipment/plugins/MagicModal",
20
- typeFrom: "@maas/vue-equipment/plugins/MagicModal",
21
20
  name: "useModalApi"
22
21
  });
23
22
  addImports({
24
23
  from: "@maas/vue-equipment/plugins/MagicModal",
25
- typeFrom: "@maas/vue-equipment/plugins/MagicModal",
26
24
  name: "useModalEmitter"
27
25
  });
28
26
  }
@@ -63,6 +63,7 @@ import {
63
63
  type Component,
64
64
  type MaybeRef,
65
65
  } from 'vue'
66
+ import { createDefu } from 'defu'
66
67
  import { onKeyStroke } from '@vueuse/core'
67
68
  import { defaultOptions } from './../utils/defaultOptions'
68
69
  import { useModalApi } from './../composables/useModalApi'
@@ -70,7 +71,8 @@ import { useModalCallback } from '../composables/private/useModalCallback'
70
71
 
71
72
  import type { ModalOptions } from './../types/index'
72
73
 
73
- import { createDefu } from 'defu'
74
+ import 'utils/css/animations/fade-in.css'
75
+ import 'utils/css/animations/fade-out.css'
74
76
 
75
77
  // Prevent keys array from being merged with default
76
78
  const customDefu = createDefu((obj, key, value) => {
@@ -160,104 +162,5 @@ watch(isActive, async (value) => {
160
162
  </script>
161
163
 
162
164
  <style>
163
- @import '@maas/vue-equipment/utils/css/animations/fade-in.css';
164
- @import '@maas/vue-equipment/utils/css/animations/fade-out.css';
165
-
166
- :root {
167
- --magic-modal-z-index: 999;
168
- --magic-modal-backdrop-color: rgba(0, 0, 0, 0.5);
169
- --magic-modal-backdrop-filter: unset;
170
- --magic-modal-content-align-items: center;
171
- --magic-modal-content-justify-content: center;
172
- --magic-modal-content-overflow-y: auto;
173
- }
174
-
175
- @keyframes magic-modal-content-enter {
176
- 0% {
177
- opacity: 0;
178
- transform: translateY(2rem);
179
- }
180
- 100% {
181
- opacity: 1;
182
- transform: translateY(0);
183
- }
184
- }
185
-
186
- @keyframes magic-modal-content-leave {
187
- 0% {
188
- opacity: 1;
189
- transform: scale(1);
190
- }
191
- 100% {
192
- opacity: 0;
193
- transform: scale(1.02);
194
- }
195
- }
196
-
197
- .magic-modal {
198
- position: fixed;
199
- inset: 0;
200
- width: 100%;
201
- height: 100%;
202
- display: flex;
203
- justify-content: center;
204
- align-items: center;
205
- z-index: var(--magic-modal-z-index);
206
- background: transparent;
207
- color: inherit;
208
- padding: 0;
209
- border: none;
210
- }
211
-
212
- .magic-modal__content {
213
- -webkit-overflow-scrolling: touch;
214
- scroll-behavior: smooth;
215
- max-height: 100%;
216
- width: 100%;
217
- display: flex;
218
- align-items: var(--magic-modal-content-align-items);
219
- justify-content: var(--magic-modal-content-justify-content);
220
- overflow-y: var(--magic-modal-content-overflow-y);
221
- }
222
-
223
- .magic-modal__backdrop {
224
- position: fixed;
225
- top: 0;
226
- left: 0;
227
- right: 0;
228
- bottom: 0;
229
- width: 100%;
230
- height: 100%;
231
- background-color: var(--magic-modal-backdrop-color);
232
- backdrop-filter: var(--magic-modal-backdrop-filter);
233
- z-index: -1;
234
- }
235
-
236
- /* Content */
237
- .magic-modal--content-enter-active {
238
- animation: magic-modal-content-enter 300ms ease;
239
- }
240
-
241
- .magic-modal--content-leave-active {
242
- animation: magic-modal-content-leave 300ms ease;
243
- }
244
-
245
- @media (prefers-reduced-motion) {
246
- .magic-modal--content-enter-active {
247
- animation: fade-in 300ms ease;
248
- }
249
-
250
- .magic-modal--content-leave-active {
251
- animation: fade-out 300ms ease;
252
- }
253
- }
254
-
255
- /* Backdrop */
256
- .magic-modal--backdrop-enter-active {
257
- animation: fade-in 300ms ease;
258
- }
259
-
260
- .magic-modal--backdrop-leave-active {
261
- animation: fade-out 300ms ease;
262
- }
165
+ :root{--magic-modal-z-index:999;--magic-modal-backdrop-color:rgba(0,0,0,.5);--magic-modal-backdrop-filter:unset;--magic-modal-content-align-items:center;--magic-modal-content-justify-content:center;--magic-modal-content-overflow-y:auto}@keyframes magic-modal-content-enter{0%{opacity:0;transform:translateY(2rem)}to{opacity:1;transform:translateY(0)}}@keyframes magic-modal-content-leave{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(1.02)}}.magic-modal{align-items:center;background:transparent;border:none;color:inherit;display:flex;height:100%;inset:0;justify-content:center;padding:0;position:fixed;width:100%;z-index:var(--magic-modal-z-index)}.magic-modal__content{-webkit-overflow-scrolling:touch;align-items:var(--magic-modal-content-align-items);display:flex;justify-content:var(--magic-modal-content-justify-content);max-height:100%;overflow-y:var(--magic-modal-content-overflow-y);scroll-behavior:smooth;width:100%}.magic-modal__backdrop{-webkit-backdrop-filter:var(--magic-modal-backdrop-filter);backdrop-filter:var(--magic-modal-backdrop-filter);background-color:var(--magic-modal-backdrop-color);bottom:0;height:100%;left:0;position:fixed;right:0;top:0;width:100%;z-index:-1}.magic-modal--content-enter-active{animation:magic-modal-content-enter .3s ease}.magic-modal--content-leave-active{animation:magic-modal-content-leave .3s ease}@media (prefers-reduced-motion){.magic-modal--content-enter-active{animation:fade-in .3s ease}.magic-modal--content-leave-active{animation:fade-out .3s ease}}.magic-modal--backdrop-enter-active{animation:fade-in .3s ease}.magic-modal--backdrop-leave-active{animation:fade-out .3s ease}
263
166
  </style>
@@ -1,48 +1,42 @@
1
1
  import { type Component, type MaybeRef } from 'vue';
2
2
  import type { ModalOptions } from './../types/index';
3
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
4
- props: {
5
- type: import("vue").PropType<Record<string, unknown>>;
6
- };
7
- class: {
8
- type: import("vue").PropType<MaybeRef<string>>;
9
- };
10
- id: {
11
- type: import("vue").PropType<MaybeRef<string>>;
12
- required: true;
13
- };
14
- component: {
15
- type: import("vue").PropType<Component>;
16
- };
17
- options: {
18
- type: import("vue").PropType<ModalOptions>;
19
- default: () => RequireAll<ModalOptions>;
20
- };
21
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
22
- props: {
23
- type: import("vue").PropType<Record<string, unknown>>;
24
- };
25
- class: {
26
- type: import("vue").PropType<MaybeRef<string>>;
27
- };
28
- id: {
29
- type: import("vue").PropType<MaybeRef<string>>;
30
- required: true;
31
- };
32
- component: {
33
- type: import("vue").PropType<Component>;
34
- };
35
- options: {
36
- type: import("vue").PropType<ModalOptions>;
37
- default: () => RequireAll<ModalOptions>;
38
- };
39
- }>>, {
3
+ import 'utils/css/animations/fade-in.css';
4
+ import 'utils/css/animations/fade-out.css';
5
+ interface MagicModalProps {
6
+ id: MaybeRef<string>;
7
+ class?: MaybeRef<string>;
8
+ component?: Component;
9
+ props?: Record<string, unknown>;
10
+ options?: ModalOptions;
11
+ }
12
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<MagicModalProps>, {
13
+ options: () => RequireAll<ModalOptions>;
14
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<MagicModalProps>, {
15
+ options: () => RequireAll<ModalOptions>;
16
+ }>>>, {
40
17
  options: ModalOptions;
41
18
  }, {}>, {
42
19
  backdrop?(_: {}): any;
43
20
  default?(_: {}): any;
44
21
  }>;
45
22
  export default _default;
23
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
24
+ type __VLS_TypePropsToRuntimeProps<T> = {
25
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
26
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
27
+ } : {
28
+ type: import('vue').PropType<T[K]>;
29
+ required: true;
30
+ };
31
+ };
32
+ type __VLS_WithDefaults<P, D> = {
33
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
34
+ default: D[K];
35
+ }> : P[K];
36
+ };
37
+ type __VLS_Prettify<T> = {
38
+ [K in keyof T]: T[K];
39
+ } & {};
46
40
  type __VLS_WithTemplateSlots<T, S> = T & {
47
41
  new (): {
48
42
  $slots: S;
@@ -5,7 +5,7 @@ export type useModalApiOptions = Pick<ModalOptions, 'scrollLock'> & {
5
5
  focusTarget: MaybeElementRef;
6
6
  };
7
7
  export declare function useModalApi(id?: MaybeRef<string>, options?: useModalApiOptions): {
8
- id: import("vue").ComputedRef<any>;
8
+ id: import("vue").ComputedRef<string>;
9
9
  isActive: import("vue").ComputedRef<boolean>;
10
10
  open: () => void;
11
11
  close: () => void;
@@ -1,4 +1,4 @@
1
- import { uuid } from "@maas/vue-equipment/utils";
1
+ import { uuid } from "utils";
2
2
  import { ref, computed, toValue } from "vue";
3
3
  import { defu } from "defu";
4
4
  import { useScrollLock } from "@vueuse/core";
@@ -1,4 +1,4 @@
1
1
  import type { ModalOptions } from '../types/index.js';
2
- import type { RequireAll } from '@maas/vue-equipment/utils/types/RequireAll';
2
+ import type { RequireAll } from 'utils';
3
3
  declare const defaultOptions: RequireAll<ModalOptions>;
4
4
  export { defaultOptions };
@@ -6,7 +6,7 @@ import {
6
6
  } from "@nuxt/kit";
7
7
  export default defineNuxtModule({
8
8
  meta: {
9
- name: "@maas/vue-equipment/MagicNoise"
9
+ name: "@maas/vue-equipment/nuxt/MagicNoise"
10
10
  },
11
11
  setup() {
12
12
  const resolver = createResolver(import.meta.url);
@@ -14,7 +14,7 @@ import { useNoiseApi } from '../composables/useNoiseApi'
14
14
  import type { NoiseOptions } from '../types'
15
15
 
16
16
  interface Props {
17
- options: NoiseOptions
17
+ options?: NoiseOptions
18
18
  pause?: boolean
19
19
  }
20
20
 
@@ -30,6 +30,7 @@ const noiseApi = useNoiseApi({
30
30
  offCanvasRef,
31
31
  options: props.options,
32
32
  })
33
+
33
34
  const {
34
35
  initialize,
35
36
  drawControls,
@@ -66,45 +67,6 @@ onUnmounted(() => {
66
67
  })
67
68
  </script>
68
69
 
69
- <style lang="css">
70
- :root {
71
- --magic-noise-loading-background: #000;
72
- --magic-noise-loading-transition: color 300ms ease, opacity 300ms ease;
73
- }
74
-
75
- .magic-noise {
76
- position: relative;
77
- user-select: none;
78
- transition: var(--magic-noise-loading-transition);
79
- &.-loading {
80
- background: var(--magic-noise-loading-background);
81
- }
82
- }
83
-
84
- .magic-noise__inner {
85
- position: relative;
86
- width: 100%;
87
- height: 100%;
88
- transition: var(--magic-noise-loading-transition);
89
- &.-loading {
90
- opacity: 0;
91
- }
92
- }
93
-
94
- .magic-noise__canvas {
95
- position: absolute;
96
- width: 100%;
97
- height: 100%;
98
- top: 0;
99
- left: 0;
100
- object-fit: cover;
101
- }
102
-
103
- .magic-noise__off-canvas {
104
- position: absolute;
105
- top: 0;
106
- left: 0;
107
- visibility: hidden;
108
- pointer-events: none;
109
- }
70
+ <style>
71
+ :root{--magic-noise-loading-background:#000;--magic-noise-loading-transition:color 300ms ease,opacity 300ms ease}.magic-noise{position:relative;transition:var(--magic-noise-loading-transition);-webkit-user-select:none;-moz-user-select:none;user-select:none}.magic-noise.-loading{background:var(--magic-noise-loading-background)}.magic-noise__inner{height:100%;position:relative;transition:var(--magic-noise-loading-transition);width:100%}.magic-noise__inner.-loading{opacity:0}.magic-noise__canvas{height:100%;left:0;-o-object-fit:cover;object-fit:cover;position:absolute;top:0;width:100%}.magic-noise__off-canvas{left:0;pointer-events:none;position:absolute;top:0;visibility:hidden}
110
72
  </style>
@@ -1,23 +1,30 @@
1
1
  import type { NoiseOptions } from '../types';
2
- declare const _default: import("vue").DefineComponent<{
3
- pause: {
4
- type: import("vue").PropType<boolean>;
5
- default: boolean;
6
- };
7
- options: {
8
- type: import("vue").PropType<NoiseOptions>;
9
- required: true;
10
- };
11
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
- pause: {
13
- type: import("vue").PropType<boolean>;
14
- default: boolean;
15
- };
16
- options: {
17
- type: import("vue").PropType<NoiseOptions>;
18
- required: true;
19
- };
20
- }>>, {
2
+ interface Props {
3
+ options?: NoiseOptions;
4
+ pause?: boolean;
5
+ }
6
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
7
+ pause: boolean;
8
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
9
+ pause: boolean;
10
+ }>>>, {
21
11
  pause: boolean;
22
12
  }, {}>;
23
13
  export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: import('vue').PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
23
+ type __VLS_WithDefaults<P, D> = {
24
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
25
+ default: D[K];
26
+ }> : P[K];
27
+ };
28
+ type __VLS_Prettify<T> = {
29
+ [K in keyof T]: T[K];
30
+ } & {};
@@ -1,4 +1,4 @@
1
1
  import type { NoiseOptions } from '../types/index.js';
2
- import type { RequireAll } from '@maas/vue-equipment/utils/types/RequireAll';
2
+ import type { RequireAll } from 'utils';
3
3
  declare const defaultOptions: RequireAll<NoiseOptions>;
4
4
  export { defaultOptions };
@@ -6,7 +6,7 @@ import {
6
6
  } from "@nuxt/kit";
7
7
  export default defineNuxtModule({
8
8
  meta: {
9
- name: "@maas/vue-equipment/MagicPlayer"
9
+ name: "@maas/vue-equipment/nuxt/MagicPlayer"
10
10
  },
11
11
  setup() {
12
12
  const resolver = createResolver(import.meta.url);
@@ -11,6 +11,7 @@
11
11
  class="magic-player-video"
12
12
  preload="auto"
13
13
  playsinline
14
+ disablePictureInPicture
14
15
  />
15
16
  <div v-show="!loaded || !touched" class="magic-player-poster">
16
17
  <slot name="poster" />
@@ -20,7 +21,7 @@
20
21
  </template>
21
22
 
22
23
  <script setup lang="ts">
23
- import { ref, computed, toRefs } from 'vue'
24
+ import { ref, computed } from 'vue'
24
25
  import { useIntersectionObserver } from '@vueuse/core'
25
26
  import { usePlayerApi } from '../composables/usePlayerApi'
26
27
 
@@ -32,6 +33,7 @@ export type MagicPlayerProps = {
32
33
  src: string
33
34
  ratio?: string
34
35
  fill?: boolean
36
+ autoplay?: boolean
35
37
  }
36
38
 
37
39
  const props = withDefaults(defineProps<MagicPlayerProps>(), {
@@ -39,6 +41,7 @@ const props = withDefaults(defineProps<MagicPlayerProps>(), {
39
41
  src: '',
40
42
  ratio: '16:9',
41
43
  fill: false,
44
+ autoplay: false,
42
45
  })
43
46
 
44
47
  const playerRef = ref<HTMLDivElement | undefined>(undefined)
@@ -53,16 +56,24 @@ const { instance } = usePlayerApi({
53
56
  src: props.src,
54
57
  })
55
58
 
56
- const { playing } = toRefs(instance.value?.mediaApi)
57
- const { touched } = toRefs(instance.value?.playerApi)
59
+ const { playing } = instance.value?.mediaApi
60
+ const { touched } = instance.value?.playerApi
58
61
  const { onMouseenter, onMouseleave } = instance.value?.playerApi
59
- const { loaded } = toRefs(instance.value?.runtimeProvider)
62
+ const { loaded } = instance.value?.runtimeProvider
60
63
 
61
- useIntersectionObserver(playerRef, ([{ isIntersecting }]) => {
62
- if (!isIntersecting && playing.value) {
63
- instance.value.playerApi.pause()
64
- }
65
- })
64
+ useIntersectionObserver(
65
+ playerRef,
66
+ ([{ isIntersecting }]) => {
67
+ if (!isIntersecting && playing.value) {
68
+ instance.value.playerApi.pause()
69
+ } else if (isIntersecting && !playing.value && props.autoplay) {
70
+ instance.value.playerApi.play()
71
+ }
72
+ },
73
+ {
74
+ immediate: true,
75
+ },
76
+ )
66
77
 
67
78
  const computedRatio = computed(() => {
68
79
  if (props.ratio) {
@@ -83,26 +94,6 @@ const computedStyle = computed(() => {
83
94
  })
84
95
  </script>
85
96
 
86
- <style lang="css">
87
- .magic-player {
88
- --aspect-ratio: 16 / 9;
89
- position: relative;
90
- width: 100%;
91
- overflow: hidden;
92
- aspect-ratio: var(--aspect-ratio);
93
- }
94
-
95
- .magic-player-video {
96
- position: absolute;
97
- width: 100%;
98
- height: 100%;
99
- top: 0;
100
- left: 0;
101
- object-fit: cover;
102
- }
103
-
104
- .magic-player-poster {
105
- position: absolute;
106
- inset: 0;
107
- }
97
+ <style>
98
+ :root{--magic-player-aspect-ratio:16/9}.magic-player{aspect-ratio:var(--magic-player-aspect-ratio);overflow:hidden;position:relative;width:100%}.magic-player-video{height:100%;left:0;-o-object-fit:cover;object-fit:cover;position:absolute;top:0;width:100%}.magic-player-poster{inset:0;position:absolute}
108
99
  </style>