@vueuse/integrations 10.2.1 → 10.4.0

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 (89) hide show
  1. package/index.cjs +62 -214
  2. package/index.d.cts +427 -0
  3. package/index.d.mts +427 -0
  4. package/index.d.ts +8 -18
  5. package/index.iife.js +62 -214
  6. package/index.iife.min.js +1 -1
  7. package/index.mjs +64 -216
  8. package/package.json +10 -26
  9. package/useAsyncValidator/component.cjs +5 -29
  10. package/useAsyncValidator/component.d.cts +27 -0
  11. package/useAsyncValidator/component.d.mts +27 -0
  12. package/useAsyncValidator/component.mjs +5 -29
  13. package/useAsyncValidator.cjs +5 -29
  14. package/useAsyncValidator.d.cts +48 -0
  15. package/useAsyncValidator.d.mts +48 -0
  16. package/useAsyncValidator.d.ts +1 -1
  17. package/useAsyncValidator.iife.js +5 -29
  18. package/useAsyncValidator.iife.min.js +1 -1
  19. package/useAsyncValidator.mjs +5 -29
  20. package/useAxios.cjs +8 -25
  21. package/useAxios.d.cts +94 -0
  22. package/useAxios.d.mts +94 -0
  23. package/useAxios.d.ts +1 -1
  24. package/useAxios.iife.js +8 -25
  25. package/useAxios.iife.min.js +1 -1
  26. package/useAxios.mjs +8 -25
  27. package/useChangeCase.d.cts +24 -0
  28. package/useChangeCase.d.mts +24 -0
  29. package/useChangeCase.d.ts +2 -14
  30. package/useCookies.cjs +2 -18
  31. package/useCookies.d.cts +54 -0
  32. package/useCookies.d.mts +54 -0
  33. package/useCookies.iife.js +2 -18
  34. package/useCookies.iife.min.js +1 -1
  35. package/useCookies.mjs +2 -18
  36. package/useDrauu.cjs +8 -43
  37. package/useDrauu.d.cts +32 -0
  38. package/useDrauu.d.mts +32 -0
  39. package/useDrauu.d.ts +1 -1
  40. package/useDrauu.iife.js +8 -43
  41. package/useDrauu.iife.min.js +1 -1
  42. package/useDrauu.mjs +8 -43
  43. package/useFocusTrap/component.d.cts +17 -0
  44. package/useFocusTrap/component.d.mts +17 -0
  45. package/useFocusTrap/component.d.ts +1 -1
  46. package/useFocusTrap.cjs +4 -34
  47. package/useFocusTrap.d.cts +57 -0
  48. package/useFocusTrap.d.mts +57 -0
  49. package/useFocusTrap.d.ts +1 -1
  50. package/useFocusTrap.iife.js +4 -34
  51. package/useFocusTrap.iife.min.js +1 -1
  52. package/useFocusTrap.mjs +4 -34
  53. package/useFuse.cjs +5 -9
  54. package/useFuse.d.cts +25 -0
  55. package/useFuse.d.mts +25 -0
  56. package/useFuse.d.ts +1 -1
  57. package/useFuse.iife.js +5 -9
  58. package/useFuse.iife.min.js +1 -1
  59. package/useFuse.mjs +5 -9
  60. package/useIDBKeyval.cjs +17 -19
  61. package/useIDBKeyval.d.cts +43 -0
  62. package/useIDBKeyval.d.mts +43 -0
  63. package/useIDBKeyval.d.ts +8 -6
  64. package/useIDBKeyval.iife.js +18 -21
  65. package/useIDBKeyval.iife.min.js +1 -1
  66. package/useIDBKeyval.mjs +18 -20
  67. package/useJwt.cjs +1 -1
  68. package/useJwt.d.cts +29 -0
  69. package/useJwt.d.mts +29 -0
  70. package/useJwt.d.ts +1 -1
  71. package/useJwt.iife.js +1 -1
  72. package/useJwt.iife.min.js +1 -1
  73. package/useJwt.mjs +1 -1
  74. package/useNProgress.d.cts +20 -0
  75. package/useNProgress.d.mts +20 -0
  76. package/useNProgress.d.ts +1 -1
  77. package/useQRCode.d.cts +14 -0
  78. package/useQRCode.d.mts +14 -0
  79. package/useSortable/component.cjs +13 -36
  80. package/useSortable/component.d.cts +40 -0
  81. package/useSortable/component.d.mts +40 -0
  82. package/useSortable/component.mjs +14 -37
  83. package/useSortable.cjs +13 -36
  84. package/useSortable.d.cts +26 -0
  85. package/useSortable.d.mts +26 -0
  86. package/useSortable.d.ts +1 -1
  87. package/useSortable.iife.js +13 -36
  88. package/useSortable.iife.min.js +1 -1
  89. package/useSortable.mjs +14 -37
package/useSortable.mjs CHANGED
@@ -1,65 +1,42 @@
1
1
  import { tryOnMounted, tryOnScopeDispose, toValue, unrefElement, defaultDocument } from '@vueuse/core';
2
2
  import Sortable from 'sortablejs';
3
- import { nextTick } from 'vue-demi';
3
+ import { isRef, nextTick } from 'vue-demi';
4
4
 
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
5
  function useSortable(el, list, options = {}) {
34
6
  let sortable;
35
- const _a = options, { document = defaultDocument } = _a, resetOptions = __objRest(_a, ["document"]);
7
+ const { document = defaultDocument, ...resetOptions } = options;
36
8
  const defaultOptions = {
37
9
  onUpdate: (e) => {
38
10
  moveArrayElement(list, e.oldIndex, e.newIndex);
39
11
  }
40
12
  };
41
13
  const start = () => {
42
- const target = typeof el === "string" ? document == null ? void 0 : document.querySelector(el) : unrefElement(el);
14
+ const target = typeof el === "string" ? document?.querySelector(el) : unrefElement(el);
43
15
  if (!target)
44
16
  return;
45
- sortable = new Sortable(target, __spreadValues(__spreadValues({}, defaultOptions), resetOptions));
17
+ sortable = new Sortable(target, { ...defaultOptions, ...resetOptions });
46
18
  };
47
- const stop = () => sortable == null ? void 0 : sortable.destroy();
19
+ const stop = () => sortable?.destroy();
48
20
  const option = (name, value) => {
49
21
  if (value !== void 0)
50
- sortable == null ? void 0 : sortable.option(name, value);
22
+ sortable?.option(name, value);
51
23
  else
52
- return sortable == null ? void 0 : sortable.option(name);
24
+ return sortable?.option(name);
53
25
  };
54
26
  tryOnMounted(start);
55
27
  tryOnScopeDispose(stop);
56
28
  return { stop, start, option };
57
29
  }
58
30
  function moveArrayElement(list, from, to) {
59
- const array = toValue(list);
31
+ const _valueIsRef = isRef(list);
32
+ const array = _valueIsRef ? [...toValue(list)] : toValue(list);
60
33
  if (to >= 0 && to < array.length) {
61
34
  const element = array.splice(from, 1)[0];
62
- nextTick(() => array.splice(to, 0, element));
35
+ nextTick(() => {
36
+ array.splice(to, 0, element);
37
+ if (_valueIsRef)
38
+ list.value = array;
39
+ });
63
40
  }
64
41
  }
65
42