@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.
- package/index.cjs +62 -214
- package/index.d.cts +427 -0
- package/index.d.mts +427 -0
- package/index.d.ts +8 -18
- package/index.iife.js +62 -214
- package/index.iife.min.js +1 -1
- package/index.mjs +64 -216
- package/package.json +10 -26
- package/useAsyncValidator/component.cjs +5 -29
- package/useAsyncValidator/component.d.cts +27 -0
- package/useAsyncValidator/component.d.mts +27 -0
- package/useAsyncValidator/component.mjs +5 -29
- package/useAsyncValidator.cjs +5 -29
- package/useAsyncValidator.d.cts +48 -0
- package/useAsyncValidator.d.mts +48 -0
- package/useAsyncValidator.d.ts +1 -1
- package/useAsyncValidator.iife.js +5 -29
- package/useAsyncValidator.iife.min.js +1 -1
- package/useAsyncValidator.mjs +5 -29
- package/useAxios.cjs +8 -25
- package/useAxios.d.cts +94 -0
- package/useAxios.d.mts +94 -0
- package/useAxios.d.ts +1 -1
- package/useAxios.iife.js +8 -25
- package/useAxios.iife.min.js +1 -1
- package/useAxios.mjs +8 -25
- package/useChangeCase.d.cts +24 -0
- package/useChangeCase.d.mts +24 -0
- package/useChangeCase.d.ts +2 -14
- package/useCookies.cjs +2 -18
- package/useCookies.d.cts +54 -0
- package/useCookies.d.mts +54 -0
- package/useCookies.iife.js +2 -18
- package/useCookies.iife.min.js +1 -1
- package/useCookies.mjs +2 -18
- package/useDrauu.cjs +8 -43
- package/useDrauu.d.cts +32 -0
- package/useDrauu.d.mts +32 -0
- package/useDrauu.d.ts +1 -1
- package/useDrauu.iife.js +8 -43
- package/useDrauu.iife.min.js +1 -1
- package/useDrauu.mjs +8 -43
- package/useFocusTrap/component.d.cts +17 -0
- package/useFocusTrap/component.d.mts +17 -0
- package/useFocusTrap/component.d.ts +1 -1
- package/useFocusTrap.cjs +4 -34
- package/useFocusTrap.d.cts +57 -0
- package/useFocusTrap.d.mts +57 -0
- package/useFocusTrap.d.ts +1 -1
- package/useFocusTrap.iife.js +4 -34
- package/useFocusTrap.iife.min.js +1 -1
- package/useFocusTrap.mjs +4 -34
- package/useFuse.cjs +5 -9
- package/useFuse.d.cts +25 -0
- package/useFuse.d.mts +25 -0
- package/useFuse.d.ts +1 -1
- package/useFuse.iife.js +5 -9
- package/useFuse.iife.min.js +1 -1
- package/useFuse.mjs +5 -9
- package/useIDBKeyval.cjs +17 -19
- package/useIDBKeyval.d.cts +43 -0
- package/useIDBKeyval.d.mts +43 -0
- package/useIDBKeyval.d.ts +8 -6
- package/useIDBKeyval.iife.js +18 -21
- package/useIDBKeyval.iife.min.js +1 -1
- package/useIDBKeyval.mjs +18 -20
- package/useJwt.cjs +1 -1
- package/useJwt.d.cts +29 -0
- package/useJwt.d.mts +29 -0
- package/useJwt.d.ts +1 -1
- package/useJwt.iife.js +1 -1
- package/useJwt.iife.min.js +1 -1
- package/useJwt.mjs +1 -1
- package/useNProgress.d.cts +20 -0
- package/useNProgress.d.mts +20 -0
- package/useNProgress.d.ts +1 -1
- package/useQRCode.d.cts +14 -0
- package/useQRCode.d.mts +14 -0
- package/useSortable/component.cjs +13 -36
- package/useSortable/component.d.cts +40 -0
- package/useSortable/component.d.mts +40 -0
- package/useSortable/component.mjs +14 -37
- package/useSortable.cjs +13 -36
- package/useSortable.d.cts +26 -0
- package/useSortable.d.mts +26 -0
- package/useSortable.d.ts +1 -1
- package/useSortable.iife.js +13 -36
- package/useSortable.iife.min.js +1 -1
- package/useSortable.mjs +14 -37
package/useAxios.d.mts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ShallowRef, Ref } from 'vue-demi';
|
|
2
|
+
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
|
|
3
|
+
|
|
4
|
+
interface UseAxiosReturn<T, R = AxiosResponse<T>, _D = any> {
|
|
5
|
+
/**
|
|
6
|
+
* Axios Response
|
|
7
|
+
*/
|
|
8
|
+
response: ShallowRef<R | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Axios response data
|
|
11
|
+
*/
|
|
12
|
+
data: Ref<T | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Indicates if the request has finished
|
|
15
|
+
*/
|
|
16
|
+
isFinished: Ref<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates if the request is currently loading
|
|
19
|
+
*/
|
|
20
|
+
isLoading: Ref<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Indicates if the request was canceled
|
|
23
|
+
*/
|
|
24
|
+
isAborted: Ref<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Any errors that may have occurred
|
|
27
|
+
*/
|
|
28
|
+
error: ShallowRef<unknown | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Aborts the current request
|
|
31
|
+
*/
|
|
32
|
+
abort: (message?: string | undefined) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Alias to `abort`
|
|
35
|
+
*/
|
|
36
|
+
cancel: (message?: string | undefined) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Alias to `isAborted`
|
|
39
|
+
*/
|
|
40
|
+
isCanceled: Ref<boolean>;
|
|
41
|
+
}
|
|
42
|
+
interface StrictUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
|
|
43
|
+
/**
|
|
44
|
+
* Manually call the axios request
|
|
45
|
+
*/
|
|
46
|
+
execute: (url?: string | AxiosRequestConfig<D>, config?: AxiosRequestConfig<D>) => Promise<StrictUseAxiosReturn<T, R, D>>;
|
|
47
|
+
}
|
|
48
|
+
interface EasyUseAxiosReturn<T, R, D> extends UseAxiosReturn<T, R, D> {
|
|
49
|
+
/**
|
|
50
|
+
* Manually call the axios request
|
|
51
|
+
*/
|
|
52
|
+
execute: (url: string, config?: AxiosRequestConfig<D>) => Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
53
|
+
}
|
|
54
|
+
interface UseAxiosOptions<T = any> {
|
|
55
|
+
/**
|
|
56
|
+
* Will automatically run axios request when `useAxios` is used
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
immediate?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Use shallowRef.
|
|
62
|
+
*
|
|
63
|
+
* @default true
|
|
64
|
+
*/
|
|
65
|
+
shallow?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Callback when error is caught.
|
|
68
|
+
*/
|
|
69
|
+
onError?: (e: unknown) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Callback when success is caught.
|
|
72
|
+
*/
|
|
73
|
+
onSuccess?: (data: T) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Initial data to use
|
|
76
|
+
*/
|
|
77
|
+
initialData?: T;
|
|
78
|
+
/**
|
|
79
|
+
* Sets the state to initialState before executing the promise.
|
|
80
|
+
*/
|
|
81
|
+
resetOnExecute?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Callback when request is finished.
|
|
84
|
+
*/
|
|
85
|
+
onFinish?: () => void;
|
|
86
|
+
}
|
|
87
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
|
|
88
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, instance?: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
|
|
89
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, R, D> & Promise<StrictUseAxiosReturn<T, R, D>>;
|
|
90
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
91
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
92
|
+
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
93
|
+
|
|
94
|
+
export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };
|
package/useAxios.d.ts
CHANGED
|
@@ -91,4 +91,4 @@ declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: Axios
|
|
|
91
91
|
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
92
92
|
declare function useAxios<T = any, R = AxiosResponse<T>, D = any>(config?: AxiosRequestConfig<D>, instance?: AxiosInstance): EasyUseAxiosReturn<T, R, D> & Promise<EasyUseAxiosReturn<T, R, D>>;
|
|
93
93
|
|
|
94
|
-
export { EasyUseAxiosReturn, StrictUseAxiosReturn, UseAxiosOptions, UseAxiosReturn, useAxios };
|
|
94
|
+
export { type EasyUseAxiosReturn, type StrictUseAxiosReturn, type UseAxiosOptions, type UseAxiosReturn, useAxios };
|
package/useAxios.iife.js
CHANGED
|
@@ -117,25 +117,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
117
117
|
;(function (exports, vueDemi, shared, axios) {
|
|
118
118
|
'use strict';
|
|
119
119
|
|
|
120
|
-
var __defProp = Object.defineProperty;
|
|
121
|
-
var __defProps = Object.defineProperties;
|
|
122
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
123
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
124
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
125
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
126
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
127
|
-
var __spreadValues = (a, b) => {
|
|
128
|
-
for (var prop in b || (b = {}))
|
|
129
|
-
if (__hasOwnProp.call(b, prop))
|
|
130
|
-
__defNormalProp(a, prop, b[prop]);
|
|
131
|
-
if (__getOwnPropSymbols)
|
|
132
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
133
|
-
if (__propIsEnum.call(b, prop))
|
|
134
|
-
__defNormalProp(a, prop, b[prop]);
|
|
135
|
-
}
|
|
136
|
-
return a;
|
|
137
|
-
};
|
|
138
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
139
120
|
function useAxios(...args) {
|
|
140
121
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
|
141
122
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
@@ -145,7 +126,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
145
126
|
immediate: !!argsPlaceholder,
|
|
146
127
|
shallow: true
|
|
147
128
|
};
|
|
148
|
-
const isAxiosInstance = (val) => !!
|
|
129
|
+
const isAxiosInstance = (val) => !!val?.request;
|
|
149
130
|
if (args.length > 0 + argsPlaceholder) {
|
|
150
131
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
151
132
|
instance = args[0 + argsPlaceholder];
|
|
@@ -201,7 +182,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
201
182
|
let executeCounter = 0;
|
|
202
183
|
const execute = (executeUrl = url, config = {}) => {
|
|
203
184
|
error.value = void 0;
|
|
204
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
185
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url ?? config.url;
|
|
205
186
|
if (_url === void 0) {
|
|
206
187
|
error.value = new axios.AxiosError(axios.AxiosError.ERR_INVALID_URL);
|
|
207
188
|
isFinished.value = true;
|
|
@@ -212,7 +193,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
212
193
|
loading(true);
|
|
213
194
|
executeCounter += 1;
|
|
214
195
|
const currentExecuteCounter = executeCounter;
|
|
215
|
-
instance(_url,
|
|
196
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
216
197
|
response.value = r;
|
|
217
198
|
const result2 = r.data;
|
|
218
199
|
data.value = result2;
|
|
@@ -221,8 +202,7 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
221
202
|
error.value = e;
|
|
222
203
|
onError(e);
|
|
223
204
|
}).finally(() => {
|
|
224
|
-
|
|
225
|
-
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
205
|
+
options.onFinish?.();
|
|
226
206
|
if (currentExecuteCounter === executeCounter)
|
|
227
207
|
loading(false);
|
|
228
208
|
});
|
|
@@ -242,7 +222,10 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
242
222
|
abort,
|
|
243
223
|
execute
|
|
244
224
|
};
|
|
245
|
-
return
|
|
225
|
+
return {
|
|
226
|
+
...result,
|
|
227
|
+
...promise
|
|
228
|
+
};
|
|
246
229
|
}
|
|
247
230
|
|
|
248
231
|
exports.useAxios = useAxios;
|
package/useAxios.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(e,n,
|
|
1
|
+
var VueDemi=function(e,n,a){if(e.install)return e;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),e;if(n.version.slice(0,4)==="2.7."){let t=function(i,o){var l,u={},d={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(c,f){return u[c]=f,this},directive:function(c,f){return f?(n.directive(c,f),d):n.directive(c)},mount:function(c,f){return l||(l=new n(Object.assign({propsData:o},i,{provide:Object.assign(u,i.provide)})),l.$mount(c,f),l)},unmount:function(){l&&(l.$destroy(),l=void 0)}};return d};var R=t;for(var r in n)e[r]=n[r];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.warn=n.util.warn,e.hasInjectionContext=()=>!!e.getCurrentInstance(),e.createApp=t}else if(n.version.slice(0,2)==="2.")if(a){for(var r in a)e[r]=a[r];e.isVue2=!0,e.isVue3=!1,e.install=function(){},e.Vue=n,e.Vue2=n,e.version=n.version,e.hasInjectionContext=()=>!!e.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(n.version.slice(0,2)==="3."){for(var r in n)e[r]=n[r];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(t,i,o){return Array.isArray(t)?(t.length=Math.max(t.length,i),t.splice(i,1,o),o):(t[i]=o,o)},e.del=function(t,i){if(Array.isArray(t)){t.splice(i,1);return}delete t[i]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return e}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(e,n,a,r){"use strict";function R(...t){const i=typeof t[0]=="string"?t[0]:void 0,o=typeof i=="string"?1:0;let l={},u=r,d={immediate:!!o,shallow:!0};const c=s=>!!s?.request;t.length>0+o&&(c(t[0+o])?u=t[0+o]:l=t[0+o]),t.length>1+o&&c(t[1+o])&&(u=t[1+o]),(t.length===2+o&&!c(t[1+o])||t.length===3+o)&&(d=t[t.length-1]);const{initialData:f,shallow:S,onSuccess:U=a.noop,onError:$=a.noop,immediate:q,resetOnExecute:B=!1}=d,j=n.shallowRef(),w=(S?n.shallowRef:n.ref)(f),v=n.ref(!1),A=n.ref(!1),y=n.ref(!1),p=n.shallowRef(),P=r.CancelToken.source;let C=P();const x=s=>{v.value||!A.value||(C.cancel(s),C=P(),y.value=!0,A.value=!1,v.value=!1)},T=s=>{A.value=s,v.value=!s},M=()=>{B&&(w.value=f)},k=()=>new Promise((s,b)=>{a.until(v).toBe(!0).then(()=>p.value?b(p.value):s(L))}),I={then:(...s)=>k().then(...s),catch:(...s)=>k().catch(...s)};let E=0;const F=(s=i,b={})=>{p.value=void 0;const O=typeof s=="string"?s:i??b.url;if(O===void 0)return p.value=new r.AxiosError(r.AxiosError.ERR_INVALID_URL),v.value=!0,I;M(),x(),T(!0),E+=1;const N=E;return u(O,{...l,...typeof s=="object"?s:b,cancelToken:C.token}).then(h=>{j.value=h;const _=h.data;w.value=_,U(_)}).catch(h=>{p.value=h,$(h)}).finally(()=>{d.onFinish?.(),N===E&&T(!1)}),I};q&&i&&F();const L={response:j,data:w,error:p,isFinished:v,isLoading:A,cancel:x,isAborted:y,isCanceled:y,abort:x,execute:F};return{...L,...I}}e.useAxios=R})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
|
package/useAxios.mjs
CHANGED
|
@@ -2,25 +2,6 @@ import { shallowRef, ref } from 'vue-demi';
|
|
|
2
2
|
import { noop, until } from '@vueuse/shared';
|
|
3
3
|
import axios, { AxiosError } from 'axios';
|
|
4
4
|
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __defProps = Object.defineProperties;
|
|
7
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
5
|
function useAxios(...args) {
|
|
25
6
|
const url = typeof args[0] === "string" ? args[0] : void 0;
|
|
26
7
|
const argsPlaceholder = typeof url === "string" ? 1 : 0;
|
|
@@ -30,7 +11,7 @@ function useAxios(...args) {
|
|
|
30
11
|
immediate: !!argsPlaceholder,
|
|
31
12
|
shallow: true
|
|
32
13
|
};
|
|
33
|
-
const isAxiosInstance = (val) => !!
|
|
14
|
+
const isAxiosInstance = (val) => !!val?.request;
|
|
34
15
|
if (args.length > 0 + argsPlaceholder) {
|
|
35
16
|
if (isAxiosInstance(args[0 + argsPlaceholder]))
|
|
36
17
|
instance = args[0 + argsPlaceholder];
|
|
@@ -86,7 +67,7 @@ function useAxios(...args) {
|
|
|
86
67
|
let executeCounter = 0;
|
|
87
68
|
const execute = (executeUrl = url, config = {}) => {
|
|
88
69
|
error.value = void 0;
|
|
89
|
-
const _url = typeof executeUrl === "string" ? executeUrl : url
|
|
70
|
+
const _url = typeof executeUrl === "string" ? executeUrl : url ?? config.url;
|
|
90
71
|
if (_url === void 0) {
|
|
91
72
|
error.value = new AxiosError(AxiosError.ERR_INVALID_URL);
|
|
92
73
|
isFinished.value = true;
|
|
@@ -97,7 +78,7 @@ function useAxios(...args) {
|
|
|
97
78
|
loading(true);
|
|
98
79
|
executeCounter += 1;
|
|
99
80
|
const currentExecuteCounter = executeCounter;
|
|
100
|
-
instance(_url,
|
|
81
|
+
instance(_url, { ...defaultConfig, ...typeof executeUrl === "object" ? executeUrl : config, cancelToken: cancelToken.token }).then((r) => {
|
|
101
82
|
response.value = r;
|
|
102
83
|
const result2 = r.data;
|
|
103
84
|
data.value = result2;
|
|
@@ -106,8 +87,7 @@ function useAxios(...args) {
|
|
|
106
87
|
error.value = e;
|
|
107
88
|
onError(e);
|
|
108
89
|
}).finally(() => {
|
|
109
|
-
|
|
110
|
-
(_a = options.onFinish) == null ? void 0 : _a.call(options);
|
|
90
|
+
options.onFinish?.();
|
|
111
91
|
if (currentExecuteCounter === executeCounter)
|
|
112
92
|
loading(false);
|
|
113
93
|
});
|
|
@@ -127,7 +107,10 @@ function useAxios(...args) {
|
|
|
127
107
|
abort,
|
|
128
108
|
execute
|
|
129
109
|
};
|
|
130
|
-
return
|
|
110
|
+
return {
|
|
111
|
+
...result,
|
|
112
|
+
...promise
|
|
113
|
+
};
|
|
131
114
|
}
|
|
132
115
|
|
|
133
116
|
export { useAxios };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
|
|
2
|
+
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared';
|
|
3
|
+
import { WritableComputedRef, ComputedRef } from 'vue-demi';
|
|
4
|
+
|
|
5
|
+
declare const changeCase_camelCase: typeof camelCase;
|
|
6
|
+
declare const changeCase_capitalCase: typeof capitalCase;
|
|
7
|
+
declare const changeCase_constantCase: typeof constantCase;
|
|
8
|
+
declare const changeCase_dotCase: typeof dotCase;
|
|
9
|
+
declare const changeCase_headerCase: typeof headerCase;
|
|
10
|
+
declare const changeCase_noCase: typeof noCase;
|
|
11
|
+
declare const changeCase_paramCase: typeof paramCase;
|
|
12
|
+
declare const changeCase_pascalCase: typeof pascalCase;
|
|
13
|
+
declare const changeCase_pathCase: typeof pathCase;
|
|
14
|
+
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
15
|
+
declare const changeCase_snakeCase: typeof snakeCase;
|
|
16
|
+
declare namespace changeCase {
|
|
17
|
+
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type ChangeCaseType = keyof typeof changeCase;
|
|
21
|
+
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
|
|
22
|
+
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
|
|
23
|
+
|
|
24
|
+
export { type ChangeCaseType, useChangeCase };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, Options } from 'change-case';
|
|
2
|
+
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared';
|
|
3
|
+
import { WritableComputedRef, ComputedRef } from 'vue-demi';
|
|
4
|
+
|
|
5
|
+
declare const changeCase_camelCase: typeof camelCase;
|
|
6
|
+
declare const changeCase_capitalCase: typeof capitalCase;
|
|
7
|
+
declare const changeCase_constantCase: typeof constantCase;
|
|
8
|
+
declare const changeCase_dotCase: typeof dotCase;
|
|
9
|
+
declare const changeCase_headerCase: typeof headerCase;
|
|
10
|
+
declare const changeCase_noCase: typeof noCase;
|
|
11
|
+
declare const changeCase_paramCase: typeof paramCase;
|
|
12
|
+
declare const changeCase_pascalCase: typeof pascalCase;
|
|
13
|
+
declare const changeCase_pathCase: typeof pathCase;
|
|
14
|
+
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
15
|
+
declare const changeCase_snakeCase: typeof snakeCase;
|
|
16
|
+
declare namespace changeCase {
|
|
17
|
+
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type ChangeCaseType = keyof typeof changeCase;
|
|
21
|
+
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
|
|
22
|
+
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
|
|
23
|
+
|
|
24
|
+
export { type ChangeCaseType, useChangeCase };
|
package/useChangeCase.d.ts
CHANGED
|
@@ -14,23 +14,11 @@ declare const changeCase_pathCase: typeof pathCase;
|
|
|
14
14
|
declare const changeCase_sentenceCase: typeof sentenceCase;
|
|
15
15
|
declare const changeCase_snakeCase: typeof snakeCase;
|
|
16
16
|
declare namespace changeCase {
|
|
17
|
-
export {
|
|
18
|
-
changeCase_camelCase as camelCase,
|
|
19
|
-
changeCase_capitalCase as capitalCase,
|
|
20
|
-
changeCase_constantCase as constantCase,
|
|
21
|
-
changeCase_dotCase as dotCase,
|
|
22
|
-
changeCase_headerCase as headerCase,
|
|
23
|
-
changeCase_noCase as noCase,
|
|
24
|
-
changeCase_paramCase as paramCase,
|
|
25
|
-
changeCase_pascalCase as pascalCase,
|
|
26
|
-
changeCase_pathCase as pathCase,
|
|
27
|
-
changeCase_sentenceCase as sentenceCase,
|
|
28
|
-
changeCase_snakeCase as snakeCase,
|
|
29
|
-
};
|
|
17
|
+
export { changeCase_camelCase as camelCase, changeCase_capitalCase as capitalCase, changeCase_constantCase as constantCase, changeCase_dotCase as dotCase, changeCase_headerCase as headerCase, changeCase_noCase as noCase, changeCase_paramCase as paramCase, changeCase_pascalCase as pascalCase, changeCase_pathCase as pathCase, changeCase_sentenceCase as sentenceCase, changeCase_snakeCase as snakeCase };
|
|
30
18
|
}
|
|
31
19
|
|
|
32
20
|
type ChangeCaseType = keyof typeof changeCase;
|
|
33
21
|
declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
|
|
34
22
|
declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
|
|
35
23
|
|
|
36
|
-
export { ChangeCaseType, useChangeCase };
|
|
24
|
+
export { type ChangeCaseType, useChangeCase };
|
package/useCookies.cjs
CHANGED
|
@@ -4,22 +4,6 @@ var shared = require('@vueuse/shared');
|
|
|
4
4
|
var vueDemi = require('vue-demi');
|
|
5
5
|
var Cookie = require('universal-cookie');
|
|
6
6
|
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
7
|
function createCookies(req) {
|
|
24
8
|
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
|
25
9
|
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
@@ -50,14 +34,14 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
|
|
|
50
34
|
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
51
35
|
watchingDependencies.push(args[0]);
|
|
52
36
|
touches.value;
|
|
53
|
-
return cookies.get(args[0],
|
|
37
|
+
return cookies.get(args[0], { doNotParse, ...args[1] });
|
|
54
38
|
},
|
|
55
39
|
/**
|
|
56
40
|
* Reactive get all cookies
|
|
57
41
|
*/
|
|
58
42
|
getAll: (...args) => {
|
|
59
43
|
touches.value;
|
|
60
|
-
return cookies.getAll(
|
|
44
|
+
return cookies.getAll({ doNotParse, ...args[0] });
|
|
61
45
|
},
|
|
62
46
|
set: (...args) => cookies.set(...args),
|
|
63
47
|
remove: (...args) => cookies.remove(...args),
|
package/useCookies.d.cts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as universal_cookie from 'universal-cookie';
|
|
2
|
+
import universal_cookie__default from 'universal-cookie';
|
|
3
|
+
import { IncomingMessage } from 'node:http';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link useCookies} function
|
|
7
|
+
* @param {Object} req - incoming http request (for SSR)
|
|
8
|
+
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
|
9
|
+
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
|
10
|
+
*/
|
|
11
|
+
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
12
|
+
doNotParse?: boolean | undefined;
|
|
13
|
+
autoUpdateDependencies?: boolean | undefined;
|
|
14
|
+
}) => {
|
|
15
|
+
/**
|
|
16
|
+
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
17
|
+
*/
|
|
18
|
+
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
19
|
+
/**
|
|
20
|
+
* Reactive get all cookies
|
|
21
|
+
*/
|
|
22
|
+
getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
|
|
23
|
+
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
24
|
+
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
25
|
+
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
26
|
+
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
|
30
|
+
* @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
|
31
|
+
* @param {Object} options
|
|
32
|
+
* @param {boolean} options.doNotParse - don't try parse value as JSON
|
|
33
|
+
* @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
|
|
34
|
+
* @param {Object} cookies - universal-cookie instance
|
|
35
|
+
*/
|
|
36
|
+
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
37
|
+
doNotParse?: boolean | undefined;
|
|
38
|
+
autoUpdateDependencies?: boolean | undefined;
|
|
39
|
+
}, cookies?: universal_cookie__default): {
|
|
40
|
+
/**
|
|
41
|
+
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
42
|
+
*/
|
|
43
|
+
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
44
|
+
/**
|
|
45
|
+
* Reactive get all cookies
|
|
46
|
+
*/
|
|
47
|
+
getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
|
|
48
|
+
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
49
|
+
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
50
|
+
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
51
|
+
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { createCookies, useCookies };
|
package/useCookies.d.mts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as universal_cookie from 'universal-cookie';
|
|
2
|
+
import universal_cookie__default from 'universal-cookie';
|
|
3
|
+
import { IncomingMessage } from 'node:http';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link useCookies} function
|
|
7
|
+
* @param {Object} req - incoming http request (for SSR)
|
|
8
|
+
* @see https://github.com/reactivestack/cookies/tree/master/packages/universal-cookie universal-cookie
|
|
9
|
+
* @description Creates universal-cookie instance using request (default is window.document.cookie) and returns {@link useCookies} function with provided universal-cookie instance
|
|
10
|
+
*/
|
|
11
|
+
declare function createCookies(req?: IncomingMessage): (dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
12
|
+
doNotParse?: boolean | undefined;
|
|
13
|
+
autoUpdateDependencies?: boolean | undefined;
|
|
14
|
+
}) => {
|
|
15
|
+
/**
|
|
16
|
+
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
17
|
+
*/
|
|
18
|
+
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
19
|
+
/**
|
|
20
|
+
* Reactive get all cookies
|
|
21
|
+
*/
|
|
22
|
+
getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
|
|
23
|
+
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
24
|
+
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
25
|
+
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
26
|
+
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Reactive methods to work with cookies (use {@link createCookies} method instead if you are using SSR)
|
|
30
|
+
* @param {string[]|null|undefined} dependencies - array of watching cookie's names. Pass empty array if don't want to watch cookies changes.
|
|
31
|
+
* @param {Object} options
|
|
32
|
+
* @param {boolean} options.doNotParse - don't try parse value as JSON
|
|
33
|
+
* @param {boolean} options.autoUpdateDependencies - automatically update watching dependencies
|
|
34
|
+
* @param {Object} cookies - universal-cookie instance
|
|
35
|
+
*/
|
|
36
|
+
declare function useCookies(dependencies?: string[] | null, { doNotParse, autoUpdateDependencies }?: {
|
|
37
|
+
doNotParse?: boolean | undefined;
|
|
38
|
+
autoUpdateDependencies?: boolean | undefined;
|
|
39
|
+
}, cookies?: universal_cookie__default): {
|
|
40
|
+
/**
|
|
41
|
+
* Reactive get cookie by name. If **autoUpdateDependencies = true** then it will update watching dependencies
|
|
42
|
+
*/
|
|
43
|
+
get: <T = any>(name: string, options?: universal_cookie.CookieGetOptions | undefined) => T;
|
|
44
|
+
/**
|
|
45
|
+
* Reactive get all cookies
|
|
46
|
+
*/
|
|
47
|
+
getAll: <T_1 = any>(options?: universal_cookie.CookieGetOptions | undefined) => T_1;
|
|
48
|
+
set: (name: string, value: any, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
49
|
+
remove: (name: string, options?: universal_cookie.CookieSetOptions | undefined) => void;
|
|
50
|
+
addChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
51
|
+
removeChangeListener: (callback: universal_cookie.CookieChangeListener) => void;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { createCookies, useCookies };
|
package/useCookies.iife.js
CHANGED
|
@@ -117,22 +117,6 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
117
117
|
;(function (exports, shared, vueDemi, Cookie) {
|
|
118
118
|
'use strict';
|
|
119
119
|
|
|
120
|
-
var __defProp = Object.defineProperty;
|
|
121
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
122
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
123
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
124
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
125
|
-
var __spreadValues = (a, b) => {
|
|
126
|
-
for (var prop in b || (b = {}))
|
|
127
|
-
if (__hasOwnProp.call(b, prop))
|
|
128
|
-
__defNormalProp(a, prop, b[prop]);
|
|
129
|
-
if (__getOwnPropSymbols)
|
|
130
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
131
|
-
if (__propIsEnum.call(b, prop))
|
|
132
|
-
__defNormalProp(a, prop, b[prop]);
|
|
133
|
-
}
|
|
134
|
-
return a;
|
|
135
|
-
};
|
|
136
120
|
function createCookies(req) {
|
|
137
121
|
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
|
138
122
|
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
@@ -163,14 +147,14 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {
|
|
|
163
147
|
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
164
148
|
watchingDependencies.push(args[0]);
|
|
165
149
|
touches.value;
|
|
166
|
-
return cookies.get(args[0],
|
|
150
|
+
return cookies.get(args[0], { doNotParse, ...args[1] });
|
|
167
151
|
},
|
|
168
152
|
/**
|
|
169
153
|
* Reactive get all cookies
|
|
170
154
|
*/
|
|
171
155
|
getAll: (...args) => {
|
|
172
156
|
touches.value;
|
|
173
|
-
return cookies.getAll(
|
|
157
|
+
return cookies.getAll({ doNotParse, ...args[0] });
|
|
174
158
|
},
|
|
175
159
|
set: (...args) => cookies.set(...args),
|
|
176
160
|
remove: (...args) => cookies.remove(...args),
|
package/useCookies.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var VueDemi=function(n,e,
|
|
1
|
+
var VueDemi=function(n,e,d){if(n.install)return n;if(!e)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),n;if(e.version.slice(0,4)==="2.7."){let s=function(u,i){var o,a={},r={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(f,c){return a[f]=c,this},directive:function(f,c){return c?(e.directive(f,c),r):e.directive(f)},mount:function(f,c){return o||(o=new e(Object.assign({propsData:i},u,{provide:Object.assign(a,u.provide)})),o.$mount(f,c),o)},unmount:function(){o&&(o.$destroy(),o=void 0)}};return r};var p=s;for(var l in e)n[l]=e[l];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.warn=e.util.warn,n.hasInjectionContext=()=>!!n.getCurrentInstance(),n.createApp=s}else if(e.version.slice(0,2)==="2.")if(d){for(var l in d)n[l]=d[l];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=e,n.Vue2=e,n.version=e.version,n.hasInjectionContext=()=>!!n.getCurrentInstance()}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(e.version.slice(0,2)==="3."){for(var l in e)n[l]=e[l];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=e,n.Vue2=void 0,n.version=e.version,n.set=function(s,u,i){return Array.isArray(s)?(s.length=Math.max(s.length,u),s.splice(u,1,i),i):(s[u]=i,i)},n.del=function(s,u){if(Array.isArray(s)){s.splice(u,1);return}delete s[u]}}else console.error("[vue-demi] Vue version "+e.version+" is unsupported.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi<"u"?VueDemi:{}),this.Vue||(typeof Vue<"u"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI<"u"?VueCompositionAPI:void 0));(function(n,e,d,l){"use strict";function p(i){const o=new l(i?i.headers.cookie:null);return(a,{doNotParse:r=!1,autoUpdateDependencies:f=!1}={})=>s(a,{doNotParse:r,autoUpdateDependencies:f},o)}function s(i,{doNotParse:o=!1,autoUpdateDependencies:a=!1}={},r=new l){const f=a?[...i||[]]:i;let c=r.getAll({doNotParse:!0});const v=d.ref(0),h=()=>{const t=r.getAll({doNotParse:!0});u(f||null,t,c)&&v.value++,c=t};return r.addChangeListener(h),e.tryOnScopeDispose(()=>{r.removeChangeListener(h)}),{get:(...t)=>(a&&f&&!f.includes(t[0])&&f.push(t[0]),v.value,r.get(t[0],{doNotParse:o,...t[1]})),getAll:(...t)=>(v.value,r.getAll({doNotParse:o,...t[0]})),set:(...t)=>r.set(...t),remove:(...t)=>r.remove(...t),addChangeListener:(...t)=>r.addChangeListener(...t),removeChangeListener:(...t)=>r.removeChangeListener(...t)}}function u(i,o,a){if(!i)return!0;for(const r of i)if(o[r]!==a[r])return!0;return!1}n.createCookies=p,n.useCookies=s})(this.VueUse=this.VueUse||{},VueUse,VueDemi,UniversalCookie);
|
package/useCookies.mjs
CHANGED
|
@@ -2,22 +2,6 @@ import { tryOnScopeDispose } from '@vueuse/shared';
|
|
|
2
2
|
import { ref } from 'vue-demi';
|
|
3
3
|
import Cookie from 'universal-cookie';
|
|
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
5
|
function createCookies(req) {
|
|
22
6
|
const universalCookie = new Cookie(req ? req.headers.cookie : null);
|
|
23
7
|
return (dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}) => useCookies(dependencies, { doNotParse, autoUpdateDependencies }, universalCookie);
|
|
@@ -48,14 +32,14 @@ function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies =
|
|
|
48
32
|
if (autoUpdateDependencies && watchingDependencies && !watchingDependencies.includes(args[0]))
|
|
49
33
|
watchingDependencies.push(args[0]);
|
|
50
34
|
touches.value;
|
|
51
|
-
return cookies.get(args[0],
|
|
35
|
+
return cookies.get(args[0], { doNotParse, ...args[1] });
|
|
52
36
|
},
|
|
53
37
|
/**
|
|
54
38
|
* Reactive get all cookies
|
|
55
39
|
*/
|
|
56
40
|
getAll: (...args) => {
|
|
57
41
|
touches.value;
|
|
58
|
-
return cookies.getAll(
|
|
42
|
+
return cookies.getAll({ doNotParse, ...args[0] });
|
|
59
43
|
},
|
|
60
44
|
set: (...args) => cookies.set(...args),
|
|
61
45
|
remove: (...args) => cookies.remove(...args),
|