@vueuse/integrations 13.9.0 → 14.0.0-alpha.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 (114) hide show
  1. package/dist/index.d.ts +473 -0
  2. package/dist/index.iife.js +772 -0
  3. package/dist/index.iife.min.js +1 -0
  4. package/dist/index.js +731 -0
  5. package/dist/useAsyncValidator/component.d.ts +19 -0
  6. package/dist/useAsyncValidator/component.js +20 -0
  7. package/dist/useAsyncValidator.d.ts +48 -0
  8. package/dist/useAsyncValidator.iife.js +99 -0
  9. package/dist/useAsyncValidator.iife.min.js +1 -0
  10. package/dist/useAsyncValidator.js +73 -0
  11. package/{useAxios.d.mts → dist/useAxios.d.ts} +86 -86
  12. package/dist/useAxios.iife.js +150 -0
  13. package/dist/useAxios.iife.min.js +1 -0
  14. package/dist/useAxios.js +124 -0
  15. package/{useChangeCase.d.mts → dist/useChangeCase.d.ts} +7 -9
  16. package/dist/useChangeCase.iife.js +61 -0
  17. package/dist/useChangeCase.iife.min.js +1 -0
  18. package/dist/useChangeCase.js +35 -0
  19. package/dist/useCookies.d.ts +64 -0
  20. package/dist/useCookies.iife.js +104 -0
  21. package/dist/useCookies.iife.min.js +1 -0
  22. package/dist/useCookies.js +77 -0
  23. package/dist/useDrauu.d.ts +33 -0
  24. package/dist/useDrauu.iife.js +146 -0
  25. package/dist/useDrauu.iife.min.js +1 -0
  26. package/dist/useDrauu.js +120 -0
  27. package/dist/useFocusTrap/component.d.ts +21 -0
  28. package/dist/useFocusTrap/component.js +17 -0
  29. package/dist/useFocusTrap.d.ts +55 -0
  30. package/dist/useFocusTrap.iife.js +97 -0
  31. package/dist/useFocusTrap.iife.min.js +1 -0
  32. package/dist/useFocusTrap.js +71 -0
  33. package/dist/useFuse.d.ts +33 -0
  34. package/dist/useFuse.iife.js +62 -0
  35. package/dist/useFuse.iife.min.js +1 -0
  36. package/dist/useFuse.js +36 -0
  37. package/dist/useIDBKeyval.d.ts +52 -0
  38. package/dist/useIDBKeyval.iife.js +93 -0
  39. package/dist/useIDBKeyval.iife.min.js +1 -0
  40. package/dist/useIDBKeyval.js +67 -0
  41. package/dist/useJwt.d.ts +28 -0
  42. package/dist/useJwt.iife.js +55 -0
  43. package/dist/useJwt.iife.min.js +1 -0
  44. package/dist/useJwt.js +29 -0
  45. package/dist/useNProgress.d.ts +21 -0
  46. package/dist/useNProgress.iife.js +66 -0
  47. package/dist/useNProgress.iife.min.js +1 -0
  48. package/dist/useNProgress.js +40 -0
  49. package/dist/useQRCode.d.ts +16 -0
  50. package/dist/useQRCode.iife.js +49 -0
  51. package/dist/useQRCode.iife.min.js +1 -0
  52. package/dist/useQRCode.js +23 -0
  53. package/dist/useSortable/component.d.ts +18 -0
  54. package/dist/useSortable/component.js +23 -0
  55. package/{useSortable.d.mts → dist/useSortable.d.ts} +20 -20
  56. package/dist/useSortable.iife.js +107 -0
  57. package/dist/useSortable.iife.min.js +1 -0
  58. package/dist/useSortable.js +78 -0
  59. package/package.json +27 -29
  60. package/index.d.mts +0 -458
  61. package/index.iife.js +0 -708
  62. package/index.iife.min.js +0 -1
  63. package/index.mjs +0 -685
  64. package/useAsyncValidator/component.d.mts +0 -27
  65. package/useAsyncValidator/component.mjs +0 -87
  66. package/useAsyncValidator.d.mts +0 -48
  67. package/useAsyncValidator.iife.js +0 -73
  68. package/useAsyncValidator.iife.min.js +0 -1
  69. package/useAsyncValidator.mjs +0 -72
  70. package/useAxios.iife.js +0 -124
  71. package/useAxios.iife.min.js +0 -1
  72. package/useAxios.mjs +0 -123
  73. package/useChangeCase.iife.js +0 -50
  74. package/useChangeCase.iife.min.js +0 -1
  75. package/useChangeCase.mjs +0 -29
  76. package/useCookies.d.mts +0 -56
  77. package/useCookies.iife.js +0 -64
  78. package/useCookies.iife.min.js +0 -1
  79. package/useCookies.mjs +0 -62
  80. package/useDrauu.d.mts +0 -33
  81. package/useDrauu.iife.js +0 -114
  82. package/useDrauu.iife.min.js +0 -1
  83. package/useDrauu.mjs +0 -114
  84. package/useFocusTrap/component.d.mts +0 -18
  85. package/useFocusTrap/component.mjs +0 -31
  86. package/useFocusTrap.d.mts +0 -55
  87. package/useFocusTrap.iife.js +0 -74
  88. package/useFocusTrap.iife.min.js +0 -1
  89. package/useFocusTrap.mjs +0 -74
  90. package/useFuse.d.mts +0 -33
  91. package/useFuse.iife.js +0 -45
  92. package/useFuse.iife.min.js +0 -1
  93. package/useFuse.mjs +0 -43
  94. package/useIDBKeyval.d.mts +0 -52
  95. package/useIDBKeyval.iife.js +0 -70
  96. package/useIDBKeyval.iife.min.js +0 -1
  97. package/useIDBKeyval.mjs +0 -69
  98. package/useJwt.d.mts +0 -28
  99. package/useJwt.iife.js +0 -27
  100. package/useJwt.iife.min.js +0 -1
  101. package/useJwt.mjs +0 -25
  102. package/useNProgress.d.mts +0 -21
  103. package/useNProgress.iife.js +0 -36
  104. package/useNProgress.iife.min.js +0 -1
  105. package/useNProgress.mjs +0 -35
  106. package/useQRCode.d.mts +0 -14
  107. package/useQRCode.iife.js +0 -20
  108. package/useQRCode.iife.min.js +0 -1
  109. package/useQRCode.mjs +0 -19
  110. package/useSortable/component.d.mts +0 -40
  111. package/useSortable/component.mjs +0 -89
  112. package/useSortable.iife.js +0 -66
  113. package/useSortable.iife.min.js +0 -1
  114. package/useSortable.mjs +0 -62
@@ -0,0 +1,78 @@
1
+ import { defaultDocument, tryOnMounted, tryOnScopeDispose, unrefElement } from "@vueuse/core";
2
+ import Sortable from "sortablejs";
3
+ import { isRef, nextTick, toValue } from "vue";
4
+
5
+ //#region useSortable/index.ts
6
+ /**
7
+ * Wrapper for sortablejs.
8
+ * @param el
9
+ * @param list
10
+ * @param options
11
+ */
12
+ function useSortable(el, list, options = {}) {
13
+ let sortable;
14
+ const { document = defaultDocument,...resetOptions } = options;
15
+ const defaultOptions = { onUpdate: (e) => {
16
+ moveArrayElement(list, e.oldIndex, e.newIndex, e);
17
+ } };
18
+ const start = () => {
19
+ const target = typeof el === "string" ? document === null || document === void 0 ? void 0 : document.querySelector(el) : unrefElement(el);
20
+ if (!target || sortable !== void 0) return;
21
+ sortable = new Sortable(target, {
22
+ ...defaultOptions,
23
+ ...resetOptions
24
+ });
25
+ };
26
+ const stop = () => {
27
+ sortable === null || sortable === void 0 || sortable.destroy();
28
+ sortable = void 0;
29
+ };
30
+ const option = (name, value) => {
31
+ if (value !== void 0) sortable === null || sortable === void 0 || sortable.option(name, value);
32
+ else return sortable === null || sortable === void 0 ? void 0 : sortable.option(name);
33
+ };
34
+ tryOnMounted(start);
35
+ tryOnScopeDispose(stop);
36
+ return {
37
+ stop,
38
+ start,
39
+ option
40
+ };
41
+ }
42
+ /**
43
+ * Inserts a element into the DOM at a given index.
44
+ * @param parentElement
45
+ * @param element
46
+ * @param {number} index
47
+ * @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
48
+ */
49
+ function insertNodeAt(parentElement, element, index) {
50
+ const refElement = parentElement.children[index];
51
+ parentElement.insertBefore(element, refElement);
52
+ }
53
+ /**
54
+ * Removes a node from the DOM.
55
+ * @param {Node} node
56
+ * @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
57
+ */
58
+ function removeNode(node) {
59
+ if (node.parentNode) node.parentNode.removeChild(node);
60
+ }
61
+ function moveArrayElement(list, from, to, e = null) {
62
+ if (e != null) {
63
+ removeNode(e.item);
64
+ insertNodeAt(e.from, e.item, from);
65
+ }
66
+ const _valueIsRef = isRef(list);
67
+ const array = _valueIsRef ? [...toValue(list)] : toValue(list);
68
+ if (to >= 0 && to < array.length) {
69
+ const element = array.splice(from, 1)[0];
70
+ nextTick(() => {
71
+ array.splice(to, 0, element);
72
+ if (_valueIsRef) list.value = array;
73
+ });
74
+ }
75
+ }
76
+
77
+ //#endregion
78
+ export { insertNodeAt, moveArrayElement, removeNode, useSortable };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vueuse/integrations",
3
3
  "type": "module",
4
- "version": "13.9.0",
4
+ "version": "14.0.0-alpha.1",
5
5
  "description": "Integration wrappers for utility libraries",
6
6
  "author": "Anthony Fu <https://github.com/antfu>",
7
7
  "license": "MIT",
@@ -22,33 +22,31 @@
22
22
  ],
23
23
  "sideEffects": false,
24
24
  "exports": {
25
- ".": "./index.mjs",
26
- "./*": "./*",
27
- "./useAsyncValidator": "./useAsyncValidator.mjs",
28
- "./useAxios": "./useAxios.mjs",
29
- "./useCookies": "./useCookies.mjs",
30
- "./useDrauu": "./useDrauu.mjs",
31
- "./useFocusTrap": "./useFocusTrap.mjs",
32
- "./useFocusTrap/component": "./useFocusTrap/component.mjs",
33
- "./useFuse": "./useFuse.mjs",
34
- "./useJwt": "./useJwt.mjs",
35
- "./useNProgress": "./useNProgress.mjs",
36
- "./useQRCode": "./useQRCode.mjs",
37
- "./useChangeCase": "./useChangeCase.mjs",
38
- "./useAsyncValidator/component": "./useAsyncValidator/component.mjs",
39
- "./useIDBKeyval": "./useIDBKeyval.mjs",
40
- "./useSortable": "./useSortable.mjs",
41
- "./useSortable/component": "./useSortable/component.mjs"
25
+ ".": "./dist/index.js",
26
+ "./*": "./dist/*",
27
+ "./useAsyncValidator": "./dist/useAsyncValidator.js",
28
+ "./useAsyncValidator/component": "./dist/useAsyncValidator/component.js",
29
+ "./useAxios": "./dist/useAxios.js",
30
+ "./useChangeCase": "./dist/useChangeCase.js",
31
+ "./useCookies": "./dist/useCookies.js",
32
+ "./useDrauu": "./dist/useDrauu.js",
33
+ "./useFocusTrap": "./dist/useFocusTrap.js",
34
+ "./useFocusTrap/component": "./dist/useFocusTrap/component.js",
35
+ "./useFuse": "./dist/useFuse.js",
36
+ "./useIDBKeyval": "./dist/useIDBKeyval.js",
37
+ "./useJwt": "./dist/useJwt.js",
38
+ "./useNProgress": "./dist/useNProgress.js",
39
+ "./useQRCode": "./dist/useQRCode.js",
40
+ "./useSortable": "./dist/useSortable.js",
41
+ "./useSortable/component": "./dist/useSortable/component.js"
42
42
  },
43
- "main": "./index.mjs",
44
- "module": "./index.mjs",
45
- "unpkg": "./index.iife.min.js",
46
- "jsdelivr": "./index.iife.min.js",
47
- "types": "./index.d.mts",
43
+ "main": "./dist/index.js",
44
+ "module": "./dist/index.js",
45
+ "unpkg": "./dist/index.iife.min.js",
46
+ "jsdelivr": "./dist/index.iife.min.js",
47
+ "types": "./dist/index.d.ts",
48
48
  "files": [
49
- "**/*.d.mts",
50
- "**/*.js",
51
- "**/*.mjs"
49
+ "dist"
52
50
  ],
53
51
  "peerDependencies": {
54
52
  "async-validator": "^4",
@@ -104,8 +102,8 @@
104
102
  }
105
103
  },
106
104
  "dependencies": {
107
- "@vueuse/core": "13.9.0",
108
- "@vueuse/shared": "13.9.0"
105
+ "@vueuse/core": "14.0.0-alpha.1",
106
+ "@vueuse/shared": "14.0.0-alpha.1"
109
107
  },
110
108
  "devDependencies": {
111
109
  "@types/nprogress": "^0.2.3",
@@ -125,7 +123,7 @@
125
123
  "universal-cookie": "^8.0.1"
126
124
  },
127
125
  "scripts": {
128
- "build": "rollup --config=rollup.config.ts --configPlugin=rollup-plugin-esbuild",
126
+ "build": "tsdown",
129
127
  "test:attw": "attw --pack --config-path ../../.attw.json ."
130
128
  }
131
129
  }
package/index.d.mts DELETED
@@ -1,458 +0,0 @@
1
- import { ValidateError, ValidateOption, Rules } from 'async-validator';
2
- import * as vue from 'vue';
3
- import { ShallowRef, ComputedRef, MaybeRefOrGetter, Ref, MaybeRef, WritableComputedRef } from 'vue';
4
- import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
5
- import * as changeCase from 'change-case';
6
- import { Options } from 'change-case';
7
- import * as universal_cookie from 'universal-cookie';
8
- import universal_cookie__default from 'universal-cookie';
9
- import { IncomingMessage } from 'node:http';
10
- import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument, MaybeElement } from '@vueuse/core';
11
- import { Options as Options$1, Drauu, Brush } from 'drauu';
12
- import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap';
13
- import * as fuse_js from 'fuse.js';
14
- import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js';
15
- import { ConfigurableFlush, RemovableRef } from '@vueuse/shared';
16
- import { JwtPayload, JwtHeader } from 'jwt-decode';
17
- import nprogress, { NProgressOptions } from 'nprogress';
18
- import QRCode from 'qrcode';
19
- import Sortable, { Options as Options$3 } from 'sortablejs';
20
-
21
- type AsyncValidatorError = Error & {
22
- errors: ValidateError[];
23
- fields: Record<string, ValidateError[]>;
24
- };
25
- interface UseAsyncValidatorExecuteReturn {
26
- pass: boolean;
27
- errors: AsyncValidatorError['errors'] | undefined;
28
- errorInfo: AsyncValidatorError | null;
29
- errorFields: AsyncValidatorError['fields'] | undefined;
30
- }
31
- interface UseAsyncValidatorReturn {
32
- pass: ShallowRef<boolean>;
33
- isFinished: ShallowRef<boolean>;
34
- errors: ComputedRef<AsyncValidatorError['errors'] | undefined>;
35
- errorInfo: ShallowRef<AsyncValidatorError | null>;
36
- errorFields: ComputedRef<AsyncValidatorError['fields'] | undefined>;
37
- execute: () => Promise<UseAsyncValidatorExecuteReturn>;
38
- }
39
- interface UseAsyncValidatorOptions {
40
- /**
41
- * @see https://github.com/yiminghe/async-validator#options
42
- */
43
- validateOption?: ValidateOption;
44
- /**
45
- * The validation will be triggered right away for the first time.
46
- * Only works when `manual` is not set to true.
47
- *
48
- * @default true
49
- */
50
- immediate?: boolean;
51
- /**
52
- * If set to true, the validation will not be triggered automatically.
53
- */
54
- manual?: boolean;
55
- }
56
- /**
57
- * Wrapper for async-validator.
58
- *
59
- * @see https://vueuse.org/useAsyncValidator
60
- * @see https://github.com/yiminghe/async-validator
61
- */
62
- declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
63
-
64
- interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any, O extends UseAxiosOptions = UseAxiosOptions<T>> {
65
- /**
66
- * Axios Response
67
- */
68
- response: ShallowRef<R | undefined>;
69
- /**
70
- * Axios response data
71
- */
72
- data: O extends UseAxiosOptionsWithInitialData<T> ? Ref<T> : Ref<T | undefined>;
73
- /**
74
- * Indicates if the request has finished
75
- */
76
- isFinished: Ref<boolean>;
77
- /**
78
- * Indicates if the request is currently loading
79
- */
80
- isLoading: Ref<boolean>;
81
- /**
82
- * Indicates if the request was canceled
83
- */
84
- isAborted: Ref<boolean>;
85
- /**
86
- * Any errors that may have occurred
87
- */
88
- error: ShallowRef<unknown | undefined>;
89
- /**
90
- * Aborts the current request
91
- */
92
- abort: (message?: string | undefined) => void;
93
- /**
94
- * Alias to `abort`
95
- */
96
- cancel: (message?: string | undefined) => void;
97
- /**
98
- * Alias to `isAborted`
99
- */
100
- isCanceled: Ref<boolean>;
101
- }
102
- interface StrictUseAxiosReturn<T, R, D, O extends UseAxiosOptions = UseAxiosOptions<T>> extends UseAxiosReturn<T, R, D, O> {
103
- /**
104
- * Manually call the axios request
105
- */
106
- execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D, O>>;
107
- }
108
- interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
109
- /**
110
- * Manually call the axios request
111
- */
112
- execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
113
- }
114
- interface UseAxiosOptionsBase<T = any> {
115
- /**
116
- * Will automatically run axios request when `useAxios` is used
117
- *
118
- */
119
- immediate?: boolean;
120
- /**
121
- * Use shallowRef.
122
- *
123
- * @default true
124
- */
125
- shallow?: boolean;
126
- /**
127
- * Abort previous request when a new request is made.
128
- *
129
- * @default true
130
- */
131
- abortPrevious?: boolean;
132
- /**
133
- * Callback when error is caught.
134
- */
135
- onError?: (e: unknown) => void;
136
- /**
137
- * Callback when success is caught.
138
- */
139
- onSuccess?: (data: T) => void;
140
- /**
141
- * Sets the state to initialState before executing the promise.
142
- */
143
- resetOnExecute?: boolean;
144
- /**
145
- * Callback when request is finished.
146
- */
147
- onFinish?: () => void;
148
- }
149
- interface UseAxiosOptionsWithInitialData<T> extends UseAxiosOptionsBase<T> {
150
- /**
151
- * Initial data
152
- */
153
- initialData: T;
154
- }
155
- type UseAxiosOptions<T = any> = UseAxiosOptionsBase<T> | UseAxiosOptionsWithInitialData<T>;
156
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
157
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
158
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsWithInitialData<T> = UseAxiosOptionsWithInitialData<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
159
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config?: AxiosRequestConfig<D>, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
160
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, instance?: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
161
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any, O extends UseAxiosOptionsBase<T> = UseAxiosOptionsBase<T>>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: O): StrictUseAxiosReturn<T, R, D, O> & Promise<StrictUseAxiosReturn<T, R, D, O>>;
162
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
163
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
164
- declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
165
-
166
- type EndsWithCase<T> = T extends `${infer _}Case` ? T : never;
167
- type FilterKeys<T> = {
168
- [K in keyof T as K extends string ? K : never]: EndsWithCase<K>;
169
- };
170
- type ChangeCaseKeys = FilterKeys<typeof changeCase>;
171
- type ChangeCaseType = ChangeCaseKeys[keyof ChangeCaseKeys];
172
- declare function useChangeCase(input: MaybeRef<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): WritableComputedRef<string>;
173
- declare function useChangeCase(input: MaybeRefOrGetter<string>, type: MaybeRefOrGetter<ChangeCaseType>, options?: MaybeRefOrGetter<Options> | undefined): ComputedRef<string>;
174
-
175
- /**
176
- * Creates a new {@link useCookies} function
177
- * @param req - incoming http request (for SSR)
178
- * @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
179
- * @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
180
- */
181
- declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
182
- doNotParse?: boolean | undefined;
183
- autoUpdateDependencies?: boolean | undefined;
184
- }) => {
185
- /**
186
- * Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
187
- */
188
- get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
189
- /**
190
- * Reactive get all cookies
191
- */
192
- getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
193
- set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
194
- remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
195
- addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
196
- removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
197
- };
198
- /**
199
- * Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
200
- * @param dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
201
- * @param options
202
- * @param options.doNotParse - don't try parse value as JSON
203
- * @param options.autoUpdateDependencies - automatically update watching dependencies
204
- * @param cookies - universal-cookie instance
205
- *
206
- * @__NO_SIDE_EFFECTS__
207
- */
208
- declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
209
- doNotParse?: boolean | undefined;
210
- autoUpdateDependencies?: boolean | undefined;
211
- }, cookies?: universal_cookie__default): {
212
- /**
213
- * Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
214
- */
215
- get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
216
- /**
217
- * Reactive get all cookies
218
- */
219
- getAll: <T = any>(options?: universal_cookie.CookieGetOptions | undefined) => T;
220
- set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
221
- remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
222
- addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
223
- removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
224
- };
225
-
226
- type UseDrauuOptions = Omit<Options$1, 'el'>;
227
- interface UseDrauuReturn {
228
- drauuInstance: Ref<Drauu | undefined>;
229
- load: (svg: string) => void;
230
- dump: () => string | undefined;
231
- clear: () => void;
232
- cancel: () => void;
233
- undo: () => boolean | undefined;
234
- redo: () => boolean | undefined;
235
- canUndo: ShallowRef<boolean>;
236
- canRedo: ShallowRef<boolean>;
237
- brush: Ref<Brush>;
238
- onChanged: EventHookOn;
239
- onCommitted: EventHookOn;
240
- onStart: EventHookOn;
241
- onEnd: EventHookOn;
242
- onCanceled: EventHookOn;
243
- }
244
- /**
245
- * Reactive drauu
246
- *
247
- * @see https://vueuse.org/useDrauu
248
- * @param target The target svg element
249
- * @param options Drauu Options
250
- */
251
- declare function useDrauu(target: MaybeComputedElementRef, options?: UseDrauuOptions): UseDrauuReturn;
252
-
253
- interface UseFocusTrapOptions extends Options$2 {
254
- /**
255
- * Immediately activate the trap
256
- */
257
- immediate?: boolean;
258
- }
259
- interface UseFocusTrapReturn {
260
- /**
261
- * Indicates if the focus trap is currently active
262
- */
263
- hasFocus: ShallowRef<boolean>;
264
- /**
265
- * Indicates if the focus trap is currently paused
266
- */
267
- isPaused: ShallowRef<boolean>;
268
- /**
269
- * Activate the focus trap
270
- *
271
- * @see https://github.com/focus-trap/focus-trap#trapactivateactivateoptions
272
- * @param opts Activate focus trap options
273
- */
274
- activate: (opts?: ActivateOptions) => void;
275
- /**
276
- * Deactivate the focus trap
277
- *
278
- * @see https://github.com/focus-trap/focus-trap#trapdeactivatedeactivateoptions
279
- * @param opts Deactivate focus trap options
280
- */
281
- deactivate: (opts?: DeactivateOptions) => void;
282
- /**
283
- * Pause the focus trap
284
- *
285
- * @see https://github.com/focus-trap/focus-trap#trappause
286
- */
287
- pause: Fn;
288
- /**
289
- * Unpauses the focus trap
290
- *
291
- * @see https://github.com/focus-trap/focus-trap#trapunpause
292
- */
293
- unpause: Fn;
294
- }
295
- /**
296
- * Reactive focus-trap
297
- *
298
- * @see https://vueuse.org/useFocusTrap
299
- */
300
- declare function useFocusTrap(target: MaybeRefOrGetter<Arrayable<MaybeRefOrGetter<string> | MaybeComputedElementRef>>, options?: UseFocusTrapOptions): UseFocusTrapReturn;
301
-
302
- type FuseOptions<T> = IFuseOptions<T>;
303
- interface UseFuseOptions<T> {
304
- fuseOptions?: FuseOptions<T>;
305
- resultLimit?: number;
306
- matchAllWhenSearchEmpty?: boolean;
307
- }
308
- declare function useFuse<DataItem>(search: MaybeRefOrGetter<string>, data: MaybeRefOrGetter<DataItem[]>, options?: MaybeRefOrGetter<UseFuseOptions<DataItem>>): {
309
- fuse: vue.Ref<{
310
- search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
311
- setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
312
- add: (doc: DataItem) => void;
313
- remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
314
- removeAt: (idx: number) => void;
315
- getIndex: () => fuse_js.FuseIndex<DataItem>;
316
- }, fuse_js__default<DataItem> | {
317
- search: <R = DataItem>(pattern: string | fuse_js.Expression, options?: fuse_js.FuseSearchOptions) => FuseResult<R>[];
318
- setCollection: (docs: readonly DataItem[], index?: fuse_js.FuseIndex<DataItem> | undefined) => void;
319
- add: (doc: DataItem) => void;
320
- remove: (predicate: (doc: DataItem, idx: number) => boolean) => DataItem[];
321
- removeAt: (idx: number) => void;
322
- getIndex: () => fuse_js.FuseIndex<DataItem>;
323
- }>;
324
- results: ComputedRef<FuseResult<DataItem>[]>;
325
- };
326
- type UseFuseReturn = ReturnType<typeof useFuse>;
327
-
328
- interface Serializer<T> {
329
- read: (raw: unknown) => T;
330
- write: (value: T) => unknown;
331
- }
332
- interface UseIDBOptions<T> extends ConfigurableFlush {
333
- /**
334
- * Watch for deep changes
335
- *
336
- * @default true
337
- */
338
- deep?: boolean;
339
- /**
340
- * On error callback
341
- *
342
- * Default log error to `console.error`
343
- */
344
- onError?: (error: unknown) => void;
345
- /**
346
- * Use shallow ref as reference
347
- *
348
- * @default false
349
- */
350
- shallow?: boolean;
351
- /**
352
- * Write the default value to the storage when it does not exist
353
- *
354
- * @default true
355
- */
356
- writeDefaults?: boolean;
357
- /**
358
- * Custom data serialization
359
- */
360
- serializer?: Serializer<T>;
361
- }
362
- interface UseIDBKeyvalReturn<T> {
363
- data: RemovableRef<T>;
364
- isFinished: ShallowRef<boolean>;
365
- set: (value: T) => Promise<void>;
366
- }
367
- /**
368
- *
369
- * @param key
370
- * @param initialValue
371
- * @param options
372
- */
373
- declare function useIDBKeyval<T>(key: IDBValidKey, initialValue: MaybeRefOrGetter<T>, options?: UseIDBOptions<T>): UseIDBKeyvalReturn<T>;
374
-
375
- interface UseJwtOptions<Fallback> {
376
- /**
377
- * Value returned when encounter error on decoding
378
- *
379
- * @default null
380
- */
381
- fallbackValue?: Fallback;
382
- /**
383
- * Error callback for decoding
384
- */
385
- onError?: (error: unknown) => void;
386
- }
387
- interface UseJwtReturn<Payload, Header, Fallback> {
388
- header: ComputedRef<Header | Fallback>;
389
- payload: ComputedRef<Payload | Fallback>;
390
- }
391
- /**
392
- * Reactive decoded jwt token.
393
- *
394
- * @see https://vueuse.org/useJwt
395
- */
396
- declare function useJwt<Payload extends object = JwtPayload, Header extends object = JwtHeader, Fallback = null>(encodedJwt: MaybeRefOrGetter<string>, options?: UseJwtOptions<Fallback>): UseJwtReturn<Payload, Header, Fallback>;
397
-
398
- type UseNProgressOptions = Partial<NProgressOptions>;
399
- /**
400
- * Reactive progress bar.
401
- *
402
- * @see https://vueuse.org/useNProgress
403
- */
404
- declare function useNProgress(currentProgress?: MaybeRefOrGetter<number | null | undefined>, options?: UseNProgressOptions): {
405
- isLoading: vue.WritableComputedRef<boolean, boolean>;
406
- progress: vue.Ref<number | null | undefined, number | null | undefined>;
407
- start: () => nprogress.NProgress;
408
- done: (force?: boolean) => nprogress.NProgress;
409
- remove: () => void;
410
- };
411
- type UseNProgressReturn = ReturnType<typeof useNProgress>;
412
-
413
- /**
414
- * Wrapper for qrcode.
415
- *
416
- * @see https://vueuse.org/useQRCode
417
- * @param text
418
- * @param options
419
- */
420
- declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
421
-
422
- interface UseSortableReturn {
423
- /**
424
- * start sortable instance
425
- */
426
- start: () => void;
427
- /**
428
- * destroy sortable instance
429
- */
430
- stop: () => void;
431
- /**
432
- * Options getter/setter
433
- * @param name a Sortable.Options property.
434
- * @param value a value.
435
- */
436
- option: (<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]) => void) & (<K extends keyof Sortable.Options>(name: K) => Sortable.Options[K]);
437
- }
438
- type UseSortableOptions = Options$3 & ConfigurableDocument;
439
- declare function useSortable<T>(selector: string, list: MaybeRef<T[]>, options?: UseSortableOptions): UseSortableReturn;
440
- declare function useSortable<T>(el: MaybeRefOrGetter<MaybeElement>, list: MaybeRef<T[]>, options?: UseSortableOptions): UseSortableReturn;
441
- /**
442
- * Inserts a element into the DOM at a given index.
443
- * @param parentElement
444
- * @param element
445
- * @param {number} index
446
- * @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L81C1-L94C2
447
- */
448
- declare function insertNodeAt(parentElement: Element, element: Element, index: number): void;
449
- /**
450
- * Removes a node from the DOM.
451
- * @param {Node} node
452
- * @see https://github.com/Alfred-Skyblue/vue-draggable-plus/blob/a3829222095e1949bf2c9a20979d7b5930e66f14/src/utils/index.ts#L96C1-L102C2
453
- */
454
- declare function removeNode(node: Node): void;
455
- declare function moveArrayElement<T>(list: MaybeRef<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void;
456
-
457
- export { createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable };
458
- export type { AsyncValidatorError, ChangeCaseType, EasyUseAxiosReturn, FuseOptions, StrictUseAxiosReturn, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, UseAxiosOptions, UseAxiosOptionsBase, UseAxiosOptionsWithInitialData, UseAxiosReturn, UseDrauuOptions, UseDrauuReturn, UseFocusTrapOptions, UseFocusTrapReturn, UseFuseOptions, UseFuseReturn, UseIDBKeyvalReturn, UseIDBOptions, UseJwtOptions, UseJwtReturn, UseNProgressOptions, UseNProgressReturn, UseSortableOptions, UseSortableReturn };