@vueuse/shared 10.0.0-beta.4 → 10.0.0-beta.5
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 +219 -234
- package/index.d.ts +1 -8
- package/index.iife.js +219 -234
- package/index.iife.min.js +1 -1
- package/index.mjs +221 -229
- package/package.json +2 -2
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowRef, watchEffect, readonly,
|
|
1
|
+
import { shallowRef, watchEffect, readonly, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, provide, inject, isVue3, version, isRef, unref, computed, reactive, toRefs as toRefs$1, toRef as toRef$1, isVue2, set as set$1, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, isReactive } from 'vue-demi';
|
|
2
2
|
|
|
3
3
|
var __defProp$b = Object.defineProperty;
|
|
4
4
|
var __defProps$8 = Object.defineProperties;
|
|
@@ -30,228 +30,6 @@ function computedEager(fn, options) {
|
|
|
30
30
|
return readonly(result);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
var _a;
|
|
34
|
-
const isClient = typeof window !== "undefined";
|
|
35
|
-
const isDef = (val) => typeof val !== "undefined";
|
|
36
|
-
const assert = (condition, ...infos) => {
|
|
37
|
-
if (!condition)
|
|
38
|
-
console.warn(...infos);
|
|
39
|
-
};
|
|
40
|
-
const toString = Object.prototype.toString;
|
|
41
|
-
const isBoolean = (val) => typeof val === "boolean";
|
|
42
|
-
const isFunction = (val) => typeof val === "function";
|
|
43
|
-
const isNumber = (val) => typeof val === "number";
|
|
44
|
-
const isString = (val) => typeof val === "string";
|
|
45
|
-
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
46
|
-
const isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
|
|
47
|
-
const now = () => Date.now();
|
|
48
|
-
const timestamp = () => +Date.now();
|
|
49
|
-
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
50
|
-
const noop = () => {
|
|
51
|
-
};
|
|
52
|
-
const rand = (min, max) => {
|
|
53
|
-
min = Math.ceil(min);
|
|
54
|
-
max = Math.floor(max);
|
|
55
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
56
|
-
};
|
|
57
|
-
const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
|
|
58
|
-
const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
59
|
-
|
|
60
|
-
function toValue(r) {
|
|
61
|
-
return typeof r === "function" ? r() : unref(r);
|
|
62
|
-
}
|
|
63
|
-
const resolveUnref = toValue;
|
|
64
|
-
|
|
65
|
-
function createFilterWrapper(filter, fn) {
|
|
66
|
-
function wrapper(...args) {
|
|
67
|
-
return new Promise((resolve, reject) => {
|
|
68
|
-
Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return wrapper;
|
|
72
|
-
}
|
|
73
|
-
const bypassFilter = (invoke) => {
|
|
74
|
-
return invoke();
|
|
75
|
-
};
|
|
76
|
-
function debounceFilter(ms, options = {}) {
|
|
77
|
-
let timer;
|
|
78
|
-
let maxTimer;
|
|
79
|
-
let lastRejector = noop;
|
|
80
|
-
const _clearTimeout = (timer2) => {
|
|
81
|
-
clearTimeout(timer2);
|
|
82
|
-
lastRejector();
|
|
83
|
-
lastRejector = noop;
|
|
84
|
-
};
|
|
85
|
-
const filter = (invoke) => {
|
|
86
|
-
const duration = toValue(ms);
|
|
87
|
-
const maxDuration = toValue(options.maxWait);
|
|
88
|
-
if (timer)
|
|
89
|
-
_clearTimeout(timer);
|
|
90
|
-
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
91
|
-
if (maxTimer) {
|
|
92
|
-
_clearTimeout(maxTimer);
|
|
93
|
-
maxTimer = null;
|
|
94
|
-
}
|
|
95
|
-
return Promise.resolve(invoke());
|
|
96
|
-
}
|
|
97
|
-
return new Promise((resolve, reject) => {
|
|
98
|
-
lastRejector = options.rejectOnCancel ? reject : resolve;
|
|
99
|
-
if (maxDuration && !maxTimer) {
|
|
100
|
-
maxTimer = setTimeout(() => {
|
|
101
|
-
if (timer)
|
|
102
|
-
_clearTimeout(timer);
|
|
103
|
-
maxTimer = null;
|
|
104
|
-
resolve(invoke());
|
|
105
|
-
}, maxDuration);
|
|
106
|
-
}
|
|
107
|
-
timer = setTimeout(() => {
|
|
108
|
-
if (maxTimer)
|
|
109
|
-
_clearTimeout(maxTimer);
|
|
110
|
-
maxTimer = null;
|
|
111
|
-
resolve(invoke());
|
|
112
|
-
}, duration);
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
return filter;
|
|
116
|
-
}
|
|
117
|
-
function throttleFilter(ms, trailing = true, leading = true, rejectOnCancel = false) {
|
|
118
|
-
let lastExec = 0;
|
|
119
|
-
let timer;
|
|
120
|
-
let isLeading = true;
|
|
121
|
-
let lastRejector = noop;
|
|
122
|
-
let lastValue;
|
|
123
|
-
const clear = () => {
|
|
124
|
-
if (timer) {
|
|
125
|
-
clearTimeout(timer);
|
|
126
|
-
timer = void 0;
|
|
127
|
-
lastRejector();
|
|
128
|
-
lastRejector = noop;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
const filter = (_invoke) => {
|
|
132
|
-
const duration = toValue(ms);
|
|
133
|
-
const elapsed = Date.now() - lastExec;
|
|
134
|
-
const invoke = () => {
|
|
135
|
-
return lastValue = _invoke();
|
|
136
|
-
};
|
|
137
|
-
clear();
|
|
138
|
-
if (duration <= 0) {
|
|
139
|
-
lastExec = Date.now();
|
|
140
|
-
return invoke();
|
|
141
|
-
}
|
|
142
|
-
if (elapsed > duration && (leading || !isLeading)) {
|
|
143
|
-
lastExec = Date.now();
|
|
144
|
-
invoke();
|
|
145
|
-
} else if (trailing) {
|
|
146
|
-
lastValue = new Promise((resolve, reject) => {
|
|
147
|
-
lastRejector = rejectOnCancel ? reject : resolve;
|
|
148
|
-
timer = setTimeout(() => {
|
|
149
|
-
lastExec = Date.now();
|
|
150
|
-
isLeading = true;
|
|
151
|
-
resolve(invoke());
|
|
152
|
-
clear();
|
|
153
|
-
}, Math.max(0, duration - elapsed));
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if (!leading && !timer)
|
|
157
|
-
timer = setTimeout(() => isLeading = true, duration);
|
|
158
|
-
isLeading = false;
|
|
159
|
-
return lastValue;
|
|
160
|
-
};
|
|
161
|
-
return filter;
|
|
162
|
-
}
|
|
163
|
-
function pausableFilter(extendFilter = bypassFilter) {
|
|
164
|
-
const isActive = ref(true);
|
|
165
|
-
function pause() {
|
|
166
|
-
isActive.value = false;
|
|
167
|
-
}
|
|
168
|
-
function resume() {
|
|
169
|
-
isActive.value = true;
|
|
170
|
-
}
|
|
171
|
-
const eventFilter = (...args) => {
|
|
172
|
-
if (isActive.value)
|
|
173
|
-
extendFilter(...args);
|
|
174
|
-
};
|
|
175
|
-
return { isActive: readonly(isActive), pause, resume, eventFilter };
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function __onlyVue3(name = "this function") {
|
|
179
|
-
if (isVue3)
|
|
180
|
-
return;
|
|
181
|
-
throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
|
|
182
|
-
}
|
|
183
|
-
function __onlyVue27Plus(name = "this function") {
|
|
184
|
-
if (isVue3 || version.startsWith("2.7."))
|
|
185
|
-
return;
|
|
186
|
-
throw new Error(`[VueUse] ${name} is only works on Vue 2.7 or above.`);
|
|
187
|
-
}
|
|
188
|
-
const directiveHooks = {
|
|
189
|
-
mounted: isVue3 ? "mounted" : "inserted",
|
|
190
|
-
updated: isVue3 ? "updated" : "componentUpdated",
|
|
191
|
-
unmounted: isVue3 ? "unmounted" : "unbind"
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
195
|
-
return new Promise((resolve, reject) => {
|
|
196
|
-
if (throwOnTimeout)
|
|
197
|
-
setTimeout(() => reject(reason), ms);
|
|
198
|
-
else
|
|
199
|
-
setTimeout(resolve, ms);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
function identity(arg) {
|
|
203
|
-
return arg;
|
|
204
|
-
}
|
|
205
|
-
function createSingletonPromise(fn) {
|
|
206
|
-
let _promise;
|
|
207
|
-
function wrapper() {
|
|
208
|
-
if (!_promise)
|
|
209
|
-
_promise = fn();
|
|
210
|
-
return _promise;
|
|
211
|
-
}
|
|
212
|
-
wrapper.reset = async () => {
|
|
213
|
-
const _prev = _promise;
|
|
214
|
-
_promise = void 0;
|
|
215
|
-
if (_prev)
|
|
216
|
-
await _prev;
|
|
217
|
-
};
|
|
218
|
-
return wrapper;
|
|
219
|
-
}
|
|
220
|
-
function invoke(fn) {
|
|
221
|
-
return fn();
|
|
222
|
-
}
|
|
223
|
-
function containsProp(obj, ...props) {
|
|
224
|
-
return props.some((k) => k in obj);
|
|
225
|
-
}
|
|
226
|
-
function increaseWithUnit(target, delta) {
|
|
227
|
-
var _a;
|
|
228
|
-
if (typeof target === "number")
|
|
229
|
-
return target + delta;
|
|
230
|
-
const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
|
|
231
|
-
const unit = target.slice(value.length);
|
|
232
|
-
const result = parseFloat(value) + delta;
|
|
233
|
-
if (Number.isNaN(result))
|
|
234
|
-
return target;
|
|
235
|
-
return result + unit;
|
|
236
|
-
}
|
|
237
|
-
function objectPick(obj, keys, omitUndefined = false) {
|
|
238
|
-
return keys.reduce((n, k) => {
|
|
239
|
-
if (k in obj) {
|
|
240
|
-
if (!omitUndefined || obj[k] !== void 0)
|
|
241
|
-
n[k] = obj[k];
|
|
242
|
-
}
|
|
243
|
-
return n;
|
|
244
|
-
}, {});
|
|
245
|
-
}
|
|
246
|
-
function objectOmit(obj, keys, omitUndefined = false) {
|
|
247
|
-
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {
|
|
248
|
-
return (!omitUndefined || value !== void 0) && !keys.includes(key);
|
|
249
|
-
}));
|
|
250
|
-
}
|
|
251
|
-
function objectEntries(obj) {
|
|
252
|
-
return Object.entries(obj);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
33
|
function computedWithControl(source, fn) {
|
|
256
34
|
let v = void 0;
|
|
257
35
|
let track;
|
|
@@ -262,8 +40,8 @@ function computedWithControl(source, fn) {
|
|
|
262
40
|
trigger();
|
|
263
41
|
};
|
|
264
42
|
watch(source, update, { flush: "sync" });
|
|
265
|
-
const get =
|
|
266
|
-
const set =
|
|
43
|
+
const get = typeof fn === "function" ? fn : fn.get;
|
|
44
|
+
const set = typeof fn === "function" ? void 0 : fn.set;
|
|
267
45
|
const result = customRef((_track, _trigger) => {
|
|
268
46
|
track = _track;
|
|
269
47
|
trigger = _trigger;
|
|
@@ -365,7 +143,11 @@ function createSharedComposable(composable) {
|
|
|
365
143
|
}
|
|
366
144
|
|
|
367
145
|
function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) {
|
|
368
|
-
|
|
146
|
+
if (!isVue3 && !version.startsWith("2.7.")) {
|
|
147
|
+
if (process.env.NODE_ENV !== "production")
|
|
148
|
+
throw new Error("[VueUse] extendRef only works in Vue 2.7 or above.");
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
369
151
|
for (const [key, value] of Object.entries(extend)) {
|
|
370
152
|
if (key === "value")
|
|
371
153
|
continue;
|
|
@@ -433,6 +215,11 @@ function makeDestructurable(obj, arr) {
|
|
|
433
215
|
}
|
|
434
216
|
}
|
|
435
217
|
|
|
218
|
+
function toValue(r) {
|
|
219
|
+
return typeof r === "function" ? r() : unref(r);
|
|
220
|
+
}
|
|
221
|
+
const resolveUnref = toValue;
|
|
222
|
+
|
|
436
223
|
function reactify(fn, options) {
|
|
437
224
|
const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : toValue;
|
|
438
225
|
return function(...args) {
|
|
@@ -508,6 +295,211 @@ function reactiveOmit(obj, ...keys) {
|
|
|
508
295
|
);
|
|
509
296
|
}
|
|
510
297
|
|
|
298
|
+
const isClient = typeof window !== "undefined";
|
|
299
|
+
const isDef = (val) => typeof val !== "undefined";
|
|
300
|
+
const assert = (condition, ...infos) => {
|
|
301
|
+
if (!condition)
|
|
302
|
+
console.warn(...infos);
|
|
303
|
+
};
|
|
304
|
+
const toString = Object.prototype.toString;
|
|
305
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
306
|
+
const now = () => Date.now();
|
|
307
|
+
const timestamp = () => +Date.now();
|
|
308
|
+
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
309
|
+
const noop = () => {
|
|
310
|
+
};
|
|
311
|
+
const rand = (min, max) => {
|
|
312
|
+
min = Math.ceil(min);
|
|
313
|
+
max = Math.floor(max);
|
|
314
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
315
|
+
};
|
|
316
|
+
const hasOwn = (val, key) => Object.prototype.hasOwnProperty.call(val, key);
|
|
317
|
+
const isIOS = /* @__PURE__ */ getIsIOS();
|
|
318
|
+
function getIsIOS() {
|
|
319
|
+
var _a;
|
|
320
|
+
return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function createFilterWrapper(filter, fn) {
|
|
324
|
+
function wrapper(...args) {
|
|
325
|
+
return new Promise((resolve, reject) => {
|
|
326
|
+
Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
return wrapper;
|
|
330
|
+
}
|
|
331
|
+
const bypassFilter = (invoke) => {
|
|
332
|
+
return invoke();
|
|
333
|
+
};
|
|
334
|
+
function debounceFilter(ms, options = {}) {
|
|
335
|
+
let timer;
|
|
336
|
+
let maxTimer;
|
|
337
|
+
let lastRejector = noop;
|
|
338
|
+
const _clearTimeout = (timer2) => {
|
|
339
|
+
clearTimeout(timer2);
|
|
340
|
+
lastRejector();
|
|
341
|
+
lastRejector = noop;
|
|
342
|
+
};
|
|
343
|
+
const filter = (invoke) => {
|
|
344
|
+
const duration = toValue(ms);
|
|
345
|
+
const maxDuration = toValue(options.maxWait);
|
|
346
|
+
if (timer)
|
|
347
|
+
_clearTimeout(timer);
|
|
348
|
+
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
349
|
+
if (maxTimer) {
|
|
350
|
+
_clearTimeout(maxTimer);
|
|
351
|
+
maxTimer = null;
|
|
352
|
+
}
|
|
353
|
+
return Promise.resolve(invoke());
|
|
354
|
+
}
|
|
355
|
+
return new Promise((resolve, reject) => {
|
|
356
|
+
lastRejector = options.rejectOnCancel ? reject : resolve;
|
|
357
|
+
if (maxDuration && !maxTimer) {
|
|
358
|
+
maxTimer = setTimeout(() => {
|
|
359
|
+
if (timer)
|
|
360
|
+
_clearTimeout(timer);
|
|
361
|
+
maxTimer = null;
|
|
362
|
+
resolve(invoke());
|
|
363
|
+
}, maxDuration);
|
|
364
|
+
}
|
|
365
|
+
timer = setTimeout(() => {
|
|
366
|
+
if (maxTimer)
|
|
367
|
+
_clearTimeout(maxTimer);
|
|
368
|
+
maxTimer = null;
|
|
369
|
+
resolve(invoke());
|
|
370
|
+
}, duration);
|
|
371
|
+
});
|
|
372
|
+
};
|
|
373
|
+
return filter;
|
|
374
|
+
}
|
|
375
|
+
function throttleFilter(ms, trailing = true, leading = true, rejectOnCancel = false) {
|
|
376
|
+
let lastExec = 0;
|
|
377
|
+
let timer;
|
|
378
|
+
let isLeading = true;
|
|
379
|
+
let lastRejector = noop;
|
|
380
|
+
let lastValue;
|
|
381
|
+
const clear = () => {
|
|
382
|
+
if (timer) {
|
|
383
|
+
clearTimeout(timer);
|
|
384
|
+
timer = void 0;
|
|
385
|
+
lastRejector();
|
|
386
|
+
lastRejector = noop;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
const filter = (_invoke) => {
|
|
390
|
+
const duration = toValue(ms);
|
|
391
|
+
const elapsed = Date.now() - lastExec;
|
|
392
|
+
const invoke = () => {
|
|
393
|
+
return lastValue = _invoke();
|
|
394
|
+
};
|
|
395
|
+
clear();
|
|
396
|
+
if (duration <= 0) {
|
|
397
|
+
lastExec = Date.now();
|
|
398
|
+
return invoke();
|
|
399
|
+
}
|
|
400
|
+
if (elapsed > duration && (leading || !isLeading)) {
|
|
401
|
+
lastExec = Date.now();
|
|
402
|
+
invoke();
|
|
403
|
+
} else if (trailing) {
|
|
404
|
+
lastValue = new Promise((resolve, reject) => {
|
|
405
|
+
lastRejector = rejectOnCancel ? reject : resolve;
|
|
406
|
+
timer = setTimeout(() => {
|
|
407
|
+
lastExec = Date.now();
|
|
408
|
+
isLeading = true;
|
|
409
|
+
resolve(invoke());
|
|
410
|
+
clear();
|
|
411
|
+
}, Math.max(0, duration - elapsed));
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (!leading && !timer)
|
|
415
|
+
timer = setTimeout(() => isLeading = true, duration);
|
|
416
|
+
isLeading = false;
|
|
417
|
+
return lastValue;
|
|
418
|
+
};
|
|
419
|
+
return filter;
|
|
420
|
+
}
|
|
421
|
+
function pausableFilter(extendFilter = bypassFilter) {
|
|
422
|
+
const isActive = ref(true);
|
|
423
|
+
function pause() {
|
|
424
|
+
isActive.value = false;
|
|
425
|
+
}
|
|
426
|
+
function resume() {
|
|
427
|
+
isActive.value = true;
|
|
428
|
+
}
|
|
429
|
+
const eventFilter = (...args) => {
|
|
430
|
+
if (isActive.value)
|
|
431
|
+
extendFilter(...args);
|
|
432
|
+
};
|
|
433
|
+
return { isActive: readonly(isActive), pause, resume, eventFilter };
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const directiveHooks = {
|
|
437
|
+
mounted: isVue3 ? "mounted" : "inserted",
|
|
438
|
+
updated: isVue3 ? "updated" : "componentUpdated",
|
|
439
|
+
unmounted: isVue3 ? "unmounted" : "unbind"
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
|
|
443
|
+
return new Promise((resolve, reject) => {
|
|
444
|
+
if (throwOnTimeout)
|
|
445
|
+
setTimeout(() => reject(reason), ms);
|
|
446
|
+
else
|
|
447
|
+
setTimeout(resolve, ms);
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
function identity(arg) {
|
|
451
|
+
return arg;
|
|
452
|
+
}
|
|
453
|
+
function createSingletonPromise(fn) {
|
|
454
|
+
let _promise;
|
|
455
|
+
function wrapper() {
|
|
456
|
+
if (!_promise)
|
|
457
|
+
_promise = fn();
|
|
458
|
+
return _promise;
|
|
459
|
+
}
|
|
460
|
+
wrapper.reset = async () => {
|
|
461
|
+
const _prev = _promise;
|
|
462
|
+
_promise = void 0;
|
|
463
|
+
if (_prev)
|
|
464
|
+
await _prev;
|
|
465
|
+
};
|
|
466
|
+
return wrapper;
|
|
467
|
+
}
|
|
468
|
+
function invoke(fn) {
|
|
469
|
+
return fn();
|
|
470
|
+
}
|
|
471
|
+
function containsProp(obj, ...props) {
|
|
472
|
+
return props.some((k) => k in obj);
|
|
473
|
+
}
|
|
474
|
+
function increaseWithUnit(target, delta) {
|
|
475
|
+
var _a;
|
|
476
|
+
if (typeof target === "number")
|
|
477
|
+
return target + delta;
|
|
478
|
+
const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
|
|
479
|
+
const unit = target.slice(value.length);
|
|
480
|
+
const result = parseFloat(value) + delta;
|
|
481
|
+
if (Number.isNaN(result))
|
|
482
|
+
return target;
|
|
483
|
+
return result + unit;
|
|
484
|
+
}
|
|
485
|
+
function objectPick(obj, keys, omitUndefined = false) {
|
|
486
|
+
return keys.reduce((n, k) => {
|
|
487
|
+
if (k in obj) {
|
|
488
|
+
if (!omitUndefined || obj[k] !== void 0)
|
|
489
|
+
n[k] = obj[k];
|
|
490
|
+
}
|
|
491
|
+
return n;
|
|
492
|
+
}, {});
|
|
493
|
+
}
|
|
494
|
+
function objectOmit(obj, keys, omitUndefined = false) {
|
|
495
|
+
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => {
|
|
496
|
+
return (!omitUndefined || value !== void 0) && !keys.includes(key);
|
|
497
|
+
}));
|
|
498
|
+
}
|
|
499
|
+
function objectEntries(obj) {
|
|
500
|
+
return Object.entries(obj);
|
|
501
|
+
}
|
|
502
|
+
|
|
511
503
|
function toRef(...args) {
|
|
512
504
|
if (args.length !== 1)
|
|
513
505
|
return toRef$1(...args);
|
|
@@ -908,7 +900,7 @@ function useArrayDifference(...args) {
|
|
|
908
900
|
const list = args[0];
|
|
909
901
|
const values = args[1];
|
|
910
902
|
let compareFn = (_a = args[2]) != null ? _a : defaultComparator;
|
|
911
|
-
if (
|
|
903
|
+
if (typeof compareFn === "string") {
|
|
912
904
|
const key = compareFn;
|
|
913
905
|
compareFn = (value, othVal) => value[key] === othVal[key];
|
|
914
906
|
}
|
|
@@ -1128,7 +1120,7 @@ function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
|
1128
1120
|
}
|
|
1129
1121
|
if (immediate && isClient)
|
|
1130
1122
|
resume();
|
|
1131
|
-
if (isRef(interval) ||
|
|
1123
|
+
if (isRef(interval) || typeof interval === "function") {
|
|
1132
1124
|
const stopWatch = watch(interval, () => {
|
|
1133
1125
|
if (isActive.value && isClient)
|
|
1134
1126
|
resume();
|
|
@@ -1791,4 +1783,4 @@ function whenever(source, cb, options) {
|
|
|
1791
1783
|
);
|
|
1792
1784
|
}
|
|
1793
1785
|
|
|
1794
|
-
export {
|
|
1786
|
+
export { assert, refAutoReset as autoResetRef, bypassFilter, clamp, computedEager, computedWithControl, containsProp, computedWithControl as controlledComputed, controlledRef, createEventHook, createFilterWrapper, createGlobalState, createInjectionState, reactify as createReactiveFn, createSharedComposable, createSingletonPromise, debounceFilter, refDebounced as debouncedRef, watchDebounced as debouncedWatch, directiveHooks, computedEager as eagerComputed, extendRef, formatDate, get, hasOwn, identity, watchIgnorable as ignorableWatch, increaseWithUnit, invoke, isClient, isDef, isDefined, isIOS, isObject, makeDestructurable, noop, normalizeDate, now, objectEntries, objectOmit, objectPick, pausableFilter, watchPausable as pausableWatch, promiseTimeout, rand, reactify, reactifyObject, reactiveComputed, reactiveOmit, reactivePick, refAutoReset, refDebounced, refDefault, refThrottled, refWithControl, resolveRef, resolveUnref, set, syncRef, syncRefs, throttleFilter, refThrottled as throttledRef, watchThrottled as throttledWatch, timestamp, toReactive, toRef, toRefs, toValue, tryOnBeforeMount, tryOnBeforeUnmount, tryOnMounted, tryOnScopeDispose, tryOnUnmounted, until, useArrayDifference, useArrayEvery, useArrayFilter, useArrayFind, useArrayFindIndex, useArrayFindLast, useArrayIncludes, useArrayJoin, useArrayMap, useArrayReduce, useArraySome, useArrayUnique, useCounter, useDateFormat, refDebounced as useDebounce, useDebounceFn, useInterval, useIntervalFn, useLastChanged, refThrottled as useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useToNumber, useToString, useToggle, watchArray, watchAtMost, watchDebounced, watchDeep, watchIgnorable, watchImmediate, watchOnce, watchPausable, watchThrottled, watchTriggerable, watchWithFilter, whenever };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueuse/shared",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.5",
|
|
4
4
|
"author": "Anthony Fu <https://github.com/antfu>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"funding": "https://github.com/sponsors/antfu",
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"jsdelivr": "./index.iife.min.js",
|
|
34
34
|
"types": "./index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"vue-demi": "
|
|
36
|
+
"vue-demi": ">=0.14.0"
|
|
37
37
|
}
|
|
38
38
|
}
|