@vueuse/shared 10.3.0 → 10.4.1
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 +98 -388
- package/index.d.cts +2 -2
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.iife.js +98 -388
- package/index.iife.min.js +1 -1
- package/index.mjs +98 -388
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, provide, inject, isVue3, version, isRef, unref, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue-demi';
|
|
2
2
|
|
|
3
|
-
var __defProp$b = Object.defineProperty;
|
|
4
|
-
var __defProps$8 = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues$b = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp$d.call(b, prop))
|
|
13
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols$d)
|
|
15
|
-
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
16
|
-
if (__propIsEnum$d.call(b, prop))
|
|
17
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
22
3
|
function computedEager(fn, options) {
|
|
23
4
|
var _a;
|
|
24
5
|
const result = shallowRef();
|
|
25
6
|
watchEffect(() => {
|
|
26
7
|
result.value = fn();
|
|
27
|
-
},
|
|
8
|
+
}, {
|
|
9
|
+
...options,
|
|
28
10
|
flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
|
|
29
|
-
})
|
|
11
|
+
});
|
|
30
12
|
return readonly(result);
|
|
31
13
|
}
|
|
32
14
|
|
|
@@ -178,25 +160,9 @@ function isDefined(v) {
|
|
|
178
160
|
return unref(v) != null;
|
|
179
161
|
}
|
|
180
162
|
|
|
181
|
-
var __defProp$a = Object.defineProperty;
|
|
182
|
-
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
183
|
-
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
184
|
-
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
185
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
186
|
-
var __spreadValues$a = (a, b) => {
|
|
187
|
-
for (var prop in b || (b = {}))
|
|
188
|
-
if (__hasOwnProp$c.call(b, prop))
|
|
189
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
190
|
-
if (__getOwnPropSymbols$c)
|
|
191
|
-
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
192
|
-
if (__propIsEnum$c.call(b, prop))
|
|
193
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
194
|
-
}
|
|
195
|
-
return a;
|
|
196
|
-
};
|
|
197
163
|
function makeDestructurable(obj, arr) {
|
|
198
164
|
if (typeof Symbol !== "undefined") {
|
|
199
|
-
const clone =
|
|
165
|
+
const clone = { ...obj };
|
|
200
166
|
Object.defineProperty(clone, Symbol.iterator, {
|
|
201
167
|
enumerable: false,
|
|
202
168
|
value() {
|
|
@@ -295,7 +261,7 @@ function reactiveOmit(obj, ...keys) {
|
|
|
295
261
|
);
|
|
296
262
|
}
|
|
297
263
|
|
|
298
|
-
const isClient = typeof window !== "undefined";
|
|
264
|
+
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
299
265
|
const isDef = (val) => typeof val !== "undefined";
|
|
300
266
|
const notNullish = (val) => val != null;
|
|
301
267
|
const assert = (condition, ...infos) => {
|
|
@@ -533,10 +499,10 @@ function reactivePick(obj, ...keys) {
|
|
|
533
499
|
|
|
534
500
|
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
535
501
|
return customRef((track, trigger) => {
|
|
536
|
-
let value = defaultValue;
|
|
502
|
+
let value = toValue(defaultValue);
|
|
537
503
|
let timer;
|
|
538
504
|
const resetAfter = () => setTimeout(() => {
|
|
539
|
-
value = defaultValue;
|
|
505
|
+
value = toValue(defaultValue);
|
|
540
506
|
trigger();
|
|
541
507
|
}, toValue(afterMs));
|
|
542
508
|
tryOnScopeDispose(() => {
|
|
@@ -670,6 +636,38 @@ function set(...args) {
|
|
|
670
636
|
}
|
|
671
637
|
}
|
|
672
638
|
|
|
639
|
+
function watchWithFilter(source, cb, options = {}) {
|
|
640
|
+
const {
|
|
641
|
+
eventFilter = bypassFilter,
|
|
642
|
+
...watchOptions
|
|
643
|
+
} = options;
|
|
644
|
+
return watch(
|
|
645
|
+
source,
|
|
646
|
+
createFilterWrapper(
|
|
647
|
+
eventFilter,
|
|
648
|
+
cb
|
|
649
|
+
),
|
|
650
|
+
watchOptions
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
function watchPausable(source, cb, options = {}) {
|
|
655
|
+
const {
|
|
656
|
+
eventFilter: filter,
|
|
657
|
+
...watchOptions
|
|
658
|
+
} = options;
|
|
659
|
+
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
660
|
+
const stop = watchWithFilter(
|
|
661
|
+
source,
|
|
662
|
+
cb,
|
|
663
|
+
{
|
|
664
|
+
...watchOptions,
|
|
665
|
+
eventFilter
|
|
666
|
+
}
|
|
667
|
+
);
|
|
668
|
+
return { stop, pause, resume, isActive };
|
|
669
|
+
}
|
|
670
|
+
|
|
673
671
|
function syncRef(left, right, options = {}) {
|
|
674
672
|
var _a, _b;
|
|
675
673
|
const {
|
|
@@ -679,28 +677,35 @@ function syncRef(left, right, options = {}) {
|
|
|
679
677
|
direction = "both",
|
|
680
678
|
transform = {}
|
|
681
679
|
} = options;
|
|
682
|
-
|
|
683
|
-
let watchRight;
|
|
680
|
+
const watchers = [];
|
|
684
681
|
const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v;
|
|
685
682
|
const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v;
|
|
686
683
|
if (direction === "both" || direction === "ltr") {
|
|
687
|
-
|
|
684
|
+
watchers.push(watchPausable(
|
|
688
685
|
left,
|
|
689
|
-
(newValue) =>
|
|
686
|
+
(newValue) => {
|
|
687
|
+
watchers.forEach((w) => w.pause());
|
|
688
|
+
right.value = transformLTR(newValue);
|
|
689
|
+
watchers.forEach((w) => w.resume());
|
|
690
|
+
},
|
|
690
691
|
{ flush, deep, immediate }
|
|
691
|
-
);
|
|
692
|
+
));
|
|
692
693
|
}
|
|
693
694
|
if (direction === "both" || direction === "rtl") {
|
|
694
|
-
|
|
695
|
+
watchers.push(watchPausable(
|
|
695
696
|
right,
|
|
696
|
-
(newValue) =>
|
|
697
|
+
(newValue) => {
|
|
698
|
+
watchers.forEach((w) => w.pause());
|
|
699
|
+
left.value = transformRTL(newValue);
|
|
700
|
+
watchers.forEach((w) => w.resume());
|
|
701
|
+
},
|
|
697
702
|
{ flush, deep, immediate }
|
|
698
|
-
);
|
|
703
|
+
));
|
|
699
704
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
watchRight == null ? void 0 : watchRight();
|
|
705
|
+
const stop = () => {
|
|
706
|
+
watchers.forEach((w) => w.stop());
|
|
703
707
|
};
|
|
708
|
+
return stop;
|
|
704
709
|
}
|
|
705
710
|
|
|
706
711
|
function syncRefs(source, targets, options = {}) {
|
|
@@ -718,25 +723,6 @@ function syncRefs(source, targets, options = {}) {
|
|
|
718
723
|
);
|
|
719
724
|
}
|
|
720
725
|
|
|
721
|
-
var __defProp$9 = Object.defineProperty;
|
|
722
|
-
var __defProps$7 = Object.defineProperties;
|
|
723
|
-
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
724
|
-
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
725
|
-
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
726
|
-
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
727
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
728
|
-
var __spreadValues$9 = (a, b) => {
|
|
729
|
-
for (var prop in b || (b = {}))
|
|
730
|
-
if (__hasOwnProp$b.call(b, prop))
|
|
731
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
732
|
-
if (__getOwnPropSymbols$b)
|
|
733
|
-
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
734
|
-
if (__propIsEnum$b.call(b, prop))
|
|
735
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
736
|
-
}
|
|
737
|
-
return a;
|
|
738
|
-
};
|
|
739
|
-
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
740
726
|
function toRefs(objectRef, options = {}) {
|
|
741
727
|
if (!isRef(objectRef))
|
|
742
728
|
return toRefs$1(objectRef);
|
|
@@ -755,7 +741,7 @@ function toRefs(objectRef, options = {}) {
|
|
|
755
741
|
copy[key] = v;
|
|
756
742
|
objectRef.value = copy;
|
|
757
743
|
} else {
|
|
758
|
-
const newObject =
|
|
744
|
+
const newObject = { ...objectRef.value, [key]: v };
|
|
759
745
|
Object.setPrototypeOf(newObject, Object.getPrototypeOf(objectRef.value));
|
|
760
746
|
objectRef.value = newObject;
|
|
761
747
|
}
|
|
@@ -1162,22 +1148,6 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
1162
1148
|
};
|
|
1163
1149
|
}
|
|
1164
1150
|
|
|
1165
|
-
var __defProp$8 = Object.defineProperty;
|
|
1166
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
1167
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
1168
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
1169
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1170
|
-
var __spreadValues$8 = (a, b) => {
|
|
1171
|
-
for (var prop in b || (b = {}))
|
|
1172
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
1173
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1174
|
-
if (__getOwnPropSymbols$a)
|
|
1175
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
1176
|
-
if (__propIsEnum$a.call(b, prop))
|
|
1177
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1178
|
-
}
|
|
1179
|
-
return a;
|
|
1180
|
-
};
|
|
1181
1151
|
function useInterval(interval = 1e3, options = {}) {
|
|
1182
1152
|
const {
|
|
1183
1153
|
controls: exposeControls = false,
|
|
@@ -1198,10 +1168,11 @@ function useInterval(interval = 1e3, options = {}) {
|
|
|
1198
1168
|
{ immediate }
|
|
1199
1169
|
);
|
|
1200
1170
|
if (exposeControls) {
|
|
1201
|
-
return
|
|
1171
|
+
return {
|
|
1202
1172
|
counter,
|
|
1203
|
-
reset
|
|
1204
|
-
|
|
1173
|
+
reset,
|
|
1174
|
+
...controls
|
|
1175
|
+
};
|
|
1205
1176
|
} else {
|
|
1206
1177
|
return counter;
|
|
1207
1178
|
}
|
|
@@ -1256,22 +1227,6 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
1256
1227
|
};
|
|
1257
1228
|
}
|
|
1258
1229
|
|
|
1259
|
-
var __defProp$7 = Object.defineProperty;
|
|
1260
|
-
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
1261
|
-
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
1262
|
-
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
1263
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1264
|
-
var __spreadValues$7 = (a, b) => {
|
|
1265
|
-
for (var prop in b || (b = {}))
|
|
1266
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
1267
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1268
|
-
if (__getOwnPropSymbols$9)
|
|
1269
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
1270
|
-
if (__propIsEnum$9.call(b, prop))
|
|
1271
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1272
|
-
}
|
|
1273
|
-
return a;
|
|
1274
|
-
};
|
|
1275
1230
|
function useTimeout(interval = 1e3, options = {}) {
|
|
1276
1231
|
const {
|
|
1277
1232
|
controls: exposeControls = false,
|
|
@@ -1284,9 +1239,10 @@ function useTimeout(interval = 1e3, options = {}) {
|
|
|
1284
1239
|
);
|
|
1285
1240
|
const ready = computed(() => !controls.isPending.value);
|
|
1286
1241
|
if (exposeControls) {
|
|
1287
|
-
return
|
|
1288
|
-
ready
|
|
1289
|
-
|
|
1242
|
+
return {
|
|
1243
|
+
ready,
|
|
1244
|
+
...controls
|
|
1245
|
+
};
|
|
1290
1246
|
} else {
|
|
1291
1247
|
return ready;
|
|
1292
1248
|
}
|
|
@@ -1360,58 +1316,11 @@ function watchArray(source, cb, options) {
|
|
|
1360
1316
|
}, options);
|
|
1361
1317
|
}
|
|
1362
1318
|
|
|
1363
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1364
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1365
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1366
|
-
var __objRest$5 = (source, exclude) => {
|
|
1367
|
-
var target = {};
|
|
1368
|
-
for (var prop in source)
|
|
1369
|
-
if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1370
|
-
target[prop] = source[prop];
|
|
1371
|
-
if (source != null && __getOwnPropSymbols$8)
|
|
1372
|
-
for (var prop of __getOwnPropSymbols$8(source)) {
|
|
1373
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
|
|
1374
|
-
target[prop] = source[prop];
|
|
1375
|
-
}
|
|
1376
|
-
return target;
|
|
1377
|
-
};
|
|
1378
|
-
function watchWithFilter(source, cb, options = {}) {
|
|
1379
|
-
const _a = options, {
|
|
1380
|
-
eventFilter = bypassFilter
|
|
1381
|
-
} = _a, watchOptions = __objRest$5(_a, [
|
|
1382
|
-
"eventFilter"
|
|
1383
|
-
]);
|
|
1384
|
-
return watch(
|
|
1385
|
-
source,
|
|
1386
|
-
createFilterWrapper(
|
|
1387
|
-
eventFilter,
|
|
1388
|
-
cb
|
|
1389
|
-
),
|
|
1390
|
-
watchOptions
|
|
1391
|
-
);
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1395
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1396
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1397
|
-
var __objRest$4 = (source, exclude) => {
|
|
1398
|
-
var target = {};
|
|
1399
|
-
for (var prop in source)
|
|
1400
|
-
if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1401
|
-
target[prop] = source[prop];
|
|
1402
|
-
if (source != null && __getOwnPropSymbols$7)
|
|
1403
|
-
for (var prop of __getOwnPropSymbols$7(source)) {
|
|
1404
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
|
|
1405
|
-
target[prop] = source[prop];
|
|
1406
|
-
}
|
|
1407
|
-
return target;
|
|
1408
|
-
};
|
|
1409
1319
|
function watchAtMost(source, cb, options) {
|
|
1410
|
-
const
|
|
1411
|
-
count
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
]);
|
|
1320
|
+
const {
|
|
1321
|
+
count,
|
|
1322
|
+
...watchOptions
|
|
1323
|
+
} = options;
|
|
1415
1324
|
const current = ref(0);
|
|
1416
1325
|
const stop = watchWithFilter(
|
|
1417
1326
|
source,
|
|
@@ -1426,120 +1335,38 @@ function watchAtMost(source, cb, options) {
|
|
|
1426
1335
|
return { count: current, stop };
|
|
1427
1336
|
}
|
|
1428
1337
|
|
|
1429
|
-
var __defProp$6 = Object.defineProperty;
|
|
1430
|
-
var __defProps$6 = Object.defineProperties;
|
|
1431
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
1432
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1433
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1434
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1435
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1436
|
-
var __spreadValues$6 = (a, b) => {
|
|
1437
|
-
for (var prop in b || (b = {}))
|
|
1438
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
1439
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1440
|
-
if (__getOwnPropSymbols$6)
|
|
1441
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1442
|
-
if (__propIsEnum$6.call(b, prop))
|
|
1443
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1444
|
-
}
|
|
1445
|
-
return a;
|
|
1446
|
-
};
|
|
1447
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1448
|
-
var __objRest$3 = (source, exclude) => {
|
|
1449
|
-
var target = {};
|
|
1450
|
-
for (var prop in source)
|
|
1451
|
-
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1452
|
-
target[prop] = source[prop];
|
|
1453
|
-
if (source != null && __getOwnPropSymbols$6)
|
|
1454
|
-
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
1455
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
1456
|
-
target[prop] = source[prop];
|
|
1457
|
-
}
|
|
1458
|
-
return target;
|
|
1459
|
-
};
|
|
1460
1338
|
function watchDebounced(source, cb, options = {}) {
|
|
1461
|
-
const
|
|
1339
|
+
const {
|
|
1462
1340
|
debounce = 0,
|
|
1463
|
-
maxWait = void 0
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
"maxWait"
|
|
1467
|
-
]);
|
|
1341
|
+
maxWait = void 0,
|
|
1342
|
+
...watchOptions
|
|
1343
|
+
} = options;
|
|
1468
1344
|
return watchWithFilter(
|
|
1469
1345
|
source,
|
|
1470
1346
|
cb,
|
|
1471
|
-
|
|
1347
|
+
{
|
|
1348
|
+
...watchOptions,
|
|
1472
1349
|
eventFilter: debounceFilter(debounce, { maxWait })
|
|
1473
|
-
}
|
|
1350
|
+
}
|
|
1474
1351
|
);
|
|
1475
1352
|
}
|
|
1476
1353
|
|
|
1477
|
-
var __defProp$5 = Object.defineProperty;
|
|
1478
|
-
var __defProps$5 = Object.defineProperties;
|
|
1479
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
1480
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1481
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1482
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1483
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1484
|
-
var __spreadValues$5 = (a, b) => {
|
|
1485
|
-
for (var prop in b || (b = {}))
|
|
1486
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
1487
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1488
|
-
if (__getOwnPropSymbols$5)
|
|
1489
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1490
|
-
if (__propIsEnum$5.call(b, prop))
|
|
1491
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1492
|
-
}
|
|
1493
|
-
return a;
|
|
1494
|
-
};
|
|
1495
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1496
1354
|
function watchDeep(source, cb, options) {
|
|
1497
1355
|
return watch(
|
|
1498
1356
|
source,
|
|
1499
1357
|
cb,
|
|
1500
|
-
|
|
1358
|
+
{
|
|
1359
|
+
...options,
|
|
1501
1360
|
deep: true
|
|
1502
|
-
}
|
|
1361
|
+
}
|
|
1503
1362
|
);
|
|
1504
1363
|
}
|
|
1505
1364
|
|
|
1506
|
-
var __defProp$4 = Object.defineProperty;
|
|
1507
|
-
var __defProps$4 = Object.defineProperties;
|
|
1508
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1509
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1510
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1511
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1512
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1513
|
-
var __spreadValues$4 = (a, b) => {
|
|
1514
|
-
for (var prop in b || (b = {}))
|
|
1515
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
1516
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1517
|
-
if (__getOwnPropSymbols$4)
|
|
1518
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1519
|
-
if (__propIsEnum$4.call(b, prop))
|
|
1520
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1521
|
-
}
|
|
1522
|
-
return a;
|
|
1523
|
-
};
|
|
1524
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1525
|
-
var __objRest$2 = (source, exclude) => {
|
|
1526
|
-
var target = {};
|
|
1527
|
-
for (var prop in source)
|
|
1528
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1529
|
-
target[prop] = source[prop];
|
|
1530
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
1531
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1532
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1533
|
-
target[prop] = source[prop];
|
|
1534
|
-
}
|
|
1535
|
-
return target;
|
|
1536
|
-
};
|
|
1537
1365
|
function watchIgnorable(source, cb, options = {}) {
|
|
1538
|
-
const
|
|
1539
|
-
eventFilter = bypassFilter
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
]);
|
|
1366
|
+
const {
|
|
1367
|
+
eventFilter = bypassFilter,
|
|
1368
|
+
...watchOptions
|
|
1369
|
+
} = options;
|
|
1543
1370
|
const filteredCb = createFilterWrapper(
|
|
1544
1371
|
eventFilter,
|
|
1545
1372
|
cb
|
|
@@ -1577,7 +1404,7 @@ function watchIgnorable(source, cb, options = {}) {
|
|
|
1577
1404
|
() => {
|
|
1578
1405
|
syncCounter.value++;
|
|
1579
1406
|
},
|
|
1580
|
-
|
|
1407
|
+
{ ...watchOptions, flush: "sync" }
|
|
1581
1408
|
)
|
|
1582
1409
|
);
|
|
1583
1410
|
ignoreUpdates = (updater) => {
|
|
@@ -1606,32 +1433,14 @@ function watchIgnorable(source, cb, options = {}) {
|
|
|
1606
1433
|
return { stop, ignoreUpdates, ignorePrevAsyncUpdates };
|
|
1607
1434
|
}
|
|
1608
1435
|
|
|
1609
|
-
var __defProp$3 = Object.defineProperty;
|
|
1610
|
-
var __defProps$3 = Object.defineProperties;
|
|
1611
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1612
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1613
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1614
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1615
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1616
|
-
var __spreadValues$3 = (a, b) => {
|
|
1617
|
-
for (var prop in b || (b = {}))
|
|
1618
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
1619
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1620
|
-
if (__getOwnPropSymbols$3)
|
|
1621
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1622
|
-
if (__propIsEnum$3.call(b, prop))
|
|
1623
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1624
|
-
}
|
|
1625
|
-
return a;
|
|
1626
|
-
};
|
|
1627
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1628
1436
|
function watchImmediate(source, cb, options) {
|
|
1629
1437
|
return watch(
|
|
1630
1438
|
source,
|
|
1631
1439
|
cb,
|
|
1632
|
-
|
|
1440
|
+
{
|
|
1441
|
+
...options,
|
|
1633
1442
|
immediate: true
|
|
1634
|
-
}
|
|
1443
|
+
}
|
|
1635
1444
|
);
|
|
1636
1445
|
}
|
|
1637
1446
|
|
|
@@ -1642,123 +1451,23 @@ function watchOnce(source, cb, options) {
|
|
|
1642
1451
|
}, options);
|
|
1643
1452
|
}
|
|
1644
1453
|
|
|
1645
|
-
var __defProp$2 = Object.defineProperty;
|
|
1646
|
-
var __defProps$2 = Object.defineProperties;
|
|
1647
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1648
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1649
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1650
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1651
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1652
|
-
var __spreadValues$2 = (a, b) => {
|
|
1653
|
-
for (var prop in b || (b = {}))
|
|
1654
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
1655
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
1656
|
-
if (__getOwnPropSymbols$2)
|
|
1657
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1658
|
-
if (__propIsEnum$2.call(b, prop))
|
|
1659
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
1660
|
-
}
|
|
1661
|
-
return a;
|
|
1662
|
-
};
|
|
1663
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1664
|
-
var __objRest$1 = (source, exclude) => {
|
|
1665
|
-
var target = {};
|
|
1666
|
-
for (var prop in source)
|
|
1667
|
-
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1668
|
-
target[prop] = source[prop];
|
|
1669
|
-
if (source != null && __getOwnPropSymbols$2)
|
|
1670
|
-
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
1671
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
1672
|
-
target[prop] = source[prop];
|
|
1673
|
-
}
|
|
1674
|
-
return target;
|
|
1675
|
-
};
|
|
1676
|
-
function watchPausable(source, cb, options = {}) {
|
|
1677
|
-
const _a = options, {
|
|
1678
|
-
eventFilter: filter
|
|
1679
|
-
} = _a, watchOptions = __objRest$1(_a, [
|
|
1680
|
-
"eventFilter"
|
|
1681
|
-
]);
|
|
1682
|
-
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
1683
|
-
const stop = watchWithFilter(
|
|
1684
|
-
source,
|
|
1685
|
-
cb,
|
|
1686
|
-
__spreadProps$2(__spreadValues$2({}, watchOptions), {
|
|
1687
|
-
eventFilter
|
|
1688
|
-
})
|
|
1689
|
-
);
|
|
1690
|
-
return { stop, pause, resume, isActive };
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
var __defProp$1 = Object.defineProperty;
|
|
1694
|
-
var __defProps$1 = Object.defineProperties;
|
|
1695
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
1696
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
1697
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
1698
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
1699
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1700
|
-
var __spreadValues$1 = (a, b) => {
|
|
1701
|
-
for (var prop in b || (b = {}))
|
|
1702
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
1703
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
1704
|
-
if (__getOwnPropSymbols$1)
|
|
1705
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
1706
|
-
if (__propIsEnum$1.call(b, prop))
|
|
1707
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
1708
|
-
}
|
|
1709
|
-
return a;
|
|
1710
|
-
};
|
|
1711
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1712
|
-
var __objRest = (source, exclude) => {
|
|
1713
|
-
var target = {};
|
|
1714
|
-
for (var prop in source)
|
|
1715
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1716
|
-
target[prop] = source[prop];
|
|
1717
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
1718
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
1719
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
1720
|
-
target[prop] = source[prop];
|
|
1721
|
-
}
|
|
1722
|
-
return target;
|
|
1723
|
-
};
|
|
1724
1454
|
function watchThrottled(source, cb, options = {}) {
|
|
1725
|
-
const
|
|
1455
|
+
const {
|
|
1726
1456
|
throttle = 0,
|
|
1727
1457
|
trailing = true,
|
|
1728
|
-
leading = true
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
"trailing",
|
|
1732
|
-
"leading"
|
|
1733
|
-
]);
|
|
1458
|
+
leading = true,
|
|
1459
|
+
...watchOptions
|
|
1460
|
+
} = options;
|
|
1734
1461
|
return watchWithFilter(
|
|
1735
1462
|
source,
|
|
1736
1463
|
cb,
|
|
1737
|
-
|
|
1464
|
+
{
|
|
1465
|
+
...watchOptions,
|
|
1738
1466
|
eventFilter: throttleFilter(throttle, trailing, leading)
|
|
1739
|
-
}
|
|
1467
|
+
}
|
|
1740
1468
|
);
|
|
1741
1469
|
}
|
|
1742
1470
|
|
|
1743
|
-
var __defProp = Object.defineProperty;
|
|
1744
|
-
var __defProps = Object.defineProperties;
|
|
1745
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1746
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1747
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1748
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1749
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1750
|
-
var __spreadValues = (a, b) => {
|
|
1751
|
-
for (var prop in b || (b = {}))
|
|
1752
|
-
if (__hasOwnProp.call(b, prop))
|
|
1753
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1754
|
-
if (__getOwnPropSymbols)
|
|
1755
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
1756
|
-
if (__propIsEnum.call(b, prop))
|
|
1757
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1758
|
-
}
|
|
1759
|
-
return a;
|
|
1760
|
-
};
|
|
1761
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1762
1471
|
function watchTriggerable(source, cb, options = {}) {
|
|
1763
1472
|
let cleanupFn;
|
|
1764
1473
|
function onEffect() {
|
|
@@ -1784,9 +1493,10 @@ function watchTriggerable(source, cb, options = {}) {
|
|
|
1784
1493
|
});
|
|
1785
1494
|
return res2;
|
|
1786
1495
|
};
|
|
1787
|
-
return
|
|
1496
|
+
return {
|
|
1497
|
+
...res,
|
|
1788
1498
|
trigger
|
|
1789
|
-
}
|
|
1499
|
+
};
|
|
1790
1500
|
}
|
|
1791
1501
|
function getWatchSources(sources) {
|
|
1792
1502
|
if (isReactive(sources))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/shared",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.1",
|
|
4
4
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"funding": "https://github.com/sponsors/antfu",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"import": "./index.mjs",
|
|
25
|
+
"require": "./index.cjs"
|
|
26
26
|
},
|
|
27
27
|
"./*": "./*"
|
|
28
28
|
},
|