@maas/vue-equipment 0.29.1 → 0.29.3
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.
- package/dist/composables/index.js +5 -10
- package/dist/composables/index.js.map +1 -1
- package/dist/composables/index.mjs +5 -10
- package/dist/composables/index.mjs.map +1 -1
- package/dist/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +16 -9
- package/dist/plugins/MagicCommand/index.d.ts +2 -4
- package/dist/plugins/MagicCommand/index.mjs +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandBody.vue +3 -3
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +4 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +5 -5
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue.d.ts +2 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +4 -4
- package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue.d.ts +5 -5
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +4 -2
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +3 -3
- package/dist/plugins/MagicCommand/src/composables/private/useCommandScroll.mjs +1 -1
- package/dist/plugins/MagicCommand/src/composables/private/useCommandStore.mjs +1 -1
- package/dist/plugins/MagicCommand/src/symbols/index.d.ts +3 -3
- package/dist/plugins/MagicCommand/src/symbols/index.mjs +2 -2
- package/dist/plugins/MagicCommand/src/types/index.d.ts +5 -5
- package/dist/plugins/MagicCommand/src/utils/defaultOptions.d.ts +2 -2
- package/dist/plugins/MagicCookie/index.d.ts +0 -2
- package/dist/plugins/MagicCookie/src/components/MagicCookie.vue +6 -7
- package/dist/plugins/MagicCookie/src/components/MagicCookie.vue.d.ts +6 -6
- package/dist/plugins/MagicCookie/src/composables/private/useCookieApi.d.ts +17 -0
- package/dist/plugins/MagicCookie/src/composables/private/{defineCookieApi.mjs → useCookieApi.mjs} +4 -4
- package/dist/plugins/MagicCookie/src/composables/useMagicCookie.d.ts +5 -5
- package/dist/plugins/MagicCookie/src/composables/useMagicCookie.mjs +4 -4
- package/dist/plugins/MagicCookie/src/types/index.d.ts +6 -10
- package/dist/plugins/MagicDraggable/index.d.ts +2 -2
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +4 -4
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +6 -6
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.d.ts +1 -2
- package/dist/plugins/MagicDraggable/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicDraggable/src/utils/defaultOptions.d.ts +4 -4
- package/dist/plugins/MagicDrawer/index.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +3 -4
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerCallback.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.d.ts +3 -3
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDOM.mjs +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +3 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.mjs +3 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +1 -3
- package/dist/plugins/MagicDrawer/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicDrawer/src/utils/defaultOptions.d.ts +7 -7
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +494 -170
- package/dist/plugins/MagicEmitter/src/types/index.d.ts +9 -9
- package/dist/plugins/MagicMarquee/nuxt.mjs +1 -5
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +3 -3
- package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue.d.ts +3 -3
- package/dist/plugins/MagicMenu/index.d.ts +4 -0
- package/dist/plugins/MagicMenu/index.mjs +27 -0
- package/dist/plugins/MagicMenu/nuxt.d.ts +2 -0
- package/dist/plugins/MagicMenu/nuxt.mjs +14 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +140 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +26 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +169 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue.d.ts +24 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +137 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +29 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +106 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue.d.ts +24 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +122 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +26 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +53 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +21 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.d.ts +18 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCallback.mjs +52 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.d.ts +6 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuDOM.mjs +42 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.d.ts +15 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.mjs +75 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.d.ts +10 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +178 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuState.d.ts +7 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuState.mjs +48 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.d.ts +18 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuTrigger.mjs +262 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuUtils.d.ts +3 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuUtils.mjs +16 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.d.ts +20 -0
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +116 -0
- package/dist/plugins/MagicMenu/src/symbols/index.d.ts +9 -0
- package/dist/plugins/MagicMenu/src/symbols/index.mjs +16 -0
- package/dist/plugins/MagicMenu/src/types/index.d.ts +72 -0
- package/dist/plugins/MagicMenu/src/types/index.mjs +0 -0
- package/dist/plugins/MagicMenu/src/utils/defaultOptions.d.ts +4 -0
- package/dist/plugins/MagicMenu/src/utils/defaultOptions.mjs +9 -0
- package/dist/plugins/MagicModal/index.d.ts +2 -2
- package/dist/plugins/MagicModal/src/components/MagicModal.vue +4 -4
- package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +5 -5
- package/dist/plugins/MagicModal/src/composables/private/useModalCallback.d.ts +2 -2
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.d.ts +3 -3
- package/dist/plugins/MagicModal/src/composables/private/useModalDOM.mjs +2 -2
- package/dist/plugins/MagicModal/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicModal/src/utils/defaultOptions.d.ts +2 -2
- package/dist/plugins/MagicNoise/index.d.ts +1 -2
- package/dist/plugins/MagicNoise/index.mjs +1 -2
- package/dist/plugins/MagicNoise/nuxt.mjs +1 -5
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +4 -4
- package/dist/plugins/MagicNoise/src/components/MagicNoise.vue.d.ts +5 -5
- package/dist/plugins/MagicNoise/src/composables/private/useNoiseApi.d.ts +2 -2
- package/dist/plugins/MagicNoise/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicNoise/src/utils/defaultOptions.d.ts +2 -2
- package/dist/plugins/MagicPlayer/index.d.ts +0 -1
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayer.vue.d.ts +3 -3
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicAudioPlayerControls.vue.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue +9 -30
- package/dist/plugins/MagicPlayer/src/components/MagicPlayer.vue.d.ts +10 -14
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue +79 -56
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerControls.vue.d.ts +20 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue.d.ts +3 -3
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +9 -7
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +2 -3
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +3 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +2 -2
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +23 -4
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +1 -1
- package/dist/plugins/MagicScroll/index.d.ts +3 -3
- package/dist/plugins/MagicScroll/index.mjs +1 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +11 -7
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue.d.ts +2 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +2 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue.d.ts +3 -3
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +2 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue.d.ts +3 -3
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +2 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue.d.ts +3 -3
- package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue +2 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollTransform.vue.d.ts +3 -3
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.d.ts +28 -0
- package/dist/plugins/MagicScroll/src/composables/private/useCollisionDetect.mjs +144 -0
- package/dist/plugins/MagicScroll/src/composables/private/useScrollApi.d.ts +0 -1
- package/dist/plugins/MagicScroll/src/types/index.d.ts +19 -25
- package/dist/plugins/MagicToast/index.d.ts +0 -2
- package/dist/plugins/MagicToast/src/components/MagicToast.vue +4 -4
- package/dist/plugins/MagicToast/src/components/MagicToast.vue.d.ts +2 -2
- package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue +4 -4
- package/dist/plugins/MagicToast/src/components/MagicToastComponent.vue.d.ts +5 -5
- package/dist/plugins/MagicToast/src/composables/private/useToastApi.d.ts +1 -1
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +3 -3
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +5 -7
- package/dist/plugins/MagicToast/src/composables/private/useToastInternalApi.d.ts +2 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastStore.d.ts +4 -14
- package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +6 -6
- package/dist/plugins/MagicToast/src/types/index.d.ts +20 -21
- package/dist/plugins/MagicToast/src/utils/defaultOptions.d.ts +2 -2
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/utils/index.js +4 -8
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +4 -8
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +9 -4
- package/dist/plugins/MagicCookie/src/composables/private/defineCookieApi.d.ts +0 -12
- package/dist/plugins/MagicScroll/src/composables/useCollisionDetect.d.ts +0 -6
- package/dist/plugins/MagicScroll/src/composables/useCollisionDetect.mjs +0 -119
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
interface
|
|
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<
|
|
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<
|
|
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-
|
|
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-
|
|
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 {
|
|
2
|
+
import type { MagicCommandOptions } from '../types.js';
|
|
3
3
|
declare const MagicCommandInstanceId: InjectionKey<MaybeRef<string>>;
|
|
4
|
-
declare const
|
|
5
|
-
export { MagicCommandInstanceId,
|
|
4
|
+
declare const MagicCommandProviderOptions: InjectionKey<MagicCommandOptions>;
|
|
5
|
+
export { MagicCommandInstanceId, MagicCommandProviderOptions };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const MagicCommandInstanceId = Symbol();
|
|
2
|
-
const
|
|
3
|
-
export { MagicCommandInstanceId,
|
|
2
|
+
const MagicCommandProviderOptions = Symbol();
|
|
3
|
+
export { MagicCommandInstanceId, MagicCommandProviderOptions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export type
|
|
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
|
|
20
|
+
export interface MagicCommandModalOptions extends MagicModalOptions {
|
|
21
21
|
}
|
|
22
|
-
export interface
|
|
22
|
+
export interface MagicCommandDrawerOptions extends MagicDrawerOptions {
|
|
23
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MagicCommandOptions } from '../types.js';
|
|
2
2
|
import type { RequireAllNested } from '@maas/vue-equipment/utils';
|
|
3
|
-
declare const defaultOptions: RequireAllNested<
|
|
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 {
|
|
85
|
+
import { useCookieApi } from '../composables/private/useCookieApi'
|
|
86
86
|
import { useMagicCookie } from '../composables/useMagicCookie'
|
|
87
|
-
import type {
|
|
87
|
+
import type { MagicCookieRecord } from '../types'
|
|
88
88
|
|
|
89
89
|
// Define the props and their default values
|
|
90
|
-
type
|
|
91
|
-
cookies:
|
|
90
|
+
type MagicCookieProps = {
|
|
91
|
+
cookies: MagicCookieRecord[]
|
|
92
92
|
maxAge?: number
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
const props = withDefaults(defineProps<
|
|
95
|
+
const props = withDefaults(defineProps<MagicCookieProps>(), {
|
|
96
96
|
maxAge: 60 * 60 * 24 * 30,
|
|
97
97
|
})
|
|
98
98
|
|
|
99
99
|
// Initialize the Cookie API
|
|
100
|
-
|
|
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 {
|
|
2
|
-
type
|
|
3
|
-
cookies:
|
|
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<
|
|
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<
|
|
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:
|
|
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 {};
|
package/dist/plugins/MagicCookie/src/composables/private/{defineCookieApi.mjs → useCookieApi.mjs}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ref } from "vue";
|
|
2
2
|
import { slugify } from "@maas/vue-equipment/utils";
|
|
3
|
-
export const
|
|
3
|
+
export const cookieApiStore = ref({
|
|
4
4
|
cookies: [],
|
|
5
5
|
maxAge: void 0
|
|
6
6
|
});
|
|
7
|
-
export function
|
|
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
|
-
|
|
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
|
-
|
|
21
|
+
cookieApiStore.value.maxAge = maxAge;
|
|
22
22
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type {
|
|
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<
|
|
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:
|
|
13
|
-
onAcceptSelected: (handler: (args:
|
|
14
|
-
onReject: (handler: (args:
|
|
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 {
|
|
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:
|
|
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 =
|
|
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 =
|
|
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
|
|
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]:
|
|
6
|
+
[key: string]: unknown;
|
|
11
7
|
};
|
|
12
|
-
export type
|
|
8
|
+
export type MagicCookieConsent = {
|
|
13
9
|
timestamp: number | undefined;
|
|
14
10
|
cookies: Record<string, boolean>;
|
|
15
11
|
};
|
|
16
12
|
export type CookieEvents = {
|
|
17
|
-
accept:
|
|
18
|
-
reject:
|
|
19
|
-
acceptSelected:
|
|
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 {
|
|
3
|
+
import type { MagicDraggableOptions } from './src/types.js';
|
|
4
4
|
declare const MagicDraggablePlugin: Plugin;
|
|
5
5
|
export { MagicDraggablePlugin, MagicDraggable };
|
|
6
|
-
export type {
|
|
6
|
+
export type { MagicDraggableOptions };
|
|
@@ -43,17 +43,17 @@ import { useDraggableDrag } from '../composables/private/useDraggableDrag'
|
|
|
43
43
|
import { useDraggableState } from '../composables/private/useDraggableState'
|
|
44
44
|
import { defaultOptions } from '../utils/defaultOptions'
|
|
45
45
|
|
|
46
|
-
import type {
|
|
46
|
+
import type { MagicDraggableOptions } from '../types'
|
|
47
47
|
|
|
48
|
-
interface
|
|
48
|
+
interface MagicDraggableProps {
|
|
49
49
|
id: MaybeRef<string>
|
|
50
50
|
class?: MaybeRef<string>
|
|
51
51
|
component?: Component
|
|
52
52
|
props?: Record<string, unknown>
|
|
53
|
-
options?:
|
|
53
|
+
options?: MagicDraggableOptions
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
const props = withDefaults(defineProps<
|
|
56
|
+
const props = withDefaults(defineProps<MagicDraggableProps>(), {
|
|
57
57
|
options: () => defaultOptions,
|
|
58
58
|
})
|
|
59
59
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { type Component, type MaybeRef } from 'vue';
|
|
2
|
-
import type {
|
|
3
|
-
interface
|
|
2
|
+
import type { MagicDraggableOptions } from '../types';
|
|
3
|
+
interface MagicDraggableProps {
|
|
4
4
|
id: MaybeRef<string>;
|
|
5
5
|
class?: MaybeRef<string>;
|
|
6
6
|
component?: Component;
|
|
7
7
|
props?: Record<string, unknown>;
|
|
8
|
-
options?:
|
|
8
|
+
options?: MagicDraggableOptions;
|
|
9
9
|
}
|
|
10
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<
|
|
10
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDraggableProps>, {
|
|
11
11
|
options: () => any;
|
|
12
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<
|
|
12
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDraggableProps>, {
|
|
13
13
|
options: () => any;
|
|
14
14
|
}>>>, {
|
|
15
|
-
options:
|
|
15
|
+
options: MagicDraggableOptions;
|
|
16
16
|
}, {}>, {
|
|
17
17
|
default?(_: {}): any;
|
|
18
18
|
}>;
|
|
@@ -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<
|
|
3
|
+
initializeState: () => import("vue").ToRefs<any>;
|
|
5
4
|
deleteState: () => void;
|
|
6
5
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MagicDraggableOptions } from '../types.js';
|
|
2
2
|
import type { RequireAll } from '@maas/vue-equipment/utils';
|
|
3
|
-
type DefaultOptions = RequireAll<
|
|
4
|
-
threshold: RequireAll<
|
|
5
|
-
animation: RequireAll<
|
|
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 {
|
|
4
|
+
import type { MagicDrawerOptions } from './src/types/index.js';
|
|
5
5
|
declare const MagicDrawerPlugin: Plugin;
|
|
6
6
|
export { MagicDrawerPlugin, MagicDrawer, useMagicDrawer };
|
|
7
|
-
export type {
|
|
7
|
+
export type { MagicDrawerOptions };
|
|
@@ -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 {
|
|
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'
|
|
@@ -109,7 +108,7 @@ import { useMagicDrawer } from '../composables/useMagicDrawer'
|
|
|
109
108
|
// Prevent deep merge of certain options
|
|
110
109
|
// In this case, don’t merge the `close` and `points` options
|
|
111
110
|
const customDefu = createDefu((obj, key, value) => {
|
|
112
|
-
if (key === 'close' || key === '
|
|
111
|
+
if (key === 'close' || key === 'snapPoints') {
|
|
113
112
|
obj[key] = value
|
|
114
113
|
return true
|
|
115
114
|
}
|
|
@@ -120,7 +119,7 @@ interface MagicDrawerProps {
|
|
|
120
119
|
class?: MaybeRef<string>
|
|
121
120
|
component?: Component
|
|
122
121
|
props?: Record<string, unknown>
|
|
123
|
-
options?:
|
|
122
|
+
options?: MagicDrawerOptions
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
const props = withDefaults(defineProps<MagicDrawerProps>(), {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Component, type MaybeRef } from 'vue';
|
|
2
|
-
import type {
|
|
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';
|
|
@@ -15,14 +15,14 @@ interface MagicDrawerProps {
|
|
|
15
15
|
class?: MaybeRef<string>;
|
|
16
16
|
component?: Component;
|
|
17
17
|
props?: Record<string, unknown>;
|
|
18
|
-
options?:
|
|
18
|
+
options?: MagicDrawerOptions;
|
|
19
19
|
}
|
|
20
20
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDrawerProps>, {
|
|
21
21
|
options: () => any;
|
|
22
22
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<MagicDrawerProps>, {
|
|
23
23
|
options: () => any;
|
|
24
24
|
}>>>, {
|
|
25
|
-
options:
|
|
25
|
+
options: MagicDrawerOptions;
|
|
26
26
|
}, {}>, {
|
|
27
27
|
backdrop?(_: {}): any;
|
|
28
28
|
default?(_: {}): any;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Ref, type MaybeRef } from 'vue';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MagicDrawerOptions } from '../../types.js';
|
|
3
3
|
type UseDrawerCallbackArgs = {
|
|
4
4
|
id: MaybeRef<string>;
|
|
5
|
-
mappedOptions:
|
|
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 {
|
|
3
|
-
export type
|
|
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(
|
|
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(
|
|
12
|
+
export function useDrawerDOM(args) {
|
|
13
13
|
const positionFixedElements = ref([]);
|
|
14
|
-
const mappedOptions = defu(
|
|
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 {
|
|
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 {
|
|
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;
|
|
@@ -42,9 +42,7 @@ export function useDrawerState(id) {
|
|
|
42
42
|
return toRefs(instance);
|
|
43
43
|
}
|
|
44
44
|
function deleteState() {
|
|
45
|
-
drawerStateStore.value = drawerStateStore.value.filter(
|
|
46
|
-
(x) => x.id !== id
|
|
47
|
-
);
|
|
45
|
+
drawerStateStore.value = drawerStateStore.value.filter((x) => x.id !== id);
|
|
48
46
|
}
|
|
49
47
|
return {
|
|
50
48
|
addState,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Options } from 'focus-trap';
|
|
2
2
|
export type DrawerSnapPoint = number | `${string}px`;
|
|
3
|
-
export interface
|
|
3
|
+
export interface MagicDrawerOptions {
|
|
4
4
|
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
5
5
|
backdrop?: boolean;
|
|
6
6
|
tag?: 'dialog' | 'div';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MagicDrawerOptions } from '../types.js';
|
|
2
2
|
import type { RequireAll } from '@maas/vue-equipment/utils';
|
|
3
|
-
type DefaultOptions = RequireAll<
|
|
4
|
-
scrollLock: RequireAll<
|
|
5
|
-
threshold: RequireAll<
|
|
6
|
-
animation: RequireAll<
|
|
7
|
-
initial: RequireAll<
|
|
8
|
-
keyListener: RequireAll<
|
|
3
|
+
type DefaultOptions = RequireAll<MagicDrawerOptions> & {
|
|
4
|
+
scrollLock: RequireAll<MagicDrawerOptions['scrollLock']>;
|
|
5
|
+
threshold: RequireAll<MagicDrawerOptions['threshold']>;
|
|
6
|
+
animation: RequireAll<MagicDrawerOptions['animation']>;
|
|
7
|
+
initial: RequireAll<MagicDrawerOptions['initial']>;
|
|
8
|
+
keyListener: RequireAll<MagicDrawerOptions['keyListener']>;
|
|
9
9
|
};
|
|
10
10
|
declare const defaultOptions: DefaultOptions;
|
|
11
11
|
export { defaultOptions, type DefaultOptions };
|