@varlet/ui 3.2.14-alpha.1717685185218 → 3.2.14
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/es/action-sheet/style/index.mjs +1 -1
- package/es/bottom-navigation-item/bottomNavigationItem.css +1 -1
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/style.css +1 -1
- package/es/swipe/Swipe.mjs +19 -1
- package/es/swipe-item/SwipeItem.mjs +8 -3
- package/es/swipe-item/swipeItem.css +1 -1
- package/es/varlet.esm.js +1432 -1422
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +26 -3
- package/package.json +7 -7
- package/types/styleVars.d.ts +15 -797
- package/umd/varlet.js +6 -6
package/es/swipe/Swipe.mjs
CHANGED
|
@@ -26,7 +26,7 @@ import { useSwipeItems } from "./provide.mjs";
|
|
|
26
26
|
import { props } from "./props.mjs";
|
|
27
27
|
import { clamp, isNumber, toNumber, doubleRaf, preventDefault, call } from "@varlet/shared";
|
|
28
28
|
import { createNamespace } from "../utils/components.mjs";
|
|
29
|
-
import { onSmartUnmounted, onWindowResize, useTouch } from "@varlet/use";
|
|
29
|
+
import { onSmartUnmounted, onWindowResize, useEventListener, useTouch } from "@varlet/use";
|
|
30
30
|
import { usePopup } from "../popup/provide.mjs";
|
|
31
31
|
import { toSizeUnit } from "../utils/elements.mjs";
|
|
32
32
|
const SWIPE_DELAY = 250;
|
|
@@ -236,6 +236,7 @@ const __sfc__ = defineComponent({
|
|
|
236
236
|
vertical
|
|
237
237
|
};
|
|
238
238
|
bindSwipeItems(swipeProvider);
|
|
239
|
+
useEventListener(() => window, "keydown", handleKeydown);
|
|
239
240
|
call(bindPopup, null);
|
|
240
241
|
watch(
|
|
241
242
|
() => length.value,
|
|
@@ -407,6 +408,23 @@ const __sfc__ = defineComponent({
|
|
|
407
408
|
}
|
|
408
409
|
return n(`--navigation${props2.vertical ? "-vertical" : ""}-${type}-animation`);
|
|
409
410
|
}
|
|
411
|
+
function handleKeydown(event) {
|
|
412
|
+
if (!swipeItems.length) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
const focusingSwipeItemIndex = swipeItems.findIndex(({ isFocusing }) => isFocusing.value);
|
|
416
|
+
if (focusingSwipeItemIndex === -1) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const { key } = event;
|
|
420
|
+
preventDefault(event);
|
|
421
|
+
if (key === "ArrowLeft") {
|
|
422
|
+
prev();
|
|
423
|
+
}
|
|
424
|
+
if (key === "ArrowRight") {
|
|
425
|
+
next();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
410
428
|
function resize() {
|
|
411
429
|
if (!swipeEl.value) {
|
|
412
430
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref } from "vue";
|
|
1
|
+
import { computed, defineComponent, ref } from "vue";
|
|
2
2
|
import { useSwipe } from "./provide.mjs";
|
|
3
3
|
import { createNamespace } from "../utils/components.mjs";
|
|
4
4
|
import { toSizeUnit } from "../utils/elements.mjs";
|
|
@@ -15,19 +15,23 @@ function __render__(_ctx, _cache) {
|
|
|
15
15
|
transform: `translate${_ctx.vertical ? "Y" : "X"}(${_ctx.toSizeUnit(_ctx.translate)})`
|
|
16
16
|
}),
|
|
17
17
|
tabindex: "-1",
|
|
18
|
-
"aria-hidden": _ctx.currentIndex !== _ctx.index
|
|
18
|
+
"aria-hidden": _ctx.currentIndex !== _ctx.index,
|
|
19
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => _ctx.isFocusing = true),
|
|
20
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => _ctx.isFocusing = false)
|
|
19
21
|
}, [
|
|
20
22
|
_renderSlot(_ctx.$slots, "default")
|
|
21
|
-
],
|
|
23
|
+
], 46, _hoisted_1);
|
|
22
24
|
}
|
|
23
25
|
const __sfc__ = defineComponent({
|
|
24
26
|
name,
|
|
25
27
|
setup() {
|
|
26
28
|
const translate = ref(0);
|
|
29
|
+
const isFocusing = ref(false);
|
|
27
30
|
const { swipe, bindSwipe, index } = useSwipe();
|
|
28
31
|
const { size, currentIndex, vertical } = swipe;
|
|
29
32
|
const swipeItemProvider = {
|
|
30
33
|
index,
|
|
34
|
+
isFocusing: computed(() => isFocusing.value),
|
|
31
35
|
setTranslate
|
|
32
36
|
};
|
|
33
37
|
bindSwipe(swipeItemProvider);
|
|
@@ -35,6 +39,7 @@ const __sfc__ = defineComponent({
|
|
|
35
39
|
translate.value = x;
|
|
36
40
|
}
|
|
37
41
|
return {
|
|
42
|
+
isFocusing,
|
|
38
43
|
size,
|
|
39
44
|
index,
|
|
40
45
|
currentIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.var-swipe-item { flex-shrink: 0; width: 100%; height: 100%;}
|
|
1
|
+
.var-swipe-item { flex-shrink: 0; width: 100%; height: 100%;}.var-swipe-item:focus { outline: none;}
|