@vueuse/components 10.3.0 → 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 +99 -413
- package/index.d.cts +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/index.iife.js +99 -413
- package/index.iife.min.js +1 -1
- package/index.mjs +99 -413
- package/package.json +5 -5
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;
|
|
@@ -118,9 +117,8 @@ function onClickOutside(target, handler, options = {}) {
|
|
|
118
117
|
}, { passive: true }),
|
|
119
118
|
detectIframe && useEventListener(window, "blur", (event) => {
|
|
120
119
|
setTimeout(() => {
|
|
121
|
-
var _a;
|
|
122
120
|
const el = unrefElement(target);
|
|
123
|
-
if (
|
|
121
|
+
if (window.document.activeElement?.tagName === "IFRAME" && !el?.contains(window.document.activeElement))
|
|
124
122
|
handler(event);
|
|
125
123
|
}, 0);
|
|
126
124
|
})
|
|
@@ -190,42 +188,25 @@ function onKeyStroke(...args) {
|
|
|
190
188
|
return useEventListener(target, eventName, listener, passive);
|
|
191
189
|
}
|
|
192
190
|
|
|
193
|
-
var __defProp$e = Object.defineProperty;
|
|
194
|
-
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
195
|
-
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
196
|
-
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
197
|
-
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
198
|
-
var __spreadValues$e = (a, b) => {
|
|
199
|
-
for (var prop in b || (b = {}))
|
|
200
|
-
if (__hasOwnProp$g.call(b, prop))
|
|
201
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
202
|
-
if (__getOwnPropSymbols$g)
|
|
203
|
-
for (var prop of __getOwnPropSymbols$g(b)) {
|
|
204
|
-
if (__propIsEnum$g.call(b, prop))
|
|
205
|
-
__defNormalProp$e(a, prop, b[prop]);
|
|
206
|
-
}
|
|
207
|
-
return a;
|
|
208
|
-
};
|
|
209
191
|
const vOnKeyStroke = {
|
|
210
192
|
[shared.directiveHooks.mounted](el, binding) {
|
|
211
|
-
|
|
212
|
-
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
193
|
+
const keys = binding.arg?.split(",") ?? true;
|
|
213
194
|
if (typeof binding.value === "function") {
|
|
214
195
|
onKeyStroke(keys, binding.value, {
|
|
215
196
|
target: el
|
|
216
197
|
});
|
|
217
198
|
} else {
|
|
218
199
|
const [handler, options] = binding.value;
|
|
219
|
-
onKeyStroke(keys, handler,
|
|
220
|
-
target: el
|
|
221
|
-
|
|
200
|
+
onKeyStroke(keys, handler, {
|
|
201
|
+
target: el,
|
|
202
|
+
...options
|
|
203
|
+
});
|
|
222
204
|
}
|
|
223
205
|
}
|
|
224
206
|
};
|
|
225
207
|
|
|
226
208
|
const DEFAULT_DELAY = 500;
|
|
227
209
|
function onLongPress(target, handler, options) {
|
|
228
|
-
var _a, _b;
|
|
229
210
|
const elementRef = vueDemi.computed(() => unrefElement(target));
|
|
230
211
|
let timeout;
|
|
231
212
|
function clear() {
|
|
@@ -235,22 +216,21 @@ function onLongPress(target, handler, options) {
|
|
|
235
216
|
}
|
|
236
217
|
}
|
|
237
218
|
function onDown(ev) {
|
|
238
|
-
|
|
239
|
-
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)
|
|
240
220
|
return;
|
|
241
221
|
clear();
|
|
242
|
-
if (
|
|
222
|
+
if (options?.modifiers?.prevent)
|
|
243
223
|
ev.preventDefault();
|
|
244
|
-
if (
|
|
224
|
+
if (options?.modifiers?.stop)
|
|
245
225
|
ev.stopPropagation();
|
|
246
226
|
timeout = setTimeout(
|
|
247
227
|
() => handler(ev),
|
|
248
|
-
|
|
228
|
+
options?.delay ?? DEFAULT_DELAY
|
|
249
229
|
);
|
|
250
230
|
}
|
|
251
231
|
const listenerOptions = {
|
|
252
|
-
capture:
|
|
253
|
-
once:
|
|
232
|
+
capture: options?.modifiers?.capture,
|
|
233
|
+
once: options?.modifiers?.once
|
|
254
234
|
};
|
|
255
235
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions);
|
|
256
236
|
useEventListener(elementRef, ["pointerup", "pointerleave"], clear, listenerOptions);
|
|
@@ -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 {
|
|
@@ -556,22 +517,6 @@ function usePreferredDark(options) {
|
|
|
556
517
|
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
557
518
|
}
|
|
558
519
|
|
|
559
|
-
var __defProp$c = Object.defineProperty;
|
|
560
|
-
var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
|
|
561
|
-
var __hasOwnProp$e = Object.prototype.hasOwnProperty;
|
|
562
|
-
var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
|
|
563
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
564
|
-
var __spreadValues$c = (a, b) => {
|
|
565
|
-
for (var prop in b || (b = {}))
|
|
566
|
-
if (__hasOwnProp$e.call(b, prop))
|
|
567
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
568
|
-
if (__getOwnPropSymbols$e)
|
|
569
|
-
for (var prop of __getOwnPropSymbols$e(b)) {
|
|
570
|
-
if (__propIsEnum$e.call(b, prop))
|
|
571
|
-
__defNormalProp$c(a, prop, b[prop]);
|
|
572
|
-
}
|
|
573
|
-
return a;
|
|
574
|
-
};
|
|
575
520
|
function useColorMode(options = {}) {
|
|
576
521
|
const {
|
|
577
522
|
selector = "html",
|
|
@@ -585,11 +530,12 @@ function useColorMode(options = {}) {
|
|
|
585
530
|
emitAuto,
|
|
586
531
|
disableTransition = true
|
|
587
532
|
} = options;
|
|
588
|
-
const modes =
|
|
533
|
+
const modes = {
|
|
589
534
|
auto: "",
|
|
590
535
|
light: "light",
|
|
591
|
-
dark: "dark"
|
|
592
|
-
|
|
536
|
+
dark: "dark",
|
|
537
|
+
...options.modes || {}
|
|
538
|
+
};
|
|
593
539
|
const preferredDark = usePreferredDark({ window });
|
|
594
540
|
const system = vueDemi.computed(() => preferredDark.value ? "dark" : "light");
|
|
595
541
|
const store = storageRef || (storageKey == null ? shared.toRef(initialValue) : useStorage(storageKey, initialValue, storage, { window, listenToStorageChanges }));
|
|
@@ -599,7 +545,7 @@ function useColorMode(options = {}) {
|
|
|
599
545
|
const updateHTMLAttrs = getSSRHandler(
|
|
600
546
|
"updateHTMLAttrs",
|
|
601
547
|
(selector2, attribute2, value) => {
|
|
602
|
-
const el = typeof selector2 === "string" ? window
|
|
548
|
+
const el = typeof selector2 === "string" ? window?.document.querySelector(selector2) : unrefElement(selector2);
|
|
603
549
|
if (!el)
|
|
604
550
|
return;
|
|
605
551
|
let style;
|
|
@@ -627,8 +573,7 @@ function useColorMode(options = {}) {
|
|
|
627
573
|
}
|
|
628
574
|
);
|
|
629
575
|
function defaultOnChanged(mode) {
|
|
630
|
-
|
|
631
|
-
updateHTMLAttrs(selector, attribute, (_a = modes[mode]) != null ? _a : mode);
|
|
576
|
+
updateHTMLAttrs(selector, attribute, modes[mode] ?? mode);
|
|
632
577
|
}
|
|
633
578
|
function onChanged(mode) {
|
|
634
579
|
if (options.onChanged)
|
|
@@ -746,25 +691,6 @@ const UseDocumentVisibility = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComp
|
|
|
746
691
|
}
|
|
747
692
|
});
|
|
748
693
|
|
|
749
|
-
var __defProp$b = Object.defineProperty;
|
|
750
|
-
var __defProps$9 = Object.defineProperties;
|
|
751
|
-
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
752
|
-
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
753
|
-
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
754
|
-
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
755
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
756
|
-
var __spreadValues$b = (a, b) => {
|
|
757
|
-
for (var prop in b || (b = {}))
|
|
758
|
-
if (__hasOwnProp$d.call(b, prop))
|
|
759
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
760
|
-
if (__getOwnPropSymbols$d)
|
|
761
|
-
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
762
|
-
if (__propIsEnum$d.call(b, prop))
|
|
763
|
-
__defNormalProp$b(a, prop, b[prop]);
|
|
764
|
-
}
|
|
765
|
-
return a;
|
|
766
|
-
};
|
|
767
|
-
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
768
694
|
const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
769
695
|
name: "UseDraggable",
|
|
770
696
|
props: [
|
|
@@ -784,10 +710,7 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
784
710
|
],
|
|
785
711
|
setup(props, { slots }) {
|
|
786
712
|
const target = vueDemi.ref();
|
|
787
|
-
const handle = vueDemi.computed(() =>
|
|
788
|
-
var _a;
|
|
789
|
-
return (_a = props.handle) != null ? _a : target.value;
|
|
790
|
-
});
|
|
713
|
+
const handle = vueDemi.computed(() => props.handle ?? target.value);
|
|
791
714
|
const storageValue = props.storageKey && core.useStorage(
|
|
792
715
|
props.storageKey,
|
|
793
716
|
shared.toValue(props.initialValue) || { x: 0, y: 0 },
|
|
@@ -795,18 +718,18 @@ const UseDraggable = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
795
718
|
);
|
|
796
719
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
797
720
|
const onEnd = (position, event) => {
|
|
798
|
-
|
|
799
|
-
(_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
|
|
721
|
+
props.onEnd?.(position, event);
|
|
800
722
|
if (!storageValue)
|
|
801
723
|
return;
|
|
802
724
|
storageValue.value.x = position.x;
|
|
803
725
|
storageValue.value.y = position.y;
|
|
804
726
|
};
|
|
805
|
-
const data = vueDemi.reactive(core.useDraggable(target,
|
|
727
|
+
const data = vueDemi.reactive(core.useDraggable(target, {
|
|
728
|
+
...props,
|
|
806
729
|
handle,
|
|
807
730
|
initialValue,
|
|
808
731
|
onEnd
|
|
809
|
-
}))
|
|
732
|
+
}));
|
|
810
733
|
return () => {
|
|
811
734
|
if (slots.default)
|
|
812
735
|
return vueDemi.h(props.as || "div", { ref: target, style: `touch-action:none;${data.style}` }, slots.default(data));
|
|
@@ -864,7 +787,7 @@ const vElementHover = {
|
|
|
864
787
|
|
|
865
788
|
const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
866
789
|
name: "UseElementSize",
|
|
867
|
-
props: ["width", "height", "box"],
|
|
790
|
+
props: ["width", "height", "box", "as"],
|
|
868
791
|
setup(props, { slots }) {
|
|
869
792
|
const target = vueDemi.ref();
|
|
870
793
|
const data = vueDemi.reactive(core.useElementSize(target, { width: props.width, height: props.height }, { box: props.box }));
|
|
@@ -875,23 +798,8 @@ const UseElementSize = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
875
798
|
}
|
|
876
799
|
});
|
|
877
800
|
|
|
878
|
-
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
879
|
-
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
880
|
-
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
881
|
-
var __objRest$1 = (source, exclude) => {
|
|
882
|
-
var target = {};
|
|
883
|
-
for (var prop in source)
|
|
884
|
-
if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
885
|
-
target[prop] = source[prop];
|
|
886
|
-
if (source != null && __getOwnPropSymbols$c)
|
|
887
|
-
for (var prop of __getOwnPropSymbols$c(source)) {
|
|
888
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
|
|
889
|
-
target[prop] = source[prop];
|
|
890
|
-
}
|
|
891
|
-
return target;
|
|
892
|
-
};
|
|
893
801
|
function useResizeObserver(target, callback, options = {}) {
|
|
894
|
-
const
|
|
802
|
+
const { window = defaultWindow, ...observerOptions } = options;
|
|
895
803
|
let observer;
|
|
896
804
|
const isSupported = useSupported(() => window && "ResizeObserver" in window);
|
|
897
805
|
const cleanup = () => {
|
|
@@ -928,10 +836,7 @@ function useResizeObserver(target, callback, options = {}) {
|
|
|
928
836
|
|
|
929
837
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
930
838
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
931
|
-
const isSVG = vueDemi.computed(() =>
|
|
932
|
-
var _a, _b;
|
|
933
|
-
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
934
|
-
});
|
|
839
|
+
const isSVG = vueDemi.computed(() => unrefElement(target)?.namespaceURI?.includes("svg"));
|
|
935
840
|
const width = vueDemi.ref(initialSize.width);
|
|
936
841
|
const height = vueDemi.ref(initialSize.height);
|
|
937
842
|
useResizeObserver(
|
|
@@ -973,8 +878,7 @@ function useElementSize(target, initialSize = { width: 0, height: 0 }, options =
|
|
|
973
878
|
|
|
974
879
|
const vElementSize = {
|
|
975
880
|
[shared.directiveHooks.mounted](el, binding) {
|
|
976
|
-
|
|
977
|
-
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];
|
|
978
882
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
979
883
|
const { width, height } = useElementSize(el, ...options);
|
|
980
884
|
vueDemi.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1064,7 +968,8 @@ function useElementVisibility(element, { window = defaultWindow, scrollTarget }
|
|
|
1064
968
|
},
|
|
1065
969
|
{
|
|
1066
970
|
root: scrollTarget,
|
|
1067
|
-
window
|
|
971
|
+
window,
|
|
972
|
+
threshold: 0
|
|
1068
973
|
}
|
|
1069
974
|
);
|
|
1070
975
|
return elementIsVisible;
|
|
@@ -1135,25 +1040,6 @@ const UseIdle = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1135
1040
|
}
|
|
1136
1041
|
});
|
|
1137
1042
|
|
|
1138
|
-
var __defProp$a = Object.defineProperty;
|
|
1139
|
-
var __defProps$8 = Object.defineProperties;
|
|
1140
|
-
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
1141
|
-
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
1142
|
-
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
1143
|
-
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
1144
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1145
|
-
var __spreadValues$a = (a, b) => {
|
|
1146
|
-
for (var prop in b || (b = {}))
|
|
1147
|
-
if (__hasOwnProp$b.call(b, prop))
|
|
1148
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
1149
|
-
if (__getOwnPropSymbols$b)
|
|
1150
|
-
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
1151
|
-
if (__propIsEnum$b.call(b, prop))
|
|
1152
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
1153
|
-
}
|
|
1154
|
-
return a;
|
|
1155
|
-
};
|
|
1156
|
-
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
1157
1043
|
function useAsyncState(promise, initialState, options) {
|
|
1158
1044
|
const {
|
|
1159
1045
|
immediate = true,
|
|
@@ -1163,7 +1049,7 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1163
1049
|
resetOnExecute = true,
|
|
1164
1050
|
shallow = true,
|
|
1165
1051
|
throwError
|
|
1166
|
-
} = options
|
|
1052
|
+
} = options ?? {};
|
|
1167
1053
|
const state = shallow ? vueDemi.shallowRef(initialState) : vueDemi.ref(initialState);
|
|
1168
1054
|
const isReady = vueDemi.ref(false);
|
|
1169
1055
|
const isLoading = vueDemi.ref(false);
|
|
@@ -1206,29 +1092,14 @@ function useAsyncState(promise, initialState, options) {
|
|
|
1206
1092
|
shared.until(isLoading).toBe(false).then(() => resolve(shell)).catch(reject);
|
|
1207
1093
|
});
|
|
1208
1094
|
}
|
|
1209
|
-
return
|
|
1095
|
+
return {
|
|
1096
|
+
...shell,
|
|
1210
1097
|
then(onFulfilled, onRejected) {
|
|
1211
1098
|
return waitUntilIsLoaded().then(onFulfilled, onRejected);
|
|
1212
1099
|
}
|
|
1213
|
-
}
|
|
1100
|
+
};
|
|
1214
1101
|
}
|
|
1215
1102
|
|
|
1216
|
-
var __defProp$9 = Object.defineProperty;
|
|
1217
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
1218
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
1219
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
1220
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1221
|
-
var __spreadValues$9 = (a, b) => {
|
|
1222
|
-
for (var prop in b || (b = {}))
|
|
1223
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
1224
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
1225
|
-
if (__getOwnPropSymbols$a)
|
|
1226
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
1227
|
-
if (__propIsEnum$a.call(b, prop))
|
|
1228
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
1229
|
-
}
|
|
1230
|
-
return a;
|
|
1231
|
-
};
|
|
1232
1103
|
async function loadImage(options) {
|
|
1233
1104
|
return new Promise((resolve, reject) => {
|
|
1234
1105
|
const img = new Image();
|
|
@@ -1254,9 +1125,10 @@ function useImage(options, asyncStateOptions = {}) {
|
|
|
1254
1125
|
const state = useAsyncState(
|
|
1255
1126
|
() => loadImage(shared.toValue(options)),
|
|
1256
1127
|
void 0,
|
|
1257
|
-
|
|
1258
|
-
resetOnExecute: true
|
|
1259
|
-
|
|
1128
|
+
{
|
|
1129
|
+
resetOnExecute: true,
|
|
1130
|
+
...asyncStateOptions
|
|
1131
|
+
}
|
|
1260
1132
|
);
|
|
1261
1133
|
vueDemi.watch(
|
|
1262
1134
|
() => shared.toValue(options),
|
|
@@ -1332,15 +1204,14 @@ function useScroll(element, options = {}) {
|
|
|
1332
1204
|
}
|
|
1333
1205
|
});
|
|
1334
1206
|
function scrollTo(_x, _y) {
|
|
1335
|
-
var _a, _b, _c;
|
|
1336
1207
|
if (!window)
|
|
1337
1208
|
return;
|
|
1338
1209
|
const _element = shared.toValue(element);
|
|
1339
1210
|
if (!_element)
|
|
1340
1211
|
return;
|
|
1341
|
-
(
|
|
1342
|
-
top:
|
|
1343
|
-
left:
|
|
1212
|
+
(_element instanceof Document ? window.document.body : _element)?.scrollTo({
|
|
1213
|
+
top: shared.toValue(_y) ?? y.value,
|
|
1214
|
+
left: shared.toValue(_x) ?? x.value,
|
|
1344
1215
|
behavior: shared.toValue(behavior)
|
|
1345
1216
|
});
|
|
1346
1217
|
}
|
|
@@ -1371,7 +1242,7 @@ function useScroll(element, options = {}) {
|
|
|
1371
1242
|
const setArrivedState = (target) => {
|
|
1372
1243
|
if (!window)
|
|
1373
1244
|
return;
|
|
1374
|
-
const el = target
|
|
1245
|
+
const el = target.document ? target.document.documentElement : target.documentElement ?? target;
|
|
1375
1246
|
const { display, flexDirection } = getComputedStyle(el);
|
|
1376
1247
|
const scrollLeft = el.scrollLeft;
|
|
1377
1248
|
directions.left = scrollLeft < internalX.value;
|
|
@@ -1405,7 +1276,7 @@ function useScroll(element, options = {}) {
|
|
|
1405
1276
|
const onScrollHandler = (e) => {
|
|
1406
1277
|
if (!window)
|
|
1407
1278
|
return;
|
|
1408
|
-
const eventTarget = e.target
|
|
1279
|
+
const eventTarget = e.target.documentElement ?? e.target;
|
|
1409
1280
|
setArrivedState(eventTarget);
|
|
1410
1281
|
isScrolling.value = true;
|
|
1411
1282
|
onScrollEndDebounced(e);
|
|
@@ -1437,48 +1308,33 @@ function useScroll(element, options = {}) {
|
|
|
1437
1308
|
};
|
|
1438
1309
|
}
|
|
1439
1310
|
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
for (var prop in b || (b = {}))
|
|
1449
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
1450
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1451
|
-
if (__getOwnPropSymbols$9)
|
|
1452
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
1453
|
-
if (__propIsEnum$9.call(b, prop))
|
|
1454
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
1455
|
-
}
|
|
1456
|
-
return a;
|
|
1457
|
-
};
|
|
1458
|
-
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
|
+
|
|
1459
1319
|
function useInfiniteScroll(element, onLoadMore, options = {}) {
|
|
1460
|
-
var _a;
|
|
1461
1320
|
const {
|
|
1462
1321
|
direction = "bottom",
|
|
1463
1322
|
interval = 100
|
|
1464
1323
|
} = options;
|
|
1465
1324
|
const state = vueDemi.reactive(useScroll(
|
|
1466
1325
|
element,
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1326
|
+
{
|
|
1327
|
+
...options,
|
|
1328
|
+
offset: {
|
|
1329
|
+
[direction]: options.distance ?? 0,
|
|
1330
|
+
...options.offset
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1472
1333
|
));
|
|
1473
1334
|
const promise = vueDemi.ref();
|
|
1474
1335
|
const isLoading = vueDemi.computed(() => !!promise.value);
|
|
1475
1336
|
const observedElement = vueDemi.computed(() => {
|
|
1476
|
-
|
|
1477
|
-
if (el instanceof Window)
|
|
1478
|
-
return window.document.documentElement;
|
|
1479
|
-
if (el instanceof Document)
|
|
1480
|
-
return document.documentElement;
|
|
1481
|
-
return el;
|
|
1337
|
+
return resolveElement(shared.toValue(element));
|
|
1482
1338
|
});
|
|
1483
1339
|
const isElementVisible = useElementVisibility(observedElement);
|
|
1484
1340
|
function checkAndLoad() {
|
|
@@ -1552,31 +1408,12 @@ const UseMouseInElement = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponen
|
|
|
1552
1408
|
}
|
|
1553
1409
|
});
|
|
1554
1410
|
|
|
1555
|
-
var __defProp$7 = Object.defineProperty;
|
|
1556
|
-
var __defProps$6 = Object.defineProperties;
|
|
1557
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
1558
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1559
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1560
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1561
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1562
|
-
var __spreadValues$7 = (a, b) => {
|
|
1563
|
-
for (var prop in b || (b = {}))
|
|
1564
|
-
if (__hasOwnProp$8.call(b, prop))
|
|
1565
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1566
|
-
if (__getOwnPropSymbols$8)
|
|
1567
|
-
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
1568
|
-
if (__propIsEnum$8.call(b, prop))
|
|
1569
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
1570
|
-
}
|
|
1571
|
-
return a;
|
|
1572
|
-
};
|
|
1573
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
1574
1411
|
const UseMousePressed = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1575
1412
|
name: "UseMousePressed",
|
|
1576
1413
|
props: ["touch", "initialValue", "as"],
|
|
1577
1414
|
setup(props, { slots }) {
|
|
1578
1415
|
const target = vueDemi.ref();
|
|
1579
|
-
const data = vueDemi.reactive(core.useMousePressed(
|
|
1416
|
+
const data = vueDemi.reactive(core.useMousePressed({ ...props, target }));
|
|
1580
1417
|
return () => {
|
|
1581
1418
|
if (slots.default)
|
|
1582
1419
|
return vueDemi.h(props.as || "div", { ref: target }, slots.default(data));
|
|
@@ -1595,30 +1432,11 @@ const UseNetwork = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1595
1432
|
}
|
|
1596
1433
|
});
|
|
1597
1434
|
|
|
1598
|
-
var __defProp$6 = Object.defineProperty;
|
|
1599
|
-
var __defProps$5 = Object.defineProperties;
|
|
1600
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
1601
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1602
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1603
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1604
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1605
|
-
var __spreadValues$6 = (a, b) => {
|
|
1606
|
-
for (var prop in b || (b = {}))
|
|
1607
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
1608
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1609
|
-
if (__getOwnPropSymbols$7)
|
|
1610
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1611
|
-
if (__propIsEnum$7.call(b, prop))
|
|
1612
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
1613
|
-
}
|
|
1614
|
-
return a;
|
|
1615
|
-
};
|
|
1616
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1617
1435
|
const UseNow = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1618
1436
|
name: "UseNow",
|
|
1619
1437
|
props: ["interval"],
|
|
1620
1438
|
setup(props, { slots }) {
|
|
1621
|
-
const data = vueDemi.reactive(core.useNow(
|
|
1439
|
+
const data = vueDemi.reactive(core.useNow({ ...props, controls: true }));
|
|
1622
1440
|
return () => {
|
|
1623
1441
|
if (slots.default)
|
|
1624
1442
|
return slots.default(data);
|
|
@@ -1641,25 +1459,6 @@ const UseObjectUrl = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1641
1459
|
}
|
|
1642
1460
|
});
|
|
1643
1461
|
|
|
1644
|
-
var __defProp$5 = Object.defineProperty;
|
|
1645
|
-
var __defProps$4 = Object.defineProperties;
|
|
1646
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1647
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1648
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1649
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1650
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1651
|
-
var __spreadValues$5 = (a, b) => {
|
|
1652
|
-
for (var prop in b || (b = {}))
|
|
1653
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
1654
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1655
|
-
if (__getOwnPropSymbols$6)
|
|
1656
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1657
|
-
if (__propIsEnum$6.call(b, prop))
|
|
1658
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1659
|
-
}
|
|
1660
|
-
return a;
|
|
1661
|
-
};
|
|
1662
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1663
1462
|
const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1664
1463
|
name: "UseOffsetPagination",
|
|
1665
1464
|
props: [
|
|
@@ -1676,23 +1475,21 @@ const UseOffsetPagination = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineCompon
|
|
|
1676
1475
|
"page-count-change"
|
|
1677
1476
|
],
|
|
1678
1477
|
setup(props, { slots, emit }) {
|
|
1679
|
-
const data = vueDemi.reactive(core.useOffsetPagination(
|
|
1478
|
+
const data = vueDemi.reactive(core.useOffsetPagination({
|
|
1479
|
+
...props,
|
|
1680
1480
|
onPageChange(...args) {
|
|
1681
|
-
|
|
1682
|
-
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
1481
|
+
props.onPageChange?.(...args);
|
|
1683
1482
|
emit("page-change", ...args);
|
|
1684
1483
|
},
|
|
1685
1484
|
onPageSizeChange(...args) {
|
|
1686
|
-
|
|
1687
|
-
(_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
|
|
1485
|
+
props.onPageSizeChange?.(...args);
|
|
1688
1486
|
emit("page-size-change", ...args);
|
|
1689
1487
|
},
|
|
1690
1488
|
onPageCountChange(...args) {
|
|
1691
|
-
|
|
1692
|
-
(_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
|
|
1489
|
+
props.onPageCountChange?.(...args);
|
|
1693
1490
|
emit("page-count-change", ...args);
|
|
1694
1491
|
}
|
|
1695
|
-
}))
|
|
1492
|
+
}));
|
|
1696
1493
|
return () => {
|
|
1697
1494
|
if (slots.default)
|
|
1698
1495
|
return slots.default(data);
|
|
@@ -1726,25 +1523,6 @@ const UsePageLeave = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1726
1523
|
}
|
|
1727
1524
|
});
|
|
1728
1525
|
|
|
1729
|
-
var __defProp$4 = Object.defineProperty;
|
|
1730
|
-
var __defProps$3 = Object.defineProperties;
|
|
1731
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1732
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1733
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1734
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1735
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1736
|
-
var __spreadValues$4 = (a, b) => {
|
|
1737
|
-
for (var prop in b || (b = {}))
|
|
1738
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
1739
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1740
|
-
if (__getOwnPropSymbols$5)
|
|
1741
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1742
|
-
if (__propIsEnum$5.call(b, prop))
|
|
1743
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
1744
|
-
}
|
|
1745
|
-
return a;
|
|
1746
|
-
};
|
|
1747
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1748
1526
|
const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
1749
1527
|
name: "UsePointer",
|
|
1750
1528
|
props: [
|
|
@@ -1754,9 +1532,10 @@ const UsePointer = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
1754
1532
|
],
|
|
1755
1533
|
setup(props, { slots }) {
|
|
1756
1534
|
const el = vueDemi.ref(null);
|
|
1757
|
-
const data = vueDemi.reactive(core.usePointer(
|
|
1535
|
+
const data = vueDemi.reactive(core.usePointer({
|
|
1536
|
+
...props,
|
|
1758
1537
|
target: props.target === "self" ? el : defaultWindow
|
|
1759
|
-
}))
|
|
1538
|
+
}));
|
|
1760
1539
|
return () => {
|
|
1761
1540
|
if (slots.default)
|
|
1762
1541
|
return slots.default(data, { ref: el });
|
|
@@ -1842,23 +1621,8 @@ const UsePreferredReducedMotion = /* @__PURE__ */ /* #__PURE__ */ vueDemi.define
|
|
|
1842
1621
|
}
|
|
1843
1622
|
});
|
|
1844
1623
|
|
|
1845
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1846
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1847
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1848
|
-
var __objRest = (source, exclude) => {
|
|
1849
|
-
var target = {};
|
|
1850
|
-
for (var prop in source)
|
|
1851
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1852
|
-
target[prop] = source[prop];
|
|
1853
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
1854
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1855
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1856
|
-
target[prop] = source[prop];
|
|
1857
|
-
}
|
|
1858
|
-
return target;
|
|
1859
|
-
};
|
|
1860
1624
|
function useMutationObserver(target, callback, options = {}) {
|
|
1861
|
-
const
|
|
1625
|
+
const { window = defaultWindow, ...mutationOptions } = options;
|
|
1862
1626
|
let observer;
|
|
1863
1627
|
const isSupported = useSupported(() => window && "MutationObserver" in window);
|
|
1864
1628
|
const cleanup = () => {
|
|
@@ -1892,16 +1656,12 @@ function useMutationObserver(target, callback, options = {}) {
|
|
|
1892
1656
|
function useCssVar(prop, target, options = {}) {
|
|
1893
1657
|
const { window = defaultWindow, initialValue = "", observe = false } = options;
|
|
1894
1658
|
const variable = vueDemi.ref(initialValue);
|
|
1895
|
-
const elRef = vueDemi.computed(() =>
|
|
1896
|
-
var _a;
|
|
1897
|
-
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
1898
|
-
});
|
|
1659
|
+
const elRef = vueDemi.computed(() => unrefElement(target) || window?.document?.documentElement);
|
|
1899
1660
|
function updateCssVar() {
|
|
1900
|
-
var _a;
|
|
1901
1661
|
const key = shared.toValue(prop);
|
|
1902
1662
|
const el = shared.toValue(elRef);
|
|
1903
1663
|
if (el && window) {
|
|
1904
|
-
const value =
|
|
1664
|
+
const value = window.getComputedStyle(el).getPropertyValue(key)?.trim();
|
|
1905
1665
|
variable.value = value || initialValue;
|
|
1906
1666
|
}
|
|
1907
1667
|
}
|
|
@@ -1919,8 +1679,7 @@ function useCssVar(prop, target, options = {}) {
|
|
|
1919
1679
|
vueDemi.watch(
|
|
1920
1680
|
variable,
|
|
1921
1681
|
(val) => {
|
|
1922
|
-
|
|
1923
|
-
if ((_a = elRef.value) == null ? void 0 : _a.style)
|
|
1682
|
+
if (elRef.value?.style)
|
|
1924
1683
|
elRef.value.style.setProperty(shared.toValue(prop), val);
|
|
1925
1684
|
}
|
|
1926
1685
|
);
|
|
@@ -2000,25 +1759,6 @@ const UseScreenSafeArea = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponen
|
|
|
2000
1759
|
}
|
|
2001
1760
|
});
|
|
2002
1761
|
|
|
2003
|
-
var __defProp$3 = Object.defineProperty;
|
|
2004
|
-
var __defProps$2 = Object.defineProperties;
|
|
2005
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
2006
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
2007
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
2008
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
2009
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2010
|
-
var __spreadValues$3 = (a, b) => {
|
|
2011
|
-
for (var prop in b || (b = {}))
|
|
2012
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
2013
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
2014
|
-
if (__getOwnPropSymbols$3)
|
|
2015
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
2016
|
-
if (__propIsEnum$3.call(b, prop))
|
|
2017
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
2018
|
-
}
|
|
2019
|
-
return a;
|
|
2020
|
-
};
|
|
2021
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2022
1762
|
const vScroll = {
|
|
2023
1763
|
[shared.directiveHooks.mounted](el, binding) {
|
|
2024
1764
|
if (typeof binding.value === "function") {
|
|
@@ -2033,18 +1773,17 @@ const vScroll = {
|
|
|
2033
1773
|
});
|
|
2034
1774
|
} else {
|
|
2035
1775
|
const [handler, options] = binding.value;
|
|
2036
|
-
const state = useScroll(el,
|
|
1776
|
+
const state = useScroll(el, {
|
|
1777
|
+
...options,
|
|
2037
1778
|
onScroll(e) {
|
|
2038
|
-
|
|
2039
|
-
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
1779
|
+
options.onScroll?.(e);
|
|
2040
1780
|
handler(state);
|
|
2041
1781
|
},
|
|
2042
1782
|
onStop(e) {
|
|
2043
|
-
|
|
2044
|
-
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
1783
|
+
options.onStop?.(e);
|
|
2045
1784
|
handler(state);
|
|
2046
1785
|
}
|
|
2047
|
-
})
|
|
1786
|
+
});
|
|
2048
1787
|
}
|
|
2049
1788
|
}
|
|
2050
1789
|
};
|
|
@@ -2076,8 +1815,9 @@ function useScrollLock(element, initialState = false) {
|
|
|
2076
1815
|
let stopTouchMoveListener = null;
|
|
2077
1816
|
let initialOverflow;
|
|
2078
1817
|
vueDemi.watch(shared.toRef(element), (el) => {
|
|
2079
|
-
|
|
2080
|
-
|
|
1818
|
+
const target = resolveElement(shared.toValue(el));
|
|
1819
|
+
if (target) {
|
|
1820
|
+
const ele = target;
|
|
2081
1821
|
initialOverflow = ele.style.overflow;
|
|
2082
1822
|
if (isLocked.value)
|
|
2083
1823
|
ele.style.overflow = "hidden";
|
|
@@ -2086,12 +1826,12 @@ function useScrollLock(element, initialState = false) {
|
|
|
2086
1826
|
immediate: true
|
|
2087
1827
|
});
|
|
2088
1828
|
const lock = () => {
|
|
2089
|
-
const
|
|
2090
|
-
if (!
|
|
1829
|
+
const el = resolveElement(shared.toValue(element));
|
|
1830
|
+
if (!el || isLocked.value)
|
|
2091
1831
|
return;
|
|
2092
1832
|
if (shared.isIOS) {
|
|
2093
1833
|
stopTouchMoveListener = useEventListener(
|
|
2094
|
-
|
|
1834
|
+
el,
|
|
2095
1835
|
"touchmove",
|
|
2096
1836
|
(e) => {
|
|
2097
1837
|
preventDefault(e);
|
|
@@ -2099,15 +1839,15 @@ function useScrollLock(element, initialState = false) {
|
|
|
2099
1839
|
{ passive: false }
|
|
2100
1840
|
);
|
|
2101
1841
|
}
|
|
2102
|
-
|
|
1842
|
+
el.style.overflow = "hidden";
|
|
2103
1843
|
isLocked.value = true;
|
|
2104
1844
|
};
|
|
2105
1845
|
const unlock = () => {
|
|
2106
|
-
const
|
|
2107
|
-
if (!
|
|
1846
|
+
const el = resolveElement(shared.toValue(element));
|
|
1847
|
+
if (!el || !isLocked.value)
|
|
2108
1848
|
return;
|
|
2109
|
-
shared.isIOS &&
|
|
2110
|
-
|
|
1849
|
+
shared.isIOS && stopTouchMoveListener?.();
|
|
1850
|
+
el.style.overflow = initialOverflow;
|
|
2111
1851
|
isLocked.value = false;
|
|
2112
1852
|
};
|
|
2113
1853
|
shared.tryOnScopeDispose(unlock);
|
|
@@ -2138,30 +1878,11 @@ function onScrollLock() {
|
|
|
2138
1878
|
}
|
|
2139
1879
|
const vScrollLock = onScrollLock();
|
|
2140
1880
|
|
|
2141
|
-
var __defProp$2 = Object.defineProperty;
|
|
2142
|
-
var __defProps$1 = Object.defineProperties;
|
|
2143
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
2144
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
2145
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
2146
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
2147
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2148
|
-
var __spreadValues$2 = (a, b) => {
|
|
2149
|
-
for (var prop in b || (b = {}))
|
|
2150
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
2151
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2152
|
-
if (__getOwnPropSymbols$2)
|
|
2153
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
2154
|
-
if (__propIsEnum$2.call(b, prop))
|
|
2155
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2156
|
-
}
|
|
2157
|
-
return a;
|
|
2158
|
-
};
|
|
2159
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
2160
1881
|
const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
2161
1882
|
name: "UseTimeAgo",
|
|
2162
1883
|
props: ["time", "updateInterval", "max", "fullDateFormatter", "messages", "showSecond"],
|
|
2163
1884
|
setup(props, { slots }) {
|
|
2164
|
-
const data = vueDemi.reactive(core.useTimeAgo(() => props.time,
|
|
1885
|
+
const data = vueDemi.reactive(core.useTimeAgo(() => props.time, { ...props, controls: true }));
|
|
2165
1886
|
return () => {
|
|
2166
1887
|
if (slots.default)
|
|
2167
1888
|
return slots.default(data);
|
|
@@ -2169,30 +1890,11 @@ const UseTimeAgo = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2169
1890
|
}
|
|
2170
1891
|
});
|
|
2171
1892
|
|
|
2172
|
-
var __defProp$1 = Object.defineProperty;
|
|
2173
|
-
var __defProps = Object.defineProperties;
|
|
2174
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2175
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
2176
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
2177
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
2178
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2179
|
-
var __spreadValues$1 = (a, b) => {
|
|
2180
|
-
for (var prop in b || (b = {}))
|
|
2181
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
2182
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2183
|
-
if (__getOwnPropSymbols$1)
|
|
2184
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
2185
|
-
if (__propIsEnum$1.call(b, prop))
|
|
2186
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2187
|
-
}
|
|
2188
|
-
return a;
|
|
2189
|
-
};
|
|
2190
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2191
1893
|
const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
2192
1894
|
name: "UseTimestamp",
|
|
2193
1895
|
props: ["immediate", "interval", "offset"],
|
|
2194
1896
|
setup(props, { slots }) {
|
|
2195
|
-
const data = vueDemi.reactive(core.useTimestamp(
|
|
1897
|
+
const data = vueDemi.reactive(core.useTimestamp({ ...props, controls: true }));
|
|
2196
1898
|
return () => {
|
|
2197
1899
|
if (slots.default)
|
|
2198
1900
|
return slots.default(data);
|
|
@@ -2200,22 +1902,6 @@ const UseTimestamp = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2200
1902
|
}
|
|
2201
1903
|
});
|
|
2202
1904
|
|
|
2203
|
-
var __defProp = Object.defineProperty;
|
|
2204
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2205
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2206
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2207
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2208
|
-
var __spreadValues = (a, b) => {
|
|
2209
|
-
for (var prop in b || (b = {}))
|
|
2210
|
-
if (__hasOwnProp.call(b, prop))
|
|
2211
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2212
|
-
if (__getOwnPropSymbols)
|
|
2213
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
2214
|
-
if (__propIsEnum.call(b, prop))
|
|
2215
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2216
|
-
}
|
|
2217
|
-
return a;
|
|
2218
|
-
};
|
|
2219
1905
|
const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
2220
1906
|
name: "UseVirtualList",
|
|
2221
1907
|
props: [
|
|
@@ -2230,11 +1916,11 @@ const UseVirtualList = /* @__PURE__ */ /* #__PURE__ */ vueDemi.defineComponent({
|
|
|
2230
1916
|
typeof containerProps.style === "object" && !Array.isArray(containerProps.style) && (containerProps.style.height = props.height || "300px");
|
|
2231
1917
|
return () => vueDemi.h(
|
|
2232
1918
|
"div",
|
|
2233
|
-
|
|
1919
|
+
{ ...containerProps },
|
|
2234
1920
|
[
|
|
2235
1921
|
vueDemi.h(
|
|
2236
1922
|
"div",
|
|
2237
|
-
|
|
1923
|
+
{ ...wrapperProps.value },
|
|
2238
1924
|
list.value.map((item) => vueDemi.h(
|
|
2239
1925
|
"div",
|
|
2240
1926
|
{ style: { overFlow: "hidden", height: item.height } },
|