@vueuse/integrations 10.2.0 → 10.3.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.
@@ -0,0 +1,48 @@
1
+ import { MaybeRefOrGetter } from '@vueuse/shared';
2
+ import { ValidateError, ValidateOption, Rules } from 'async-validator';
3
+ import { Ref } from 'vue-demi';
4
+
5
+ type AsyncValidatorError = Error & {
6
+ errors: ValidateError[];
7
+ fields: Record<string, ValidateError[]>;
8
+ };
9
+ interface UseAsyncValidatorExecuteReturn {
10
+ pass: boolean;
11
+ errors: AsyncValidatorError['errors'] | undefined;
12
+ errorInfo: AsyncValidatorError | null;
13
+ errorFields: AsyncValidatorError['fields'] | undefined;
14
+ }
15
+ interface UseAsyncValidatorReturn {
16
+ pass: Ref<boolean>;
17
+ isFinished: Ref<boolean>;
18
+ errors: Ref<AsyncValidatorError['errors'] | undefined>;
19
+ errorInfo: Ref<AsyncValidatorError | null>;
20
+ errorFields: Ref<AsyncValidatorError['fields'] | undefined>;
21
+ execute: () => Promise<UseAsyncValidatorExecuteReturn>;
22
+ }
23
+ interface UseAsyncValidatorOptions {
24
+ /**
25
+ * @see https://github.com/yiminghe/async-validator#options
26
+ */
27
+ validateOption?: ValidateOption;
28
+ /**
29
+ * The validation will be triggered right away for the first time.
30
+ * Only works when `manual` is not set to true.
31
+ *
32
+ * @default true
33
+ */
34
+ immediate?: boolean;
35
+ /**
36
+ * If set to true, the validation will not be triggered automatically.
37
+ */
38
+ manual?: boolean;
39
+ }
40
+ /**
41
+ * Wrapper for async-validator.
42
+ *
43
+ * @see https://vueuse.org/useAsyncValidator
44
+ * @see https://github.com/yiminghe/async-validator
45
+ */
46
+ declare function useAsyncValidator(value: MaybeRefOrGetter<Record<string, any>>, rules: MaybeRefOrGetter<Rules>, options?: UseAsyncValidatorOptions): UseAsyncValidatorReturn & PromiseLike<UseAsyncValidatorReturn>;
47
+
48
+ export { AsyncValidatorError, UseAsyncValidatorExecuteReturn, UseAsyncValidatorOptions, UseAsyncValidatorReturn, useAsyncValidator };
@@ -1 +1 @@
1
- var VueDemi=function(r,n,v){if(r.install)return r;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(n.version.slice(0,4)==="2.7."){let o=function(i,f){var c,y={},h={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(u,d){return y[u]=d,this},directive:function(u,d){return d?(n.directive(u,d),h):n.directive(u)},mount:function(u,d){return c||(c=new n(Object.assign({propsData:f},i,{provide:Object.assign(y,i.provide)})),c.$mount(u,d),c)},unmount:function(){c&&(c.$destroy(),c=void 0)}};return h};var F=o;for(var e in n)r[e]=n[e];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.warn=n.util.warn,r.hasInjectionContext=()=>!!r.getCurrentInstance(),r.createApp=o}else if(n.version.slice(0,2)==="2.")if(v){for(var e in v)r[e]=v[e];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.hasInjectionContext=()=>!!r.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 e in n)r[e]=n[e];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=n,r.Vue2=void 0,r.version=n.version,r.set=function(o,i,f){return Array.isArray(o)?(o.length=Math.max(o.length,i),o.splice(i,1,f),f):(o[i]=f,f)},r.del=function(o,i){if(Array.isArray(o)){o.splice(i,1);return}delete o[i]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return r}(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(r,n,v,e){"use strict";var F=Object.defineProperty,o=Object.defineProperties,i=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,h=(a,t,s)=>t in a?F(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,u=(a,t)=>{for(var s in t||(t={}))c.call(t,s)&&h(a,s,t[s]);if(f)for(var s of f(t))y.call(t,s)&&h(a,s,t[s]);return a},d=(a,t)=>o(a,i(t));const U=v.default||v;function R(a,t,s={}){const{validateOption:E={},immediate:P=!0,manual:b=!1}=s,A=n.toRef(a),p=e.shallowRef(null),_=e.ref(!0),w=e.ref(!P||b),I=e.computed(()=>{var l;return((l=p.value)==null?void 0:l.errors)||[]}),j=e.computed(()=>{var l;return((l=p.value)==null?void 0:l.fields)||{}}),g=e.computed(()=>new U(n.toValue(t))),x=async()=>{_.value=!1,w.value=!1;try{await g.value.validate(A.value,E),w.value=!0,p.value=null}catch(l){p.value=l}finally{_.value=!0}return{pass:w.value,errorInfo:p.value,errors:I.value,errorFields:j.value}};b||e.watch([A,g],()=>x(),{immediate:P,deep:!0});const C={isFinished:_,pass:w,errors:I,errorInfo:p,errorFields:j,execute:x};function S(){return new Promise((l,O)=>{n.until(_).toBe(!0).then(()=>l(C)).catch($=>O($))})}return d(u({},C),{then(l,O){return S().then(l,O)}})}r.useAsyncValidator=R})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi);
1
+ var VueDemi=function(r,n,v){if(r.install)return r;if(!n)return console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`."),r;if(n.version.slice(0,4)==="2.7."){let o=function(i,f){var c,y={},h={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(u,d){return y[u]=d,this},directive:function(u,d){return d?(n.directive(u,d),h):n.directive(u)},mount:function(u,d){return c||(c=new n(Object.assign({propsData:f},i,{provide:Object.assign(y,i.provide)})),c.$mount(u,d),c)},unmount:function(){c&&(c.$destroy(),c=void 0)}};return h};var P=o;for(var e in n)r[e]=n[e];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.warn=n.util.warn,r.hasInjectionContext=()=>!!r.getCurrentInstance(),r.createApp=o}else if(n.version.slice(0,2)==="2.")if(v){for(var e in v)r[e]=v[e];r.isVue2=!0,r.isVue3=!1,r.install=function(){},r.Vue=n,r.Vue2=n,r.version=n.version,r.hasInjectionContext=()=>!!r.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 e in n)r[e]=n[e];r.isVue2=!1,r.isVue3=!0,r.install=function(){},r.Vue=n,r.Vue2=void 0,r.version=n.version,r.set=function(o,i,f){return Array.isArray(o)?(o.length=Math.max(o.length,i),o.splice(i,1,f),f):(o[i]=f,f)},r.del=function(o,i){if(Array.isArray(o)){o.splice(i,1);return}delete o[i]}}else console.error("[vue-demi] Vue version "+n.version+" is unsupported.");return r}(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(r,n,v,e){"use strict";var P=Object.defineProperty,o=Object.defineProperties,i=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,h=(a,t,s)=>t in a?P(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,u=(a,t)=>{for(var s in t||(t={}))c.call(t,s)&&h(a,s,t[s]);if(f)for(var s of f(t))y.call(t,s)&&h(a,s,t[s]);return a},d=(a,t)=>o(a,i(t));const U=v.default||v;function R(a,t,s={}){const{validateOption:E={},immediate:b=!0,manual:A=!1}=s,I=n.toRef(a),p=e.shallowRef(null),_=e.ref(!0),w=e.ref(!b||A),j=e.computed(()=>{var l;return((l=p.value)==null?void 0:l.errors)||[]}),g=e.computed(()=>{var l;return((l=p.value)==null?void 0:l.fields)||{}}),x=e.computed(()=>new U(n.toValue(t))),C=async()=>{_.value=!1,w.value=!1;try{await x.value.validate(I.value,E),w.value=!0,p.value=null}catch(l){p.value=l}finally{_.value=!0}return{pass:w.value,errorInfo:p.value,errors:j.value,errorFields:g.value}};A||e.watch([I,x],()=>C(),{immediate:b,deep:!0});const F={isFinished:_,pass:w,errors:j,errorInfo:p,errorFields:g,execute:C};function S(){return new Promise((l,O)=>{n.until(_).toBe(!0).then(()=>l(F)).catch($=>O($))})}return d(u({},F),{then(l,O){return S().then(l,O)}})}r.useAsyncValidator=R})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,VueDemi);
package/useAxios.d.cts 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 { EasyUseAxiosReturn, StrictUseAxiosReturn, UseAxiosOptions, UseAxiosReturn, useAxios };
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 { EasyUseAxiosReturn, StrictUseAxiosReturn, UseAxiosOptions, UseAxiosReturn, useAxios };
@@ -1 +1 @@
1
- var VueDemi=function(e,n,v){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 i=function(c,u){var f,y={},w={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(a,p){return y[a]=p,this},directive:function(a,p){return p?(n.directive(a,p),w):n.directive(a)},mount:function(a,p){return f||(f=new n(Object.assign({propsData:u},c,{provide:Object.assign(y,c.provide)})),f.$mount(a,p),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return w};var M=i;for(var l in n)e[l]=n[l];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=i}else if(n.version.slice(0,2)==="2.")if(v){for(var l in v)e[l]=v[l];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 l in n)e[l]=n[l];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(i,c,u){return Array.isArray(i)?(i.length=Math.max(i.length,c),i.splice(c,1,u),u):(i[c]=u,u)},e.del=function(i,c){if(Array.isArray(i)){i.splice(c,1);return}delete i[c]}}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,v,l){"use strict";var M=Object.defineProperty,i=Object.defineProperties,c=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,w=(t,r,o)=>r in t?M(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,a=(t,r)=>{for(var o in r||(r={}))f.call(r,o)&&w(t,o,r[o]);if(u)for(var o of u(r))y.call(r,o)&&w(t,o,r[o]);return t},p=(t,r)=>i(t,c(r));function z(...t){const r=typeof t[0]=="string"?t[0]:void 0,o=typeof r=="string"?1:0;let S={},A=l,b={immediate:!!o,shallow:!0};const I=s=>!!s?.request;t.length>0+o&&(I(t[0+o])?A=t[0+o]:S=t[0+o]),t.length>1+o&&I(t[1+o])&&(A=t[1+o]),(t.length===2+o&&!I(t[1+o])||t.length===3+o)&&(b=t[t.length-1]);const{initialData:T,shallow:G,onSuccess:H=v.noop,onError:J=v.noop,immediate:K,resetOnExecute:Q=!1}=b,F=n.shallowRef(),C=(G?n.shallowRef:n.ref)(T),h=n.ref(!1),P=n.ref(!1),j=n.ref(!1),_=n.shallowRef(),L=l.CancelToken.source;let x=L();const E=s=>{h.value||!P.value||(x.cancel(s),x=L(),j.value=!0,P.value=!1,h.value=!1)},N=s=>{P.value=s,h.value=!s},W=()=>{Q&&(C.value=T)},U=()=>new Promise((s,O)=>{v.until(h).toBe(!0).then(()=>_.value?O(_.value):s(k))}),R={then:(...s)=>U().then(...s),catch:(...s)=>U().catch(...s)};let g=0;const $=(s=r,O={})=>{_.value=void 0;const q=typeof s=="string"?s:r??O.url;if(q===void 0)return _.value=new l.AxiosError(l.AxiosError.ERR_INVALID_URL),h.value=!0,R;W(),E(),N(!0),g+=1;const X=g;return A(q,p(a(a({},S),typeof s=="object"?s:O),{cancelToken:x.token})).then(d=>{F.value=d;const B=d.data;C.value=B,H(B)}).catch(d=>{_.value=d,J(d)}).finally(()=>{var d;(d=b.onFinish)==null||d.call(b),X===g&&N(!1)}),R};K&&r&&$();const k={response:F,data:C,error:_,isFinished:h,isLoading:P,cancel:E,isAborted:j,isCanceled:j,abort:E,execute:$};return a(a({},k),R)}e.useAxios=z})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
1
+ var VueDemi=function(e,n,v){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 i=function(c,u){var f,y={},w={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(a,p){return y[a]=p,this},directive:function(a,p){return p?(n.directive(a,p),w):n.directive(a)},mount:function(a,p){return f||(f=new n(Object.assign({propsData:u},c,{provide:Object.assign(y,c.provide)})),f.$mount(a,p),f)},unmount:function(){f&&(f.$destroy(),f=void 0)}};return w};var S=i;for(var l in n)e[l]=n[l];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=i}else if(n.version.slice(0,2)==="2.")if(v){for(var l in v)e[l]=v[l];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 l in n)e[l]=n[l];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(i,c,u){return Array.isArray(i)?(i.length=Math.max(i.length,c),i.splice(c,1,u),u):(i[c]=u,u)},e.del=function(i,c){if(Array.isArray(i)){i.splice(c,1);return}delete i[c]}}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,v,l){"use strict";var S=Object.defineProperty,i=Object.defineProperties,c=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,w=(t,r,o)=>r in t?S(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o,a=(t,r)=>{for(var o in r||(r={}))f.call(r,o)&&w(t,o,r[o]);if(u)for(var o of u(r))y.call(r,o)&&w(t,o,r[o]);return t},p=(t,r)=>i(t,c(r));function z(...t){const r=typeof t[0]=="string"?t[0]:void 0,o=typeof r=="string"?1:0;let T={},A=l,b={immediate:!!o,shallow:!0};const I=s=>!!s?.request;t.length>0+o&&(I(t[0+o])?A=t[0+o]:T=t[0+o]),t.length>1+o&&I(t[1+o])&&(A=t[1+o]),(t.length===2+o&&!I(t[1+o])||t.length===3+o)&&(b=t[t.length-1]);const{initialData:F,shallow:G,onSuccess:H=v.noop,onError:J=v.noop,immediate:K,resetOnExecute:Q=!1}=b,L=n.shallowRef(),C=(G?n.shallowRef:n.ref)(F),h=n.ref(!1),P=n.ref(!1),j=n.ref(!1),_=n.shallowRef(),N=l.CancelToken.source;let x=N();const E=s=>{h.value||!P.value||(x.cancel(s),x=N(),j.value=!0,P.value=!1,h.value=!1)},U=s=>{P.value=s,h.value=!s},W=()=>{Q&&(C.value=F)},$=()=>new Promise((s,O)=>{v.until(h).toBe(!0).then(()=>_.value?O(_.value):s(q))}),R={then:(...s)=>$().then(...s),catch:(...s)=>$().catch(...s)};let g=0;const k=(s=r,O={})=>{_.value=void 0;const B=typeof s=="string"?s:r??O.url;if(B===void 0)return _.value=new l.AxiosError(l.AxiosError.ERR_INVALID_URL),h.value=!0,R;W(),E(),U(!0),g+=1;const X=g;return A(B,p(a(a({},T),typeof s=="object"?s:O),{cancelToken:x.token})).then(d=>{L.value=d;const M=d.data;C.value=M,H(M)}).catch(d=>{_.value=d,J(d)}).finally(()=>{var d;(d=b.onFinish)==null||d.call(b),X===g&&U(!1)}),R};K&&r&&k();const q={response:L,data:C,error:_,isFinished:h,isLoading:P,cancel:E,isAborted:j,isCanceled:j,abort:E,execute:k};return a(a({},q),R)}e.useAxios=z})(this.VueUse=this.VueUse||{},VueDemi,VueUse,axios);
@@ -0,0 +1,36 @@
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 {
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
+ };
30
+ }
31
+
32
+ type ChangeCaseType = keyof typeof changeCase;
33
+ declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
34
+ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
35
+
36
+ export { ChangeCaseType, useChangeCase };
@@ -0,0 +1,36 @@
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 {
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
+ };
30
+ }
31
+
32
+ type ChangeCaseType = keyof typeof changeCase;
33
+ declare function useChangeCase(input: MaybeRef<string>, type: ChangeCaseType, options?: Options | undefined): WritableComputedRef<string>;
34
+ declare function useChangeCase(input: MaybeRefOrGetter<string>, type: ChangeCaseType, options?: Options | undefined): ComputedRef<string>;
35
+
36
+ export { ChangeCaseType, useChangeCase };
@@ -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 };
@@ -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 };
@@ -1 +1 @@
1
- var VueDemi=function(n,e,h){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 i=function(a,v){var u,C={},g={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(c,d){return C[c]=d,this},directive:function(c,d){return d?(e.directive(c,d),g):e.directive(c)},mount:function(c,d){return u||(u=new e(Object.assign({propsData:v},a,{provide:Object.assign(C,a.provide)})),u.$mount(c,d),u)},unmount:function(){u&&(u.$destroy(),u=void 0)}};return g};var b=i;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=i}else if(e.version.slice(0,2)==="2.")if(h){for(var l in h)n[l]=h[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(i,a,v){return Array.isArray(i)?(i.length=Math.max(i.length,a),i.splice(a,1,v),v):(i[a]=v,v)},n.del=function(i,a){if(Array.isArray(i)){i.splice(a,1);return}delete i[a]}}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,h,l){"use strict";var b=Object.defineProperty,i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,u=(s,r,t)=>r in s?b(s,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[r]=t,C=(s,r)=>{for(var t in r||(r={}))a.call(r,t)&&u(s,t,r[t]);if(i)for(var t of i(r))v.call(r,t)&&u(s,t,r[t]);return s};function g(s){const r=new l(s?s.headers.cookie:null);return(t,{doNotParse:f=!1,autoUpdateDependencies:p=!1}={})=>c(t,{doNotParse:f,autoUpdateDependencies:p},r)}function c(s,{doNotParse:r=!1,autoUpdateDependencies:t=!1}={},f=new l){const p=t?[...s||[]]:s;let w=f.getAll({doNotParse:!0});const y=h.ref(0),_=()=>{const o=f.getAll({doNotParse:!0});d(p||null,o,w)&&y.value++,w=o};return f.addChangeListener(_),e.tryOnScopeDispose(()=>{f.removeChangeListener(_)}),{get:(...o)=>(t&&p&&!p.includes(o[0])&&p.push(o[0]),y.value,f.get(o[0],C({doNotParse:r},o[1]))),getAll:(...o)=>(y.value,f.getAll(C({doNotParse:r},o[0]))),set:(...o)=>f.set(...o),remove:(...o)=>f.remove(...o),addChangeListener:(...o)=>f.addChangeListener(...o),removeChangeListener:(...o)=>f.removeChangeListener(...o)}}function d(s,r,t){if(!s)return!0;for(const f of s)if(r[f]!==t[f])return!0;return!1}n.createCookies=g,n.useCookies=c})(this.VueUse=this.VueUse||{},VueUse,VueDemi,UniversalCookie);
1
+ var VueDemi=function(n,e,h){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 i=function(a,v){var u,C={},g={config:e.config,use:e.use.bind(e),mixin:e.mixin.bind(e),component:e.component.bind(e),provide:function(c,d){return C[c]=d,this},directive:function(c,d){return d?(e.directive(c,d),g):e.directive(c)},mount:function(c,d){return u||(u=new e(Object.assign({propsData:v},a,{provide:Object.assign(C,a.provide)})),u.$mount(c,d),u)},unmount:function(){u&&(u.$destroy(),u=void 0)}};return g};var w=i;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=i}else if(e.version.slice(0,2)==="2.")if(h){for(var l in h)n[l]=h[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(i,a,v){return Array.isArray(i)?(i.length=Math.max(i.length,a),i.splice(a,1,v),v):(i[a]=v,v)},n.del=function(i,a){if(Array.isArray(i)){i.splice(a,1);return}delete i[a]}}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,h,l){"use strict";var w=Object.defineProperty,i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,u=(s,r,t)=>r in s?w(s,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[r]=t,C=(s,r)=>{for(var t in r||(r={}))a.call(r,t)&&u(s,t,r[t]);if(i)for(var t of i(r))v.call(r,t)&&u(s,t,r[t]);return s};function g(s){const r=new l(s?s.headers.cookie:null);return(t,{doNotParse:f=!1,autoUpdateDependencies:p=!1}={})=>c(t,{doNotParse:f,autoUpdateDependencies:p},r)}function c(s,{doNotParse:r=!1,autoUpdateDependencies:t=!1}={},f=new l){const p=t?[...s||[]]:s;let _=f.getAll({doNotParse:!0});const y=h.ref(0),b=()=>{const o=f.getAll({doNotParse:!0});d(p||null,o,_)&&y.value++,_=o};return f.addChangeListener(b),e.tryOnScopeDispose(()=>{f.removeChangeListener(b)}),{get:(...o)=>(t&&p&&!p.includes(o[0])&&p.push(o[0]),y.value,f.get(o[0],C({doNotParse:r},o[1]))),getAll:(...o)=>(y.value,f.getAll(C({doNotParse:r},o[0]))),set:(...o)=>f.set(...o),remove:(...o)=>f.remove(...o),addChangeListener:(...o)=>f.addChangeListener(...o),removeChangeListener:(...o)=>f.removeChangeListener(...o)}}function d(s,r,t){if(!s)return!0;for(const f of s)if(r[f]!==t[f])return!0;return!1}n.createCookies=g,n.useCookies=c})(this.VueUse=this.VueUse||{},VueUse,VueDemi,UniversalCookie);
package/useDrauu.d.cts ADDED
@@ -0,0 +1,32 @@
1
+ import { Ref } from 'vue-demi';
2
+ import { Options, Drauu, Brush } from 'drauu';
3
+ import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
4
+
5
+ type UseDrauuOptions = Omit<Options, 'el'>;
6
+ interface UseDrauuReturn {
7
+ drauuInstance: Ref<Drauu | undefined>;
8
+ load: (svg: string) => void;
9
+ dump: () => string | undefined;
10
+ clear: () => void;
11
+ cancel: () => void;
12
+ undo: () => boolean | undefined;
13
+ redo: () => boolean | undefined;
14
+ canUndo: Ref<boolean>;
15
+ canRedo: Ref<boolean>;
16
+ brush: Ref<Brush>;
17
+ onChanged: EventHookOn;
18
+ onCommitted: EventHookOn;
19
+ onStart: EventHookOn;
20
+ onEnd: EventHookOn;
21
+ onCanceled: EventHookOn;
22
+ }
23
+ /**
24
+ * Reactive drauu
25
+ *
26
+ * @see https://vueuse.org/useDrauu
27
+ * @param target The target svg element
28
+ * @param options Drauu Options
29
+ */
30
+ declare function useDrauu(target: MaybeComputedElementRef, options?: UseDrauuOptions): UseDrauuReturn;
31
+
32
+ export { UseDrauuOptions, UseDrauuReturn, useDrauu };
package/useDrauu.d.mts ADDED
@@ -0,0 +1,32 @@
1
+ import { Ref } from 'vue-demi';
2
+ import { Options, Drauu, Brush } from 'drauu';
3
+ import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core';
4
+
5
+ type UseDrauuOptions = Omit<Options, 'el'>;
6
+ interface UseDrauuReturn {
7
+ drauuInstance: Ref<Drauu | undefined>;
8
+ load: (svg: string) => void;
9
+ dump: () => string | undefined;
10
+ clear: () => void;
11
+ cancel: () => void;
12
+ undo: () => boolean | undefined;
13
+ redo: () => boolean | undefined;
14
+ canUndo: Ref<boolean>;
15
+ canRedo: Ref<boolean>;
16
+ brush: Ref<Brush>;
17
+ onChanged: EventHookOn;
18
+ onCommitted: EventHookOn;
19
+ onStart: EventHookOn;
20
+ onEnd: EventHookOn;
21
+ onCanceled: EventHookOn;
22
+ }
23
+ /**
24
+ * Reactive drauu
25
+ *
26
+ * @see https://vueuse.org/useDrauu
27
+ * @param target The target svg element
28
+ * @param options Drauu Options
29
+ */
30
+ declare function useDrauu(target: MaybeComputedElementRef, options?: UseDrauuOptions): UseDrauuReturn;
31
+
32
+ export { UseDrauuOptions, UseDrauuReturn, useDrauu };
@@ -1 +1 @@
1
- var VueDemi=function(e,n,v){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 a=function(l,u){var c,p={},h={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(d,t){return p[d]=t,this},directive:function(d,t){return t?(n.directive(d,t),h):n.directive(d)},mount:function(d,t){return c||(c=new n(Object.assign({propsData:u},l,{provide:Object.assign(p,l.provide)})),c.$mount(d,t),c)},unmount:function(){c&&(c.$destroy(),c=void 0)}};return h};var I=a;for(var s in n)e[s]=n[s];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=a}else if(n.version.slice(0,2)==="2.")if(v){for(var s in v)e[s]=v[s];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 s in n)e[s]=n[s];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(a,l,u){return Array.isArray(a)?(a.length=Math.max(a.length,l),a.splice(l,1,u),u):(a[l]=u,u)},e.del=function(a,l){if(Array.isArray(a)){a.splice(l,1);return}delete a[l]}}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,v,s,I){"use strict";var a=Object.defineProperty,l=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable,p=(t,i,r)=>i in t?a(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r,h=(t,i)=>{for(var r in i||(i={}))u.call(i,r)&&p(t,r,i[r]);if(l)for(var r of l(i))c.call(i,r)&&p(t,r,i[r]);return t};function d(t,i){const r=n.ref();let g=[];const y=s.createEventHook(),b=s.createEventHook(),E=s.createEventHook(),P=s.createEventHook(),w=s.createEventHook(),C=n.ref(!1),O=n.ref(!1),k=n.ref(!1),A=n.ref(!1),_=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});n.watch(_,()=>{const o=r.value;o&&(o.brush=_.value,o.mode=_.value.mode)},{deep:!0});const j=()=>{var o;return(o=r.value)==null?void 0:o.undo()},U=()=>{var o;return(o=r.value)==null?void 0:o.redo()},x=()=>{var o;return(o=r.value)==null?void 0:o.clear()},G=()=>{var o;return(o=r.value)==null?void 0:o.cancel()},R=o=>{var f;return(f=r.value)==null?void 0:f.load(o)},m=()=>{var o;return(o=r.value)==null?void 0:o.dump()},H=()=>{var o;g.forEach(f=>f()),(o=r.value)==null||o.unmount()},S=()=>{r.value&&(C.value=r.value.canUndo(),O.value=r.value.canRedo(),k.value=r.value.altPressed,A.value=r.value.shiftPressed)};return n.watch(()=>s.unrefElement(t),o=>{!o||typeof SVGSVGElement>"u"||!(o instanceof SVGSVGElement)||(r.value&&H(),r.value=v.createDrauu(h({el:o},i)),S(),g=[r.value.on("canceled",()=>b.trigger()),r.value.on("committed",f=>E.trigger(f)),r.value.on("start",()=>P.trigger()),r.value.on("end",()=>w.trigger()),r.value.on("changed",()=>{S(),y.trigger()})])},{flush:"post"}),I.tryOnScopeDispose(()=>H()),{drauuInstance:r,load:R,dump:m,clear:x,cancel:G,undo:j,redo:U,canUndo:C,canRedo:O,brush:_,onChanged:y.on,onCommitted:E.on,onStart:P.on,onEnd:w.on,onCanceled:b.on}}e.useDrauu=d})(this.VueUse=this.VueUse||{},VueDemi,Drauu,VueUse,VueUse);
1
+ var VueDemi=function(e,n,v){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 a=function(l,u){var c,p={},h={config:n.config,use:n.use.bind(n),mixin:n.mixin.bind(n),component:n.component.bind(n),provide:function(d,t){return p[d]=t,this},directive:function(d,t){return t?(n.directive(d,t),h):n.directive(d)},mount:function(d,t){return c||(c=new n(Object.assign({propsData:u},l,{provide:Object.assign(p,l.provide)})),c.$mount(d,t),c)},unmount:function(){c&&(c.$destroy(),c=void 0)}};return h};var g=a;for(var s in n)e[s]=n[s];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=a}else if(n.version.slice(0,2)==="2.")if(v){for(var s in v)e[s]=v[s];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 s in n)e[s]=n[s];e.isVue2=!1,e.isVue3=!0,e.install=function(){},e.Vue=n,e.Vue2=void 0,e.version=n.version,e.set=function(a,l,u){return Array.isArray(a)?(a.length=Math.max(a.length,l),a.splice(l,1,u),u):(a[l]=u,u)},e.del=function(a,l){if(Array.isArray(a)){a.splice(l,1);return}delete a[l]}}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,v,s,g){"use strict";var a=Object.defineProperty,l=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable,p=(t,i,r)=>i in t?a(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r,h=(t,i)=>{for(var r in i||(i={}))u.call(i,r)&&p(t,r,i[r]);if(l)for(var r of l(i))c.call(i,r)&&p(t,r,i[r]);return t};function d(t,i){const r=n.ref();let y=[];const b=s.createEventHook(),E=s.createEventHook(),P=s.createEventHook(),w=s.createEventHook(),C=s.createEventHook(),O=n.ref(!1),H=n.ref(!1),k=n.ref(!1),A=n.ref(!1),_=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw"});n.watch(_,()=>{const o=r.value;o&&(o.brush=_.value,o.mode=_.value.mode)},{deep:!0});const j=()=>{var o;return(o=r.value)==null?void 0:o.undo()},U=()=>{var o;return(o=r.value)==null?void 0:o.redo()},x=()=>{var o;return(o=r.value)==null?void 0:o.clear()},G=()=>{var o;return(o=r.value)==null?void 0:o.cancel()},R=o=>{var f;return(f=r.value)==null?void 0:f.load(o)},m=()=>{var o;return(o=r.value)==null?void 0:o.dump()},S=()=>{var o;y.forEach(f=>f()),(o=r.value)==null||o.unmount()},I=()=>{r.value&&(O.value=r.value.canUndo(),H.value=r.value.canRedo(),k.value=r.value.altPressed,A.value=r.value.shiftPressed)};return n.watch(()=>s.unrefElement(t),o=>{!o||typeof SVGSVGElement>"u"||!(o instanceof SVGSVGElement)||(r.value&&S(),r.value=v.createDrauu(h({el:o},i)),I(),y=[r.value.on("canceled",()=>E.trigger()),r.value.on("committed",f=>P.trigger(f)),r.value.on("start",()=>w.trigger()),r.value.on("end",()=>C.trigger()),r.value.on("changed",()=>{I(),b.trigger()})])},{flush:"post"}),g.tryOnScopeDispose(()=>S()),{drauuInstance:r,load:R,dump:m,clear:x,cancel:G,undo:j,redo:U,canUndo:O,canRedo:H,brush:_,onChanged:b.on,onCommitted:P.on,onStart:w.on,onEnd:C.on,onCanceled:E.on}}e.useDrauu=d})(this.VueUse=this.VueUse||{},VueDemi,Drauu,VueUse,VueUse);
@@ -0,0 +1,17 @@
1
+ import * as vue_demi from 'vue-demi';
2
+ import { RenderableComponent } from '@vueuse/core';
3
+ import { Options } from 'focus-trap';
4
+
5
+ interface UseFocusTrapOptions extends Options {
6
+ /**
7
+ * Immediately activate the trap
8
+ */
9
+ immediate?: boolean;
10
+ }
11
+
12
+ interface ComponentUseFocusTrapOptions extends RenderableComponent {
13
+ options?: UseFocusTrapOptions;
14
+ }
15
+ declare const UseFocusTrap: vue_demi.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<ComponentUseFocusTrapOptions>, {}, {}>;
16
+
17
+ export { ComponentUseFocusTrapOptions, UseFocusTrap };
@@ -0,0 +1,17 @@
1
+ import * as vue_demi from 'vue-demi';
2
+ import { RenderableComponent } from '@vueuse/core';
3
+ import { Options } from 'focus-trap';
4
+
5
+ interface UseFocusTrapOptions extends Options {
6
+ /**
7
+ * Immediately activate the trap
8
+ */
9
+ immediate?: boolean;
10
+ }
11
+
12
+ interface ComponentUseFocusTrapOptions extends RenderableComponent {
13
+ options?: UseFocusTrapOptions;
14
+ }
15
+ declare const UseFocusTrap: vue_demi.DefineComponent<ComponentUseFocusTrapOptions, {}, {}, {}, {}, vue_demi.ComponentOptionsMixin, vue_demi.ComponentOptionsMixin, {}, string, vue_demi.VNodeProps & vue_demi.AllowedComponentProps & vue_demi.ComponentCustomProps, Readonly<ComponentUseFocusTrapOptions>, {}, {}>;
16
+
17
+ export { ComponentUseFocusTrapOptions, UseFocusTrap };