@vueuse/components 10.2.1 → 10.4.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 +135 -429
- package/index.d.cts +650 -0
- package/index.d.mts +650 -0
- package/index.d.ts +3 -3
- package/index.iife.js +135 -429
- package/index.iife.min.js +1 -1
- package/index.mjs +135 -429
- package/package.json +6 -7
package/index.cjs
CHANGED
|
@@ -21,9 +21,8 @@ const OnClickOutside = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
function unrefElement(elRef) {
|
|
24
|
-
var _a;
|
|
25
24
|
const plain = shared.toValue(elRef);
|
|
26
|
-
return
|
|
25
|
+
return plain?.$el ?? plain;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
const defaultWindow = shared.isClient ? window : void 0;
|
|
@@ -84,6 +83,7 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
84
83
|
if (shared.isIOS && !_iOSWorkaround) {
|
|
85
84
|
_iOSWorkaround = true;
|
|
86
85
|
Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", shared.noop));
|
|
86
|
+
window.document.documentElement.addEventListener("click", shared.noop);
|
|
87
87
|
}
|
|
88
88
|
let shouldListen = true;
|
|
89
89
|
const shouldIgnore = (event) => {
|
|
@@ -117,9 +117,8 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
117
117
|
}, { passive: true }),
|
|
118
118
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
119
119
|
setTimeout(() => {
|
|
120
|
-
var _a;
|
|
121
120
|
const el = unrefElement(target);
|
|
122
|
-
if (
|
|
121
|
+
if (window.document.activeElement?.tagName === "IFRAME" && !el?.contains(window.document.activeElement))
|
|
123
122
|
handler(event);
|
|
124
123
|
}, 0);
|
|
125
124
|
})
|
|
@@ -189,42 +188,25 @@ function onKeyStroke(...args) {
|
|
|
189
188
|
return useEventListener(target, eventName, listener, passive);
|
|
190
189
|
}
|
|
191
190
|
|
|
192
|
-
var __defProp$e = Object.defineProperty;
|
|
193
|
-
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
194
|
-
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
195
|
-
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
196
|
-
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
197
|
-
var __spreadValues$e = (a, b) => {
|
|
198
|
-
for (var prop in b || (b = {}))
|
|
199
|
-
if (__hasOwnProp$g.call(b, prop))
|
|
200
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
201
|
-
if (__getOwnPropSymbols$g)
|
|
202
|
-
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
203
|
-
if (__propIsEnum$g.call(b, prop))
|
|
204
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
205
|
-
}
|
|
206
|
-
return a;
|
|
207
|
-
};
|
|
208
191
|
const vOnKeyStroke = {
|
|
209
192
|
[shared.directiveHooks.mounted](el, binding) {
|
|
210
|
-
|
|
211
|
-
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
193
|
+
const keys = binding.arg?.split(",") ?? true;
|
|
212
194
|
if (typeof binding.value === "function") {
|
|
213
195
|
onKeyStroke(keys, binding.value, {
|
|
214
196
|
target: el
|
|
215
197
|
});
|
|
216
198
|
} else {
|
|
217
199
|
const [handler, options] = binding.value;
|
|
218
|
-
onKeyStroke(keys, handler,
|
|
219
|
-
target: el
|
|
220
|
-
|
|
200
|
+
onKeyStroke(keys, handler, {
|
|
201
|
+
target: el,
|
|
202
|
+
...options
|
|
203
|
+
});
|
|
221
204
|
}
|
|
222
205
|
}
|
|
223
206
|
};
|
|
224
207
|
|
|
225
208
|
const DEFAULT_DELAY = 500;
|
|
226
209
|
function onLongPress(target, handler, options) {
|
|
227
|
-
var _a, _b;
|
|
228
210
|
const elementRef = vueDemi.computed(() => unrefElement(target));
|
|
229
211
|
let timeout;
|
|
230
212
|
function clear() {
|
|
@@ -234,26 +216,24 @@ function onLongPress(target, handler, options) {
|
|
|
234
216
|
}
|
|
235
217
|
}
|
|
236
218
|
function onDown(ev) {
|
|
237
|
-
|
|
238
|
-
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
219
|
+
if (options?.modifiers?.self && ev.target !== elementRef.value)
|
|
239
220
|
return;
|
|
240
221
|
clear();
|
|
241
|
-
if (
|
|
222
|
+
if (options?.modifiers?.prevent)
|
|
242
223
|
ev.preventDefault();
|
|
243
|
-
if (
|
|
224
|
+
if (options?.modifiers?.stop)
|
|
244
225
|
ev.stopPropagation();
|
|
245
226
|
timeout = setTimeout(
|
|
246
227
|
() => handler(ev),
|
|
247
|
-
|
|
228
|
+
options?.delay ?? DEFAULT_DELAY
|
|
248
229
|
);
|
|
249
230
|
}
|
|
250
231
|
const listenerOptions = {
|
|
251
|
-
capture:
|
|
252
|
-
once:
|
|
232
|
+
capture: options?.modifiers?.capture,
|
|
233
|
+
once: options?.modifiers?.once
|
|
253
234
|
};
|
|
254
235
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
|
|
255
|
-
useEventListener(elementRef, "pointerup", clear, listenerOptions);
|
|
256
|
-
useEventListener(elementRef, "pointerleave", clear, listenerOptions);
|
|
236
|
+
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions);
|
|
257
237
|
}
|
|
258
238
|
|
|
259
239
|
const OnLongPress = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
@@ -336,22 +316,6 @@ function guessSerializerType(rawInit) {
|
|
|
336
316
|
return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
|
|
337
317
|
}
|
|
338
318
|
|
|
339
|
-
var __defProp$d = Object.defineProperty;
|
|
340
|
-
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
|
341
|
-
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
|
342
|
-
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
|
343
|
-
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
344
|
-
var __spreadValues$d = (a, b) => {
|
|
345
|
-
for (var prop in b || (b = {}))
|
|
346
|
-
if (__hasOwnProp$f.call(b, prop))
|
|
347
|
-
__defNormalProp$d(a, prop, b[prop]);
|
|
348
|
-
if (__getOwnPropSymbols$f)
|
|
349
|
-
for (var prop of __getOwnPropSymbols$f(b)) {
|
|
350
|
-
if (__propIsEnum$f.call(b, prop))
|
|
351
|
-
__defNormalProp$d(a, prop, b[prop]);
|
|
352
|
-
}
|
|
353
|
-
return a;
|
|
354
|
-
};
|
|
355
319
|
const StorageSerializers = {
|
|
356
320
|
boolean: {
|
|
357
321
|
read: (v) => v === "true",
|
|
@@ -388,7 +352,6 @@ const StorageSerializers = {
|
|
|
388
352
|
};
|
|
389
353
|
const customStorageEventName = "vueuse-storage";
|
|
390
354
|
function useStorage(key, defaults, storage, options = {}) {
|
|
391
|
-
var _a;
|
|
392
355
|
const {
|
|
393
356
|
flush = "pre",
|
|
394
357
|
deep = true,
|
|
@@ -405,10 +368,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
405
368
|
const data = (shallow ? vueDemi.shallowRef : vueDemi.ref)(defaults);
|
|
406
369
|
if (!storage) {
|
|
407
370
|
try {
|
|
408
|
-
storage = getSSRHandler("getDefaultStorage", () =>
|
|
409
|
-
var _a2;
|
|
410
|
-
return (_a2 = defaultWindow) == null ? void 0 : _a2.localStorage;
|
|
411
|
-
})();
|
|
371
|
+
storage = getSSRHandler("getDefaultStorage", () => defaultWindow?.localStorage)();
|
|
412
372
|
} catch (e) {
|
|
413
373
|
onError(e);
|
|
414
374
|
}
|
|
@@ -417,7 +377,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
417
377
|
return data;
|
|
418
378
|
const rawInit = shared.toValue(defaults);
|
|
419
379
|
const type = guessSerializerType(rawInit);
|
|
420
|
-
const serializer =
|
|
380
|
+
const serializer = options.serializer ?? StorageSerializers[type];
|
|
421
381
|
const { pause: pauseWatch, resume: resumeWatch } = shared.pausableWatch(
|
|
422
382
|
data,
|
|
423
383
|
() => write(data.value),
|
|
@@ -465,7 +425,7 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
465
425
|
if (typeof mergeDefaults === "function")
|
|
466
426
|
return mergeDefaults(value, rawInit);
|
|
467
427
|
else if (type === "object" && !Array.isArray(value))
|
|
468
|
-
return
|
|
428
|
+
return { ...rawInit, ...value };
|
|
469
429
|
return value;
|
|
470
430
|
} else if (typeof rawValue !== "string") {
|
|
471
431
|
return rawValue;
|
|
@@ -487,7 +447,8 @@ function useStorage(key, defaults, storage, options = {}) {
|
|
|
487
447
|
return;
|
|
488
448
|
pauseWatch();
|
|
489
449
|
try {
|
|
490
|
-
data.value
|
|
450
|
+
if (event?.newValue !== serializer.write(data.value))
|
|
451
|
+
data.value = read(event);
|
|
491
452
|
} catch (e) {
|
|
492
453
|
onError(e);
|
|
493
454
|
} finally {
|
|
@@ -522,29 +483,33 @@ function useMediaQuery(query, options = {}) {
|
|
|
522
483
|
const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
|
|
523
484
|
let mediaQuery;
|
|
524
485
|
const matches = vueDemi.ref(false);
|
|
486
|
+
const handler = (event) => {
|
|
487
|
+
matches.value = event.matches;
|
|
488
|
+
};
|
|
525
489
|
const cleanup = () => {
|
|
526
490
|
if (!mediaQuery)
|
|
527
491
|
return;
|
|
528
492
|
if ("removeEventListener" in mediaQuery)
|
|
529
|
-
mediaQuery.removeEventListener("change",
|
|
493
|
+
mediaQuery.removeEventListener("change", handler);
|
|
530
494
|
else
|
|
531
|
-
mediaQuery.removeListener(
|
|
495
|
+
mediaQuery.removeListener(handler);
|
|
532
496
|
};
|
|
533
|
-
const
|
|
497
|
+
const stopWatch = vueDemi.watchEffect(() => {
|
|
534
498
|
if (!isSupported.value)
|
|
535
499
|
return;
|
|
536
500
|
cleanup();
|
|
537
|
-
mediaQuery = window.matchMedia(shared.
|
|
538
|
-
matches.value = !!(mediaQuery == null ? void 0 : mediaQuery.matches);
|
|
539
|
-
if (!mediaQuery)
|
|
540
|
-
return;
|
|
501
|
+
mediaQuery = window.matchMedia(shared.toValue(query));
|
|
541
502
|
if ("addEventListener" in mediaQuery)
|
|
542
|
-
mediaQuery.addEventListener("change",
|
|
503
|
+
mediaQuery.addEventListener("change", handler);
|
|
543
504
|
else
|
|
544
|
-
mediaQuery.addListener(
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
shared.tryOnScopeDispose(() =>
|
|
505
|
+
mediaQuery.addListener(handler);
|
|
506
|
+
matches.value = mediaQuery.matches;
|
|
507
|
+
});
|
|
508
|
+
shared.tryOnScopeDispose(() => {
|
|
509
|
+
stopWatch();
|
|
510
|
+
cleanup();
|
|
511
|
+
mediaQuery = void 0;
|
|
512
|
+
});
|
|
548
513
|
return matches;
|
|
549
514
|
}
|
|
550
515
|
|
|
@@ -552,22 +517,6 @@ function usePreferredDark(options) {
|
|
|
552
517
|
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
553
518
|
}
|
|
554
519
|
|
|
555
|
-
var __defProp$c = Object.defineProperty;
|
|
556
|
-
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
557
|
-
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
558
|
-
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
559
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
560
|
-
var __spreadValues$c = (a, b) => {
|
|
561
|
-
for (var prop in b || (b = {}))
|
|
562
|
-
if (__hasOwnProp$e.call(b, prop))
|
|
563
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
564
|
-
if (__getOwnPropSymbols$e)
|
|
565
|
-
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
566
|
-
if (__propIsEnum$e.call(b, prop))
|
|
567
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
568
|
-
}
|
|
569
|
-
return a;
|
|
570
|
-
};
|
|
571
520
|
function useColorMode(options = {}) {
|
|
572
521
|
const {
|
|
573
522
|
selector = "html",
|
|
@@ -581,11 +530,12 @@ function useColorMode(options = {}) {
|
|
|
581
530
|
emitAuto,
|
|
582
531
|
disableTransition = true
|
|
583
532
|
} = options;
|
|
584
|
-
const modes =
|
|
533
|
+
const modes = {
|
|
585
534
|
auto: "",
|
|
586
535
|
light: "light",
|
|
587
|
-
dark: "dark"
|
|
588
|
-
|
|
536
|
+
dark: "dark",
|
|
537
|
+
...options.modes || {}
|
|
538
|
+
};
|
|
589
539
|
const preferredDark = usePreferredDark({ window });
|
|
590
540
|
const system = vueDemi.computed(() => preferredDark.value ? "dark" : "light");
|
|
591
541
|
const store = storageRef || (storageKey == null ? shared.toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
@@ -595,7 +545,7 @@ function useColorMode(options = {}) {
|
|
|
595
545
|
const updateHTMLAttrs = getSSRHandler(
|
|
596
546
|
"updateHTMLAttrs",
|
|
597
547
|
(selector2, attribute2, value) => {
|
|
598
|
-
const el = typeof selector2 === "string" ? window
|
|
548
|
+
const el = typeof selector2 === "string" ? window?.document.querySelector(selector2) : unrefElement(selector2);
|
|
599
549
|
if (!el)
|
|
600
550
|
return;
|
|
601
551
|
let style;
|
|
@@ -623,8 +573,7 @@ function useColorMode(options = {}) {
|
|
|
623
573
|
}
|
|
624
574
|
);
|
|
625
575
|
function defaultOnChanged(mode) {
|
|
626
|
-
|
|
627
|
-
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
|
576
|
+
updateHTMLAttrs(selector, attribute, modes[mode] ?? mode);
|
|
628
577
|
}
|
|
629
578
|
function onChanged(mode) {
|
|
630
579
|
if (options.onChanged)
|
|
@@ -742,25 +691,6 @@ const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComp
|
|
|
742
691
|
}
|
|
743
692
|
});
|
|
744
693
|
|
|
745
|
-
var __defProp$b = Object.defineProperty;
|
|
746
|
-
var __defProps$9 = Object.defineProperties;
|
|
747
|
-
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
748
|
-
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
749
|
-
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
750
|
-
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
751
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
752
|
-
var __spreadValues$b = (a, b) => {
|
|
753
|
-
for (var prop in b || (b = {}))
|
|
754
|
-
if (__hasOwnProp$d.call(b, prop))
|
|
755
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
756
|
-
if (__getOwnPropSymbols$d)
|
|
757
|
-
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
758
|
-
if (__propIsEnum$d.call(b, prop))
|
|
759
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
760
|
-
}
|
|
761
|
-
return a;
|
|
762
|
-
};
|
|
763
|
-
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
764
694
|
const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
765
695
|
name: "UseDraggable",
|
|
766
696
|
props: [
|
|
@@ -780,10 +710,7 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
780
710
|
],
|
|
781
711
|
setup(props, { slots }) {
|
|
782
712
|
const target = vueDemi.ref();
|
|
783
|
-
const handle = vueDemi.computed(() =>
|
|
784
|
-
var _a;
|
|
785
|
-
return (_a = props.handle) != null ? _a : target.value;
|
|
786
|
-
});
|
|
713
|
+
const handle = vueDemi.computed(() => props.handle ?? target.value);
|
|
787
714
|
const storageValue = props.storageKey && core.useStorage(
|
|
788
715
|
props.storageKey,
|
|
789
716
|
shared.toValue(props.initialValue) || { x: 0, y: 0 },
|
|
@@ -791,18 +718,18 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
791
718
|
);
|
|
792
719
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
793
720
|
const onEnd = (position, event) => {
|
|
794
|
-
|
|
795
|
-
(_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
|
|
721
|
+
props.onEnd?.(position, event);
|
|
796
722
|
if (!storageValue)
|
|
797
723
|
return;
|
|
798
724
|
storageValue.value.x = position.x;
|
|
799
725
|
storageValue.value.y = position.y;
|
|
800
726
|
};
|
|
801
|
-
const data = vueDemi.reactive(core.useDraggable(target,
|
|
727
|
+
const data = vueDemi.reactive(core.useDraggable(target, {
|
|
728
|
+
...props,
|
|
802
729
|
handle,
|
|
803
730
|
initialValue,
|
|
804
731
|
onEnd
|
|
805
|
-
}))
|
|
732
|
+
}));
|
|
806
733
|
return () => {
|
|
807
734
|
if (slots.default)
|
|
808
735
|
return vueDemi.h(props.as || "div", { ref: target, style: `touch-action:none;${data.style}` }, slots.default(data));
|
|
@@ -860,7 +787,7 @@ const vElementHover = {
|
|
|
860
787
|
|
|
861
788
|
const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
862
789
|
name: "UseElementSize",
|
|
863
|
-
props: ["width", "height", "box"],
|
|
790
|
+
props: ["width", "height", "box", "as"],
|
|
864
791
|
setup(props, { slots }) {
|
|
865
792
|
const target = vueDemi.ref();
|
|
866
793
|
const data = vueDemi.reactive(core.useElementSize(target, { width: props.width, height: props.height }, { box: props.box }));
|
|
@@ -871,23 +798,8 @@ const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
871
798
|
}
|
|
872
799
|
});
|
|
873
800
|
|
|
874
|
-
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
875
|
-
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
876
|
-
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
877
|
-
var __objRest$1 = (source, exclude) => {
|
|
878
|
-
var target = {};
|
|
879
|
-
for (var prop in source)
|
|
880
|
-
if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
881
|
-
target[prop] = source[prop];
|
|
882
|
-
if (source != null && __getOwnPropSymbols$c)
|
|
883
|
-
for (var prop of __getOwnPropSymbols$c(source)) {
|
|
884
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
|
|
885
|
-
target[prop] = source[prop];
|
|
886
|
-
}
|
|
887
|
-
return target;
|
|
888
|
-
};
|
|
889
801
|
function useResizeObserver(target, callback, options = {}) {
|
|
890
|
-
const
|
|
802
|
+
const { window = defaultWindow, ...observerOptions } = options;
|
|
891
803
|
let observer;
|
|
892
804
|
const isSupported = useSupported(() => window && "ResizeObserver" in window);
|
|
893
805
|
const cleanup = () => {
|
|
@@ -924,10 +836,7 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
924
836
|
|
|
925
837
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
926
838
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
927
|
-
const isSVG = vueDemi.computed(() =>
|
|
928
|
-
var _a, _b;
|
|
929
|
-
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
930
|
-
});
|
|
839
|
+
const isSVG = vueDemi.computed(() => unrefElement(target)?.namespaceURI?.includes("svg"));
|
|
931
840
|
const width = vueDemi.ref(initialSize.width);
|
|
932
841
|
const height = vueDemi.ref(initialSize.height);
|
|
933
842
|
useResizeObserver(
|
|
@@ -969,8 +878,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
969
878
|
|
|
970
879
|
const vElementSize = {
|
|
971
880
|
[shared.directiveHooks.mounted](el, binding) {
|
|
972
|
-
|
|
973
|
-
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
|
|
881
|
+
const handler = typeof binding.value === "function" ? binding.value : binding.value?.[0];
|
|
974
882
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
975
883
|
const { width, height } = useElementSize(el, ...options);
|
|
976
884
|
vueDemi.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1060,7 +968,8 @@ function useElementVisibility(element, { window = defaultWindow, scrollTarget }
|
|
|
1060
968
|
},
|
|
1061
969
|
{
|
|
1062
970
|
root: scrollTarget,
|
|
1063
|
-
window
|
|
971
|
+
window,
|
|
972
|
+
threshold: 0
|
|
1064
973
|
}
|
|
1065
974
|
);
|
|
1066
975
|
return elementIsVisible;
|
|
@@ -1131,25 +1040,6 @@ const UseIdle = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1131
1040
|
}
|
|
1132
1041
|
});
|
|
1133
1042
|
|
|
1134
|
-
var __defProp$a = Object.defineProperty;
|
|
1135
|
-
var __defProps$8 = Object.defineProperties;
|
|
1136
|
-
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
1137
|
-
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
1138
|
-
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
1139
|
-
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
1140
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1141
|
-
var __spreadValues$a = (a, b) => {
|
|
1142
|
-
for (var prop in b || (b = {}))
|
|
1143
|
-
if (__hasOwnProp$b.call(b, prop))
|
|
1144
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
1145
|
-
if (__getOwnPropSymbols$b)
|
|
1146
|
-
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
1147
|
-
if (__propIsEnum$b.call(b, prop))
|
|
1148
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
1149
|
-
}
|
|
1150
|
-
return a;
|
|
1151
|
-
};
|
|
1152
|
-
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
1153
1043
|
function useAsyncState(promise, initialState, options) {
|
|
1154
1044
|
const {
|
|
1155
1045
|
immediate = true,
|
|
@@ -1159,7 +1049,7 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1159
1049
|
resetOnExecute = true,
|
|
1160
1050
|
shallow = true,
|
|
1161
1051
|
throwError
|
|
1162
|
-
} = options
|
|
1052
|
+
} = options ?? {};
|
|
1163
1053
|
const state = shallow ? vueDemi.shallowRef(initialState) : vueDemi.ref(initialState);
|
|
1164
1054
|
const isReady = vueDemi.ref(false);
|
|
1165
1055
|
const isLoading = vueDemi.ref(false);
|
|
@@ -1202,29 +1092,14 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1202
1092
|
shared.until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);
|
|
1203
1093
|
});
|
|
1204
1094
|
}
|
|
1205
|
-
return
|
|
1095
|
+
return {
|
|
1096
|
+
...shell,
|
|
1206
1097
|
then(onFulfilled, onRejected) {
|
|
1207
1098
|
return waitUntilIsLoaded().then(onFulfilled, onRejected);
|
|
1208
1099
|
}
|
|
1209
|
-
}
|
|
1100
|
+
};
|
|
1210
1101
|
}
|
|
1211
1102
|
|
|
1212
|
-
var __defProp$9 = Object.defineProperty;
|
|
1213
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
1214
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
1215
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
1216
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1217
|
-
var __spreadValues$9 = (a, b) => {
|
|
1218
|
-
for (var prop in b || (b = {}))
|
|
1219
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
1220
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
1221
|
-
if (__getOwnPropSymbols$a)
|
|
1222
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
1223
|
-
if (__propIsEnum$a.call(b, prop))
|
|
1224
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
1225
|
-
}
|
|
1226
|
-
return a;
|
|
1227
|
-
};
|
|
1228
1103
|
async function loadImage(options) {
|
|
1229
1104
|
return new Promise((resolve, reject) => {
|
|
1230
1105
|
const img = new Image();
|
|
@@ -1250,9 +1125,10 @@ function useImage(options, asyncStateOptions = {}) {
|
|
|
1250
1125
|
const state = useAsyncState(
|
|
1251
1126
|
() => loadImage(shared.toValue(options)),
|
|
1252
1127
|
void 0,
|
|
1253
|
-
|
|
1254
|
-
resetOnExecute: true
|
|
1255
|
-
|
|
1128
|
+
{
|
|
1129
|
+
resetOnExecute: true,
|
|
1130
|
+
...asyncStateOptions
|
|
1131
|
+
}
|
|
1256
1132
|
);
|
|
1257
1133
|
vueDemi.watch(
|
|
1258
1134
|
() => shared.toValue(options),
|
|
@@ -1306,7 +1182,8 @@ function useScroll(element, options = {}) {
|
|
|
1306
1182
|
capture: false,
|
|
1307
1183
|
passive: true
|
|
1308
1184
|
},
|
|
1309
|
-
behavior = "auto"
|
|
1185
|
+
behavior = "auto",
|
|
1186
|
+
window = defaultWindow
|
|
1310
1187
|
} = options;
|
|
1311
1188
|
const internalX = vueDemi.ref(0);
|
|
1312
1189
|
const internalY = vueDemi.ref(0);
|
|
@@ -1327,13 +1204,14 @@ function useScroll(element, options = {}) {
|
|
|
1327
1204
|
}
|
|
1328
1205
|
});
|
|
1329
1206
|
function scrollTo(_x, _y) {
|
|
1330
|
-
|
|
1207
|
+
if (!window)
|
|
1208
|
+
return;
|
|
1331
1209
|
const _element = shared.toValue(element);
|
|
1332
1210
|
if (!_element)
|
|
1333
1211
|
return;
|
|
1334
|
-
(
|
|
1335
|
-
top:
|
|
1336
|
-
left:
|
|
1212
|
+
(_element instanceof Document ? window.document.body : _element)?.scrollTo({
|
|
1213
|
+
top: shared.toValue(_y) ?? y.value,
|
|
1214
|
+
left: shared.toValue(_x) ?? x.value,
|
|
1337
1215
|
behavior: shared.toValue(behavior)
|
|
1338
1216
|
});
|
|
1339
1217
|
}
|
|
@@ -1362,7 +1240,9 @@ function useScroll(element, options = {}) {
|
|
|
1362
1240
|
};
|
|
1363
1241
|
const onScrollEndDebounced = shared.useDebounceFn(onScrollEnd, throttle + idle);
|
|
1364
1242
|
const setArrivedState = (target) => {
|
|
1365
|
-
|
|
1243
|
+
if (!window)
|
|
1244
|
+
return;
|
|
1245
|
+
const el = target.document ? target.document.documentElement : target.documentElement ?? target;
|
|
1366
1246
|
const { display, flexDirection } = getComputedStyle(el);
|
|
1367
1247
|
const scrollLeft = el.scrollLeft;
|
|
1368
1248
|
directions.left = scrollLeft < internalX.value;
|
|
@@ -1378,8 +1258,8 @@ function useScroll(element, options = {}) {
|
|
|
1378
1258
|
}
|
|
1379
1259
|
internalX.value = scrollLeft;
|
|
1380
1260
|
let scrollTop = el.scrollTop;
|
|
1381
|
-
if (target === document && !scrollTop)
|
|
1382
|
-
scrollTop = document.body.scrollTop;
|
|
1261
|
+
if (target === window.document && !scrollTop)
|
|
1262
|
+
scrollTop = window.document.body.scrollTop;
|
|
1383
1263
|
directions.top = scrollTop < internalY.value;
|
|
1384
1264
|
directions.bottom = scrollTop > internalY.value;
|
|
1385
1265
|
const top = Math.abs(scrollTop) <= 0 + (offset.top || 0);
|
|
@@ -1394,7 +1274,9 @@ function useScroll(element, options = {}) {
|
|
|
1394
1274
|
internalY.value = scrollTop;
|
|
1395
1275
|
};
|
|
1396
1276
|
const onScrollHandler = (e) => {
|
|
1397
|
-
|
|
1277
|
+
if (!window)
|
|
1278
|
+
return;
|
|
1279
|
+
const eventTarget = e.target.documentElement ?? e.target;
|
|
1398
1280
|
setArrivedState(eventTarget);
|
|
1399
1281
|
isScrolling.value = true;
|
|
1400
1282
|
onScrollEndDebounced(e);
|
|
@@ -1420,53 +1302,47 @@ function useScroll(element, options = {}) {
|
|
|
1420
1302
|
directions,
|
|
1421
1303
|
measure() {
|
|
1422
1304
|
const _element = shared.toValue(element);
|
|
1423
|
-
if (_element)
|
|
1305
|
+
if (window && _element)
|
|
1424
1306
|
setArrivedState(_element);
|
|
1425
1307
|
}
|
|
1426
1308
|
};
|
|
1427
1309
|
}
|
|
1428
1310
|
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
for (var prop in b || (b = {}))
|
|
1438
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
1439
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1440
|
-
if (__getOwnPropSymbols$9)
|
|
1441
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
1442
|
-
if (__propIsEnum$9.call(b, prop))
|
|
1443
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1444
|
-
}
|
|
1445
|
-
return a;
|
|
1446
|
-
};
|
|
1447
|
-
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
1311
|
+
function resolveElement(el) {
|
|
1312
|
+
if (typeof Window !== "undefined" && el instanceof Window)
|
|
1313
|
+
return el.document.documentElement;
|
|
1314
|
+
if (typeof Document !== "undefined" && el instanceof Document)
|
|
1315
|
+
return el.documentElement;
|
|
1316
|
+
return el;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1448
1319
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1449
|
-
var _a;
|
|
1450
1320
|
const {
|
|
1451
1321
|
direction = "bottom",
|
|
1452
1322
|
interval = 100
|
|
1453
1323
|
} = options;
|
|
1454
1324
|
const state = vueDemi.reactive(useScroll(
|
|
1455
1325
|
element,
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1326
|
+
{
|
|
1327
|
+
...options,
|
|
1328
|
+
offset: {
|
|
1329
|
+
[direction]: options.distance ?? 0,
|
|
1330
|
+
...options.offset
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1461
1333
|
));
|
|
1462
1334
|
const promise = vueDemi.ref();
|
|
1463
1335
|
const isLoading = vueDemi.computed(() => !!promise.value);
|
|
1336
|
+
const observedElement = vueDemi.computed(() => {
|
|
1337
|
+
return resolveElement(shared.toValue(element));
|
|
1338
|
+
});
|
|
1339
|
+
const isElementVisible = useElementVisibility(observedElement);
|
|
1464
1340
|
function checkAndLoad() {
|
|
1465
1341
|
state.measure();
|
|
1466
|
-
|
|
1467
|
-
if (!el || !el.offsetParent)
|
|
1342
|
+
if (!observedElement.value || !isElementVisible.value)
|
|
1468
1343
|
return;
|
|
1469
|
-
const
|
|
1344
|
+
const { scrollHeight, clientHeight, scrollWidth, clientWidth } = observedElement.value;
|
|
1345
|
+
const isNarrower = direction === "bottom" || direction === "top" ? scrollHeight <= clientHeight : scrollWidth <= clientWidth;
|
|
1470
1346
|
if (state.arrivedState[direction] || isNarrower) {
|
|
1471
1347
|
if (!promise.value) {
|
|
1472
1348
|
promise.value = Promise.all([
|
|
@@ -1480,7 +1356,7 @@ function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
|
1480
1356
|
}
|
|
1481
1357
|
}
|
|
1482
1358
|
vueDemi.watch(
|
|
1483
|
-
() => [state.arrivedState[direction],
|
|
1359
|
+
() => [state.arrivedState[direction], isElementVisible.value],
|
|
1484
1360
|
checkAndLoad,
|
|
1485
1361
|
{ immediate: true }
|
|
1486
1362
|
);
|
|
@@ -1532,31 +1408,12 @@ const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponen
|
|
|
1532
1408
|
}
|
|
1533
1409
|
});
|
|
1534
1410
|
|
|
1535
|
-
var __defProp$7 = Object.defineProperty;
|
|
1536
|
-
var __defProps$6 = Object.defineProperties;
|
|
1537
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
1538
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1539
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1540
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1541
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1542
|
-
var __spreadValues$7 = (a, b) => {
|
|
1543
|
-
for (var prop in b || (b = {}))
|
|
1544
|
-
if (__hasOwnProp$8.call(b, prop))
|
|
1545
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1546
|
-
if (__getOwnPropSymbols$8)
|
|
1547
|
-
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
1548
|
-
if (__propIsEnum$8.call(b, prop))
|
|
1549
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1550
|
-
}
|
|
1551
|
-
return a;
|
|
1552
|
-
};
|
|
1553
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1554
1411
|
const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1555
1412
|
name: "UseMousePressed",
|
|
1556
1413
|
props: ["touch", "initialValue", "as"],
|
|
1557
1414
|
setup(props, { slots }) {
|
|
1558
1415
|
const target = vueDemi.ref();
|
|
1559
|
-
const data = vueDemi.reactive(core.useMousePressed(
|
|
1416
|
+
const data = vueDemi.reactive(core.useMousePressed({ ...props, target }));
|
|
1560
1417
|
return () => {
|
|
1561
1418
|
if (slots.default)
|
|
1562
1419
|
return vueDemi.h(props.as || "div", { ref: target }, slots.default(data));
|
|
@@ -1575,30 +1432,11 @@ const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1575
1432
|
}
|
|
1576
1433
|
});
|
|
1577
1434
|
|
|
1578
|
-
var __defProp$6 = Object.defineProperty;
|
|
1579
|
-
var __defProps$5 = Object.defineProperties;
|
|
1580
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
1581
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1582
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1583
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1584
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1585
|
-
var __spreadValues$6 = (a, b) => {
|
|
1586
|
-
for (var prop in b || (b = {}))
|
|
1587
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
1588
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1589
|
-
if (__getOwnPropSymbols$7)
|
|
1590
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1591
|
-
if (__propIsEnum$7.call(b, prop))
|
|
1592
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1593
|
-
}
|
|
1594
|
-
return a;
|
|
1595
|
-
};
|
|
1596
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1597
1435
|
const UseNow = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1598
1436
|
name: "UseNow",
|
|
1599
1437
|
props: ["interval"],
|
|
1600
1438
|
setup(props, { slots }) {
|
|
1601
|
-
const data = vueDemi.reactive(core.useNow(
|
|
1439
|
+
const data = vueDemi.reactive(core.useNow({ ...props, controls: true }));
|
|
1602
1440
|
return () => {
|
|
1603
1441
|
if (slots.default)
|
|
1604
1442
|
return slots.default(data);
|
|
@@ -1621,25 +1459,6 @@ const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1621
1459
|
}
|
|
1622
1460
|
});
|
|
1623
1461
|
|
|
1624
|
-
var __defProp$5 = Object.defineProperty;
|
|
1625
|
-
var __defProps$4 = Object.defineProperties;
|
|
1626
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1627
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1628
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1629
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1630
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1631
|
-
var __spreadValues$5 = (a, b) => {
|
|
1632
|
-
for (var prop in b || (b = {}))
|
|
1633
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
1634
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1635
|
-
if (__getOwnPropSymbols$6)
|
|
1636
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1637
|
-
if (__propIsEnum$6.call(b, prop))
|
|
1638
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1639
|
-
}
|
|
1640
|
-
return a;
|
|
1641
|
-
};
|
|
1642
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1643
1462
|
const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1644
1463
|
name: "UseOffsetPagination",
|
|
1645
1464
|
props: [
|
|
@@ -1656,23 +1475,21 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompon
|
|
|
1656
1475
|
"page-count-change"
|
|
1657
1476
|
],
|
|
1658
1477
|
setup(props, { slots, emit }) {
|
|
1659
|
-
const data = vueDemi.reactive(core.useOffsetPagination(
|
|
1478
|
+
const data = vueDemi.reactive(core.useOffsetPagination({
|
|
1479
|
+
...props,
|
|
1660
1480
|
onPageChange(...args) {
|
|
1661
|
-
|
|
1662
|
-
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
1481
|
+
props.onPageChange?.(...args);
|
|
1663
1482
|
emit("page-change", ...args);
|
|
1664
1483
|
},
|
|
1665
1484
|
onPageSizeChange(...args) {
|
|
1666
|
-
|
|
1667
|
-
(_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
|
|
1485
|
+
props.onPageSizeChange?.(...args);
|
|
1668
1486
|
emit("page-size-change", ...args);
|
|
1669
1487
|
},
|
|
1670
1488
|
onPageCountChange(...args) {
|
|
1671
|
-
|
|
1672
|
-
(_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
|
|
1489
|
+
props.onPageCountChange?.(...args);
|
|
1673
1490
|
emit("page-count-change", ...args);
|
|
1674
1491
|
}
|
|
1675
|
-
}))
|
|
1492
|
+
}));
|
|
1676
1493
|
return () => {
|
|
1677
1494
|
if (slots.default)
|
|
1678
1495
|
return slots.default(data);
|
|
@@ -1706,25 +1523,6 @@ const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1706
1523
|
}
|
|
1707
1524
|
});
|
|
1708
1525
|
|
|
1709
|
-
var __defProp$4 = Object.defineProperty;
|
|
1710
|
-
var __defProps$3 = Object.defineProperties;
|
|
1711
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1712
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1713
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1714
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1715
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1716
|
-
var __spreadValues$4 = (a, b) => {
|
|
1717
|
-
for (var prop in b || (b = {}))
|
|
1718
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
1719
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1720
|
-
if (__getOwnPropSymbols$5)
|
|
1721
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1722
|
-
if (__propIsEnum$5.call(b, prop))
|
|
1723
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1724
|
-
}
|
|
1725
|
-
return a;
|
|
1726
|
-
};
|
|
1727
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1728
1526
|
const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1729
1527
|
name: "UsePointer",
|
|
1730
1528
|
props: [
|
|
@@ -1734,9 +1532,10 @@ const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1734
1532
|
],
|
|
1735
1533
|
setup(props, { slots }) {
|
|
1736
1534
|
const el = vueDemi.ref(null);
|
|
1737
|
-
const data = vueDemi.reactive(core.usePointer(
|
|
1535
|
+
const data = vueDemi.reactive(core.usePointer({
|
|
1536
|
+
...props,
|
|
1738
1537
|
target: props.target === "self" ? el : defaultWindow
|
|
1739
|
-
}))
|
|
1538
|
+
}));
|
|
1740
1539
|
return () => {
|
|
1741
1540
|
if (slots.default)
|
|
1742
1541
|
return slots.default(data, { ref: el });
|
|
@@ -1822,23 +1621,8 @@ const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ vueDemi.define
|
|
|
1822
1621
|
}
|
|
1823
1622
|
});
|
|
1824
1623
|
|
|
1825
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1826
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1827
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1828
|
-
var __objRest = (source, exclude) => {
|
|
1829
|
-
var target = {};
|
|
1830
|
-
for (var prop in source)
|
|
1831
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1832
|
-
target[prop] = source[prop];
|
|
1833
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
1834
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1835
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1836
|
-
target[prop] = source[prop];
|
|
1837
|
-
}
|
|
1838
|
-
return target;
|
|
1839
|
-
};
|
|
1840
1624
|
function useMutationObserver(target, callback, options = {}) {
|
|
1841
|
-
const
|
|
1625
|
+
const { window = defaultWindow, ...mutationOptions } = options;
|
|
1842
1626
|
let observer;
|
|
1843
1627
|
const isSupported = useSupported(() => window && "MutationObserver" in window);
|
|
1844
1628
|
const cleanup = () => {
|
|
@@ -1872,16 +1656,12 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1872
1656
|
function useCssVar(prop, target, options = {}) {
|
|
1873
1657
|
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1874
1658
|
const variable = vueDemi.ref(initialValue);
|
|
1875
|
-
const elRef = vueDemi.computed(() =>
|
|
1876
|
-
var _a;
|
|
1877
|
-
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1878
|
-
});
|
|
1659
|
+
const elRef = vueDemi.computed(() => unrefElement(target) || window?.document?.documentElement);
|
|
1879
1660
|
function updateCssVar() {
|
|
1880
|
-
var _a;
|
|
1881
1661
|
const key = shared.toValue(prop);
|
|
1882
1662
|
const el = shared.toValue(elRef);
|
|
1883
1663
|
if (el && window) {
|
|
1884
|
-
const value =
|
|
1664
|
+
const value = window.getComputedStyle(el).getPropertyValue(key)?.trim();
|
|
1885
1665
|
variable.value = value || initialValue;
|
|
1886
1666
|
}
|
|
1887
1667
|
}
|
|
@@ -1899,8 +1679,7 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1899
1679
|
vueDemi.watch(
|
|
1900
1680
|
variable,
|
|
1901
1681
|
(val) => {
|
|
1902
|
-
|
|
1903
|
-
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
1682
|
+
if (elRef.value?.style)
|
|
1904
1683
|
elRef.value.style.setProperty(shared.toValue(prop), val);
|
|
1905
1684
|
}
|
|
1906
1685
|
);
|
|
@@ -1980,25 +1759,6 @@ const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponen
|
|
|
1980
1759
|
}
|
|
1981
1760
|
});
|
|
1982
1761
|
|
|
1983
|
-
var __defProp$3 = Object.defineProperty;
|
|
1984
|
-
var __defProps$2 = Object.defineProperties;
|
|
1985
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1986
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1987
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1988
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1989
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1990
|
-
var __spreadValues$3 = (a, b) => {
|
|
1991
|
-
for (var prop in b || (b = {}))
|
|
1992
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
1993
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1994
|
-
if (__getOwnPropSymbols$3)
|
|
1995
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1996
|
-
if (__propIsEnum$3.call(b, prop))
|
|
1997
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
1998
|
-
}
|
|
1999
|
-
return a;
|
|
2000
|
-
};
|
|
2001
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2002
1762
|
const vScroll = {
|
|
2003
1763
|
[shared.directiveHooks.mounted](el, binding) {
|
|
2004
1764
|
if (typeof binding.value === "function") {
|
|
@@ -2013,18 +1773,17 @@ const vScroll = {
|
|
|
2013
1773
|
});
|
|
2014
1774
|
} else {
|
|
2015
1775
|
const [handler, options] = binding.value;
|
|
2016
|
-
const state = useScroll(el,
|
|
1776
|
+
const state = useScroll(el, {
|
|
1777
|
+
...options,
|
|
2017
1778
|
onScroll(e) {
|
|
2018
|
-
|
|
2019
|
-
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
1779
|
+
options.onScroll?.(e);
|
|
2020
1780
|
handler(state);
|
|
2021
1781
|
},
|
|
2022
1782
|
onStop(e) {
|
|
2023
|
-
|
|
2024
|
-
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
1783
|
+
options.onStop?.(e);
|
|
2025
1784
|
handler(state);
|
|
2026
1785
|
}
|
|
2027
|
-
})
|
|
1786
|
+
});
|
|
2028
1787
|
}
|
|
2029
1788
|
}
|
|
2030
1789
|
};
|
|
@@ -2056,8 +1815,9 @@ function useScrollLock(element, initialState = false) {
|
|
|
2056
1815
|
let stopTouchMoveListener = null;
|
|
2057
1816
|
let initialOverflow;
|
|
2058
1817
|
vueDemi.watch(shared.toRef(element), (el) => {
|
|
2059
|
-
|
|
2060
|
-
|
|
1818
|
+
const target = resolveElement(shared.toValue(el));
|
|
1819
|
+
if (target) {
|
|
1820
|
+
const ele = target;
|
|
2061
1821
|
initialOverflow = ele.style.overflow;
|
|
2062
1822
|
if (isLocked.value)
|
|
2063
1823
|
ele.style.overflow = "hidden";
|
|
@@ -2066,12 +1826,12 @@ function useScrollLock(element, initialState = false) {
|
|
|
2066
1826
|
immediate: true
|
|
2067
1827
|
});
|
|
2068
1828
|
const lock = () => {
|
|
2069
|
-
const
|
|
2070
|
-
if (!
|
|
1829
|
+
const el = resolveElement(shared.toValue(element));
|
|
1830
|
+
if (!el || isLocked.value)
|
|
2071
1831
|
return;
|
|
2072
1832
|
if (shared.isIOS) {
|
|
2073
1833
|
stopTouchMoveListener = useEventListener(
|
|
2074
|
-
|
|
1834
|
+
el,
|
|
2075
1835
|
"touchmove",
|
|
2076
1836
|
(e) => {
|
|
2077
1837
|
preventDefault(e);
|
|
@@ -2079,15 +1839,15 @@ function useScrollLock(element, initialState = false) {
|
|
|
2079
1839
|
{ passive: false }
|
|
2080
1840
|
);
|
|
2081
1841
|
}
|
|
2082
|
-
|
|
1842
|
+
el.style.overflow = "hidden";
|
|
2083
1843
|
isLocked.value = true;
|
|
2084
1844
|
};
|
|
2085
1845
|
const unlock = () => {
|
|
2086
|
-
const
|
|
2087
|
-
if (!
|
|
1846
|
+
const el = resolveElement(shared.toValue(element));
|
|
1847
|
+
if (!el || !isLocked.value)
|
|
2088
1848
|
return;
|
|
2089
|
-
shared.isIOS &&
|
|
2090
|
-
|
|
1849
|
+
shared.isIOS && stopTouchMoveListener?.();
|
|
1850
|
+
el.style.overflow = initialOverflow;
|
|
2091
1851
|
isLocked.value = false;
|
|
2092
1852
|
};
|
|
2093
1853
|
shared.tryOnScopeDispose(unlock);
|
|
@@ -2118,30 +1878,11 @@ function onScrollLock() {
|
|
|
2118
1878
|
}
|
|
2119
1879
|
const vScrollLock = onScrollLock();
|
|
2120
1880
|
|
|
2121
|
-
var __defProp$2 = Object.defineProperty;
|
|
2122
|
-
var __defProps$1 = Object.defineProperties;
|
|
2123
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
2124
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
2125
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
2126
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
2127
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2128
|
-
var __spreadValues$2 = (a, b) => {
|
|
2129
|
-
for (var prop in b || (b = {}))
|
|
2130
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
2131
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2132
|
-
if (__getOwnPropSymbols$2)
|
|
2133
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
2134
|
-
if (__propIsEnum$2.call(b, prop))
|
|
2135
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2136
|
-
}
|
|
2137
|
-
return a;
|
|
2138
|
-
};
|
|
2139
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
2140
1881
|
const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
2141
1882
|
name: "UseTimeAgo",
|
|
2142
1883
|
props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
|
|
2143
1884
|
setup(props, { slots }) {
|
|
2144
|
-
const data = vueDemi.reactive(core.useTimeAgo(() => props.time,
|
|
1885
|
+
const data = vueDemi.reactive(core.useTimeAgo(() => props.time, { ...props, controls: true }));
|
|
2145
1886
|
return () => {
|
|
2146
1887
|
if (slots.default)
|
|
2147
1888
|
return slots.default(data);
|
|
@@ -2149,30 +1890,11 @@ const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2149
1890
|
}
|
|
2150
1891
|
});
|
|
2151
1892
|
|
|
2152
|
-
var __defProp$1 = Object.defineProperty;
|
|
2153
|
-
var __defProps = Object.defineProperties;
|
|
2154
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2155
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
2156
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
2157
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
2158
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2159
|
-
var __spreadValues$1 = (a, b) => {
|
|
2160
|
-
for (var prop in b || (b = {}))
|
|
2161
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
2162
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2163
|
-
if (__getOwnPropSymbols$1)
|
|
2164
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
2165
|
-
if (__propIsEnum$1.call(b, prop))
|
|
2166
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2167
|
-
}
|
|
2168
|
-
return a;
|
|
2169
|
-
};
|
|
2170
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2171
1893
|
const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
2172
1894
|
name: "UseTimestamp",
|
|
2173
1895
|
props: ["immediate", "interval", "offset"],
|
|
2174
1896
|
setup(props, { slots }) {
|
|
2175
|
-
const data = vueDemi.reactive(core.useTimestamp(
|
|
1897
|
+
const data = vueDemi.reactive(core.useTimestamp({ ...props, controls: true }));
|
|
2176
1898
|
return () => {
|
|
2177
1899
|
if (slots.default)
|
|
2178
1900
|
return slots.default(data);
|
|
@@ -2180,22 +1902,6 @@ const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2180
1902
|
}
|
|
2181
1903
|
});
|
|
2182
1904
|
|
|
2183
|
-
var __defProp = Object.defineProperty;
|
|
2184
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2185
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2186
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2187
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2188
|
-
var __spreadValues = (a, b) => {
|
|
2189
|
-
for (var prop in b || (b = {}))
|
|
2190
|
-
if (__hasOwnProp.call(b, prop))
|
|
2191
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2192
|
-
if (__getOwnPropSymbols)
|
|
2193
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
2194
|
-
if (__propIsEnum.call(b, prop))
|
|
2195
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2196
|
-
}
|
|
2197
|
-
return a;
|
|
2198
|
-
};
|
|
2199
1905
|
const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
2200
1906
|
name: "UseVirtualList",
|
|
2201
1907
|
props: [
|
|
@@ -2210,11 +1916,11 @@ const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2210
1916
|
typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
|
|
2211
1917
|
return () => vueDemi.h(
|
|
2212
1918
|
"div",
|
|
2213
|
-
|
|
1919
|
+
{ ...containerProps },
|
|
2214
1920
|
[
|
|
2215
1921
|
vueDemi.h(
|
|
2216
1922
|
"div",
|
|
2217
|
-
|
|
1923
|
+
{ ...wrapperProps.value },
|
|
2218
1924
|
list.value.map((item) => vueDemi.h(
|
|
2219
1925
|
"div",
|
|
2220
1926
|
{ style: { overFlow: "hidden", height: item.height } },
|