@varlet/ui 2.16.6 → 2.16.7-alpha.1695050636971

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
@@ -13848,6 +13848,10 @@ var props$E = {
13848
13848
  type: [String, Number],
13849
13849
  default: 0
13850
13850
  },
13851
+ navigation: {
13852
+ type: [Boolean, String],
13853
+ default: false
13854
+ },
13851
13855
  indicator: {
13852
13856
  type: Boolean,
13853
13857
  default: true
@@ -13898,7 +13902,10 @@ var {
13898
13902
  } = createNamespace("swipe");
13899
13903
  var _hoisted_1$k = ["onClick"];
13900
13904
  function __render__$I(_ctx, _cache) {
13901
- return vue.openBlock(), vue.createElementBlock(
13905
+ var _component_var_icon = vue.resolveComponent("var-icon");
13906
+ var _component_var_button = vue.resolveComponent("var-button");
13907
+ var _directive_hover = vue.resolveDirective("hover");
13908
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock(
13902
13909
  "div",
13903
13910
  {
13904
13911
  class: vue.normalizeClass(_ctx.n()),
@@ -13927,13 +13934,88 @@ function __render__$I(_ctx, _cache) {
13927
13934
  [vue.renderSlot(_ctx.$slots, "default")],
13928
13935
  38
13929
13936
  /* CLASS, STYLE, HYDRATE_EVENTS */
13930
- ), vue.renderSlot(_ctx.$slots, "indicator", {
13937
+ ), _ctx.navigation ? vue.renderSlot(_ctx.$slots, "prev", vue.normalizeProps(vue.mergeProps({
13938
+ key: 0
13939
+ }, {
13940
+ index: _ctx.index,
13941
+ length: _ctx.length,
13942
+ prev: _ctx.prev,
13943
+ next: _ctx.next,
13944
+ to: _ctx.to,
13945
+ hovering: _ctx.hovering
13946
+ })), () => [vue.createVNode(vue.Transition, {
13947
+ name: _ctx.getNavigationAnimation("prev")
13948
+ }, {
13949
+ default: vue.withCtx(() => [_ctx.navigation === true || _ctx.hovering ? (vue.openBlock(), vue.createElementBlock(
13950
+ "div",
13951
+ {
13952
+ key: 0,
13953
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("navigation"), _ctx.n("navigation-prev"), [_ctx.vertical, _ctx.n("--navigation-vertical-prev")]))
13954
+ },
13955
+ [vue.createVNode(_component_var_button, {
13956
+ "var-swipe-cover": "",
13957
+ disabled: !_ctx.loop && _ctx.index === 0,
13958
+ class: vue.normalizeClass(_ctx.n("navigation-prev-button")),
13959
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.prev())
13960
+ }, {
13961
+ default: vue.withCtx(() => [vue.createVNode(_component_var_icon, {
13962
+ "var-swipe-cover": "",
13963
+ class: vue.normalizeClass(_ctx.n("navigation-prev-button-icon")),
13964
+ name: _ctx.vertical ? "chevron-up" : "chevron-left"
13965
+ }, null, 8, ["class", "name"])]),
13966
+ _: 1
13967
+ /* STABLE */
13968
+ }, 8, ["disabled", "class"])],
13969
+ 2
13970
+ /* CLASS */
13971
+ )) : vue.createCommentVNode("v-if", true)]),
13972
+ _: 1
13973
+ /* STABLE */
13974
+ }, 8, ["name"])]) : vue.createCommentVNode("v-if", true), _ctx.navigation ? vue.renderSlot(_ctx.$slots, "next", vue.normalizeProps(vue.mergeProps({
13975
+ key: 1
13976
+ }, {
13977
+ index: _ctx.index,
13978
+ length: _ctx.length,
13979
+ hovering: _ctx.hovering,
13980
+ prev: _ctx.prev,
13981
+ next: _ctx.next,
13982
+ to: _ctx.to
13983
+ })), () => [vue.createVNode(vue.Transition, {
13984
+ name: _ctx.getNavigationAnimation("next")
13985
+ }, {
13986
+ default: vue.withCtx(() => [_ctx.navigation === true || _ctx.hovering ? (vue.openBlock(), vue.createElementBlock(
13987
+ "div",
13988
+ {
13989
+ key: 0,
13990
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("navigation"), _ctx.n("navigation-next"), [_ctx.vertical, _ctx.n("--navigation-vertical-next")]))
13991
+ },
13992
+ [vue.createVNode(_component_var_button, {
13993
+ "var-swipe-cover": "",
13994
+ class: vue.normalizeClass(_ctx.n("navigation-next-button")),
13995
+ disabled: !_ctx.loop && _ctx.index === _ctx.length - 1,
13996
+ onClick: _cache[4] || (_cache[4] = ($event) => _ctx.next())
13997
+ }, {
13998
+ default: vue.withCtx(() => [vue.createVNode(_component_var_icon, {
13999
+ "var-swipe-cover": "",
14000
+ class: vue.normalizeClass(_ctx.n("navigation-next-button-icon")),
14001
+ name: _ctx.vertical ? "chevron-down" : "chevron-right"
14002
+ }, null, 8, ["class", "name"])]),
14003
+ _: 1
14004
+ /* STABLE */
14005
+ }, 8, ["class", "disabled"])],
14006
+ 2
14007
+ /* CLASS */
14008
+ )) : vue.createCommentVNode("v-if", true)]),
14009
+ _: 1
14010
+ /* STABLE */
14011
+ }, 8, ["name"])]) : vue.createCommentVNode("v-if", true), vue.renderSlot(_ctx.$slots, "indicator", vue.normalizeProps(vue.guardReactiveProps({
13931
14012
  index: _ctx.index,
13932
14013
  length: _ctx.length,
14014
+ hovering: _ctx.hovering,
13933
14015
  prev: _ctx.prev,
13934
14016
  next: _ctx.next,
13935
14017
  to: _ctx.to
13936
- }, () => [_ctx.indicator && _ctx.length ? (vue.openBlock(), vue.createElementBlock(
14018
+ })), () => [_ctx.indicator && _ctx.length ? (vue.openBlock(), vue.createElementBlock(
13937
14019
  "div",
13938
14020
  {
13939
14021
  key: 0,
@@ -13960,10 +14042,17 @@ function __render__$I(_ctx, _cache) {
13960
14042
  )) : vue.createCommentVNode("v-if", true)])],
13961
14043
  2
13962
14044
  /* CLASS */
13963
- );
14045
+ )), [[_directive_hover, _ctx.handleHovering]]);
13964
14046
  }
13965
14047
  var __sfc__$J = vue.defineComponent({
13966
14048
  name: name$E,
14049
+ directives: {
14050
+ Hover: Hover$1
14051
+ },
14052
+ components: {
14053
+ VarButton: Button,
14054
+ VarIcon: Icon
14055
+ },
13967
14056
  props: props$E,
13968
14057
  setup(props2) {
13969
14058
  var swipeEl = vue.ref(null);
@@ -13973,6 +14062,7 @@ var __sfc__$J = vue.defineComponent({
13973
14062
  var trackTranslate = vue.ref(0);
13974
14063
  var lockDuration = vue.ref(false);
13975
14064
  var index = vue.ref(0);
14065
+ var hovering = vue.ref(false);
13976
14066
  var {
13977
14067
  swipeItems,
13978
14068
  bindSwipeItems,
@@ -14283,6 +14373,17 @@ var __sfc__$J = vue.defineComponent({
14283
14373
  });
14284
14374
  });
14285
14375
  }
14376
+ var handleHovering = (value) => {
14377
+ if (props2.navigation === "hover") {
14378
+ hovering.value = value;
14379
+ }
14380
+ };
14381
+ function getNavigationAnimation(type) {
14382
+ if (props2.navigation !== "hover") {
14383
+ return "";
14384
+ }
14385
+ return props2.vertical ? n$H("--navigation-vertical-" + type + "-animation") : n$H("--navigation-" + type + "-animation");
14386
+ }
14286
14387
  return {
14287
14388
  length,
14288
14389
  index,
@@ -14290,6 +14391,7 @@ var __sfc__$J = vue.defineComponent({
14290
14391
  trackSize,
14291
14392
  trackTranslate,
14292
14393
  lockDuration,
14394
+ hovering,
14293
14395
  n: n$H,
14294
14396
  classes: classes$A,
14295
14397
  handleTouchstart,
@@ -14299,7 +14401,9 @@ var __sfc__$J = vue.defineComponent({
14299
14401
  prev,
14300
14402
  to,
14301
14403
  resize,
14302
- toNumber
14404
+ toNumber,
14405
+ handleHovering,
14406
+ getNavigationAnimation
14303
14407
  };
14304
14408
  }
14305
14409
  });
@@ -24748,7 +24852,7 @@ const uploader = "";
24748
24852
  const UploaderSfc = "";
24749
24853
  const watermark = "";
24750
24854
  const WatermarkSfc = "";
24751
- const version = "2.16.6";
24855
+ const version = "2.16.7-alpha.1695050636971";
24752
24856
  function install(app) {
24753
24857
  ActionSheet.install && app.use(ActionSheet);
24754
24858
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.16.6",
3
+ "version": "2.16.7-alpha.1695050636971",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -48,9 +48,9 @@
48
48
  "@popperjs/core": "^2.11.6",
49
49
  "dayjs": "^1.10.4",
50
50
  "decimal.js": "^10.2.1",
51
- "@varlet/icons": "2.16.6",
52
- "@varlet/use": "2.16.6",
53
- "@varlet/shared": "2.16.6"
51
+ "@varlet/icons": "2.16.7-alpha.1695050636971",
52
+ "@varlet/shared": "2.16.7-alpha.1695050636971",
53
+ "@varlet/use": "2.16.7-alpha.1695050636971"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@vue/runtime-core": "3.3.4",
@@ -66,9 +66,9 @@
66
66
  "typescript": "^5.1.5",
67
67
  "vue": "3.3.4",
68
68
  "vue-router": "4.2.0",
69
- "@varlet/cli": "2.16.6",
70
- "@varlet/touch-emulator": "2.16.6",
71
- "@varlet/ui": "2.16.6"
69
+ "@varlet/touch-emulator": "2.16.7-alpha.1695050636971",
70
+ "@varlet/ui": "2.16.7-alpha.1695050636971",
71
+ "@varlet/cli": "2.16.7-alpha.1695050636971"
72
72
  },
73
73
  "scripts": {
74
74
  "dev": "varlet-cli dev",
package/types/swipe.d.ts CHANGED
@@ -7,6 +7,8 @@ export interface SwipeToOptions {
7
7
  event?: boolean
8
8
  }
9
9
 
10
+ export type SwipeNavigation = 'hover'
11
+
10
12
  export interface SwipeProps extends BasicAttributes {
11
13
  loop?: boolean
12
14
  autoplay?: string | number
@@ -16,6 +18,7 @@ export interface SwipeProps extends BasicAttributes {
16
18
  indicatorColor?: string
17
19
  vertical?: boolean
18
20
  touchable?: boolean
21
+ navigation?: boolean | SwipeNavigation
19
22
  onChange?: ListenerProp<(index: number) => void>
20
23
  }
21
24
 
@@ -28,6 +31,7 @@ export type SwipeTo = (index: number, options?: SwipeToOptions) => void
28
31
  export interface SwipeIndicatorData {
29
32
  index: number
30
33
  length: number
34
+ hovering: boolean
31
35
  prev: SwipePrev
32
36
  next: SwipeNext
33
37
  to: SwipeTo
@@ -38,6 +42,8 @@ export class Swipe extends VarComponent {
38
42
 
39
43
  $slots: {
40
44
  default(): VNode[]
45
+ prev(data: SwipeIndicatorData): VNode[]
46
+ next(data: SwipeIndicatorData): VNode[]
41
47
  indicator(data: SwipeIndicatorData): VNode[]
42
48
  }
43
49