@vueuse/integrations 12.6.1 → 12.7.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 CHANGED
@@ -44,7 +44,7 @@ function useAsyncValidator(value, rules, options = {}) {
44
44
  } = options;
45
45
  const valueRef = shared.toRef(value);
46
46
  const errorInfo = vue.shallowRef(null);
47
- const isFinished = vue.ref(true);
47
+ const isFinished = vue.shallowRef(true);
48
48
  const pass = vue.ref(!immediate || manual);
49
49
  const errors = vue.computed(() => {
50
50
  var _a;
@@ -137,9 +137,9 @@ function useAxios(...args) {
137
137
  const initialData = options.initialData;
138
138
  const response = vue.shallowRef();
139
139
  const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
140
- const isFinished = vue.ref(false);
141
- const isLoading = vue.ref(false);
142
- const isAborted = vue.ref(false);
140
+ const isFinished = vue.shallowRef(false);
141
+ const isLoading = vue.shallowRef(false);
142
+ const isAborted = vue.shallowRef(false);
143
143
  const error = vue.shallowRef();
144
144
  let abortController = new AbortController();
145
145
  const abort = (message) => {
@@ -251,7 +251,7 @@ function createCookies(req) {
251
251
  function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
252
252
  const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
253
253
  let previousCookies = cookies.getAll({ doNotParse: true });
254
- const touches = vue.ref(0);
254
+ const touches = vue.shallowRef(0);
255
255
  const onChange = () => {
256
256
  const newCookies = cookies.getAll({ doNotParse: true });
257
257
  if (shouldUpdate(
@@ -308,10 +308,10 @@ function useDrauu(target, options) {
308
308
  const onCommittedHook = core.createEventHook();
309
309
  const onStartHook = core.createEventHook();
310
310
  const onEndHook = core.createEventHook();
311
- const canUndo = vue.ref(false);
312
- const canRedo = vue.ref(false);
313
- const altPressed = vue.ref(false);
314
- const shiftPressed = vue.ref(false);
311
+ const canUndo = vue.shallowRef(false);
312
+ const canRedo = vue.shallowRef(false);
313
+ const altPressed = vue.shallowRef(false);
314
+ const shiftPressed = vue.shallowRef(false);
315
315
  const brush = vue.ref({
316
316
  color: "black",
317
317
  size: 3,
@@ -411,8 +411,8 @@ function useDrauu(target, options) {
411
411
  function useFocusTrap(target, options = {}) {
412
412
  let trap;
413
413
  const { immediate, ...focusTrapOptions } = options;
414
- const hasFocus = vue.ref(false);
415
- const isPaused = vue.ref(false);
414
+ const hasFocus = vue.shallowRef(false);
415
+ const isPaused = vue.shallowRef(false);
416
416
  const activate = (opts) => trap && trap.activate(opts);
417
417
  const deactivate = (opts) => trap && trap.deactivate(opts);
418
418
  const pause = () => {
@@ -517,7 +517,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
517
517
  },
518
518
  writeDefaults = true
519
519
  } = options;
520
- const isFinished = vue.ref(false);
520
+ const isFinished = vue.shallowRef(false);
521
521
  const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
522
522
  const rawInit = vue.toValue(initialValue);
523
523
  async function read() {
@@ -616,7 +616,7 @@ function useNProgress(currentProgress = null, options) {
616
616
 
617
617
  function useQRCode(text, options) {
618
618
  const src = shared.toRef(text);
619
- const result = vue.ref("");
619
+ const result = vue.shallowRef("");
620
620
  vue.watch(
621
621
  src,
622
622
  async (value) => {
package/index.d.cts CHANGED
@@ -407,7 +407,7 @@ type UseNProgressReturn = ReturnType<typeof useNProgress>;
407
407
  * @param text
408
408
  * @param options
409
409
  */
410
- declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
410
+ declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
411
411
 
412
412
  interface UseSortableReturn {
413
413
  /**
package/index.d.mts CHANGED
@@ -407,7 +407,7 @@ type UseNProgressReturn = ReturnType<typeof useNProgress>;
407
407
  * @param text
408
408
  * @param options
409
409
  */
410
- declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
410
+ declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
411
411
 
412
412
  interface UseSortableReturn {
413
413
  /**
package/index.d.ts CHANGED
@@ -407,7 +407,7 @@ type UseNProgressReturn = ReturnType<typeof useNProgress>;
407
407
  * @param text
408
408
  * @param options
409
409
  */
410
- declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
410
+ declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
411
411
 
412
412
  interface UseSortableReturn {
413
413
  /**
package/index.iife.js CHANGED
@@ -29,7 +29,7 @@
29
29
  } = options;
30
30
  const valueRef = shared.toRef(value);
31
31
  const errorInfo = vue.shallowRef(null);
32
- const isFinished = vue.ref(true);
32
+ const isFinished = vue.shallowRef(true);
33
33
  const pass = vue.ref(!immediate || manual);
34
34
  const errors = vue.computed(() => {
35
35
  var _a;
@@ -122,9 +122,9 @@
122
122
  const initialData = options.initialData;
123
123
  const response = vue.shallowRef();
124
124
  const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
125
- const isFinished = vue.ref(false);
126
- const isLoading = vue.ref(false);
127
- const isAborted = vue.ref(false);
125
+ const isFinished = vue.shallowRef(false);
126
+ const isLoading = vue.shallowRef(false);
127
+ const isAborted = vue.shallowRef(false);
128
128
  const error = vue.shallowRef();
129
129
  let abortController = new AbortController();
130
130
  const abort = (message) => {
@@ -236,7 +236,7 @@
236
236
  function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
237
237
  const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
238
238
  let previousCookies = cookies.getAll({ doNotParse: true });
239
- const touches = vue.ref(0);
239
+ const touches = vue.shallowRef(0);
240
240
  const onChange = () => {
241
241
  const newCookies = cookies.getAll({ doNotParse: true });
242
242
  if (shouldUpdate(
@@ -293,10 +293,10 @@
293
293
  const onCommittedHook = core.createEventHook();
294
294
  const onStartHook = core.createEventHook();
295
295
  const onEndHook = core.createEventHook();
296
- const canUndo = vue.ref(false);
297
- const canRedo = vue.ref(false);
298
- const altPressed = vue.ref(false);
299
- const shiftPressed = vue.ref(false);
296
+ const canUndo = vue.shallowRef(false);
297
+ const canRedo = vue.shallowRef(false);
298
+ const altPressed = vue.shallowRef(false);
299
+ const shiftPressed = vue.shallowRef(false);
300
300
  const brush = vue.ref({
301
301
  color: "black",
302
302
  size: 3,
@@ -396,8 +396,8 @@
396
396
  function useFocusTrap(target, options = {}) {
397
397
  let trap;
398
398
  const { immediate, ...focusTrapOptions } = options;
399
- const hasFocus = vue.ref(false);
400
- const isPaused = vue.ref(false);
399
+ const hasFocus = vue.shallowRef(false);
400
+ const isPaused = vue.shallowRef(false);
401
401
  const activate = (opts) => trap && trap.activate(opts);
402
402
  const deactivate = (opts) => trap && trap.deactivate(opts);
403
403
  const pause = () => {
@@ -502,7 +502,7 @@
502
502
  },
503
503
  writeDefaults = true
504
504
  } = options;
505
- const isFinished = vue.ref(false);
505
+ const isFinished = vue.shallowRef(false);
506
506
  const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
507
507
  const rawInit = vue.toValue(initialValue);
508
508
  async function read() {
@@ -601,7 +601,7 @@
601
601
 
602
602
  function useQRCode(text, options) {
603
603
  const src = shared.toRef(text);
604
- const result = vue.ref("");
604
+ const result = vue.shallowRef("");
605
605
  vue.watch(
606
606
  src,
607
607
  async (value) => {
package/index.iife.min.js CHANGED
@@ -1 +1 @@
1
- (function(p,C,U,n,L,$,k,w,K,X,Y,P,Z,b,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.ref(!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 V={isFinished:s,pass:d,errors:v,errorInfo:c,errorFields:g,execute:y};function A(){return new Promise((i,E)=>{C.until(s).toBe(!0).then(()=>i(V)).catch(D=>E(D))})}return{...V,then(i,E){return A().then(i,E)}}}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,V=n.shallowRef(),A=(s?n.shallowRef:n.ref)(y),i=n.ref(!1),E=n.ref(!1),D=n.ref(!1),R=n.shallowRef();let S=new AbortController;const F=m=>{i.value||!E.value||(S.abort(m),S=new AbortController,D.value=!0,E.value=!1,i.value=!1)},f=m=>{E.value=m,i.value=!m},_=()=>{h&&(A.value=y)},Q=()=>new Promise((m,I)=>{C.until(i).toBe(!0).then(()=>R.value?I(R.value):m(q))}),H={then:(...m)=>Q().then(...m),catch:(...m)=>Q().catch(...m)};let j=0;const z=(m=o,I={})=>{R.value=void 0;const J=typeof m=="string"?m:o??I.url;if(J===void 0)return R.value=new L.AxiosError(L.AxiosError.ERR_INVALID_URL),i.value=!0,H;_(),l.abortPrevious!==!1&&F(),f(!0),j+=1;const we=j;return D.value=!1,u(J,{...r,...typeof m=="object"?m:I,signal:S.signal}).then(O=>{if(D.value)return;V.value=O;const M=O.data;A.value=M,d(M)}).catch(O=>{R.value=O,v(O)}).finally(()=>{var O;(O=l.onFinish)==null||O.call(l),we===j&&f(!1)}),H};g&&o&&z();const q={response:V,data:A,error:R,isFinished:i,isLoading:E,cancel:F,isAborted:D,isCanceled:D,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.ref(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=w.createEventHook(),u=w.createEventHook(),l=w.createEventHook(),c=w.createEventHook(),s=w.createEventHook(),d=n.ref(!1),v=n.ref(!1),g=n.ref(!1),h=n.ref(!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 V=()=>{var f;return(f=e.value)==null?void 0:f.undo()},A=()=>{var f;return(f=e.value)==null?void 0:f.redo()},i=()=>{var f;return(f=e.value)==null?void 0:f.clear()},E=()=>{var f;return(f=e.value)==null?void 0:f.cancel()},D=f=>{var _;return(_=e.value)==null?void 0:_.load(f)},R=()=>{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(()=>w.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:D,dump:R,clear:i,cancel:E,undo:V,redo:A,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.ref(!1),l=n.ref(!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 w.toArray(h).map(y=>{const V=n.toValue(y);return typeof V=="string"?V:w.unrefElement(V)}).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"}),w.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.ref(!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:V}=w.watchPausable(d,()=>h(),{flush:a,deep:r});async function A(i){y(),d.value=i,await h(),V()}return{set:A,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?b.start():b.done(),get:()=>typeof e.value=="number"&&e.value<1});o&&b.configure(o);const r=b.set;return b.set=u=>(e.value=u,r.call(b,u)),n.watchEffect(()=>{typeof e.value=="number"&&C.isClient&&r.call(b,e.value)}),C.tryOnScopeDispose(b.remove),{isLoading:a,progress:e,start:b.start,done:b.done,remove:()=>{e.value=null,b.remove()}}}function me(t,o){const e=C.toRef(t),a=n.ref("");return n.watch(e,async r=>{e.value&&C.isClient&&(a.value=await x.toDataURL(r,o))},{immediate:!0}),a}function pe(t,o,e={}){let a;const{document:r=w.defaultDocument,...u}=e,l={onUpdate:v=>{G(o,v.oldIndex,v.newIndex,v)}},c=()=>{const v=typeof t=="string"?r?.querySelector(t):w.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 w.tryOnMounted(c),w.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)})}}p.createCookies=ue,p.insertNodeAt=B,p.moveArrayElement=G,p.removeNode=W,p.useAsyncValidator=oe,p.useAxios=le,p.useChangeCase=re,p.useCookies=T,p.useDrauu=ce,p.useFocusTrap=ie,p.useFuse=fe,p.useIDBKeyval=de,p.useJwt=ve,p.useNProgress=he,p.useQRCode=me,p.useSortable=pe})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue,axios,changeCase,UniversalCookie,VueUse,Drauu,focusTrap,Fuse,idbKeyval,jwt_decode,nprogress,QRCode,Sortable);
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);
package/index.mjs CHANGED
@@ -23,7 +23,7 @@ function useAsyncValidator(value, rules, options = {}) {
23
23
  } = options;
24
24
  const valueRef = toRef(value);
25
25
  const errorInfo = shallowRef(null);
26
- const isFinished = ref(true);
26
+ const isFinished = shallowRef(true);
27
27
  const pass = ref(!immediate || manual);
28
28
  const errors = computed(() => {
29
29
  var _a;
@@ -116,9 +116,9 @@ function useAxios(...args) {
116
116
  const initialData = options.initialData;
117
117
  const response = shallowRef();
118
118
  const data = (shallow ? shallowRef : ref)(initialData);
119
- const isFinished = ref(false);
120
- const isLoading = ref(false);
121
- const isAborted = ref(false);
119
+ const isFinished = shallowRef(false);
120
+ const isLoading = shallowRef(false);
121
+ const isAborted = shallowRef(false);
122
122
  const error = shallowRef();
123
123
  let abortController = new AbortController();
124
124
  const abort = (message) => {
@@ -230,7 +230,7 @@ function createCookies(req) {
230
230
  function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
231
231
  const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
232
232
  let previousCookies = cookies.getAll({ doNotParse: true });
233
- const touches = ref(0);
233
+ const touches = shallowRef(0);
234
234
  const onChange = () => {
235
235
  const newCookies = cookies.getAll({ doNotParse: true });
236
236
  if (shouldUpdate(
@@ -287,10 +287,10 @@ function useDrauu(target, options) {
287
287
  const onCommittedHook = createEventHook();
288
288
  const onStartHook = createEventHook();
289
289
  const onEndHook = createEventHook();
290
- const canUndo = ref(false);
291
- const canRedo = ref(false);
292
- const altPressed = ref(false);
293
- const shiftPressed = ref(false);
290
+ const canUndo = shallowRef(false);
291
+ const canRedo = shallowRef(false);
292
+ const altPressed = shallowRef(false);
293
+ const shiftPressed = shallowRef(false);
294
294
  const brush = ref({
295
295
  color: "black",
296
296
  size: 3,
@@ -390,8 +390,8 @@ function useDrauu(target, options) {
390
390
  function useFocusTrap(target, options = {}) {
391
391
  let trap;
392
392
  const { immediate, ...focusTrapOptions } = options;
393
- const hasFocus = ref(false);
394
- const isPaused = ref(false);
393
+ const hasFocus = shallowRef(false);
394
+ const isPaused = shallowRef(false);
395
395
  const activate = (opts) => trap && trap.activate(opts);
396
396
  const deactivate = (opts) => trap && trap.deactivate(opts);
397
397
  const pause = () => {
@@ -496,7 +496,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
496
496
  },
497
497
  writeDefaults = true
498
498
  } = options;
499
- const isFinished = ref(false);
499
+ const isFinished = shallowRef(false);
500
500
  const data = (shallow ? shallowRef : ref)(initialValue);
501
501
  const rawInit = toValue(initialValue);
502
502
  async function read() {
@@ -595,7 +595,7 @@ function useNProgress(currentProgress = null, options) {
595
595
 
596
596
  function useQRCode(text, options) {
597
597
  const src = toRef(text);
598
- const result = ref("");
598
+ const result = shallowRef("");
599
599
  watch(
600
600
  src,
601
601
  async (value) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vueuse/integrations",
3
3
  "type": "module",
4
- "version": "12.6.1",
4
+ "version": "12.7.0",
5
5
  "description": "Integration wrappers for utility libraries",
6
6
  "author": "Anthony Fu <https://github.com/antfu>",
7
7
  "license": "MIT",
@@ -155,8 +155,8 @@
155
155
  },
156
156
  "dependencies": {
157
157
  "vue": "^3.5.13",
158
- "@vueuse/core": "12.6.1",
159
- "@vueuse/shared": "12.6.1"
158
+ "@vueuse/shared": "12.7.0",
159
+ "@vueuse/core": "12.7.0"
160
160
  },
161
161
  "devDependencies": {
162
162
  "@types/nprogress": "^0.2.3",
@@ -13,7 +13,7 @@ function useAsyncValidator(value, rules, options = {}) {
13
13
  } = options;
14
14
  const valueRef = shared.toRef(value);
15
15
  const errorInfo = vue.shallowRef(null);
16
- const isFinished = vue.ref(true);
16
+ const isFinished = vue.shallowRef(true);
17
17
  const pass = vue.ref(!immediate || manual);
18
18
  const errors = vue.computed(() => errorInfo.value?.errors || []);
19
19
  const errorFields = vue.computed(() => errorInfo.value?.fields || {});
@@ -11,7 +11,7 @@ function useAsyncValidator(value, rules, options = {}) {
11
11
  } = options;
12
12
  const valueRef = toRef(value);
13
13
  const errorInfo = shallowRef(null);
14
- const isFinished = ref(true);
14
+ const isFinished = shallowRef(true);
15
15
  const pass = ref(!immediate || manual);
16
16
  const errors = computed(() => errorInfo.value?.errors || []);
17
17
  const errorFields = computed(() => errorInfo.value?.fields || {});
@@ -13,7 +13,7 @@ function useAsyncValidator(value, rules, options = {}) {
13
13
  } = options;
14
14
  const valueRef = shared.toRef(value);
15
15
  const errorInfo = vue.shallowRef(null);
16
- const isFinished = vue.ref(true);
16
+ const isFinished = vue.shallowRef(true);
17
17
  const pass = vue.ref(!immediate || manual);
18
18
  const errors = vue.computed(() => {
19
19
  var _a;
@@ -10,7 +10,7 @@
10
10
  } = options;
11
11
  const valueRef = shared.toRef(value);
12
12
  const errorInfo = vue.shallowRef(null);
13
- const isFinished = vue.ref(true);
13
+ const isFinished = vue.shallowRef(true);
14
14
  const pass = vue.ref(!immediate || manual);
15
15
  const errors = vue.computed(() => {
16
16
  var _a;
@@ -1 +1 @@
1
- (function(m,s,u,t){"use strict";const p=u.default||u;function y(w,A,F={}){const{validateOption:U={},immediate:o=!0,manual:i=!1}=F,c=s.toRef(w),r=t.shallowRef(null),a=t.ref(!0),l=t.ref(!o||i),d=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.errors)||[]}),f=t.computed(()=>{var e;return((e=r.value)==null?void 0:e.fields)||{}}),v=t.computed(()=>new p(t.toValue(A))),h=async()=>{a.value=!1,l.value=!1;try{await v.value.validate(c.value,U),l.value=!0,r.value=null}catch(e){r.value=e}finally{a.value=!0}return{pass:l.value,errorInfo:r.value,errors:d.value,errorFields:f.value}};i||t.watch([c,v],()=>h(),{immediate:o,deep:!0});const V={isFinished:a,pass:l,errors:d,errorInfo:r,errorFields:f,execute:h};function R(){return new Promise((e,n)=>{s.until(a).toBe(!0).then(()=>e(V)).catch(I=>n(I))})}return{...V,then(e,n){return R().then(e,n)}}}m.useAsyncValidator=y})(this.VueUse=this.VueUse||{},VueUse,AsyncValidator,Vue);
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);
@@ -11,7 +11,7 @@ function useAsyncValidator(value, rules, options = {}) {
11
11
  } = options;
12
12
  const valueRef = toRef(value);
13
13
  const errorInfo = shallowRef(null);
14
- const isFinished = ref(true);
14
+ const isFinished = shallowRef(true);
15
15
  const pass = ref(!immediate || manual);
16
16
  const errors = computed(() => {
17
17
  var _a;
package/useAxios.cjs CHANGED
@@ -39,9 +39,9 @@ function useAxios(...args) {
39
39
  const initialData = options.initialData;
40
40
  const response = vue.shallowRef();
41
41
  const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
42
- const isFinished = vue.ref(false);
43
- const isLoading = vue.ref(false);
44
- const isAborted = vue.ref(false);
42
+ const isFinished = vue.shallowRef(false);
43
+ const isLoading = vue.shallowRef(false);
44
+ const isAborted = vue.shallowRef(false);
45
45
  const error = vue.shallowRef();
46
46
  let abortController = new AbortController();
47
47
  const abort = (message) => {
package/useAxios.iife.js CHANGED
@@ -36,9 +36,9 @@
36
36
  const initialData = options.initialData;
37
37
  const response = vue.shallowRef();
38
38
  const data = (shallow ? vue.shallowRef : vue.ref)(initialData);
39
- const isFinished = vue.ref(false);
40
- const isLoading = vue.ref(false);
41
- const isAborted = vue.ref(false);
39
+ const isFinished = vue.shallowRef(false);
40
+ const isLoading = vue.shallowRef(false);
41
+ const isAborted = vue.shallowRef(false);
42
42
  const error = vue.shallowRef();
43
43
  let abortController = new AbortController();
44
44
  const abort = (message) => {
@@ -1 +1 @@
1
- (function(L,h,v,l){"use strict";function O(...t){const r=typeof t[0]=="string"?t[0]:void 0,n=typeof r=="string"?1:0,E={immediate:!!n,shallow:!0,abortPrevious:!0};let R={},d=v,s=E;const p=e=>!!e?.request;t.length>0+n&&(p(t[0+n])?d=t[0+n]:R=t[0+n]),t.length>1+n&&p(t[1+n])&&(d=t[1+n]),(t.length===2+n&&!p(t[1+n])||t.length===3+n)&&(s=t[t.length-1]||E);const{shallow:U,onSuccess:j=h.noop,onError:q=h.noop,immediate:B,resetOnExecute:N=!1}=s,x=s.initialData,y=l.shallowRef(),w=(U?l.shallowRef:l.ref)(x),i=l.ref(!1),c=l.ref(!1),u=l.ref(!1),a=l.shallowRef();let b=new AbortController;const A=e=>{i.value||!c.value||(b.abort(e),b=new AbortController,u.value=!0,c.value=!1,i.value=!1)},V=e=>{c.value=e,i.value=!e},S=()=>{N&&(w.value=x)},D=()=>new Promise((e,f)=>{h.until(i).toBe(!0).then(()=>a.value?f(a.value):e(_))}),C={then:(...e)=>D().then(...e),catch:(...e)=>D().catch(...e)};let m=0;const P=(e=r,f={})=>{a.value=void 0;const F=typeof e=="string"?e:r??f.url;if(F===void 0)return a.value=new v.AxiosError(v.AxiosError.ERR_INVALID_URL),i.value=!0,C;S(),s.abortPrevious!==!1&&A(),V(!0),m+=1;const k=m;return u.value=!1,d(F,{...R,...typeof e=="object"?e:f,signal:b.signal}).then(o=>{if(u.value)return;y.value=o;const I=o.data;w.value=I,j(I)}).catch(o=>{a.value=o,q(o)}).finally(()=>{var o;(o=s.onFinish)==null||o.call(s),k===m&&V(!1)}),C};B&&r&&P();const _={response:y,data:w,error:a,isFinished:i,isLoading:c,cancel:A,isAborted:u,isCanceled:u,abort:A,execute:P};return{..._,...C}}L.useAxios=O})(this.VueUse=this.VueUse||{},VueUse,axios,Vue);
1
+ (function(L,h,v,n){"use strict";function O(...t){const u=typeof t[0]=="string"?t[0]:void 0,o=typeof u=="string"?1:0,m={immediate:!!o,shallow:!0,abortPrevious:!0};let E={},d=v,s=m;const w=e=>!!e?.request;t.length>0+o&&(w(t[0+o])?d=t[0+o]:E=t[0+o]),t.length>1+o&&w(t[1+o])&&(d=t[1+o]),(t.length===2+o&&!w(t[1+o])||t.length===3+o)&&(s=t[t.length-1]||m);const{shallow:U,onSuccess:j=h.noop,onError:q=h.noop,immediate:B,resetOnExecute:N=!1}=s,x=s.initialData,y=n.shallowRef(),p=(U?n.shallowRef:n.ref)(x),i=n.shallowRef(!1),c=n.shallowRef(!1),r=n.shallowRef(!1),a=n.shallowRef();let b=new AbortController;const A=e=>{i.value||!c.value||(b.abort(e),b=new AbortController,r.value=!0,c.value=!1,i.value=!1)},V=e=>{c.value=e,i.value=!e},S=()=>{N&&(p.value=x)},D=()=>new Promise((e,f)=>{h.until(i).toBe(!0).then(()=>a.value?f(a.value):e(_))}),R={then:(...e)=>D().then(...e),catch:(...e)=>D().catch(...e)};let C=0;const P=(e=u,f={})=>{a.value=void 0;const F=typeof e=="string"?e:u??f.url;if(F===void 0)return a.value=new v.AxiosError(v.AxiosError.ERR_INVALID_URL),i.value=!0,R;S(),s.abortPrevious!==!1&&A(),V(!0),C+=1;const k=C;return r.value=!1,d(F,{...E,...typeof e=="object"?e:f,signal:b.signal}).then(l=>{if(r.value)return;y.value=l;const I=l.data;p.value=I,j(I)}).catch(l=>{a.value=l,q(l)}).finally(()=>{var l;(l=s.onFinish)==null||l.call(s),k===C&&V(!1)}),R};B&&u&&P();const _={response:y,data:p,error:a,isFinished:i,isLoading:c,cancel:A,isAborted:r,isCanceled:r,abort:A,execute:P};return{..._,...R}}L.useAxios=O})(this.VueUse=this.VueUse||{},VueUse,axios,Vue);
package/useAxios.mjs CHANGED
@@ -37,9 +37,9 @@ function useAxios(...args) {
37
37
  const initialData = options.initialData;
38
38
  const response = shallowRef();
39
39
  const data = (shallow ? shallowRef : ref)(initialData);
40
- const isFinished = ref(false);
41
- const isLoading = ref(false);
42
- const isAborted = ref(false);
40
+ const isFinished = shallowRef(false);
41
+ const isLoading = shallowRef(false);
42
+ const isAborted = shallowRef(false);
43
43
  const error = shallowRef();
44
44
  let abortController = new AbortController();
45
45
  const abort = (message) => {
package/useCookies.cjs CHANGED
@@ -11,7 +11,7 @@ function createCookies(req) {
11
11
  function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
12
12
  const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
13
13
  let previousCookies = cookies.getAll({ doNotParse: true });
14
- const touches = vue.ref(0);
14
+ const touches = vue.shallowRef(0);
15
15
  const onChange = () => {
16
16
  const newCookies = cookies.getAll({ doNotParse: true });
17
17
  if (shouldUpdate(
@@ -8,7 +8,7 @@
8
8
  function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
9
9
  const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
10
10
  let previousCookies = cookies.getAll({ doNotParse: true });
11
- const touches = vue.ref(0);
11
+ const touches = vue.shallowRef(0);
12
12
  const onChange = () => {
13
13
  const newCookies = cookies.getAll({ doNotParse: true });
14
14
  if (shouldUpdate(
@@ -1 +1 @@
1
- (function(a,C,o,g){"use strict";function v(n){const r=new o(n?n.headers.cookie:null);return(u,{doNotParse:t=!1,autoUpdateDependencies:s=!1}={})=>i(u,{doNotParse:t,autoUpdateDependencies:s},r)}function i(n,{doNotParse:r=!1,autoUpdateDependencies:u=!1}={},t=new o){const s=u?[...n||[]]:n;let f=t.getAll({doNotParse:!0});const l=g.ref(0),h=()=>{const e=t.getAll({doNotParse:!0});c(s||null,e,f)&&l.value++,f=e};return t.addChangeListener(h),C.tryOnScopeDispose(()=>{t.removeChangeListener(h)}),{get:(...e)=>(u&&s&&!s.includes(e[0])&&s.push(e[0]),l.value,t.get(e[0],{doNotParse:r,...e[1]})),getAll:(...e)=>(l.value,t.getAll({doNotParse:r,...e[0]})),set:(...e)=>t.set(...e),remove:(...e)=>t.remove(...e),addChangeListener:(...e)=>t.addChangeListener(...e),removeChangeListener:(...e)=>t.removeChangeListener(...e)}}function c(n,r,u){if(!n)return!0;for(const t of n)if(r[t]!==u[t])return!0;return!1}a.createCookies=v,a.useCookies=i})(this.VueUse=this.VueUse||{},VueUse,UniversalCookie,Vue);
1
+ (function(a,C,o,g){"use strict";function v(n){const r=new o(n?n.headers.cookie:null);return(u,{doNotParse:t=!1,autoUpdateDependencies:s=!1}={})=>i(u,{doNotParse:t,autoUpdateDependencies:s},r)}function i(n,{doNotParse:r=!1,autoUpdateDependencies:u=!1}={},t=new o){const s=u?[...n||[]]:n;let f=t.getAll({doNotParse:!0});const l=g.shallowRef(0),h=()=>{const e=t.getAll({doNotParse:!0});c(s||null,e,f)&&l.value++,f=e};return t.addChangeListener(h),C.tryOnScopeDispose(()=>{t.removeChangeListener(h)}),{get:(...e)=>(u&&s&&!s.includes(e[0])&&s.push(e[0]),l.value,t.get(e[0],{doNotParse:r,...e[1]})),getAll:(...e)=>(l.value,t.getAll({doNotParse:r,...e[0]})),set:(...e)=>t.set(...e),remove:(...e)=>t.remove(...e),addChangeListener:(...e)=>t.addChangeListener(...e),removeChangeListener:(...e)=>t.removeChangeListener(...e)}}function c(n,r,u){if(!n)return!0;for(const t of n)if(r[t]!==u[t])return!0;return!1}a.createCookies=v,a.useCookies=i})(this.VueUse=this.VueUse||{},VueUse,UniversalCookie,Vue);
package/useCookies.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { tryOnScopeDispose } from '@vueuse/shared';
2
2
  import Cookie from 'universal-cookie';
3
- import { ref } from 'vue';
3
+ import { shallowRef } from 'vue';
4
4
 
5
5
  function createCookies(req) {
6
6
  const universalCookie = new Cookie(req ? req.headers.cookie : null);
@@ -9,7 +9,7 @@ function createCookies(req) {
9
9
  function useCookies(dependencies, { doNotParse = false, autoUpdateDependencies = false } = {}, cookies = new Cookie()) {
10
10
  const watchingDependencies = autoUpdateDependencies ? [...dependencies || []] : dependencies;
11
11
  let previousCookies = cookies.getAll({ doNotParse: true });
12
- const touches = ref(0);
12
+ const touches = shallowRef(0);
13
13
  const onChange = () => {
14
14
  const newCookies = cookies.getAll({ doNotParse: true });
15
15
  if (shouldUpdate(
package/useDrauu.cjs CHANGED
@@ -13,10 +13,10 @@ function useDrauu(target, options) {
13
13
  const onCommittedHook = core.createEventHook();
14
14
  const onStartHook = core.createEventHook();
15
15
  const onEndHook = core.createEventHook();
16
- const canUndo = vue.ref(false);
17
- const canRedo = vue.ref(false);
18
- const altPressed = vue.ref(false);
19
- const shiftPressed = vue.ref(false);
16
+ const canUndo = vue.shallowRef(false);
17
+ const canRedo = vue.shallowRef(false);
18
+ const altPressed = vue.shallowRef(false);
19
+ const shiftPressed = vue.shallowRef(false);
20
20
  const brush = vue.ref({
21
21
  color: "black",
22
22
  size: 3,
package/useDrauu.iife.js CHANGED
@@ -9,10 +9,10 @@
9
9
  const onCommittedHook = core.createEventHook();
10
10
  const onStartHook = core.createEventHook();
11
11
  const onEndHook = core.createEventHook();
12
- const canUndo = vue.ref(false);
13
- const canRedo = vue.ref(false);
14
- const altPressed = vue.ref(false);
15
- const shiftPressed = vue.ref(false);
12
+ const canUndo = vue.shallowRef(false);
13
+ const canRedo = vue.shallowRef(false);
14
+ const altPressed = vue.shallowRef(false);
15
+ const shiftPressed = vue.shallowRef(false);
16
16
  const brush = vue.ref({
17
17
  color: "black",
18
18
  size: 3,
@@ -1 +1 @@
1
- (function(E,o,k,H,a){"use strict";function V(p,u){const n=a.ref();let l=[];const s=o.createEventHook(),c=o.createEventHook(),d=o.createEventHook(),v=o.createEventHook(),i=o.createEventHook(),f=a.ref(!1),h=a.ref(!1),S=a.ref(!1),_=a.ref(!1),r=a.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...u?.brush});a.watch(r,()=>{const e=n.value;e&&(e.brush=r.value,e.mode=r.value.mode)},{deep:!0});const C=()=>{var e;return(e=n.value)==null?void 0:e.undo()},U=()=>{var e;return(e=n.value)==null?void 0:e.redo()},b=()=>{var e;return(e=n.value)==null?void 0:e.clear()},D=()=>{var e;return(e=n.value)==null?void 0:e.cancel()},w=e=>{var t;return(t=n.value)==null?void 0:t.load(e)},y=()=>{var e;return(e=n.value)==null?void 0:e.dump()},m=()=>{var e;l.forEach(t=>t()),(e=n.value)==null||e.unmount()},g=()=>{n.value&&(f.value=n.value.canUndo(),h.value=n.value.canRedo(),S.value=n.value.altPressed,_.value=n.value.shiftPressed)};return a.watch(()=>o.unrefElement(p),e=>{!e||typeof SVGSVGElement>"u"||!(e instanceof SVGSVGElement)||(n.value&&m(),n.value=H.createDrauu({el:e,...u}),g(),l=[n.value.on("canceled",()=>c.trigger()),n.value.on("committed",t=>d.trigger(t)),n.value.on("start",()=>v.trigger()),n.value.on("end",()=>i.trigger()),n.value.on("changed",()=>{g(),s.trigger()})])},{flush:"post"}),k.tryOnScopeDispose(()=>m()),{drauuInstance:n,load:w,dump:y,clear:b,cancel:D,undo:C,redo:U,canUndo:f,canRedo:h,brush:r,onChanged:s.on,onCommitted:d.on,onStart:v.on,onEnd:i.on,onCanceled:c.on}}E.useDrauu=V})(this.VueUse=this.VueUse||{},VueUse,VueUse,Drauu,Vue);
1
+ (function(E,o,k,H,a){"use strict";function V(p,u){const n=a.ref();let r=[];const s=o.createEventHook(),c=o.createEventHook(),d=o.createEventHook(),v=o.createEventHook(),i=o.createEventHook(),f=a.shallowRef(!1),h=a.shallowRef(!1),w=a.shallowRef(!1),S=a.shallowRef(!1),l=a.ref({color:"black",size:3,arrowEnd:!1,cornerRadius:0,dasharray:void 0,fill:"transparent",mode:"draw",...u?.brush});a.watch(l,()=>{const e=n.value;e&&(e.brush=l.value,e.mode=l.value.mode)},{deep:!0});const R=()=>{var e;return(e=n.value)==null?void 0:e.undo()},_=()=>{var e;return(e=n.value)==null?void 0:e.redo()},C=()=>{var e;return(e=n.value)==null?void 0:e.clear()},U=()=>{var e;return(e=n.value)==null?void 0:e.cancel()},b=e=>{var t;return(t=n.value)==null?void 0:t.load(e)},D=()=>{var e;return(e=n.value)==null?void 0:e.dump()},m=()=>{var e;r.forEach(t=>t()),(e=n.value)==null||e.unmount()},g=()=>{n.value&&(f.value=n.value.canUndo(),h.value=n.value.canRedo(),w.value=n.value.altPressed,S.value=n.value.shiftPressed)};return a.watch(()=>o.unrefElement(p),e=>{!e||typeof SVGSVGElement>"u"||!(e instanceof SVGSVGElement)||(n.value&&m(),n.value=H.createDrauu({el:e,...u}),g(),r=[n.value.on("canceled",()=>c.trigger()),n.value.on("committed",t=>d.trigger(t)),n.value.on("start",()=>v.trigger()),n.value.on("end",()=>i.trigger()),n.value.on("changed",()=>{g(),s.trigger()})])},{flush:"post"}),k.tryOnScopeDispose(()=>m()),{drauuInstance:n,load:b,dump:D,clear:C,cancel:U,undo:R,redo:_,canUndo:f,canRedo:h,brush:l,onChanged:s.on,onCommitted:d.on,onStart:v.on,onEnd:i.on,onCanceled:c.on}}E.useDrauu=V})(this.VueUse=this.VueUse||{},VueUse,VueUse,Drauu,Vue);
package/useDrauu.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createEventHook, unrefElement } from '@vueuse/core';
2
2
  import { tryOnScopeDispose } from '@vueuse/shared';
3
3
  import { createDrauu } from 'drauu';
4
- import { ref, watch } from 'vue';
4
+ import { ref, shallowRef, watch } from 'vue';
5
5
 
6
6
  function useDrauu(target, options) {
7
7
  const drauuInstance = ref();
@@ -11,10 +11,10 @@ function useDrauu(target, options) {
11
11
  const onCommittedHook = createEventHook();
12
12
  const onStartHook = createEventHook();
13
13
  const onEndHook = createEventHook();
14
- const canUndo = ref(false);
15
- const canRedo = ref(false);
16
- const altPressed = ref(false);
17
- const shiftPressed = ref(false);
14
+ const canUndo = shallowRef(false);
15
+ const canRedo = shallowRef(false);
16
+ const altPressed = shallowRef(false);
17
+ const shiftPressed = shallowRef(false);
18
18
  const brush = ref({
19
19
  color: "black",
20
20
  size: 3,
package/useFocusTrap.cjs CHANGED
@@ -8,8 +8,8 @@ var vue = require('vue');
8
8
  function useFocusTrap(target, options = {}) {
9
9
  let trap;
10
10
  const { immediate, ...focusTrapOptions } = options;
11
- const hasFocus = vue.ref(false);
12
- const isPaused = vue.ref(false);
11
+ const hasFocus = vue.shallowRef(false);
12
+ const isPaused = vue.shallowRef(false);
13
13
  const activate = (opts) => trap && trap.activate(opts);
14
14
  const deactivate = (opts) => trap && trap.deactivate(opts);
15
15
  const pause = () => {
@@ -4,8 +4,8 @@
4
4
  function useFocusTrap(target, options = {}) {
5
5
  let trap;
6
6
  const { immediate, ...focusTrapOptions } = options;
7
- const hasFocus = vue.ref(false);
8
- const isPaused = vue.ref(false);
7
+ const hasFocus = vue.shallowRef(false);
8
+ const isPaused = vue.shallowRef(false);
9
9
  const activate = (opts) => trap && trap.activate(opts);
10
10
  const deactivate = (opts) => trap && trap.deactivate(opts);
11
11
  const pause = () => {
@@ -1 +1 @@
1
- (function(f,u,l,p,a){"use strict";function v(h,s={}){let t;const{immediate:V,...d}=s,c=a.ref(!1),n=a.ref(!1),i=e=>t&&t.activate(e),o=e=>t&&t.deactivate(e),m=()=>{t&&(t.pause(),n.value=!0)},T=()=>{t&&(t.unpause(),n.value=!1)},g=a.computed(()=>{const e=a.toValue(h);return u.toArray(e).map(A=>{const r=a.toValue(A);return typeof r=="string"?r:u.unrefElement(r)}).filter(l.notNullish)});return a.watch(g,e=>{e.length&&(t=p.createFocusTrap(e,{...d,onActivate(){c.value=!0,s.onActivate&&s.onActivate()},onDeactivate(){c.value=!1,s.onDeactivate&&s.onDeactivate()}}),V&&i())},{flush:"post"}),u.tryOnScopeDispose(()=>o()),{hasFocus:c,isPaused:n,activate:i,deactivate:o,pause:m,unpause:T}}f.useFocusTrap=v})(this.VueUse=this.VueUse||{},VueUse,VueUse,focusTrap,Vue);
1
+ (function(l,u,f,p,a){"use strict";function h(v,s={}){let t;const{immediate:V,...d}=s,c=a.shallowRef(!1),n=a.shallowRef(!1),i=e=>t&&t.activate(e),r=e=>t&&t.deactivate(e),m=()=>{t&&(t.pause(),n.value=!0)},T=()=>{t&&(t.unpause(),n.value=!1)},g=a.computed(()=>{const e=a.toValue(v);return u.toArray(e).map(A=>{const o=a.toValue(A);return typeof o=="string"?o:u.unrefElement(o)}).filter(f.notNullish)});return a.watch(g,e=>{e.length&&(t=p.createFocusTrap(e,{...d,onActivate(){c.value=!0,s.onActivate&&s.onActivate()},onDeactivate(){c.value=!1,s.onDeactivate&&s.onDeactivate()}}),V&&i())},{flush:"post"}),u.tryOnScopeDispose(()=>r()),{hasFocus:c,isPaused:n,activate:i,deactivate:r,pause:m,unpause:T}}l.useFocusTrap=h})(this.VueUse=this.VueUse||{},VueUse,VueUse,focusTrap,Vue);
package/useFocusTrap.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { toArray, unrefElement, tryOnScopeDispose } from '@vueuse/core';
2
2
  import { notNullish } from '@vueuse/shared';
3
3
  import { createFocusTrap } from 'focus-trap';
4
- import { ref, computed, toValue, watch } from 'vue';
4
+ import { shallowRef, computed, toValue, watch } from 'vue';
5
5
 
6
6
  function useFocusTrap(target, options = {}) {
7
7
  let trap;
8
8
  const { immediate, ...focusTrapOptions } = options;
9
- const hasFocus = ref(false);
10
- const isPaused = ref(false);
9
+ const hasFocus = shallowRef(false);
10
+ const isPaused = shallowRef(false);
11
11
  const activate = (opts) => trap && trap.activate(opts);
12
12
  const deactivate = (opts) => trap && trap.deactivate(opts);
13
13
  const pause = () => {
package/useIDBKeyval.cjs CHANGED
@@ -14,7 +14,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
14
14
  },
15
15
  writeDefaults = true
16
16
  } = options;
17
- const isFinished = vue.ref(false);
17
+ const isFinished = vue.shallowRef(false);
18
18
  const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
19
19
  const rawInit = vue.toValue(initialValue);
20
20
  async function read() {
@@ -11,7 +11,7 @@
11
11
  },
12
12
  writeDefaults = true
13
13
  } = options;
14
- const isFinished = vue.ref(false);
14
+ const isFinished = vue.shallowRef(false);
15
15
  const data = (shallow ? vue.shallowRef : vue.ref)(initialValue);
16
16
  const rawInit = vue.toValue(initialValue);
17
17
  async function read() {
@@ -1 +1 @@
1
- (function(i,f,s,a){"use strict";function w(u,r,h={}){const{flush:d="pre",deep:p=!0,shallow:V=!1,onError:c=e=>{console.error(e)},writeDefaults:D=!0}=h,l=a.ref(!1),t=(V?a.shallowRef:a.ref)(r),n=a.toValue(r);async function v(){try{const e=await s.get(u);e===void 0?n!=null&&D&&await s.set(u,n):t.value=e}catch(e){c(e)}l.value=!0}v();async function o(){try{t.value==null?await s.del(u):await s.update(u,()=>a.toRaw(t.value))}catch(e){c(e)}}const{pause:I,resume:U}=f.watchPausable(t,()=>o(),{flush:d,deep:p});async function m(e){I(),t.value=e,await o(),U()}return{set:m,isFinished:l,data:t}}i.useIDBKeyval=w})(this.VueUse=this.VueUse||{},VueUse,idbKeyval,Vue);
1
+ (function(i,f,s,a){"use strict";function w(u,l,h={}){const{flush:d="pre",deep:p=!0,shallow:V=!1,onError:c=e=>{console.error(e)},writeDefaults:D=!0}=h,o=a.shallowRef(!1),t=(V?a.shallowRef:a.ref)(l),n=a.toValue(l);async function v(){try{const e=await s.get(u);e===void 0?n!=null&&D&&await s.set(u,n):t.value=e}catch(e){c(e)}o.value=!0}v();async function r(){try{t.value==null?await s.del(u):await s.update(u,()=>a.toRaw(t.value))}catch(e){c(e)}}const{pause:I,resume:R}=f.watchPausable(t,()=>r(),{flush:d,deep:p});async function U(e){I(),t.value=e,await r(),R()}return{set:U,isFinished:o,data:t}}i.useIDBKeyval=w})(this.VueUse=this.VueUse||{},VueUse,idbKeyval,Vue);
package/useIDBKeyval.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { watchPausable } from '@vueuse/core';
2
2
  import { get, set, del, update } from 'idb-keyval';
3
- import { ref, shallowRef, toValue, toRaw } from 'vue';
3
+ import { shallowRef, ref, toValue, toRaw } from 'vue';
4
4
 
5
5
  function useIDBKeyval(key, initialValue, options = {}) {
6
6
  const {
@@ -12,7 +12,7 @@ function useIDBKeyval(key, initialValue, options = {}) {
12
12
  },
13
13
  writeDefaults = true
14
14
  } = options;
15
- const isFinished = ref(false);
15
+ const isFinished = shallowRef(false);
16
16
  const data = (shallow ? shallowRef : ref)(initialValue);
17
17
  const rawInit = toValue(initialValue);
18
18
  async function read() {
package/useQRCode.cjs CHANGED
@@ -6,7 +6,7 @@ var vue = require('vue');
6
6
 
7
7
  function useQRCode(text, options) {
8
8
  const src = shared.toRef(text);
9
- const result = vue.ref("");
9
+ const result = vue.shallowRef("");
10
10
  vue.watch(
11
11
  src,
12
12
  async (value) => {
package/useQRCode.d.cts CHANGED
@@ -9,6 +9,6 @@ import QRCode from 'qrcode';
9
9
  * @param text
10
10
  * @param options
11
11
  */
12
- declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
12
+ declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
13
13
 
14
14
  export { useQRCode };
package/useQRCode.d.mts CHANGED
@@ -9,6 +9,6 @@ import QRCode from 'qrcode';
9
9
  * @param text
10
10
  * @param options
11
11
  */
12
- declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
12
+ declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
13
13
 
14
14
  export { useQRCode };
package/useQRCode.d.ts CHANGED
@@ -9,6 +9,6 @@ import QRCode from 'qrcode';
9
9
  * @param text
10
10
  * @param options
11
11
  */
12
- declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.Ref<string, string>;
12
+ declare function useQRCode(text: MaybeRefOrGetter<string>, options?: QRCode.QRCodeToDataURLOptions): vue.ShallowRef<string, string>;
13
13
 
14
14
  export { useQRCode };
package/useQRCode.iife.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  function useQRCode(text, options) {
5
5
  const src = shared.toRef(text);
6
- const result = vue.ref("");
6
+ const result = vue.shallowRef("");
7
7
  vue.watch(
8
8
  src,
9
9
  async (value) => {
@@ -1 +1 @@
1
- (function(i,e,n,t){"use strict";function o(a,c){const s=e.toRef(a),u=t.ref("");return t.watch(s,async r=>{s.value&&e.isClient&&(u.value=await n.toDataURL(r,c))},{immediate:!0}),u}i.useQRCode=o})(this.VueUse=this.VueUse||{},VueUse,QRCode,Vue);
1
+ (function(i,e,o,t){"use strict";function a(n,c){const s=e.toRef(n),u=t.shallowRef("");return t.watch(s,async l=>{s.value&&e.isClient&&(u.value=await o.toDataURL(l,c))},{immediate:!0}),u}i.useQRCode=a})(this.VueUse=this.VueUse||{},VueUse,QRCode,Vue);
package/useQRCode.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { toRef, isClient } from '@vueuse/shared';
2
2
  import QRCode from 'qrcode';
3
- import { ref, watch } from 'vue';
3
+ import { shallowRef, watch } from 'vue';
4
4
 
5
5
  function useQRCode(text, options) {
6
6
  const src = toRef(text);
7
- const result = ref("");
7
+ const result = shallowRef("");
8
8
  watch(
9
9
  src,
10
10
  async (value) => {