@maas/vue-equipment 0.27.0 → 0.27.2

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment/nuxt",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.26.5"
4
+ "version": "0.27.1"
5
5
  }
@@ -18,7 +18,7 @@ const functions$1 = [
18
18
  {
19
19
  name: "MagicDraggable",
20
20
  "package": "plugins",
21
- lastUpdated: 1712936178000,
21
+ lastUpdated: 1714995800000,
22
22
  docs: "https://maas.egineering/vue-equipment/plugins/MagicDraggable/",
23
23
  description: "draggable"
24
24
  },
@@ -1,5 +1,7 @@
1
1
  import type { Plugin } from 'vue';
2
2
  import MagicDraggable from './src/components/MagicDraggable.vue.js';
3
3
  import { useDraggableApi } from './src/composables/useDraggableApi.js';
4
+ import type { DraggableOptions } from './src/types.js';
4
5
  declare const MagicDraggablePlugin: Plugin;
5
6
  export { MagicDraggablePlugin, MagicDraggable, useDraggableApi };
7
+ export type { DraggableOptions };
@@ -276,6 +276,7 @@ export function useDraggableDrag(args) {
276
276
  }
277
277
  await nextTick();
278
278
  if (toValue(initial).snapPoint) {
279
+ activeSnapPoint.value = toValue(initial).snapPoint;
279
280
  const mappedSnapPoint = mapSnapPoint(toValue(initial).snapPoint);
280
281
  if (mappedSnapPoint) {
281
282
  draggedX.value = mappedSnapPoint.x;
@@ -292,6 +293,15 @@ export function useDraggableDrag(args) {
292
293
  }
293
294
  }, 100)();
294
295
  });
296
+ useResizeObserver(elRef, async () => {
297
+ useThrottleFn(async () => {
298
+ await getSizes();
299
+ if (activeSnapPoint.value) {
300
+ await snapTo({ snapPoint: activeSnapPoint.value, interpolate: false });
301
+ snapPointsMap.trigger();
302
+ }
303
+ }, 100)();
304
+ });
295
305
  const { idle } = useIdle(toValue(threshold).idle);
296
306
  watch(idle, (value) => {
297
307
  if (value && dragging.value) {
@@ -22,7 +22,7 @@ type SnapToArgs = {
22
22
  };
23
23
  export declare function useDraggableSnap(args: UseDraggableSnapArgs): {
24
24
  mappedSnapPoints: import("@vueuse/core").ComputedRefWithControl<Coordinates[]>;
25
- activeSnapPoint: Ref<("center" | "top-center" | "bottom-center" | "top-left" | "top-right" | "center-left" | "center-right" | "bottom-left" | "bottom-right") | ["center" | "top-center" | "bottom-center" | "top-left" | "top-right" | "center-left" | "center-right" | "bottom-left" | "bottom-right", offset?: {
25
+ activeSnapPoint: Ref<("center" | "top-left" | "top-center" | "top-right" | "center-left" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right") | ["center" | "top-left" | "top-center" | "top-right" | "center-left" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right", offset?: {
26
26
  x?: number | undefined;
27
27
  y?: number | undefined;
28
28
  } | undefined] | undefined>;
@@ -26,7 +26,7 @@ export interface DraggableOptions {
26
26
  initial?: {
27
27
  snapPoint?: SnapPoint;
28
28
  };
29
- snapPoints: SnapPoint[];
29
+ snapPoints?: SnapPoint[];
30
30
  disabled?: boolean;
31
31
  }
32
32
  export interface DraggableState {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "description": "A magic collection of Vue composables, plugins, components and directives",
4
- "version": "0.27.0",
4
+ "version": "0.27.2",
5
5
  "author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
6
6
  "devDependencies": {
7
7
  "@antfu/ni": "^0.21.12",