@maas/vue-equipment 0.28.4 → 0.29.1

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 (24) hide show
  1. package/dist/nuxt/module.json +1 -1
  2. package/dist/nuxt/module.mjs +1 -1
  3. package/dist/plugins/MagicDraggable/index.d.ts +2 -2
  4. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +2 -2
  5. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +28 -2
  6. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.d.ts +5 -4
  7. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +11 -1
  8. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.d.ts +1 -103
  9. package/dist/plugins/MagicDraggable/src/composables/private/useDraggableState.mjs +2 -3
  10. package/dist/plugins/MagicDraggable/src/types/index.d.ts +38 -3
  11. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +2 -2
  12. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +2 -2
  13. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerGuards.d.ts +2 -2
  14. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerProgress.mjs +2 -2
  15. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerSnap.d.ts +4 -4
  16. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.d.ts +1 -1
  17. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerState.mjs +2 -2
  18. package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.mjs +2 -2
  19. package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.d.ts +2 -2
  20. package/dist/plugins/MagicDrawer/src/composables/useMagicDrawer.mjs +2 -2
  21. package/dist/plugins/MagicDrawer/src/types/index.d.ts +6 -6
  22. package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +394 -58
  23. package/dist/plugins/MagicEmitter/src/types/index.d.ts +5 -3
  24. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment/nuxt",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.28.3"
4
+ "version": "0.29.0"
5
5
  }
@@ -18,7 +18,7 @@ const functions$1 = [
18
18
  {
19
19
  name: "MagicDraggable",
20
20
  "package": "plugins",
21
- lastUpdated: 1715012147000,
21
+ lastUpdated: 1716453773000,
22
22
  docs: "https://maas.egineering/vue-equipment/plugins/MagicDraggable/",
23
23
  description: "draggable"
24
24
  },
@@ -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 } from './src/types.js';
3
+ import type { DraggableOptions, DraggableEvents } from './src/types.js';
4
4
  declare const MagicDraggablePlugin: Plugin;
5
5
  export { MagicDraggablePlugin, MagicDraggable };
6
- export type { DraggableOptions };
6
+ export type { DraggableOptions, DraggableEvents };
@@ -62,8 +62,8 @@ const mappedOptions = defu(props.options, defaultOptions)
62
62
  const elRef = ref<HTMLElement | undefined>(undefined)
63
63
  const wrapperRef = ref<HTMLDivElement | undefined>(undefined)
64
64
 
65
- const { findState } = useDraggableState(props.id)
66
- const { dragging } = findState()
65
+ const { initializeState } = useDraggableState(props.id)
66
+ const { dragging } = initializeState()
67
67
 
68
68
  // Make sure this is reactive
69
69
  const disabled = computed(() => {
@@ -13,12 +13,13 @@ import {
13
13
  useIdle
14
14
  } from "@vueuse/core";
15
15
  import { isIOS, isWithinRange } from "@maas/vue-equipment/utils";
16
+ import { useMagicEmitter } from "@maas/vue-equipment/plugins";
16
17
  import { useDraggableSnap } from "./useDraggableSnap.mjs";
17
18
  import { useDraggableState } from "./useDraggableState.mjs";
18
19
  import { useDraggableScrollLock } from "./useDraggableScrollLock.mjs";
19
20
  export function useDraggableDrag(args) {
20
21
  const { id, elRef, wrapperRef, threshold, snapPoints, initial, animation } = args;
21
- const { findState } = useDraggableState(toValue(id));
22
+ const { initializeState } = useDraggableState(toValue(id));
22
23
  const {
23
24
  dragStart,
24
25
  dragging,
@@ -33,7 +34,7 @@ export function useDraggableDrag(args) {
33
34
  draggedY,
34
35
  elRect,
35
36
  wrapperRect
36
- } = findState();
37
+ } = initializeState();
37
38
  let cancelPointerup = void 0;
38
39
  let cancelPointermove = void 0;
39
40
  let cancelTouchend = void 0;
@@ -63,6 +64,7 @@ export function useDraggableDrag(args) {
63
64
  snapPointsMap,
64
65
  interpolateDragged
65
66
  } = useDraggableSnap({
67
+ id,
66
68
  elRect,
67
69
  wrapperRect,
68
70
  animation,
@@ -70,6 +72,7 @@ export function useDraggableDrag(args) {
70
72
  draggedY,
71
73
  draggedX
72
74
  });
75
+ const emitter = useMagicEmitter();
73
76
  const {
74
77
  lockScroll,
75
78
  unlockScroll,
@@ -236,6 +239,19 @@ export function useDraggableDrag(args) {
236
239
  const key = `x${interpolateTo.value.x}y${interpolateTo.value.y}`;
237
240
  activeSnapPoint.value = snapPointsMap.value[key];
238
241
  }
242
+ if (intermediateDraggedX.value === draggedX.value && intermediateDraggedY.value === draggedY.value) {
243
+ emitter.emit("dragCanceled", {
244
+ id: toValue(id),
245
+ x: draggedX.value,
246
+ y: draggedY.value
247
+ });
248
+ } else {
249
+ emitter.emit("afterDrag", {
250
+ id: toValue(id),
251
+ x: draggedX.value,
252
+ y: draggedY.value
253
+ });
254
+ }
239
255
  resetStateAndListeners();
240
256
  unlockScroll();
241
257
  removeScrollLockPadding();
@@ -260,6 +276,11 @@ export function useDraggableDrag(args) {
260
276
  if (toValue(snapPoints).length) {
261
277
  findSnapPointByVector();
262
278
  }
279
+ emitter.emit("drag", {
280
+ id: toValue(id),
281
+ x: draggedX.value,
282
+ y: draggedY.value
283
+ });
263
284
  }
264
285
  function onIdle() {
265
286
  interpolateTo.value = findClosestSnapPoint();
@@ -277,6 +298,11 @@ export function useDraggableDrag(args) {
277
298
  return;
278
299
  } else {
279
300
  dragging.value = true;
301
+ emitter.emit("beforeDrag", {
302
+ id: toValue(id),
303
+ x: draggedX.value,
304
+ y: draggedY.value
305
+ });
280
306
  }
281
307
  intermediateDraggedX.value = draggedX.value;
282
308
  intermediateDraggedY.value = draggedY.value;
@@ -1,7 +1,8 @@
1
1
  import { type MaybeRef, type Ref } from 'vue';
2
2
  import { type DefaultOptions } from '../../utils/defaultOptions.js';
3
- import type { SnapPoint, Coordinates } from '../../types.js';
3
+ import type { DraggableSnapPoint, Coordinates } from '../../types.js';
4
4
  type UseDraggableSnapArgs = {
5
+ id: MaybeRef<string>;
5
6
  elRect: Ref<DOMRect | undefined>;
6
7
  wrapperRect: Ref<DOMRect | undefined>;
7
8
  draggedY: Ref<number>;
@@ -16,7 +17,7 @@ type InterpolateDraggedArgs = {
16
17
  easing?: (t: number) => number;
17
18
  };
18
19
  type SnapToArgs = {
19
- snapPoint: SnapPoint;
20
+ snapPoint: DraggableSnapPoint;
20
21
  interpolate?: boolean;
21
22
  duration?: number;
22
23
  };
@@ -26,8 +27,8 @@ export declare function useDraggableSnap(args: UseDraggableSnapArgs): {
26
27
  x?: number | undefined;
27
28
  y?: number | undefined;
28
29
  } | undefined] | undefined>;
29
- snapPointsMap: import("@vueuse/core").ComputedRefWithControl<Record<string, SnapPoint>>;
30
- mapSnapPoint: (snapPoint: SnapPoint) => Coordinates | undefined;
30
+ snapPointsMap: import("@vueuse/core").ComputedRefWithControl<Record<string, DraggableSnapPoint>>;
31
+ mapSnapPoint: (snapPoint: DraggableSnapPoint) => Coordinates | undefined;
31
32
  interpolateDragged: (args: InterpolateDraggedArgs) => void;
32
33
  snapTo: (args: SnapToArgs) => Promise<void>;
33
34
  };
@@ -1,9 +1,10 @@
1
1
  import { ref, toValue, nextTick } from "vue";
2
2
  import { computedWithControl } from "@vueuse/core";
3
3
  import { interpolate } from "@maas/vue-equipment/utils";
4
+ import { useMagicEmitter } from "@maas/vue-equipment/plugins";
4
5
  import { defu } from "defu";
5
6
  export function useDraggableSnap(args) {
6
- const { draggedY, draggedX, elRect, wrapperRect, animation, snapPoints } = args;
7
+ const { id, draggedY, draggedX, elRect, wrapperRect, animation, snapPoints } = args;
7
8
  const activeSnapPoint = ref(void 0);
8
9
  const mappedSnapPoints = computedWithControl(
9
10
  () => toValue(wrapperRect),
@@ -28,6 +29,7 @@ export function useDraggableSnap(args) {
28
29
  return mapped;
29
30
  }
30
31
  );
32
+ const emitter = useMagicEmitter();
31
33
  function mapSnapPoint(snapPoint) {
32
34
  if (!wrapperRect.value) {
33
35
  console.warn("Wrapper rect is not defined");
@@ -95,6 +97,8 @@ export function useDraggableSnap(args) {
95
97
  duration = toValue(animation).snap?.duration,
96
98
  easing = toValue(animation).snap?.easing
97
99
  } = args2;
100
+ const snapPoint = snapPointsMap.value[`x${x}y${y}`];
101
+ emitter.emit("beforeSnap", { id: toValue(id), snapPoint });
98
102
  interpolate({
99
103
  from: draggedY.value,
100
104
  to: y,
@@ -102,6 +106,9 @@ export function useDraggableSnap(args) {
102
106
  easing,
103
107
  callback: (value) => {
104
108
  draggedY.value = value;
109
+ if (y > x && draggedY.value === y) {
110
+ emitter.emit("afterSnap", { id: toValue(id), snapPoint });
111
+ }
105
112
  }
106
113
  });
107
114
  interpolate({
@@ -111,6 +118,9 @@ export function useDraggableSnap(args) {
111
118
  easing,
112
119
  callback: (value) => {
113
120
  draggedX.value = value;
121
+ if (x >= y && draggedX.value === x) {
122
+ emitter.emit("afterSnap", { id: toValue(id), snapPoint });
123
+ }
114
124
  }
115
125
  });
116
126
  }
@@ -1,108 +1,6 @@
1
1
  import { type MaybeRef } from 'vue';
2
2
  import type { DraggableState } from '../../types/index.js';
3
3
  export declare function useDraggableState(id: MaybeRef<string>): {
4
- addState: (id: string) => {
5
- id: string;
6
- dragStart: {
7
- toString: () => string;
8
- toDateString: () => string;
9
- toTimeString: () => string;
10
- toLocaleString: {
11
- (): string;
12
- (locales?: string | string[] | undefined, options?: Intl.DateTimeFormatOptions | undefined): string;
13
- (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
14
- };
15
- toLocaleDateString: {
16
- (): string;
17
- (locales?: string | string[] | undefined, options?: Intl.DateTimeFormatOptions | undefined): string;
18
- (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
19
- };
20
- toLocaleTimeString: {
21
- (): string;
22
- (locales?: string | string[] | undefined, options?: Intl.DateTimeFormatOptions | undefined): string;
23
- (locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;
24
- };
25
- valueOf: () => number;
26
- getTime: () => number;
27
- getFullYear: () => number;
28
- getUTCFullYear: () => number;
29
- getMonth: () => number;
30
- getUTCMonth: () => number;
31
- getDate: () => number;
32
- getUTCDate: () => number;
33
- getDay: () => number;
34
- getUTCDay: () => number;
35
- getHours: () => number;
36
- getUTCHours: () => number;
37
- getMinutes: () => number;
38
- getUTCMinutes: () => number;
39
- getSeconds: () => number;
40
- getUTCSeconds: () => number;
41
- getMilliseconds: () => number;
42
- getUTCMilliseconds: () => number;
43
- getTimezoneOffset: () => number;
44
- setTime: (time: number) => number;
45
- setMilliseconds: (ms: number) => number;
46
- setUTCMilliseconds: (ms: number) => number;
47
- setSeconds: (sec: number, ms?: number | undefined) => number;
48
- setUTCSeconds: (sec: number, ms?: number | undefined) => number;
49
- setMinutes: (min: number, sec?: number | undefined, ms?: number | undefined) => number;
50
- setUTCMinutes: (min: number, sec?: number | undefined, ms?: number | undefined) => number;
51
- setHours: (hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => number;
52
- setUTCHours: (hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => number;
53
- setDate: (date: number) => number;
54
- setUTCDate: (date: number) => number;
55
- setMonth: (month: number, date?: number | undefined) => number;
56
- setUTCMonth: (month: number, date?: number | undefined) => number;
57
- setFullYear: (year: number, month?: number | undefined, date?: number | undefined) => number;
58
- setUTCFullYear: (year: number, month?: number | undefined, date?: number | undefined) => number;
59
- toUTCString: () => string;
60
- toISOString: () => string;
61
- toJSON: (key?: any) => string;
62
- getVarDate: () => VarDate;
63
- [Symbol.toPrimitive]: {
64
- (hint: "default"): string;
65
- (hint: "string"): string;
66
- (hint: "number"): number;
67
- (hint: string): string | number;
68
- };
69
- } | undefined;
70
- dragging: boolean;
71
- interpolateTo: {
72
- x: number;
73
- y: number;
74
- } | undefined;
75
- originX: number;
76
- originY: number;
77
- lastDraggedX: number;
78
- lastDraggedY: number;
79
- intermediateDraggedX: number;
80
- intermediateDraggedY: number;
81
- draggedX: number;
82
- draggedY: number;
83
- elRect: {
84
- height: number;
85
- width: number;
86
- x: number;
87
- y: number;
88
- readonly bottom: number;
89
- readonly left: number;
90
- readonly right: number;
91
- readonly top: number;
92
- toJSON: () => any;
93
- } | undefined;
94
- wrapperRect: {
95
- height: number;
96
- width: number;
97
- x: number;
98
- y: number;
99
- readonly bottom: number;
100
- readonly left: number;
101
- readonly right: number;
102
- readonly top: number;
103
- toJSON: () => any;
104
- } | undefined;
105
- };
106
- findState: () => import("vue").ToRefs<DraggableState>;
4
+ initializeState: () => import("vue").ToRefs<DraggableState>;
107
5
  deleteState: () => void;
108
6
  };
@@ -25,7 +25,7 @@ export function useDraggableState(id) {
25
25
  drawerStateStore.value = [...drawerStateStore.value, instance];
26
26
  return instance;
27
27
  }
28
- function findState() {
28
+ function initializeState() {
29
29
  let instance = drawerStateStore.value.find((instance2) => {
30
30
  return instance2.id === id;
31
31
  });
@@ -39,8 +39,7 @@ export function useDraggableState(id) {
39
39
  );
40
40
  }
41
41
  return {
42
- addState,
43
- findState,
42
+ initializeState,
44
43
  deleteState
45
44
  };
46
45
  }
@@ -3,7 +3,7 @@ export type Coordinates = {
3
3
  x: number;
4
4
  y: number;
5
5
  };
6
- export type SnapPoint = [
6
+ export type DraggableSnapPoint = [
7
7
  Position,
8
8
  offset?: {
9
9
  x?: number;
@@ -25,9 +25,9 @@ export interface DraggableOptions {
25
25
  };
26
26
  };
27
27
  initial?: {
28
- snapPoint?: SnapPoint;
28
+ snapPoint?: DraggableSnapPoint;
29
29
  };
30
- snapPoints?: SnapPoint[];
30
+ snapPoints?: DraggableSnapPoint[];
31
31
  disabled?: boolean;
32
32
  }
33
33
  export interface DraggableState {
@@ -46,4 +46,39 @@ export interface DraggableState {
46
46
  elRect: DOMRect | undefined;
47
47
  wrapperRect: DOMRect | undefined;
48
48
  }
49
+ export type DraggableEvents = {
50
+ beforeSnap: {
51
+ id: string;
52
+ snapPoint: DraggableSnapPoint;
53
+ };
54
+ snapTo: {
55
+ id: string;
56
+ snapPoint: DraggableSnapPoint;
57
+ duration?: number;
58
+ };
59
+ afterSnap: {
60
+ id: string;
61
+ snapPoint: DraggableSnapPoint;
62
+ };
63
+ beforeDrag: {
64
+ id: string;
65
+ x: number;
66
+ y: number;
67
+ };
68
+ drag: {
69
+ id: string;
70
+ x: number;
71
+ y: number;
72
+ };
73
+ afterDrag: {
74
+ id: string;
75
+ x: number;
76
+ y: number;
77
+ };
78
+ dragCanceled: {
79
+ id: string;
80
+ x: number;
81
+ y: number;
82
+ };
83
+ };
49
84
  export {};
@@ -192,8 +192,8 @@ const { initializeWheelListener, destroyWheelListener } = useDrawerWheel({
192
192
  disabled,
193
193
  })
194
194
 
195
- const { findState } = useDrawerState(props.id)
196
- const { dragging, wheeling } = findState()
195
+ const { initializeState } = useDrawerState(props.id)
196
+ const { dragging, wheeling } = initializeState()
197
197
 
198
198
  // Split isActive into two values to animate drawer smoothly
199
199
  const innerActive = ref(false)
@@ -35,7 +35,7 @@ export function useDrawerDrag(args) {
35
35
  disabled,
36
36
  close
37
37
  } = args;
38
- const { findState } = useDrawerState(toValue(id));
38
+ const { initializeState } = useDrawerState(toValue(id));
39
39
  const {
40
40
  dragStart,
41
41
  dragging,
@@ -54,7 +54,7 @@ export function useDrawerDrag(args) {
54
54
  absDirectionY,
55
55
  elRect,
56
56
  wrapperRect
57
- } = findState();
57
+ } = initializeState();
58
58
  let cancelPointerup = void 0;
59
59
  let cancelPointermove = void 0;
60
60
  let cancelTouchend = void 0;
@@ -1,12 +1,12 @@
1
1
  import { type Ref, type MaybeRef } from 'vue';
2
2
  import { type DefaultOptions } from '../../utils/defaultOptions.js';
3
- import { type SnapPoint } from '../../types.js';
3
+ import { type DrawerSnapPoint } from '../../types.js';
4
4
  interface UseDrawerGuardsArgs {
5
5
  elRef: Ref<HTMLElement | undefined>;
6
6
  absDirectionX: MaybeRef<'with' | 'against' | undefined>;
7
7
  absDirectionY: MaybeRef<'with' | 'against' | undefined>;
8
8
  position: MaybeRef<DefaultOptions['position']>;
9
- activeSnapPoint: MaybeRef<SnapPoint | undefined>;
9
+ activeSnapPoint: MaybeRef<DrawerSnapPoint | undefined>;
10
10
  }
11
11
  export declare function useDrawerGuards(args: UseDrawerGuardsArgs): {
12
12
  canDrag: (el: EventTarget) => boolean;
@@ -12,7 +12,7 @@ import { useMagicEmitter } from "@maas/vue-equipment/plugins";
12
12
  import { useDrawerState } from "./useDrawerState.mjs";
13
13
  export function useDrawerProgress(args) {
14
14
  const { id, drawerRef, elRef, position, overshoot } = args;
15
- const { findState } = useDrawerState(id);
15
+ const { initializeState } = useDrawerState(id);
16
16
  const drawerRect = useElementBounding(drawerRef);
17
17
  const elRect = useElementBounding(elRef);
18
18
  const maxX = computed(
@@ -21,7 +21,7 @@ export function useDrawerProgress(args) {
21
21
  const maxY = computed(
22
22
  () => drawerRect.height.value - elRect.height.value + toValue(overshoot)
23
23
  );
24
- const { progress } = findState();
24
+ const { progress } = initializeState();
25
25
  function rafCallback() {
26
26
  drawerRect.update();
27
27
  elRect.update();
@@ -1,6 +1,6 @@
1
1
  import { type MaybeRef, type Ref } from 'vue';
2
2
  import { type DefaultOptions } from '../../utils/defaultOptions.js';
3
- import { type SnapPoint } from '../../types.js';
3
+ import { type DrawerSnapPoint } from '../../types.js';
4
4
  type UseDrawerSnapArgs = {
5
5
  id: MaybeRef<string>;
6
6
  wrapperRect: Ref<DOMRect | undefined>;
@@ -18,7 +18,7 @@ type FindClosestSnapPointArgs = {
18
18
  direction?: 'below' | 'above' | 'absolute';
19
19
  };
20
20
  type SnapToArgs = {
21
- snapPoint: SnapPoint;
21
+ snapPoint: DrawerSnapPoint;
22
22
  interpolate: boolean;
23
23
  duration?: number;
24
24
  };
@@ -30,11 +30,11 @@ type InterpolateDraggedArgs = {
30
30
  export declare function useDrawerSnap(args: UseDrawerSnapArgs): {
31
31
  snappedY: Ref<number>;
32
32
  snappedX: Ref<number>;
33
- activeSnapPoint: Ref<SnapPoint | undefined>;
33
+ activeSnapPoint: Ref<DrawerSnapPoint | undefined>;
34
34
  snapTo: (args: SnapToArgs) => Promise<void>;
35
35
  findClosestSnapPoint: (args: FindClosestSnapPointArgs) => number | undefined;
36
36
  interpolateDragged: (args: InterpolateDraggedArgs) => void;
37
- snapPointsMap: import("@vueuse/core").ComputedRefWithControl<Record<number, SnapPoint>>;
37
+ snapPointsMap: import("@vueuse/core").ComputedRefWithControl<Record<number, DrawerSnapPoint>>;
38
38
  drawerHeight: import("vue").ComputedRef<number>;
39
39
  drawerWidth: import("vue").ComputedRef<number>;
40
40
  };
@@ -108,6 +108,6 @@ export declare function useDrawerState(id: MaybeRef<string>): {
108
108
  toJSON: () => any;
109
109
  } | undefined;
110
110
  };
111
- findState: () => import("vue").ToRefs<DrawerState>;
111
+ initializeState: () => import("vue").ToRefs<DrawerState>;
112
112
  deleteState: () => void;
113
113
  };
@@ -33,7 +33,7 @@ export function useDrawerState(id) {
33
33
  drawerStateStore.value = [...drawerStateStore.value, instance];
34
34
  return instance;
35
35
  }
36
- function findState() {
36
+ function initializeState() {
37
37
  let instance = drawerStateStore.value.find((instance2) => {
38
38
  return instance2.id === id;
39
39
  });
@@ -48,7 +48,7 @@ export function useDrawerState(id) {
48
48
  }
49
49
  return {
50
50
  addState,
51
- findState,
51
+ initializeState,
52
52
  deleteState
53
53
  };
54
54
  }
@@ -7,8 +7,8 @@ import WheelGestures from "wheel-gestures";
7
7
  import { useDrawerState } from "./useDrawerState.mjs";
8
8
  export function useDrawerWheel(args) {
9
9
  const { id, elRef, position, disabled } = args;
10
- const { findState } = useDrawerState(toValue(id));
11
- const { dragging, wheeling } = findState();
10
+ const { initializeState } = useDrawerState(toValue(id));
11
+ const { dragging, wheeling } = initializeState();
12
12
  let startEvent;
13
13
  const axis = computed(() => {
14
14
  switch (toValue(position)) {
@@ -1,5 +1,5 @@
1
1
  import { type MaybeRef } from 'vue';
2
- import type { SnapPoint } from '../types/index.js';
2
+ import type { DrawerSnapPoint } from '../types/index.js';
3
3
  export declare function useMagicDrawer(id: MaybeRef<string>): {
4
4
  isActive: import("vue").ComputedRef<boolean>;
5
5
  progress: import("vue").Ref<{
@@ -8,6 +8,6 @@ export declare function useMagicDrawer(id: MaybeRef<string>): {
8
8
  }>;
9
9
  open: () => void;
10
10
  close: () => void;
11
- snapTo: (snapPoint: SnapPoint, duration?: number) => void;
11
+ snapTo: (snapPoint: DrawerSnapPoint, duration?: number) => void;
12
12
  };
13
13
  export type UseMagicDrawerReturn = ReturnType<typeof useMagicDrawer>;
@@ -4,8 +4,8 @@ import { useDrawerStore } from "./private/useDrawerStore.mjs";
4
4
  import { useDrawerState } from "./private/useDrawerState.mjs";
5
5
  export function useMagicDrawer(id) {
6
6
  const { drawerStore, addInstance, removeInstance } = useDrawerStore();
7
- const { deleteState, findState } = useDrawerState(toValue(id));
8
- const { progress } = findState();
7
+ const { deleteState, initializeState } = useDrawerState(toValue(id));
8
+ const { progress } = initializeState();
9
9
  const isActive = computed(() => drawerStore.value.includes(toValue(id)));
10
10
  function open() {
11
11
  addInstance(toValue(id));
@@ -1,5 +1,5 @@
1
1
  import { type Options } from 'focus-trap';
2
- export type SnapPoint = number | `${string}px`;
2
+ export type DrawerSnapPoint = number | `${string}px`;
3
3
  export interface DrawerOptions {
4
4
  position?: 'top' | 'right' | 'bottom' | 'left';
5
5
  backdrop?: boolean;
@@ -8,7 +8,7 @@ export interface DrawerOptions {
8
8
  scrollLock?: boolean | {
9
9
  padding: boolean;
10
10
  };
11
- snapPoints?: SnapPoint[];
11
+ snapPoints?: DrawerSnapPoint[];
12
12
  teleport?: {
13
13
  target?: string;
14
14
  disabled?: boolean;
@@ -31,7 +31,7 @@ export interface DrawerOptions {
31
31
  initial?: {
32
32
  open?: boolean;
33
33
  transition?: boolean;
34
- snapPoint?: SnapPoint;
34
+ snapPoint?: DrawerSnapPoint;
35
35
  };
36
36
  keyListener?: {
37
37
  close?: string[] | false;
@@ -74,16 +74,16 @@ export type DrawerEvents = {
74
74
  afterLeave: string;
75
75
  beforeSnap: {
76
76
  id: string;
77
- snapPoint: SnapPoint;
77
+ snapPoint: DrawerSnapPoint;
78
78
  };
79
79
  snapTo: {
80
80
  id: string;
81
- snapPoint: SnapPoint;
81
+ snapPoint: DrawerSnapPoint;
82
82
  duration?: number;
83
83
  };
84
84
  afterSnap: {
85
85
  id: string;
86
- snapPoint: SnapPoint;
86
+ snapPoint: DrawerSnapPoint;
87
87
  };
88
88
  beforeDrag: {
89
89
  id: string;