@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.iife.js
CHANGED
|
@@ -90,61 +90,249 @@
|
|
|
90
90
|
;(function (exports, vueDemi) {
|
|
91
91
|
'use strict';
|
|
92
92
|
|
|
93
|
-
var __defProp$
|
|
94
|
-
var __defProps$
|
|
95
|
-
var __getOwnPropDescs$
|
|
96
|
-
var __getOwnPropSymbols$
|
|
97
|
-
var __hasOwnProp$
|
|
98
|
-
var __propIsEnum$
|
|
99
|
-
var __defNormalProp$
|
|
100
|
-
var __spreadValues$
|
|
93
|
+
var __defProp$9 = Object.defineProperty;
|
|
94
|
+
var __defProps$6 = Object.defineProperties;
|
|
95
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
96
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
97
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
98
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
99
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
100
|
+
var __spreadValues$9 = (a, b) => {
|
|
101
101
|
for (var prop in b || (b = {}))
|
|
102
|
-
if (__hasOwnProp$
|
|
103
|
-
__defNormalProp$
|
|
104
|
-
if (__getOwnPropSymbols$
|
|
105
|
-
for (var prop of __getOwnPropSymbols$
|
|
106
|
-
if (__propIsEnum$
|
|
107
|
-
__defNormalProp$
|
|
102
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
103
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
104
|
+
if (__getOwnPropSymbols$b)
|
|
105
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
106
|
+
if (__propIsEnum$b.call(b, prop))
|
|
107
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
108
108
|
}
|
|
109
109
|
return a;
|
|
110
110
|
};
|
|
111
|
-
var __spreadProps$
|
|
111
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
112
112
|
function computedEager(fn, options) {
|
|
113
113
|
var _a;
|
|
114
114
|
const result = vueDemi.shallowRef();
|
|
115
115
|
vueDemi.watchEffect(() => {
|
|
116
116
|
result.value = fn();
|
|
117
|
-
}, __spreadProps$
|
|
117
|
+
}, __spreadProps$6(__spreadValues$9({}, options), {
|
|
118
118
|
flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
|
|
119
119
|
}));
|
|
120
120
|
return vueDemi.readonly(result);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
var _a;
|
|
124
|
+
const isClient = typeof window !== "undefined";
|
|
125
|
+
const isDef = (val) => typeof val !== "undefined";
|
|
126
|
+
const assert = (condition, ...infos) => {
|
|
127
|
+
if (!condition)
|
|
128
|
+
console.warn(...infos);
|
|
129
|
+
};
|
|
130
|
+
const toString = Object.prototype.toString;
|
|
131
|
+
const isBoolean = (val) => typeof val === "boolean";
|
|
132
|
+
const isFunction = (val) => typeof val === "function";
|
|
133
|
+
const isNumber = (val) => typeof val === "number";
|
|
134
|
+
const isString = (val) => typeof val === "string";
|
|
135
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
136
|
+
const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
|
|
137
|
+
const now = () => Date.now();
|
|
138
|
+
const timestamp = () => +Date.now();
|
|
139
|
+
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
140
|
+
const noop = () => {
|
|
141
|
+
};
|
|
142
|
+
const rand = (min, max) => {
|
|
143
|
+
min = Math.ceil(min);
|
|
144
|
+
max = Math.floor(max);
|
|
145
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
146
|
+
};
|
|
147
|
+
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
148
|
+
|
|
149
|
+
function createFilterWrapper(filter, fn) {
|
|
150
|
+
function wrapper(...args) {
|
|
151
|
+
filter(() => fn.apply(this, args), { fn, thisArg: this, args });
|
|
152
|
+
}
|
|
153
|
+
return wrapper;
|
|
154
|
+
}
|
|
155
|
+
const bypassFilter = (invoke) => {
|
|
156
|
+
return invoke();
|
|
157
|
+
};
|
|
158
|
+
function debounceFilter(ms, options = {}) {
|
|
159
|
+
let timer;
|
|
160
|
+
let maxTimer;
|
|
161
|
+
const filter = (invoke) => {
|
|
162
|
+
const duration = vueDemi.unref(ms);
|
|
163
|
+
const maxDuration = vueDemi.unref(options.maxWait);
|
|
164
|
+
if (timer)
|
|
165
|
+
clearTimeout(timer);
|
|
166
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
167
|
+
if (maxTimer) {
|
|
168
|
+
clearTimeout(maxTimer);
|
|
169
|
+
maxTimer = null;
|
|
170
|
+
}
|
|
171
|
+
return invoke();
|
|
172
|
+
}
|
|
173
|
+
if (maxDuration && !maxTimer) {
|
|
174
|
+
maxTimer = setTimeout(() => {
|
|
175
|
+
if (timer)
|
|
176
|
+
clearTimeout(timer);
|
|
177
|
+
maxTimer = null;
|
|
178
|
+
invoke();
|
|
179
|
+
}, maxDuration);
|
|
180
|
+
}
|
|
181
|
+
timer = setTimeout(() => {
|
|
182
|
+
if (maxTimer)
|
|
183
|
+
clearTimeout(maxTimer);
|
|
184
|
+
maxTimer = null;
|
|
185
|
+
invoke();
|
|
186
|
+
}, duration);
|
|
187
|
+
};
|
|
188
|
+
return filter;
|
|
189
|
+
}
|
|
190
|
+
function throttleFilter(ms, trailing = true, leading = true) {
|
|
191
|
+
let lastExec = 0;
|
|
192
|
+
let timer;
|
|
193
|
+
let isLeading = true;
|
|
194
|
+
const clear = () => {
|
|
195
|
+
if (timer) {
|
|
196
|
+
clearTimeout(timer);
|
|
197
|
+
timer = void 0;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const filter = (invoke) => {
|
|
201
|
+
const duration = vueDemi.unref(ms);
|
|
202
|
+
const elapsed = Date.now() - lastExec;
|
|
203
|
+
clear();
|
|
204
|
+
if (duration <= 0) {
|
|
205
|
+
lastExec = Date.now();
|
|
206
|
+
return invoke();
|
|
207
|
+
}
|
|
208
|
+
if (elapsed > duration && (leading || !isLeading)) {
|
|
209
|
+
lastExec = Date.now();
|
|
210
|
+
invoke();
|
|
211
|
+
} else if (trailing) {
|
|
212
|
+
timer = setTimeout(() => {
|
|
213
|
+
lastExec = Date.now();
|
|
214
|
+
isLeading = true;
|
|
215
|
+
clear();
|
|
216
|
+
invoke();
|
|
217
|
+
}, duration);
|
|
218
|
+
}
|
|
219
|
+
if (!leading && !timer)
|
|
220
|
+
timer = setTimeout(() => isLeading = true, duration);
|
|
221
|
+
isLeading = false;
|
|
222
|
+
};
|
|
223
|
+
return filter;
|
|
224
|
+
}
|
|
225
|
+
function pausableFilter(extendFilter = bypassFilter) {
|
|
226
|
+
const isActive = vueDemi.ref(true);
|
|
227
|
+
function pause() {
|
|
228
|
+
isActive.value = false;
|
|
229
|
+
}
|
|
230
|
+
function resume() {
|
|
231
|
+
isActive.value = true;
|
|
232
|
+
}
|
|
233
|
+
const eventFilter = (...args) => {
|
|
234
|
+
if (isActive.value)
|
|
235
|
+
extendFilter(...args);
|
|
236
|
+
};
|
|
237
|
+
return { isActive, pause, resume, eventFilter };
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function __onlyVue3(name = "this function") {
|
|
241
|
+
if (vueDemi.isVue3)
|
|
242
|
+
return;
|
|
243
|
+
throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
|
|
244
|
+
}
|
|
245
|
+
const directiveHooks = {
|
|
246
|
+
mounted: vueDemi.isVue3 ? "mounted" : "inserted",
|
|
247
|
+
updated: vueDemi.isVue3 ? "updated" : "componentUpdated",
|
|
248
|
+
unmounted: vueDemi.isVue3 ? "unmounted" : "unbind"
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
252
|
+
return new Promise((resolve, reject) => {
|
|
253
|
+
if (throwOnTimeout)
|
|
254
|
+
setTimeout(() => reject(reason), ms);
|
|
255
|
+
else
|
|
256
|
+
setTimeout(resolve, ms);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function identity(arg) {
|
|
260
|
+
return arg;
|
|
261
|
+
}
|
|
262
|
+
function createSingletonPromise(fn) {
|
|
263
|
+
let _promise;
|
|
264
|
+
function wrapper() {
|
|
265
|
+
if (!_promise)
|
|
266
|
+
_promise = fn();
|
|
267
|
+
return _promise;
|
|
268
|
+
}
|
|
269
|
+
wrapper.reset = async () => {
|
|
270
|
+
const _prev = _promise;
|
|
271
|
+
_promise = void 0;
|
|
272
|
+
if (_prev)
|
|
273
|
+
await _prev;
|
|
274
|
+
};
|
|
275
|
+
return wrapper;
|
|
276
|
+
}
|
|
277
|
+
function invoke(fn) {
|
|
278
|
+
return fn();
|
|
279
|
+
}
|
|
280
|
+
function containsProp(obj, ...props) {
|
|
281
|
+
return props.some((k) => k in obj);
|
|
282
|
+
}
|
|
283
|
+
function increaseWithUnit(target, delta) {
|
|
284
|
+
var _a;
|
|
285
|
+
if (typeof target === "number")
|
|
286
|
+
return target + delta;
|
|
287
|
+
const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
|
|
288
|
+
const unit = target.slice(value.length);
|
|
289
|
+
const result = parseFloat(value) + delta;
|
|
290
|
+
if (Number.isNaN(result))
|
|
291
|
+
return target;
|
|
292
|
+
return result + unit;
|
|
293
|
+
}
|
|
294
|
+
function objectPick(obj, keys, omitUndefined = false) {
|
|
295
|
+
return keys.reduce((n, k) => {
|
|
296
|
+
if (k in obj) {
|
|
297
|
+
if (!omitUndefined || obj[k] !== void 0)
|
|
298
|
+
n[k] = obj[k];
|
|
299
|
+
}
|
|
300
|
+
return n;
|
|
301
|
+
}, {});
|
|
302
|
+
}
|
|
303
|
+
|
|
123
304
|
function computedWithControl(source, fn) {
|
|
124
305
|
let v = void 0;
|
|
125
306
|
let track;
|
|
126
307
|
let trigger;
|
|
127
308
|
const dirty = vueDemi.ref(true);
|
|
128
|
-
|
|
309
|
+
const update = () => {
|
|
129
310
|
dirty.value = true;
|
|
130
311
|
trigger();
|
|
131
|
-
}
|
|
132
|
-
|
|
312
|
+
};
|
|
313
|
+
vueDemi.watch(source, update, { flush: "sync" });
|
|
314
|
+
const get = isFunction(fn) ? fn : fn.get;
|
|
315
|
+
const set = isFunction(fn) ? void 0 : fn.set;
|
|
316
|
+
const result = vueDemi.customRef((_track, _trigger) => {
|
|
133
317
|
track = _track;
|
|
134
318
|
trigger = _trigger;
|
|
135
319
|
return {
|
|
136
320
|
get() {
|
|
137
321
|
if (dirty.value) {
|
|
138
|
-
v =
|
|
322
|
+
v = get();
|
|
139
323
|
dirty.value = false;
|
|
140
324
|
}
|
|
141
325
|
track();
|
|
142
326
|
return v;
|
|
143
327
|
},
|
|
144
|
-
set() {
|
|
328
|
+
set(v2) {
|
|
329
|
+
set == null ? void 0 : set(v2);
|
|
145
330
|
}
|
|
146
331
|
};
|
|
147
332
|
});
|
|
333
|
+
if (Object.isExtensible(result))
|
|
334
|
+
result.trigger = update;
|
|
335
|
+
return result;
|
|
148
336
|
}
|
|
149
337
|
|
|
150
338
|
function createEventHook() {
|
|
@@ -223,17 +411,6 @@
|
|
|
223
411
|
};
|
|
224
412
|
}
|
|
225
413
|
|
|
226
|
-
function __onlyVue3(name = "this function") {
|
|
227
|
-
if (vueDemi.isVue3)
|
|
228
|
-
return;
|
|
229
|
-
throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
|
|
230
|
-
}
|
|
231
|
-
const directiveHooks = {
|
|
232
|
-
mounted: vueDemi.isVue3 ? "mounted" : "inserted",
|
|
233
|
-
updated: vueDemi.isVue3 ? "updated" : "componentUpdated",
|
|
234
|
-
unmounted: vueDemi.isVue3 ? "unmounted" : "unbind"
|
|
235
|
-
};
|
|
236
|
-
|
|
237
414
|
function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
|
|
238
415
|
__onlyVue3();
|
|
239
416
|
for (const [key, value] of Object.entries(extend)) {
|
|
@@ -278,25 +455,25 @@
|
|
|
278
455
|
return vueDemi.computed(() => args.some((i) => vueDemi.unref(i)));
|
|
279
456
|
}
|
|
280
457
|
|
|
281
|
-
var __defProp$
|
|
282
|
-
var __getOwnPropSymbols$
|
|
283
|
-
var __hasOwnProp$
|
|
284
|
-
var __propIsEnum$
|
|
285
|
-
var __defNormalProp$
|
|
286
|
-
var __spreadValues$
|
|
458
|
+
var __defProp$8 = Object.defineProperty;
|
|
459
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
460
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
461
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
462
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
463
|
+
var __spreadValues$8 = (a, b) => {
|
|
287
464
|
for (var prop in b || (b = {}))
|
|
288
|
-
if (__hasOwnProp$
|
|
289
|
-
__defNormalProp$
|
|
290
|
-
if (__getOwnPropSymbols$
|
|
291
|
-
for (var prop of __getOwnPropSymbols$
|
|
292
|
-
if (__propIsEnum$
|
|
293
|
-
__defNormalProp$
|
|
465
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
466
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
467
|
+
if (__getOwnPropSymbols$a)
|
|
468
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
469
|
+
if (__propIsEnum$a.call(b, prop))
|
|
470
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
294
471
|
}
|
|
295
472
|
return a;
|
|
296
473
|
};
|
|
297
474
|
function makeDestructurable(obj, arr) {
|
|
298
475
|
if (typeof Symbol !== "undefined") {
|
|
299
|
-
const clone = __spreadValues$
|
|
476
|
+
const clone = __spreadValues$8({}, obj);
|
|
300
477
|
Object.defineProperty(clone, Symbol.iterator, {
|
|
301
478
|
enumerable: false,
|
|
302
479
|
value() {
|
|
@@ -378,11 +555,13 @@
|
|
|
378
555
|
}
|
|
379
556
|
|
|
380
557
|
function reactiveOmit(obj, ...keys) {
|
|
381
|
-
|
|
558
|
+
const flatKeys = keys.flat();
|
|
559
|
+
return reactiveComputed(() => Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
382
560
|
}
|
|
383
561
|
|
|
384
562
|
function reactivePick(obj, ...keys) {
|
|
385
|
-
|
|
563
|
+
const flatKeys = keys.flat();
|
|
564
|
+
return vueDemi.reactive(Object.fromEntries(flatKeys.map((k) => [k, vueDemi.toRef(obj, k)])));
|
|
386
565
|
}
|
|
387
566
|
|
|
388
567
|
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
@@ -411,176 +590,6 @@
|
|
|
411
590
|
});
|
|
412
591
|
}
|
|
413
592
|
|
|
414
|
-
var _a;
|
|
415
|
-
const isClient = typeof window !== "undefined";
|
|
416
|
-
const isDef = (val) => typeof val !== "undefined";
|
|
417
|
-
const assert = (condition, ...infos) => {
|
|
418
|
-
if (!condition)
|
|
419
|
-
console.warn(...infos);
|
|
420
|
-
};
|
|
421
|
-
const toString = Object.prototype.toString;
|
|
422
|
-
const isBoolean = (val) => typeof val === "boolean";
|
|
423
|
-
const isFunction = (val) => typeof val === "function";
|
|
424
|
-
const isNumber = (val) => typeof val === "number";
|
|
425
|
-
const isString = (val) => typeof val === "string";
|
|
426
|
-
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
427
|
-
const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
|
|
428
|
-
const now = () => Date.now();
|
|
429
|
-
const timestamp = () => +Date.now();
|
|
430
|
-
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
431
|
-
const noop = () => {
|
|
432
|
-
};
|
|
433
|
-
const rand = (min, max) => {
|
|
434
|
-
min = Math.ceil(min);
|
|
435
|
-
max = Math.floor(max);
|
|
436
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
437
|
-
};
|
|
438
|
-
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
439
|
-
|
|
440
|
-
function createFilterWrapper(filter, fn) {
|
|
441
|
-
function wrapper(...args) {
|
|
442
|
-
filter(() => fn.apply(this, args), { fn, thisArg: this, args });
|
|
443
|
-
}
|
|
444
|
-
return wrapper;
|
|
445
|
-
}
|
|
446
|
-
const bypassFilter = (invoke) => {
|
|
447
|
-
return invoke();
|
|
448
|
-
};
|
|
449
|
-
function debounceFilter(ms, options = {}) {
|
|
450
|
-
let timer;
|
|
451
|
-
let maxTimer;
|
|
452
|
-
const filter = (invoke) => {
|
|
453
|
-
const duration = vueDemi.unref(ms);
|
|
454
|
-
const maxDuration = vueDemi.unref(options.maxWait);
|
|
455
|
-
if (timer)
|
|
456
|
-
clearTimeout(timer);
|
|
457
|
-
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
458
|
-
if (maxTimer) {
|
|
459
|
-
clearTimeout(maxTimer);
|
|
460
|
-
maxTimer = null;
|
|
461
|
-
}
|
|
462
|
-
return invoke();
|
|
463
|
-
}
|
|
464
|
-
if (maxDuration && !maxTimer) {
|
|
465
|
-
maxTimer = setTimeout(() => {
|
|
466
|
-
if (timer)
|
|
467
|
-
clearTimeout(timer);
|
|
468
|
-
maxTimer = null;
|
|
469
|
-
invoke();
|
|
470
|
-
}, maxDuration);
|
|
471
|
-
}
|
|
472
|
-
timer = setTimeout(() => {
|
|
473
|
-
if (maxTimer)
|
|
474
|
-
clearTimeout(maxTimer);
|
|
475
|
-
maxTimer = null;
|
|
476
|
-
invoke();
|
|
477
|
-
}, duration);
|
|
478
|
-
};
|
|
479
|
-
return filter;
|
|
480
|
-
}
|
|
481
|
-
function throttleFilter(ms, trailing = true, leading = true) {
|
|
482
|
-
let lastExec = 0;
|
|
483
|
-
let timer;
|
|
484
|
-
let isLeading = true;
|
|
485
|
-
const clear = () => {
|
|
486
|
-
if (timer) {
|
|
487
|
-
clearTimeout(timer);
|
|
488
|
-
timer = void 0;
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
const filter = (invoke) => {
|
|
492
|
-
const duration = vueDemi.unref(ms);
|
|
493
|
-
const elapsed = Date.now() - lastExec;
|
|
494
|
-
clear();
|
|
495
|
-
if (duration <= 0) {
|
|
496
|
-
lastExec = Date.now();
|
|
497
|
-
return invoke();
|
|
498
|
-
}
|
|
499
|
-
if (elapsed > duration && (leading || !isLeading)) {
|
|
500
|
-
lastExec = Date.now();
|
|
501
|
-
invoke();
|
|
502
|
-
} else if (trailing) {
|
|
503
|
-
timer = setTimeout(() => {
|
|
504
|
-
lastExec = Date.now();
|
|
505
|
-
isLeading = true;
|
|
506
|
-
clear();
|
|
507
|
-
invoke();
|
|
508
|
-
}, duration);
|
|
509
|
-
}
|
|
510
|
-
if (!leading && !timer)
|
|
511
|
-
timer = setTimeout(() => isLeading = true, duration);
|
|
512
|
-
isLeading = false;
|
|
513
|
-
};
|
|
514
|
-
return filter;
|
|
515
|
-
}
|
|
516
|
-
function pausableFilter(extendFilter = bypassFilter) {
|
|
517
|
-
const isActive = vueDemi.ref(true);
|
|
518
|
-
function pause() {
|
|
519
|
-
isActive.value = false;
|
|
520
|
-
}
|
|
521
|
-
function resume() {
|
|
522
|
-
isActive.value = true;
|
|
523
|
-
}
|
|
524
|
-
const eventFilter = (...args) => {
|
|
525
|
-
if (isActive.value)
|
|
526
|
-
extendFilter(...args);
|
|
527
|
-
};
|
|
528
|
-
return { isActive, pause, resume, eventFilter };
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
532
|
-
return new Promise((resolve, reject) => {
|
|
533
|
-
if (throwOnTimeout)
|
|
534
|
-
setTimeout(() => reject(reason), ms);
|
|
535
|
-
else
|
|
536
|
-
setTimeout(resolve, ms);
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
function identity(arg) {
|
|
540
|
-
return arg;
|
|
541
|
-
}
|
|
542
|
-
function createSingletonPromise(fn) {
|
|
543
|
-
let _promise;
|
|
544
|
-
function wrapper() {
|
|
545
|
-
if (!_promise)
|
|
546
|
-
_promise = fn();
|
|
547
|
-
return _promise;
|
|
548
|
-
}
|
|
549
|
-
wrapper.reset = async () => {
|
|
550
|
-
const _prev = _promise;
|
|
551
|
-
_promise = void 0;
|
|
552
|
-
if (_prev)
|
|
553
|
-
await _prev;
|
|
554
|
-
};
|
|
555
|
-
return wrapper;
|
|
556
|
-
}
|
|
557
|
-
function invoke(fn) {
|
|
558
|
-
return fn();
|
|
559
|
-
}
|
|
560
|
-
function containsProp(obj, ...props) {
|
|
561
|
-
return props.some((k) => k in obj);
|
|
562
|
-
}
|
|
563
|
-
function increaseWithUnit(target, delta) {
|
|
564
|
-
var _a;
|
|
565
|
-
if (typeof target === "number")
|
|
566
|
-
return target + delta;
|
|
567
|
-
const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
|
|
568
|
-
const unit = target.slice(value.length);
|
|
569
|
-
const result = parseFloat(value) + delta;
|
|
570
|
-
if (Number.isNaN(result))
|
|
571
|
-
return target;
|
|
572
|
-
return result + unit;
|
|
573
|
-
}
|
|
574
|
-
function objectPick(obj, keys, omitUndefined = false) {
|
|
575
|
-
return keys.reduce((n, k) => {
|
|
576
|
-
if (k in obj) {
|
|
577
|
-
if (!omitUndefined || obj[k] !== void 0)
|
|
578
|
-
n[k] = obj[k];
|
|
579
|
-
}
|
|
580
|
-
return n;
|
|
581
|
-
}, {});
|
|
582
|
-
}
|
|
583
|
-
|
|
584
593
|
function useDebounceFn(fn, ms = 200, options = {}) {
|
|
585
594
|
return createFilterWrapper(debounceFilter(ms, options), fn);
|
|
586
595
|
}
|
|
@@ -671,6 +680,14 @@
|
|
|
671
680
|
}
|
|
672
681
|
const controlledRef = refWithControl;
|
|
673
682
|
|
|
683
|
+
function resolveRef(r) {
|
|
684
|
+
return typeof r === "function" ? vueDemi.computed(r) : vueDemi.ref(r);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
function resolveUnref(r) {
|
|
688
|
+
return typeof r === "function" ? r() : vueDemi.unref(r);
|
|
689
|
+
}
|
|
690
|
+
|
|
674
691
|
function set(...args) {
|
|
675
692
|
if (args.length === 2) {
|
|
676
693
|
const [ref, value] = args;
|
|
@@ -717,25 +734,25 @@
|
|
|
717
734
|
return vueDemi.watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
|
|
718
735
|
}
|
|
719
736
|
|
|
720
|
-
var __defProp$
|
|
721
|
-
var __defProps$
|
|
722
|
-
var __getOwnPropDescs$
|
|
723
|
-
var __getOwnPropSymbols$
|
|
724
|
-
var __hasOwnProp$
|
|
725
|
-
var __propIsEnum$
|
|
726
|
-
var __defNormalProp$
|
|
727
|
-
var __spreadValues$
|
|
737
|
+
var __defProp$7 = Object.defineProperty;
|
|
738
|
+
var __defProps$5 = Object.defineProperties;
|
|
739
|
+
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
740
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
741
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
742
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
743
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
744
|
+
var __spreadValues$7 = (a, b) => {
|
|
728
745
|
for (var prop in b || (b = {}))
|
|
729
|
-
if (__hasOwnProp$
|
|
730
|
-
__defNormalProp$
|
|
731
|
-
if (__getOwnPropSymbols$
|
|
732
|
-
for (var prop of __getOwnPropSymbols$
|
|
733
|
-
if (__propIsEnum$
|
|
734
|
-
__defNormalProp$
|
|
746
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
747
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
748
|
+
if (__getOwnPropSymbols$9)
|
|
749
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
750
|
+
if (__propIsEnum$9.call(b, prop))
|
|
751
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
735
752
|
}
|
|
736
753
|
return a;
|
|
737
754
|
};
|
|
738
|
-
var __spreadProps$
|
|
755
|
+
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
739
756
|
function toRefs(objectRef) {
|
|
740
757
|
if (!vueDemi.isRef(objectRef))
|
|
741
758
|
return vueDemi.toRefs(objectRef);
|
|
@@ -751,7 +768,7 @@
|
|
|
751
768
|
copy[key] = v;
|
|
752
769
|
objectRef.value = copy;
|
|
753
770
|
} else {
|
|
754
|
-
const newObject = __spreadProps$
|
|
771
|
+
const newObject = __spreadProps$5(__spreadValues$7({}, objectRef.value), { [key]: v });
|
|
755
772
|
Object.setPrototypeOf(newObject, objectRef.value);
|
|
756
773
|
objectRef.value = newObject;
|
|
757
774
|
}
|
|
@@ -1008,19 +1025,19 @@
|
|
|
1008
1025
|
};
|
|
1009
1026
|
}
|
|
1010
1027
|
|
|
1011
|
-
var __defProp$
|
|
1012
|
-
var __getOwnPropSymbols$
|
|
1013
|
-
var __hasOwnProp$
|
|
1014
|
-
var __propIsEnum$
|
|
1015
|
-
var __defNormalProp$
|
|
1016
|
-
var __spreadValues$
|
|
1028
|
+
var __defProp$6 = Object.defineProperty;
|
|
1029
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1030
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1031
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1032
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1033
|
+
var __spreadValues$6 = (a, b) => {
|
|
1017
1034
|
for (var prop in b || (b = {}))
|
|
1018
|
-
if (__hasOwnProp$
|
|
1019
|
-
__defNormalProp$
|
|
1020
|
-
if (__getOwnPropSymbols$
|
|
1021
|
-
for (var prop of __getOwnPropSymbols$
|
|
1022
|
-
if (__propIsEnum$
|
|
1023
|
-
__defNormalProp$
|
|
1035
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
1036
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1037
|
+
if (__getOwnPropSymbols$8)
|
|
1038
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
1039
|
+
if (__propIsEnum$8.call(b, prop))
|
|
1040
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1024
1041
|
}
|
|
1025
1042
|
return a;
|
|
1026
1043
|
};
|
|
@@ -1032,7 +1049,7 @@
|
|
|
1032
1049
|
const counter = vueDemi.ref(0);
|
|
1033
1050
|
const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
|
|
1034
1051
|
if (exposeControls) {
|
|
1035
|
-
return __spreadValues$
|
|
1052
|
+
return __spreadValues$6({
|
|
1036
1053
|
counter
|
|
1037
1054
|
}, controls);
|
|
1038
1055
|
} else {
|
|
@@ -1085,19 +1102,19 @@
|
|
|
1085
1102
|
};
|
|
1086
1103
|
}
|
|
1087
1104
|
|
|
1088
|
-
var __defProp$
|
|
1089
|
-
var __getOwnPropSymbols$
|
|
1090
|
-
var __hasOwnProp$
|
|
1091
|
-
var __propIsEnum$
|
|
1092
|
-
var __defNormalProp$
|
|
1093
|
-
var __spreadValues$
|
|
1105
|
+
var __defProp$5 = Object.defineProperty;
|
|
1106
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1107
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1108
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1109
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1110
|
+
var __spreadValues$5 = (a, b) => {
|
|
1094
1111
|
for (var prop in b || (b = {}))
|
|
1095
|
-
if (__hasOwnProp$
|
|
1096
|
-
__defNormalProp$
|
|
1097
|
-
if (__getOwnPropSymbols$
|
|
1098
|
-
for (var prop of __getOwnPropSymbols$
|
|
1099
|
-
if (__propIsEnum$
|
|
1100
|
-
__defNormalProp$
|
|
1112
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
1113
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1114
|
+
if (__getOwnPropSymbols$7)
|
|
1115
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1116
|
+
if (__propIsEnum$7.call(b, prop))
|
|
1117
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1101
1118
|
}
|
|
1102
1119
|
return a;
|
|
1103
1120
|
};
|
|
@@ -1108,7 +1125,7 @@
|
|
|
1108
1125
|
const controls = useTimeoutFn(noop, interval, options);
|
|
1109
1126
|
const ready = vueDemi.computed(() => !controls.isPending.value);
|
|
1110
1127
|
if (exposeControls) {
|
|
1111
|
-
return __spreadValues$
|
|
1128
|
+
return __spreadValues$5({
|
|
1112
1129
|
ready
|
|
1113
1130
|
}, controls);
|
|
1114
1131
|
} else {
|
|
@@ -1138,17 +1155,17 @@
|
|
|
1138
1155
|
return [innerValue, toggle];
|
|
1139
1156
|
}
|
|
1140
1157
|
|
|
1141
|
-
var __getOwnPropSymbols$
|
|
1142
|
-
var __hasOwnProp$
|
|
1143
|
-
var __propIsEnum$
|
|
1158
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1159
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1160
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1144
1161
|
var __objRest$5 = (source, exclude) => {
|
|
1145
1162
|
var target = {};
|
|
1146
1163
|
for (var prop in source)
|
|
1147
|
-
if (__hasOwnProp$
|
|
1164
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1148
1165
|
target[prop] = source[prop];
|
|
1149
|
-
if (source != null && __getOwnPropSymbols$
|
|
1150
|
-
for (var prop of __getOwnPropSymbols$
|
|
1151
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1166
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
1167
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
1168
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
1152
1169
|
target[prop] = source[prop];
|
|
1153
1170
|
}
|
|
1154
1171
|
return target;
|
|
@@ -1162,17 +1179,17 @@
|
|
|
1162
1179
|
return vueDemi.watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
|
|
1163
1180
|
}
|
|
1164
1181
|
|
|
1165
|
-
var __getOwnPropSymbols$
|
|
1166
|
-
var __hasOwnProp$
|
|
1167
|
-
var __propIsEnum$
|
|
1182
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1183
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1184
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1168
1185
|
var __objRest$4 = (source, exclude) => {
|
|
1169
1186
|
var target = {};
|
|
1170
1187
|
for (var prop in source)
|
|
1171
|
-
if (__hasOwnProp$
|
|
1188
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1172
1189
|
target[prop] = source[prop];
|
|
1173
|
-
if (source != null && __getOwnPropSymbols$
|
|
1174
|
-
for (var prop of __getOwnPropSymbols$
|
|
1175
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1190
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
1191
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
1192
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
1176
1193
|
target[prop] = source[prop];
|
|
1177
1194
|
}
|
|
1178
1195
|
return target;
|
|
@@ -1193,33 +1210,33 @@
|
|
|
1193
1210
|
return { count: current, stop };
|
|
1194
1211
|
}
|
|
1195
1212
|
|
|
1196
|
-
var __defProp$
|
|
1197
|
-
var __defProps$
|
|
1198
|
-
var __getOwnPropDescs$
|
|
1199
|
-
var __getOwnPropSymbols$
|
|
1200
|
-
var __hasOwnProp$
|
|
1201
|
-
var __propIsEnum$
|
|
1202
|
-
var __defNormalProp$
|
|
1203
|
-
var __spreadValues$
|
|
1213
|
+
var __defProp$4 = Object.defineProperty;
|
|
1214
|
+
var __defProps$4 = Object.defineProperties;
|
|
1215
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1216
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1217
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1218
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1219
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1220
|
+
var __spreadValues$4 = (a, b) => {
|
|
1204
1221
|
for (var prop in b || (b = {}))
|
|
1205
|
-
if (__hasOwnProp$
|
|
1206
|
-
__defNormalProp$
|
|
1207
|
-
if (__getOwnPropSymbols$
|
|
1208
|
-
for (var prop of __getOwnPropSymbols$
|
|
1209
|
-
if (__propIsEnum$
|
|
1210
|
-
__defNormalProp$
|
|
1222
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
1223
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1224
|
+
if (__getOwnPropSymbols$4)
|
|
1225
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1226
|
+
if (__propIsEnum$4.call(b, prop))
|
|
1227
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1211
1228
|
}
|
|
1212
1229
|
return a;
|
|
1213
1230
|
};
|
|
1214
|
-
var __spreadProps$
|
|
1231
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1215
1232
|
var __objRest$3 = (source, exclude) => {
|
|
1216
1233
|
var target = {};
|
|
1217
1234
|
for (var prop in source)
|
|
1218
|
-
if (__hasOwnProp$
|
|
1235
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1219
1236
|
target[prop] = source[prop];
|
|
1220
|
-
if (source != null && __getOwnPropSymbols$
|
|
1221
|
-
for (var prop of __getOwnPropSymbols$
|
|
1222
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1237
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
1238
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1239
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1223
1240
|
target[prop] = source[prop];
|
|
1224
1241
|
}
|
|
1225
1242
|
return target;
|
|
@@ -1232,38 +1249,38 @@
|
|
|
1232
1249
|
"debounce",
|
|
1233
1250
|
"maxWait"
|
|
1234
1251
|
]);
|
|
1235
|
-
return watchWithFilter(source, cb, __spreadProps$
|
|
1252
|
+
return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$4({}, watchOptions), {
|
|
1236
1253
|
eventFilter: debounceFilter(debounce, { maxWait })
|
|
1237
1254
|
}));
|
|
1238
1255
|
}
|
|
1239
1256
|
|
|
1240
|
-
var __defProp$
|
|
1241
|
-
var __defProps$
|
|
1242
|
-
var __getOwnPropDescs$
|
|
1243
|
-
var __getOwnPropSymbols$
|
|
1244
|
-
var __hasOwnProp$
|
|
1245
|
-
var __propIsEnum$
|
|
1246
|
-
var __defNormalProp$
|
|
1247
|
-
var __spreadValues$
|
|
1257
|
+
var __defProp$3 = Object.defineProperty;
|
|
1258
|
+
var __defProps$3 = Object.defineProperties;
|
|
1259
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1260
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1261
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1262
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1263
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1264
|
+
var __spreadValues$3 = (a, b) => {
|
|
1248
1265
|
for (var prop in b || (b = {}))
|
|
1249
|
-
if (__hasOwnProp$
|
|
1250
|
-
__defNormalProp$
|
|
1251
|
-
if (__getOwnPropSymbols$
|
|
1252
|
-
for (var prop of __getOwnPropSymbols$
|
|
1253
|
-
if (__propIsEnum$
|
|
1254
|
-
__defNormalProp$
|
|
1266
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
1267
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1268
|
+
if (__getOwnPropSymbols$3)
|
|
1269
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1270
|
+
if (__propIsEnum$3.call(b, prop))
|
|
1271
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1255
1272
|
}
|
|
1256
1273
|
return a;
|
|
1257
1274
|
};
|
|
1258
|
-
var __spreadProps$
|
|
1275
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1259
1276
|
var __objRest$2 = (source, exclude) => {
|
|
1260
1277
|
var target = {};
|
|
1261
1278
|
for (var prop in source)
|
|
1262
|
-
if (__hasOwnProp$
|
|
1279
|
+
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1263
1280
|
target[prop] = source[prop];
|
|
1264
|
-
if (source != null && __getOwnPropSymbols$
|
|
1265
|
-
for (var prop of __getOwnPropSymbols$
|
|
1266
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1281
|
+
if (source != null && __getOwnPropSymbols$3)
|
|
1282
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
1283
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
1267
1284
|
target[prop] = source[prop];
|
|
1268
1285
|
}
|
|
1269
1286
|
return target;
|
|
@@ -1300,7 +1317,7 @@
|
|
|
1300
1317
|
};
|
|
1301
1318
|
disposables.push(vueDemi.watch(source, () => {
|
|
1302
1319
|
syncCounter.value++;
|
|
1303
|
-
}, __spreadProps$
|
|
1320
|
+
}, __spreadProps$3(__spreadValues$3({}, watchOptions), { flush: "sync" })));
|
|
1304
1321
|
ignoreUpdates = (updater) => {
|
|
1305
1322
|
const syncCounterPrev = syncCounter.value;
|
|
1306
1323
|
updater();
|
|
@@ -1328,6 +1345,50 @@
|
|
|
1328
1345
|
}, options);
|
|
1329
1346
|
}
|
|
1330
1347
|
|
|
1348
|
+
var __defProp$2 = Object.defineProperty;
|
|
1349
|
+
var __defProps$2 = Object.defineProperties;
|
|
1350
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1351
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1352
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1353
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1354
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1355
|
+
var __spreadValues$2 = (a, b) => {
|
|
1356
|
+
for (var prop in b || (b = {}))
|
|
1357
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
1358
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
1359
|
+
if (__getOwnPropSymbols$2)
|
|
1360
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1361
|
+
if (__propIsEnum$2.call(b, prop))
|
|
1362
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
1363
|
+
}
|
|
1364
|
+
return a;
|
|
1365
|
+
};
|
|
1366
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1367
|
+
var __objRest$1 = (source, exclude) => {
|
|
1368
|
+
var target = {};
|
|
1369
|
+
for (var prop in source)
|
|
1370
|
+
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1371
|
+
target[prop] = source[prop];
|
|
1372
|
+
if (source != null && __getOwnPropSymbols$2)
|
|
1373
|
+
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
1374
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
1375
|
+
target[prop] = source[prop];
|
|
1376
|
+
}
|
|
1377
|
+
return target;
|
|
1378
|
+
};
|
|
1379
|
+
function watchPausable(source, cb, options = {}) {
|
|
1380
|
+
const _a = options, {
|
|
1381
|
+
eventFilter: filter
|
|
1382
|
+
} = _a, watchOptions = __objRest$1(_a, [
|
|
1383
|
+
"eventFilter"
|
|
1384
|
+
]);
|
|
1385
|
+
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
1386
|
+
const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$2({}, watchOptions), {
|
|
1387
|
+
eventFilter
|
|
1388
|
+
}));
|
|
1389
|
+
return { stop, pause, resume, isActive };
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1331
1392
|
var __defProp$1 = Object.defineProperty;
|
|
1332
1393
|
var __defProps$1 = Object.defineProperties;
|
|
1333
1394
|
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
@@ -1347,7 +1408,7 @@
|
|
|
1347
1408
|
return a;
|
|
1348
1409
|
};
|
|
1349
1410
|
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1350
|
-
var __objRest
|
|
1411
|
+
var __objRest = (source, exclude) => {
|
|
1351
1412
|
var target = {};
|
|
1352
1413
|
for (var prop in source)
|
|
1353
1414
|
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
@@ -1359,17 +1420,19 @@
|
|
|
1359
1420
|
}
|
|
1360
1421
|
return target;
|
|
1361
1422
|
};
|
|
1362
|
-
function
|
|
1423
|
+
function watchThrottled(source, cb, options = {}) {
|
|
1363
1424
|
const _a = options, {
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1425
|
+
throttle = 0,
|
|
1426
|
+
trailing = true,
|
|
1427
|
+
leading = true
|
|
1428
|
+
} = _a, watchOptions = __objRest(_a, [
|
|
1429
|
+
"throttle",
|
|
1430
|
+
"trailing",
|
|
1431
|
+
"leading"
|
|
1367
1432
|
]);
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
eventFilter
|
|
1433
|
+
return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
|
|
1434
|
+
eventFilter: throttleFilter(throttle, trailing, leading)
|
|
1371
1435
|
}));
|
|
1372
|
-
return { stop, pause, resume, isActive };
|
|
1373
1436
|
}
|
|
1374
1437
|
|
|
1375
1438
|
var __defProp = Object.defineProperty;
|
|
@@ -1391,31 +1454,47 @@
|
|
|
1391
1454
|
return a;
|
|
1392
1455
|
};
|
|
1393
1456
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
if (
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
}
|
|
1457
|
+
function watchTriggerable(source, cb, options = {}) {
|
|
1458
|
+
let cleanupFn;
|
|
1459
|
+
function onEffect() {
|
|
1460
|
+
if (!cleanupFn)
|
|
1461
|
+
return;
|
|
1462
|
+
const fn = cleanupFn;
|
|
1463
|
+
cleanupFn = void 0;
|
|
1464
|
+
fn();
|
|
1465
|
+
}
|
|
1466
|
+
function onCleanup(callback) {
|
|
1467
|
+
cleanupFn = callback;
|
|
1468
|
+
}
|
|
1469
|
+
const _cb = (value, oldValue) => {
|
|
1470
|
+
onEffect();
|
|
1471
|
+
return cb(value, oldValue, onCleanup);
|
|
1472
|
+
};
|
|
1473
|
+
const res = watchIgnorable(source, _cb, options);
|
|
1474
|
+
const { ignoreUpdates } = res;
|
|
1475
|
+
const trigger = () => {
|
|
1476
|
+
let res2;
|
|
1477
|
+
ignoreUpdates(() => {
|
|
1478
|
+
res2 = _cb(getWatchSources(source), getOldValue(source));
|
|
1479
|
+
});
|
|
1480
|
+
return res2;
|
|
1481
|
+
};
|
|
1482
|
+
return __spreadProps(__spreadValues({}, res), {
|
|
1483
|
+
trigger
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
function getWatchSources(sources) {
|
|
1487
|
+
if (vueDemi.isReactive(sources))
|
|
1488
|
+
return sources;
|
|
1489
|
+
if (Array.isArray(sources))
|
|
1490
|
+
return sources.map((item) => getOneWatchSource(item));
|
|
1491
|
+
return getOneWatchSource(sources);
|
|
1492
|
+
}
|
|
1493
|
+
function getOneWatchSource(source) {
|
|
1494
|
+
return typeof source === "function" ? source() : vueDemi.unref(source);
|
|
1495
|
+
}
|
|
1496
|
+
function getOldValue(source) {
|
|
1497
|
+
return Array.isArray(source) ? source.map(() => void 0) : void 0;
|
|
1419
1498
|
}
|
|
1420
1499
|
|
|
1421
1500
|
function whenever(source, cb, options) {
|
|
@@ -1489,6 +1568,8 @@
|
|
|
1489
1568
|
exports.refDefault = refDefault;
|
|
1490
1569
|
exports.refThrottled = refThrottled;
|
|
1491
1570
|
exports.refWithControl = refWithControl;
|
|
1571
|
+
exports.resolveRef = resolveRef;
|
|
1572
|
+
exports.resolveUnref = resolveUnref;
|
|
1492
1573
|
exports.set = set;
|
|
1493
1574
|
exports.syncRef = syncRef;
|
|
1494
1575
|
exports.syncRefs = syncRefs;
|
|
@@ -1522,6 +1603,7 @@
|
|
|
1522
1603
|
exports.watchOnce = watchOnce;
|
|
1523
1604
|
exports.watchPausable = watchPausable;
|
|
1524
1605
|
exports.watchThrottled = watchThrottled;
|
|
1606
|
+
exports.watchTriggerable = watchTriggerable;
|
|
1525
1607
|
exports.watchWithFilter = watchWithFilter;
|
|
1526
1608
|
exports.whenever = whenever;
|
|
1527
1609
|
|