@vueuse/shared 7.7.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +788 -696
- package/index.d.ts +229 -182
- package/index.iife.js +788 -696
- package/index.iife.min.js +1 -1
- package/index.mjs +759 -684
- package/package.json +7 -7
package/index.iife.js
CHANGED
|
@@ -62,31 +62,37 @@
|
|
|
62
62
|
;(function (exports, vueDemi) {
|
|
63
63
|
'use strict';
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
var __defProp$8 = Object.defineProperty;
|
|
66
|
+
var __defProps$5 = Object.defineProperties;
|
|
67
|
+
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
68
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
69
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
70
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
71
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
72
|
+
var __spreadValues$8 = (a, b) => {
|
|
73
|
+
for (var prop in b || (b = {}))
|
|
74
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
75
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
76
|
+
if (__getOwnPropSymbols$a)
|
|
77
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
78
|
+
if (__propIsEnum$a.call(b, prop))
|
|
79
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
80
|
+
}
|
|
81
|
+
return a;
|
|
82
|
+
};
|
|
83
|
+
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
84
|
+
function computedEager(fn, options) {
|
|
85
|
+
var _a;
|
|
86
|
+
const result = vueDemi.shallowRef();
|
|
87
|
+
vueDemi.watchEffect(() => {
|
|
88
|
+
result.value = fn();
|
|
89
|
+
}, __spreadProps$5(__spreadValues$8({}, options), {
|
|
90
|
+
flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
|
|
91
|
+
}));
|
|
92
|
+
return vueDemi.readonly(result);
|
|
87
93
|
}
|
|
88
94
|
|
|
89
|
-
function
|
|
95
|
+
function computedWithControl(source, fn) {
|
|
90
96
|
let v = void 0;
|
|
91
97
|
let track;
|
|
92
98
|
let trigger;
|
|
@@ -113,81 +119,6 @@
|
|
|
113
119
|
});
|
|
114
120
|
}
|
|
115
121
|
|
|
116
|
-
function __onlyVue3(name = "this function") {
|
|
117
|
-
if (vueDemi.isVue3)
|
|
118
|
-
return;
|
|
119
|
-
throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
|
|
123
|
-
__onlyVue3();
|
|
124
|
-
for (const [key, value] of Object.entries(extend)) {
|
|
125
|
-
if (key === "value")
|
|
126
|
-
continue;
|
|
127
|
-
if (vueDemi.isRef(value) && unwrap) {
|
|
128
|
-
Object.defineProperty(ref, key, {
|
|
129
|
-
get() {
|
|
130
|
-
return value.value;
|
|
131
|
-
},
|
|
132
|
-
set(v) {
|
|
133
|
-
value.value = v;
|
|
134
|
-
},
|
|
135
|
-
enumerable
|
|
136
|
-
});
|
|
137
|
-
} else {
|
|
138
|
-
Object.defineProperty(ref, key, { value, enumerable });
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return ref;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function controlledRef(initial, options = {}) {
|
|
145
|
-
let source = initial;
|
|
146
|
-
let track;
|
|
147
|
-
let trigger;
|
|
148
|
-
const ref = vueDemi.customRef((_track, _trigger) => {
|
|
149
|
-
track = _track;
|
|
150
|
-
trigger = _trigger;
|
|
151
|
-
return {
|
|
152
|
-
get() {
|
|
153
|
-
return get();
|
|
154
|
-
},
|
|
155
|
-
set(v) {
|
|
156
|
-
set(v);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
});
|
|
160
|
-
function get(tracking = true) {
|
|
161
|
-
if (tracking)
|
|
162
|
-
track();
|
|
163
|
-
return source;
|
|
164
|
-
}
|
|
165
|
-
function set(value, triggering = true) {
|
|
166
|
-
var _a, _b;
|
|
167
|
-
if (value === source)
|
|
168
|
-
return;
|
|
169
|
-
const old = source;
|
|
170
|
-
if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)
|
|
171
|
-
return;
|
|
172
|
-
source = value;
|
|
173
|
-
(_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);
|
|
174
|
-
if (triggering)
|
|
175
|
-
trigger();
|
|
176
|
-
}
|
|
177
|
-
const untrackedGet = () => get(false);
|
|
178
|
-
const silentSet = (v) => set(v, false);
|
|
179
|
-
const peek = () => get(false);
|
|
180
|
-
const lay = (v) => set(v, false);
|
|
181
|
-
return extendRef(ref, {
|
|
182
|
-
get,
|
|
183
|
-
set,
|
|
184
|
-
untrackedGet,
|
|
185
|
-
silentSet,
|
|
186
|
-
peek,
|
|
187
|
-
lay
|
|
188
|
-
}, { enumerable: true });
|
|
189
|
-
}
|
|
190
|
-
|
|
191
122
|
function createEventHook() {
|
|
192
123
|
const fns = [];
|
|
193
124
|
const off = (fn) => {
|
|
@@ -224,12 +155,6 @@
|
|
|
224
155
|
};
|
|
225
156
|
}
|
|
226
157
|
|
|
227
|
-
function reactify(fn) {
|
|
228
|
-
return function(...args) {
|
|
229
|
-
return vueDemi.computed(() => fn.apply(this, args.map((i) => vueDemi.unref(i))));
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
|
|
233
158
|
function tryOnScopeDispose(fn) {
|
|
234
159
|
if (vueDemi.getCurrentScope()) {
|
|
235
160
|
vueDemi.onScopeDispose(fn);
|
|
@@ -261,126 +186,306 @@
|
|
|
261
186
|
};
|
|
262
187
|
}
|
|
263
188
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
};
|
|
270
|
-
const toString = Object.prototype.toString;
|
|
271
|
-
const isBoolean = (val) => typeof val === "boolean";
|
|
272
|
-
const isFunction = (val) => typeof val === "function";
|
|
273
|
-
const isNumber = (val) => typeof val === "number";
|
|
274
|
-
const isString = (val) => typeof val === "string";
|
|
275
|
-
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
276
|
-
const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
|
|
277
|
-
const now = () => Date.now();
|
|
278
|
-
const timestamp = () => +Date.now();
|
|
279
|
-
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
280
|
-
const noop = () => {
|
|
281
|
-
};
|
|
282
|
-
const rand = (min, max) => {
|
|
283
|
-
min = Math.ceil(min);
|
|
284
|
-
max = Math.floor(max);
|
|
285
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
286
|
-
};
|
|
189
|
+
function __onlyVue3(name = "this function") {
|
|
190
|
+
if (vueDemi.isVue3)
|
|
191
|
+
return;
|
|
192
|
+
throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
|
|
193
|
+
}
|
|
287
194
|
|
|
288
|
-
function
|
|
289
|
-
|
|
290
|
-
|
|
195
|
+
function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
|
|
196
|
+
__onlyVue3();
|
|
197
|
+
for (const [key, value] of Object.entries(extend)) {
|
|
198
|
+
if (key === "value")
|
|
199
|
+
continue;
|
|
200
|
+
if (vueDemi.isRef(value) && unwrap) {
|
|
201
|
+
Object.defineProperty(ref, key, {
|
|
202
|
+
get() {
|
|
203
|
+
return value.value;
|
|
204
|
+
},
|
|
205
|
+
set(v) {
|
|
206
|
+
value.value = v;
|
|
207
|
+
},
|
|
208
|
+
enumerable
|
|
209
|
+
});
|
|
210
|
+
} else {
|
|
211
|
+
Object.defineProperty(ref, key, { value, enumerable });
|
|
212
|
+
}
|
|
291
213
|
}
|
|
292
|
-
return
|
|
214
|
+
return ref;
|
|
293
215
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
let maxTimer;
|
|
300
|
-
const filter = (invoke) => {
|
|
301
|
-
const duration = vueDemi.unref(ms);
|
|
302
|
-
const maxDuration = vueDemi.unref(options.maxWait);
|
|
303
|
-
if (timer)
|
|
304
|
-
clearTimeout(timer);
|
|
305
|
-
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
306
|
-
if (maxTimer) {
|
|
307
|
-
clearTimeout(maxTimer);
|
|
308
|
-
maxTimer = null;
|
|
309
|
-
}
|
|
310
|
-
return invoke();
|
|
311
|
-
}
|
|
312
|
-
if (maxDuration && !maxTimer) {
|
|
313
|
-
maxTimer = setTimeout(() => {
|
|
314
|
-
if (timer)
|
|
315
|
-
clearTimeout(timer);
|
|
316
|
-
maxTimer = null;
|
|
317
|
-
invoke();
|
|
318
|
-
}, maxDuration);
|
|
319
|
-
}
|
|
320
|
-
timer = setTimeout(() => {
|
|
321
|
-
if (maxTimer)
|
|
322
|
-
clearTimeout(maxTimer);
|
|
323
|
-
maxTimer = null;
|
|
324
|
-
invoke();
|
|
325
|
-
}, duration);
|
|
326
|
-
};
|
|
327
|
-
return filter;
|
|
216
|
+
|
|
217
|
+
function get(obj, key) {
|
|
218
|
+
if (key == null)
|
|
219
|
+
return vueDemi.unref(obj);
|
|
220
|
+
return vueDemi.unref(obj)[key];
|
|
328
221
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
let preventLeading = !leading;
|
|
333
|
-
const clear = () => {
|
|
334
|
-
if (timer) {
|
|
335
|
-
clearTimeout(timer);
|
|
336
|
-
timer = void 0;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
const filter = (invoke) => {
|
|
340
|
-
const duration = vueDemi.unref(ms);
|
|
341
|
-
const elapsed = Date.now() - lastExec;
|
|
342
|
-
clear();
|
|
343
|
-
if (duration <= 0) {
|
|
344
|
-
lastExec = Date.now();
|
|
345
|
-
return invoke();
|
|
346
|
-
}
|
|
347
|
-
if (elapsed > duration) {
|
|
348
|
-
lastExec = Date.now();
|
|
349
|
-
if (preventLeading)
|
|
350
|
-
preventLeading = false;
|
|
351
|
-
else
|
|
352
|
-
invoke();
|
|
353
|
-
}
|
|
354
|
-
if (trailing) {
|
|
355
|
-
timer = setTimeout(() => {
|
|
356
|
-
lastExec = Date.now();
|
|
357
|
-
if (!leading)
|
|
358
|
-
preventLeading = true;
|
|
359
|
-
clear();
|
|
360
|
-
invoke();
|
|
361
|
-
}, duration);
|
|
362
|
-
}
|
|
363
|
-
if (!leading && !timer)
|
|
364
|
-
timer = setTimeout(() => preventLeading = true, duration);
|
|
365
|
-
};
|
|
366
|
-
return filter;
|
|
222
|
+
|
|
223
|
+
function isDefined(v) {
|
|
224
|
+
return vueDemi.unref(v) != null;
|
|
367
225
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
isActive.value = false;
|
|
372
|
-
}
|
|
373
|
-
function resume() {
|
|
374
|
-
isActive.value = true;
|
|
375
|
-
}
|
|
376
|
-
const eventFilter = (...args) => {
|
|
377
|
-
if (isActive.value)
|
|
378
|
-
extendFilter(...args);
|
|
379
|
-
};
|
|
380
|
-
return { isActive, pause, resume, eventFilter };
|
|
226
|
+
|
|
227
|
+
function logicAnd(...args) {
|
|
228
|
+
return vueDemi.computed(() => args.every((i) => vueDemi.unref(i)));
|
|
381
229
|
}
|
|
382
230
|
|
|
383
|
-
function
|
|
231
|
+
function logicNot(v) {
|
|
232
|
+
return vueDemi.computed(() => !vueDemi.unref(v));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function logicOr(...args) {
|
|
236
|
+
return vueDemi.computed(() => args.some((i) => vueDemi.unref(i)));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
var __defProp$7 = Object.defineProperty;
|
|
240
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
241
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
242
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
243
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
244
|
+
var __spreadValues$7 = (a, b) => {
|
|
245
|
+
for (var prop in b || (b = {}))
|
|
246
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
247
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
248
|
+
if (__getOwnPropSymbols$9)
|
|
249
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
250
|
+
if (__propIsEnum$9.call(b, prop))
|
|
251
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
252
|
+
}
|
|
253
|
+
return a;
|
|
254
|
+
};
|
|
255
|
+
function makeDestructurable(obj, arr) {
|
|
256
|
+
if (typeof Symbol !== "undefined") {
|
|
257
|
+
const clone = __spreadValues$7({}, obj);
|
|
258
|
+
Object.defineProperty(clone, Symbol.iterator, {
|
|
259
|
+
enumerable: false,
|
|
260
|
+
value() {
|
|
261
|
+
let index = 0;
|
|
262
|
+
return {
|
|
263
|
+
next: () => ({
|
|
264
|
+
value: arr[index++],
|
|
265
|
+
done: index > arr.length
|
|
266
|
+
})
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
return clone;
|
|
271
|
+
} else {
|
|
272
|
+
return Object.assign([...arr], obj);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function reactify(fn) {
|
|
277
|
+
return function(...args) {
|
|
278
|
+
return vueDemi.computed(() => fn.apply(this, args.map((i) => vueDemi.unref(i))));
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function reactifyObject(obj, optionsOrKeys = {}) {
|
|
283
|
+
let keys = [];
|
|
284
|
+
if (Array.isArray(optionsOrKeys)) {
|
|
285
|
+
keys = optionsOrKeys;
|
|
286
|
+
} else {
|
|
287
|
+
const { includeOwnProperties = true } = optionsOrKeys;
|
|
288
|
+
keys.push(...Object.keys(obj));
|
|
289
|
+
if (includeOwnProperties)
|
|
290
|
+
keys.push(...Object.getOwnPropertyNames(obj));
|
|
291
|
+
}
|
|
292
|
+
return Object.fromEntries(keys.map((key) => {
|
|
293
|
+
const value = obj[key];
|
|
294
|
+
return [
|
|
295
|
+
key,
|
|
296
|
+
typeof value === "function" ? reactify(value.bind(obj)) : value
|
|
297
|
+
];
|
|
298
|
+
}));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function toReactive(objectRef) {
|
|
302
|
+
if (!vueDemi.isRef(objectRef))
|
|
303
|
+
return vueDemi.reactive(objectRef);
|
|
304
|
+
const proxy = new Proxy({}, {
|
|
305
|
+
get(_, p, receiver) {
|
|
306
|
+
return vueDemi.unref(Reflect.get(objectRef.value, p, receiver));
|
|
307
|
+
},
|
|
308
|
+
set(_, p, value) {
|
|
309
|
+
if (vueDemi.isRef(objectRef.value[p]) && !vueDemi.isRef(value))
|
|
310
|
+
objectRef.value[p].value = value;
|
|
311
|
+
else
|
|
312
|
+
objectRef.value[p] = value;
|
|
313
|
+
return true;
|
|
314
|
+
},
|
|
315
|
+
deleteProperty(_, p) {
|
|
316
|
+
return Reflect.deleteProperty(objectRef.value, p);
|
|
317
|
+
},
|
|
318
|
+
has(_, p) {
|
|
319
|
+
return Reflect.has(objectRef.value, p);
|
|
320
|
+
},
|
|
321
|
+
ownKeys() {
|
|
322
|
+
return Object.keys(objectRef.value);
|
|
323
|
+
},
|
|
324
|
+
getOwnPropertyDescriptor() {
|
|
325
|
+
return {
|
|
326
|
+
enumerable: true,
|
|
327
|
+
configurable: true
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
return vueDemi.reactive(proxy);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function reactiveComputed(fn) {
|
|
335
|
+
return toReactive(vueDemi.computed(fn));
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function reactiveOmit(obj, ...keys) {
|
|
339
|
+
return reactiveComputed(() => Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !keys.includes(e[0]))));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function reactivePick(obj, ...keys) {
|
|
343
|
+
return vueDemi.reactive(Object.fromEntries(keys.map((k) => [k, vueDemi.toRef(obj, k)])));
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
347
|
+
return vueDemi.customRef((track, trigger) => {
|
|
348
|
+
let value = defaultValue;
|
|
349
|
+
let timer;
|
|
350
|
+
const resetAfter = () => setTimeout(() => {
|
|
351
|
+
value = defaultValue;
|
|
352
|
+
trigger();
|
|
353
|
+
}, vueDemi.unref(afterMs));
|
|
354
|
+
return {
|
|
355
|
+
get() {
|
|
356
|
+
track();
|
|
357
|
+
return value;
|
|
358
|
+
},
|
|
359
|
+
set(newValue) {
|
|
360
|
+
value = newValue;
|
|
361
|
+
trigger();
|
|
362
|
+
clearTimeout(timer);
|
|
363
|
+
timer = resetAfter();
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const isClient = typeof window !== "undefined";
|
|
370
|
+
const isDef = (val) => typeof val !== "undefined";
|
|
371
|
+
const assert = (condition, ...infos) => {
|
|
372
|
+
if (!condition)
|
|
373
|
+
console.warn(...infos);
|
|
374
|
+
};
|
|
375
|
+
const toString = Object.prototype.toString;
|
|
376
|
+
const isBoolean = (val) => typeof val === "boolean";
|
|
377
|
+
const isFunction = (val) => typeof val === "function";
|
|
378
|
+
const isNumber = (val) => typeof val === "number";
|
|
379
|
+
const isString = (val) => typeof val === "string";
|
|
380
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
381
|
+
const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
|
|
382
|
+
const now = () => Date.now();
|
|
383
|
+
const timestamp = () => +Date.now();
|
|
384
|
+
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
385
|
+
const noop = () => {
|
|
386
|
+
};
|
|
387
|
+
const rand = (min, max) => {
|
|
388
|
+
min = Math.ceil(min);
|
|
389
|
+
max = Math.floor(max);
|
|
390
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
function createFilterWrapper(filter, fn) {
|
|
394
|
+
function wrapper(...args) {
|
|
395
|
+
filter(() => fn.apply(this, args), { fn, thisArg: this, args });
|
|
396
|
+
}
|
|
397
|
+
return wrapper;
|
|
398
|
+
}
|
|
399
|
+
const bypassFilter = (invoke) => {
|
|
400
|
+
return invoke();
|
|
401
|
+
};
|
|
402
|
+
function debounceFilter(ms, options = {}) {
|
|
403
|
+
let timer;
|
|
404
|
+
let maxTimer;
|
|
405
|
+
const filter = (invoke) => {
|
|
406
|
+
const duration = vueDemi.unref(ms);
|
|
407
|
+
const maxDuration = vueDemi.unref(options.maxWait);
|
|
408
|
+
if (timer)
|
|
409
|
+
clearTimeout(timer);
|
|
410
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
411
|
+
if (maxTimer) {
|
|
412
|
+
clearTimeout(maxTimer);
|
|
413
|
+
maxTimer = null;
|
|
414
|
+
}
|
|
415
|
+
return invoke();
|
|
416
|
+
}
|
|
417
|
+
if (maxDuration && !maxTimer) {
|
|
418
|
+
maxTimer = setTimeout(() => {
|
|
419
|
+
if (timer)
|
|
420
|
+
clearTimeout(timer);
|
|
421
|
+
maxTimer = null;
|
|
422
|
+
invoke();
|
|
423
|
+
}, maxDuration);
|
|
424
|
+
}
|
|
425
|
+
timer = setTimeout(() => {
|
|
426
|
+
if (maxTimer)
|
|
427
|
+
clearTimeout(maxTimer);
|
|
428
|
+
maxTimer = null;
|
|
429
|
+
invoke();
|
|
430
|
+
}, duration);
|
|
431
|
+
};
|
|
432
|
+
return filter;
|
|
433
|
+
}
|
|
434
|
+
function throttleFilter(ms, trailing = true, leading = true) {
|
|
435
|
+
let lastExec = 0;
|
|
436
|
+
let timer;
|
|
437
|
+
let preventLeading = !leading;
|
|
438
|
+
const clear = () => {
|
|
439
|
+
if (timer) {
|
|
440
|
+
clearTimeout(timer);
|
|
441
|
+
timer = void 0;
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
const filter = (invoke) => {
|
|
445
|
+
const duration = vueDemi.unref(ms);
|
|
446
|
+
const elapsed = Date.now() - lastExec;
|
|
447
|
+
clear();
|
|
448
|
+
if (duration <= 0) {
|
|
449
|
+
lastExec = Date.now();
|
|
450
|
+
return invoke();
|
|
451
|
+
}
|
|
452
|
+
if (elapsed > duration) {
|
|
453
|
+
lastExec = Date.now();
|
|
454
|
+
if (preventLeading)
|
|
455
|
+
preventLeading = false;
|
|
456
|
+
else
|
|
457
|
+
invoke();
|
|
458
|
+
}
|
|
459
|
+
if (trailing) {
|
|
460
|
+
timer = setTimeout(() => {
|
|
461
|
+
lastExec = Date.now();
|
|
462
|
+
if (!leading)
|
|
463
|
+
preventLeading = true;
|
|
464
|
+
clear();
|
|
465
|
+
invoke();
|
|
466
|
+
}, duration);
|
|
467
|
+
}
|
|
468
|
+
if (!leading && !timer)
|
|
469
|
+
timer = setTimeout(() => preventLeading = true, duration);
|
|
470
|
+
};
|
|
471
|
+
return filter;
|
|
472
|
+
}
|
|
473
|
+
function pausableFilter(extendFilter = bypassFilter) {
|
|
474
|
+
const isActive = vueDemi.ref(true);
|
|
475
|
+
function pause() {
|
|
476
|
+
isActive.value = false;
|
|
477
|
+
}
|
|
478
|
+
function resume() {
|
|
479
|
+
isActive.value = true;
|
|
480
|
+
}
|
|
481
|
+
const eventFilter = (...args) => {
|
|
482
|
+
if (isActive.value)
|
|
483
|
+
extendFilter(...args);
|
|
484
|
+
};
|
|
485
|
+
return { isActive, pause, resume, eventFilter };
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
384
489
|
return new Promise((resolve, reject) => {
|
|
385
490
|
if (throwOnTimeout)
|
|
386
491
|
setTimeout(() => reject(reason), ms);
|
|
@@ -437,7 +542,7 @@
|
|
|
437
542
|
return createFilterWrapper(debounceFilter(ms, options), fn);
|
|
438
543
|
}
|
|
439
544
|
|
|
440
|
-
function
|
|
545
|
+
function refDebounced(value, ms = 200, options = {}) {
|
|
441
546
|
if (ms <= 0)
|
|
442
547
|
return value;
|
|
443
548
|
const debounced = vueDemi.ref(value.value);
|
|
@@ -448,349 +553,6 @@
|
|
|
448
553
|
return debounced;
|
|
449
554
|
}
|
|
450
555
|
|
|
451
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
452
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
453
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
454
|
-
var __objRest$5 = (source, exclude) => {
|
|
455
|
-
var target = {};
|
|
456
|
-
for (var prop in source)
|
|
457
|
-
if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
458
|
-
target[prop] = source[prop];
|
|
459
|
-
if (source != null && __getOwnPropSymbols$a)
|
|
460
|
-
for (var prop of __getOwnPropSymbols$a(source)) {
|
|
461
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
|
|
462
|
-
target[prop] = source[prop];
|
|
463
|
-
}
|
|
464
|
-
return target;
|
|
465
|
-
};
|
|
466
|
-
function watchWithFilter(source, cb, options = {}) {
|
|
467
|
-
const _a = options, {
|
|
468
|
-
eventFilter = bypassFilter
|
|
469
|
-
} = _a, watchOptions = __objRest$5(_a, [
|
|
470
|
-
"eventFilter"
|
|
471
|
-
]);
|
|
472
|
-
return vueDemi.watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
var __defProp$8 = Object.defineProperty;
|
|
476
|
-
var __defProps$5 = Object.defineProperties;
|
|
477
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
478
|
-
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
479
|
-
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
480
|
-
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
481
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
482
|
-
var __spreadValues$8 = (a, b) => {
|
|
483
|
-
for (var prop in b || (b = {}))
|
|
484
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
485
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
486
|
-
if (__getOwnPropSymbols$9)
|
|
487
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
488
|
-
if (__propIsEnum$9.call(b, prop))
|
|
489
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
490
|
-
}
|
|
491
|
-
return a;
|
|
492
|
-
};
|
|
493
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
494
|
-
var __objRest$4 = (source, exclude) => {
|
|
495
|
-
var target = {};
|
|
496
|
-
for (var prop in source)
|
|
497
|
-
if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
498
|
-
target[prop] = source[prop];
|
|
499
|
-
if (source != null && __getOwnPropSymbols$9)
|
|
500
|
-
for (var prop of __getOwnPropSymbols$9(source)) {
|
|
501
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
|
|
502
|
-
target[prop] = source[prop];
|
|
503
|
-
}
|
|
504
|
-
return target;
|
|
505
|
-
};
|
|
506
|
-
function debouncedWatch(source, cb, options = {}) {
|
|
507
|
-
const _a = options, {
|
|
508
|
-
debounce = 0
|
|
509
|
-
} = _a, watchOptions = __objRest$4(_a, [
|
|
510
|
-
"debounce"
|
|
511
|
-
]);
|
|
512
|
-
return watchWithFilter(source, cb, __spreadProps$5(__spreadValues$8({}, watchOptions), {
|
|
513
|
-
eventFilter: debounceFilter(debounce)
|
|
514
|
-
}));
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
var __defProp$7 = Object.defineProperty;
|
|
518
|
-
var __defProps$4 = Object.defineProperties;
|
|
519
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
520
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
521
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
522
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
523
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
524
|
-
var __spreadValues$7 = (a, b) => {
|
|
525
|
-
for (var prop in b || (b = {}))
|
|
526
|
-
if (__hasOwnProp$8.call(b, prop))
|
|
527
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
528
|
-
if (__getOwnPropSymbols$8)
|
|
529
|
-
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
530
|
-
if (__propIsEnum$8.call(b, prop))
|
|
531
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
532
|
-
}
|
|
533
|
-
return a;
|
|
534
|
-
};
|
|
535
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
536
|
-
function eagerComputed(fn, options) {
|
|
537
|
-
var _a;
|
|
538
|
-
const result = vueDemi.shallowRef();
|
|
539
|
-
vueDemi.watchEffect(() => {
|
|
540
|
-
result.value = fn();
|
|
541
|
-
}, __spreadProps$4(__spreadValues$7({}, options), {
|
|
542
|
-
flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
|
|
543
|
-
}));
|
|
544
|
-
return vueDemi.readonly(result);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function get(obj, key) {
|
|
548
|
-
if (key == null)
|
|
549
|
-
return vueDemi.unref(obj);
|
|
550
|
-
return vueDemi.unref(obj)[key];
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
var __defProp$6 = Object.defineProperty;
|
|
554
|
-
var __defProps$3 = Object.defineProperties;
|
|
555
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
556
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
557
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
558
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
559
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
560
|
-
var __spreadValues$6 = (a, b) => {
|
|
561
|
-
for (var prop in b || (b = {}))
|
|
562
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
563
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
564
|
-
if (__getOwnPropSymbols$7)
|
|
565
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
566
|
-
if (__propIsEnum$7.call(b, prop))
|
|
567
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
568
|
-
}
|
|
569
|
-
return a;
|
|
570
|
-
};
|
|
571
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
572
|
-
var __objRest$3 = (source, exclude) => {
|
|
573
|
-
var target = {};
|
|
574
|
-
for (var prop in source)
|
|
575
|
-
if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
576
|
-
target[prop] = source[prop];
|
|
577
|
-
if (source != null && __getOwnPropSymbols$7)
|
|
578
|
-
for (var prop of __getOwnPropSymbols$7(source)) {
|
|
579
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
|
|
580
|
-
target[prop] = source[prop];
|
|
581
|
-
}
|
|
582
|
-
return target;
|
|
583
|
-
};
|
|
584
|
-
function ignorableWatch(source, cb, options = {}) {
|
|
585
|
-
const _a = options, {
|
|
586
|
-
eventFilter = bypassFilter
|
|
587
|
-
} = _a, watchOptions = __objRest$3(_a, [
|
|
588
|
-
"eventFilter"
|
|
589
|
-
]);
|
|
590
|
-
const filteredCb = createFilterWrapper(eventFilter, cb);
|
|
591
|
-
let ignoreUpdates;
|
|
592
|
-
let ignorePrevAsyncUpdates;
|
|
593
|
-
let stop;
|
|
594
|
-
if (watchOptions.flush === "sync") {
|
|
595
|
-
const ignore = vueDemi.ref(false);
|
|
596
|
-
ignorePrevAsyncUpdates = () => {
|
|
597
|
-
};
|
|
598
|
-
ignoreUpdates = (updater) => {
|
|
599
|
-
ignore.value = true;
|
|
600
|
-
updater();
|
|
601
|
-
ignore.value = false;
|
|
602
|
-
};
|
|
603
|
-
stop = vueDemi.watch(source, (...args) => {
|
|
604
|
-
if (!ignore.value)
|
|
605
|
-
filteredCb(...args);
|
|
606
|
-
}, watchOptions);
|
|
607
|
-
} else {
|
|
608
|
-
const disposables = [];
|
|
609
|
-
const ignoreCounter = vueDemi.ref(0);
|
|
610
|
-
const syncCounter = vueDemi.ref(0);
|
|
611
|
-
ignorePrevAsyncUpdates = () => {
|
|
612
|
-
ignoreCounter.value = syncCounter.value;
|
|
613
|
-
};
|
|
614
|
-
disposables.push(vueDemi.watch(source, () => {
|
|
615
|
-
syncCounter.value++;
|
|
616
|
-
}, __spreadProps$3(__spreadValues$6({}, watchOptions), { flush: "sync" })));
|
|
617
|
-
ignoreUpdates = (updater) => {
|
|
618
|
-
const syncCounterPrev = syncCounter.value;
|
|
619
|
-
updater();
|
|
620
|
-
ignoreCounter.value += syncCounter.value - syncCounterPrev;
|
|
621
|
-
};
|
|
622
|
-
disposables.push(vueDemi.watch(source, (...args) => {
|
|
623
|
-
const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;
|
|
624
|
-
ignoreCounter.value = 0;
|
|
625
|
-
syncCounter.value = 0;
|
|
626
|
-
if (ignore)
|
|
627
|
-
return;
|
|
628
|
-
filteredCb(...args);
|
|
629
|
-
}, watchOptions));
|
|
630
|
-
stop = () => {
|
|
631
|
-
disposables.forEach((fn) => fn());
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
return { stop, ignoreUpdates, ignorePrevAsyncUpdates };
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
function isDefined(v) {
|
|
638
|
-
return vueDemi.unref(v) != null;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
var __defProp$5 = Object.defineProperty;
|
|
642
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
643
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
644
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
645
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
646
|
-
var __spreadValues$5 = (a, b) => {
|
|
647
|
-
for (var prop in b || (b = {}))
|
|
648
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
649
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
650
|
-
if (__getOwnPropSymbols$6)
|
|
651
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
652
|
-
if (__propIsEnum$6.call(b, prop))
|
|
653
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
654
|
-
}
|
|
655
|
-
return a;
|
|
656
|
-
};
|
|
657
|
-
function makeDestructurable(obj, arr) {
|
|
658
|
-
if (typeof Symbol !== "undefined") {
|
|
659
|
-
const clone = __spreadValues$5({}, obj);
|
|
660
|
-
Object.defineProperty(clone, Symbol.iterator, {
|
|
661
|
-
enumerable: false,
|
|
662
|
-
value() {
|
|
663
|
-
let index = 0;
|
|
664
|
-
return {
|
|
665
|
-
next: () => ({
|
|
666
|
-
value: arr[index++],
|
|
667
|
-
done: index > arr.length
|
|
668
|
-
})
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
});
|
|
672
|
-
return clone;
|
|
673
|
-
} else {
|
|
674
|
-
return Object.assign([...arr], obj);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
function not(v) {
|
|
679
|
-
return vueDemi.computed(() => !vueDemi.unref(v));
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
function or(...args) {
|
|
683
|
-
return vueDemi.computed(() => args.some((i) => vueDemi.unref(i)));
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
var __defProp$4 = Object.defineProperty;
|
|
687
|
-
var __defProps$2 = Object.defineProperties;
|
|
688
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
689
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
690
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
691
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
692
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
693
|
-
var __spreadValues$4 = (a, b) => {
|
|
694
|
-
for (var prop in b || (b = {}))
|
|
695
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
696
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
697
|
-
if (__getOwnPropSymbols$5)
|
|
698
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
699
|
-
if (__propIsEnum$5.call(b, prop))
|
|
700
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
701
|
-
}
|
|
702
|
-
return a;
|
|
703
|
-
};
|
|
704
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
705
|
-
var __objRest$2 = (source, exclude) => {
|
|
706
|
-
var target = {};
|
|
707
|
-
for (var prop in source)
|
|
708
|
-
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
709
|
-
target[prop] = source[prop];
|
|
710
|
-
if (source != null && __getOwnPropSymbols$5)
|
|
711
|
-
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
712
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
713
|
-
target[prop] = source[prop];
|
|
714
|
-
}
|
|
715
|
-
return target;
|
|
716
|
-
};
|
|
717
|
-
function pausableWatch(source, cb, options = {}) {
|
|
718
|
-
const _a = options, {
|
|
719
|
-
eventFilter: filter
|
|
720
|
-
} = _a, watchOptions = __objRest$2(_a, [
|
|
721
|
-
"eventFilter"
|
|
722
|
-
]);
|
|
723
|
-
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
724
|
-
const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$4({}, watchOptions), {
|
|
725
|
-
eventFilter
|
|
726
|
-
}));
|
|
727
|
-
return { stop, pause, resume, isActive };
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
function reactifyObject(obj, optionsOrKeys = {}) {
|
|
731
|
-
let keys = [];
|
|
732
|
-
if (Array.isArray(optionsOrKeys)) {
|
|
733
|
-
keys = optionsOrKeys;
|
|
734
|
-
} else {
|
|
735
|
-
const { includeOwnProperties = true } = optionsOrKeys;
|
|
736
|
-
keys.push(...Object.keys(obj));
|
|
737
|
-
if (includeOwnProperties)
|
|
738
|
-
keys.push(...Object.getOwnPropertyNames(obj));
|
|
739
|
-
}
|
|
740
|
-
return Object.fromEntries(keys.map((key) => {
|
|
741
|
-
const value = obj[key];
|
|
742
|
-
return [
|
|
743
|
-
key,
|
|
744
|
-
typeof value === "function" ? reactify(value.bind(obj)) : value
|
|
745
|
-
];
|
|
746
|
-
}));
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
function toReactive(objectRef) {
|
|
750
|
-
if (!vueDemi.isRef(objectRef))
|
|
751
|
-
return vueDemi.reactive(objectRef);
|
|
752
|
-
const proxy = new Proxy({}, {
|
|
753
|
-
get(_, p, receiver) {
|
|
754
|
-
return vueDemi.unref(Reflect.get(objectRef.value, p, receiver));
|
|
755
|
-
},
|
|
756
|
-
set(_, p, value) {
|
|
757
|
-
if (vueDemi.isRef(objectRef.value[p]) && !vueDemi.isRef(value))
|
|
758
|
-
objectRef.value[p].value = value;
|
|
759
|
-
else
|
|
760
|
-
objectRef.value[p] = value;
|
|
761
|
-
return true;
|
|
762
|
-
},
|
|
763
|
-
deleteProperty(_, p) {
|
|
764
|
-
return Reflect.deleteProperty(objectRef.value, p);
|
|
765
|
-
},
|
|
766
|
-
has(_, p) {
|
|
767
|
-
return Reflect.has(objectRef.value, p);
|
|
768
|
-
},
|
|
769
|
-
ownKeys() {
|
|
770
|
-
return Object.keys(objectRef.value);
|
|
771
|
-
},
|
|
772
|
-
getOwnPropertyDescriptor() {
|
|
773
|
-
return {
|
|
774
|
-
enumerable: true,
|
|
775
|
-
configurable: true
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
});
|
|
779
|
-
return vueDemi.reactive(proxy);
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
function reactiveComputed(fn) {
|
|
783
|
-
return toReactive(vueDemi.computed(fn));
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
function reactiveOmit(obj, ...keys) {
|
|
787
|
-
return reactiveComputed(() => Object.fromEntries(Object.entries(vueDemi.toRefs(obj)).filter((e) => !keys.includes(e[0]))));
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
function reactivePick(obj, ...keys) {
|
|
791
|
-
return vueDemi.reactive(Object.fromEntries(keys.map((k) => [k, vueDemi.toRef(obj, k)])));
|
|
792
|
-
}
|
|
793
|
-
|
|
794
556
|
function refDefault(source, defaultValue) {
|
|
795
557
|
return vueDemi.computed({
|
|
796
558
|
get() {
|
|
@@ -803,6 +565,69 @@
|
|
|
803
565
|
});
|
|
804
566
|
}
|
|
805
567
|
|
|
568
|
+
function useThrottleFn(fn, ms = 200, trailing = true, leading = true) {
|
|
569
|
+
return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
function refThrottled(value, delay = 200, trailing = true, leading = true) {
|
|
573
|
+
if (delay <= 0)
|
|
574
|
+
return value;
|
|
575
|
+
const throttled = vueDemi.ref(value.value);
|
|
576
|
+
const updater = useThrottleFn(() => {
|
|
577
|
+
throttled.value = value.value;
|
|
578
|
+
}, delay, trailing, leading);
|
|
579
|
+
vueDemi.watch(value, () => updater());
|
|
580
|
+
return throttled;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function refWithControl(initial, options = {}) {
|
|
584
|
+
let source = initial;
|
|
585
|
+
let track;
|
|
586
|
+
let trigger;
|
|
587
|
+
const ref = vueDemi.customRef((_track, _trigger) => {
|
|
588
|
+
track = _track;
|
|
589
|
+
trigger = _trigger;
|
|
590
|
+
return {
|
|
591
|
+
get() {
|
|
592
|
+
return get();
|
|
593
|
+
},
|
|
594
|
+
set(v) {
|
|
595
|
+
set(v);
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
});
|
|
599
|
+
function get(tracking = true) {
|
|
600
|
+
if (tracking)
|
|
601
|
+
track();
|
|
602
|
+
return source;
|
|
603
|
+
}
|
|
604
|
+
function set(value, triggering = true) {
|
|
605
|
+
var _a, _b;
|
|
606
|
+
if (value === source)
|
|
607
|
+
return;
|
|
608
|
+
const old = source;
|
|
609
|
+
if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)
|
|
610
|
+
return;
|
|
611
|
+
source = value;
|
|
612
|
+
(_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);
|
|
613
|
+
if (triggering)
|
|
614
|
+
trigger();
|
|
615
|
+
}
|
|
616
|
+
const untrackedGet = () => get(false);
|
|
617
|
+
const silentSet = (v) => set(v, false);
|
|
618
|
+
const peek = () => get(false);
|
|
619
|
+
const lay = (v) => set(v, false);
|
|
620
|
+
return extendRef(ref, {
|
|
621
|
+
get,
|
|
622
|
+
set,
|
|
623
|
+
untrackedGet,
|
|
624
|
+
silentSet,
|
|
625
|
+
peek,
|
|
626
|
+
lay
|
|
627
|
+
}, { enumerable: true });
|
|
628
|
+
}
|
|
629
|
+
const controlledRef = refWithControl;
|
|
630
|
+
|
|
806
631
|
function set(...args) {
|
|
807
632
|
if (args.length === 2) {
|
|
808
633
|
const [ref, value] = args;
|
|
@@ -818,96 +643,56 @@
|
|
|
818
643
|
}
|
|
819
644
|
}
|
|
820
645
|
|
|
821
|
-
function syncRef(
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
646
|
+
function syncRef(left, right, options = {}) {
|
|
647
|
+
const {
|
|
648
|
+
flush = "sync",
|
|
649
|
+
deep = false,
|
|
650
|
+
immediate = true,
|
|
651
|
+
direction = "both"
|
|
652
|
+
} = options;
|
|
653
|
+
let stop1, stop2;
|
|
654
|
+
if (direction === "both" || direction === "ltr") {
|
|
655
|
+
stop1 = vueDemi.watch(left, (newValue) => right.value = newValue, { flush, deep, immediate });
|
|
656
|
+
}
|
|
657
|
+
if (direction === "both" || direction === "rtl") {
|
|
658
|
+
stop2 = vueDemi.watch(right, (newValue) => left.value = newValue, { flush, deep, immediate });
|
|
659
|
+
}
|
|
660
|
+
return () => {
|
|
661
|
+
stop1 == null ? void 0 : stop1();
|
|
662
|
+
stop2 == null ? void 0 : stop2();
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function syncRefs(source, targets, options = {}) {
|
|
667
|
+
const {
|
|
668
|
+
flush = "sync",
|
|
669
|
+
deep = false,
|
|
670
|
+
immediate = true
|
|
671
|
+
} = options;
|
|
826
672
|
if (!Array.isArray(targets))
|
|
827
673
|
targets = [targets];
|
|
828
674
|
return vueDemi.watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
|
|
829
675
|
}
|
|
830
676
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
const updater = useThrottleFn(() => {
|
|
840
|
-
throttled.value = value.value;
|
|
841
|
-
}, delay, trailing, leading);
|
|
842
|
-
vueDemi.watch(value, () => updater());
|
|
843
|
-
return throttled;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
var __defProp$3 = Object.defineProperty;
|
|
847
|
-
var __defProps$1 = Object.defineProperties;
|
|
848
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
849
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
850
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
851
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
852
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
853
|
-
var __spreadValues$3 = (a, b) => {
|
|
854
|
-
for (var prop in b || (b = {}))
|
|
855
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
856
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
857
|
-
if (__getOwnPropSymbols$4)
|
|
858
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
859
|
-
if (__propIsEnum$4.call(b, prop))
|
|
860
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
861
|
-
}
|
|
862
|
-
return a;
|
|
863
|
-
};
|
|
864
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
865
|
-
var __objRest$1 = (source, exclude) => {
|
|
866
|
-
var target = {};
|
|
867
|
-
for (var prop in source)
|
|
868
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
869
|
-
target[prop] = source[prop];
|
|
870
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
871
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
872
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
873
|
-
target[prop] = source[prop];
|
|
874
|
-
}
|
|
875
|
-
return target;
|
|
876
|
-
};
|
|
877
|
-
function throttledWatch(source, cb, options = {}) {
|
|
878
|
-
const _a = options, {
|
|
879
|
-
throttle = 0,
|
|
880
|
-
trailing = true,
|
|
881
|
-
leading = true
|
|
882
|
-
} = _a, watchOptions = __objRest$1(_a, [
|
|
883
|
-
"throttle",
|
|
884
|
-
"trailing",
|
|
885
|
-
"leading"
|
|
886
|
-
]);
|
|
887
|
-
return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$3({}, watchOptions), {
|
|
888
|
-
eventFilter: throttleFilter(throttle, trailing, leading)
|
|
889
|
-
}));
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
var __defProp$2 = Object.defineProperty;
|
|
893
|
-
var __defProps = Object.defineProperties;
|
|
894
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
895
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
896
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
897
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
898
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
899
|
-
var __spreadValues$2 = (a, b) => {
|
|
677
|
+
var __defProp$6 = Object.defineProperty;
|
|
678
|
+
var __defProps$4 = Object.defineProperties;
|
|
679
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
680
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
681
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
682
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
683
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
684
|
+
var __spreadValues$6 = (a, b) => {
|
|
900
685
|
for (var prop in b || (b = {}))
|
|
901
|
-
if (__hasOwnProp$
|
|
902
|
-
__defNormalProp$
|
|
903
|
-
if (__getOwnPropSymbols$
|
|
904
|
-
for (var prop of __getOwnPropSymbols$
|
|
905
|
-
if (__propIsEnum$
|
|
906
|
-
__defNormalProp$
|
|
686
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
687
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
688
|
+
if (__getOwnPropSymbols$8)
|
|
689
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
690
|
+
if (__propIsEnum$8.call(b, prop))
|
|
691
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
907
692
|
}
|
|
908
693
|
return a;
|
|
909
694
|
};
|
|
910
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
695
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
911
696
|
function toRefs(objectRef) {
|
|
912
697
|
if (!vueDemi.isRef(objectRef))
|
|
913
698
|
return vueDemi.toRefs(objectRef);
|
|
@@ -923,7 +708,7 @@
|
|
|
923
708
|
copy[key] = v;
|
|
924
709
|
objectRef.value = copy;
|
|
925
710
|
} else {
|
|
926
|
-
objectRef.value = __spreadProps(__spreadValues$
|
|
711
|
+
objectRef.value = __spreadProps$4(__spreadValues$6({}, objectRef.value), { [key]: v });
|
|
927
712
|
}
|
|
928
713
|
}
|
|
929
714
|
}));
|
|
@@ -1053,6 +838,56 @@
|
|
|
1053
838
|
return { count, inc, dec, get, set, reset };
|
|
1054
839
|
}
|
|
1055
840
|
|
|
841
|
+
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
842
|
+
const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
843
|
+
const formatDate = (date, formatStr) => {
|
|
844
|
+
const years = date.getFullYear();
|
|
845
|
+
const month = date.getMonth();
|
|
846
|
+
const days = date.getDate();
|
|
847
|
+
const hours = date.getHours();
|
|
848
|
+
const minutes = date.getMinutes();
|
|
849
|
+
const seconds = date.getSeconds();
|
|
850
|
+
const milliseconds = date.getMilliseconds();
|
|
851
|
+
const matches = {
|
|
852
|
+
YY: String(years).slice(-2),
|
|
853
|
+
YYYY: years,
|
|
854
|
+
M: month + 1,
|
|
855
|
+
MM: `${month + 1}`.padStart(2, "0"),
|
|
856
|
+
D: String(days),
|
|
857
|
+
DD: `${days}`.padStart(2, "0"),
|
|
858
|
+
H: String(hours),
|
|
859
|
+
HH: `${hours}`.padStart(2, "0"),
|
|
860
|
+
h: `${hours % 12 || 12}`.padStart(1, "0"),
|
|
861
|
+
hh: `${hours % 12 || 12}`.padStart(2, "0"),
|
|
862
|
+
m: String(minutes),
|
|
863
|
+
mm: `${minutes}`.padStart(2, "0"),
|
|
864
|
+
s: String(seconds),
|
|
865
|
+
ss: `${seconds}`.padStart(2, "0"),
|
|
866
|
+
SSS: `${milliseconds}`.padStart(3, "0")
|
|
867
|
+
};
|
|
868
|
+
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]);
|
|
869
|
+
};
|
|
870
|
+
const normalizeDate = (date) => {
|
|
871
|
+
if (date === null)
|
|
872
|
+
return new Date(NaN);
|
|
873
|
+
if (date === void 0)
|
|
874
|
+
return new Date();
|
|
875
|
+
if (date instanceof Date)
|
|
876
|
+
return new Date(date);
|
|
877
|
+
if (typeof date === "string" && !/Z$/i.test(date)) {
|
|
878
|
+
const d = date.match(REGEX_PARSE);
|
|
879
|
+
if (d) {
|
|
880
|
+
const m = d[2] - 1 || 0;
|
|
881
|
+
const ms = (d[7] || "0").substring(0, 3);
|
|
882
|
+
return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return new Date(date);
|
|
886
|
+
};
|
|
887
|
+
function useDateFormat(date, formatStr = "HH:mm:ss") {
|
|
888
|
+
return vueDemi.computed(() => formatDate(normalizeDate(vueDemi.unref(date)), vueDemi.unref(formatStr)));
|
|
889
|
+
}
|
|
890
|
+
|
|
1056
891
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
1057
892
|
const {
|
|
1058
893
|
immediate = true,
|
|
@@ -1096,19 +931,19 @@
|
|
|
1096
931
|
};
|
|
1097
932
|
}
|
|
1098
933
|
|
|
1099
|
-
var __defProp$
|
|
1100
|
-
var __getOwnPropSymbols$
|
|
1101
|
-
var __hasOwnProp$
|
|
1102
|
-
var __propIsEnum$
|
|
1103
|
-
var __defNormalProp$
|
|
1104
|
-
var __spreadValues$
|
|
934
|
+
var __defProp$5 = Object.defineProperty;
|
|
935
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
936
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
937
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
938
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
939
|
+
var __spreadValues$5 = (a, b) => {
|
|
1105
940
|
for (var prop in b || (b = {}))
|
|
1106
|
-
if (__hasOwnProp$
|
|
1107
|
-
__defNormalProp$
|
|
1108
|
-
if (__getOwnPropSymbols$
|
|
1109
|
-
for (var prop of __getOwnPropSymbols$
|
|
1110
|
-
if (__propIsEnum$
|
|
1111
|
-
__defNormalProp$
|
|
941
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
942
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
943
|
+
if (__getOwnPropSymbols$7)
|
|
944
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
945
|
+
if (__propIsEnum$7.call(b, prop))
|
|
946
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1112
947
|
}
|
|
1113
948
|
return a;
|
|
1114
949
|
};
|
|
@@ -1120,7 +955,7 @@
|
|
|
1120
955
|
const counter = vueDemi.ref(0);
|
|
1121
956
|
const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
|
|
1122
957
|
if (exposeControls) {
|
|
1123
|
-
return __spreadValues$
|
|
958
|
+
return __spreadValues$5({
|
|
1124
959
|
counter
|
|
1125
960
|
}, controls);
|
|
1126
961
|
} else {
|
|
@@ -1169,23 +1004,23 @@
|
|
|
1169
1004
|
return {
|
|
1170
1005
|
isPending,
|
|
1171
1006
|
start,
|
|
1172
|
-
stop
|
|
1173
|
-
};
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
var __defProp = Object.defineProperty;
|
|
1177
|
-
var __getOwnPropSymbols$
|
|
1178
|
-
var __hasOwnProp$
|
|
1179
|
-
var __propIsEnum$
|
|
1180
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1181
|
-
var __spreadValues = (a, b) => {
|
|
1007
|
+
stop
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
var __defProp$4 = Object.defineProperty;
|
|
1012
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1013
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1014
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1015
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1016
|
+
var __spreadValues$4 = (a, b) => {
|
|
1182
1017
|
for (var prop in b || (b = {}))
|
|
1183
|
-
if (__hasOwnProp$
|
|
1184
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1185
|
-
if (__getOwnPropSymbols$
|
|
1186
|
-
for (var prop of __getOwnPropSymbols$
|
|
1187
|
-
if (__propIsEnum$
|
|
1188
|
-
__defNormalProp(a, prop, b[prop]);
|
|
1018
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
1019
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1020
|
+
if (__getOwnPropSymbols$6)
|
|
1021
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1022
|
+
if (__propIsEnum$6.call(b, prop))
|
|
1023
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1189
1024
|
}
|
|
1190
1025
|
return a;
|
|
1191
1026
|
};
|
|
@@ -1196,7 +1031,7 @@
|
|
|
1196
1031
|
const controls = useTimeoutFn(noop, interval, options);
|
|
1197
1032
|
const ready = vueDemi.computed(() => !controls.isPending.value);
|
|
1198
1033
|
if (exposeControls) {
|
|
1199
|
-
return __spreadValues({
|
|
1034
|
+
return __spreadValues$4({
|
|
1200
1035
|
ready
|
|
1201
1036
|
}, controls);
|
|
1202
1037
|
} else {
|
|
@@ -1220,17 +1055,41 @@
|
|
|
1220
1055
|
}
|
|
1221
1056
|
}
|
|
1222
1057
|
|
|
1223
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1224
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1225
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1226
|
-
var __objRest = (source, exclude) => {
|
|
1058
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1059
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1060
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1061
|
+
var __objRest$5 = (source, exclude) => {
|
|
1227
1062
|
var target = {};
|
|
1228
1063
|
for (var prop in source)
|
|
1229
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1064
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1230
1065
|
target[prop] = source[prop];
|
|
1231
|
-
if (source != null && __getOwnPropSymbols)
|
|
1232
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
1233
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
1066
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
1067
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
1068
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
1069
|
+
target[prop] = source[prop];
|
|
1070
|
+
}
|
|
1071
|
+
return target;
|
|
1072
|
+
};
|
|
1073
|
+
function watchWithFilter(source, cb, options = {}) {
|
|
1074
|
+
const _a = options, {
|
|
1075
|
+
eventFilter = bypassFilter
|
|
1076
|
+
} = _a, watchOptions = __objRest$5(_a, [
|
|
1077
|
+
"eventFilter"
|
|
1078
|
+
]);
|
|
1079
|
+
return vueDemi.watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1083
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1084
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1085
|
+
var __objRest$4 = (source, exclude) => {
|
|
1086
|
+
var target = {};
|
|
1087
|
+
for (var prop in source)
|
|
1088
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1089
|
+
target[prop] = source[prop];
|
|
1090
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
1091
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1092
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1234
1093
|
target[prop] = source[prop];
|
|
1235
1094
|
}
|
|
1236
1095
|
return target;
|
|
@@ -1238,7 +1097,7 @@
|
|
|
1238
1097
|
function watchAtMost(source, cb, options) {
|
|
1239
1098
|
const _a = options, {
|
|
1240
1099
|
count
|
|
1241
|
-
} = _a, watchOptions = __objRest(_a, [
|
|
1100
|
+
} = _a, watchOptions = __objRest$4(_a, [
|
|
1242
1101
|
"count"
|
|
1243
1102
|
]);
|
|
1244
1103
|
const current = vueDemi.ref(0);
|
|
@@ -1251,6 +1110,132 @@
|
|
|
1251
1110
|
return { count: current, stop };
|
|
1252
1111
|
}
|
|
1253
1112
|
|
|
1113
|
+
var __defProp$3 = Object.defineProperty;
|
|
1114
|
+
var __defProps$3 = Object.defineProperties;
|
|
1115
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1116
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1117
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1118
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1119
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1120
|
+
var __spreadValues$3 = (a, b) => {
|
|
1121
|
+
for (var prop in b || (b = {}))
|
|
1122
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
1123
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1124
|
+
if (__getOwnPropSymbols$3)
|
|
1125
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1126
|
+
if (__propIsEnum$3.call(b, prop))
|
|
1127
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1128
|
+
}
|
|
1129
|
+
return a;
|
|
1130
|
+
};
|
|
1131
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1132
|
+
var __objRest$3 = (source, exclude) => {
|
|
1133
|
+
var target = {};
|
|
1134
|
+
for (var prop in source)
|
|
1135
|
+
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1136
|
+
target[prop] = source[prop];
|
|
1137
|
+
if (source != null && __getOwnPropSymbols$3)
|
|
1138
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
1139
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
1140
|
+
target[prop] = source[prop];
|
|
1141
|
+
}
|
|
1142
|
+
return target;
|
|
1143
|
+
};
|
|
1144
|
+
function watchDebounced(source, cb, options = {}) {
|
|
1145
|
+
const _a = options, {
|
|
1146
|
+
debounce = 0
|
|
1147
|
+
} = _a, watchOptions = __objRest$3(_a, [
|
|
1148
|
+
"debounce"
|
|
1149
|
+
]);
|
|
1150
|
+
return watchWithFilter(source, cb, __spreadProps$3(__spreadValues$3({}, watchOptions), {
|
|
1151
|
+
eventFilter: debounceFilter(debounce)
|
|
1152
|
+
}));
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
var __defProp$2 = Object.defineProperty;
|
|
1156
|
+
var __defProps$2 = Object.defineProperties;
|
|
1157
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1158
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1159
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1160
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1161
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1162
|
+
var __spreadValues$2 = (a, b) => {
|
|
1163
|
+
for (var prop in b || (b = {}))
|
|
1164
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
1165
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
1166
|
+
if (__getOwnPropSymbols$2)
|
|
1167
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1168
|
+
if (__propIsEnum$2.call(b, prop))
|
|
1169
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
1170
|
+
}
|
|
1171
|
+
return a;
|
|
1172
|
+
};
|
|
1173
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1174
|
+
var __objRest$2 = (source, exclude) => {
|
|
1175
|
+
var target = {};
|
|
1176
|
+
for (var prop in source)
|
|
1177
|
+
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1178
|
+
target[prop] = source[prop];
|
|
1179
|
+
if (source != null && __getOwnPropSymbols$2)
|
|
1180
|
+
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
1181
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
1182
|
+
target[prop] = source[prop];
|
|
1183
|
+
}
|
|
1184
|
+
return target;
|
|
1185
|
+
};
|
|
1186
|
+
function watchIgnorable(source, cb, options = {}) {
|
|
1187
|
+
const _a = options, {
|
|
1188
|
+
eventFilter = bypassFilter
|
|
1189
|
+
} = _a, watchOptions = __objRest$2(_a, [
|
|
1190
|
+
"eventFilter"
|
|
1191
|
+
]);
|
|
1192
|
+
const filteredCb = createFilterWrapper(eventFilter, cb);
|
|
1193
|
+
let ignoreUpdates;
|
|
1194
|
+
let ignorePrevAsyncUpdates;
|
|
1195
|
+
let stop;
|
|
1196
|
+
if (watchOptions.flush === "sync") {
|
|
1197
|
+
const ignore = vueDemi.ref(false);
|
|
1198
|
+
ignorePrevAsyncUpdates = () => {
|
|
1199
|
+
};
|
|
1200
|
+
ignoreUpdates = (updater) => {
|
|
1201
|
+
ignore.value = true;
|
|
1202
|
+
updater();
|
|
1203
|
+
ignore.value = false;
|
|
1204
|
+
};
|
|
1205
|
+
stop = vueDemi.watch(source, (...args) => {
|
|
1206
|
+
if (!ignore.value)
|
|
1207
|
+
filteredCb(...args);
|
|
1208
|
+
}, watchOptions);
|
|
1209
|
+
} else {
|
|
1210
|
+
const disposables = [];
|
|
1211
|
+
const ignoreCounter = vueDemi.ref(0);
|
|
1212
|
+
const syncCounter = vueDemi.ref(0);
|
|
1213
|
+
ignorePrevAsyncUpdates = () => {
|
|
1214
|
+
ignoreCounter.value = syncCounter.value;
|
|
1215
|
+
};
|
|
1216
|
+
disposables.push(vueDemi.watch(source, () => {
|
|
1217
|
+
syncCounter.value++;
|
|
1218
|
+
}, __spreadProps$2(__spreadValues$2({}, watchOptions), { flush: "sync" })));
|
|
1219
|
+
ignoreUpdates = (updater) => {
|
|
1220
|
+
const syncCounterPrev = syncCounter.value;
|
|
1221
|
+
updater();
|
|
1222
|
+
ignoreCounter.value += syncCounter.value - syncCounterPrev;
|
|
1223
|
+
};
|
|
1224
|
+
disposables.push(vueDemi.watch(source, (...args) => {
|
|
1225
|
+
const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;
|
|
1226
|
+
ignoreCounter.value = 0;
|
|
1227
|
+
syncCounter.value = 0;
|
|
1228
|
+
if (ignore)
|
|
1229
|
+
return;
|
|
1230
|
+
filteredCb(...args);
|
|
1231
|
+
}, watchOptions));
|
|
1232
|
+
stop = () => {
|
|
1233
|
+
disposables.forEach((fn) => fn());
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
return { stop, ignoreUpdates, ignorePrevAsyncUpdates };
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1254
1239
|
function watchOnce(source, cb, options) {
|
|
1255
1240
|
const stop = vueDemi.watch(source, (...args) => {
|
|
1256
1241
|
vueDemi.nextTick(() => stop());
|
|
@@ -1258,6 +1243,96 @@
|
|
|
1258
1243
|
}, options);
|
|
1259
1244
|
}
|
|
1260
1245
|
|
|
1246
|
+
var __defProp$1 = Object.defineProperty;
|
|
1247
|
+
var __defProps$1 = Object.defineProperties;
|
|
1248
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
1249
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
1250
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
1251
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
1252
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1253
|
+
var __spreadValues$1 = (a, b) => {
|
|
1254
|
+
for (var prop in b || (b = {}))
|
|
1255
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
1256
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
1257
|
+
if (__getOwnPropSymbols$1)
|
|
1258
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
1259
|
+
if (__propIsEnum$1.call(b, prop))
|
|
1260
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
1261
|
+
}
|
|
1262
|
+
return a;
|
|
1263
|
+
};
|
|
1264
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1265
|
+
var __objRest$1 = (source, exclude) => {
|
|
1266
|
+
var target = {};
|
|
1267
|
+
for (var prop in source)
|
|
1268
|
+
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1269
|
+
target[prop] = source[prop];
|
|
1270
|
+
if (source != null && __getOwnPropSymbols$1)
|
|
1271
|
+
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
1272
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
1273
|
+
target[prop] = source[prop];
|
|
1274
|
+
}
|
|
1275
|
+
return target;
|
|
1276
|
+
};
|
|
1277
|
+
function watchPausable(source, cb, options = {}) {
|
|
1278
|
+
const _a = options, {
|
|
1279
|
+
eventFilter: filter
|
|
1280
|
+
} = _a, watchOptions = __objRest$1(_a, [
|
|
1281
|
+
"eventFilter"
|
|
1282
|
+
]);
|
|
1283
|
+
const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
|
|
1284
|
+
const stop = watchWithFilter(source, cb, __spreadProps$1(__spreadValues$1({}, watchOptions), {
|
|
1285
|
+
eventFilter
|
|
1286
|
+
}));
|
|
1287
|
+
return { stop, pause, resume, isActive };
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
var __defProp = Object.defineProperty;
|
|
1291
|
+
var __defProps = Object.defineProperties;
|
|
1292
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
1293
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
1294
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1295
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
1296
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1297
|
+
var __spreadValues = (a, b) => {
|
|
1298
|
+
for (var prop in b || (b = {}))
|
|
1299
|
+
if (__hasOwnProp.call(b, prop))
|
|
1300
|
+
__defNormalProp(a, prop, b[prop]);
|
|
1301
|
+
if (__getOwnPropSymbols)
|
|
1302
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
1303
|
+
if (__propIsEnum.call(b, prop))
|
|
1304
|
+
__defNormalProp(a, prop, b[prop]);
|
|
1305
|
+
}
|
|
1306
|
+
return a;
|
|
1307
|
+
};
|
|
1308
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
1309
|
+
var __objRest = (source, exclude) => {
|
|
1310
|
+
var target = {};
|
|
1311
|
+
for (var prop in source)
|
|
1312
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1313
|
+
target[prop] = source[prop];
|
|
1314
|
+
if (source != null && __getOwnPropSymbols)
|
|
1315
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
1316
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
1317
|
+
target[prop] = source[prop];
|
|
1318
|
+
}
|
|
1319
|
+
return target;
|
|
1320
|
+
};
|
|
1321
|
+
function watchThrottled(source, cb, options = {}) {
|
|
1322
|
+
const _a = options, {
|
|
1323
|
+
throttle = 0,
|
|
1324
|
+
trailing = true,
|
|
1325
|
+
leading = true
|
|
1326
|
+
} = _a, watchOptions = __objRest(_a, [
|
|
1327
|
+
"throttle",
|
|
1328
|
+
"trailing",
|
|
1329
|
+
"leading"
|
|
1330
|
+
]);
|
|
1331
|
+
return watchWithFilter(source, cb, __spreadProps(__spreadValues({}, watchOptions), {
|
|
1332
|
+
eventFilter: throttleFilter(throttle, trailing, leading)
|
|
1333
|
+
}));
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1261
1336
|
function whenever(source, cb, options) {
|
|
1262
1337
|
return vueDemi.watch(source, (v, ov, onInvalidate) => {
|
|
1263
1338
|
if (v)
|
|
@@ -1265,13 +1340,15 @@
|
|
|
1265
1340
|
}, options);
|
|
1266
1341
|
}
|
|
1267
1342
|
|
|
1268
|
-
exports.and =
|
|
1343
|
+
exports.and = logicAnd;
|
|
1269
1344
|
exports.assert = assert;
|
|
1270
|
-
exports.
|
|
1345
|
+
exports.autoResetRef = refAutoReset;
|
|
1271
1346
|
exports.bypassFilter = bypassFilter;
|
|
1272
1347
|
exports.clamp = clamp;
|
|
1348
|
+
exports.computedEager = computedEager;
|
|
1349
|
+
exports.computedWithControl = computedWithControl;
|
|
1273
1350
|
exports.containsProp = containsProp;
|
|
1274
|
-
exports.controlledComputed =
|
|
1351
|
+
exports.controlledComputed = computedWithControl;
|
|
1275
1352
|
exports.controlledRef = controlledRef;
|
|
1276
1353
|
exports.createEventHook = createEventHook;
|
|
1277
1354
|
exports.createFilterWrapper = createFilterWrapper;
|
|
@@ -1280,13 +1357,14 @@
|
|
|
1280
1357
|
exports.createSharedComposable = createSharedComposable;
|
|
1281
1358
|
exports.createSingletonPromise = createSingletonPromise;
|
|
1282
1359
|
exports.debounceFilter = debounceFilter;
|
|
1283
|
-
exports.debouncedRef =
|
|
1284
|
-
exports.debouncedWatch =
|
|
1285
|
-
exports.eagerComputed =
|
|
1360
|
+
exports.debouncedRef = refDebounced;
|
|
1361
|
+
exports.debouncedWatch = watchDebounced;
|
|
1362
|
+
exports.eagerComputed = computedEager;
|
|
1286
1363
|
exports.extendRef = extendRef;
|
|
1364
|
+
exports.formatDate = formatDate;
|
|
1287
1365
|
exports.get = get;
|
|
1288
1366
|
exports.identity = identity;
|
|
1289
|
-
exports.ignorableWatch =
|
|
1367
|
+
exports.ignorableWatch = watchIgnorable;
|
|
1290
1368
|
exports.increaseWithUnit = increaseWithUnit;
|
|
1291
1369
|
exports.invoke = invoke;
|
|
1292
1370
|
exports.isBoolean = isBoolean;
|
|
@@ -1298,14 +1376,18 @@
|
|
|
1298
1376
|
exports.isObject = isObject;
|
|
1299
1377
|
exports.isString = isString;
|
|
1300
1378
|
exports.isWindow = isWindow;
|
|
1379
|
+
exports.logicAnd = logicAnd;
|
|
1380
|
+
exports.logicNot = logicNot;
|
|
1381
|
+
exports.logicOr = logicOr;
|
|
1301
1382
|
exports.makeDestructurable = makeDestructurable;
|
|
1302
1383
|
exports.noop = noop;
|
|
1303
|
-
exports.
|
|
1384
|
+
exports.normalizeDate = normalizeDate;
|
|
1385
|
+
exports.not = logicNot;
|
|
1304
1386
|
exports.now = now;
|
|
1305
1387
|
exports.objectPick = objectPick;
|
|
1306
|
-
exports.or =
|
|
1388
|
+
exports.or = logicOr;
|
|
1307
1389
|
exports.pausableFilter = pausableFilter;
|
|
1308
|
-
exports.pausableWatch =
|
|
1390
|
+
exports.pausableWatch = watchPausable;
|
|
1309
1391
|
exports.promiseTimeout = promiseTimeout;
|
|
1310
1392
|
exports.rand = rand;
|
|
1311
1393
|
exports.reactify = reactify;
|
|
@@ -1313,12 +1395,17 @@
|
|
|
1313
1395
|
exports.reactiveComputed = reactiveComputed;
|
|
1314
1396
|
exports.reactiveOmit = reactiveOmit;
|
|
1315
1397
|
exports.reactivePick = reactivePick;
|
|
1398
|
+
exports.refAutoReset = refAutoReset;
|
|
1399
|
+
exports.refDebounced = refDebounced;
|
|
1316
1400
|
exports.refDefault = refDefault;
|
|
1401
|
+
exports.refThrottled = refThrottled;
|
|
1402
|
+
exports.refWithControl = refWithControl;
|
|
1317
1403
|
exports.set = set;
|
|
1318
1404
|
exports.syncRef = syncRef;
|
|
1405
|
+
exports.syncRefs = syncRefs;
|
|
1319
1406
|
exports.throttleFilter = throttleFilter;
|
|
1320
|
-
exports.throttledRef =
|
|
1321
|
-
exports.throttledWatch =
|
|
1407
|
+
exports.throttledRef = refThrottled;
|
|
1408
|
+
exports.throttledWatch = watchThrottled;
|
|
1322
1409
|
exports.timestamp = timestamp;
|
|
1323
1410
|
exports.toReactive = toReactive;
|
|
1324
1411
|
exports.toRefs = toRefs;
|
|
@@ -1328,18 +1415,23 @@
|
|
|
1328
1415
|
exports.tryOnUnmounted = tryOnUnmounted;
|
|
1329
1416
|
exports.until = until;
|
|
1330
1417
|
exports.useCounter = useCounter;
|
|
1331
|
-
exports.
|
|
1418
|
+
exports.useDateFormat = useDateFormat;
|
|
1419
|
+
exports.useDebounce = refDebounced;
|
|
1332
1420
|
exports.useDebounceFn = useDebounceFn;
|
|
1333
1421
|
exports.useInterval = useInterval;
|
|
1334
1422
|
exports.useIntervalFn = useIntervalFn;
|
|
1335
1423
|
exports.useLastChanged = useLastChanged;
|
|
1336
|
-
exports.useThrottle =
|
|
1424
|
+
exports.useThrottle = refThrottled;
|
|
1337
1425
|
exports.useThrottleFn = useThrottleFn;
|
|
1338
1426
|
exports.useTimeout = useTimeout;
|
|
1339
1427
|
exports.useTimeoutFn = useTimeoutFn;
|
|
1340
1428
|
exports.useToggle = useToggle;
|
|
1341
1429
|
exports.watchAtMost = watchAtMost;
|
|
1430
|
+
exports.watchDebounced = watchDebounced;
|
|
1431
|
+
exports.watchIgnorable = watchIgnorable;
|
|
1342
1432
|
exports.watchOnce = watchOnce;
|
|
1433
|
+
exports.watchPausable = watchPausable;
|
|
1434
|
+
exports.watchThrottled = watchThrottled;
|
|
1343
1435
|
exports.watchWithFilter = watchWithFilter;
|
|
1344
1436
|
exports.whenever = whenever;
|
|
1345
1437
|
|