@varlet/ui 3.2.12 → 3.2.14-alpha.1717685185218

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.
@@ -28,6 +28,7 @@ import { clamp, isNumber, toNumber, doubleRaf, preventDefault, call } from "@var
28
28
  import { createNamespace } from "../utils/components.mjs";
29
29
  import { onSmartUnmounted, onWindowResize, useTouch } from "@varlet/use";
30
30
  import { usePopup } from "../popup/provide.mjs";
31
+ import { toSizeUnit } from "../utils/elements.mjs";
31
32
  const SWIPE_DELAY = 250;
32
33
  const SWIPE_OFFSET = 20;
33
34
  const { name, n, classes } = createNamespace("swipe");
@@ -50,10 +51,10 @@ function __render__(_ctx, _cache) {
50
51
  {
51
52
  class: _normalizeClass(_ctx.classes(_ctx.n("track"), [_ctx.vertical, _ctx.n("--vertical")])),
52
53
  style: _normalizeStyle({
53
- width: !_ctx.vertical ? `${_ctx.trackSize}px` : void 0,
54
- height: _ctx.vertical ? `${_ctx.trackSize}px` : void 0,
55
- transform: `translate${_ctx.vertical ? "Y" : "X"}(${_ctx.trackTranslate}px)`,
56
- transitionDuration: _ctx.lockDuration ? `0ms` : `${_ctx.toNumber(_ctx.duration)}ms`
54
+ width: !_ctx.vertical ? _ctx.toSizeUnit(_ctx.trackSize) : void 0,
55
+ height: _ctx.vertical ? _ctx.toSizeUnit(_ctx.trackSize) : void 0,
56
+ transform: `translate${_ctx.vertical ? "Y" : "X"}(${_ctx.toSizeUnit(_ctx.trackTranslate)})`,
57
+ transitionDuration: _ctx.lockDuration ? "0ms" : `${_ctx.toNumber(_ctx.duration)}ms`
57
58
  }),
58
59
  onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.handleTouchstart && _ctx.handleTouchstart(...args)),
59
60
  onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.handleTouchmove && _ctx.handleTouchmove(...args)),
@@ -489,6 +490,7 @@ const __sfc__ = defineComponent({
489
490
  lockDuration,
490
491
  hovering,
491
492
  n,
493
+ toSizeUnit,
492
494
  classes,
493
495
  handleTouchstart,
494
496
  handleTouchmove,
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, ref } from "vue";
2
2
  import { useSwipe } from "./provide.mjs";
3
3
  import { createNamespace } from "../utils/components.mjs";
4
+ import { toSizeUnit } from "../utils/elements.mjs";
4
5
  const { name, n } = createNamespace("swipe-item");
5
6
  import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
6
7
  const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
@@ -9,12 +10,12 @@ function __render__(_ctx, _cache) {
9
10
  return _openBlock(), _createElementBlock("div", {
10
11
  class: _normalizeClass(_ctx.n()),
11
12
  style: _normalizeStyle({
12
- width: !_ctx.vertical ? `${_ctx.size}px` : void 0,
13
- height: _ctx.vertical ? `${_ctx.size}px` : void 0,
14
- transform: `translate${_ctx.vertical ? "Y" : "X"}(${_ctx.translate}px)`
13
+ width: !_ctx.vertical ? _ctx.toSizeUnit(_ctx.size) : void 0,
14
+ height: _ctx.vertical ? _ctx.toSizeUnit(_ctx.size) : void 0,
15
+ transform: `translate${_ctx.vertical ? "Y" : "X"}(${_ctx.toSizeUnit(_ctx.translate)})`
15
16
  }),
16
17
  tabindex: "-1",
17
- "aria-hidden": _ctx.currentIndex === _ctx.index ? "false" : "true"
18
+ "aria-hidden": _ctx.currentIndex !== _ctx.index
18
19
  }, [
19
20
  _renderSlot(_ctx.$slots, "default")
20
21
  ], 14, _hoisted_1);
@@ -34,12 +35,13 @@ const __sfc__ = defineComponent({
34
35
  translate.value = x;
35
36
  }
36
37
  return {
37
- n,
38
38
  size,
39
39
  index,
40
40
  currentIndex,
41
41
  vertical,
42
- translate
42
+ translate,
43
+ n,
44
+ toSizeUnit
43
45
  };
44
46
  }
45
47
  });