@vueuse/shared 12.3.0 → 12.4.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 +33 -33
- package/index.iife.js +33 -33
- package/index.iife.min.js +1 -1
- package/index.mjs +33 -33
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -9,13 +9,13 @@ function computedEager(fn, options) {
|
|
|
9
9
|
result.value = fn();
|
|
10
10
|
}, {
|
|
11
11
|
...options,
|
|
12
|
-
flush: (_a = options == null ?
|
|
12
|
+
flush: (_a = options == null ? undefined : options.flush) != null ? _a : "sync"
|
|
13
13
|
});
|
|
14
14
|
return vue.readonly(result);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function computedWithControl(source, fn) {
|
|
18
|
-
let v =
|
|
18
|
+
let v = undefined;
|
|
19
19
|
let track;
|
|
20
20
|
let trigger;
|
|
21
21
|
const dirty = vue.ref(true);
|
|
@@ -25,7 +25,7 @@ function computedWithControl(source, fn) {
|
|
|
25
25
|
};
|
|
26
26
|
vue.watch(source, update, { flush: "sync" });
|
|
27
27
|
const get = typeof fn === "function" ? fn : fn.get;
|
|
28
|
-
const set = typeof fn === "function" ?
|
|
28
|
+
const set = typeof fn === "function" ? undefined : fn.set;
|
|
29
29
|
const result = vue.customRef((_track, _trigger) => {
|
|
30
30
|
track = _track;
|
|
31
31
|
trigger = _trigger;
|
|
@@ -39,7 +39,7 @@ function computedWithControl(source, fn) {
|
|
|
39
39
|
return v;
|
|
40
40
|
},
|
|
41
41
|
set(v2) {
|
|
42
|
-
set == null ?
|
|
42
|
+
set == null ? undefined : set(v2);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
});
|
|
@@ -101,7 +101,7 @@ const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
|
101
101
|
const injectLocal = (...args) => {
|
|
102
102
|
var _a;
|
|
103
103
|
const key = args[0];
|
|
104
|
-
const instance = (_a = vue.getCurrentInstance()) == null ?
|
|
104
|
+
const instance = (_a = vue.getCurrentInstance()) == null ? undefined : _a.proxy;
|
|
105
105
|
if (instance == null && !vue.hasInjectionContext())
|
|
106
106
|
throw new Error("injectLocal must be called in setup");
|
|
107
107
|
if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
|
|
@@ -111,7 +111,7 @@ const injectLocal = (...args) => {
|
|
|
111
111
|
|
|
112
112
|
const provideLocal = (key, value) => {
|
|
113
113
|
var _a;
|
|
114
|
-
const instance = (_a = vue.getCurrentInstance()) == null ?
|
|
114
|
+
const instance = (_a = vue.getCurrentInstance()) == null ? undefined : _a.proxy;
|
|
115
115
|
if (instance == null)
|
|
116
116
|
throw new Error("provideLocal must be called in setup");
|
|
117
117
|
if (!localProvidedStateMap.has(instance))
|
|
@@ -122,8 +122,8 @@ const provideLocal = (key, value) => {
|
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
function createInjectionState(composable, options) {
|
|
125
|
-
const key = (options == null ?
|
|
126
|
-
const defaultValue = options == null ?
|
|
125
|
+
const key = (options == null ? undefined : options.injectionKey) || Symbol(composable.name || "InjectionState");
|
|
126
|
+
const defaultValue = options == null ? undefined : options.defaultValue;
|
|
127
127
|
const useProvidingState = (...args) => {
|
|
128
128
|
const state = composable(...args);
|
|
129
129
|
provideLocal(key, state);
|
|
@@ -141,8 +141,8 @@ function createSharedComposable(composable) {
|
|
|
141
141
|
subscribers -= 1;
|
|
142
142
|
if (scope && subscribers <= 0) {
|
|
143
143
|
scope.stop();
|
|
144
|
-
state =
|
|
145
|
-
scope =
|
|
144
|
+
state = undefined;
|
|
145
|
+
scope = undefined;
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
return (...args) => {
|
|
@@ -209,7 +209,7 @@ function makeDestructurable(obj, arr) {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
function reactify(fn, options) {
|
|
212
|
-
const unrefFn = (options == null ?
|
|
212
|
+
const unrefFn = (options == null ? undefined : options.computedGetter) === false ? vue.unref : vue.toValue;
|
|
213
213
|
return function(...args) {
|
|
214
214
|
return vue.computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
215
215
|
};
|
|
@@ -305,7 +305,7 @@ const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
|
|
|
305
305
|
const isIOS = /* @__PURE__ */ getIsIOS();
|
|
306
306
|
function getIsIOS() {
|
|
307
307
|
var _a, _b;
|
|
308
|
-
return isClient && ((_a = window == null ?
|
|
308
|
+
return isClient && ((_a = window == null ? undefined : window.navigator) == null ? undefined : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? undefined : window.navigator) == null ? undefined : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? undefined : window.navigator.userAgent));
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
function createFilterWrapper(filter, fn) {
|
|
@@ -333,7 +333,7 @@ function debounceFilter(ms, options = {}) {
|
|
|
333
333
|
const maxDuration = vue.toValue(options.maxWait);
|
|
334
334
|
if (timer)
|
|
335
335
|
_clearTimeout(timer);
|
|
336
|
-
if (duration <= 0 || maxDuration !==
|
|
336
|
+
if (duration <= 0 || maxDuration !== undefined && maxDuration <= 0) {
|
|
337
337
|
if (maxTimer) {
|
|
338
338
|
_clearTimeout(maxTimer);
|
|
339
339
|
maxTimer = null;
|
|
@@ -377,7 +377,7 @@ function throttleFilter(...args) {
|
|
|
377
377
|
const clear = () => {
|
|
378
378
|
if (timer) {
|
|
379
379
|
clearTimeout(timer);
|
|
380
|
-
timer =
|
|
380
|
+
timer = undefined;
|
|
381
381
|
lastRejector();
|
|
382
382
|
lastRejector = noop;
|
|
383
383
|
}
|
|
@@ -463,7 +463,7 @@ function createSingletonPromise(fn) {
|
|
|
463
463
|
}
|
|
464
464
|
wrapper.reset = async () => {
|
|
465
465
|
const _prev = _promise;
|
|
466
|
-
_promise =
|
|
466
|
+
_promise = undefined;
|
|
467
467
|
if (_prev)
|
|
468
468
|
await _prev;
|
|
469
469
|
};
|
|
@@ -479,7 +479,7 @@ function increaseWithUnit(target, delta) {
|
|
|
479
479
|
var _a;
|
|
480
480
|
if (typeof target === "number")
|
|
481
481
|
return target + delta;
|
|
482
|
-
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ?
|
|
482
|
+
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ? undefined : _a[0]) || "";
|
|
483
483
|
const unit = target.slice(value.length);
|
|
484
484
|
const result = Number.parseFloat(value) + delta;
|
|
485
485
|
if (Number.isNaN(result))
|
|
@@ -492,7 +492,7 @@ function pxValue(px) {
|
|
|
492
492
|
function objectPick(obj, keys, omitUndefined = false) {
|
|
493
493
|
return keys.reduce((n, k) => {
|
|
494
494
|
if (k in obj) {
|
|
495
|
-
if (!omitUndefined || obj[k] !==
|
|
495
|
+
if (!omitUndefined || obj[k] !== undefined)
|
|
496
496
|
n[k] = obj[k];
|
|
497
497
|
}
|
|
498
498
|
return n;
|
|
@@ -500,7 +500,7 @@ function objectPick(obj, keys, omitUndefined = false) {
|
|
|
500
500
|
}
|
|
501
501
|
function objectOmit(obj, keys, omitUndefined = false) {
|
|
502
502
|
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {
|
|
503
|
-
return (!omitUndefined || value !==
|
|
503
|
+
return (!omitUndefined || value !== undefined) && !keys.includes(key);
|
|
504
504
|
}));
|
|
505
505
|
}
|
|
506
506
|
function objectEntries(obj) {
|
|
@@ -625,10 +625,10 @@ function refWithControl(initial, options = {}) {
|
|
|
625
625
|
if (value === source)
|
|
626
626
|
return;
|
|
627
627
|
const old = source;
|
|
628
|
-
if (((_a = options.onBeforeChange) == null ?
|
|
628
|
+
if (((_a = options.onBeforeChange) == null ? undefined : _a.call(options, value, old)) === false)
|
|
629
629
|
return;
|
|
630
630
|
source = value;
|
|
631
|
-
(_b = options.onChanged) == null ?
|
|
631
|
+
(_b = options.onChanged) == null ? undefined : _b.call(options, value, old);
|
|
632
632
|
if (triggering)
|
|
633
633
|
trigger();
|
|
634
634
|
}
|
|
@@ -824,7 +824,7 @@ function createUntil(r, isNot = false) {
|
|
|
824
824
|
if (stop)
|
|
825
825
|
stop();
|
|
826
826
|
else
|
|
827
|
-
vue.nextTick(() => stop == null ?
|
|
827
|
+
vue.nextTick(() => stop == null ? undefined : stop());
|
|
828
828
|
resolve(v);
|
|
829
829
|
}
|
|
830
830
|
},
|
|
@@ -838,7 +838,7 @@ function createUntil(r, isNot = false) {
|
|
|
838
838
|
const promises = [watcher];
|
|
839
839
|
if (timeout != null) {
|
|
840
840
|
promises.push(
|
|
841
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => stop == null ?
|
|
841
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => stop == null ? undefined : stop())
|
|
842
842
|
);
|
|
843
843
|
}
|
|
844
844
|
return Promise.race(promises);
|
|
@@ -856,7 +856,7 @@ function createUntil(r, isNot = false) {
|
|
|
856
856
|
if (stop)
|
|
857
857
|
stop();
|
|
858
858
|
else
|
|
859
|
-
vue.nextTick(() => stop == null ?
|
|
859
|
+
vue.nextTick(() => stop == null ? undefined : stop());
|
|
860
860
|
resolve(v1);
|
|
861
861
|
}
|
|
862
862
|
},
|
|
@@ -871,7 +871,7 @@ function createUntil(r, isNot = false) {
|
|
|
871
871
|
if (timeout != null) {
|
|
872
872
|
promises.push(
|
|
873
873
|
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => {
|
|
874
|
-
stop == null ?
|
|
874
|
+
stop == null ? undefined : stop();
|
|
875
875
|
return vue.toValue(r);
|
|
876
876
|
})
|
|
877
877
|
);
|
|
@@ -885,7 +885,7 @@ function createUntil(r, isNot = false) {
|
|
|
885
885
|
return toBe(null, options);
|
|
886
886
|
}
|
|
887
887
|
function toBeUndefined(options) {
|
|
888
|
-
return toBe(
|
|
888
|
+
return toBe(undefined, options);
|
|
889
889
|
}
|
|
890
890
|
function toBeNaN(options) {
|
|
891
891
|
return toMatch(Number.isNaN, options);
|
|
@@ -986,7 +986,7 @@ function findLast(arr, cb) {
|
|
|
986
986
|
if (cb(arr[index], index, arr))
|
|
987
987
|
return arr[index];
|
|
988
988
|
}
|
|
989
|
-
return
|
|
989
|
+
return undefined;
|
|
990
990
|
}
|
|
991
991
|
function useArrayFindLast(list, fn) {
|
|
992
992
|
return vue.computed(() => vue.toValue(
|
|
@@ -1135,13 +1135,13 @@ function formatDate(date, formatStr, options = {}) {
|
|
|
1135
1135
|
};
|
|
1136
1136
|
return formatStr.replace(REGEX_FORMAT, (match, $1) => {
|
|
1137
1137
|
var _a2, _b;
|
|
1138
|
-
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ?
|
|
1138
|
+
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? undefined : _a2.call(matches)) != null ? _b : match;
|
|
1139
1139
|
});
|
|
1140
1140
|
}
|
|
1141
1141
|
function normalizeDate(date) {
|
|
1142
1142
|
if (date === null)
|
|
1143
1143
|
return new Date(Number.NaN);
|
|
1144
|
-
if (date ===
|
|
1144
|
+
if (date === undefined)
|
|
1145
1145
|
return /* @__PURE__ */ new Date();
|
|
1146
1146
|
if (date instanceof Date)
|
|
1147
1147
|
return new Date(date);
|
|
@@ -1350,7 +1350,7 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1350
1350
|
}
|
|
1351
1351
|
|
|
1352
1352
|
function watchArray(source, cb, options) {
|
|
1353
|
-
let oldList = (options == null ?
|
|
1353
|
+
let oldList = (options == null ? undefined : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : vue.toValue(source)];
|
|
1354
1354
|
return vue.watch(source, (newList, _, onCleanup) => {
|
|
1355
1355
|
const oldListRemains = Array.from({ length: oldList.length });
|
|
1356
1356
|
const added = [];
|
|
@@ -1394,7 +1394,7 @@ function watchAtMost(source, cb, options) {
|
|
|
1394
1394
|
function watchDebounced(source, cb, options = {}) {
|
|
1395
1395
|
const {
|
|
1396
1396
|
debounce = 0,
|
|
1397
|
-
maxWait =
|
|
1397
|
+
maxWait = undefined,
|
|
1398
1398
|
...watchOptions
|
|
1399
1399
|
} = options;
|
|
1400
1400
|
return watchWithFilter(
|
|
@@ -1531,7 +1531,7 @@ function watchTriggerable(source, cb, options = {}) {
|
|
|
1531
1531
|
if (!cleanupFn)
|
|
1532
1532
|
return;
|
|
1533
1533
|
const fn = cleanupFn;
|
|
1534
|
-
cleanupFn =
|
|
1534
|
+
cleanupFn = undefined;
|
|
1535
1535
|
fn();
|
|
1536
1536
|
}
|
|
1537
1537
|
function onCleanup(callback) {
|
|
@@ -1563,7 +1563,7 @@ function getWatchSources(sources) {
|
|
|
1563
1563
|
return vue.toValue(sources);
|
|
1564
1564
|
}
|
|
1565
1565
|
function getOldValue(source) {
|
|
1566
|
-
return Array.isArray(source) ? source.map(() =>
|
|
1566
|
+
return Array.isArray(source) ? source.map(() => undefined) : undefined;
|
|
1567
1567
|
}
|
|
1568
1568
|
|
|
1569
1569
|
function whenever(source, cb, options) {
|
|
@@ -1571,7 +1571,7 @@ function whenever(source, cb, options) {
|
|
|
1571
1571
|
source,
|
|
1572
1572
|
(v, ov, onInvalidate) => {
|
|
1573
1573
|
if (v) {
|
|
1574
|
-
if (options == null ?
|
|
1574
|
+
if (options == null ? undefined : options.once)
|
|
1575
1575
|
vue.nextTick(() => stop());
|
|
1576
1576
|
cb(v, ov, onInvalidate);
|
|
1577
1577
|
}
|
package/index.iife.js
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
result.value = fn();
|
|
9
9
|
}, {
|
|
10
10
|
...options,
|
|
11
|
-
flush: (_a = options == null ?
|
|
11
|
+
flush: (_a = options == null ? undefined : options.flush) != null ? _a : "sync"
|
|
12
12
|
});
|
|
13
13
|
return vue.readonly(result);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function computedWithControl(source, fn) {
|
|
17
|
-
let v =
|
|
17
|
+
let v = undefined;
|
|
18
18
|
let track;
|
|
19
19
|
let trigger;
|
|
20
20
|
const dirty = vue.ref(true);
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
};
|
|
25
25
|
vue.watch(source, update, { flush: "sync" });
|
|
26
26
|
const get = typeof fn === "function" ? fn : fn.get;
|
|
27
|
-
const set = typeof fn === "function" ?
|
|
27
|
+
const set = typeof fn === "function" ? undefined : fn.set;
|
|
28
28
|
const result = vue.customRef((_track, _trigger) => {
|
|
29
29
|
track = _track;
|
|
30
30
|
trigger = _trigger;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
return v;
|
|
39
39
|
},
|
|
40
40
|
set(v2) {
|
|
41
|
-
set == null ?
|
|
41
|
+
set == null ? undefined : set(v2);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
});
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
const injectLocal = (...args) => {
|
|
101
101
|
var _a;
|
|
102
102
|
const key = args[0];
|
|
103
|
-
const instance = (_a = vue.getCurrentInstance()) == null ?
|
|
103
|
+
const instance = (_a = vue.getCurrentInstance()) == null ? undefined : _a.proxy;
|
|
104
104
|
if (instance == null && !vue.hasInjectionContext())
|
|
105
105
|
throw new Error("injectLocal must be called in setup");
|
|
106
106
|
if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
|
|
111
111
|
const provideLocal = (key, value) => {
|
|
112
112
|
var _a;
|
|
113
|
-
const instance = (_a = vue.getCurrentInstance()) == null ?
|
|
113
|
+
const instance = (_a = vue.getCurrentInstance()) == null ? undefined : _a.proxy;
|
|
114
114
|
if (instance == null)
|
|
115
115
|
throw new Error("provideLocal must be called in setup");
|
|
116
116
|
if (!localProvidedStateMap.has(instance))
|
|
@@ -121,8 +121,8 @@
|
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
function createInjectionState(composable, options) {
|
|
124
|
-
const key = (options == null ?
|
|
125
|
-
const defaultValue = options == null ?
|
|
124
|
+
const key = (options == null ? undefined : options.injectionKey) || Symbol(composable.name || "InjectionState");
|
|
125
|
+
const defaultValue = options == null ? undefined : options.defaultValue;
|
|
126
126
|
const useProvidingState = (...args) => {
|
|
127
127
|
const state = composable(...args);
|
|
128
128
|
provideLocal(key, state);
|
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
subscribers -= 1;
|
|
141
141
|
if (scope && subscribers <= 0) {
|
|
142
142
|
scope.stop();
|
|
143
|
-
state =
|
|
144
|
-
scope =
|
|
143
|
+
state = undefined;
|
|
144
|
+
scope = undefined;
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
return (...args) => {
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
function reactify(fn, options) {
|
|
211
|
-
const unrefFn = (options == null ?
|
|
211
|
+
const unrefFn = (options == null ? undefined : options.computedGetter) === false ? vue.unref : vue.toValue;
|
|
212
212
|
return function(...args) {
|
|
213
213
|
return vue.computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
214
214
|
};
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
const isIOS = /* @__PURE__ */ getIsIOS();
|
|
305
305
|
function getIsIOS() {
|
|
306
306
|
var _a, _b;
|
|
307
|
-
return isClient && ((_a = window == null ?
|
|
307
|
+
return isClient && ((_a = window == null ? undefined : window.navigator) == null ? undefined : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? undefined : window.navigator) == null ? undefined : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? undefined : window.navigator.userAgent));
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
function createFilterWrapper(filter, fn) {
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
const maxDuration = vue.toValue(options.maxWait);
|
|
333
333
|
if (timer)
|
|
334
334
|
_clearTimeout(timer);
|
|
335
|
-
if (duration <= 0 || maxDuration !==
|
|
335
|
+
if (duration <= 0 || maxDuration !== undefined && maxDuration <= 0) {
|
|
336
336
|
if (maxTimer) {
|
|
337
337
|
_clearTimeout(maxTimer);
|
|
338
338
|
maxTimer = null;
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
const clear = () => {
|
|
377
377
|
if (timer) {
|
|
378
378
|
clearTimeout(timer);
|
|
379
|
-
timer =
|
|
379
|
+
timer = undefined;
|
|
380
380
|
lastRejector();
|
|
381
381
|
lastRejector = noop;
|
|
382
382
|
}
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
}
|
|
463
463
|
wrapper.reset = async () => {
|
|
464
464
|
const _prev = _promise;
|
|
465
|
-
_promise =
|
|
465
|
+
_promise = undefined;
|
|
466
466
|
if (_prev)
|
|
467
467
|
await _prev;
|
|
468
468
|
};
|
|
@@ -478,7 +478,7 @@
|
|
|
478
478
|
var _a;
|
|
479
479
|
if (typeof target === "number")
|
|
480
480
|
return target + delta;
|
|
481
|
-
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ?
|
|
481
|
+
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ? undefined : _a[0]) || "";
|
|
482
482
|
const unit = target.slice(value.length);
|
|
483
483
|
const result = Number.parseFloat(value) + delta;
|
|
484
484
|
if (Number.isNaN(result))
|
|
@@ -491,7 +491,7 @@
|
|
|
491
491
|
function objectPick(obj, keys, omitUndefined = false) {
|
|
492
492
|
return keys.reduce((n, k) => {
|
|
493
493
|
if (k in obj) {
|
|
494
|
-
if (!omitUndefined || obj[k] !==
|
|
494
|
+
if (!omitUndefined || obj[k] !== undefined)
|
|
495
495
|
n[k] = obj[k];
|
|
496
496
|
}
|
|
497
497
|
return n;
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
}
|
|
500
500
|
function objectOmit(obj, keys, omitUndefined = false) {
|
|
501
501
|
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {
|
|
502
|
-
return (!omitUndefined || value !==
|
|
502
|
+
return (!omitUndefined || value !== undefined) && !keys.includes(key);
|
|
503
503
|
}));
|
|
504
504
|
}
|
|
505
505
|
function objectEntries(obj) {
|
|
@@ -624,10 +624,10 @@
|
|
|
624
624
|
if (value === source)
|
|
625
625
|
return;
|
|
626
626
|
const old = source;
|
|
627
|
-
if (((_a = options.onBeforeChange) == null ?
|
|
627
|
+
if (((_a = options.onBeforeChange) == null ? undefined : _a.call(options, value, old)) === false)
|
|
628
628
|
return;
|
|
629
629
|
source = value;
|
|
630
|
-
(_b = options.onChanged) == null ?
|
|
630
|
+
(_b = options.onChanged) == null ? undefined : _b.call(options, value, old);
|
|
631
631
|
if (triggering)
|
|
632
632
|
trigger();
|
|
633
633
|
}
|
|
@@ -823,7 +823,7 @@
|
|
|
823
823
|
if (stop)
|
|
824
824
|
stop();
|
|
825
825
|
else
|
|
826
|
-
vue.nextTick(() => stop == null ?
|
|
826
|
+
vue.nextTick(() => stop == null ? undefined : stop());
|
|
827
827
|
resolve(v);
|
|
828
828
|
}
|
|
829
829
|
},
|
|
@@ -837,7 +837,7 @@
|
|
|
837
837
|
const promises = [watcher];
|
|
838
838
|
if (timeout != null) {
|
|
839
839
|
promises.push(
|
|
840
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => stop == null ?
|
|
840
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => stop == null ? undefined : stop())
|
|
841
841
|
);
|
|
842
842
|
}
|
|
843
843
|
return Promise.race(promises);
|
|
@@ -855,7 +855,7 @@
|
|
|
855
855
|
if (stop)
|
|
856
856
|
stop();
|
|
857
857
|
else
|
|
858
|
-
vue.nextTick(() => stop == null ?
|
|
858
|
+
vue.nextTick(() => stop == null ? undefined : stop());
|
|
859
859
|
resolve(v1);
|
|
860
860
|
}
|
|
861
861
|
},
|
|
@@ -870,7 +870,7 @@
|
|
|
870
870
|
if (timeout != null) {
|
|
871
871
|
promises.push(
|
|
872
872
|
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => {
|
|
873
|
-
stop == null ?
|
|
873
|
+
stop == null ? undefined : stop();
|
|
874
874
|
return vue.toValue(r);
|
|
875
875
|
})
|
|
876
876
|
);
|
|
@@ -884,7 +884,7 @@
|
|
|
884
884
|
return toBe(null, options);
|
|
885
885
|
}
|
|
886
886
|
function toBeUndefined(options) {
|
|
887
|
-
return toBe(
|
|
887
|
+
return toBe(undefined, options);
|
|
888
888
|
}
|
|
889
889
|
function toBeNaN(options) {
|
|
890
890
|
return toMatch(Number.isNaN, options);
|
|
@@ -985,7 +985,7 @@
|
|
|
985
985
|
if (cb(arr[index], index, arr))
|
|
986
986
|
return arr[index];
|
|
987
987
|
}
|
|
988
|
-
return
|
|
988
|
+
return undefined;
|
|
989
989
|
}
|
|
990
990
|
function useArrayFindLast(list, fn) {
|
|
991
991
|
return vue.computed(() => vue.toValue(
|
|
@@ -1134,13 +1134,13 @@
|
|
|
1134
1134
|
};
|
|
1135
1135
|
return formatStr.replace(REGEX_FORMAT, (match, $1) => {
|
|
1136
1136
|
var _a2, _b;
|
|
1137
|
-
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ?
|
|
1137
|
+
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? undefined : _a2.call(matches)) != null ? _b : match;
|
|
1138
1138
|
});
|
|
1139
1139
|
}
|
|
1140
1140
|
function normalizeDate(date) {
|
|
1141
1141
|
if (date === null)
|
|
1142
1142
|
return new Date(Number.NaN);
|
|
1143
|
-
if (date ===
|
|
1143
|
+
if (date === undefined)
|
|
1144
1144
|
return /* @__PURE__ */ new Date();
|
|
1145
1145
|
if (date instanceof Date)
|
|
1146
1146
|
return new Date(date);
|
|
@@ -1349,7 +1349,7 @@
|
|
|
1349
1349
|
}
|
|
1350
1350
|
|
|
1351
1351
|
function watchArray(source, cb, options) {
|
|
1352
|
-
let oldList = (options == null ?
|
|
1352
|
+
let oldList = (options == null ? undefined : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : vue.toValue(source)];
|
|
1353
1353
|
return vue.watch(source, (newList, _, onCleanup) => {
|
|
1354
1354
|
const oldListRemains = Array.from({ length: oldList.length });
|
|
1355
1355
|
const added = [];
|
|
@@ -1393,7 +1393,7 @@
|
|
|
1393
1393
|
function watchDebounced(source, cb, options = {}) {
|
|
1394
1394
|
const {
|
|
1395
1395
|
debounce = 0,
|
|
1396
|
-
maxWait =
|
|
1396
|
+
maxWait = undefined,
|
|
1397
1397
|
...watchOptions
|
|
1398
1398
|
} = options;
|
|
1399
1399
|
return watchWithFilter(
|
|
@@ -1530,7 +1530,7 @@
|
|
|
1530
1530
|
if (!cleanupFn)
|
|
1531
1531
|
return;
|
|
1532
1532
|
const fn = cleanupFn;
|
|
1533
|
-
cleanupFn =
|
|
1533
|
+
cleanupFn = undefined;
|
|
1534
1534
|
fn();
|
|
1535
1535
|
}
|
|
1536
1536
|
function onCleanup(callback) {
|
|
@@ -1562,7 +1562,7 @@
|
|
|
1562
1562
|
return vue.toValue(sources);
|
|
1563
1563
|
}
|
|
1564
1564
|
function getOldValue(source) {
|
|
1565
|
-
return Array.isArray(source) ? source.map(() =>
|
|
1565
|
+
return Array.isArray(source) ? source.map(() => undefined) : undefined;
|
|
1566
1566
|
}
|
|
1567
1567
|
|
|
1568
1568
|
function whenever(source, cb, options) {
|
|
@@ -1570,7 +1570,7 @@
|
|
|
1570
1570
|
source,
|
|
1571
1571
|
(v, ov, onInvalidate) => {
|
|
1572
1572
|
if (v) {
|
|
1573
|
-
if (options == null ?
|
|
1573
|
+
if (options == null ? undefined : options.once)
|
|
1574
1574
|
vue.nextTick(() => stop());
|
|
1575
1575
|
cb(v, ov, onInvalidate);
|
|
1576
1576
|
}
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(c,o){"use strict";function H(t,e){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),o.readonly(r)}function G(t,e){let n,r,a;const i=o.ref(!0),l=()=>{i.value=!0,a()};o.watch(t,l,{flush:"sync"});const u=typeof e=="function"?e:e.get,s=typeof e=="function"?void 0:e.set,h=o.customRef((m,d)=>(r=m,a=d,{get(){return i.value&&(n=u(n),i.value=!1),r(),n},set(f){s?.(f)}}));return Object.isExtensible(h)&&(h.trigger=l),h}function p(t){return o.getCurrentScope()?(o.onScopeDispose(t),!0):!1}function dt(){const t=new Set,e=i=>{t.delete(i)};return{on:i=>{t.add(i);const l=()=>e(i);return p(l),{off:l}},off:e,trigger:(...i)=>Promise.all(Array.from(t).map(l=>l(...i))),clear:()=>{t.clear()}}}function mt(t){let e=!1,n;const r=o.effectScope(!0);return(...a)=>(e||(n=r.run(()=>t(...a)),e=!0),n)}const S=new WeakMap,z=(...t)=>{var e;const n=t[0],r=(e=o.getCurrentInstance())==null?void 0:e.proxy;if(r==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&S.has(r)&&n in S.get(r)?S.get(r)[n]:o.inject(...t)},q=(t,e)=>{var n;const r=(n=o.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");S.has(r)||S.set(r,Object.create(null));const a=S.get(r);a[t]=e,o.provide(t,e)};function ht(t,e){const n=e?.injectionKey||Symbol(t.name||"InjectionState"),r=e?.defaultValue;return[(...l)=>{const u=t(...l);return q(n,u),u},()=>z(n,r)]}function yt(t){let e=0,n,r;const a=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...i)=>(e+=1,r||(r=o.effectScope(!0),n=r.run(()=>t(...i))),p(a),n)}function Z(t,e,{enumerable:n=!1,unwrap:r=!0}={}){for(const[a,i]of Object.entries(e))a!=="value"&&(o.isRef(i)&&r?Object.defineProperty(t,a,{get(){return i.value},set(l){i.value=l},enumerable:n}):Object.defineProperty(t,a,{value:i,enumerable:n}));return t}function gt(t,e){return e==null?o.unref(t):o.unref(t)[e]}function wt(t){return o.unref(t)!=null}function Vt(t,e){if(typeof Symbol<"u"){const n={...t};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function k(t,e){const n=e?.computedGetter===!1?o.unref:o.toValue;return function(...r){return o.computed(()=>t.apply(this,r.map(a=>n(a))))}}function bt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:a=!0}=e;n.push(...Object.keys(t)),a&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(a=>{const i=t[a];return[a,typeof i=="function"?k(i.bind(t),r):i]}))}function J(t){if(!o.isRef(t))return o.reactive(t);const e=new Proxy({},{get(n,r,a){return o.unref(Reflect.get(t.value,r,a))},set(n,r,a){return o.isRef(t.value[r])&&!o.isRef(a)?t.value[r].value=a:t.value[r]=a,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return o.reactive(e)}function E(t){return J(o.computed(t))}function pt(t,...e){const n=e.flat(),r=n[0];return E(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,i])=>!r(o.toValue(i),a)):Object.entries(o.toRefs(t)).filter(a=>!n.includes(a[0]))))}const D=typeof window<"u"&&typeof document<"u",At=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Ot=t=>typeof t<"u",St=t=>t!=null,Tt=(t,...e)=>{t||console.warn(...e)},Dt=Object.prototype.toString,X=t=>Dt.call(t)==="[object Object]",Ft=()=>Date.now(),K=()=>+Date.now(),Mt=(t,e,n)=>Math.min(n,Math.max(e,t)),A=()=>{},Pt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),It=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Rt=Ct();function Ct(){var t,e;return D&&((t=window?.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window?.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function F(t,e){function n(...r){return new Promise((a,i)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(a).catch(i)})}return n}const I=t=>t();function _(t,e={}){let n,r,a=A;const i=u=>{clearTimeout(u),a(),a=A};return u=>{const s=o.toValue(t),h=o.toValue(e.maxWait);return n&&i(n),s<=0||h!==void 0&&h<=0?(r&&(i(r),r=null),Promise.resolve(u())):new Promise((m,d)=>{a=e.rejectOnCancel?d:m,h&&!r&&(r=setTimeout(()=>{n&&i(n),r=null,m(u())},h)),n=setTimeout(()=>{r&&i(r),r=null,m(u())},s)})}}function N(...t){let e=0,n,r=!0,a=A,i,l,u,s,h;!o.isRef(t[0])&&typeof t[0]=="object"?{delay:l,trailing:u=!0,leading:s=!0,rejectOnCancel:h=!1}=t[0]:[l,u=!0,s=!0,h=!1]=t;const m=()=>{n&&(clearTimeout(n),n=void 0,a(),a=A)};return f=>{const y=o.toValue(l),g=Date.now()-e,V=()=>i=f();return m(),y<=0?(e=Date.now(),V()):(g>y&&(s||!r)?(e=Date.now(),V()):u&&(i=new Promise((w,b)=>{a=h?b:w,n=setTimeout(()=>{e=Date.now(),r=!0,w(V()),m()},Math.max(0,y-g))})),!s&&!n&&(n=setTimeout(()=>r=!0,y)),r=!1,i)}}function Q(t=I){const e=o.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const a=(...i)=>{e.value&&t(...i)};return{isActive:o.readonly(e),pause:n,resume:r,eventFilter:a}}function v(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const kt=/\B([A-Z])/g,Et=v(t=>t.replace(kt,"-$1").toLowerCase()),_t=/-(\w)/g,Nt=v(t=>t.replace(_t,(e,n)=>n?n.toUpperCase():""));function j(t,e=!1,n="Timeout"){return new Promise((r,a)=>{setTimeout(e?()=>a(n):r,t)})}function jt(t){return t}function Lt(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function Wt(t){return t()}function x(t,...e){return e.some(n=>n in t)}function Ut(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",a=t.slice(r.length),i=Number.parseFloat(r)+e;return Number.isNaN(i)?t:i+a}function Bt(t){return t.endsWith("rem")?Number.parseFloat(t)*16:Number.parseFloat(t)}function Yt(t,e,n=!1){return e.reduce((r,a)=>(a in t&&(!n||t[a]!==void 0)&&(r[a]=t[a]),r),{})}function $t(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,a])=>(!n||a!==void 0)&&!e.includes(r)))}function Ht(t){return Object.entries(t)}function M(t){return t||o.getCurrentInstance()}function tt(t){return Array.isArray(t)?t:[t]}function L(...t){if(t.length!==1)return o.toRef(...t);const e=t[0];return typeof e=="function"?o.readonly(o.customRef(()=>({get:e,set:A}))):o.ref(e)}const Gt=L;function zt(t,...e){const n=e.flat(),r=n[0];return E(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,i])=>r(o.toValue(i),a)):n.map(a=>[a,L(t,a)])))}function et(t,e=1e4){return o.customRef((n,r)=>{let a=o.toValue(t),i;const l=()=>setTimeout(()=>{a=o.toValue(t),r()},o.toValue(e));return p(()=>{clearTimeout(i)}),{get(){return n(),a},set(u){a=u,r(),clearTimeout(i),i=l()}}})}function nt(t,e=200,n={}){return F(_(e,n),t)}function W(t,e=200,n={}){const r=o.ref(t.value),a=nt(()=>{r.value=t.value},e,n);return o.watch(t,()=>a()),r}function qt(t,e){return o.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function rt(t,e=200,n=!1,r=!0,a=!1){return F(N(e,n,r,a),t)}function U(t,e=200,n=!0,r=!0){if(e<=0)return t;const a=o.ref(t.value),i=rt(()=>{a.value=t.value},e,n,r);return o.watch(t,()=>i()),a}function ot(t,e={}){let n=t,r,a;const i=o.customRef((f,y)=>(r=f,a=y,{get(){return l()},set(g){u(g)}}));function l(f=!0){return f&&r(),n}function u(f,y=!0){var g,V;if(f===n)return;const w=n;((g=e.onBeforeChange)==null?void 0:g.call(e,f,w))!==!1&&(n=f,(V=e.onChanged)==null||V.call(e,f,w),y&&a())}return Z(i,{get:l,set:u,untrackedGet:()=>l(!1),silentSet:f=>u(f,!1),peek:()=>l(!1),lay:f=>u(f,!1)},{enumerable:!0})}const Zt=ot;function Jt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3){const[e,n,r]=t;e[n]=r}}function P(t,e,n={}){const{eventFilter:r=I,...a}=n;return o.watch(t,F(r,e),a)}function R(t,e,n={}){const{eventFilter:r,...a}=n,{eventFilter:i,pause:l,resume:u,isActive:s}=Q(r);return{stop:P(t,e,{...a,eventFilter:i}),pause:l,resume:u,isActive:s}}function Xt(t,e,...[n]){const{flush:r="sync",deep:a=!1,immediate:i=!0,direction:l="both",transform:u={}}=n||{},s=[],h="ltr"in u&&u.ltr||(f=>f),m="rtl"in u&&u.rtl||(f=>f);return(l==="both"||l==="ltr")&&s.push(R(t,f=>{s.forEach(y=>y.pause()),e.value=h(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:i})),(l==="both"||l==="rtl")&&s.push(R(e,f=>{s.forEach(y=>y.pause()),t.value=m(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:i})),()=>{s.forEach(f=>f.stop())}}function Kt(t,e,n={}){const{flush:r="sync",deep:a=!1,immediate:i=!0}=n;return e=tt(e),o.watch(t,l=>e.forEach(u=>u.value=l),{flush:r,deep:a,immediate:i})}function Qt(t,e={}){if(!o.isRef(t))return o.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=o.customRef(()=>({get(){return t.value[r]},set(a){var i;if((i=o.toValue(e.replaceRef))!=null?i:!0)if(Array.isArray(t.value)){const u=[...t.value];u[r]=a,t.value=u}else{const u={...t.value,[r]:a};Object.setPrototypeOf(u,Object.getPrototypeOf(t.value)),t.value=u}else t.value[r]=a}}));return n}const vt=o.toValue,xt=o.toValue;function te(t,e=!0,n){M(n)?o.onBeforeMount(t,n):e?t():o.nextTick(t)}function ee(t,e){M(e)&&o.onBeforeUnmount(t,e)}function ne(t,e=!0,n){M()?o.onMounted(t,n):e?t():o.nextTick(t)}function re(t,e){M(e)&&o.onUnmounted(t,e)}function B(t,e=!1){function n(d,{flush:f="sync",deep:y=!1,timeout:g,throwOnTimeout:V}={}){let w=null;const $=[new Promise(C=>{w=o.watch(t,T=>{d(T)!==e&&(w?w():o.nextTick(()=>w?.()),C(T))},{flush:f,deep:y,immediate:!0})})];return g!=null&&$.push(j(g,V).then(()=>o.toValue(t)).finally(()=>w?.())),Promise.race($)}function r(d,f){if(!o.isRef(d))return n(T=>T===d,f);const{flush:y="sync",deep:g=!1,timeout:V,throwOnTimeout:w}=f??{};let b=null;const C=[new Promise(T=>{b=o.watch([t,d],([ft,$e])=>{e!==(ft===$e)&&(b?b():o.nextTick(()=>b?.()),T(ft))},{flush:y,deep:g,immediate:!0})})];return V!=null&&C.push(j(V,w).then(()=>o.toValue(t)).finally(()=>(b?.(),o.toValue(t)))),Promise.race(C)}function a(d){return n(f=>!!f,d)}function i(d){return r(null,d)}function l(d){return r(void 0,d)}function u(d){return n(Number.isNaN,d)}function s(d,f){return n(y=>{const g=Array.from(y);return g.includes(d)||g.includes(o.toValue(d))},f)}function h(d){return m(1,d)}function m(d=1,f){let y=-1;return n(()=>(y+=1,y>=d),f)}return Array.isArray(o.toValue(t))?{toMatch:n,toContains:s,changed:h,changedTimes:m,get not(){return B(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:a,toBeNull:i,toBeNaN:u,toBeUndefined:l,changed:h,changedTimes:m,get not(){return B(t,!e)}}}function oe(t){return B(t)}function ae(t,e){return t===e}function ie(...t){var e,n;const r=t[0],a=t[1];let i=(e=t[2])!=null?e:ae;const{symmetric:l=!1}=(n=t[3])!=null?n:{};if(typeof i=="string"){const s=i;i=(h,m)=>h[s]===m[s]}const u=o.computed(()=>o.toValue(r).filter(s=>o.toValue(a).findIndex(h=>i(s,h))===-1));if(l){const s=o.computed(()=>o.toValue(a).filter(h=>o.toValue(r).findIndex(m=>i(h,m))===-1));return o.computed(()=>l?[...o.toValue(u),...o.toValue(s)]:o.toValue(u))}else return u}function ce(t,e){return o.computed(()=>o.toValue(t).every((n,r,a)=>e(o.toValue(n),r,a)))}function le(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).filter(e))}function ue(t,e){return o.computed(()=>o.toValue(o.toValue(t).find((n,r,a)=>e(o.toValue(n),r,a))))}function se(t,e){return o.computed(()=>o.toValue(t).findIndex((n,r,a)=>e(o.toValue(n),r,a)))}function fe(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function de(t,e){return o.computed(()=>o.toValue(Array.prototype.findLast?o.toValue(t).findLast((n,r,a)=>e(o.toValue(n),r,a)):fe(o.toValue(t),(n,r,a)=>e(o.toValue(n),r,a))))}function me(t){return X(t)&&x(t,"formIndex","comparator")}function he(...t){var e;const n=t[0],r=t[1];let a=t[2],i=0;if(me(a)&&(i=(e=a.fromIndex)!=null?e:0,a=a.comparator),typeof a=="string"){const l=a;a=(u,s)=>u[l]===o.toValue(s)}return a=a??((l,u)=>l===o.toValue(u)),o.computed(()=>o.toValue(n).slice(i).some((l,u,s)=>a(o.toValue(l),o.toValue(r),u,o.toValue(s))))}function ye(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).join(o.toValue(e)))}function ge(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).map(e))}function we(t,e,...n){const r=(a,i,l)=>e(o.toValue(a),o.toValue(i),l);return o.computed(()=>{const a=o.toValue(t);return n.length?a.reduce(r,typeof n[0]=="function"?o.toValue(n[0]()):o.toValue(n[0])):a.reduce(r)})}function Ve(t,e){return o.computed(()=>o.toValue(t).some((n,r,a)=>e(o.toValue(n),r,a)))}function be(t){return Array.from(new Set(t))}function pe(t,e){return t.reduce((n,r)=>(n.some(a=>e(r,a,t))||n.push(r),n),[])}function Ae(t,e){return o.computed(()=>{const n=o.toValue(t).map(r=>o.toValue(r));return e?pe(n,e):be(n)})}function Oe(t=0,e={}){let n=o.unref(t);const r=o.ref(t),{max:a=Number.POSITIVE_INFINITY,min:i=Number.NEGATIVE_INFINITY}=e,l=(d=1)=>r.value=Math.max(Math.min(a,r.value+d),i),u=(d=1)=>r.value=Math.min(Math.max(i,r.value-d),a),s=()=>r.value,h=d=>r.value=Math.max(i,Math.min(a,d));return{count:r,inc:l,dec:u,get:s,set:h,reset:(d=n)=>(n=d,h(d))}}const Se=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,Te=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function De(t,e,n,r){let a=t<12?"AM":"PM";return r&&(a=a.split("").reduce((i,l)=>i+=`${l}.`,"")),n?a.toLowerCase():a}function O(t){const e=["th","st","nd","rd"],n=t%100;return t+(e[(n-20)%10]||e[n]||e[0])}function at(t,e,n={}){var r;const a=t.getFullYear(),i=t.getMonth(),l=t.getDate(),u=t.getHours(),s=t.getMinutes(),h=t.getSeconds(),m=t.getMilliseconds(),d=t.getDay(),f=(r=n.customMeridiem)!=null?r:De,y={Yo:()=>O(a),YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>i+1,Mo:()=>O(i+1),MM:()=>`${i+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"short"}),MMMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"long"}),D:()=>String(l),Do:()=>O(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(u),Ho:()=>O(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),ho:()=>O(u%12||12),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(s),mo:()=>O(s),mm:()=>`${s}`.padStart(2,"0"),s:()=>String(h),so:()=>O(h),ss:()=>`${h}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"short"}),dddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"long"}),A:()=>f(u,s),AA:()=>f(u,s,!1,!0),a:()=>f(u,s,!0),aa:()=>f(u,s,!0,!0)};return e.replace(Te,(g,V)=>{var w,b;return(b=V??((w=y[g])==null?void 0:w.call(y)))!=null?b:g})}function it(t){if(t===null)return new Date(Number.NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(Se);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)}function Fe(t,e="HH:mm:ss",n={}){return o.computed(()=>at(it(o.toValue(t)),o.toValue(e),n))}function ct(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n;let i=null;const l=o.ref(!1);function u(){i&&(clearInterval(i),i=null)}function s(){l.value=!1,u()}function h(){const m=o.toValue(e);m<=0||(l.value=!0,a&&t(),u(),l.value&&(i=setInterval(t,m)))}if(r&&D&&h(),o.isRef(e)||typeof e=="function"){const m=o.watch(e,()=>{l.value&&D&&h()});p(m)}return p(s),{isActive:l,pause:s,resume:h}}function Me(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:a}=e,i=o.ref(0),l=()=>i.value+=1,u=()=>{i.value=0},s=ct(a?()=>{l(),a(i.value)}:l,t,{immediate:r});return n?{counter:i,reset:u,...s}:i}function Pe(t,e={}){var n;const r=o.ref((n=e.initialValue)!=null?n:null);return o.watch(t,()=>r.value=K(),e),r}function lt(t,e,n={}){const{immediate:r=!0}=n,a=o.ref(!1);let i=null;function l(){i&&(clearTimeout(i),i=null)}function u(){a.value=!1,l()}function s(...h){l(),a.value=!0,i=setTimeout(()=>{a.value=!1,i=null,t(...h)},o.toValue(e))}return r&&(a.value=!0,D&&s()),p(u),{isPending:o.readonly(a),start:s,stop:u}}function Ie(t=1e3,e={}){const{controls:n=!1,callback:r}=e,a=lt(r??A,t,e),i=o.computed(()=>!a.isPending.value);return n?{ready:i,...a}:i}function Re(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:a}=e;return o.computed(()=>{let i=o.toValue(t);return typeof n=="function"?i=n(i):typeof i=="string"&&(i=Number[n](i,r)),a&&Number.isNaN(i)&&(i=0),i})}function Ce(t){return o.computed(()=>`${o.toValue(t)}`)}function ke(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,a=o.isRef(t),i=o.ref(t);function l(u){if(arguments.length)return i.value=u,i.value;{const s=o.toValue(n);return i.value=i.value===s?o.toValue(r):s,i.value}}return a?l:[i,l]}function Ee(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:o.toValue(t)];return o.watch(t,(a,i,l)=>{const u=Array.from({length:r.length}),s=[];for(const m of a){let d=!1;for(let f=0;f<r.length;f++)if(!u[f]&&m===r[f]){u[f]=!0,d=!0;break}d||s.push(m)}const h=r.filter((m,d)=>!u[d]);e(a,r,s,h,l),r=[...a]},n)}function _e(t,e,n){const{count:r,...a}=n,i=o.ref(0),l=P(t,(...u)=>{i.value+=1,i.value>=o.toValue(r)&&o.nextTick(()=>l()),e(...u)},a);return{count:i,stop:l}}function ut(t,e,n={}){const{debounce:r=0,maxWait:a=void 0,...i}=n;return P(t,e,{...i,eventFilter:_(r,{maxWait:a})})}function Ne(t,e,n){return o.watch(t,e,{...n,deep:!0})}function Y(t,e,n={}){const{eventFilter:r=I,...a}=n,i=F(r,e);let l,u,s;if(a.flush==="sync"){const h=o.ref(!1);u=()=>{},l=m=>{h.value=!0,m(),h.value=!1},s=o.watch(t,(...m)=>{h.value||i(...m)},a)}else{const h=[],m=o.ref(0),d=o.ref(0);u=()=>{m.value=d.value},h.push(o.watch(t,()=>{d.value++},{...a,flush:"sync"})),l=f=>{const y=d.value;f(),m.value+=d.value-y},h.push(o.watch(t,(...f)=>{const y=m.value>0&&m.value===d.value;m.value=0,d.value=0,!y&&i(...f)},a)),s=()=>{h.forEach(f=>f())}}return{stop:s,ignoreUpdates:l,ignorePrevAsyncUpdates:u}}function je(t,e,n){return o.watch(t,e,{...n,immediate:!0})}function Le(t,e,n){const r=o.watch(t,(...a)=>(o.nextTick(()=>r()),e(...a)),n);return r}function st(t,e,n={}){const{throttle:r=0,trailing:a=!0,leading:i=!0,...l}=n;return P(t,e,{...l,eventFilter:N(r,a,i)})}function We(t,e,n={}){let r;function a(){if(!r)return;const m=r;r=void 0,m()}function i(m){r=m}const l=(m,d)=>(a(),e(m,d,i)),u=Y(t,l,n),{ignoreUpdates:s}=u;return{...u,trigger:()=>{let m;return s(()=>{m=l(Ue(t),Be(t))}),m}}}function Ue(t){return o.isReactive(t)?t:Array.isArray(t)?t.map(e=>o.toValue(e)):o.toValue(t)}function Be(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Ye(t,e,n){const r=o.watch(t,(a,i,l)=>{a&&(n?.once&&o.nextTick(()=>r()),e(a,i,l))},{...n,once:!1});return r}c.assert=Tt,c.autoResetRef=et,c.bypassFilter=I,c.camelize=Nt,c.clamp=Mt,c.computedEager=H,c.computedWithControl=G,c.containsProp=x,c.controlledComputed=G,c.controlledRef=Zt,c.createEventHook=dt,c.createFilterWrapper=F,c.createGlobalState=mt,c.createInjectionState=ht,c.createReactiveFn=k,c.createSharedComposable=yt,c.createSingletonPromise=Lt,c.debounceFilter=_,c.debouncedRef=W,c.debouncedWatch=ut,c.eagerComputed=H,c.extendRef=Z,c.formatDate=at,c.get=gt,c.getLifeCycleTarget=M,c.hasOwn=It,c.hyphenate=Et,c.identity=jt,c.ignorableWatch=Y,c.increaseWithUnit=Ut,c.injectLocal=z,c.invoke=Wt,c.isClient=D,c.isDef=Ot,c.isDefined=wt,c.isIOS=Rt,c.isObject=X,c.isWorker=At,c.makeDestructurable=Vt,c.noop=A,c.normalizeDate=it,c.notNullish=St,c.now=Ft,c.objectEntries=Ht,c.objectOmit=$t,c.objectPick=Yt,c.pausableFilter=Q,c.pausableWatch=R,c.promiseTimeout=j,c.provideLocal=q,c.pxValue=Bt,c.rand=Pt,c.reactify=k,c.reactifyObject=bt,c.reactiveComputed=E,c.reactiveOmit=pt,c.reactivePick=zt,c.refAutoReset=et,c.refDebounced=W,c.refDefault=qt,c.refThrottled=U,c.refWithControl=ot,c.resolveRef=Gt,c.resolveUnref=xt,c.set=Jt,c.syncRef=Xt,c.syncRefs=Kt,c.throttleFilter=N,c.throttledRef=U,c.throttledWatch=st,c.timestamp=K,c.toArray=tt,c.toReactive=J,c.toRef=L,c.toRefs=Qt,c.toValue=vt,c.tryOnBeforeMount=te,c.tryOnBeforeUnmount=ee,c.tryOnMounted=ne,c.tryOnScopeDispose=p,c.tryOnUnmounted=re,c.until=oe,c.useArrayDifference=ie,c.useArrayEvery=ce,c.useArrayFilter=le,c.useArrayFind=ue,c.useArrayFindIndex=se,c.useArrayFindLast=de,c.useArrayIncludes=he,c.useArrayJoin=ye,c.useArrayMap=ge,c.useArrayReduce=we,c.useArraySome=Ve,c.useArrayUnique=Ae,c.useCounter=Oe,c.useDateFormat=Fe,c.useDebounce=W,c.useDebounceFn=nt,c.useInterval=Me,c.useIntervalFn=ct,c.useLastChanged=Pe,c.useThrottle=U,c.useThrottleFn=rt,c.useTimeout=Ie,c.useTimeoutFn=lt,c.useToNumber=Re,c.useToString=Ce,c.useToggle=ke,c.watchArray=Ee,c.watchAtMost=_e,c.watchDebounced=ut,c.watchDeep=Ne,c.watchIgnorable=Y,c.watchImmediate=je,c.watchOnce=Le,c.watchPausable=R,c.watchThrottled=st,c.watchTriggerable=We,c.watchWithFilter=P,c.whenever=Ye})(this.VueUse=this.VueUse||{},Vue);
|
|
1
|
+
(function(i,o){"use strict";function H(e,t){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=e()},{...t,flush:(n=t?.flush)!=null?n:"sync"}),o.readonly(r)}function G(e,t){let n,r,a;const u=o.ref(!0),c=()=>{u.value=!0,a()};o.watch(e,c,{flush:"sync"});const l=typeof t=="function"?t:t.get,s=typeof t=="function"?void 0:t.set,h=o.customRef((m,d)=>(r=m,a=d,{get(){return u.value&&(n=l(n),u.value=!1),r(),n},set(f){s?.(f)}}));return Object.isExtensible(h)&&(h.trigger=c),h}function p(e){return o.getCurrentScope()?(o.onScopeDispose(e),!0):!1}function de(){const e=new Set,t=u=>{e.delete(u)};return{on:u=>{e.add(u);const c=()=>t(u);return p(c),{off:c}},off:t,trigger:(...u)=>Promise.all(Array.from(e).map(c=>c(...u))),clear:()=>{e.clear()}}}function me(e){let t=!1,n;const r=o.effectScope(!0);return(...a)=>(t||(n=r.run(()=>e(...a)),t=!0),n)}const S=new WeakMap,z=(...e)=>{var t;const n=e[0],r=(t=o.getCurrentInstance())==null?void 0:t.proxy;if(r==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&S.has(r)&&n in S.get(r)?S.get(r)[n]:o.inject(...e)},q=(e,t)=>{var n;const r=(n=o.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");S.has(r)||S.set(r,Object.create(null));const a=S.get(r);a[e]=t,o.provide(e,t)};function he(e,t){const n=t?.injectionKey||Symbol(e.name||"InjectionState"),r=t?.defaultValue;return[(...c)=>{const l=e(...c);return q(n,l),l},()=>z(n,r)]}function ye(e){let t=0,n,r;const a=()=>{t-=1,r&&t<=0&&(r.stop(),n=void 0,r=void 0)};return(...u)=>(t+=1,r||(r=o.effectScope(!0),n=r.run(()=>e(...u))),p(a),n)}function Z(e,t,{enumerable:n=!1,unwrap:r=!0}={}){for(const[a,u]of Object.entries(t))a!=="value"&&(o.isRef(u)&&r?Object.defineProperty(e,a,{get(){return u.value},set(c){u.value=c},enumerable:n}):Object.defineProperty(e,a,{value:u,enumerable:n}));return e}function ge(e,t){return t==null?o.unref(e):o.unref(e)[t]}function we(e){return o.unref(e)!=null}function Ve(e,t){if(typeof Symbol<"u"){const n={...e};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:t[r++],done:r>t.length})}}}),n}else return Object.assign([...t],e)}function k(e,t){const n=t?.computedGetter===!1?o.unref:o.toValue;return function(...r){return o.computed(()=>e.apply(this,r.map(a=>n(a))))}}function be(e,t={}){let n=[],r;if(Array.isArray(t))n=t;else{r=t;const{includeOwnProperties:a=!0}=t;n.push(...Object.keys(e)),a&&n.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(n.map(a=>{const u=e[a];return[a,typeof u=="function"?k(u.bind(e),r):u]}))}function J(e){if(!o.isRef(e))return o.reactive(e);const t=new Proxy({},{get(n,r,a){return o.unref(Reflect.get(e.value,r,a))},set(n,r,a){return o.isRef(e.value[r])&&!o.isRef(a)?e.value[r].value=a:e.value[r]=a,!0},deleteProperty(n,r){return Reflect.deleteProperty(e.value,r)},has(n,r){return Reflect.has(e.value,r)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return o.reactive(t)}function E(e){return J(o.computed(e))}function pe(e,...t){const n=t.flat(),r=n[0];return E(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(e)).filter(([a,u])=>!r(o.toValue(u),a)):Object.entries(o.toRefs(e)).filter(a=>!n.includes(a[0]))))}const D=typeof window<"u"&&typeof document<"u",Ae=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Oe=e=>typeof e<"u",Se=e=>e!=null,Te=(e,...t)=>{e||console.warn(...t)},De=Object.prototype.toString,X=e=>De.call(e)==="[object Object]",Fe=()=>Date.now(),K=()=>+Date.now(),Me=(e,t,n)=>Math.min(n,Math.max(t,e)),A=()=>{},Pe=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),Ie=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Re=Ce();function Ce(){var e,t;return D&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function F(e,t){function n(...r){return new Promise((a,u)=>{Promise.resolve(e(()=>t.apply(this,r),{fn:t,thisArg:this,args:r})).then(a).catch(u)})}return n}const I=e=>e();function _(e,t={}){let n,r,a=A;const u=l=>{clearTimeout(l),a(),a=A};return l=>{const s=o.toValue(e),h=o.toValue(t.maxWait);return n&&u(n),s<=0||h!==void 0&&h<=0?(r&&(u(r),r=null),Promise.resolve(l())):new Promise((m,d)=>{a=t.rejectOnCancel?d:m,h&&!r&&(r=setTimeout(()=>{n&&u(n),r=null,m(l())},h)),n=setTimeout(()=>{r&&u(r),r=null,m(l())},s)})}}function N(...e){let t=0,n,r=!0,a=A,u,c,l,s,h;!o.isRef(e[0])&&typeof e[0]=="object"?{delay:c,trailing:l=!0,leading:s=!0,rejectOnCancel:h=!1}=e[0]:[c,l=!0,s=!0,h=!1]=e;const m=()=>{n&&(clearTimeout(n),n=void 0,a(),a=A)};return f=>{const y=o.toValue(c),g=Date.now()-t,V=()=>u=f();return m(),y<=0?(t=Date.now(),V()):(g>y&&(s||!r)?(t=Date.now(),V()):l&&(u=new Promise((w,b)=>{a=h?b:w,n=setTimeout(()=>{t=Date.now(),r=!0,w(V()),m()},Math.max(0,y-g))})),!s&&!n&&(n=setTimeout(()=>r=!0,y)),r=!1,u)}}function Q(e=I){const t=o.ref(!0);function n(){t.value=!1}function r(){t.value=!0}const a=(...u)=>{t.value&&e(...u)};return{isActive:o.readonly(t),pause:n,resume:r,eventFilter:a}}function v(e){const t=Object.create(null);return n=>t[n]||(t[n]=e(n))}const ke=/\B([A-Z])/g,Ee=v(e=>e.replace(ke,"-$1").toLowerCase()),_e=/-(\w)/g,Ne=v(e=>e.replace(_e,(t,n)=>n?n.toUpperCase():""));function j(e,t=!1,n="Timeout"){return new Promise((r,a)=>{setTimeout(t?()=>a(n):r,e)})}function je(e){return e}function Le(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const r=t;t=void 0,r&&await r},n}function We(e){return e()}function x(e,...t){return t.some(n=>n in e)}function Ue(e,t){var n;if(typeof e=="number")return e+t;const r=((n=e.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",a=e.slice(r.length),u=Number.parseFloat(r)+t;return Number.isNaN(u)?e:u+a}function Be(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function Ye(e,t,n=!1){return t.reduce((r,a)=>(a in e&&(!n||e[a]!==void 0)&&(r[a]=e[a]),r),{})}function $e(e,t,n=!1){return Object.fromEntries(Object.entries(e).filter(([r,a])=>(!n||a!==void 0)&&!t.includes(r)))}function He(e){return Object.entries(e)}function M(e){return e||o.getCurrentInstance()}function ee(e){return Array.isArray(e)?e:[e]}function L(...e){if(e.length!==1)return o.toRef(...e);const t=e[0];return typeof t=="function"?o.readonly(o.customRef(()=>({get:t,set:A}))):o.ref(t)}const Ge=L;function ze(e,...t){const n=t.flat(),r=n[0];return E(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(e)).filter(([a,u])=>r(o.toValue(u),a)):n.map(a=>[a,L(e,a)])))}function te(e,t=1e4){return o.customRef((n,r)=>{let a=o.toValue(e),u;const c=()=>setTimeout(()=>{a=o.toValue(e),r()},o.toValue(t));return p(()=>{clearTimeout(u)}),{get(){return n(),a},set(l){a=l,r(),clearTimeout(u),u=c()}}})}function ne(e,t=200,n={}){return F(_(t,n),e)}function W(e,t=200,n={}){const r=o.ref(e.value),a=ne(()=>{r.value=e.value},t,n);return o.watch(e,()=>a()),r}function qe(e,t){return o.computed({get(){var n;return(n=e.value)!=null?n:t},set(n){e.value=n}})}function re(e,t=200,n=!1,r=!0,a=!1){return F(N(t,n,r,a),e)}function U(e,t=200,n=!0,r=!0){if(t<=0)return e;const a=o.ref(e.value),u=re(()=>{a.value=e.value},t,n,r);return o.watch(e,()=>u()),a}function oe(e,t={}){let n=e,r,a;const u=o.customRef((f,y)=>(r=f,a=y,{get(){return c()},set(g){l(g)}}));function c(f=!0){return f&&r(),n}function l(f,y=!0){var g,V;if(f===n)return;const w=n;((g=t.onBeforeChange)==null?void 0:g.call(t,f,w))!==!1&&(n=f,(V=t.onChanged)==null||V.call(t,f,w),y&&a())}return Z(u,{get:c,set:l,untrackedGet:()=>c(!1),silentSet:f=>l(f,!1),peek:()=>c(!1),lay:f=>l(f,!1)},{enumerable:!0})}const Ze=oe;function Je(...e){if(e.length===2){const[t,n]=e;t.value=n}if(e.length===3){const[t,n,r]=e;t[n]=r}}function P(e,t,n={}){const{eventFilter:r=I,...a}=n;return o.watch(e,F(r,t),a)}function R(e,t,n={}){const{eventFilter:r,...a}=n,{eventFilter:u,pause:c,resume:l,isActive:s}=Q(r);return{stop:P(e,t,{...a,eventFilter:u}),pause:c,resume:l,isActive:s}}function Xe(e,t,...[n]){const{flush:r="sync",deep:a=!1,immediate:u=!0,direction:c="both",transform:l={}}=n||{},s=[],h="ltr"in l&&l.ltr||(f=>f),m="rtl"in l&&l.rtl||(f=>f);return(c==="both"||c==="ltr")&&s.push(R(e,f=>{s.forEach(y=>y.pause()),t.value=h(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:u})),(c==="both"||c==="rtl")&&s.push(R(t,f=>{s.forEach(y=>y.pause()),e.value=m(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:u})),()=>{s.forEach(f=>f.stop())}}function Ke(e,t,n={}){const{flush:r="sync",deep:a=!1,immediate:u=!0}=n;return t=ee(t),o.watch(e,c=>t.forEach(l=>l.value=c),{flush:r,deep:a,immediate:u})}function Qe(e,t={}){if(!o.isRef(e))return o.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const r in e.value)n[r]=o.customRef(()=>({get(){return e.value[r]},set(a){var u;if((u=o.toValue(t.replaceRef))!=null?u:!0)if(Array.isArray(e.value)){const l=[...e.value];l[r]=a,e.value=l}else{const l={...e.value,[r]:a};Object.setPrototypeOf(l,Object.getPrototypeOf(e.value)),e.value=l}else e.value[r]=a}}));return n}const ve=o.toValue,xe=o.toValue;function et(e,t=!0,n){M(n)?o.onBeforeMount(e,n):t?e():o.nextTick(e)}function tt(e,t){M(t)&&o.onBeforeUnmount(e,t)}function nt(e,t=!0,n){M()?o.onMounted(e,n):t?e():o.nextTick(e)}function rt(e,t){M(t)&&o.onUnmounted(e,t)}function B(e,t=!1){function n(d,{flush:f="sync",deep:y=!1,timeout:g,throwOnTimeout:V}={}){let w=null;const $=[new Promise(C=>{w=o.watch(e,T=>{d(T)!==t&&(w?w():o.nextTick(()=>w?.()),C(T))},{flush:f,deep:y,immediate:!0})})];return g!=null&&$.push(j(g,V).then(()=>o.toValue(e)).finally(()=>w?.())),Promise.race($)}function r(d,f){if(!o.isRef(d))return n(T=>T===d,f);const{flush:y="sync",deep:g=!1,timeout:V,throwOnTimeout:w}=f??{};let b=null;const C=[new Promise(T=>{b=o.watch([e,d],([fe,$t])=>{t!==(fe===$t)&&(b?b():o.nextTick(()=>b?.()),T(fe))},{flush:y,deep:g,immediate:!0})})];return V!=null&&C.push(j(V,w).then(()=>o.toValue(e)).finally(()=>(b?.(),o.toValue(e)))),Promise.race(C)}function a(d){return n(f=>!!f,d)}function u(d){return r(null,d)}function c(d){return r(void 0,d)}function l(d){return n(Number.isNaN,d)}function s(d,f){return n(y=>{const g=Array.from(y);return g.includes(d)||g.includes(o.toValue(d))},f)}function h(d){return m(1,d)}function m(d=1,f){let y=-1;return n(()=>(y+=1,y>=d),f)}return Array.isArray(o.toValue(e))?{toMatch:n,toContains:s,changed:h,changedTimes:m,get not(){return B(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:a,toBeNull:u,toBeNaN:l,toBeUndefined:c,changed:h,changedTimes:m,get not(){return B(e,!t)}}}function ot(e){return B(e)}function at(e,t){return e===t}function ut(...e){var t,n;const r=e[0],a=e[1];let u=(t=e[2])!=null?t:at;const{symmetric:c=!1}=(n=e[3])!=null?n:{};if(typeof u=="string"){const s=u;u=(h,m)=>h[s]===m[s]}const l=o.computed(()=>o.toValue(r).filter(s=>o.toValue(a).findIndex(h=>u(s,h))===-1));if(c){const s=o.computed(()=>o.toValue(a).filter(h=>o.toValue(r).findIndex(m=>u(h,m))===-1));return o.computed(()=>c?[...o.toValue(l),...o.toValue(s)]:o.toValue(l))}else return l}function it(e,t){return o.computed(()=>o.toValue(e).every((n,r,a)=>t(o.toValue(n),r,a)))}function ct(e,t){return o.computed(()=>o.toValue(e).map(n=>o.toValue(n)).filter(t))}function lt(e,t){return o.computed(()=>o.toValue(o.toValue(e).find((n,r,a)=>t(o.toValue(n),r,a))))}function st(e,t){return o.computed(()=>o.toValue(e).findIndex((n,r,a)=>t(o.toValue(n),r,a)))}function ft(e,t){let n=e.length;for(;n-- >0;)if(t(e[n],n,e))return e[n]}function dt(e,t){return o.computed(()=>o.toValue(Array.prototype.findLast?o.toValue(e).findLast((n,r,a)=>t(o.toValue(n),r,a)):ft(o.toValue(e),(n,r,a)=>t(o.toValue(n),r,a))))}function mt(e){return X(e)&&x(e,"formIndex","comparator")}function ht(...e){var t;const n=e[0],r=e[1];let a=e[2],u=0;if(mt(a)&&(u=(t=a.fromIndex)!=null?t:0,a=a.comparator),typeof a=="string"){const c=a;a=(l,s)=>l[c]===o.toValue(s)}return a=a??((c,l)=>c===o.toValue(l)),o.computed(()=>o.toValue(n).slice(u).some((c,l,s)=>a(o.toValue(c),o.toValue(r),l,o.toValue(s))))}function yt(e,t){return o.computed(()=>o.toValue(e).map(n=>o.toValue(n)).join(o.toValue(t)))}function gt(e,t){return o.computed(()=>o.toValue(e).map(n=>o.toValue(n)).map(t))}function wt(e,t,...n){const r=(a,u,c)=>t(o.toValue(a),o.toValue(u),c);return o.computed(()=>{const a=o.toValue(e);return n.length?a.reduce(r,typeof n[0]=="function"?o.toValue(n[0]()):o.toValue(n[0])):a.reduce(r)})}function Vt(e,t){return o.computed(()=>o.toValue(e).some((n,r,a)=>t(o.toValue(n),r,a)))}function bt(e){return Array.from(new Set(e))}function pt(e,t){return e.reduce((n,r)=>(n.some(a=>t(r,a,e))||n.push(r),n),[])}function At(e,t){return o.computed(()=>{const n=o.toValue(e).map(r=>o.toValue(r));return t?pt(n,t):bt(n)})}function Ot(e=0,t={}){let n=o.unref(e);const r=o.ref(e),{max:a=Number.POSITIVE_INFINITY,min:u=Number.NEGATIVE_INFINITY}=t,c=(d=1)=>r.value=Math.max(Math.min(a,r.value+d),u),l=(d=1)=>r.value=Math.min(Math.max(u,r.value-d),a),s=()=>r.value,h=d=>r.value=Math.max(u,Math.min(a,d));return{count:r,inc:c,dec:l,get:s,set:h,reset:(d=n)=>(n=d,h(d))}}const St=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,Tt=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g;function Dt(e,t,n,r){let a=e<12?"AM":"PM";return r&&(a=a.split("").reduce((u,c)=>u+=`${c}.`,"")),n?a.toLowerCase():a}function O(e){const t=["th","st","nd","rd"],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function ae(e,t,n={}){var r;const a=e.getFullYear(),u=e.getMonth(),c=e.getDate(),l=e.getHours(),s=e.getMinutes(),h=e.getSeconds(),m=e.getMilliseconds(),d=e.getDay(),f=(r=n.customMeridiem)!=null?r:Dt,y={Yo:()=>O(a),YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>u+1,Mo:()=>O(u+1),MM:()=>`${u+1}`.padStart(2,"0"),MMM:()=>e.toLocaleDateString(o.toValue(n.locales),{month:"short"}),MMMM:()=>e.toLocaleDateString(o.toValue(n.locales),{month:"long"}),D:()=>String(c),Do:()=>O(c),DD:()=>`${c}`.padStart(2,"0"),H:()=>String(l),Ho:()=>O(l),HH:()=>`${l}`.padStart(2,"0"),h:()=>`${l%12||12}`.padStart(1,"0"),ho:()=>O(l%12||12),hh:()=>`${l%12||12}`.padStart(2,"0"),m:()=>String(s),mo:()=>O(s),mm:()=>`${s}`.padStart(2,"0"),s:()=>String(h),so:()=>O(h),ss:()=>`${h}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>e.toLocaleDateString(o.toValue(n.locales),{weekday:"narrow"}),ddd:()=>e.toLocaleDateString(o.toValue(n.locales),{weekday:"short"}),dddd:()=>e.toLocaleDateString(o.toValue(n.locales),{weekday:"long"}),A:()=>f(l,s),AA:()=>f(l,s,!1,!0),a:()=>f(l,s,!0),aa:()=>f(l,s,!0,!0)};return t.replace(Tt,(g,V)=>{var w,b;return(b=V??((w=y[g])==null?void 0:w.call(y)))!=null?b:g})}function ue(e){if(e===null)return new Date(Number.NaN);if(e===void 0)return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){const t=e.match(St);if(t){const n=t[2]-1||0,r=(t[7]||"0").substring(0,3);return new Date(t[1],n,t[3]||1,t[4]||0,t[5]||0,t[6]||0,r)}}return new Date(e)}function Ft(e,t="HH:mm:ss",n={}){return o.computed(()=>ae(ue(o.toValue(e)),o.toValue(t),n))}function ie(e,t=1e3,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n;let u=null;const c=o.ref(!1);function l(){u&&(clearInterval(u),u=null)}function s(){c.value=!1,l()}function h(){const m=o.toValue(t);m<=0||(c.value=!0,a&&e(),l(),c.value&&(u=setInterval(e,m)))}if(r&&D&&h(),o.isRef(t)||typeof t=="function"){const m=o.watch(t,()=>{c.value&&D&&h()});p(m)}return p(s),{isActive:c,pause:s,resume:h}}function Mt(e=1e3,t={}){const{controls:n=!1,immediate:r=!0,callback:a}=t,u=o.ref(0),c=()=>u.value+=1,l=()=>{u.value=0},s=ie(a?()=>{c(),a(u.value)}:c,e,{immediate:r});return n?{counter:u,reset:l,...s}:u}function Pt(e,t={}){var n;const r=o.ref((n=t.initialValue)!=null?n:null);return o.watch(e,()=>r.value=K(),t),r}function ce(e,t,n={}){const{immediate:r=!0}=n,a=o.ref(!1);let u=null;function c(){u&&(clearTimeout(u),u=null)}function l(){a.value=!1,c()}function s(...h){c(),a.value=!0,u=setTimeout(()=>{a.value=!1,u=null,e(...h)},o.toValue(t))}return r&&(a.value=!0,D&&s()),p(l),{isPending:o.readonly(a),start:s,stop:l}}function It(e=1e3,t={}){const{controls:n=!1,callback:r}=t,a=ce(r??A,e,t),u=o.computed(()=>!a.isPending.value);return n?{ready:u,...a}:u}function Rt(e,t={}){const{method:n="parseFloat",radix:r,nanToZero:a}=t;return o.computed(()=>{let u=o.toValue(e);return typeof n=="function"?u=n(u):typeof u=="string"&&(u=Number[n](u,r)),a&&Number.isNaN(u)&&(u=0),u})}function Ct(e){return o.computed(()=>`${o.toValue(e)}`)}function kt(e=!1,t={}){const{truthyValue:n=!0,falsyValue:r=!1}=t,a=o.isRef(e),u=o.ref(e);function c(l){if(arguments.length)return u.value=l,u.value;{const s=o.toValue(n);return u.value=u.value===s?o.toValue(r):s,u.value}}return a?c:[u,c]}function Et(e,t,n){let r=n?.immediate?[]:[...e instanceof Function?e():Array.isArray(e)?e:o.toValue(e)];return o.watch(e,(a,u,c)=>{const l=Array.from({length:r.length}),s=[];for(const m of a){let d=!1;for(let f=0;f<r.length;f++)if(!l[f]&&m===r[f]){l[f]=!0,d=!0;break}d||s.push(m)}const h=r.filter((m,d)=>!l[d]);t(a,r,s,h,c),r=[...a]},n)}function _t(e,t,n){const{count:r,...a}=n,u=o.ref(0),c=P(e,(...l)=>{u.value+=1,u.value>=o.toValue(r)&&o.nextTick(()=>c()),t(...l)},a);return{count:u,stop:c}}function le(e,t,n={}){const{debounce:r=0,maxWait:a=void 0,...u}=n;return P(e,t,{...u,eventFilter:_(r,{maxWait:a})})}function Nt(e,t,n){return o.watch(e,t,{...n,deep:!0})}function Y(e,t,n={}){const{eventFilter:r=I,...a}=n,u=F(r,t);let c,l,s;if(a.flush==="sync"){const h=o.ref(!1);l=()=>{},c=m=>{h.value=!0,m(),h.value=!1},s=o.watch(e,(...m)=>{h.value||u(...m)},a)}else{const h=[],m=o.ref(0),d=o.ref(0);l=()=>{m.value=d.value},h.push(o.watch(e,()=>{d.value++},{...a,flush:"sync"})),c=f=>{const y=d.value;f(),m.value+=d.value-y},h.push(o.watch(e,(...f)=>{const y=m.value>0&&m.value===d.value;m.value=0,d.value=0,!y&&u(...f)},a)),s=()=>{h.forEach(f=>f())}}return{stop:s,ignoreUpdates:c,ignorePrevAsyncUpdates:l}}function jt(e,t,n){return o.watch(e,t,{...n,immediate:!0})}function Lt(e,t,n){const r=o.watch(e,(...a)=>(o.nextTick(()=>r()),t(...a)),n);return r}function se(e,t,n={}){const{throttle:r=0,trailing:a=!0,leading:u=!0,...c}=n;return P(e,t,{...c,eventFilter:N(r,a,u)})}function Wt(e,t,n={}){let r;function a(){if(!r)return;const m=r;r=void 0,m()}function u(m){r=m}const c=(m,d)=>(a(),t(m,d,u)),l=Y(e,c,n),{ignoreUpdates:s}=l;return{...l,trigger:()=>{let m;return s(()=>{m=c(Ut(e),Bt(e))}),m}}}function Ut(e){return o.isReactive(e)?e:Array.isArray(e)?e.map(t=>o.toValue(t)):o.toValue(e)}function Bt(e){return Array.isArray(e)?e.map(()=>{}):void 0}function Yt(e,t,n){const r=o.watch(e,(a,u,c)=>{a&&(n?.once&&o.nextTick(()=>r()),t(a,u,c))},{...n,once:!1});return r}i.assert=Te,i.autoResetRef=te,i.bypassFilter=I,i.camelize=Ne,i.clamp=Me,i.computedEager=H,i.computedWithControl=G,i.containsProp=x,i.controlledComputed=G,i.controlledRef=Ze,i.createEventHook=de,i.createFilterWrapper=F,i.createGlobalState=me,i.createInjectionState=he,i.createReactiveFn=k,i.createSharedComposable=ye,i.createSingletonPromise=Le,i.debounceFilter=_,i.debouncedRef=W,i.debouncedWatch=le,i.eagerComputed=H,i.extendRef=Z,i.formatDate=ae,i.get=ge,i.getLifeCycleTarget=M,i.hasOwn=Ie,i.hyphenate=Ee,i.identity=je,i.ignorableWatch=Y,i.increaseWithUnit=Ue,i.injectLocal=z,i.invoke=We,i.isClient=D,i.isDef=Oe,i.isDefined=we,i.isIOS=Re,i.isObject=X,i.isWorker=Ae,i.makeDestructurable=Ve,i.noop=A,i.normalizeDate=ue,i.notNullish=Se,i.now=Fe,i.objectEntries=He,i.objectOmit=$e,i.objectPick=Ye,i.pausableFilter=Q,i.pausableWatch=R,i.promiseTimeout=j,i.provideLocal=q,i.pxValue=Be,i.rand=Pe,i.reactify=k,i.reactifyObject=be,i.reactiveComputed=E,i.reactiveOmit=pe,i.reactivePick=ze,i.refAutoReset=te,i.refDebounced=W,i.refDefault=qe,i.refThrottled=U,i.refWithControl=oe,i.resolveRef=Ge,i.resolveUnref=xe,i.set=Je,i.syncRef=Xe,i.syncRefs=Ke,i.throttleFilter=N,i.throttledRef=U,i.throttledWatch=se,i.timestamp=K,i.toArray=ee,i.toReactive=J,i.toRef=L,i.toRefs=Qe,i.toValue=ve,i.tryOnBeforeMount=et,i.tryOnBeforeUnmount=tt,i.tryOnMounted=nt,i.tryOnScopeDispose=p,i.tryOnUnmounted=rt,i.until=ot,i.useArrayDifference=ut,i.useArrayEvery=it,i.useArrayFilter=ct,i.useArrayFind=lt,i.useArrayFindIndex=st,i.useArrayFindLast=dt,i.useArrayIncludes=ht,i.useArrayJoin=yt,i.useArrayMap=gt,i.useArrayReduce=wt,i.useArraySome=Vt,i.useArrayUnique=At,i.useCounter=Ot,i.useDateFormat=Ft,i.useDebounce=W,i.useDebounceFn=ne,i.useInterval=Mt,i.useIntervalFn=ie,i.useLastChanged=Pt,i.useThrottle=U,i.useThrottleFn=re,i.useTimeout=It,i.useTimeoutFn=ce,i.useToNumber=Rt,i.useToString=Ct,i.useToggle=kt,i.watchArray=Et,i.watchAtMost=_t,i.watchDebounced=le,i.watchDeep=Nt,i.watchIgnorable=Y,i.watchImmediate=jt,i.watchOnce=Lt,i.watchPausable=R,i.watchThrottled=se,i.watchTriggerable=Wt,i.watchWithFilter=P,i.whenever=Yt})(this.VueUse=this.VueUse||{},Vue);
|
package/index.mjs
CHANGED
|
@@ -7,13 +7,13 @@ function computedEager(fn, options) {
|
|
|
7
7
|
result.value = fn();
|
|
8
8
|
}, {
|
|
9
9
|
...options,
|
|
10
|
-
flush: (_a = options == null ?
|
|
10
|
+
flush: (_a = options == null ? undefined : options.flush) != null ? _a : "sync"
|
|
11
11
|
});
|
|
12
12
|
return readonly(result);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function computedWithControl(source, fn) {
|
|
16
|
-
let v =
|
|
16
|
+
let v = undefined;
|
|
17
17
|
let track;
|
|
18
18
|
let trigger;
|
|
19
19
|
const dirty = ref(true);
|
|
@@ -23,7 +23,7 @@ function computedWithControl(source, fn) {
|
|
|
23
23
|
};
|
|
24
24
|
watch(source, update, { flush: "sync" });
|
|
25
25
|
const get = typeof fn === "function" ? fn : fn.get;
|
|
26
|
-
const set = typeof fn === "function" ?
|
|
26
|
+
const set = typeof fn === "function" ? undefined : fn.set;
|
|
27
27
|
const result = customRef((_track, _trigger) => {
|
|
28
28
|
track = _track;
|
|
29
29
|
trigger = _trigger;
|
|
@@ -37,7 +37,7 @@ function computedWithControl(source, fn) {
|
|
|
37
37
|
return v;
|
|
38
38
|
},
|
|
39
39
|
set(v2) {
|
|
40
|
-
set == null ?
|
|
40
|
+
set == null ? undefined : set(v2);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
});
|
|
@@ -99,7 +99,7 @@ const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
|
99
99
|
const injectLocal = (...args) => {
|
|
100
100
|
var _a;
|
|
101
101
|
const key = args[0];
|
|
102
|
-
const instance = (_a = getCurrentInstance()) == null ?
|
|
102
|
+
const instance = (_a = getCurrentInstance()) == null ? undefined : _a.proxy;
|
|
103
103
|
if (instance == null && !hasInjectionContext())
|
|
104
104
|
throw new Error("injectLocal must be called in setup");
|
|
105
105
|
if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
|
|
@@ -109,7 +109,7 @@ const injectLocal = (...args) => {
|
|
|
109
109
|
|
|
110
110
|
const provideLocal = (key, value) => {
|
|
111
111
|
var _a;
|
|
112
|
-
const instance = (_a = getCurrentInstance()) == null ?
|
|
112
|
+
const instance = (_a = getCurrentInstance()) == null ? undefined : _a.proxy;
|
|
113
113
|
if (instance == null)
|
|
114
114
|
throw new Error("provideLocal must be called in setup");
|
|
115
115
|
if (!localProvidedStateMap.has(instance))
|
|
@@ -120,8 +120,8 @@ const provideLocal = (key, value) => {
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
function createInjectionState(composable, options) {
|
|
123
|
-
const key = (options == null ?
|
|
124
|
-
const defaultValue = options == null ?
|
|
123
|
+
const key = (options == null ? undefined : options.injectionKey) || Symbol(composable.name || "InjectionState");
|
|
124
|
+
const defaultValue = options == null ? undefined : options.defaultValue;
|
|
125
125
|
const useProvidingState = (...args) => {
|
|
126
126
|
const state = composable(...args);
|
|
127
127
|
provideLocal(key, state);
|
|
@@ -139,8 +139,8 @@ function createSharedComposable(composable) {
|
|
|
139
139
|
subscribers -= 1;
|
|
140
140
|
if (scope && subscribers <= 0) {
|
|
141
141
|
scope.stop();
|
|
142
|
-
state =
|
|
143
|
-
scope =
|
|
142
|
+
state = undefined;
|
|
143
|
+
scope = undefined;
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
return (...args) => {
|
|
@@ -207,7 +207,7 @@ function makeDestructurable(obj, arr) {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
function reactify(fn, options) {
|
|
210
|
-
const unrefFn = (options == null ?
|
|
210
|
+
const unrefFn = (options == null ? undefined : options.computedGetter) === false ? unref : toValue$1;
|
|
211
211
|
return function(...args) {
|
|
212
212
|
return computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
213
213
|
};
|
|
@@ -303,7 +303,7 @@ const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
|
|
|
303
303
|
const isIOS = /* @__PURE__ */ getIsIOS();
|
|
304
304
|
function getIsIOS() {
|
|
305
305
|
var _a, _b;
|
|
306
|
-
return isClient && ((_a = window == null ?
|
|
306
|
+
return isClient && ((_a = window == null ? undefined : window.navigator) == null ? undefined : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? undefined : window.navigator) == null ? undefined : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? undefined : window.navigator.userAgent));
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
function createFilterWrapper(filter, fn) {
|
|
@@ -331,7 +331,7 @@ function debounceFilter(ms, options = {}) {
|
|
|
331
331
|
const maxDuration = toValue$1(options.maxWait);
|
|
332
332
|
if (timer)
|
|
333
333
|
_clearTimeout(timer);
|
|
334
|
-
if (duration <= 0 || maxDuration !==
|
|
334
|
+
if (duration <= 0 || maxDuration !== undefined && maxDuration <= 0) {
|
|
335
335
|
if (maxTimer) {
|
|
336
336
|
_clearTimeout(maxTimer);
|
|
337
337
|
maxTimer = null;
|
|
@@ -375,7 +375,7 @@ function throttleFilter(...args) {
|
|
|
375
375
|
const clear = () => {
|
|
376
376
|
if (timer) {
|
|
377
377
|
clearTimeout(timer);
|
|
378
|
-
timer =
|
|
378
|
+
timer = undefined;
|
|
379
379
|
lastRejector();
|
|
380
380
|
lastRejector = noop;
|
|
381
381
|
}
|
|
@@ -461,7 +461,7 @@ function createSingletonPromise(fn) {
|
|
|
461
461
|
}
|
|
462
462
|
wrapper.reset = async () => {
|
|
463
463
|
const _prev = _promise;
|
|
464
|
-
_promise =
|
|
464
|
+
_promise = undefined;
|
|
465
465
|
if (_prev)
|
|
466
466
|
await _prev;
|
|
467
467
|
};
|
|
@@ -477,7 +477,7 @@ function increaseWithUnit(target, delta) {
|
|
|
477
477
|
var _a;
|
|
478
478
|
if (typeof target === "number")
|
|
479
479
|
return target + delta;
|
|
480
|
-
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ?
|
|
480
|
+
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ? undefined : _a[0]) || "";
|
|
481
481
|
const unit = target.slice(value.length);
|
|
482
482
|
const result = Number.parseFloat(value) + delta;
|
|
483
483
|
if (Number.isNaN(result))
|
|
@@ -490,7 +490,7 @@ function pxValue(px) {
|
|
|
490
490
|
function objectPick(obj, keys, omitUndefined = false) {
|
|
491
491
|
return keys.reduce((n, k) => {
|
|
492
492
|
if (k in obj) {
|
|
493
|
-
if (!omitUndefined || obj[k] !==
|
|
493
|
+
if (!omitUndefined || obj[k] !== undefined)
|
|
494
494
|
n[k] = obj[k];
|
|
495
495
|
}
|
|
496
496
|
return n;
|
|
@@ -498,7 +498,7 @@ function objectPick(obj, keys, omitUndefined = false) {
|
|
|
498
498
|
}
|
|
499
499
|
function objectOmit(obj, keys, omitUndefined = false) {
|
|
500
500
|
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {
|
|
501
|
-
return (!omitUndefined || value !==
|
|
501
|
+
return (!omitUndefined || value !== undefined) && !keys.includes(key);
|
|
502
502
|
}));
|
|
503
503
|
}
|
|
504
504
|
function objectEntries(obj) {
|
|
@@ -623,10 +623,10 @@ function refWithControl(initial, options = {}) {
|
|
|
623
623
|
if (value === source)
|
|
624
624
|
return;
|
|
625
625
|
const old = source;
|
|
626
|
-
if (((_a = options.onBeforeChange) == null ?
|
|
626
|
+
if (((_a = options.onBeforeChange) == null ? undefined : _a.call(options, value, old)) === false)
|
|
627
627
|
return;
|
|
628
628
|
source = value;
|
|
629
|
-
(_b = options.onChanged) == null ?
|
|
629
|
+
(_b = options.onChanged) == null ? undefined : _b.call(options, value, old);
|
|
630
630
|
if (triggering)
|
|
631
631
|
trigger();
|
|
632
632
|
}
|
|
@@ -822,7 +822,7 @@ function createUntil(r, isNot = false) {
|
|
|
822
822
|
if (stop)
|
|
823
823
|
stop();
|
|
824
824
|
else
|
|
825
|
-
nextTick(() => stop == null ?
|
|
825
|
+
nextTick(() => stop == null ? undefined : stop());
|
|
826
826
|
resolve(v);
|
|
827
827
|
}
|
|
828
828
|
},
|
|
@@ -836,7 +836,7 @@ function createUntil(r, isNot = false) {
|
|
|
836
836
|
const promises = [watcher];
|
|
837
837
|
if (timeout != null) {
|
|
838
838
|
promises.push(
|
|
839
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => stop == null ?
|
|
839
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => stop == null ? undefined : stop())
|
|
840
840
|
);
|
|
841
841
|
}
|
|
842
842
|
return Promise.race(promises);
|
|
@@ -854,7 +854,7 @@ function createUntil(r, isNot = false) {
|
|
|
854
854
|
if (stop)
|
|
855
855
|
stop();
|
|
856
856
|
else
|
|
857
|
-
nextTick(() => stop == null ?
|
|
857
|
+
nextTick(() => stop == null ? undefined : stop());
|
|
858
858
|
resolve(v1);
|
|
859
859
|
}
|
|
860
860
|
},
|
|
@@ -869,7 +869,7 @@ function createUntil(r, isNot = false) {
|
|
|
869
869
|
if (timeout != null) {
|
|
870
870
|
promises.push(
|
|
871
871
|
promiseTimeout(timeout, throwOnTimeout).then(() => toValue$1(r)).finally(() => {
|
|
872
|
-
stop == null ?
|
|
872
|
+
stop == null ? undefined : stop();
|
|
873
873
|
return toValue$1(r);
|
|
874
874
|
})
|
|
875
875
|
);
|
|
@@ -883,7 +883,7 @@ function createUntil(r, isNot = false) {
|
|
|
883
883
|
return toBe(null, options);
|
|
884
884
|
}
|
|
885
885
|
function toBeUndefined(options) {
|
|
886
|
-
return toBe(
|
|
886
|
+
return toBe(undefined, options);
|
|
887
887
|
}
|
|
888
888
|
function toBeNaN(options) {
|
|
889
889
|
return toMatch(Number.isNaN, options);
|
|
@@ -984,7 +984,7 @@ function findLast(arr, cb) {
|
|
|
984
984
|
if (cb(arr[index], index, arr))
|
|
985
985
|
return arr[index];
|
|
986
986
|
}
|
|
987
|
-
return
|
|
987
|
+
return undefined;
|
|
988
988
|
}
|
|
989
989
|
function useArrayFindLast(list, fn) {
|
|
990
990
|
return computed(() => toValue$1(
|
|
@@ -1133,13 +1133,13 @@ function formatDate(date, formatStr, options = {}) {
|
|
|
1133
1133
|
};
|
|
1134
1134
|
return formatStr.replace(REGEX_FORMAT, (match, $1) => {
|
|
1135
1135
|
var _a2, _b;
|
|
1136
|
-
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ?
|
|
1136
|
+
return (_b = $1 != null ? $1 : (_a2 = matches[match]) == null ? undefined : _a2.call(matches)) != null ? _b : match;
|
|
1137
1137
|
});
|
|
1138
1138
|
}
|
|
1139
1139
|
function normalizeDate(date) {
|
|
1140
1140
|
if (date === null)
|
|
1141
1141
|
return new Date(Number.NaN);
|
|
1142
|
-
if (date ===
|
|
1142
|
+
if (date === undefined)
|
|
1143
1143
|
return /* @__PURE__ */ new Date();
|
|
1144
1144
|
if (date instanceof Date)
|
|
1145
1145
|
return new Date(date);
|
|
@@ -1348,7 +1348,7 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1348
1348
|
}
|
|
1349
1349
|
|
|
1350
1350
|
function watchArray(source, cb, options) {
|
|
1351
|
-
let oldList = (options == null ?
|
|
1351
|
+
let oldList = (options == null ? undefined : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : toValue$1(source)];
|
|
1352
1352
|
return watch(source, (newList, _, onCleanup) => {
|
|
1353
1353
|
const oldListRemains = Array.from({ length: oldList.length });
|
|
1354
1354
|
const added = [];
|
|
@@ -1392,7 +1392,7 @@ function watchAtMost(source, cb, options) {
|
|
|
1392
1392
|
function watchDebounced(source, cb, options = {}) {
|
|
1393
1393
|
const {
|
|
1394
1394
|
debounce = 0,
|
|
1395
|
-
maxWait =
|
|
1395
|
+
maxWait = undefined,
|
|
1396
1396
|
...watchOptions
|
|
1397
1397
|
} = options;
|
|
1398
1398
|
return watchWithFilter(
|
|
@@ -1529,7 +1529,7 @@ function watchTriggerable(source, cb, options = {}) {
|
|
|
1529
1529
|
if (!cleanupFn)
|
|
1530
1530
|
return;
|
|
1531
1531
|
const fn = cleanupFn;
|
|
1532
|
-
cleanupFn =
|
|
1532
|
+
cleanupFn = undefined;
|
|
1533
1533
|
fn();
|
|
1534
1534
|
}
|
|
1535
1535
|
function onCleanup(callback) {
|
|
@@ -1561,7 +1561,7 @@ function getWatchSources(sources) {
|
|
|
1561
1561
|
return toValue$1(sources);
|
|
1562
1562
|
}
|
|
1563
1563
|
function getOldValue(source) {
|
|
1564
|
-
return Array.isArray(source) ? source.map(() =>
|
|
1564
|
+
return Array.isArray(source) ? source.map(() => undefined) : undefined;
|
|
1565
1565
|
}
|
|
1566
1566
|
|
|
1567
1567
|
function whenever(source, cb, options) {
|
|
@@ -1569,7 +1569,7 @@ function whenever(source, cb, options) {
|
|
|
1569
1569
|
source,
|
|
1570
1570
|
(v, ov, onInvalidate) => {
|
|
1571
1571
|
if (v) {
|
|
1572
|
-
if (options == null ?
|
|
1572
|
+
if (options == null ? undefined : options.once)
|
|
1573
1573
|
nextTick(() => stop());
|
|
1574
1574
|
cb(v, ov, onInvalidate);
|
|
1575
1575
|
}
|