@maas/vue-equipment 1.0.0-beta.77 → 1.0.0-beta.79
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/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +7 -3
- package/dist/plugins/MagicDrawer/index.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +23 -0
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.d.ts +4 -4
- package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.d.ts +2 -2
- package/dist/plugins/MagicDrawer/src/types/index.d.ts +11 -6
- package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +268 -226
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.d.ts +1 -7
- package/dist/plugins/MagicMenu/src/composables/private/useMenuCursor.mjs +2 -2
- package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +2 -2
- package/dist/plugins/MagicToast/index.d.ts +2 -2
- package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +1 -1
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +3 -3
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +2 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastDrag.mjs +30 -17
- package/dist/plugins/MagicToast/src/composables/private/useToastListener.mjs +2 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastState.mjs +1 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastView.d.ts +1 -1
- package/dist/plugins/MagicToast/src/composables/private/useToastView.mjs +6 -6
- package/dist/plugins/MagicToast/src/composables/useMagicToast.d.ts +3 -4
- package/dist/plugins/MagicToast/src/composables/useMagicToast.mjs +20 -20
- package/dist/plugins/MagicToast/src/types/index.d.ts +16 -4
- package/dist/plugins/MagicToast/src/utils/defaultOptions.mjs +1 -1
- package/dist/plugins/MagicTray/index.d.ts +2 -2
- package/dist/plugins/MagicTray/src/components/MagicTray.d.vue.ts +1 -1
- package/dist/plugins/MagicTray/src/components/MagicTray.vue.d.ts +1 -1
- package/dist/plugins/MagicTray/src/components/MagicTrayContent.d.vue.ts +4 -4
- package/dist/plugins/MagicTray/src/components/MagicTrayContent.vue +3 -1
- package/dist/plugins/MagicTray/src/components/MagicTrayContent.vue.d.ts +4 -4
- package/dist/plugins/MagicTray/src/components/MagicTrayHandle.d.vue.ts +3 -3
- package/dist/plugins/MagicTray/src/components/MagicTrayHandle.vue.d.ts +3 -3
- package/dist/plugins/MagicTray/src/components/MagicTrayTransform.d.vue.ts +2 -2
- package/dist/plugins/MagicTray/src/components/MagicTrayTransform.vue.d.ts +2 -2
- package/dist/plugins/MagicTray/src/composables/private/useTrayDrag.d.ts +7 -6
- package/dist/plugins/MagicTray/src/composables/private/useTrayDrag.mjs +23 -27
- package/dist/plugins/MagicTray/src/composables/private/useTrayMagnetism.d.ts +2 -2
- package/dist/plugins/MagicTray/src/composables/private/useTraySnap.d.ts +12 -12
- package/dist/plugins/MagicTray/src/composables/private/useTrayUtils.d.ts +3 -3
- package/dist/plugins/MagicTray/src/composables/useMagicTray.d.ts +3 -3
- package/dist/plugins/MagicTray/src/types/index.d.ts +35 -34
- package/dist/plugins/MagicTray/src/utils/defaultOptions.mjs +4 -2
- package/package.json +1 -1
package/dist/nuxt/module.json
CHANGED
package/dist/nuxt/module.mjs
CHANGED
|
@@ -32,7 +32,7 @@ const functions$1 = [
|
|
|
32
32
|
{
|
|
33
33
|
name: "MagicDrawer",
|
|
34
34
|
"package": "plugins",
|
|
35
|
-
lastUpdated:
|
|
35
|
+
lastUpdated: 1784022545000,
|
|
36
36
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicDrawer/",
|
|
37
37
|
description: "MagicDrawer is a flexible"
|
|
38
38
|
},
|
|
@@ -102,14 +102,14 @@ const functions$1 = [
|
|
|
102
102
|
{
|
|
103
103
|
name: "MagicToast",
|
|
104
104
|
"package": "plugins",
|
|
105
|
-
lastUpdated:
|
|
105
|
+
lastUpdated: 1784022567000,
|
|
106
106
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicToast/",
|
|
107
107
|
description: "MagicToast let’s you trigger and display toasts from anywhere"
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
name: "MagicTray",
|
|
111
111
|
"package": "plugins",
|
|
112
|
-
lastUpdated:
|
|
112
|
+
lastUpdated: 1784022556000,
|
|
113
113
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicTray/",
|
|
114
114
|
description: "MagicTray is a flexible"
|
|
115
115
|
},
|
|
@@ -175,6 +175,10 @@ const module$1 = defineNuxtModule({
|
|
|
175
175
|
nuxt.options.build.transpile.push("@maas/vue-equipment");
|
|
176
176
|
const packages = ["plugins", "composables", "utils"];
|
|
177
177
|
nuxt.options.alias = nuxt.options.alias ?? {};
|
|
178
|
+
for (const plugin of plugins) {
|
|
179
|
+
const alias = `@maas/vue-equipment/plugins/${plugin.name}/css`;
|
|
180
|
+
nuxt.options.alias[alias] = nuxt.options.alias[alias] ?? resolver.resolve(`../plugins/${plugin.name}/src/css`);
|
|
181
|
+
}
|
|
178
182
|
for (const pkg of packages) {
|
|
179
183
|
nuxt.options.alias[`@maas/vue-equipment/${pkg}`] = nuxt.options.alias[`@maas/vue-equipment/${pkg}`] ?? resolver.resolve(`../${pkg}`);
|
|
180
184
|
}
|
|
@@ -6,7 +6,7 @@ import MagicDrawerContent from './src/components/MagicDrawerContent.vue.js';
|
|
|
6
6
|
import MagicDrawerTrigger from './src/components/MagicDrawerTrigger.vue.js';
|
|
7
7
|
import { useMagicDrawer } from './src/composables/useMagicDrawer.js';
|
|
8
8
|
import type { Plugin } from 'vue';
|
|
9
|
-
import type { MagicDrawerOptions } from './src/types/index.js';
|
|
9
|
+
import type { MagicDrawerOptions, MagicDrawerSnapPoint, MagicDrawerWillSnapToPayload } from './src/types/index.js';
|
|
10
10
|
declare const MagicDrawerPlugin: Plugin;
|
|
11
11
|
export { MagicDrawerPlugin, MagicDrawer, MagicDrawerProvider, MagicDrawerTeleport, MagicDrawerBackdrop, MagicDrawerContent, MagicDrawerTrigger, useMagicDrawer, };
|
|
12
|
-
export type { MagicDrawerOptions };
|
|
12
|
+
export type { MagicDrawerOptions, MagicDrawerSnapPoint, MagicDrawerWillSnapToPayload, };
|
|
@@ -72,6 +72,7 @@ export function useDrawerDrag(args) {
|
|
|
72
72
|
wrapperRect
|
|
73
73
|
} = toRefs(state);
|
|
74
74
|
const { isActive, close } = useMagicDrawer(id);
|
|
75
|
+
let lastPendingTarget = void 0;
|
|
75
76
|
let pointerdownTarget = void 0;
|
|
76
77
|
let cancelPointerup = void 0;
|
|
77
78
|
let cancelPointermove = void 0;
|
|
@@ -220,6 +221,24 @@ export function useDrawerDrag(args) {
|
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
}
|
|
224
|
+
function emitWillSnapTo() {
|
|
225
|
+
const target = interpolateTo.value || interpolateTo.value === 0 ? interpolateTo.value : position === "top" || position === "bottom" ? snappedY.value : snappedX.value;
|
|
226
|
+
if (shouldClose.value) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (target === lastPendingTarget) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
lastPendingTarget = target;
|
|
233
|
+
const snapPoint = snapPointsMap.value[target];
|
|
234
|
+
if (!snapPoint && snapPoint !== 0) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
emitter.emit("willSnapTo", {
|
|
238
|
+
id: toValue(id),
|
|
239
|
+
snapPoint
|
|
240
|
+
});
|
|
241
|
+
}
|
|
223
242
|
function setDragged({ x, y }) {
|
|
224
243
|
const os = toValue(overshoot);
|
|
225
244
|
switch (position) {
|
|
@@ -387,6 +406,7 @@ export function useDrawerDrag(args) {
|
|
|
387
406
|
setDragged({ x: e.clientX, y: e.clientY });
|
|
388
407
|
checkMomentum();
|
|
389
408
|
checkPosition();
|
|
409
|
+
emitWillSnapTo();
|
|
390
410
|
emitter.emit("drag", {
|
|
391
411
|
id: toValue(id),
|
|
392
412
|
x: draggedX.value,
|
|
@@ -470,6 +490,7 @@ export function useDrawerDrag(args) {
|
|
|
470
490
|
setDragged({ x: firstTouch.clientX, y: firstTouch.clientY });
|
|
471
491
|
checkMomentum();
|
|
472
492
|
checkPosition();
|
|
493
|
+
emitWillSnapTo();
|
|
473
494
|
emitter.emit("drag", {
|
|
474
495
|
id: toValue(id),
|
|
475
496
|
x: draggedX.value,
|
|
@@ -535,6 +556,7 @@ export function useDrawerDrag(args) {
|
|
|
535
556
|
return;
|
|
536
557
|
}
|
|
537
558
|
dragging.value = true;
|
|
559
|
+
lastPendingTarget = void 0;
|
|
538
560
|
pointerdownTarget = e.target;
|
|
539
561
|
guardedSetPointerCapture({
|
|
540
562
|
event: e,
|
|
@@ -587,6 +609,7 @@ export function useDrawerDrag(args) {
|
|
|
587
609
|
e.stopImmediatePropagation();
|
|
588
610
|
e.stopPropagation();
|
|
589
611
|
dragging.value = true;
|
|
612
|
+
lastPendingTarget = void 0;
|
|
590
613
|
pointerdownTarget = e.target;
|
|
591
614
|
emitter.emit("beforeDrag", {
|
|
592
615
|
id: toValue(id),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Ref, type MaybeRef } from 'vue';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MagicDrawerSnapPoint, RequiredMagicDrawerOptions } from '../../types/index.js';
|
|
3
3
|
interface UseDrawerGuardsArgs {
|
|
4
4
|
elRef: Ref<HTMLElement | null>;
|
|
5
5
|
absDirectionX: MaybeRef<'with' | 'against' | undefined>;
|
|
6
6
|
absDirectionY: MaybeRef<'with' | 'against' | undefined>;
|
|
7
7
|
position: MaybeRef<RequiredMagicDrawerOptions['position']>;
|
|
8
|
-
activeSnapPoint: MaybeRef<
|
|
8
|
+
activeSnapPoint: MaybeRef<MagicDrawerSnapPoint | undefined>;
|
|
9
9
|
}
|
|
10
10
|
export declare function useDrawerGuards(args: UseDrawerGuardsArgs): {
|
|
11
11
|
canDrag: (el: EventTarget) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MaybeRef, type Ref } from 'vue';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MagicDrawerSnapPoint, RequiredMagicDrawerOptions } from '../../types/index.js';
|
|
3
3
|
type UseDrawerSnapArgs = {
|
|
4
4
|
id: MaybeRef<string>;
|
|
5
5
|
wrapperRect: Ref<DOMRect | undefined>;
|
|
@@ -17,7 +17,7 @@ type FindClosestSnapPointArgs = {
|
|
|
17
17
|
direction?: 'below' | 'above' | 'absolute';
|
|
18
18
|
};
|
|
19
19
|
type SnapToArgs = {
|
|
20
|
-
snapPoint:
|
|
20
|
+
snapPoint: MagicDrawerSnapPoint;
|
|
21
21
|
interpolate: boolean;
|
|
22
22
|
duration?: number;
|
|
23
23
|
};
|
|
@@ -29,11 +29,11 @@ type InterpolateDraggedArgs = {
|
|
|
29
29
|
export declare function useDrawerSnap(args: UseDrawerSnapArgs): {
|
|
30
30
|
snappedY: import("vue").ShallowRef<number, number>;
|
|
31
31
|
snappedX: import("vue").ShallowRef<number, number>;
|
|
32
|
-
activeSnapPoint: import("vue").ShallowRef<
|
|
32
|
+
activeSnapPoint: import("vue").ShallowRef<MagicDrawerSnapPoint | undefined, MagicDrawerSnapPoint | undefined>;
|
|
33
33
|
snapTo: (args: SnapToArgs) => Promise<void>;
|
|
34
34
|
findClosestSnapPoint: (args: FindClosestSnapPointArgs) => number | undefined;
|
|
35
35
|
interpolateDragged: (args: InterpolateDraggedArgs) => void;
|
|
36
|
-
snapPointsMap: import("@vueuse/core").ComputedRefWithControl<Record<number,
|
|
36
|
+
snapPointsMap: import("@vueuse/core").ComputedRefWithControl<Record<number, MagicDrawerSnapPoint>>;
|
|
37
37
|
drawerHeight: import("vue").ComputedRef<number>;
|
|
38
38
|
drawerWidth: import("vue").ComputedRef<number>;
|
|
39
39
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MagicDrawerSnapPoint, MagicDrawerOptions } from '../types/index.js';
|
|
3
3
|
export declare function useMagicDrawer(id: MaybeRef<string>, options?: MagicDrawerOptions): {
|
|
4
4
|
isActive: import("vue").ComputedRef<boolean>;
|
|
5
5
|
progress: import("vue").Ref<{
|
|
@@ -12,6 +12,6 @@ export declare function useMagicDrawer(id: MaybeRef<string>, options?: MagicDraw
|
|
|
12
12
|
state: import("../types/index.js").DrawerState;
|
|
13
13
|
open: () => void;
|
|
14
14
|
close: () => void;
|
|
15
|
-
snapTo: (snapPoint:
|
|
15
|
+
snapTo: (snapPoint: MagicDrawerSnapPoint, duration?: number) => void;
|
|
16
16
|
};
|
|
17
17
|
export type UseMagicDrawerReturn = ReturnType<typeof useMagicDrawer>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Options as FocusTrapOptions } from 'focus-trap';
|
|
2
2
|
import type { RequireAllNested } from '@maas/vue-equipment/utils';
|
|
3
|
-
export type
|
|
3
|
+
export type MagicDrawerSnapPoint = number | `${number}px`;
|
|
4
4
|
export type DrawerSnapMode = 'closest' | 'step';
|
|
5
5
|
export interface MagicDrawerOptions {
|
|
6
6
|
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
@@ -9,7 +9,7 @@ export interface MagicDrawerOptions {
|
|
|
9
9
|
scrollLock?: boolean | {
|
|
10
10
|
padding: boolean;
|
|
11
11
|
};
|
|
12
|
-
snapPoints?:
|
|
12
|
+
snapPoints?: MagicDrawerSnapPoint[];
|
|
13
13
|
snap?: {
|
|
14
14
|
mode?: DrawerSnapMode;
|
|
15
15
|
};
|
|
@@ -35,7 +35,7 @@ export interface MagicDrawerOptions {
|
|
|
35
35
|
initial?: {
|
|
36
36
|
open?: boolean;
|
|
37
37
|
transition?: boolean;
|
|
38
|
-
snapPoint?:
|
|
38
|
+
snapPoint?: MagicDrawerSnapPoint;
|
|
39
39
|
};
|
|
40
40
|
keyListener?: {
|
|
41
41
|
close?: string[] | false;
|
|
@@ -79,6 +79,10 @@ export interface DrawerState {
|
|
|
79
79
|
wrapperRect: DOMRect | undefined;
|
|
80
80
|
options: RequiredMagicDrawerOptions;
|
|
81
81
|
}
|
|
82
|
+
export interface MagicDrawerWillSnapToPayload {
|
|
83
|
+
id: string;
|
|
84
|
+
snapPoint: MagicDrawerSnapPoint;
|
|
85
|
+
}
|
|
82
86
|
export type DrawerEvents = {
|
|
83
87
|
beforeEnter: string;
|
|
84
88
|
enter: string;
|
|
@@ -88,16 +92,16 @@ export type DrawerEvents = {
|
|
|
88
92
|
afterLeave: string;
|
|
89
93
|
beforeSnap: {
|
|
90
94
|
id: string;
|
|
91
|
-
snapPoint:
|
|
95
|
+
snapPoint: MagicDrawerSnapPoint;
|
|
92
96
|
};
|
|
93
97
|
snapTo: {
|
|
94
98
|
id: string;
|
|
95
|
-
snapPoint:
|
|
99
|
+
snapPoint: MagicDrawerSnapPoint;
|
|
96
100
|
duration?: number;
|
|
97
101
|
};
|
|
98
102
|
afterSnap: {
|
|
99
103
|
id: string;
|
|
100
|
-
snapPoint:
|
|
104
|
+
snapPoint: MagicDrawerSnapPoint;
|
|
101
105
|
};
|
|
102
106
|
beforeDrag: {
|
|
103
107
|
id: string;
|
|
@@ -119,6 +123,7 @@ export type DrawerEvents = {
|
|
|
119
123
|
x: number;
|
|
120
124
|
y: number;
|
|
121
125
|
};
|
|
126
|
+
willSnapTo: MagicDrawerWillSnapToPayload;
|
|
122
127
|
};
|
|
123
128
|
export interface DrawerActive {
|
|
124
129
|
innerActive: boolean;
|