@varlet/ui 2.14.1 → 2.14.3-alpha.1692871861882

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/lib/varlet.cjs.js CHANGED
@@ -616,6 +616,94 @@ function useInitialized(source, value) {
616
616
  }, { immediate: true });
617
617
  return initialized;
618
618
  }
619
+ function getDirection(x, y) {
620
+ if (x > y) {
621
+ return "horizontal";
622
+ }
623
+ if (y > x) {
624
+ return "vertical";
625
+ }
626
+ }
627
+ function useTouch() {
628
+ const startX = vue.ref(0);
629
+ const startY = vue.ref(0);
630
+ const deltaX = vue.ref(0);
631
+ const deltaY = vue.ref(0);
632
+ const offsetX = vue.ref(0);
633
+ const offsetY = vue.ref(0);
634
+ const prevX = vue.ref(0);
635
+ const prevY = vue.ref(0);
636
+ const moveX = vue.ref(0);
637
+ const moveY = vue.ref(0);
638
+ const direction = vue.ref();
639
+ const touching = vue.ref(false);
640
+ const startTime = vue.ref(0);
641
+ const distance = vue.ref(0);
642
+ const resetTouch = () => {
643
+ startX.value = 0;
644
+ startY.value = 0;
645
+ deltaX.value = 0;
646
+ deltaY.value = 0;
647
+ offsetX.value = 0;
648
+ offsetY.value = 0;
649
+ prevX.value = 0;
650
+ prevY.value = 0;
651
+ moveX.value = 0;
652
+ moveY.value = 0;
653
+ direction.value = void 0;
654
+ touching.value = false;
655
+ startTime.value = 0;
656
+ distance.value = 0;
657
+ };
658
+ const startTouch = (event) => {
659
+ resetTouch();
660
+ const { clientX: x, clientY: y } = event.touches[0];
661
+ startX.value = x;
662
+ startY.value = y;
663
+ prevX.value = x;
664
+ prevY.value = y;
665
+ touching.value = true;
666
+ startTime.value = performance.now();
667
+ };
668
+ const moveTouch = (event) => {
669
+ const { clientX: x, clientY: y } = event.touches[0];
670
+ deltaX.value = x - startX.value;
671
+ deltaY.value = y - startY.value;
672
+ offsetX.value = Math.abs(deltaX.value);
673
+ offsetY.value = Math.abs(deltaY.value);
674
+ distance.value = Math.sqrt(offsetX.value ** 2 + offsetY.value ** 2);
675
+ moveX.value = x - prevX.value;
676
+ moveY.value = y - prevY.value;
677
+ if (!direction.value) {
678
+ direction.value = getDirection(offsetX.value, offsetY.value);
679
+ }
680
+ prevX.value = x;
681
+ prevY.value = y;
682
+ };
683
+ const endTouch = () => {
684
+ touching.value = false;
685
+ };
686
+ return {
687
+ startX,
688
+ startY,
689
+ deltaX,
690
+ deltaY,
691
+ offsetX,
692
+ offsetY,
693
+ prevX,
694
+ prevY,
695
+ moveX,
696
+ moveY,
697
+ direction,
698
+ touching,
699
+ startTime,
700
+ distance,
701
+ resetTouch,
702
+ startTouch,
703
+ moveTouch,
704
+ endTouch
705
+ };
706
+ }
619
707
  function asyncGeneratorStep$f(gen, resolve, reject, _next, _throw, key, arg) {
620
708
  try {
621
709
  var info = gen[key](arg);
@@ -4738,6 +4826,10 @@ var props$V = {
4738
4826
  type: Boolean,
4739
4827
  default: false
4740
4828
  },
4829
+ indeterminate: {
4830
+ type: Boolean,
4831
+ default: false
4832
+ },
4741
4833
  iconSize: {
4742
4834
  type: [String, Number]
4743
4835
  },
@@ -4754,7 +4846,8 @@ var props$V = {
4754
4846
  },
4755
4847
  onClick: defineListenerProp(),
4756
4848
  onChange: defineListenerProp(),
4757
- "onUpdate:modelValue": defineListenerProp()
4849
+ "onUpdate:modelValue": defineListenerProp(),
4850
+ "onUpdate:indeterminate": defineListenerProp()
4758
4851
  };
4759
4852
  var CHECKBOX_GROUP_BIND_CHECKBOX_KEY = Symbol("CHECKBOX_GROUP_BIND_CHECKBOX_KEY");
4760
4853
  function useCheckboxes() {
@@ -4852,26 +4945,33 @@ function __render__$10(_ctx, _cache) {
4852
4945
  [vue.withDirectives((vue.openBlock(), vue.createElementBlock(
4853
4946
  "div",
4854
4947
  {
4855
- class: vue.normalizeClass(_ctx.classes(_ctx.n("action"), [_ctx.checked, _ctx.n("--checked"), _ctx.n("--unchecked")], [_ctx.errorMessage || _ctx.checkboxGroupErrorMessage, _ctx.n("--error")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")])),
4948
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("action"), [_ctx.checked || _ctx.isIndeterminate, _ctx.n("--checked"), _ctx.n("--unchecked")], [_ctx.errorMessage || _ctx.checkboxGroupErrorMessage, _ctx.n("--error")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")])),
4856
4949
  style: vue.normalizeStyle({
4857
- color: _ctx.checked ? _ctx.checkedColor : _ctx.uncheckedColor
4950
+ color: _ctx.checked || _ctx.isIndeterminate ? _ctx.checkedColor : _ctx.uncheckedColor
4858
4951
  })
4859
4952
  },
4860
- [_ctx.checked ? vue.renderSlot(_ctx.$slots, "checked-icon", {
4953
+ [_ctx.isIndeterminate ? vue.renderSlot(_ctx.$slots, "indeterminate-icon", {
4861
4954
  key: 0
4862
4955
  }, () => [vue.createVNode(_component_var_icon, {
4863
4956
  class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [_ctx.withAnimation, _ctx.n("--with-animation")])),
4864
- name: "checkbox-marked",
4957
+ name: "minus-box",
4865
4958
  size: _ctx.iconSize,
4866
4959
  "var-checkbox-cover": ""
4867
- }, null, 8, ["class", "size"])]) : vue.renderSlot(_ctx.$slots, "unchecked-icon", {
4960
+ }, null, 8, ["class", "size"])]) : vue.createCommentVNode("v-if", true), _ctx.checked && !_ctx.isIndeterminate ? vue.renderSlot(_ctx.$slots, "checked-icon", {
4868
4961
  key: 1
4962
+ }, () => [vue.createVNode(_component_var_icon, {
4963
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [_ctx.withAnimation, _ctx.n("--with-animation")])),
4964
+ name: "checkbox-marked",
4965
+ size: _ctx.iconSize,
4966
+ "var-checkbox-cover": ""
4967
+ }, null, 8, ["class", "size"])]) : vue.createCommentVNode("v-if", true), !_ctx.checked && !_ctx.isIndeterminate ? vue.renderSlot(_ctx.$slots, "unchecked-icon", {
4968
+ key: 2
4869
4969
  }, () => [vue.createVNode(_component_var_icon, {
4870
4970
  class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [_ctx.withAnimation, _ctx.n("--with-animation")])),
4871
4971
  name: "checkbox-blank-outline",
4872
4972
  size: _ctx.iconSize,
4873
4973
  "var-checkbox-cover": ""
4874
- }, null, 8, ["class", "size"])]), vue.createVNode(_component_var_hover_overlay, {
4974
+ }, null, 8, ["class", "size"])]) : vue.createCommentVNode("v-if", true), vue.createVNode(_component_var_hover_overlay, {
4875
4975
  hovering: !_ctx.disabled && !_ctx.formDisabled && _ctx.hovering
4876
4976
  }, null, 8, ["hovering"])],
4877
4977
  6
@@ -4909,7 +5009,7 @@ var __sfc__$11 = vue.defineComponent({
4909
5009
  },
4910
5010
  props: props$V,
4911
5011
  setup(props2) {
4912
- var value = vue.ref(false);
5012
+ var value = useVModel(props2, "modelValue");
4913
5013
  var checked = vue.computed(() => value.value === props2.checkedValue);
4914
5014
  var checkedValue = vue.computed(() => props2.checkedValue);
4915
5015
  var withAnimation = vue.ref(false);
@@ -4932,6 +5032,7 @@ var __sfc__$11 = vue.defineComponent({
4932
5032
  // expose
4933
5033
  resetValidation
4934
5034
  } = useValidation();
5035
+ var isIndeterminate = useVModel(props2, "indeterminate");
4935
5036
  var validateWithTrigger = (trigger) => {
4936
5037
  vue.nextTick(() => {
4937
5038
  var {
@@ -4943,12 +5044,12 @@ var __sfc__$11 = vue.defineComponent({
4943
5044
  });
4944
5045
  };
4945
5046
  var change = (changedValue) => {
4946
- value.value = changedValue;
4947
5047
  var {
4948
5048
  checkedValue: checkedValue2,
4949
5049
  onChange
4950
5050
  } = props2;
4951
- call(props2["onUpdate:modelValue"], value.value);
5051
+ value.value = changedValue;
5052
+ isIndeterminate.value = false;
4952
5053
  call(onChange, value.value);
4953
5054
  validateWithTrigger("onChange");
4954
5055
  changedValue === checkedValue2 ? checkboxGroup2 == null ? void 0 : checkboxGroup2.onChecked(checkedValue2) : checkboxGroup2 == null ? void 0 : checkboxGroup2.onUnchecked(checkedValue2);
@@ -4986,7 +5087,7 @@ var __sfc__$11 = vue.defineComponent({
4986
5087
  withAnimation.value = false;
4987
5088
  };
4988
5089
  var reset = () => {
4989
- call(props2["onUpdate:modelValue"], props2.uncheckedValue);
5090
+ value.value = props2.uncheckedValue;
4990
5091
  resetValidation();
4991
5092
  };
4992
5093
  var toggle = (changedValue) => {
@@ -5001,11 +5102,6 @@ var __sfc__$11 = vue.defineComponent({
5001
5102
  change(changedValue);
5002
5103
  };
5003
5104
  var validate = () => v(props2.rules, props2.modelValue);
5004
- vue.watch(() => props2.modelValue, (newValue) => {
5005
- value.value = newValue;
5006
- }, {
5007
- immediate: true
5008
- });
5009
5105
  var checkboxProvider = {
5010
5106
  checkedValue,
5011
5107
  checked,
@@ -5018,6 +5114,7 @@ var __sfc__$11 = vue.defineComponent({
5018
5114
  call(bindCheckboxGroup, checkboxProvider);
5019
5115
  call(bindForm, checkboxProvider);
5020
5116
  return {
5117
+ isIndeterminate,
5021
5118
  withAnimation,
5022
5119
  checked,
5023
5120
  errorMessage,
@@ -10529,7 +10626,7 @@ var __sfc__$R = vue.defineComponent({
10529
10626
  startX = clientX;
10530
10627
  startY = clientY;
10531
10628
  };
10532
- var getDirection = (x, y) => x >= y && x > 20 ? "x" : "y";
10629
+ var getDirection2 = (x, y) => x >= y && x > 20 ? "x" : "y";
10533
10630
  var handleTouchmove = (event) => {
10534
10631
  if (isUntouchable.value)
10535
10632
  return;
@@ -10539,7 +10636,7 @@ var __sfc__$R = vue.defineComponent({
10539
10636
  } = event.touches[0];
10540
10637
  var x = clientX - startX;
10541
10638
  var y = clientY - startY;
10542
- touchDirection = getDirection(Math.abs(x), Math.abs(y));
10639
+ touchDirection = getDirection2(Math.abs(x), Math.abs(y));
10543
10640
  checkType = x > 0 ? "prev" : "next";
10544
10641
  };
10545
10642
  var handleTouchend = () => {
@@ -11285,7 +11382,8 @@ var props$K = {
11285
11382
  teleport: {
11286
11383
  type: [String, Object, Boolean],
11287
11384
  default: "body"
11288
- }
11385
+ },
11386
+ onClick: defineListenerProp()
11289
11387
  };
11290
11388
  function _extends$b() {
11291
11389
  _extends$b = Object.assign ? Object.assign.bind() : function(target) {
@@ -11357,6 +11455,9 @@ function __render__$N(_ctx, _cache) {
11357
11455
  }),
11358
11456
  onTouchcancel: _cache[3] || (_cache[3] = function() {
11359
11457
  return _ctx.handleTouchend && _ctx.handleTouchend(...arguments);
11458
+ }),
11459
+ onClick: _cache[4] || (_cache[4] = function() {
11460
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
11360
11461
  })
11361
11462
  }, _ctx.getAttrs()),
11362
11463
  [vue.renderSlot(_ctx.$slots, "default")],
@@ -11384,50 +11485,45 @@ var __sfc__$O = vue.defineComponent({
11384
11485
  var dragged = vue.ref(false);
11385
11486
  var enableTransition = vue.ref(false);
11386
11487
  var dragging = vue.ref(false);
11488
+ var {
11489
+ touching,
11490
+ moveX,
11491
+ moveY,
11492
+ startTouch,
11493
+ moveTouch,
11494
+ endTouch,
11495
+ resetTouch
11496
+ } = useTouch();
11387
11497
  var {
11388
11498
  disabled: teleportDisabled
11389
11499
  } = useTeleport();
11390
- var touching = false;
11391
- var prevX = 0;
11392
- var prevY = 0;
11393
11500
  var draggingRunner = null;
11394
11501
  var handleTouchstart = (event) => {
11395
11502
  if (props2.disabled) {
11396
11503
  return;
11397
11504
  }
11398
- draggingRunner && window.clearTimeout(draggingRunner);
11399
- var {
11400
- clientX,
11401
- clientY
11402
- } = event.touches[0];
11505
+ if (draggingRunner) {
11506
+ window.clearTimeout(draggingRunner);
11507
+ }
11403
11508
  saveXY();
11404
- prevX = clientX;
11405
- prevY = clientY;
11406
- touching = true;
11509
+ startTouch(event);
11407
11510
  dragging.value = false;
11408
11511
  };
11409
11512
  var handleTouchmove = /* @__PURE__ */ function() {
11410
11513
  var _ref2 = _asyncToGenerator$b(function* (event) {
11411
- if (!touching || props2.disabled) {
11514
+ if (!touching.value || props2.disabled) {
11412
11515
  return;
11413
11516
  }
11414
11517
  event.preventDefault();
11415
11518
  enableTransition.value = false;
11416
11519
  dragged.value = true;
11417
11520
  dragging.value = true;
11418
- var {
11419
- clientX,
11420
- clientY
11421
- } = event.touches[0];
11422
- var deltaX = clientX - prevX;
11423
- var deltaY = clientY - prevY;
11424
- prevX = clientX;
11425
- prevY = clientY;
11521
+ moveTouch(event);
11426
11522
  if (props2.direction.includes("x")) {
11427
- x.value += deltaX;
11523
+ x.value += moveX.value;
11428
11524
  }
11429
11525
  if (props2.direction.includes("y")) {
11430
- y.value += deltaY;
11526
+ y.value += moveY.value;
11431
11527
  }
11432
11528
  clampToBoundary();
11433
11529
  });
@@ -11439,13 +11535,19 @@ var __sfc__$O = vue.defineComponent({
11439
11535
  if (props2.disabled) {
11440
11536
  return;
11441
11537
  }
11442
- touching = false;
11538
+ endTouch();
11443
11539
  enableTransition.value = true;
11444
11540
  attract();
11445
11541
  draggingRunner = window.setTimeout(() => {
11446
11542
  dragging.value = false;
11447
11543
  });
11448
11544
  };
11545
+ var handleClick = (event) => {
11546
+ if (dragging.value) {
11547
+ return;
11548
+ }
11549
+ call(props2.onClick, event);
11550
+ };
11449
11551
  var saveXY = () => {
11450
11552
  var {
11451
11553
  left: left2,
@@ -11576,9 +11678,7 @@ var __sfc__$O = vue.defineComponent({
11576
11678
  dragging.value = false;
11577
11679
  x.value = 0;
11578
11680
  y.value = 0;
11579
- touching = false;
11580
- prevX = 0;
11581
- prevY = 0;
11681
+ resetTouch();
11582
11682
  };
11583
11683
  vue.watch(() => props2.boundary, toPxBoundary);
11584
11684
  onWindowResize(resize);
@@ -11599,6 +11699,7 @@ var __sfc__$O = vue.defineComponent({
11599
11699
  handleTouchstart,
11600
11700
  handleTouchmove,
11601
11701
  handleTouchend,
11702
+ handleClick,
11602
11703
  resize,
11603
11704
  reset
11604
11705
  };
@@ -13677,7 +13778,6 @@ const Fab = vue.defineComponent({
13677
13778
  var host = vue.ref(null);
13678
13779
  var dragRef = vue.ref(null);
13679
13780
  var handleClick = (e, value, childrenLength) => {
13680
- var _dragRef$value;
13681
13781
  e.stopPropagation();
13682
13782
  if (props2.trigger !== "click" || props2.disabled) {
13683
13783
  return;
@@ -13686,9 +13786,6 @@ const Fab = vue.defineComponent({
13686
13786
  call(props2.onClick, isActive.value, e);
13687
13787
  return;
13688
13788
  }
13689
- if ((_dragRef$value = dragRef.value) != null && _dragRef$value.dragging) {
13690
- return;
13691
- }
13692
13789
  isActive.value = value;
13693
13790
  call(props2.onClick, isActive.value, e);
13694
13791
  call(isActive.value ? props2.onOpen : props2.onClose);
@@ -13741,8 +13838,8 @@ const Fab = vue.defineComponent({
13741
13838
  isActive.value = false;
13742
13839
  });
13743
13840
  vue.watch(() => [props2.position, props2.fixed, props2.top, props2.bottom, props2.left, props2.right], () => {
13744
- var _dragRef$value2;
13745
- (_dragRef$value2 = dragRef.value) == null ? void 0 : _dragRef$value2.reset();
13841
+ var _dragRef$value;
13842
+ (_dragRef$value = dragRef.value) == null ? void 0 : _dragRef$value.reset();
13746
13843
  });
13747
13844
  useClickOutside(host, "click", handleClickOutside);
13748
13845
  return () => {
@@ -13764,12 +13861,12 @@ const Fab = vue.defineComponent({
13764
13861
  "disabled": props2.disabled || !props2.drag || !props2.fixed,
13765
13862
  "direction": dragProps.direction,
13766
13863
  "attraction": dragProps.attraction,
13767
- "boundary": dragProps.boundary
13864
+ "boundary": dragProps.boundary,
13865
+ "onClick": (e) => handleClick(e, !isActive.value, children.length)
13768
13866
  }, attrs), {
13769
13867
  default: () => [vue.createVNode("div", {
13770
13868
  "class": classes$C(n$K(), n$K("--direction-" + props2.direction), [props2.safeArea, n$K("--safe-area")]),
13771
13869
  "ref": host,
13772
- "onClick": (e) => handleClick(e, !isActive.value, children.length),
13773
13870
  "onMouseleave": () => handleMouse(false, children.length),
13774
13871
  "onMouseenter": () => handleMouse(true, children.length)
13775
13872
  }, [vue.createVNode(vue.Transition, {
@@ -14173,7 +14270,7 @@ function _asyncToGenerator$8(fn2) {
14173
14270
  };
14174
14271
  }
14175
14272
  var SWIPE_DELAY = 250;
14176
- var SWIPE_DISTANCE = 20;
14273
+ var SWIPE_OFFSET = 20;
14177
14274
  var {
14178
14275
  n: n$H,
14179
14276
  classes: classes$A
@@ -14193,7 +14290,7 @@ function __render__$I(_ctx, _cache) {
14193
14290
  style: vue.normalizeStyle({
14194
14291
  width: !_ctx.vertical ? _ctx.trackSize + "px" : void 0,
14195
14292
  height: _ctx.vertical ? _ctx.trackSize + "px" : void 0,
14196
- transform: "translate" + (_ctx.vertical ? "Y" : "X") + "(" + _ctx.translate + "px)",
14293
+ transform: "translate" + (_ctx.vertical ? "Y" : "X") + "(" + _ctx.trackTranslate + "px)",
14197
14294
  transitionDuration: _ctx.lockDuration ? "0ms" : _ctx.toNumber(_ctx.duration) + "ms"
14198
14295
  }),
14199
14296
  onTouchstart: _cache[0] || (_cache[0] = function() {
@@ -14249,7 +14346,7 @@ var __sfc__$J = vue.defineComponent({
14249
14346
  var size = vue.ref(0);
14250
14347
  var vertical = vue.computed(() => props2.vertical);
14251
14348
  var trackSize = vue.ref(0);
14252
- var translate = vue.ref(0);
14349
+ var trackTranslate = vue.ref(0);
14253
14350
  var lockDuration = vue.ref(false);
14254
14351
  var index = vue.ref(0);
14255
14352
  var {
@@ -14261,37 +14358,45 @@ var __sfc__$J = vue.defineComponent({
14261
14358
  popup: popup2,
14262
14359
  bindPopup
14263
14360
  } = usePopup();
14361
+ var {
14362
+ deltaX,
14363
+ deltaY,
14364
+ moveX,
14365
+ moveY,
14366
+ offsetX,
14367
+ offsetY,
14368
+ touching,
14369
+ direction,
14370
+ startTime,
14371
+ startTouch,
14372
+ moveTouch,
14373
+ endTouch
14374
+ } = useTouch();
14264
14375
  var initializedIndex = false;
14265
- var touching = false;
14266
14376
  var timer = -1;
14267
- var startX;
14268
- var startY;
14269
- var startTime;
14270
- var prevX;
14271
- var prevY;
14272
14377
  var findSwipeItem = (idx) => swipeItems.find((_ref) => {
14273
14378
  var {
14274
14379
  index: index2
14275
14380
  } = _ref;
14276
14381
  return index2.value === idx;
14277
14382
  });
14278
- var dispatchBorrower = () => {
14383
+ var dispatchSwipeItems = () => {
14279
14384
  if (!props2.loop) {
14280
14385
  return;
14281
14386
  }
14282
- if (translate.value >= 0) {
14387
+ if (trackTranslate.value >= 0) {
14283
14388
  findSwipeItem(length.value - 1).setTranslate(-trackSize.value);
14284
14389
  }
14285
- if (translate.value <= -(trackSize.value - size.value)) {
14390
+ if (trackTranslate.value <= -(trackSize.value - size.value)) {
14286
14391
  findSwipeItem(0).setTranslate(trackSize.value);
14287
14392
  }
14288
- if (translate.value > -(trackSize.value - size.value) && translate.value < 0) {
14393
+ if (trackTranslate.value > -(trackSize.value - size.value) && trackTranslate.value < 0) {
14289
14394
  findSwipeItem(length.value - 1).setTranslate(0);
14290
14395
  findSwipeItem(0).setTranslate(0);
14291
14396
  }
14292
14397
  };
14293
14398
  var getSwipeIndex = (targetSwipeIndex) => {
14294
- var swipeIndex = isNumber(targetSwipeIndex) ? targetSwipeIndex : Math.floor((translate.value - size.value / 2) / -size.value);
14399
+ var swipeIndex = isNumber(targetSwipeIndex) ? targetSwipeIndex : Math.floor((trackTranslate.value - size.value / 2) / -size.value);
14295
14400
  var {
14296
14401
  loop
14297
14402
  } = props2;
@@ -14328,14 +14433,14 @@ var __sfc__$J = vue.defineComponent({
14328
14433
  return clamp$1(index2, 0, length.value - 1);
14329
14434
  };
14330
14435
  var fixPosition = (fn2) => {
14331
- var overLeft = translate.value >= size.value;
14332
- var overRight = translate.value <= -trackSize.value;
14436
+ var overLeft = trackTranslate.value >= size.value;
14437
+ var overRight = trackTranslate.value <= -trackSize.value;
14333
14438
  var leftTranslate = 0;
14334
14439
  var rightTranslate = -(trackSize.value - size.value);
14335
14440
  lockDuration.value = true;
14336
14441
  if (overLeft || overRight) {
14337
14442
  lockDuration.value = true;
14338
- translate.value = overRight ? leftTranslate : rightTranslate;
14443
+ trackTranslate.value = overRight ? leftTranslate : rightTranslate;
14339
14444
  findSwipeItem(0).setTranslate(0);
14340
14445
  findSwipeItem(length.value - 1).setTranslate(0);
14341
14446
  }
@@ -14367,26 +14472,15 @@ var __sfc__$J = vue.defineComponent({
14367
14472
  var stopAutoplay = () => {
14368
14473
  timer && clearTimeout(timer);
14369
14474
  };
14370
- var getDirection = (x, y) => {
14371
- if (x > y && x > 10) {
14372
- return "horizontal";
14373
- }
14374
- if (y > x && y > 10) {
14375
- return "vertical";
14376
- }
14475
+ var setTrackTranslate = (value) => {
14476
+ trackTranslate.value = value;
14477
+ dispatchSwipeItems();
14377
14478
  };
14378
14479
  var handleTouchstart = (event) => {
14379
14480
  if (length.value <= 1 || !props2.touchable) {
14380
14481
  return;
14381
14482
  }
14382
- var {
14383
- clientX,
14384
- clientY
14385
- } = event.touches[0];
14386
- startX = clientX;
14387
- startY = clientY;
14388
- startTime = performance.now();
14389
- touching = true;
14483
+ startTouch(event);
14390
14484
  stopAutoplay();
14391
14485
  fixPosition(() => {
14392
14486
  lockDuration.value = true;
@@ -14397,48 +14491,38 @@ var __sfc__$J = vue.defineComponent({
14397
14491
  touchable,
14398
14492
  vertical: vertical2
14399
14493
  } = props2;
14400
- if (!touching || !touchable) {
14494
+ if (!touching.value || !touchable) {
14401
14495
  return;
14402
14496
  }
14403
- var {
14404
- clientX,
14405
- clientY
14406
- } = event.touches[0];
14407
- var deltaX = Math.abs(clientX - startX);
14408
- var deltaY = Math.abs(clientY - startY);
14409
- var direction = getDirection(deltaX, deltaY);
14497
+ moveTouch(event);
14410
14498
  var expectDirection = vertical2 ? "vertical" : "horizontal";
14411
- if (direction === expectDirection) {
14412
- event.preventDefault();
14413
- var moveX = prevX !== void 0 ? clientX - prevX : 0;
14414
- var moveY = prevY !== void 0 ? clientY - prevY : 0;
14415
- prevX = clientX;
14416
- prevY = clientY;
14417
- translate.value += vertical2 ? moveY : moveX;
14418
- dispatchBorrower();
14499
+ if (direction.value !== expectDirection) {
14500
+ return;
14419
14501
  }
14502
+ event.preventDefault();
14503
+ setTrackTranslate(trackTranslate.value + (vertical2 ? moveY.value : moveX.value));
14420
14504
  };
14421
14505
  var handleTouchend = () => {
14422
- if (!touching) {
14506
+ if (!touching.value) {
14423
14507
  return;
14424
14508
  }
14425
14509
  var {
14426
14510
  vertical: vertical2,
14427
14511
  onChange
14428
14512
  } = props2;
14429
- var positive = vertical2 ? prevY < startY : prevX < startX;
14430
- var distance = vertical2 ? Math.abs(startY - prevY) : Math.abs(startX - prevX);
14431
- var quickSwiping = performance.now() - startTime <= SWIPE_DELAY && distance >= SWIPE_DISTANCE;
14513
+ endTouch();
14514
+ var positive = vertical2 ? deltaY.value < 0 : deltaX.value < 0;
14515
+ var offset2 = vertical2 ? offsetY.value : offsetX.value;
14516
+ var quickSwiping = performance.now() - startTime.value <= SWIPE_DELAY && offset2 >= SWIPE_OFFSET;
14432
14517
  var swipeIndex = quickSwiping ? positive ? getSwipeIndex(index.value + 1) : getSwipeIndex(index.value - 1) : getSwipeIndex();
14433
- touching = false;
14434
14518
  lockDuration.value = false;
14435
- prevX = void 0;
14436
- prevY = void 0;
14437
- translate.value = swipeIndex * -size.value;
14519
+ setTrackTranslate(swipeIndex * -size.value);
14438
14520
  var prevIndex = index.value;
14439
14521
  index.value = swipeIndexToIndex(swipeIndex);
14440
14522
  startAutoplay();
14441
- prevIndex !== index.value && call(onChange, index.value);
14523
+ if (prevIndex !== index.value) {
14524
+ call(onChange, index.value);
14525
+ }
14442
14526
  };
14443
14527
  var resize = () => {
14444
14528
  if (!swipeEl.value) {
@@ -14447,7 +14531,7 @@ var __sfc__$J = vue.defineComponent({
14447
14531
  lockDuration.value = true;
14448
14532
  size.value = props2.vertical ? swipeEl.value.offsetHeight : swipeEl.value.offsetWidth;
14449
14533
  trackSize.value = size.value * length.value;
14450
- translate.value = index.value * -size.value;
14534
+ trackTranslate.value = index.value * -size.value;
14451
14535
  swipeItems.forEach((swipeItem2) => {
14452
14536
  swipeItem2.setTranslate(0);
14453
14537
  });
@@ -14473,11 +14557,11 @@ var __sfc__$J = vue.defineComponent({
14473
14557
  fixPosition(() => {
14474
14558
  if (currentIndex === length.value - 1 && loop) {
14475
14559
  findSwipeItem(0).setTranslate(trackSize.value);
14476
- translate.value = length.value * -size.value;
14560
+ trackTranslate.value = length.value * -size.value;
14477
14561
  return;
14478
14562
  }
14479
14563
  if (currentIndex !== length.value - 1) {
14480
- translate.value = index.value * -size.value;
14564
+ trackTranslate.value = index.value * -size.value;
14481
14565
  }
14482
14566
  });
14483
14567
  };
@@ -14498,11 +14582,11 @@ var __sfc__$J = vue.defineComponent({
14498
14582
  fixPosition(() => {
14499
14583
  if (currentIndex === 0 && loop) {
14500
14584
  findSwipeItem(length.value - 1).setTranslate(-trackSize.value);
14501
- translate.value = size.value;
14585
+ trackTranslate.value = size.value;
14502
14586
  return;
14503
14587
  }
14504
14588
  if (currentIndex !== 0) {
14505
- translate.value = index.value * -size.value;
14589
+ trackTranslate.value = index.value * -size.value;
14506
14590
  }
14507
14591
  });
14508
14592
  };
@@ -14558,7 +14642,7 @@ var __sfc__$J = vue.defineComponent({
14558
14642
  index,
14559
14643
  swipeEl,
14560
14644
  trackSize,
14561
- translate,
14645
+ trackTranslate,
14562
14646
  lockDuration,
14563
14647
  handleTouchstart,
14564
14648
  handleTouchmove,
@@ -14828,6 +14912,29 @@ var __sfc__$H = vue.defineComponent({
14828
14912
  props: props$D,
14829
14913
  setup(props2) {
14830
14914
  var popupShow = vue.ref(false);
14915
+ var scale = vue.ref(1);
14916
+ var translateX = vue.ref(0);
14917
+ var translateY = vue.ref(0);
14918
+ var transitionTimingFunction = vue.ref(void 0);
14919
+ var transitionDuration = vue.ref(void 0);
14920
+ var canSwipe = vue.ref(true);
14921
+ var swipeRef = vue.ref(null);
14922
+ var {
14923
+ moveX,
14924
+ moveY,
14925
+ distance,
14926
+ startTime,
14927
+ startTouch,
14928
+ moveTouch,
14929
+ endTouch
14930
+ } = useTouch();
14931
+ var targets = {
14932
+ start: null,
14933
+ prev: null
14934
+ };
14935
+ var closeRunner = null;
14936
+ var longPressRunner = null;
14937
+ var isLongPress = false;
14831
14938
  var initialIndex = vue.computed(() => {
14832
14939
  var {
14833
14940
  images,
@@ -14838,20 +14945,8 @@ var __sfc__$H = vue.defineComponent({
14838
14945
  return toNumber(initialIndex2);
14839
14946
  }
14840
14947
  var index = images.findIndex((image2) => image2 === current);
14841
- return index >= 0 ? index : 0;
14948
+ return Math.max(index, 0);
14842
14949
  });
14843
- var scale = vue.ref(1);
14844
- var translateX = vue.ref(0);
14845
- var translateY = vue.ref(0);
14846
- var transitionTimingFunction = vue.ref(void 0);
14847
- var transitionDuration = vue.ref(void 0);
14848
- var canSwipe = vue.ref(true);
14849
- var swipeRef = vue.ref(null);
14850
- var startTouch = null;
14851
- var prevTouch = null;
14852
- var closeRunner = null;
14853
- var longPressRunner = null;
14854
- var isLongPress = false;
14855
14950
  var isPreventDefault = vue.computed(() => {
14856
14951
  var {
14857
14952
  imagePreventDefault,
@@ -14859,27 +14954,10 @@ var __sfc__$H = vue.defineComponent({
14859
14954
  } = props2;
14860
14955
  return show && imagePreventDefault;
14861
14956
  });
14862
- var getDistance = (touch, target) => {
14863
- var {
14864
- clientX: touchX,
14865
- clientY: touchY
14866
- } = touch;
14867
- var {
14868
- clientX: targetX,
14869
- clientY: targetY
14870
- } = target;
14871
- return Math.abs(Math.sqrt(Math.pow(targetX - touchX, 2) + Math.pow(targetY - touchY, 2)));
14872
- };
14873
- var createVarTouch = (touches, target) => ({
14874
- clientX: touches.clientX,
14875
- clientY: touches.clientY,
14876
- timestamp: performance.now(),
14877
- target
14878
- });
14879
14957
  var zoomIn = () => {
14880
14958
  scale.value = toNumber(props2.zoom);
14881
14959
  canSwipe.value = false;
14882
- prevTouch = null;
14960
+ targets.prev = null;
14883
14961
  window.setTimeout(() => {
14884
14962
  transitionTimingFunction.value = "linear";
14885
14963
  transitionDuration.value = "0s";
@@ -14890,28 +14968,30 @@ var __sfc__$H = vue.defineComponent({
14890
14968
  translateX.value = 0;
14891
14969
  translateY.value = 0;
14892
14970
  canSwipe.value = true;
14893
- prevTouch = null;
14971
+ targets.prev = null;
14894
14972
  transitionTimingFunction.value = void 0;
14895
14973
  transitionDuration.value = void 0;
14896
14974
  };
14897
- var isDoubleTouch = (currentTouch) => {
14898
- if (!prevTouch) {
14975
+ var isDoubleTouch = (target) => {
14976
+ if (!targets.prev) {
14899
14977
  return false;
14900
14978
  }
14901
- return getDistance(prevTouch, currentTouch) <= DISTANCE_OFFSET && currentTouch.timestamp - prevTouch.timestamp <= EVENT_DELAY && prevTouch.target === currentTouch.target;
14979
+ return distance.value <= DISTANCE_OFFSET && performance.now() - startTime.value <= EVENT_DELAY && targets.prev === target;
14902
14980
  };
14903
14981
  var isTapTouch = (target) => {
14904
- if (!target || !startTouch || !prevTouch) {
14982
+ if (!target || !targets.start || !targets.prev) {
14905
14983
  return false;
14906
14984
  }
14907
- return getDistance(startTouch, prevTouch) <= DISTANCE_OFFSET && performance.now() - prevTouch.timestamp < TAP_DELAY && (target === startTouch.target || target.parentNode === startTouch.target);
14985
+ return distance.value <= DISTANCE_OFFSET && performance.now() - startTime.value < TAP_DELAY && (target === targets.start || target.parentNode === targets.start);
14908
14986
  };
14909
14987
  var handleTouchcancel = () => {
14988
+ endTouch();
14910
14989
  window.clearTimeout(longPressRunner);
14911
14990
  isLongPress = false;
14912
- startTouch = null;
14991
+ targets.start = null;
14913
14992
  };
14914
14993
  var handleTouchend = (event) => {
14994
+ endTouch();
14915
14995
  window.clearTimeout(longPressRunner);
14916
14996
  if (isLongPress) {
14917
14997
  isLongPress = false;
@@ -14920,26 +15000,24 @@ var __sfc__$H = vue.defineComponent({
14920
15000
  var isTap = isTapTouch(event.target);
14921
15001
  closeRunner = window.setTimeout(() => {
14922
15002
  isTap && close();
14923
- startTouch = null;
15003
+ targets.start = null;
14924
15004
  }, EVENT_DELAY);
14925
15005
  };
14926
15006
  var handleTouchstart = (event, idx) => {
14927
15007
  window.clearTimeout(closeRunner);
14928
15008
  window.clearTimeout(longPressRunner);
14929
- var currentTouch = createVarTouch(event.touches[0], event.currentTarget);
14930
- startTouch = currentTouch;
15009
+ var target = event.currentTarget;
15010
+ targets.start = target;
14931
15011
  longPressRunner = window.setTimeout(() => {
14932
- var {
14933
- onLongPress
14934
- } = props2;
14935
15012
  isLongPress = true;
14936
- call(onLongPress, idx);
15013
+ call(props2.onLongPress, idx);
14937
15014
  }, LONG_PRESS_DELAY);
14938
- if (isDoubleTouch(currentTouch)) {
15015
+ if (isDoubleTouch(target)) {
14939
15016
  scale.value > 1 ? zoomOut() : zoomIn();
14940
15017
  return;
14941
15018
  }
14942
- prevTouch = currentTouch;
15019
+ startTouch(event);
15020
+ targets.prev = target;
14943
15021
  };
14944
15022
  var getZoom = (target) => {
14945
15023
  var {
@@ -14986,33 +15064,22 @@ var __sfc__$H = vue.defineComponent({
14986
15064
  var displayHeight = imageRadio > rootRadio ? height : width * imageRadio;
14987
15065
  return Math.max(0, (zoom * displayHeight - height) / 2) / zoom;
14988
15066
  };
14989
- var getMoveTranslate = (current, move, limit) => {
14990
- if (current + move >= limit) {
14991
- return limit;
14992
- }
14993
- if (current + move <= -limit) {
14994
- return -limit;
14995
- }
14996
- return current + move;
14997
- };
14998
15067
  var handleTouchmove = (event) => {
14999
- if (!prevTouch) {
15068
+ if (!targets.prev) {
15000
15069
  return;
15001
15070
  }
15071
+ moveTouch(event);
15002
15072
  var target = event.currentTarget;
15003
- var currentTouch = createVarTouch(event.touches[0], target);
15004
- if (getDistance(currentTouch, prevTouch) > DISTANCE_OFFSET) {
15073
+ if (distance.value > DISTANCE_OFFSET) {
15005
15074
  window.clearTimeout(longPressRunner);
15006
15075
  }
15007
15076
  if (scale.value > 1) {
15008
- var moveX = currentTouch.clientX - prevTouch.clientX;
15009
- var moveY = currentTouch.clientY - prevTouch.clientY;
15010
15077
  var limitX = getLimitX(target);
15011
15078
  var limitY = getLimitY(target);
15012
- translateX.value = getMoveTranslate(translateX.value, moveX, limitX);
15013
- translateY.value = getMoveTranslate(translateY.value, moveY, limitY);
15079
+ translateX.value = clamp$1(translateX.value + moveX.value, -limitX, limitX);
15080
+ translateY.value = clamp$1(translateY.value + moveY.value, -limitY, limitY);
15014
15081
  }
15015
- prevTouch = currentTouch;
15082
+ targets.prev = target;
15016
15083
  };
15017
15084
  var close = () => {
15018
15085
  if (scale.value > 1) {
@@ -17266,7 +17333,9 @@ var {
17266
17333
  } = createNamespace("option");
17267
17334
  function __render__$x(_ctx, _cache) {
17268
17335
  var _component_var_checkbox = vue.resolveComponent("var-checkbox");
17336
+ var _component_var_hover_overlay = vue.resolveComponent("var-hover-overlay");
17269
17337
  var _directive_ripple = vue.resolveDirective("ripple");
17338
+ var _directive_hover = vue.resolveDirective("hover");
17270
17339
  return vue.withDirectives((vue.openBlock(), vue.createElementBlock(
17271
17340
  "div",
17272
17341
  {
@@ -17310,18 +17379,22 @@ function __render__$x(_ctx, _cache) {
17310
17379
  )])],
17311
17380
  2
17312
17381
  /* CLASS */
17313
- )],
17382
+ ), vue.createVNode(_component_var_hover_overlay, {
17383
+ hovering: _ctx.hovering
17384
+ }, null, 8, ["hovering"])],
17314
17385
  6
17315
17386
  /* CLASS, STYLE */
17316
- )), [[_directive_ripple]]);
17387
+ )), [[_directive_ripple], [_directive_hover, _ctx.handleHovering, "desktop"]]);
17317
17388
  }
17318
17389
  var __sfc__$y = vue.defineComponent({
17319
17390
  name: "VarOption",
17320
17391
  directives: {
17321
- Ripple: Ripple$1
17392
+ Ripple: Ripple$1,
17393
+ Hover: Hover$1
17322
17394
  },
17323
17395
  components: {
17324
- VarCheckbox: Checkbox
17396
+ VarCheckbox: Checkbox,
17397
+ VarHoverOverlay: HoverOverlay
17325
17398
  },
17326
17399
  props: props$s,
17327
17400
  setup(props2) {
@@ -17339,6 +17412,10 @@ var __sfc__$y = vue.defineComponent({
17339
17412
  onSelect,
17340
17413
  computeLabel
17341
17414
  } = select2;
17415
+ var {
17416
+ hovering,
17417
+ handleHovering
17418
+ } = useHoverOverlay();
17342
17419
  var handleClick = () => {
17343
17420
  if (multiple.value) {
17344
17421
  optionSelected.value = !optionSelected.value;
@@ -17363,6 +17440,8 @@ var __sfc__$y = vue.defineComponent({
17363
17440
  optionSelected,
17364
17441
  multiple,
17365
17442
  focusColor,
17443
+ hovering,
17444
+ handleHovering,
17366
17445
  handleClick,
17367
17446
  handleSelect
17368
17447
  };
@@ -19209,7 +19288,7 @@ var __sfc__$s = vue.defineComponent({
19209
19288
  inheritAttrs: false,
19210
19289
  props: props$l,
19211
19290
  setup(props2) {
19212
- var value = vue.ref(false);
19291
+ var value = useVModel(props2, "modelValue");
19213
19292
  var checked = vue.computed(() => value.value === props2.checkedValue);
19214
19293
  var withAnimation = vue.ref(false);
19215
19294
  var {
@@ -19250,7 +19329,6 @@ var __sfc__$s = vue.defineComponent({
19250
19329
  return;
19251
19330
  }
19252
19331
  value.value = changedValue;
19253
- call(props2["onUpdate:modelValue"], value.value);
19254
19332
  call(onChange, value.value);
19255
19333
  radioGroup2 == null ? void 0 : radioGroup2.onToggle(checkedValue);
19256
19334
  validateWithTrigger("onChange");
@@ -19281,7 +19359,7 @@ var __sfc__$s = vue.defineComponent({
19281
19359
  value.value = v2 === checkedValue ? checkedValue : uncheckedValue;
19282
19360
  };
19283
19361
  var reset = () => {
19284
- call(props2["onUpdate:modelValue"], props2.uncheckedValue);
19362
+ value.value = props2.uncheckedValue;
19285
19363
  resetValidation();
19286
19364
  };
19287
19365
  var validate = () => v(props2.rules, props2.modelValue);
@@ -19296,11 +19374,6 @@ var __sfc__$s = vue.defineComponent({
19296
19374
  }
19297
19375
  change(changedValue);
19298
19376
  };
19299
- vue.watch(() => props2.modelValue, (newValue) => {
19300
- value.value = newValue;
19301
- }, {
19302
- immediate: true
19303
- });
19304
19377
  var radioProvider = {
19305
19378
  sync,
19306
19379
  validate,
@@ -25453,7 +25526,7 @@ const uploader = "";
25453
25526
  const UploaderSfc = "";
25454
25527
  const watermark = "";
25455
25528
  const WatermarkSfc = "";
25456
- const version = "2.14.1";
25529
+ const version = "2.14.3-alpha.1692871861882";
25457
25530
  function install(app) {
25458
25531
  ActionSheet.install && app.use(ActionSheet);
25459
25532
  AppBar.install && app.use(AppBar);