@vueuse/components 12.4.0 → 12.6.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 +125 -121
- package/index.d.cts +17 -4
- package/index.d.mts +17 -4
- package/index.d.ts +17 -4
- package/index.iife.js +125 -121
- package/index.iife.min.js +1 -1
- package/index.mjs +127 -123
- package/package.json +3 -3
package/index.iife.js
CHANGED
|
@@ -17,70 +17,73 @@
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
const defaultWindow = shared.isClient ? window :
|
|
20
|
+
const defaultWindow = shared.isClient ? window : void 0;
|
|
21
21
|
|
|
22
22
|
function unrefElement(elRef) {
|
|
23
23
|
var _a;
|
|
24
24
|
const plain = vue.toValue(elRef);
|
|
25
|
-
return (_a = plain == null ?
|
|
25
|
+
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function useEventListener(...args) {
|
|
29
|
-
let target;
|
|
30
|
-
let events;
|
|
31
|
-
let listeners;
|
|
32
|
-
let options;
|
|
33
|
-
if (typeof args[0] === "string" || Array.isArray(args[0])) {
|
|
34
|
-
[events, listeners, options] = args;
|
|
35
|
-
target = defaultWindow;
|
|
36
|
-
} else {
|
|
37
|
-
[target, events, listeners, options] = args;
|
|
38
|
-
}
|
|
39
|
-
if (!target)
|
|
40
|
-
return shared.noop;
|
|
41
|
-
events = shared.toArray(events);
|
|
42
|
-
listeners = shared.toArray(listeners);
|
|
43
29
|
const cleanups = [];
|
|
44
30
|
const cleanup = () => {
|
|
45
31
|
cleanups.forEach((fn) => fn());
|
|
46
32
|
cleanups.length = 0;
|
|
47
33
|
};
|
|
48
|
-
const register = (el, event, listener,
|
|
49
|
-
el.addEventListener(event, listener,
|
|
50
|
-
return () => el.removeEventListener(event, listener,
|
|
34
|
+
const register = (el, event, listener, options) => {
|
|
35
|
+
el.addEventListener(event, listener, options);
|
|
36
|
+
return () => el.removeEventListener(event, listener, options);
|
|
51
37
|
};
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
(
|
|
38
|
+
const firstParamTargets = vue.computed(() => {
|
|
39
|
+
const test = shared.toArray(vue.toValue(args[0])).filter((e) => e != null);
|
|
40
|
+
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
41
|
+
});
|
|
42
|
+
const stopWatch = shared.watchImmediate(
|
|
43
|
+
() => {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
return [
|
|
46
|
+
(_b = (_a = firstParamTargets.value) == null ? void 0 : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
|
|
47
|
+
shared.toArray(vue.toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
48
|
+
shared.toArray(vue.unref(firstParamTargets.value ? args[2] : args[1])),
|
|
49
|
+
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
50
|
+
vue.toValue(firstParamTargets.value ? args[3] : args[2])
|
|
51
|
+
];
|
|
52
|
+
},
|
|
53
|
+
([raw_targets, raw_events, raw_listeners, raw_options]) => {
|
|
55
54
|
cleanup();
|
|
56
|
-
if (!
|
|
55
|
+
if (!(raw_targets == null ? void 0 : raw_targets.length) || !(raw_events == null ? void 0 : raw_events.length) || !(raw_listeners == null ? void 0 : raw_listeners.length))
|
|
57
56
|
return;
|
|
58
|
-
const optionsClone = shared.isObject(
|
|
57
|
+
const optionsClone = shared.isObject(raw_options) ? { ...raw_options } : raw_options;
|
|
59
58
|
cleanups.push(
|
|
60
|
-
...
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
...raw_targets.flatMap(
|
|
60
|
+
(el) => raw_events.flatMap(
|
|
61
|
+
(event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))
|
|
62
|
+
)
|
|
63
|
+
)
|
|
63
64
|
);
|
|
64
65
|
},
|
|
65
|
-
{
|
|
66
|
+
{ flush: "post" }
|
|
66
67
|
);
|
|
67
68
|
const stop = () => {
|
|
68
69
|
stopWatch();
|
|
69
70
|
cleanup();
|
|
70
71
|
};
|
|
71
|
-
shared.tryOnScopeDispose(
|
|
72
|
+
shared.tryOnScopeDispose(cleanup);
|
|
72
73
|
return stop;
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
let _iOSWorkaround = false;
|
|
76
77
|
function onClickOutside(target, handler, options = {}) {
|
|
77
|
-
const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
|
|
78
|
-
if (!window)
|
|
79
|
-
return shared.noop;
|
|
78
|
+
const { window = defaultWindow, ignore = [], capture = true, detectIframe = false, controls = false } = options;
|
|
79
|
+
if (!window) {
|
|
80
|
+
return controls ? { stop: shared.noop, cancel: shared.noop, trigger: shared.noop } : shared.noop;
|
|
81
|
+
}
|
|
80
82
|
if (shared.isIOS && !_iOSWorkaround) {
|
|
81
83
|
_iOSWorkaround = true;
|
|
82
|
-
|
|
83
|
-
window.document.
|
|
84
|
+
const listenerOptions = { passive: true };
|
|
85
|
+
Array.from(window.document.body.children).forEach((el) => useEventListener(el, "click", shared.noop, listenerOptions));
|
|
86
|
+
useEventListener(window.document.documentElement, "click", shared.noop, listenerOptions);
|
|
84
87
|
}
|
|
85
88
|
let shouldListen = true;
|
|
86
89
|
const shouldIgnore = (event) => {
|
|
@@ -112,7 +115,7 @@
|
|
|
112
115
|
return;
|
|
113
116
|
if (!el || el === event.target || event.composedPath().includes(el))
|
|
114
117
|
return;
|
|
115
|
-
if (event.detail === 0)
|
|
118
|
+
if ("detail" in event && event.detail === 0)
|
|
116
119
|
shouldListen = !shouldIgnore(event);
|
|
117
120
|
if (!shouldListen) {
|
|
118
121
|
shouldListen = true;
|
|
@@ -139,13 +142,26 @@
|
|
|
139
142
|
setTimeout(() => {
|
|
140
143
|
var _a;
|
|
141
144
|
const el = unrefElement(target);
|
|
142
|
-
if (((_a = window.document.activeElement) == null ?
|
|
145
|
+
if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) {
|
|
143
146
|
handler(event);
|
|
144
147
|
}
|
|
145
148
|
}, 0);
|
|
146
149
|
}, { passive: true })
|
|
147
150
|
].filter(Boolean);
|
|
148
151
|
const stop = () => cleanup.forEach((fn) => fn());
|
|
152
|
+
if (controls) {
|
|
153
|
+
return {
|
|
154
|
+
stop,
|
|
155
|
+
cancel: () => {
|
|
156
|
+
shouldListen = false;
|
|
157
|
+
},
|
|
158
|
+
trigger: (event) => {
|
|
159
|
+
shouldListen = true;
|
|
160
|
+
listener(event);
|
|
161
|
+
shouldListen = false;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
149
165
|
return stop;
|
|
150
166
|
}
|
|
151
167
|
|
|
@@ -213,7 +229,7 @@
|
|
|
213
229
|
const vOnKeyStroke = {
|
|
214
230
|
mounted(el, binding) {
|
|
215
231
|
var _a, _b;
|
|
216
|
-
const keys = (_b = (_a = binding.arg) == null ?
|
|
232
|
+
const keys = (_b = (_a = binding.arg) == null ? void 0 : _a.split(",")) != null ? _b : true;
|
|
217
233
|
if (typeof binding.value === "function") {
|
|
218
234
|
onKeyStroke(keys, binding.value, {
|
|
219
235
|
target: el
|
|
@@ -240,23 +256,23 @@
|
|
|
240
256
|
function clear() {
|
|
241
257
|
if (timeout) {
|
|
242
258
|
clearTimeout(timeout);
|
|
243
|
-
timeout =
|
|
259
|
+
timeout = void 0;
|
|
244
260
|
}
|
|
245
|
-
posStart =
|
|
246
|
-
startTimestamp =
|
|
261
|
+
posStart = void 0;
|
|
262
|
+
startTimestamp = void 0;
|
|
247
263
|
hasLongPressed = false;
|
|
248
264
|
}
|
|
249
265
|
function onRelease(ev) {
|
|
250
266
|
var _a2, _b2, _c;
|
|
251
267
|
const [_startTimestamp, _posStart, _hasLongPressed] = [startTimestamp, posStart, hasLongPressed];
|
|
252
268
|
clear();
|
|
253
|
-
if (!(options == null ?
|
|
269
|
+
if (!(options == null ? void 0 : options.onMouseUp) || !_posStart || !_startTimestamp)
|
|
254
270
|
return;
|
|
255
|
-
if (((_a2 = options == null ?
|
|
271
|
+
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
256
272
|
return;
|
|
257
|
-
if ((_b2 = options == null ?
|
|
273
|
+
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
258
274
|
ev.preventDefault();
|
|
259
|
-
if ((_c = options == null ?
|
|
275
|
+
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
260
276
|
ev.stopPropagation();
|
|
261
277
|
const dx = ev.x - _posStart.x;
|
|
262
278
|
const dy = ev.y - _posStart.y;
|
|
@@ -265,12 +281,12 @@
|
|
|
265
281
|
}
|
|
266
282
|
function onDown(ev) {
|
|
267
283
|
var _a2, _b2, _c, _d;
|
|
268
|
-
if (((_a2 = options == null ?
|
|
284
|
+
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
269
285
|
return;
|
|
270
286
|
clear();
|
|
271
|
-
if ((_b2 = options == null ?
|
|
287
|
+
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
272
288
|
ev.preventDefault();
|
|
273
|
-
if ((_c = options == null ?
|
|
289
|
+
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
274
290
|
ev.stopPropagation();
|
|
275
291
|
posStart = {
|
|
276
292
|
x: ev.x,
|
|
@@ -282,28 +298,28 @@
|
|
|
282
298
|
hasLongPressed = true;
|
|
283
299
|
handler(ev);
|
|
284
300
|
},
|
|
285
|
-
(_d = options == null ?
|
|
301
|
+
(_d = options == null ? void 0 : options.delay) != null ? _d : DEFAULT_DELAY
|
|
286
302
|
);
|
|
287
303
|
}
|
|
288
304
|
function onMove(ev) {
|
|
289
305
|
var _a2, _b2, _c, _d;
|
|
290
|
-
if (((_a2 = options == null ?
|
|
306
|
+
if (((_a2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _a2.self) && ev.target !== elementRef.value)
|
|
291
307
|
return;
|
|
292
|
-
if (!posStart || (options == null ?
|
|
308
|
+
if (!posStart || (options == null ? void 0 : options.distanceThreshold) === false)
|
|
293
309
|
return;
|
|
294
|
-
if ((_b2 = options == null ?
|
|
310
|
+
if ((_b2 = options == null ? void 0 : options.modifiers) == null ? void 0 : _b2.prevent)
|
|
295
311
|
ev.preventDefault();
|
|
296
|
-
if ((_c = options == null ?
|
|
312
|
+
if ((_c = options == null ? void 0 : options.modifiers) == null ? void 0 : _c.stop)
|
|
297
313
|
ev.stopPropagation();
|
|
298
314
|
const dx = ev.x - posStart.x;
|
|
299
315
|
const dy = ev.y - posStart.y;
|
|
300
316
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
301
|
-
if (distance >= ((_d = options == null ?
|
|
317
|
+
if (distance >= ((_d = options == null ? void 0 : options.distanceThreshold) != null ? _d : DEFAULT_THRESHOLD))
|
|
302
318
|
clear();
|
|
303
319
|
}
|
|
304
320
|
const listenerOptions = {
|
|
305
|
-
capture: (_a = options == null ?
|
|
306
|
-
once: (_b = options == null ?
|
|
321
|
+
capture: (_a = options == null ? void 0 : options.modifiers) == null ? void 0 : _a.capture,
|
|
322
|
+
once: (_b = options == null ? void 0 : options.modifiers) == null ? void 0 : _b.once
|
|
307
323
|
};
|
|
308
324
|
const cleanup = [
|
|
309
325
|
useEventListener(elementRef, "pointerdown", onDown, listenerOptions),
|
|
@@ -391,7 +407,7 @@
|
|
|
391
407
|
const data = vue.reactive(core.useClipboard(props));
|
|
392
408
|
return () => {
|
|
393
409
|
var _a;
|
|
394
|
-
return (_a = slots.default) == null ?
|
|
410
|
+
return (_a = slots.default) == null ? void 0 : _a.call(slots, data);
|
|
395
411
|
};
|
|
396
412
|
}
|
|
397
413
|
});
|
|
@@ -411,7 +427,7 @@
|
|
|
411
427
|
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
412
428
|
function useSSRWidth() {
|
|
413
429
|
const ssrWidth = vue.hasInjectionContext() ? shared.injectLocal(ssrWidthSymbol, null) : null;
|
|
414
|
-
return typeof ssrWidth === "number" ? ssrWidth :
|
|
430
|
+
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
415
431
|
}
|
|
416
432
|
|
|
417
433
|
function useMounted() {
|
|
@@ -437,20 +453,12 @@
|
|
|
437
453
|
const { window = defaultWindow, ssrWidth = useSSRWidth() } = options;
|
|
438
454
|
const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
|
|
439
455
|
const ssrSupport = vue.ref(typeof ssrWidth === "number");
|
|
440
|
-
|
|
456
|
+
const mediaQuery = vue.shallowRef();
|
|
441
457
|
const matches = vue.ref(false);
|
|
442
458
|
const handler = (event) => {
|
|
443
459
|
matches.value = event.matches;
|
|
444
460
|
};
|
|
445
|
-
|
|
446
|
-
if (!mediaQuery)
|
|
447
|
-
return;
|
|
448
|
-
if ("removeEventListener" in mediaQuery)
|
|
449
|
-
mediaQuery.removeEventListener("change", handler);
|
|
450
|
-
else
|
|
451
|
-
mediaQuery.removeListener(handler);
|
|
452
|
-
};
|
|
453
|
-
const stopWatch = vue.watchEffect(() => {
|
|
461
|
+
vue.watchEffect(() => {
|
|
454
462
|
if (ssrSupport.value) {
|
|
455
463
|
ssrSupport.value = !isSupported.value;
|
|
456
464
|
const queryStrings = vue.toValue(query).split(",");
|
|
@@ -471,19 +479,10 @@
|
|
|
471
479
|
}
|
|
472
480
|
if (!isSupported.value)
|
|
473
481
|
return;
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if ("addEventListener" in mediaQuery)
|
|
477
|
-
mediaQuery.addEventListener("change", handler);
|
|
478
|
-
else
|
|
479
|
-
mediaQuery.addListener(handler);
|
|
480
|
-
matches.value = mediaQuery.matches;
|
|
481
|
-
});
|
|
482
|
-
shared.tryOnScopeDispose(() => {
|
|
483
|
-
stopWatch();
|
|
484
|
-
cleanup();
|
|
485
|
-
mediaQuery = undefined;
|
|
482
|
+
mediaQuery.value = window.matchMedia(vue.toValue(query));
|
|
483
|
+
matches.value = mediaQuery.value.matches;
|
|
486
484
|
});
|
|
485
|
+
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
487
486
|
return vue.computed(() => matches.value);
|
|
488
487
|
}
|
|
489
488
|
|
|
@@ -685,7 +684,7 @@
|
|
|
685
684
|
const updateHTMLAttrs = getSSRHandler(
|
|
686
685
|
"updateHTMLAttrs",
|
|
687
686
|
(selector2, attribute2, value) => {
|
|
688
|
-
const el = typeof selector2 === "string" ? window == null ?
|
|
687
|
+
const el = typeof selector2 === "string" ? window == null ? void 0 : window.document.querySelector(selector2) : unrefElement(selector2);
|
|
689
688
|
if (!el)
|
|
690
689
|
return;
|
|
691
690
|
const classesToAdd = /* @__PURE__ */ new Set();
|
|
@@ -869,18 +868,18 @@
|
|
|
869
868
|
});
|
|
870
869
|
const containerElement = vue.computed(() => {
|
|
871
870
|
var _a;
|
|
872
|
-
return (_a = props.containerElement) != null ? _a :
|
|
871
|
+
return (_a = props.containerElement) != null ? _a : void 0;
|
|
873
872
|
});
|
|
874
873
|
const disabled = vue.computed(() => !!props.disabled);
|
|
875
874
|
const storageValue = props.storageKey && core.useStorage(
|
|
876
875
|
props.storageKey,
|
|
877
876
|
vue.toValue(props.initialValue) || { x: 0, y: 0 },
|
|
878
|
-
core.isClient ? props.storageType === "session" ? sessionStorage : localStorage :
|
|
877
|
+
core.isClient ? props.storageType === "session" ? sessionStorage : localStorage : void 0
|
|
879
878
|
);
|
|
880
879
|
const initialValue = storageValue || props.initialValue || { x: 0, y: 0 };
|
|
881
880
|
const onEnd = (position, event) => {
|
|
882
881
|
var _a;
|
|
883
|
-
(_a = props.onEnd) == null ?
|
|
882
|
+
(_a = props.onEnd) == null ? void 0 : _a.call(props, position, event);
|
|
884
883
|
if (!storageValue)
|
|
885
884
|
return;
|
|
886
885
|
storageValue.value.x = position.x;
|
|
@@ -921,7 +920,7 @@
|
|
|
921
920
|
const cleanup = () => {
|
|
922
921
|
if (observer) {
|
|
923
922
|
observer.disconnect();
|
|
924
|
-
observer =
|
|
923
|
+
observer = void 0;
|
|
925
924
|
}
|
|
926
925
|
};
|
|
927
926
|
const targets = vue.computed(() => {
|
|
@@ -941,7 +940,7 @@
|
|
|
941
940
|
{ immediate: true, flush: "post" }
|
|
942
941
|
);
|
|
943
942
|
const takeRecords = () => {
|
|
944
|
-
return observer == null ?
|
|
943
|
+
return observer == null ? void 0 : observer.takeRecords();
|
|
945
944
|
};
|
|
946
945
|
const stop = () => {
|
|
947
946
|
stopWatch();
|
|
@@ -962,7 +961,7 @@
|
|
|
962
961
|
const cleanup = () => {
|
|
963
962
|
if (observer) {
|
|
964
963
|
observer.disconnect();
|
|
965
|
-
observer =
|
|
964
|
+
observer = void 0;
|
|
966
965
|
}
|
|
967
966
|
};
|
|
968
967
|
const targets = vue.computed(() => {
|
|
@@ -1087,14 +1086,14 @@
|
|
|
1087
1086
|
function onElementRemoval(target, callback, options = {}) {
|
|
1088
1087
|
const {
|
|
1089
1088
|
window = defaultWindow,
|
|
1090
|
-
document = window == null ?
|
|
1089
|
+
document = window == null ? void 0 : window.document,
|
|
1091
1090
|
flush = "sync"
|
|
1092
1091
|
} = options;
|
|
1093
1092
|
if (!window || !document)
|
|
1094
1093
|
return shared.noop;
|
|
1095
1094
|
let stopFn;
|
|
1096
1095
|
const cleanupAndUpdate = (fn) => {
|
|
1097
|
-
stopFn == null ?
|
|
1096
|
+
stopFn == null ? void 0 : stopFn();
|
|
1098
1097
|
stopFn = fn;
|
|
1099
1098
|
};
|
|
1100
1099
|
const stopWatch = vue.watchEffect(() => {
|
|
@@ -1138,7 +1137,7 @@
|
|
|
1138
1137
|
const delay = entering ? delayEnter : delayLeave;
|
|
1139
1138
|
if (timer) {
|
|
1140
1139
|
clearTimeout(timer);
|
|
1141
|
-
timer =
|
|
1140
|
+
timer = void 0;
|
|
1142
1141
|
}
|
|
1143
1142
|
if (delay)
|
|
1144
1143
|
timer = setTimeout(() => isHovered.value = entering, delay);
|
|
@@ -1189,7 +1188,7 @@
|
|
|
1189
1188
|
const { window = defaultWindow, box = "content-box" } = options;
|
|
1190
1189
|
const isSVG = vue.computed(() => {
|
|
1191
1190
|
var _a, _b;
|
|
1192
|
-
return (_b = (_a = unrefElement(target)) == null ?
|
|
1191
|
+
return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
|
|
1193
1192
|
});
|
|
1194
1193
|
const width = vue.ref(initialSize.width);
|
|
1195
1194
|
const height = vue.ref(initialSize.height);
|
|
@@ -1245,7 +1244,7 @@
|
|
|
1245
1244
|
const vElementSize = {
|
|
1246
1245
|
mounted(el, binding) {
|
|
1247
1246
|
var _a;
|
|
1248
|
-
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ?
|
|
1247
|
+
const handler = typeof binding.value === "function" ? binding.value : (_a = binding.value) == null ? void 0 : _a[0];
|
|
1249
1248
|
const options = typeof binding.value === "function" ? [] : binding.value.slice(1);
|
|
1250
1249
|
const { width, height } = useElementSize(el, ...options);
|
|
1251
1250
|
vue.watch([width, height], ([width2, height2]) => handler({ width: width2, height: height2 }));
|
|
@@ -1331,10 +1330,11 @@
|
|
|
1331
1330
|
window = defaultWindow,
|
|
1332
1331
|
scrollTarget,
|
|
1333
1332
|
threshold = 0,
|
|
1334
|
-
rootMargin
|
|
1333
|
+
rootMargin,
|
|
1334
|
+
once = false
|
|
1335
1335
|
} = options;
|
|
1336
1336
|
const elementIsVisible = vue.ref(false);
|
|
1337
|
-
useIntersectionObserver(
|
|
1337
|
+
const { stop } = useIntersectionObserver(
|
|
1338
1338
|
element,
|
|
1339
1339
|
(intersectionObserverEntries) => {
|
|
1340
1340
|
let isIntersecting = elementIsVisible.value;
|
|
@@ -1346,6 +1346,11 @@
|
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
1348
|
elementIsVisible.value = isIntersecting;
|
|
1349
|
+
if (once) {
|
|
1350
|
+
shared.watchOnce(elementIsVisible, () => {
|
|
1351
|
+
stop();
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1349
1354
|
},
|
|
1350
1355
|
{
|
|
1351
1356
|
root: scrollTarget,
|
|
@@ -1435,11 +1440,11 @@
|
|
|
1435
1440
|
const state = shallow ? vue.shallowRef(initialState) : vue.ref(initialState);
|
|
1436
1441
|
const isReady = vue.ref(false);
|
|
1437
1442
|
const isLoading = vue.ref(false);
|
|
1438
|
-
const error = vue.shallowRef(
|
|
1443
|
+
const error = vue.shallowRef(void 0);
|
|
1439
1444
|
async function execute(delay2 = 0, ...args) {
|
|
1440
1445
|
if (resetOnExecute)
|
|
1441
1446
|
state.value = initialState;
|
|
1442
|
-
error.value =
|
|
1447
|
+
error.value = void 0;
|
|
1443
1448
|
isReady.value = false;
|
|
1444
1449
|
isLoading.value = true;
|
|
1445
1450
|
if (delay2 > 0)
|
|
@@ -1519,7 +1524,7 @@
|
|
|
1519
1524
|
function useImage(options, asyncStateOptions = {}) {
|
|
1520
1525
|
const state = useAsyncState(
|
|
1521
1526
|
() => loadImage(vue.toValue(options)),
|
|
1522
|
-
|
|
1527
|
+
void 0,
|
|
1523
1528
|
{
|
|
1524
1529
|
resetOnExecute: true,
|
|
1525
1530
|
...asyncStateOptions
|
|
@@ -1604,7 +1609,7 @@
|
|
|
1604
1609
|
return internalX.value;
|
|
1605
1610
|
},
|
|
1606
1611
|
set(x2) {
|
|
1607
|
-
scrollTo(x2,
|
|
1612
|
+
scrollTo(x2, void 0);
|
|
1608
1613
|
}
|
|
1609
1614
|
});
|
|
1610
1615
|
const y = vue.computed({
|
|
@@ -1612,7 +1617,7 @@
|
|
|
1612
1617
|
return internalY.value;
|
|
1613
1618
|
},
|
|
1614
1619
|
set(y2) {
|
|
1615
|
-
scrollTo(
|
|
1620
|
+
scrollTo(void 0, y2);
|
|
1616
1621
|
}
|
|
1617
1622
|
});
|
|
1618
1623
|
function scrollTo(_x, _y) {
|
|
@@ -1622,12 +1627,12 @@
|
|
|
1622
1627
|
const _element = vue.toValue(element);
|
|
1623
1628
|
if (!_element)
|
|
1624
1629
|
return;
|
|
1625
|
-
(_c = _element instanceof Document ? window.document.body : _element) == null ?
|
|
1630
|
+
(_c = _element instanceof Document ? window.document.body : _element) == null ? void 0 : _c.scrollTo({
|
|
1626
1631
|
top: (_a = vue.toValue(_y)) != null ? _a : y.value,
|
|
1627
1632
|
left: (_b = vue.toValue(_x)) != null ? _b : x.value,
|
|
1628
1633
|
behavior: vue.toValue(behavior)
|
|
1629
1634
|
});
|
|
1630
|
-
const scrollContainer = ((_d = _element == null ?
|
|
1635
|
+
const scrollContainer = ((_d = _element == null ? void 0 : _element.document) == null ? void 0 : _d.documentElement) || (_element == null ? void 0 : _element.documentElement) || _element;
|
|
1631
1636
|
if (x != null)
|
|
1632
1637
|
internalX.value = scrollContainer.scrollLeft;
|
|
1633
1638
|
if (y != null)
|
|
@@ -1661,7 +1666,7 @@
|
|
|
1661
1666
|
var _a;
|
|
1662
1667
|
if (!window)
|
|
1663
1668
|
return;
|
|
1664
|
-
const el = ((_a = target == null ?
|
|
1669
|
+
const el = ((_a = target == null ? void 0 : target.document) == null ? void 0 : _a.documentElement) || (target == null ? void 0 : target.documentElement) || unrefElement(target);
|
|
1665
1670
|
const { display, flexDirection, direction } = getComputedStyle(el);
|
|
1666
1671
|
const directionMultipler = direction === "rtl" ? -1 : 1;
|
|
1667
1672
|
const scrollLeft = el.scrollLeft;
|
|
@@ -1841,7 +1846,7 @@
|
|
|
1841
1846
|
page: (event) => [event.pageX, event.pageY],
|
|
1842
1847
|
client: (event) => [event.clientX, event.clientY],
|
|
1843
1848
|
screen: (event) => [event.screenX, event.screenY],
|
|
1844
|
-
movement: (event) => event instanceof
|
|
1849
|
+
movement: (event) => event instanceof MouseEvent ? [event.movementX, event.movementY] : null
|
|
1845
1850
|
};
|
|
1846
1851
|
function useMouse(options = {}) {
|
|
1847
1852
|
const {
|
|
@@ -1923,7 +1928,7 @@
|
|
|
1923
1928
|
} = options;
|
|
1924
1929
|
const type = options.type || "page";
|
|
1925
1930
|
const { x, y, sourceType } = useMouse(options);
|
|
1926
|
-
const targetRef = vue.ref(target != null ? target : window == null ?
|
|
1931
|
+
const targetRef = vue.ref(target != null ? target : window == null ? void 0 : window.document.body);
|
|
1927
1932
|
const elementX = vue.ref(0);
|
|
1928
1933
|
const elementY = vue.ref(0);
|
|
1929
1934
|
const elementPositionX = vue.ref(0);
|
|
@@ -2061,17 +2066,17 @@
|
|
|
2061
2066
|
...props,
|
|
2062
2067
|
onPageChange(...args) {
|
|
2063
2068
|
var _a;
|
|
2064
|
-
(_a = props.onPageChange) == null ?
|
|
2069
|
+
(_a = props.onPageChange) == null ? void 0 : _a.call(props, ...args);
|
|
2065
2070
|
emit("page-change", ...args);
|
|
2066
2071
|
},
|
|
2067
2072
|
onPageSizeChange(...args) {
|
|
2068
2073
|
var _a;
|
|
2069
|
-
(_a = props.onPageSizeChange) == null ?
|
|
2074
|
+
(_a = props.onPageSizeChange) == null ? void 0 : _a.call(props, ...args);
|
|
2070
2075
|
emit("page-size-change", ...args);
|
|
2071
2076
|
},
|
|
2072
2077
|
onPageCountChange(...args) {
|
|
2073
2078
|
var _a;
|
|
2074
|
-
(_a = props.onPageCountChange) == null ?
|
|
2079
|
+
(_a = props.onPageCountChange) == null ? void 0 : _a.call(props, ...args);
|
|
2075
2080
|
emit("page-count-change", ...args);
|
|
2076
2081
|
}
|
|
2077
2082
|
}));
|
|
@@ -2233,15 +2238,15 @@
|
|
|
2233
2238
|
const variable = vue.ref(initialValue);
|
|
2234
2239
|
const elRef = vue.computed(() => {
|
|
2235
2240
|
var _a;
|
|
2236
|
-
return unrefElement(target) || ((_a = window == null ?
|
|
2241
|
+
return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
|
|
2237
2242
|
});
|
|
2238
2243
|
function updateCssVar() {
|
|
2239
2244
|
var _a;
|
|
2240
2245
|
const key = vue.toValue(prop);
|
|
2241
2246
|
const el = vue.toValue(elRef);
|
|
2242
2247
|
if (el && window && key) {
|
|
2243
|
-
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ?
|
|
2244
|
-
variable.value = value || initialValue;
|
|
2248
|
+
const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
|
|
2249
|
+
variable.value = value || variable.value || initialValue;
|
|
2245
2250
|
}
|
|
2246
2251
|
}
|
|
2247
2252
|
if (observe) {
|
|
@@ -2256,21 +2261,20 @@
|
|
|
2256
2261
|
if (old[0] && old[1])
|
|
2257
2262
|
old[0].style.removeProperty(old[1]);
|
|
2258
2263
|
updateCssVar();
|
|
2259
|
-
}
|
|
2260
|
-
{ immediate: true }
|
|
2264
|
+
}
|
|
2261
2265
|
);
|
|
2262
2266
|
vue.watch(
|
|
2263
|
-
variable,
|
|
2264
|
-
(val) => {
|
|
2265
|
-
var _a;
|
|
2267
|
+
[variable, elRef],
|
|
2268
|
+
([val, el]) => {
|
|
2266
2269
|
const raw_prop = vue.toValue(prop);
|
|
2267
|
-
if ((
|
|
2270
|
+
if ((el == null ? void 0 : el.style) && raw_prop) {
|
|
2268
2271
|
if (val == null)
|
|
2269
|
-
|
|
2272
|
+
el.style.removeProperty(raw_prop);
|
|
2270
2273
|
else
|
|
2271
|
-
|
|
2274
|
+
el.style.setProperty(raw_prop, val);
|
|
2272
2275
|
}
|
|
2273
|
-
}
|
|
2276
|
+
},
|
|
2277
|
+
{ immediate: true }
|
|
2274
2278
|
);
|
|
2275
2279
|
return variable;
|
|
2276
2280
|
}
|
|
@@ -2366,12 +2370,12 @@
|
|
|
2366
2370
|
...options,
|
|
2367
2371
|
onScroll(e) {
|
|
2368
2372
|
var _a;
|
|
2369
|
-
(_a = options.onScroll) == null ?
|
|
2373
|
+
(_a = options.onScroll) == null ? void 0 : _a.call(options, e);
|
|
2370
2374
|
handler(state);
|
|
2371
2375
|
},
|
|
2372
2376
|
onStop(e) {
|
|
2373
2377
|
var _a;
|
|
2374
|
-
(_a = options.onStop) == null ?
|
|
2378
|
+
(_a = options.onStop) == null ? void 0 : _a.call(options, e);
|
|
2375
2379
|
handler(state);
|
|
2376
2380
|
}
|
|
2377
2381
|
});
|
|
@@ -2444,7 +2448,7 @@
|
|
|
2444
2448
|
if (!el || !isLocked.value)
|
|
2445
2449
|
return;
|
|
2446
2450
|
if (shared.isIOS)
|
|
2447
|
-
stopTouchMoveListener == null ?
|
|
2451
|
+
stopTouchMoveListener == null ? void 0 : stopTouchMoveListener();
|
|
2448
2452
|
el.style.overflow = initialOverflow;
|
|
2449
2453
|
elInitialOverflow.delete(el);
|
|
2450
2454
|
isLocked.value = false;
|