@maas/vue-equipment 0.28.1 → 0.28.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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment/nuxt",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.28.0"
4
+ "version": "0.28.2"
5
5
  }
@@ -14,9 +14,6 @@ import { MagicCommandInstanceId, MagicCommandOptions } from '../symbols'
14
14
 
15
15
  import type { CommandOptions } from './../types/index'
16
16
 
17
- import '@maas/vue-equipment/utils/css/animations/fade-in.css'
18
- import '@maas/vue-equipment/utils/css/animations/fade-out.css'
19
-
20
17
  // Prevent keys arrays from being merged with default
21
18
  const customDefu = createDefu((obj, key, value) => {
22
19
  if (key === 'open' || key === 'close' || key === 'next' || key === 'prev') {
@@ -1,7 +1,5 @@
1
1
  import { type MaybeRef } from 'vue';
2
2
  import type { CommandOptions } from './../types/index';
3
- import '@maas/vue-equipment/utils/css/animations/fade-in.css';
4
- import '@maas/vue-equipment/utils/css/animations/fade-out.css';
5
3
  interface MagicCommandProps {
6
4
  id: MaybeRef<string>;
7
5
  options?: CommandOptions;
@@ -1,9 +1,4 @@
1
- import {
2
- defineNuxtModule,
3
- createResolver,
4
- addComponent,
5
- addImports
6
- } from "@nuxt/kit";
1
+ import { defineNuxtModule, createResolver, addComponent } from "@nuxt/kit";
7
2
  export default defineNuxtModule({
8
3
  meta: {
9
4
  name: "@maas/vue-equipment/nuxt/MagicDraggable"
@@ -15,9 +10,5 @@ export default defineNuxtModule({
15
10
  name: "MagicDraggable",
16
11
  global: true
17
12
  });
18
- addImports({
19
- from: "@maas/vue-equipment/plugins/MagicDraggable",
20
- name: "useDraggableApi"
21
- });
22
13
  }
23
14
  });
@@ -181,6 +181,7 @@ const { onPointerdown, onClick, style, hasDragged } = useDrawerDrag({
181
181
  animation,
182
182
  initial,
183
183
  preventDragClose,
184
+ disabled,
184
185
  close,
185
186
  })
186
187
 
@@ -11,6 +11,7 @@ type UseDrawerDragArgs = {
11
11
  initial: MaybeRef<DefaultOptions['initial']>;
12
12
  animation: MaybeRef<DefaultOptions['animation']>;
13
13
  preventDragClose: MaybeRef<DefaultOptions['preventDragClose']>;
14
+ disabled: MaybeRef<boolean>;
14
15
  overshoot: MaybeRef<number>;
15
16
  close: () => void;
16
17
  };
@@ -32,6 +32,7 @@ export function useDrawerDrag(args) {
32
32
  initial,
33
33
  animation,
34
34
  preventDragClose,
35
+ disabled,
35
36
  close
36
37
  } = args;
37
38
  const { findState } = useDrawerState(toValue(id));
@@ -281,6 +282,24 @@ export function useDrawerDrag(args) {
281
282
  }
282
283
  }
283
284
  }
285
+ function onCancel() {
286
+ switch (position) {
287
+ case "bottom":
288
+ case "top":
289
+ interpolateDragged({
290
+ to: snappedY.value
291
+ });
292
+ break;
293
+ case "right":
294
+ case "left":
295
+ interpolateDragged({
296
+ to: snappedX.value
297
+ });
298
+ break;
299
+ }
300
+ resetStateAndListeners();
301
+ resetScrollLock();
302
+ }
284
303
  function onPointerup(e) {
285
304
  if (shouldClose.value) {
286
305
  close();
@@ -401,6 +420,14 @@ export function useDrawerDrag(args) {
401
420
  lastDraggedX.value = x;
402
421
  lastDraggedY.value = y;
403
422
  });
423
+ watch(
424
+ () => toValue(disabled),
425
+ (value) => {
426
+ if (value) {
427
+ onCancel();
428
+ }
429
+ }
430
+ );
404
431
  useResizeObserver(elRef, async () => {
405
432
  useThrottleFn(async () => {
406
433
  await getSizes();
@@ -17,7 +17,7 @@ export default defineNuxtModule({
17
17
  });
18
18
  addImports({
19
19
  from: "@maas/vue-equipment/plugins/MagicToast",
20
- name: "useToastApi"
20
+ name: "useMagicToast"
21
21
  });
22
22
  }
23
23
  });
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.28.1",
4
+ "version": "0.28.3",
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",