@vueuse/integrations
Advanced tools
@@ -1,5 +0,4 @@ | ||
import { MaybeRefOrGetter, MaybeRef, ConfigurableFlush, RemovableRef } from '@vueuse/shared'; | ||
import { ValidateError, ValidateOption, Rules } from 'async-validator'; | ||
import * as vue from 'vue'; | ||
import { Ref, ShallowRef, WritableComputedRef, ComputedRef } from 'vue'; | ||
import { ShallowRef, ComputedRef, MaybeRefOrGetter, Ref, MaybeRef, WritableComputedRef } from 'vue'; | ||
import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios'; | ||
@@ -11,3 +10,3 @@ import * as changeCase from 'change-case'; | ||
import { IncomingMessage } from 'node:http'; | ||
import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument, MaybeRefOrGetter as MaybeRefOrGetter$1 } from '@vueuse/core'; | ||
import { EventHookOn, MaybeComputedElementRef, Fn, Arrayable, ConfigurableDocument } from '@vueuse/core'; | ||
import { Options as Options$1, Drauu, Brush } from 'drauu'; | ||
@@ -17,2 +16,3 @@ import { Options as Options$2, ActivateOptions, DeactivateOptions } from 'focus-trap'; | ||
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js'; | ||
import { ConfigurableFlush, RemovableRef } from '@vueuse/shared'; | ||
import { JwtPayload, JwtHeader } from 'jwt-decode'; | ||
@@ -34,7 +34,7 @@ import nprogress, { NProgressOptions } from 'nprogress'; | ||
interface UseAsyncValidatorReturn { | ||
pass: Ref<boolean>; | ||
isFinished: Ref<boolean>; | ||
errors: Ref<AsyncValidatorError['errors'] | undefined>; | ||
errorInfo: Ref<AsyncValidatorError | null>; | ||
errorFields: Ref<AsyncValidatorError['fields'] | undefined>; | ||
pass: ShallowRef<boolean>; | ||
isFinished: ShallowRef<boolean>; | ||
errors: ComputedRef<AsyncValidatorError['errors'] | undefined>; | ||
errorInfo: ShallowRef<AsyncValidatorError | null>; | ||
errorFields: ComputedRef<AsyncValidatorError['fields'] | undefined>; | ||
execute: () => Promise<UseAsyncValidatorExecuteReturn>; | ||
@@ -236,4 +236,4 @@ } | ||
redo: () => boolean | undefined; | ||
canUndo: Ref<boolean>; | ||
canRedo: Ref<boolean>; | ||
canUndo: ShallowRef<boolean>; | ||
canRedo: ShallowRef<boolean>; | ||
brush: Ref<Brush>; | ||
@@ -265,7 +265,7 @@ onChanged: EventHookOn; | ||
*/ | ||
hasFocus: Ref<boolean>; | ||
hasFocus: ShallowRef<boolean>; | ||
/** | ||
* Indicates if the focus trap is currently paused | ||
*/ | ||
isPaused: Ref<boolean>; | ||
isPaused: ShallowRef<boolean>; | ||
/** | ||
@@ -359,3 +359,3 @@ * Activate the focus trap | ||
data: RemovableRef<T>; | ||
isFinished: Ref<boolean>; | ||
isFinished: ShallowRef<boolean>; | ||
set: (value: T) => Promise<void>; | ||
@@ -435,4 +435,4 @@ } | ||
type UseSortableOptions = Options$3 & ConfigurableDocument; | ||
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn; | ||
declare function useSortable<T>(el: MaybeRefOrGetter$1<HTMLElement | null | undefined>, list: MaybeRefOrGetter$1<T[]>, options?: UseSortableOptions): UseSortableReturn; | ||
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn; | ||
declare function useSortable<T>(el: MaybeRefOrGetter<HTMLElement | null | undefined>, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn; | ||
/** | ||
@@ -452,4 +452,4 @@ * Inserts a element into the DOM at a given index. | ||
declare function removeNode(node: Node): void; | ||
declare function moveArrayElement<T>(list: MaybeRefOrGetter$1<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void; | ||
declare function moveArrayElement<T>(list: MaybeRefOrGetter<T[]>, from: number, to: number, e?: Sortable.SortableEvent | null): void; | ||
export { type AsyncValidatorError, type ChangeCaseType, type EasyUseAxiosReturn, type FuseOptions, type StrictUseAxiosReturn, type UseAsyncValidatorExecuteReturn, type UseAsyncValidatorOptions, type UseAsyncValidatorReturn, type UseAxiosOptions, type UseAxiosOptionsBase, type UseAxiosOptionsWithInitialData, type UseAxiosReturn, type UseDrauuOptions, type UseDrauuReturn, type UseFocusTrapOptions, type UseFocusTrapReturn, type UseFuseOptions, type UseFuseReturn, type UseIDBKeyvalReturn, type UseIDBOptions, type UseJwtOptions, type UseJwtReturn, type UseNProgressOptions, type UseNProgressReturn, type UseSortableOptions, type UseSortableReturn, createCookies, insertNodeAt, moveArrayElement, removeNode, useAsyncValidator, useAxios, useChangeCase, useCookies, useDrauu, useFocusTrap, useFuse, useIDBKeyval, useJwt, useNProgress, useQRCode, useSortable }; |
@@ -33,3 +33,3 @@ (function (exports, shared, Schema, vue, axios, changeCase, Cookie, core, drauu, focusTrap, Fuse, idbKeyval, jwtDecode, nprogress, QRCode, Sortable) { | ||
const isFinished = vue.shallowRef(true); | ||
const pass = vue.ref(!immediate || manual); | ||
const pass = vue.shallowRef(!immediate || manual); | ||
const errors = vue.computed(() => { | ||
@@ -36,0 +36,0 @@ var _a; |
@@ -1,1 +0,1 @@ | ||
(function(w,C,U,n,L,$,k,p,K,X,Y,P,Z,V,x,ee){"use strict";function te(t){var o=Object.create(null);return t&&Object.keys(t).forEach(function(e){if(e!=="default"){var a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(o,e,a.get?a:{enumerable:!0,get:function(){return t[e]}})}}),o.default=t,Object.freeze(o)}var ne=te($);const ae=U.default||U;function oe(t,o,e={}){const{validateOption:a={},immediate:r=!0,manual:u=!1}=e,l=C.toRef(t),c=n.shallowRef(null),s=n.shallowRef(!0),d=n.ref(!r||u),v=n.computed(()=>{var i;return((i=c.value)==null?void 0:i.errors)||[]}),g=n.computed(()=>{var i;return((i=c.value)==null?void 0:i.fields)||{}}),h=n.computed(()=>new ae(n.toValue(o))),y=async()=>{s.value=!1,d.value=!1;try{await h.value.validate(l.value,a),d.value=!0,c.value=null}catch(i){c.value=i}finally{s.value=!0}return{pass:d.value,errorInfo:c.value,errors:v.value,errorFields:g.value}};u||n.watch([l,h],()=>y(),{immediate:r,deep:!0});const R={isFinished:s,pass:d,errors:v,errorInfo:c,errorFields:g,execute:y};function E(){return new Promise((i,b)=>{C.until(s).toBe(!0).then(()=>i(R)).catch(A=>b(A))})}return{...R,then(i,b){return E().then(i,b)}}}function le(...t){const o=typeof t[0]=="string"?t[0]:void 0,e=typeof o=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let r={},u=L,l=a;const c=m=>!!m?.request;t.length>0+e&&(c(t[0+e])?u=t[0+e]:r=t[0+e]),t.length>1+e&&c(t[1+e])&&(u=t[1+e]),(t.length===2+e&&!c(t[1+e])||t.length===3+e)&&(l=t[t.length-1]||a);const{shallow:s,onSuccess:d=C.noop,onError:v=C.noop,immediate:g,resetOnExecute:h=!1}=l,y=l.initialData,R=n.shallowRef(),E=(s?n.shallowRef:n.ref)(y),i=n.shallowRef(!1),b=n.shallowRef(!1),A=n.shallowRef(!1),D=n.shallowRef();let S=new AbortController;const F=m=>{i.value||!b.value||(S.abort(m),S=new AbortController,A.value=!0,b.value=!1,i.value=!1)},f=m=>{b.value=m,i.value=!m},_=()=>{h&&(E.value=y)},Q=()=>new Promise((m,I)=>{C.until(i).toBe(!0).then(()=>D.value?I(D.value):m(q))}),H={then:(...m)=>Q().then(...m),catch:(...m)=>Q().catch(...m)};let j=0;const z=(m=o,I={})=>{D.value=void 0;const J=typeof m=="string"?m:o??I.url;if(J===void 0)return D.value=new L.AxiosError(L.AxiosError.ERR_INVALID_URL),i.value=!0,H;_(),l.abortPrevious!==!1&&F(),f(!0),j+=1;const pe=j;return A.value=!1,u(J,{...r,...typeof m=="object"?m:I,signal:S.signal}).then(O=>{if(A.value)return;R.value=O;const M=O.data;E.value=M,d(M)}).catch(O=>{D.value=O,v(O)}).finally(()=>{var O;(O=l.onFinish)==null||O.call(l),pe===j&&f(!1)}),H};g&&o&&z();const q={response:R,data:E,error:D,isFinished:i,isLoading:b,cancel:F,isAborted:A,isCanceled:A,abort:F,execute:z};return{...q,...H}}const N=Object.entries(ne).filter(([t,o])=>typeof o=="function"&&t.endsWith("Case")).reduce((t,[o,e])=>(t[o]=e,t),{});function re(t,o,e){const a=n.computed(()=>{const u=n.toValue(o);if(!N[u])throw new Error(`Invalid change case type "${u}"`);return u});if(typeof t=="function")return n.computed(()=>N[a.value](n.toValue(t),n.toValue(e)));const r=n.ref(t);return n.computed({get(){return N[a.value](r.value,n.toValue(e))},set(u){r.value=u}})}function ue(t){const o=new k(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:r=!1}={})=>T(e,{doNotParse:a,autoUpdateDependencies:r},o)}function T(t,{doNotParse:o=!1,autoUpdateDependencies:e=!1}={},a=new k){const r=e?[...t||[]]:t;let u=a.getAll({doNotParse:!0});const l=n.shallowRef(0),c=()=>{const s=a.getAll({doNotParse:!0});se(r||null,s,u)&&l.value++,u=s};return a.addChangeListener(c),C.tryOnScopeDispose(()=>{a.removeChangeListener(c)}),{get:(...s)=>(e&&r&&!r.includes(s[0])&&r.push(s[0]),l.value,a.get(s[0],{doNotParse:o,...s[1]})),getAll:(...s)=>(l.value,a.getAll({doNotParse:o,...s[0]})),set:(...s)=>a.set(...s),remove:(...s)=>a.remove(...s),addChangeListener:(...s)=>a.addChangeListener(...s),removeChangeListener:(...s)=>a.removeChangeListener(...s)}}function se(t,o,e){if(!t)return!0;for(const a of t)if(o[a]!==e[a])return!0;return!1}function ce(t,o){const e=n.ref();let a=[];const r=p.createEventHook(),u=p.createEventHook(),l=p.createEventHook(),c=p.createEventHook(),s=p.createEventHook(),d=n.shallowRef(!1),v=n.shallowRef(!1),g=n.shallowRef(!1),h=n.shallowRef(!1),y=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...o?.brush});n.watch(y,()=>{const f=e.value;f&&(f.brush=y.value,f.mode=y.value.mode)},{deep:!0});const R=()=>{var f;return(f=e.value)==null?void 0:f.undo()},E=()=>{var f;return(f=e.value)==null?void 0:f.redo()},i=()=>{var f;return(f=e.value)==null?void 0:f.clear()},b=()=>{var f;return(f=e.value)==null?void 0:f.cancel()},A=f=>{var _;return(_=e.value)==null?void 0:_.load(f)},D=()=>{var f;return(f=e.value)==null?void 0:f.dump()},S=()=>{var f;a.forEach(_=>_()),(f=e.value)==null||f.unmount()},F=()=>{e.value&&(d.value=e.value.canUndo(),v.value=e.value.canRedo(),g.value=e.value.altPressed,h.value=e.value.shiftPressed)};return n.watch(()=>p.unrefElement(t),f=>{!f||typeof SVGSVGElement>"u"||!(f instanceof SVGSVGElement)||(e.value&&S(),e.value=K.createDrauu({el:f,...o}),F(),a=[e.value.on("canceled",()=>u.trigger()),e.value.on("committed",_=>l.trigger(_)),e.value.on("start",()=>c.trigger()),e.value.on("end",()=>s.trigger()),e.value.on("changed",()=>{F(),r.trigger()})])},{flush:"post"}),C.tryOnScopeDispose(()=>S()),{drauuInstance:e,load:A,dump:D,clear:i,cancel:b,undo:R,redo:E,canUndo:d,canRedo:v,brush:y,onChanged:r.on,onCommitted:l.on,onStart:c.on,onEnd:s.on,onCanceled:u.on}}function ie(t,o={}){let e;const{immediate:a,...r}=o,u=n.shallowRef(!1),l=n.shallowRef(!1),c=h=>e&&e.activate(h),s=h=>e&&e.deactivate(h),d=()=>{e&&(e.pause(),l.value=!0)},v=()=>{e&&(e.unpause(),l.value=!1)},g=n.computed(()=>{const h=n.toValue(t);return p.toArray(h).map(y=>{const R=n.toValue(y);return typeof R=="string"?R:p.unrefElement(R)}).filter(C.notNullish)});return n.watch(g,h=>{h.length&&(e=X.createFocusTrap(h,{...r,onActivate(){u.value=!0,o.onActivate&&o.onActivate()},onDeactivate(){u.value=!1,o.onDeactivate&&o.onDeactivate()}}),a&&c())},{flush:"post"}),p.tryOnScopeDispose(()=>s()),{hasFocus:u,isPaused:l,activate:c,deactivate:s,pause:d,unpause:v}}function fe(t,o,e){const a=()=>{var l,c;return new Y((l=n.toValue(o))!=null?l:[],(c=n.toValue(e))==null?void 0:c.fuseOptions)},r=n.ref(a());n.watch(()=>{var l;return(l=n.toValue(e))==null?void 0:l.fuseOptions},()=>{r.value=a()},{deep:!0}),n.watch(()=>n.toValue(o),l=>{r.value.setCollection(l)},{deep:!0});const u=n.computed(()=>{const l=n.toValue(e);if(l?.matchAllWhenSearchEmpty&&!n.toValue(t))return n.toValue(o).map((s,d)=>({item:s,refIndex:d}));const c=l?.resultLimit;return r.value.search(n.toValue(t),c?{limit:c}:void 0)});return{fuse:r,results:u}}function de(t,o,e={}){const{flush:a="pre",deep:r=!0,shallow:u=!1,onError:l=i=>{console.error(i)},writeDefaults:c=!0}=e,s=n.shallowRef(!1),d=(u?n.shallowRef:n.ref)(o),v=n.toValue(o);async function g(){try{const i=await P.get(t);i===void 0?v!=null&&c&&await P.set(t,v):d.value=i}catch(i){l(i)}s.value=!0}g();async function h(){try{d.value==null?await P.del(t):await P.update(t,()=>n.toRaw(d.value))}catch(i){l(i)}}const{pause:y,resume:R}=p.watchPausable(d,()=>h(),{flush:a,deep:r});async function E(i){y(),d.value=i,await h(),R()}return{set:E,isFinished:s,data:d}}function ve(t,o={}){const{onError:e,fallbackValue:a=null}=o,r=(c,s)=>{try{return Z.jwtDecode(c,s)}catch(d){return e?.(d),a}},u=n.computed(()=>r(n.toValue(t),{header:!0})),l=n.computed(()=>r(n.toValue(t)));return{header:u,payload:l}}function he(t=null,o){const e=C.toRef(t),a=n.computed({set:u=>u?V.start():V.done(),get:()=>typeof e.value=="number"&&e.value<1});o&&V.configure(o);const r=V.set;return V.set=u=>(e.value=u,r.call(V,u)),n.watchEffect(()=>{typeof e.value=="number"&&C.isClient&&r.call(V,e.value)}),C.tryOnScopeDispose(V.remove),{isLoading:a,progress:e,start:V.start,done:V.done,remove:()=>{e.value=null,V.remove()}}}function me(t,o){const e=C.toRef(t),a=n.shallowRef("");return n.watch(e,async r=>{e.value&&C.isClient&&(a.value=await x.toDataURL(r,o))},{immediate:!0}),a}function we(t,o,e={}){let a;const{document:r=p.defaultDocument,...u}=e,l={onUpdate:v=>{G(o,v.oldIndex,v.newIndex,v)}},c=()=>{const v=typeof t=="string"?r?.querySelector(t):p.unrefElement(t);!v||a!==void 0||(a=new ee(v,{...l,...u}))},s=()=>{a?.destroy(),a=void 0},d=(v,g)=>{if(g!==void 0)a?.option(v,g);else return a?.option(v)};return p.tryOnMounted(c),p.tryOnScopeDispose(s),{stop:s,start:c,option:d}}function B(t,o,e){const a=t.children[e];t.insertBefore(o,a)}function W(t){t.parentNode&&t.parentNode.removeChild(t)}function G(t,o,e,a=null){a!=null&&(W(a.item),B(a.from,a.item,o));const r=n.isRef(t),u=r?[...n.toValue(t)]:n.toValue(t);if(e>=0&&e<u.length){const l=u.splice(o,1)[0];n.nextTick(()=>{u.splice(e,0,l),r&&(t.value=u)})}}w.createCookies=ue,w.insertNodeAt=B,w.moveArrayElement=G,w.removeNode=W,w.useAsyncValidator=oe,w.useAxios=le,w.useChangeCase=re,w.useCookies=T,w.useDrauu=ce,w.useFocusTrap=ie,w.useFuse=fe,w.useIDBKeyval=de,w.useJwt=ve,w.useNProgress=he,w.useQRCode=me,w.useSortable=we})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue,axios,changeCase,UniversalCookie,VueUse,Drauu,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable); | ||
(function(w,C,U,n,L,$,k,p,K,X,Y,P,Z,V,x,ee){"use strict";function te(t){var o=Object.create(null);return t&&Object.keys(t).forEach(function(e){if(e!=="default"){var a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(o,e,a.get?a:{enumerable:!0,get:function(){return t[e]}})}}),o.default=t,Object.freeze(o)}var ne=te($);const ae=U.default||U;function oe(t,o,e={}){const{validateOption:a={},immediate:r=!0,manual:s=!1}=e,l=C.toRef(t),c=n.shallowRef(null),u=n.shallowRef(!0),d=n.shallowRef(!r||s),v=n.computed(()=>{var i;return((i=c.value)==null?void 0:i.errors)||[]}),g=n.computed(()=>{var i;return((i=c.value)==null?void 0:i.fields)||{}}),h=n.computed(()=>new ae(n.toValue(o))),y=async()=>{u.value=!1,d.value=!1;try{await h.value.validate(l.value,a),d.value=!0,c.value=null}catch(i){c.value=i}finally{u.value=!0}return{pass:d.value,errorInfo:c.value,errors:v.value,errorFields:g.value}};s||n.watch([l,h],()=>y(),{immediate:r,deep:!0});const R={isFinished:u,pass:d,errors:v,errorInfo:c,errorFields:g,execute:y};function E(){return new Promise((i,b)=>{C.until(u).toBe(!0).then(()=>i(R)).catch(A=>b(A))})}return{...R,then(i,b){return E().then(i,b)}}}function le(...t){const o=typeof t[0]=="string"?t[0]:void 0,e=typeof o=="string"?1:0,a={immediate:!!e,shallow:!0,abortPrevious:!0};let r={},s=L,l=a;const c=m=>!!m?.request;t.length>0+e&&(c(t[0+e])?s=t[0+e]:r=t[0+e]),t.length>1+e&&c(t[1+e])&&(s=t[1+e]),(t.length===2+e&&!c(t[1+e])||t.length===3+e)&&(l=t[t.length-1]||a);const{shallow:u,onSuccess:d=C.noop,onError:v=C.noop,immediate:g,resetOnExecute:h=!1}=l,y=l.initialData,R=n.shallowRef(),E=(u?n.shallowRef:n.ref)(y),i=n.shallowRef(!1),b=n.shallowRef(!1),A=n.shallowRef(!1),D=n.shallowRef();let S=new AbortController;const F=m=>{i.value||!b.value||(S.abort(m),S=new AbortController,A.value=!0,b.value=!1,i.value=!1)},f=m=>{b.value=m,i.value=!m},_=()=>{h&&(E.value=y)},Q=()=>new Promise((m,I)=>{C.until(i).toBe(!0).then(()=>D.value?I(D.value):m(q))}),H={then:(...m)=>Q().then(...m),catch:(...m)=>Q().catch(...m)};let j=0;const z=(m=o,I={})=>{D.value=void 0;const J=typeof m=="string"?m:o??I.url;if(J===void 0)return D.value=new L.AxiosError(L.AxiosError.ERR_INVALID_URL),i.value=!0,H;_(),l.abortPrevious!==!1&&F(),f(!0),j+=1;const pe=j;return A.value=!1,s(J,{...r,...typeof m=="object"?m:I,signal:S.signal}).then(O=>{if(A.value)return;R.value=O;const M=O.data;E.value=M,d(M)}).catch(O=>{D.value=O,v(O)}).finally(()=>{var O;(O=l.onFinish)==null||O.call(l),pe===j&&f(!1)}),H};g&&o&&z();const q={response:R,data:E,error:D,isFinished:i,isLoading:b,cancel:F,isAborted:A,isCanceled:A,abort:F,execute:z};return{...q,...H}}const N=Object.entries(ne).filter(([t,o])=>typeof o=="function"&&t.endsWith("Case")).reduce((t,[o,e])=>(t[o]=e,t),{});function re(t,o,e){const a=n.computed(()=>{const s=n.toValue(o);if(!N[s])throw new Error(`Invalid change case type "${s}"`);return s});if(typeof t=="function")return n.computed(()=>N[a.value](n.toValue(t),n.toValue(e)));const r=n.ref(t);return n.computed({get(){return N[a.value](r.value,n.toValue(e))},set(s){r.value=s}})}function se(t){const o=new k(t?t.headers.cookie:null);return(e,{doNotParse:a=!1,autoUpdateDependencies:r=!1}={})=>T(e,{doNotParse:a,autoUpdateDependencies:r},o)}function T(t,{doNotParse:o=!1,autoUpdateDependencies:e=!1}={},a=new k){const r=e?[...t||[]]:t;let s=a.getAll({doNotParse:!0});const l=n.shallowRef(0),c=()=>{const u=a.getAll({doNotParse:!0});ue(r||null,u,s)&&l.value++,s=u};return a.addChangeListener(c),C.tryOnScopeDispose(()=>{a.removeChangeListener(c)}),{get:(...u)=>(e&&r&&!r.includes(u[0])&&r.push(u[0]),l.value,a.get(u[0],{doNotParse:o,...u[1]})),getAll:(...u)=>(l.value,a.getAll({doNotParse:o,...u[0]})),set:(...u)=>a.set(...u),remove:(...u)=>a.remove(...u),addChangeListener:(...u)=>a.addChangeListener(...u),removeChangeListener:(...u)=>a.removeChangeListener(...u)}}function ue(t,o,e){if(!t)return!0;for(const a of t)if(o[a]!==e[a])return!0;return!1}function ce(t,o){const e=n.ref();let a=[];const r=p.createEventHook(),s=p.createEventHook(),l=p.createEventHook(),c=p.createEventHook(),u=p.createEventHook(),d=n.shallowRef(!1),v=n.shallowRef(!1),g=n.shallowRef(!1),h=n.shallowRef(!1),y=n.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...o?.brush});n.watch(y,()=>{const f=e.value;f&&(f.brush=y.value,f.mode=y.value.mode)},{deep:!0});const R=()=>{var f;return(f=e.value)==null?void 0:f.undo()},E=()=>{var f;return(f=e.value)==null?void 0:f.redo()},i=()=>{var f;return(f=e.value)==null?void 0:f.clear()},b=()=>{var f;return(f=e.value)==null?void 0:f.cancel()},A=f=>{var _;return(_=e.value)==null?void 0:_.load(f)},D=()=>{var f;return(f=e.value)==null?void 0:f.dump()},S=()=>{var f;a.forEach(_=>_()),(f=e.value)==null||f.unmount()},F=()=>{e.value&&(d.value=e.value.canUndo(),v.value=e.value.canRedo(),g.value=e.value.altPressed,h.value=e.value.shiftPressed)};return n.watch(()=>p.unrefElement(t),f=>{!f||typeof SVGSVGElement>"u"||!(f instanceof SVGSVGElement)||(e.value&&S(),e.value=K.createDrauu({el:f,...o}),F(),a=[e.value.on("canceled",()=>s.trigger()),e.value.on("committed",_=>l.trigger(_)),e.value.on("start",()=>c.trigger()),e.value.on("end",()=>u.trigger()),e.value.on("changed",()=>{F(),r.trigger()})])},{flush:"post"}),C.tryOnScopeDispose(()=>S()),{drauuInstance:e,load:A,dump:D,clear:i,cancel:b,undo:R,redo:E,canUndo:d,canRedo:v,brush:y,onChanged:r.on,onCommitted:l.on,onStart:c.on,onEnd:u.on,onCanceled:s.on}}function ie(t,o={}){let e;const{immediate:a,...r}=o,s=n.shallowRef(!1),l=n.shallowRef(!1),c=h=>e&&e.activate(h),u=h=>e&&e.deactivate(h),d=()=>{e&&(e.pause(),l.value=!0)},v=()=>{e&&(e.unpause(),l.value=!1)},g=n.computed(()=>{const h=n.toValue(t);return p.toArray(h).map(y=>{const R=n.toValue(y);return typeof R=="string"?R:p.unrefElement(R)}).filter(C.notNullish)});return n.watch(g,h=>{h.length&&(e=X.createFocusTrap(h,{...r,onActivate(){s.value=!0,o.onActivate&&o.onActivate()},onDeactivate(){s.value=!1,o.onDeactivate&&o.onDeactivate()}}),a&&c())},{flush:"post"}),p.tryOnScopeDispose(()=>u()),{hasFocus:s,isPaused:l,activate:c,deactivate:u,pause:d,unpause:v}}function fe(t,o,e){const a=()=>{var l,c;return new Y((l=n.toValue(o))!=null?l:[],(c=n.toValue(e))==null?void 0:c.fuseOptions)},r=n.ref(a());n.watch(()=>{var l;return(l=n.toValue(e))==null?void 0:l.fuseOptions},()=>{r.value=a()},{deep:!0}),n.watch(()=>n.toValue(o),l=>{r.value.setCollection(l)},{deep:!0});const s=n.computed(()=>{const l=n.toValue(e);if(l?.matchAllWhenSearchEmpty&&!n.toValue(t))return n.toValue(o).map((u,d)=>({item:u,refIndex:d}));const c=l?.resultLimit;return r.value.search(n.toValue(t),c?{limit:c}:void 0)});return{fuse:r,results:s}}function de(t,o,e={}){const{flush:a="pre",deep:r=!0,shallow:s=!1,onError:l=i=>{console.error(i)},writeDefaults:c=!0}=e,u=n.shallowRef(!1),d=(s?n.shallowRef:n.ref)(o),v=n.toValue(o);async function g(){try{const i=await P.get(t);i===void 0?v!=null&&c&&await P.set(t,v):d.value=i}catch(i){l(i)}u.value=!0}g();async function h(){try{d.value==null?await P.del(t):await P.update(t,()=>n.toRaw(d.value))}catch(i){l(i)}}const{pause:y,resume:R}=p.watchPausable(d,()=>h(),{flush:a,deep:r});async function E(i){y(),d.value=i,await h(),R()}return{set:E,isFinished:u,data:d}}function ve(t,o={}){const{onError:e,fallbackValue:a=null}=o,r=(c,u)=>{try{return Z.jwtDecode(c,u)}catch(d){return e?.(d),a}},s=n.computed(()=>r(n.toValue(t),{header:!0})),l=n.computed(()=>r(n.toValue(t)));return{header:s,payload:l}}function he(t=null,o){const e=C.toRef(t),a=n.computed({set:s=>s?V.start():V.done(),get:()=>typeof e.value=="number"&&e.value<1});o&&V.configure(o);const r=V.set;return V.set=s=>(e.value=s,r.call(V,s)),n.watchEffect(()=>{typeof e.value=="number"&&C.isClient&&r.call(V,e.value)}),C.tryOnScopeDispose(V.remove),{isLoading:a,progress:e,start:V.start,done:V.done,remove:()=>{e.value=null,V.remove()}}}function me(t,o){const e=C.toRef(t),a=n.shallowRef("");return n.watch(e,async r=>{e.value&&C.isClient&&(a.value=await x.toDataURL(r,o))},{immediate:!0}),a}function we(t,o,e={}){let a;const{document:r=p.defaultDocument,...s}=e,l={onUpdate:v=>{G(o,v.oldIndex,v.newIndex,v)}},c=()=>{const v=typeof t=="string"?r?.querySelector(t):p.unrefElement(t);!v||a!==void 0||(a=new ee(v,{...l,...s}))},u=()=>{a?.destroy(),a=void 0},d=(v,g)=>{if(g!==void 0)a?.option(v,g);else return a?.option(v)};return p.tryOnMounted(c),p.tryOnScopeDispose(u),{stop:u,start:c,option:d}}function B(t,o,e){const a=t.children[e];t.insertBefore(o,a)}function W(t){t.parentNode&&t.parentNode.removeChild(t)}function G(t,o,e,a=null){a!=null&&(W(a.item),B(a.from,a.item,o));const r=n.isRef(t),s=r?[...n.toValue(t)]:n.toValue(t);if(e>=0&&e<s.length){const l=s.splice(o,1)[0];n.nextTick(()=>{s.splice(e,0,l),r&&(t.value=s)})}}w.createCookies=se,w.insertNodeAt=B,w.moveArrayElement=G,w.removeNode=W,w.useAsyncValidator=oe,w.useAxios=le,w.useChangeCase=re,w.useCookies=T,w.useDrauu=ce,w.useFocusTrap=ie,w.useFuse=fe,w.useIDBKeyval=de,w.useJwt=ve,w.useNProgress=he,w.useQRCode=me,w.useSortable=we})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue,axios,changeCase,UniversalCookie,VueUse,Drauu,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable); |
{ | ||
"name": "@vueuse/integrations", | ||
"type": "module", | ||
"version": "12.7.0", | ||
"version": "12.8.0", | ||
"description": "Integration wrappers for utility libraries", | ||
@@ -158,4 +158,4 @@ "author": "Anthony Fu <https://github.com/antfu>", | ||
"vue": "^3.5.13", | ||
"@vueuse/shared": "12.7.0", | ||
"@vueuse/core": "12.7.0" | ||
"@vueuse/core": "12.8.0", | ||
"@vueuse/shared": "12.8.0" | ||
}, | ||
@@ -167,5 +167,5 @@ "devDependencies": { | ||
"async-validator": "^4.2.5", | ||
"axios": "^1.7.9", | ||
"axios": "^1.8.1", | ||
"change-case": "^5.4.4", | ||
"drauu": "^0.4.2", | ||
"drauu": "^0.4.3", | ||
"focus-trap": "^7.6.4", | ||
@@ -172,0 +172,0 @@ "fuse.js": "^7.1.0", |
@@ -1,4 +0,3 @@ | ||
import { MaybeRefOrGetter } from '@vueuse/shared'; | ||
import { ValidateError, ValidateOption, Rules } from 'async-validator'; | ||
import { Ref } from 'vue'; | ||
import { ShallowRef, ComputedRef, MaybeRefOrGetter } from 'vue'; | ||
@@ -16,7 +15,7 @@ type AsyncValidatorError = Error & { | ||
interface UseAsyncValidatorReturn { | ||
pass: Ref<boolean>; | ||
isFinished: Ref<boolean>; | ||
errors: Ref<AsyncValidatorError['errors'] | undefined>; | ||
errorInfo: Ref<AsyncValidatorError | null>; | ||
errorFields: Ref<AsyncValidatorError['fields'] | undefined>; | ||
pass: ShallowRef<boolean>; | ||
isFinished: ShallowRef<boolean>; | ||
errors: ComputedRef<AsyncValidatorError['errors'] | undefined>; | ||
errorInfo: ShallowRef<AsyncValidatorError | null>; | ||
errorFields: ComputedRef<AsyncValidatorError['fields'] | undefined>; | ||
execute: () => Promise<UseAsyncValidatorExecuteReturn>; | ||
@@ -23,0 +22,0 @@ } |
@@ -14,3 +14,3 @@ (function (exports, shared, Schema, vue) { | ||
const isFinished = vue.shallowRef(true); | ||
const pass = vue.ref(!immediate || manual); | ||
const pass = vue.shallowRef(!immediate || manual); | ||
const errors = vue.computed(() => { | ||
@@ -17,0 +17,0 @@ var _a; |
@@ -1,1 +0,1 @@ | ||
(function(m,s,u,t){"use strict";const p=u.default||u;function w(y,A,F={}){const{validateOption:R={},immediate:o=!0,manual:i=!1}=F,c=s.toRef(y),a=t.shallowRef(null),r=t.shallowRef(!0),l=t.ref(!o||i),d=t.computed(()=>{var e;return((e=a.value)==null?void 0:e.errors)||[]}),f=t.computed(()=>{var e;return((e=a.value)==null?void 0:e.fields)||{}}),v=t.computed(()=>new p(t.toValue(A))),h=async()=>{r.value=!1,l.value=!1;try{await v.value.validate(c.value,R),l.value=!0,a.value=null}catch(e){a.value=e}finally{r.value=!0}return{pass:l.value,errorInfo:a.value,errors:d.value,errorFields:f.value}};i||t.watch([c,v],()=>h(),{immediate:o,deep:!0});const V={isFinished:r,pass:l,errors:d,errorInfo:a,errorFields:f,execute:h};function U(){return new Promise((e,n)=>{s.until(r).toBe(!0).then(()=>e(V)).catch(I=>n(I))})}return{...V,then(e,n){return U().then(e,n)}}}m.useAsyncValidator=w})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue); | ||
(function(w,s,u,t){"use strict";const m=u.default||u;function p(y,R,A={}){const{validateOption:F={},immediate:o=!0,manual:i=!1}=A,c=s.toRef(y),a=t.shallowRef(null),l=t.shallowRef(!0),r=t.shallowRef(!o||i),d=t.computed(()=>{var e;return((e=a.value)==null?void 0:e.errors)||[]}),f=t.computed(()=>{var e;return((e=a.value)==null?void 0:e.fields)||{}}),v=t.computed(()=>new m(t.toValue(R))),h=async()=>{l.value=!1,r.value=!1;try{await v.value.validate(c.value,F),r.value=!0,a.value=null}catch(e){a.value=e}finally{l.value=!0}return{pass:r.value,errorInfo:a.value,errors:d.value,errorFields:f.value}};i||t.watch([c,v],()=>h(),{immediate:o,deep:!0});const V={isFinished:l,pass:r,errors:d,errorInfo:a,errorFields:f,execute:h};function U(){return new Promise((e,n)=>{s.until(l).toBe(!0).then(()=>e(V)).catch(I=>n(I))})}return{...V,then(e,n){return U().then(e,n)}}}w.useAsyncValidator=p})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue); |
@@ -1,5 +0,4 @@ | ||
import { MaybeRef, MaybeRefOrGetter } from '@vueuse/shared'; | ||
import * as changeCase from 'change-case'; | ||
import { Options } from 'change-case'; | ||
import { WritableComputedRef, ComputedRef } from 'vue'; | ||
import { MaybeRef, MaybeRefOrGetter, WritableComputedRef, ComputedRef } from 'vue'; | ||
@@ -6,0 +5,0 @@ type EndsWithCase<T> = T extends `${infer _}Case` ? T : never; |
import { EventHookOn, MaybeComputedElementRef } from '@vueuse/core'; | ||
import { Options, Drauu, Brush } from 'drauu'; | ||
import { Ref } from 'vue'; | ||
import { Ref, ShallowRef } from 'vue'; | ||
@@ -14,4 +14,4 @@ type UseDrauuOptions = Omit<Options, 'el'>; | ||
redo: () => boolean | undefined; | ||
canUndo: Ref<boolean>; | ||
canRedo: Ref<boolean>; | ||
canUndo: ShallowRef<boolean>; | ||
canRedo: ShallowRef<boolean>; | ||
brush: Ref<Brush>; | ||
@@ -18,0 +18,0 @@ onChanged: EventHookOn; |
import { Fn, Arrayable, MaybeComputedElementRef } from '@vueuse/core'; | ||
import { MaybeRefOrGetter } from '@vueuse/shared'; | ||
import { Options, ActivateOptions, DeactivateOptions } from 'focus-trap'; | ||
import { Ref } from 'vue'; | ||
import { ShallowRef, MaybeRefOrGetter } from 'vue'; | ||
@@ -16,7 +15,7 @@ interface UseFocusTrapOptions extends Options { | ||
*/ | ||
hasFocus: Ref<boolean>; | ||
hasFocus: ShallowRef<boolean>; | ||
/** | ||
* Indicates if the focus trap is currently paused | ||
*/ | ||
isPaused: Ref<boolean>; | ||
isPaused: ShallowRef<boolean>; | ||
/** | ||
@@ -23,0 +22,0 @@ * Activate the focus trap |
import * as vue from 'vue'; | ||
import { ComputedRef } from 'vue'; | ||
import { MaybeRefOrGetter, ComputedRef } from 'vue'; | ||
import * as fuse_js from 'fuse.js'; | ||
import fuse_js__default, { IFuseOptions, FuseResult } from 'fuse.js'; | ||
import { MaybeRefOrGetter } from '@vueuse/shared'; | ||
@@ -7,0 +6,0 @@ type FuseOptions<T> = IFuseOptions<T>; |
@@ -1,3 +0,3 @@ | ||
import { ConfigurableFlush, RemovableRef, MaybeRefOrGetter } from '@vueuse/shared'; | ||
import { Ref } from 'vue'; | ||
import { ConfigurableFlush, RemovableRef } from '@vueuse/shared'; | ||
import { ShallowRef, MaybeRefOrGetter } from 'vue'; | ||
@@ -32,3 +32,3 @@ interface UseIDBOptions extends ConfigurableFlush { | ||
data: RemovableRef<T>; | ||
isFinished: Ref<boolean>; | ||
isFinished: ShallowRef<boolean>; | ||
set: (value: T) => Promise<void>; | ||
@@ -35,0 +35,0 @@ } |
@@ -1,4 +0,3 @@ | ||
import { MaybeRefOrGetter } from '@vueuse/shared'; | ||
import { JwtPayload, JwtHeader } from 'jwt-decode'; | ||
import { ComputedRef } from 'vue'; | ||
import { ComputedRef, MaybeRefOrGetter } from 'vue'; | ||
@@ -5,0 +4,0 @@ interface UseJwtOptions<Fallback> { |
import * as vue from 'vue'; | ||
import { MaybeRefOrGetter } from '@vueuse/shared'; | ||
import { MaybeRefOrGetter } from 'vue'; | ||
import nprogress, { NProgressOptions } from 'nprogress'; | ||
@@ -4,0 +4,0 @@ |
import * as vue from 'vue'; | ||
import { MaybeRefOrGetter } from '@vueuse/shared'; | ||
import { MaybeRefOrGetter } from 'vue'; | ||
import QRCode from 'qrcode'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,4 @@ | ||
import { ConfigurableDocument, MaybeRefOrGetter } from '@vueuse/core'; | ||
import { ConfigurableDocument } from '@vueuse/core'; | ||
import Sortable, { Options } from 'sortablejs'; | ||
import { MaybeRefOrGetter } from 'vue'; | ||
@@ -4,0 +5,0 @@ interface UseSortableReturn { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
286346
-0.01%5580
-0.07%