@vueuse/shared 6.7.6 → 6.8.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 +153 -108
- package/index.d.ts +13 -4
- package/index.iife.js +153 -108
- package/index.iife.min.js +1 -1
- package/index.mjs +153 -108
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -226,15 +226,35 @@ function createFilterWrapper(filter, fn) {
|
|
|
226
226
|
const bypassFilter = (invoke) => {
|
|
227
227
|
return invoke();
|
|
228
228
|
};
|
|
229
|
-
function debounceFilter(ms) {
|
|
229
|
+
function debounceFilter(ms, options = {}) {
|
|
230
230
|
let timer;
|
|
231
|
+
let maxTimer;
|
|
231
232
|
const filter = (invoke) => {
|
|
232
233
|
const duration = unref(ms);
|
|
234
|
+
const maxDuration = unref(options.maxWait);
|
|
233
235
|
if (timer)
|
|
234
236
|
clearTimeout(timer);
|
|
235
|
-
if (duration <= 0)
|
|
237
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
238
|
+
if (maxTimer) {
|
|
239
|
+
clearTimeout(maxTimer);
|
|
240
|
+
maxTimer = null;
|
|
241
|
+
}
|
|
236
242
|
return invoke();
|
|
237
|
-
|
|
243
|
+
}
|
|
244
|
+
if (maxDuration && !maxTimer) {
|
|
245
|
+
maxTimer = setTimeout(() => {
|
|
246
|
+
if (timer)
|
|
247
|
+
clearTimeout(timer);
|
|
248
|
+
maxTimer = null;
|
|
249
|
+
invoke();
|
|
250
|
+
}, maxDuration);
|
|
251
|
+
}
|
|
252
|
+
timer = setTimeout(() => {
|
|
253
|
+
if (maxTimer)
|
|
254
|
+
clearTimeout(maxTimer);
|
|
255
|
+
maxTimer = null;
|
|
256
|
+
invoke();
|
|
257
|
+
}, duration);
|
|
238
258
|
};
|
|
239
259
|
return filter;
|
|
240
260
|
}
|
|
@@ -344,17 +364,17 @@ function objectPick(obj, keys, omitUndefined = false) {
|
|
|
344
364
|
}, {});
|
|
345
365
|
}
|
|
346
366
|
|
|
347
|
-
var __getOwnPropSymbols$
|
|
348
|
-
var __hasOwnProp$
|
|
349
|
-
var __propIsEnum$
|
|
367
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
368
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
369
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
350
370
|
var __objRest$5 = (source, exclude) => {
|
|
351
371
|
var target = {};
|
|
352
372
|
for (var prop in source)
|
|
353
|
-
if (__hasOwnProp$
|
|
373
|
+
if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
354
374
|
target[prop] = source[prop];
|
|
355
|
-
if (source != null && __getOwnPropSymbols$
|
|
356
|
-
for (var prop of __getOwnPropSymbols$
|
|
357
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
375
|
+
if (source != null && __getOwnPropSymbols$9)
|
|
376
|
+
for (var prop of __getOwnPropSymbols$9(source)) {
|
|
377
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
|
|
358
378
|
target[prop] = source[prop];
|
|
359
379
|
}
|
|
360
380
|
return target;
|
|
@@ -368,33 +388,33 @@ function watchWithFilter(source, cb, options = {}) {
|
|
|
368
388
|
return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
|
|
369
389
|
}
|
|
370
390
|
|
|
371
|
-
var __defProp$
|
|
372
|
-
var __defProps$
|
|
373
|
-
var __getOwnPropDescs$
|
|
374
|
-
var __getOwnPropSymbols$
|
|
375
|
-
var __hasOwnProp$
|
|
376
|
-
var __propIsEnum$
|
|
377
|
-
var __defNormalProp$
|
|
378
|
-
var __spreadValues$
|
|
391
|
+
var __defProp$7 = Object.defineProperty;
|
|
392
|
+
var __defProps$4 = Object.defineProperties;
|
|
393
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
394
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
395
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
396
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
397
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
398
|
+
var __spreadValues$7 = (a, b) => {
|
|
379
399
|
for (var prop in b || (b = {}))
|
|
380
|
-
if (__hasOwnProp$
|
|
381
|
-
__defNormalProp$
|
|
382
|
-
if (__getOwnPropSymbols$
|
|
383
|
-
for (var prop of __getOwnPropSymbols$
|
|
384
|
-
if (__propIsEnum$
|
|
385
|
-
__defNormalProp$
|
|
400
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
401
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
402
|
+
if (__getOwnPropSymbols$8)
|
|
403
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
404
|
+
if (__propIsEnum$8.call(b, prop))
|
|
405
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
386
406
|
}
|
|
387
407
|
return a;
|
|
388
408
|
};
|
|
389
|
-
var __spreadProps$
|
|
409
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
390
410
|
var __objRest$4 = (source, exclude) => {
|
|
391
411
|
var target = {};
|
|
392
412
|
for (var prop in source)
|
|
393
|
-
if (__hasOwnProp$
|
|
413
|
+
if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
394
414
|
target[prop] = source[prop];
|
|
395
|
-
if (source != null && __getOwnPropSymbols$
|
|
396
|
-
for (var prop of __getOwnPropSymbols$
|
|
397
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
415
|
+
if (source != null && __getOwnPropSymbols$8)
|
|
416
|
+
for (var prop of __getOwnPropSymbols$8(source)) {
|
|
417
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
|
|
398
418
|
target[prop] = source[prop];
|
|
399
419
|
}
|
|
400
420
|
return target;
|
|
@@ -405,7 +425,7 @@ function debouncedWatch(source, cb, options = {}) {
|
|
|
405
425
|
} = _a, watchOptions = __objRest$4(_a, [
|
|
406
426
|
"debounce"
|
|
407
427
|
]);
|
|
408
|
-
return watchWithFilter(source, cb, __spreadProps$
|
|
428
|
+
return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$7({}, watchOptions), {
|
|
409
429
|
eventFilter: debounceFilter(debounce)
|
|
410
430
|
}));
|
|
411
431
|
}
|
|
@@ -424,33 +444,33 @@ function get(obj, key) {
|
|
|
424
444
|
return unref(obj)[key];
|
|
425
445
|
}
|
|
426
446
|
|
|
427
|
-
var __defProp$
|
|
428
|
-
var __defProps$
|
|
429
|
-
var __getOwnPropDescs$
|
|
430
|
-
var __getOwnPropSymbols$
|
|
431
|
-
var __hasOwnProp$
|
|
432
|
-
var __propIsEnum$
|
|
433
|
-
var __defNormalProp$
|
|
434
|
-
var __spreadValues$
|
|
447
|
+
var __defProp$6 = Object.defineProperty;
|
|
448
|
+
var __defProps$3 = Object.defineProperties;
|
|
449
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
450
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
451
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
452
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
453
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
454
|
+
var __spreadValues$6 = (a, b) => {
|
|
435
455
|
for (var prop in b || (b = {}))
|
|
436
|
-
if (__hasOwnProp$
|
|
437
|
-
__defNormalProp$
|
|
438
|
-
if (__getOwnPropSymbols$
|
|
439
|
-
for (var prop of __getOwnPropSymbols$
|
|
440
|
-
if (__propIsEnum$
|
|
441
|
-
__defNormalProp$
|
|
456
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
457
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
458
|
+
if (__getOwnPropSymbols$7)
|
|
459
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
460
|
+
if (__propIsEnum$7.call(b, prop))
|
|
461
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
442
462
|
}
|
|
443
463
|
return a;
|
|
444
464
|
};
|
|
445
|
-
var __spreadProps$
|
|
465
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
446
466
|
var __objRest$3 = (source, exclude) => {
|
|
447
467
|
var target = {};
|
|
448
468
|
for (var prop in source)
|
|
449
|
-
if (__hasOwnProp$
|
|
469
|
+
if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
450
470
|
target[prop] = source[prop];
|
|
451
|
-
if (source != null && __getOwnPropSymbols$
|
|
452
|
-
for (var prop of __getOwnPropSymbols$
|
|
453
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
471
|
+
if (source != null && __getOwnPropSymbols$7)
|
|
472
|
+
for (var prop of __getOwnPropSymbols$7(source)) {
|
|
473
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
|
|
454
474
|
target[prop] = source[prop];
|
|
455
475
|
}
|
|
456
476
|
return target;
|
|
@@ -487,7 +507,7 @@ function ignorableWatch(source, cb, options = {}) {
|
|
|
487
507
|
};
|
|
488
508
|
disposables.push(watch(source, () => {
|
|
489
509
|
syncCounter.value++;
|
|
490
|
-
}, __spreadProps$
|
|
510
|
+
}, __spreadProps$3(__spreadValues$6({}, watchOptions), { flush: "sync" })));
|
|
491
511
|
ignoreUpdates = (updater) => {
|
|
492
512
|
const syncCounterPrev = syncCounter.value;
|
|
493
513
|
updater();
|
|
@@ -512,25 +532,25 @@ function isDefined(v) {
|
|
|
512
532
|
return unref(v) != null;
|
|
513
533
|
}
|
|
514
534
|
|
|
515
|
-
var __defProp$
|
|
516
|
-
var __getOwnPropSymbols$
|
|
517
|
-
var __hasOwnProp$
|
|
518
|
-
var __propIsEnum$
|
|
519
|
-
var __defNormalProp$
|
|
520
|
-
var __spreadValues$
|
|
535
|
+
var __defProp$5 = Object.defineProperty;
|
|
536
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
537
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
538
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
539
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
540
|
+
var __spreadValues$5 = (a, b) => {
|
|
521
541
|
for (var prop in b || (b = {}))
|
|
522
|
-
if (__hasOwnProp$
|
|
523
|
-
__defNormalProp$
|
|
524
|
-
if (__getOwnPropSymbols$
|
|
525
|
-
for (var prop of __getOwnPropSymbols$
|
|
526
|
-
if (__propIsEnum$
|
|
527
|
-
__defNormalProp$
|
|
542
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
543
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
544
|
+
if (__getOwnPropSymbols$6)
|
|
545
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
546
|
+
if (__propIsEnum$6.call(b, prop))
|
|
547
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
528
548
|
}
|
|
529
549
|
return a;
|
|
530
550
|
};
|
|
531
551
|
function makeDestructurable(obj, arr) {
|
|
532
552
|
if (typeof Symbol !== "undefined") {
|
|
533
|
-
const clone = __spreadValues$
|
|
553
|
+
const clone = __spreadValues$5({}, obj);
|
|
534
554
|
Object.defineProperty(clone, Symbol.iterator, {
|
|
535
555
|
enumerable: false,
|
|
536
556
|
value() {
|
|
@@ -557,33 +577,33 @@ function or(...args) {
|
|
|
557
577
|
return computed(() => args.some((i) => unref(i)));
|
|
558
578
|
}
|
|
559
579
|
|
|
560
|
-
var __defProp$
|
|
561
|
-
var __defProps$
|
|
562
|
-
var __getOwnPropDescs$
|
|
563
|
-
var __getOwnPropSymbols$
|
|
564
|
-
var __hasOwnProp$
|
|
565
|
-
var __propIsEnum$
|
|
566
|
-
var __defNormalProp$
|
|
567
|
-
var __spreadValues$
|
|
580
|
+
var __defProp$4 = Object.defineProperty;
|
|
581
|
+
var __defProps$2 = Object.defineProperties;
|
|
582
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
583
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
584
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
585
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
586
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
587
|
+
var __spreadValues$4 = (a, b) => {
|
|
568
588
|
for (var prop in b || (b = {}))
|
|
569
|
-
if (__hasOwnProp$
|
|
570
|
-
__defNormalProp$
|
|
571
|
-
if (__getOwnPropSymbols$
|
|
572
|
-
for (var prop of __getOwnPropSymbols$
|
|
573
|
-
if (__propIsEnum$
|
|
574
|
-
__defNormalProp$
|
|
589
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
590
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
591
|
+
if (__getOwnPropSymbols$5)
|
|
592
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
593
|
+
if (__propIsEnum$5.call(b, prop))
|
|
594
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
575
595
|
}
|
|
576
596
|
return a;
|
|
577
597
|
};
|
|
578
|
-
var __spreadProps$
|
|
598
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
579
599
|
var __objRest$2 = (source, exclude) => {
|
|
580
600
|
var target = {};
|
|
581
601
|
for (var prop in source)
|
|
582
|
-
if (__hasOwnProp$
|
|
602
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
583
603
|
target[prop] = source[prop];
|
|
584
|
-
if (source != null && __getOwnPropSymbols$
|
|
585
|
-
for (var prop of __getOwnPropSymbols$
|
|
586
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
604
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
605
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
606
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
587
607
|
target[prop] = source[prop];
|
|
588
608
|
}
|
|
589
609
|
return target;
|
|
@@ -595,7 +615,7 @@ function pausableWatch(source, cb, options = {}) {
|
|
|
595
615
|
"eventFilter"
|
|
596
616
|
]);
|
|
597
617
|
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
598
|
-
const stop = watchWithFilter(source, cb, __spreadProps$
|
|
618
|
+
const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$4({}, watchOptions), {
|
|
599
619
|
eventFilter
|
|
600
620
|
}));
|
|
601
621
|
return { stop, pause, resume, isActive };
|
|
@@ -673,33 +693,33 @@ function syncRef(source, targets, {
|
|
|
673
693
|
});
|
|
674
694
|
}
|
|
675
695
|
|
|
676
|
-
var __defProp$
|
|
677
|
-
var __defProps = Object.defineProperties;
|
|
678
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
679
|
-
var __getOwnPropSymbols$
|
|
680
|
-
var __hasOwnProp$
|
|
681
|
-
var __propIsEnum$
|
|
682
|
-
var __defNormalProp$
|
|
683
|
-
var __spreadValues$
|
|
696
|
+
var __defProp$3 = Object.defineProperty;
|
|
697
|
+
var __defProps$1 = Object.defineProperties;
|
|
698
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
699
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
700
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
701
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
702
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
703
|
+
var __spreadValues$3 = (a, b) => {
|
|
684
704
|
for (var prop in b || (b = {}))
|
|
685
|
-
if (__hasOwnProp$
|
|
686
|
-
__defNormalProp$
|
|
687
|
-
if (__getOwnPropSymbols$
|
|
688
|
-
for (var prop of __getOwnPropSymbols$
|
|
689
|
-
if (__propIsEnum$
|
|
690
|
-
__defNormalProp$
|
|
705
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
706
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
707
|
+
if (__getOwnPropSymbols$4)
|
|
708
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
709
|
+
if (__propIsEnum$4.call(b, prop))
|
|
710
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
691
711
|
}
|
|
692
712
|
return a;
|
|
693
713
|
};
|
|
694
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
714
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
695
715
|
var __objRest$1 = (source, exclude) => {
|
|
696
716
|
var target = {};
|
|
697
717
|
for (var prop in source)
|
|
698
|
-
if (__hasOwnProp$
|
|
718
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
699
719
|
target[prop] = source[prop];
|
|
700
|
-
if (source != null && __getOwnPropSymbols$
|
|
701
|
-
for (var prop of __getOwnPropSymbols$
|
|
702
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
720
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
721
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
722
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
703
723
|
target[prop] = source[prop];
|
|
704
724
|
}
|
|
705
725
|
return target;
|
|
@@ -714,7 +734,7 @@ function throttledWatch(source, cb, options = {}) {
|
|
|
714
734
|
"trailing",
|
|
715
735
|
"leading"
|
|
716
736
|
]);
|
|
717
|
-
return watchWithFilter(source, cb, __spreadProps(__spreadValues$
|
|
737
|
+
return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$3({}, watchOptions), {
|
|
718
738
|
eventFilter: throttleFilter(throttle, trailing, leading)
|
|
719
739
|
}));
|
|
720
740
|
}
|
|
@@ -749,6 +769,25 @@ function toReactive(objectRef) {
|
|
|
749
769
|
return reactive(proxy);
|
|
750
770
|
}
|
|
751
771
|
|
|
772
|
+
var __defProp$2 = Object.defineProperty;
|
|
773
|
+
var __defProps = Object.defineProperties;
|
|
774
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
775
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
776
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
777
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
778
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
779
|
+
var __spreadValues$2 = (a, b) => {
|
|
780
|
+
for (var prop in b || (b = {}))
|
|
781
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
782
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
783
|
+
if (__getOwnPropSymbols$3)
|
|
784
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
785
|
+
if (__propIsEnum$3.call(b, prop))
|
|
786
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
787
|
+
}
|
|
788
|
+
return a;
|
|
789
|
+
};
|
|
790
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
752
791
|
function toRefs(objectRef) {
|
|
753
792
|
if (!isRef(objectRef))
|
|
754
793
|
return toRefs$1(objectRef);
|
|
@@ -759,7 +798,13 @@ function toRefs(objectRef) {
|
|
|
759
798
|
return objectRef.value[key];
|
|
760
799
|
},
|
|
761
800
|
set(v) {
|
|
762
|
-
objectRef.value
|
|
801
|
+
if (Array.isArray(objectRef.value)) {
|
|
802
|
+
const copy = [...objectRef.value];
|
|
803
|
+
copy[key] = v;
|
|
804
|
+
objectRef.value = copy;
|
|
805
|
+
} else {
|
|
806
|
+
objectRef.value = __spreadProps(__spreadValues$2({}, objectRef.value), { [key]: v });
|
|
807
|
+
}
|
|
763
808
|
}
|
|
764
809
|
}));
|
|
765
810
|
}
|
|
@@ -884,17 +929,17 @@ function useCounter(initialValue = 0) {
|
|
|
884
929
|
return { count, inc, dec, get, set, reset };
|
|
885
930
|
}
|
|
886
931
|
|
|
887
|
-
function useDebounceFn(fn, ms = 200) {
|
|
888
|
-
return createFilterWrapper(debounceFilter(ms), fn);
|
|
932
|
+
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
933
|
+
return createFilterWrapper(debounceFilter(ms, options), fn);
|
|
889
934
|
}
|
|
890
935
|
|
|
891
|
-
function useDebounce(value, ms = 200) {
|
|
936
|
+
function useDebounce(value, ms = 200, options = {}) {
|
|
892
937
|
if (ms <= 0)
|
|
893
938
|
return value;
|
|
894
939
|
const debounced = ref(value.value);
|
|
895
940
|
const updater = useDebounceFn(() => {
|
|
896
941
|
debounced.value = value.value;
|
|
897
|
-
}, ms);
|
|
942
|
+
}, ms, options);
|
|
898
943
|
watch(value, () => updater());
|
|
899
944
|
return debounced;
|
|
900
945
|
}
|