@vueuse/shared 8.7.4 → 8.8.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 +429 -347
- package/index.d.ts +53 -19
- package/index.iife.js +429 -347
- package/index.iife.min.js +1 -1
- package/index.mjs +428 -349
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,60 +1,248 @@
|
|
|
1
|
-
import { shallowRef, watchEffect, readonly, ref, watch, customRef, effectScope, provide, inject, getCurrentScope, onScopeDispose,
|
|
1
|
+
import { shallowRef, watchEffect, readonly, ref, unref, isVue3, watch, customRef, effectScope, provide, inject, getCurrentScope, onScopeDispose, isRef, computed, reactive, toRefs as toRefs$1, toRef, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue-demi';
|
|
2
2
|
|
|
3
|
-
var __defProp$
|
|
4
|
-
var __defProps$
|
|
5
|
-
var __getOwnPropDescs$
|
|
6
|
-
var __getOwnPropSymbols$
|
|
7
|
-
var __hasOwnProp$
|
|
8
|
-
var __propIsEnum$
|
|
9
|
-
var __defNormalProp$
|
|
10
|
-
var __spreadValues$
|
|
3
|
+
var __defProp$9 = Object.defineProperty;
|
|
4
|
+
var __defProps$6 = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues$9 = (a, b) => {
|
|
11
11
|
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp$
|
|
13
|
-
__defNormalProp$
|
|
14
|
-
if (__getOwnPropSymbols$
|
|
15
|
-
for (var prop of __getOwnPropSymbols$
|
|
16
|
-
if (__propIsEnum$
|
|
17
|
-
__defNormalProp$
|
|
12
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
13
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols$b)
|
|
15
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
16
|
+
if (__propIsEnum$b.call(b, prop))
|
|
17
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
|
-
var __spreadProps$
|
|
21
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
22
22
|
function computedEager(fn, options) {
|
|
23
23
|
var _a;
|
|
24
24
|
const result = shallowRef();
|
|
25
25
|
watchEffect(() => {
|
|
26
26
|
result.value = fn();
|
|
27
|
-
}, __spreadProps$
|
|
27
|
+
}, __spreadProps$6(__spreadValues$9({}, options), {
|
|
28
28
|
flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
|
|
29
29
|
}));
|
|
30
30
|
return readonly(result);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
var _a;
|
|
34
|
+
const isClient = typeof window !== "undefined";
|
|
35
|
+
const isDef = (val) => typeof val !== "undefined";
|
|
36
|
+
const assert = (condition, ...infos) => {
|
|
37
|
+
if (!condition)
|
|
38
|
+
console.warn(...infos);
|
|
39
|
+
};
|
|
40
|
+
const toString = Object.prototype.toString;
|
|
41
|
+
const isBoolean = (val) => typeof val === "boolean";
|
|
42
|
+
const isFunction = (val) => typeof val === "function";
|
|
43
|
+
const isNumber = (val) => typeof val === "number";
|
|
44
|
+
const isString = (val) => typeof val === "string";
|
|
45
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
46
|
+
const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
|
|
47
|
+
const now = () => Date.now();
|
|
48
|
+
const timestamp = () => +Date.now();
|
|
49
|
+
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
50
|
+
const noop = () => {
|
|
51
|
+
};
|
|
52
|
+
const rand = (min, max) => {
|
|
53
|
+
min = Math.ceil(min);
|
|
54
|
+
max = Math.floor(max);
|
|
55
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
56
|
+
};
|
|
57
|
+
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
58
|
+
|
|
59
|
+
function createFilterWrapper(filter, fn) {
|
|
60
|
+
function wrapper(...args) {
|
|
61
|
+
filter(() => fn.apply(this, args), { fn, thisArg: this, args });
|
|
62
|
+
}
|
|
63
|
+
return wrapper;
|
|
64
|
+
}
|
|
65
|
+
const bypassFilter = (invoke) => {
|
|
66
|
+
return invoke();
|
|
67
|
+
};
|
|
68
|
+
function debounceFilter(ms, options = {}) {
|
|
69
|
+
let timer;
|
|
70
|
+
let maxTimer;
|
|
71
|
+
const filter = (invoke) => {
|
|
72
|
+
const duration = unref(ms);
|
|
73
|
+
const maxDuration = unref(options.maxWait);
|
|
74
|
+
if (timer)
|
|
75
|
+
clearTimeout(timer);
|
|
76
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
77
|
+
if (maxTimer) {
|
|
78
|
+
clearTimeout(maxTimer);
|
|
79
|
+
maxTimer = null;
|
|
80
|
+
}
|
|
81
|
+
return invoke();
|
|
82
|
+
}
|
|
83
|
+
if (maxDuration && !maxTimer) {
|
|
84
|
+
maxTimer = setTimeout(() => {
|
|
85
|
+
if (timer)
|
|
86
|
+
clearTimeout(timer);
|
|
87
|
+
maxTimer = null;
|
|
88
|
+
invoke();
|
|
89
|
+
}, maxDuration);
|
|
90
|
+
}
|
|
91
|
+
timer = setTimeout(() => {
|
|
92
|
+
if (maxTimer)
|
|
93
|
+
clearTimeout(maxTimer);
|
|
94
|
+
maxTimer = null;
|
|
95
|
+
invoke();
|
|
96
|
+
}, duration);
|
|
97
|
+
};
|
|
98
|
+
return filter;
|
|
99
|
+
}
|
|
100
|
+
function throttleFilter(ms, trailing = true, leading = true) {
|
|
101
|
+
let lastExec = 0;
|
|
102
|
+
let timer;
|
|
103
|
+
let isLeading = true;
|
|
104
|
+
const clear = () => {
|
|
105
|
+
if (timer) {
|
|
106
|
+
clearTimeout(timer);
|
|
107
|
+
timer = void 0;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const filter = (invoke) => {
|
|
111
|
+
const duration = unref(ms);
|
|
112
|
+
const elapsed = Date.now() - lastExec;
|
|
113
|
+
clear();
|
|
114
|
+
if (duration <= 0) {
|
|
115
|
+
lastExec = Date.now();
|
|
116
|
+
return invoke();
|
|
117
|
+
}
|
|
118
|
+
if (elapsed > duration && (leading || !isLeading)) {
|
|
119
|
+
lastExec = Date.now();
|
|
120
|
+
invoke();
|
|
121
|
+
} else if (trailing) {
|
|
122
|
+
timer = setTimeout(() => {
|
|
123
|
+
lastExec = Date.now();
|
|
124
|
+
isLeading = true;
|
|
125
|
+
clear();
|
|
126
|
+
invoke();
|
|
127
|
+
}, duration);
|
|
128
|
+
}
|
|
129
|
+
if (!leading && !timer)
|
|
130
|
+
timer = setTimeout(() => isLeading = true, duration);
|
|
131
|
+
isLeading = false;
|
|
132
|
+
};
|
|
133
|
+
return filter;
|
|
134
|
+
}
|
|
135
|
+
function pausableFilter(extendFilter = bypassFilter) {
|
|
136
|
+
const isActive = ref(true);
|
|
137
|
+
function pause() {
|
|
138
|
+
isActive.value = false;
|
|
139
|
+
}
|
|
140
|
+
function resume() {
|
|
141
|
+
isActive.value = true;
|
|
142
|
+
}
|
|
143
|
+
const eventFilter = (...args) => {
|
|
144
|
+
if (isActive.value)
|
|
145
|
+
extendFilter(...args);
|
|
146
|
+
};
|
|
147
|
+
return { isActive, pause, resume, eventFilter };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function __onlyVue3(name = "this function") {
|
|
151
|
+
if (isVue3)
|
|
152
|
+
return;
|
|
153
|
+
throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
|
|
154
|
+
}
|
|
155
|
+
const directiveHooks = {
|
|
156
|
+
mounted: isVue3 ? "mounted" : "inserted",
|
|
157
|
+
updated: isVue3 ? "updated" : "componentUpdated",
|
|
158
|
+
unmounted: isVue3 ? "unmounted" : "unbind"
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
162
|
+
return new Promise((resolve, reject) => {
|
|
163
|
+
if (throwOnTimeout)
|
|
164
|
+
setTimeout(() => reject(reason), ms);
|
|
165
|
+
else
|
|
166
|
+
setTimeout(resolve, ms);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function identity(arg) {
|
|
170
|
+
return arg;
|
|
171
|
+
}
|
|
172
|
+
function createSingletonPromise(fn) {
|
|
173
|
+
let _promise;
|
|
174
|
+
function wrapper() {
|
|
175
|
+
if (!_promise)
|
|
176
|
+
_promise = fn();
|
|
177
|
+
return _promise;
|
|
178
|
+
}
|
|
179
|
+
wrapper.reset = async () => {
|
|
180
|
+
const _prev = _promise;
|
|
181
|
+
_promise = void 0;
|
|
182
|
+
if (_prev)
|
|
183
|
+
await _prev;
|
|
184
|
+
};
|
|
185
|
+
return wrapper;
|
|
186
|
+
}
|
|
187
|
+
function invoke(fn) {
|
|
188
|
+
return fn();
|
|
189
|
+
}
|
|
190
|
+
function containsProp(obj, ...props) {
|
|
191
|
+
return props.some((k) => k in obj);
|
|
192
|
+
}
|
|
193
|
+
function increaseWithUnit(target, delta) {
|
|
194
|
+
var _a;
|
|
195
|
+
if (typeof target === "number")
|
|
196
|
+
return target + delta;
|
|
197
|
+
const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
|
|
198
|
+
const unit = target.slice(value.length);
|
|
199
|
+
const result = parseFloat(value) + delta;
|
|
200
|
+
if (Number.isNaN(result))
|
|
201
|
+
return target;
|
|
202
|
+
return result + unit;
|
|
203
|
+
}
|
|
204
|
+
function objectPick(obj, keys, omitUndefined = false) {
|
|
205
|
+
return keys.reduce((n, k) => {
|
|
206
|
+
if (k in obj) {
|
|
207
|
+
if (!omitUndefined || obj[k] !== void 0)
|
|
208
|
+
n[k] = obj[k];
|
|
209
|
+
}
|
|
210
|
+
return n;
|
|
211
|
+
}, {});
|
|
212
|
+
}
|
|
213
|
+
|
|
33
214
|
function computedWithControl(source, fn) {
|
|
34
215
|
let v = void 0;
|
|
35
216
|
let track;
|
|
36
217
|
let trigger;
|
|
37
218
|
const dirty = ref(true);
|
|
38
|
-
|
|
219
|
+
const update = () => {
|
|
39
220
|
dirty.value = true;
|
|
40
221
|
trigger();
|
|
41
|
-
}
|
|
42
|
-
|
|
222
|
+
};
|
|
223
|
+
watch(source, update, { flush: "sync" });
|
|
224
|
+
const get = isFunction(fn) ? fn : fn.get;
|
|
225
|
+
const set = isFunction(fn) ? void 0 : fn.set;
|
|
226
|
+
const result = customRef((_track, _trigger) => {
|
|
43
227
|
track = _track;
|
|
44
228
|
trigger = _trigger;
|
|
45
229
|
return {
|
|
46
230
|
get() {
|
|
47
231
|
if (dirty.value) {
|
|
48
|
-
v =
|
|
232
|
+
v = get();
|
|
49
233
|
dirty.value = false;
|
|
50
234
|
}
|
|
51
235
|
track();
|
|
52
236
|
return v;
|
|
53
237
|
},
|
|
54
|
-
set() {
|
|
238
|
+
set(v2) {
|
|
239
|
+
set == null ? void 0 : set(v2);
|
|
55
240
|
}
|
|
56
241
|
};
|
|
57
242
|
});
|
|
243
|
+
if (Object.isExtensible(result))
|
|
244
|
+
result.trigger = update;
|
|
245
|
+
return result;
|
|
58
246
|
}
|
|
59
247
|
|
|
60
248
|
function createEventHook() {
|
|
@@ -133,17 +321,6 @@ function createSharedComposable(composable) {
|
|
|
133
321
|
};
|
|
134
322
|
}
|
|
135
323
|
|
|
136
|
-
function __onlyVue3(name = "this function") {
|
|
137
|
-
if (isVue3)
|
|
138
|
-
return;
|
|
139
|
-
throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
|
|
140
|
-
}
|
|
141
|
-
const directiveHooks = {
|
|
142
|
-
mounted: isVue3 ? "mounted" : "inserted",
|
|
143
|
-
updated: isVue3 ? "updated" : "componentUpdated",
|
|
144
|
-
unmounted: isVue3 ? "unmounted" : "unbind"
|
|
145
|
-
};
|
|
146
|
-
|
|
147
324
|
function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
|
|
148
325
|
__onlyVue3();
|
|
149
326
|
for (const [key, value] of Object.entries(extend)) {
|
|
@@ -188,25 +365,25 @@ function logicOr(...args) {
|
|
|
188
365
|
return computed(() => args.some((i) => unref(i)));
|
|
189
366
|
}
|
|
190
367
|
|
|
191
|
-
var __defProp$
|
|
192
|
-
var __getOwnPropSymbols$
|
|
193
|
-
var __hasOwnProp$
|
|
194
|
-
var __propIsEnum$
|
|
195
|
-
var __defNormalProp$
|
|
196
|
-
var __spreadValues$
|
|
368
|
+
var __defProp$8 = Object.defineProperty;
|
|
369
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
370
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
371
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
372
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
373
|
+
var __spreadValues$8 = (a, b) => {
|
|
197
374
|
for (var prop in b || (b = {}))
|
|
198
|
-
if (__hasOwnProp$
|
|
199
|
-
__defNormalProp$
|
|
200
|
-
if (__getOwnPropSymbols$
|
|
201
|
-
for (var prop of __getOwnPropSymbols$
|
|
202
|
-
if (__propIsEnum$
|
|
203
|
-
__defNormalProp$
|
|
375
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
376
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
377
|
+
if (__getOwnPropSymbols$a)
|
|
378
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
379
|
+
if (__propIsEnum$a.call(b, prop))
|
|
380
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
204
381
|
}
|
|
205
382
|
return a;
|
|
206
383
|
};
|
|
207
384
|
function makeDestructurable(obj, arr) {
|
|
208
385
|
if (typeof Symbol !== "undefined") {
|
|
209
|
-
const clone = __spreadValues$
|
|
386
|
+
const clone = __spreadValues$8({}, obj);
|
|
210
387
|
Object.defineProperty(clone, Symbol.iterator, {
|
|
211
388
|
enumerable: false,
|
|
212
389
|
value() {
|
|
@@ -288,11 +465,13 @@ function reactiveComputed(fn) {
|
|
|
288
465
|
}
|
|
289
466
|
|
|
290
467
|
function reactiveOmit(obj, ...keys) {
|
|
291
|
-
|
|
468
|
+
const flatKeys = keys.flat();
|
|
469
|
+
return reactiveComputed(() => Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
292
470
|
}
|
|
293
471
|
|
|
294
472
|
function reactivePick(obj, ...keys) {
|
|
295
|
-
|
|
473
|
+
const flatKeys = keys.flat();
|
|
474
|
+
return reactive(Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
296
475
|
}
|
|
297
476
|
|
|
298
477
|
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
@@ -321,176 +500,6 @@ function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
|
321
500
|
});
|
|
322
501
|
}
|
|
323
502
|
|
|
324
|
-
var _a;
|
|
325
|
-
const isClient = typeof window !== "undefined";
|
|
326
|
-
const isDef = (val) => typeof val !== "undefined";
|
|
327
|
-
const assert = (condition, ...infos) => {
|
|
328
|
-
if (!condition)
|
|
329
|
-
console.warn(...infos);
|
|
330
|
-
};
|
|
331
|
-
const toString = Object.prototype.toString;
|
|
332
|
-
const isBoolean = (val) => typeof val === "boolean";
|
|
333
|
-
const isFunction = (val) => typeof val === "function";
|
|
334
|
-
const isNumber = (val) => typeof val === "number";
|
|
335
|
-
const isString = (val) => typeof val === "string";
|
|
336
|
-
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
337
|
-
const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
|
|
338
|
-
const now = () => Date.now();
|
|
339
|
-
const timestamp = () => +Date.now();
|
|
340
|
-
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
341
|
-
const noop = () => {
|
|
342
|
-
};
|
|
343
|
-
const rand = (min, max) => {
|
|
344
|
-
min = Math.ceil(min);
|
|
345
|
-
max = Math.floor(max);
|
|
346
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
347
|
-
};
|
|
348
|
-
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
349
|
-
|
|
350
|
-
function createFilterWrapper(filter, fn) {
|
|
351
|
-
function wrapper(...args) {
|
|
352
|
-
filter(() => fn.apply(this, args), { fn, thisArg: this, args });
|
|
353
|
-
}
|
|
354
|
-
return wrapper;
|
|
355
|
-
}
|
|
356
|
-
const bypassFilter = (invoke) => {
|
|
357
|
-
return invoke();
|
|
358
|
-
};
|
|
359
|
-
function debounceFilter(ms, options = {}) {
|
|
360
|
-
let timer;
|
|
361
|
-
let maxTimer;
|
|
362
|
-
const filter = (invoke) => {
|
|
363
|
-
const duration = unref(ms);
|
|
364
|
-
const maxDuration = unref(options.maxWait);
|
|
365
|
-
if (timer)
|
|
366
|
-
clearTimeout(timer);
|
|
367
|
-
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
368
|
-
if (maxTimer) {
|
|
369
|
-
clearTimeout(maxTimer);
|
|
370
|
-
maxTimer = null;
|
|
371
|
-
}
|
|
372
|
-
return invoke();
|
|
373
|
-
}
|
|
374
|
-
if (maxDuration && !maxTimer) {
|
|
375
|
-
maxTimer = setTimeout(() => {
|
|
376
|
-
if (timer)
|
|
377
|
-
clearTimeout(timer);
|
|
378
|
-
maxTimer = null;
|
|
379
|
-
invoke();
|
|
380
|
-
}, maxDuration);
|
|
381
|
-
}
|
|
382
|
-
timer = setTimeout(() => {
|
|
383
|
-
if (maxTimer)
|
|
384
|
-
clearTimeout(maxTimer);
|
|
385
|
-
maxTimer = null;
|
|
386
|
-
invoke();
|
|
387
|
-
}, duration);
|
|
388
|
-
};
|
|
389
|
-
return filter;
|
|
390
|
-
}
|
|
391
|
-
function throttleFilter(ms, trailing = true, leading = true) {
|
|
392
|
-
let lastExec = 0;
|
|
393
|
-
let timer;
|
|
394
|
-
let isLeading = true;
|
|
395
|
-
const clear = () => {
|
|
396
|
-
if (timer) {
|
|
397
|
-
clearTimeout(timer);
|
|
398
|
-
timer = void 0;
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
const filter = (invoke) => {
|
|
402
|
-
const duration = unref(ms);
|
|
403
|
-
const elapsed = Date.now() - lastExec;
|
|
404
|
-
clear();
|
|
405
|
-
if (duration <= 0) {
|
|
406
|
-
lastExec = Date.now();
|
|
407
|
-
return invoke();
|
|
408
|
-
}
|
|
409
|
-
if (elapsed > duration && (leading || !isLeading)) {
|
|
410
|
-
lastExec = Date.now();
|
|
411
|
-
invoke();
|
|
412
|
-
} else if (trailing) {
|
|
413
|
-
timer = setTimeout(() => {
|
|
414
|
-
lastExec = Date.now();
|
|
415
|
-
isLeading = true;
|
|
416
|
-
clear();
|
|
417
|
-
invoke();
|
|
418
|
-
}, duration);
|
|
419
|
-
}
|
|
420
|
-
if (!leading && !timer)
|
|
421
|
-
timer = setTimeout(() => isLeading = true, duration);
|
|
422
|
-
isLeading = false;
|
|
423
|
-
};
|
|
424
|
-
return filter;
|
|
425
|
-
}
|
|
426
|
-
function pausableFilter(extendFilter = bypassFilter) {
|
|
427
|
-
const isActive = ref(true);
|
|
428
|
-
function pause() {
|
|
429
|
-
isActive.value = false;
|
|
430
|
-
}
|
|
431
|
-
function resume() {
|
|
432
|
-
isActive.value = true;
|
|
433
|
-
}
|
|
434
|
-
const eventFilter = (...args) => {
|
|
435
|
-
if (isActive.value)
|
|
436
|
-
extendFilter(...args);
|
|
437
|
-
};
|
|
438
|
-
return { isActive, pause, resume, eventFilter };
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
442
|
-
return new Promise((resolve, reject) => {
|
|
443
|
-
if (throwOnTimeout)
|
|
444
|
-
setTimeout(() => reject(reason), ms);
|
|
445
|
-
else
|
|
446
|
-
setTimeout(resolve, ms);
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
function identity(arg) {
|
|
450
|
-
return arg;
|
|
451
|
-
}
|
|
452
|
-
function createSingletonPromise(fn) {
|
|
453
|
-
let _promise;
|
|
454
|
-
function wrapper() {
|
|
455
|
-
if (!_promise)
|
|
456
|
-
_promise = fn();
|
|
457
|
-
return _promise;
|
|
458
|
-
}
|
|
459
|
-
wrapper.reset = async () => {
|
|
460
|
-
const _prev = _promise;
|
|
461
|
-
_promise = void 0;
|
|
462
|
-
if (_prev)
|
|
463
|
-
await _prev;
|
|
464
|
-
};
|
|
465
|
-
return wrapper;
|
|
466
|
-
}
|
|
467
|
-
function invoke(fn) {
|
|
468
|
-
return fn();
|
|
469
|
-
}
|
|
470
|
-
function containsProp(obj, ...props) {
|
|
471
|
-
return props.some((k) => k in obj);
|
|
472
|
-
}
|
|
473
|
-
function increaseWithUnit(target, delta) {
|
|
474
|
-
var _a;
|
|
475
|
-
if (typeof target === "number")
|
|
476
|
-
return target + delta;
|
|
477
|
-
const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
|
|
478
|
-
const unit = target.slice(value.length);
|
|
479
|
-
const result = parseFloat(value) + delta;
|
|
480
|
-
if (Number.isNaN(result))
|
|
481
|
-
return target;
|
|
482
|
-
return result + unit;
|
|
483
|
-
}
|
|
484
|
-
function objectPick(obj, keys, omitUndefined = false) {
|
|
485
|
-
return keys.reduce((n, k) => {
|
|
486
|
-
if (k in obj) {
|
|
487
|
-
if (!omitUndefined || obj[k] !== void 0)
|
|
488
|
-
n[k] = obj[k];
|
|
489
|
-
}
|
|
490
|
-
return n;
|
|
491
|
-
}, {});
|
|
492
|
-
}
|
|
493
|
-
|
|
494
503
|
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
495
504
|
return createFilterWrapper(debounceFilter(ms, options), fn);
|
|
496
505
|
}
|
|
@@ -581,6 +590,14 @@ function refWithControl(initial, options = {}) {
|
|
|
581
590
|
}
|
|
582
591
|
const controlledRef = refWithControl;
|
|
583
592
|
|
|
593
|
+
function resolveRef(r) {
|
|
594
|
+
return typeof r === "function" ? computed(r) : ref(r);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function resolveUnref(r) {
|
|
598
|
+
return typeof r === "function" ? r() : unref(r);
|
|
599
|
+
}
|
|
600
|
+
|
|
584
601
|
function set(...args) {
|
|
585
602
|
if (args.length === 2) {
|
|
586
603
|
const [ref, value] = args;
|
|
@@ -627,25 +644,25 @@ function syncRefs(source, targets, options = {}) {
|
|
|
627
644
|
return watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
|
|
628
645
|
}
|
|
629
646
|
|
|
630
|
-
var __defProp$
|
|
631
|
-
var __defProps$
|
|
632
|
-
var __getOwnPropDescs$
|
|
633
|
-
var __getOwnPropSymbols$
|
|
634
|
-
var __hasOwnProp$
|
|
635
|
-
var __propIsEnum$
|
|
636
|
-
var __defNormalProp$
|
|
637
|
-
var __spreadValues$
|
|
647
|
+
var __defProp$7 = Object.defineProperty;
|
|
648
|
+
var __defProps$5 = Object.defineProperties;
|
|
649
|
+
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
650
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
651
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
652
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
653
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
654
|
+
var __spreadValues$7 = (a, b) => {
|
|
638
655
|
for (var prop in b || (b = {}))
|
|
639
|
-
if (__hasOwnProp$
|
|
640
|
-
__defNormalProp$
|
|
641
|
-
if (__getOwnPropSymbols$
|
|
642
|
-
for (var prop of __getOwnPropSymbols$
|
|
643
|
-
if (__propIsEnum$
|
|
644
|
-
__defNormalProp$
|
|
656
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
657
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
658
|
+
if (__getOwnPropSymbols$9)
|
|
659
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
660
|
+
if (__propIsEnum$9.call(b, prop))
|
|
661
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
645
662
|
}
|
|
646
663
|
return a;
|
|
647
664
|
};
|
|
648
|
-
var __spreadProps$
|
|
665
|
+
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
649
666
|
function toRefs(objectRef) {
|
|
650
667
|
if (!isRef(objectRef))
|
|
651
668
|
return toRefs$1(objectRef);
|
|
@@ -661,7 +678,7 @@ function toRefs(objectRef) {
|
|
|
661
678
|
copy[key] = v;
|
|
662
679
|
objectRef.value = copy;
|
|
663
680
|
} else {
|
|
664
|
-
const newObject = __spreadProps$
|
|
681
|
+
const newObject = __spreadProps$5(__spreadValues$7({}, objectRef.value), { [key]: v });
|
|
665
682
|
Object.setPrototypeOf(newObject, objectRef.value);
|
|
666
683
|
objectRef.value = newObject;
|
|
667
684
|
}
|
|
@@ -918,19 +935,19 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
918
935
|
};
|
|
919
936
|
}
|
|
920
937
|
|
|
921
|
-
var __defProp$
|
|
922
|
-
var __getOwnPropSymbols$
|
|
923
|
-
var __hasOwnProp$
|
|
924
|
-
var __propIsEnum$
|
|
925
|
-
var __defNormalProp$
|
|
926
|
-
var __spreadValues$
|
|
938
|
+
var __defProp$6 = Object.defineProperty;
|
|
939
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
940
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
941
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
942
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
943
|
+
var __spreadValues$6 = (a, b) => {
|
|
927
944
|
for (var prop in b || (b = {}))
|
|
928
|
-
if (__hasOwnProp$
|
|
929
|
-
__defNormalProp$
|
|
930
|
-
if (__getOwnPropSymbols$
|
|
931
|
-
for (var prop of __getOwnPropSymbols$
|
|
932
|
-
if (__propIsEnum$
|
|
933
|
-
__defNormalProp$
|
|
945
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
946
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
947
|
+
if (__getOwnPropSymbols$8)
|
|
948
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
949
|
+
if (__propIsEnum$8.call(b, prop))
|
|
950
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
934
951
|
}
|
|
935
952
|
return a;
|
|
936
953
|
};
|
|
@@ -942,7 +959,7 @@ function useInterval(interval = 1e3, options = {}) {
|
|
|
942
959
|
const counter = ref(0);
|
|
943
960
|
const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
|
|
944
961
|
if (exposeControls) {
|
|
945
|
-
return __spreadValues$
|
|
962
|
+
return __spreadValues$6({
|
|
946
963
|
counter
|
|
947
964
|
}, controls);
|
|
948
965
|
} else {
|
|
@@ -995,19 +1012,19 @@ function useTimeoutFn(cb, interval, options = {}) {
|
|
|
995
1012
|
};
|
|
996
1013
|
}
|
|
997
1014
|
|
|
998
|
-
var __defProp$
|
|
999
|
-
var __getOwnPropSymbols$
|
|
1000
|
-
var __hasOwnProp$
|
|
1001
|
-
var __propIsEnum$
|
|
1002
|
-
var __defNormalProp$
|
|
1003
|
-
var __spreadValues$
|
|
1015
|
+
var __defProp$5 = Object.defineProperty;
|
|
1016
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1017
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1018
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1019
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1020
|
+
var __spreadValues$5 = (a, b) => {
|
|
1004
1021
|
for (var prop in b || (b = {}))
|
|
1005
|
-
if (__hasOwnProp$
|
|
1006
|
-
__defNormalProp$
|
|
1007
|
-
if (__getOwnPropSymbols$
|
|
1008
|
-
for (var prop of __getOwnPropSymbols$
|
|
1009
|
-
if (__propIsEnum$
|
|
1010
|
-
__defNormalProp$
|
|
1022
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
1023
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1024
|
+
if (__getOwnPropSymbols$7)
|
|
1025
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1026
|
+
if (__propIsEnum$7.call(b, prop))
|
|
1027
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1011
1028
|
}
|
|
1012
1029
|
return a;
|
|
1013
1030
|
};
|
|
@@ -1018,7 +1035,7 @@ function useTimeout(interval = 1e3, options = {}) {
|
|
|
1018
1035
|
const controls = useTimeoutFn(noop, interval, options);
|
|
1019
1036
|
const ready = computed(() => !controls.isPending.value);
|
|
1020
1037
|
if (exposeControls) {
|
|
1021
|
-
return __spreadValues$
|
|
1038
|
+
return __spreadValues$5({
|
|
1022
1039
|
ready
|
|
1023
1040
|
}, controls);
|
|
1024
1041
|
} else {
|
|
@@ -1048,17 +1065,17 @@ function useToggle(initialValue = false, options = {}) {
|
|
|
1048
1065
|
return [innerValue, toggle];
|
|
1049
1066
|
}
|
|
1050
1067
|
|
|
1051
|
-
var __getOwnPropSymbols$
|
|
1052
|
-
var __hasOwnProp$
|
|
1053
|
-
var __propIsEnum$
|
|
1068
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1069
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1070
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1054
1071
|
var __objRest$5 = (source, exclude) => {
|
|
1055
1072
|
var target = {};
|
|
1056
1073
|
for (var prop in source)
|
|
1057
|
-
if (__hasOwnProp$
|
|
1074
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1058
1075
|
target[prop] = source[prop];
|
|
1059
|
-
if (source != null && __getOwnPropSymbols$
|
|
1060
|
-
for (var prop of __getOwnPropSymbols$
|
|
1061
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1076
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
1077
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
1078
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
1062
1079
|
target[prop] = source[prop];
|
|
1063
1080
|
}
|
|
1064
1081
|
return target;
|
|
@@ -1072,17 +1089,17 @@ function watchWithFilter(source, cb, options = {}) {
|
|
|
1072
1089
|
return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
|
|
1073
1090
|
}
|
|
1074
1091
|
|
|
1075
|
-
var __getOwnPropSymbols$
|
|
1076
|
-
var __hasOwnProp$
|
|
1077
|
-
var __propIsEnum$
|
|
1092
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1093
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1094
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1078
1095
|
var __objRest$4 = (source, exclude) => {
|
|
1079
1096
|
var target = {};
|
|
1080
1097
|
for (var prop in source)
|
|
1081
|
-
if (__hasOwnProp$
|
|
1098
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1082
1099
|
target[prop] = source[prop];
|
|
1083
|
-
if (source != null && __getOwnPropSymbols$
|
|
1084
|
-
for (var prop of __getOwnPropSymbols$
|
|
1085
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1100
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
1101
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
1102
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
1086
1103
|
target[prop] = source[prop];
|
|
1087
1104
|
}
|
|
1088
1105
|
return target;
|
|
@@ -1103,33 +1120,33 @@ function watchAtMost(source, cb, options) {
|
|
|
1103
1120
|
return { count: current, stop };
|
|
1104
1121
|
}
|
|
1105
1122
|
|
|
1106
|
-
var __defProp$
|
|
1107
|
-
var __defProps$
|
|
1108
|
-
var __getOwnPropDescs$
|
|
1109
|
-
var __getOwnPropSymbols$
|
|
1110
|
-
var __hasOwnProp$
|
|
1111
|
-
var __propIsEnum$
|
|
1112
|
-
var __defNormalProp$
|
|
1113
|
-
var __spreadValues$
|
|
1123
|
+
var __defProp$4 = Object.defineProperty;
|
|
1124
|
+
var __defProps$4 = Object.defineProperties;
|
|
1125
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1126
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1127
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1128
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1129
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1130
|
+
var __spreadValues$4 = (a, b) => {
|
|
1114
1131
|
for (var prop in b || (b = {}))
|
|
1115
|
-
if (__hasOwnProp$
|
|
1116
|
-
__defNormalProp$
|
|
1117
|
-
if (__getOwnPropSymbols$
|
|
1118
|
-
for (var prop of __getOwnPropSymbols$
|
|
1119
|
-
if (__propIsEnum$
|
|
1120
|
-
__defNormalProp$
|
|
1132
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
1133
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1134
|
+
if (__getOwnPropSymbols$4)
|
|
1135
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1136
|
+
if (__propIsEnum$4.call(b, prop))
|
|
1137
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1121
1138
|
}
|
|
1122
1139
|
return a;
|
|
1123
1140
|
};
|
|
1124
|
-
var __spreadProps$
|
|
1141
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1125
1142
|
var __objRest$3 = (source, exclude) => {
|
|
1126
1143
|
var target = {};
|
|
1127
1144
|
for (var prop in source)
|
|
1128
|
-
if (__hasOwnProp$
|
|
1145
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1129
1146
|
target[prop] = source[prop];
|
|
1130
|
-
if (source != null && __getOwnPropSymbols$
|
|
1131
|
-
for (var prop of __getOwnPropSymbols$
|
|
1132
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1147
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
1148
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1149
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1133
1150
|
target[prop] = source[prop];
|
|
1134
1151
|
}
|
|
1135
1152
|
return target;
|
|
@@ -1142,38 +1159,38 @@ function watchDebounced(source, cb, options = {}) {
|
|
|
1142
1159
|
"debounce",
|
|
1143
1160
|
"maxWait"
|
|
1144
1161
|
]);
|
|
1145
|
-
return watchWithFilter(source, cb, __spreadProps$
|
|
1162
|
+
return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$4({}, watchOptions), {
|
|
1146
1163
|
eventFilter: debounceFilter(debounce, { maxWait })
|
|
1147
1164
|
}));
|
|
1148
1165
|
}
|
|
1149
1166
|
|
|
1150
|
-
var __defProp$
|
|
1151
|
-
var __defProps$
|
|
1152
|
-
var __getOwnPropDescs$
|
|
1153
|
-
var __getOwnPropSymbols$
|
|
1154
|
-
var __hasOwnProp$
|
|
1155
|
-
var __propIsEnum$
|
|
1156
|
-
var __defNormalProp$
|
|
1157
|
-
var __spreadValues$
|
|
1167
|
+
var __defProp$3 = Object.defineProperty;
|
|
1168
|
+
var __defProps$3 = Object.defineProperties;
|
|
1169
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1170
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1171
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1172
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1173
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1174
|
+
var __spreadValues$3 = (a, b) => {
|
|
1158
1175
|
for (var prop in b || (b = {}))
|
|
1159
|
-
if (__hasOwnProp$
|
|
1160
|
-
__defNormalProp$
|
|
1161
|
-
if (__getOwnPropSymbols$
|
|
1162
|
-
for (var prop of __getOwnPropSymbols$
|
|
1163
|
-
if (__propIsEnum$
|
|
1164
|
-
__defNormalProp$
|
|
1176
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
1177
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1178
|
+
if (__getOwnPropSymbols$3)
|
|
1179
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1180
|
+
if (__propIsEnum$3.call(b, prop))
|
|
1181
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1165
1182
|
}
|
|
1166
1183
|
return a;
|
|
1167
1184
|
};
|
|
1168
|
-
var __spreadProps$
|
|
1185
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1169
1186
|
var __objRest$2 = (source, exclude) => {
|
|
1170
1187
|
var target = {};
|
|
1171
1188
|
for (var prop in source)
|
|
1172
|
-
if (__hasOwnProp$
|
|
1189
|
+
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1173
1190
|
target[prop] = source[prop];
|
|
1174
|
-
if (source != null && __getOwnPropSymbols$
|
|
1175
|
-
for (var prop of __getOwnPropSymbols$
|
|
1176
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1191
|
+
if (source != null && __getOwnPropSymbols$3)
|
|
1192
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
1193
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
1177
1194
|
target[prop] = source[prop];
|
|
1178
1195
|
}
|
|
1179
1196
|
return target;
|
|
@@ -1210,7 +1227,7 @@ function watchIgnorable(source, cb, options = {}) {
|
|
|
1210
1227
|
};
|
|
1211
1228
|
disposables.push(watch(source, () => {
|
|
1212
1229
|
syncCounter.value++;
|
|
1213
|
-
}, __spreadProps$
|
|
1230
|
+
}, __spreadProps$3(__spreadValues$3({}, watchOptions), { flush: "sync" })));
|
|
1214
1231
|
ignoreUpdates = (updater) => {
|
|
1215
1232
|
const syncCounterPrev = syncCounter.value;
|
|
1216
1233
|
updater();
|
|
@@ -1238,6 +1255,50 @@ function watchOnce(source, cb, options) {
|
|
|
1238
1255
|
}, options);
|
|
1239
1256
|
}
|
|
1240
1257
|
|
|
1258
|
+
var __defProp$2 = Object.defineProperty;
|
|
1259
|
+
var __defProps$2 = Object.defineProperties;
|
|
1260
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1261
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1262
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1263
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1264
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1265
|
+
var __spreadValues$2 = (a, b) => {
|
|
1266
|
+
for (var prop in b || (b = {}))
|
|
1267
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
1268
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
1269
|
+
if (__getOwnPropSymbols$2)
|
|
1270
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1271
|
+
if (__propIsEnum$2.call(b, prop))
|
|
1272
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
1273
|
+
}
|
|
1274
|
+
return a;
|
|
1275
|
+
};
|
|
1276
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1277
|
+
var __objRest$1 = (source, exclude) => {
|
|
1278
|
+
var target = {};
|
|
1279
|
+
for (var prop in source)
|
|
1280
|
+
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1281
|
+
target[prop] = source[prop];
|
|
1282
|
+
if (source != null && __getOwnPropSymbols$2)
|
|
1283
|
+
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
1284
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
1285
|
+
target[prop] = source[prop];
|
|
1286
|
+
}
|
|
1287
|
+
return target;
|
|
1288
|
+
};
|
|
1289
|
+
function watchPausable(source, cb, options = {}) {
|
|
1290
|
+
const _a = options, {
|
|
1291
|
+
eventFilter: filter
|
|
1292
|
+
} = _a, watchOptions = __objRest$1(_a, [
|
|
1293
|
+
"eventFilter"
|
|
1294
|
+
]);
|
|
1295
|
+
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
1296
|
+
const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$2({}, watchOptions), {
|
|
1297
|
+
eventFilter
|
|
1298
|
+
}));
|
|
1299
|
+
return { stop, pause, resume, isActive };
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1241
1302
|
var __defProp$1 = Object.defineProperty;
|
|
1242
1303
|
var __defProps$1 = Object.defineProperties;
|
|
1243
1304
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
@@ -1257,7 +1318,7 @@ var __spreadValues$1 = (a, b) => {
|
|
|
1257
1318
|
return a;
|
|
1258
1319
|
};
|
|
1259
1320
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1260
|
-
var __objRest
|
|
1321
|
+
var __objRest = (source, exclude) => {
|
|
1261
1322
|
var target = {};
|
|
1262
1323
|
for (var prop in source)
|
|
1263
1324
|
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
@@ -1269,17 +1330,19 @@ var __objRest$1 = (source, exclude) => {
|
|
|
1269
1330
|
}
|
|
1270
1331
|
return target;
|
|
1271
1332
|
};
|
|
1272
|
-
function
|
|
1333
|
+
function watchThrottled(source, cb, options = {}) {
|
|
1273
1334
|
const _a = options, {
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1335
|
+
throttle = 0,
|
|
1336
|
+
trailing = true,
|
|
1337
|
+
leading = true
|
|
1338
|
+
} = _a, watchOptions = __objRest(_a, [
|
|
1339
|
+
"throttle",
|
|
1340
|
+
"trailing",
|
|
1341
|
+
"leading"
|
|
1277
1342
|
]);
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
eventFilter
|
|
1343
|
+
return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
|
|
1344
|
+
eventFilter: throttleFilter(throttle, trailing, leading)
|
|
1281
1345
|
}));
|
|
1282
|
-
return { stop, pause, resume, isActive };
|
|
1283
1346
|
}
|
|
1284
1347
|
|
|
1285
1348
|
var __defProp = Object.defineProperty;
|
|
@@ -1301,31 +1364,47 @@ var __spreadValues = (a, b) => {
|
|
|
1301
1364
|
return a;
|
|
1302
1365
|
};
|
|
1303
1366
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
if (
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
}
|
|
1367
|
+
function watchTriggerable(source, cb, options = {}) {
|
|
1368
|
+
let cleanupFn;
|
|
1369
|
+
function onEffect() {
|
|
1370
|
+
if (!cleanupFn)
|
|
1371
|
+
return;
|
|
1372
|
+
const fn = cleanupFn;
|
|
1373
|
+
cleanupFn = void 0;
|
|
1374
|
+
fn();
|
|
1375
|
+
}
|
|
1376
|
+
function onCleanup(callback) {
|
|
1377
|
+
cleanupFn = callback;
|
|
1378
|
+
}
|
|
1379
|
+
const _cb = (value, oldValue) => {
|
|
1380
|
+
onEffect();
|
|
1381
|
+
return cb(value, oldValue, onCleanup);
|
|
1382
|
+
};
|
|
1383
|
+
const res = watchIgnorable(source, _cb, options);
|
|
1384
|
+
const { ignoreUpdates } = res;
|
|
1385
|
+
const trigger = () => {
|
|
1386
|
+
let res2;
|
|
1387
|
+
ignoreUpdates(() => {
|
|
1388
|
+
res2 = _cb(getWatchSources(source), getOldValue(source));
|
|
1389
|
+
});
|
|
1390
|
+
return res2;
|
|
1391
|
+
};
|
|
1392
|
+
return __spreadProps(__spreadValues({}, res), {
|
|
1393
|
+
trigger
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
function getWatchSources(sources) {
|
|
1397
|
+
if (isReactive(sources))
|
|
1398
|
+
return sources;
|
|
1399
|
+
if (Array.isArray(sources))
|
|
1400
|
+
return sources.map((item) => getOneWatchSource(item));
|
|
1401
|
+
return getOneWatchSource(sources);
|
|
1402
|
+
}
|
|
1403
|
+
function getOneWatchSource(source) {
|
|
1404
|
+
return typeof source === "function" ? source() : unref(source);
|
|
1405
|
+
}
|
|
1406
|
+
function getOldValue(source) {
|
|
1407
|
+
return Array.isArray(source) ? source.map(() => void 0) : void 0;
|
|
1329
1408
|
}
|
|
1330
1409
|
|
|
1331
1410
|
function whenever(source, cb, options) {
|
|
@@ -1335,4 +1414,4 @@ function whenever(source, cb, options) {
|
|
|
1335
1414
|
}, options);
|
|
1336
1415
|
}
|
|
1337
1416
|
|
|
1338
|
-
export { __onlyVue3, logicAnd as and, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, logicAnd, logicNot, logicOr, makeDestructurable, noop, normalizeDate, logicNot as not, now, objectPick, logicOr as or, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchWithFilter, whenever };
|
|
1417
|
+
export { __onlyVue3, logicAnd as and, assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isBoolean, isClient, isDef, isDefined, isFunction, isIOS, isNumber, isObject, isString, isWindow, logicAnd, logicNot, logicOr, makeDestructurable, noop, normalizeDate, logicNot as not, now, objectPick, logicOr as or, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRefs, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToggle, watchAtMost, watchDebounced, watchIgnorable, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|