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