@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/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/input.css +1 -1
- package/es/select/select.css +1 -1
- package/es/style.css +1 -1
- package/es/swipe/Swipe.mjs +93 -7
- package/es/swipe/props.mjs +4 -0
- package/es/swipe/style/index.mjs +5 -0
- package/es/swipe/swipe.css +1 -1
- package/es/varlet.esm.js +4564 -4468
- package/highlight/web-types.en-US.json +18 -1
- package/highlight/web-types.zh-CN.json +18 -1
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +110 -6
- package/package.json +7 -7
- package/types/swipe.d.ts +6 -0
- package/umd/varlet.js +5 -5
package/es/swipe/Swipe.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
2
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
+
import VarButton from '../button/index.mjs';
|
|
4
|
+
import VarIcon from '../icon/index.mjs';
|
|
5
|
+
import Hover from '../hover/index.mjs';
|
|
3
6
|
import { defineComponent, ref, computed, watch, onActivated } from 'vue';
|
|
4
7
|
import { useSwipeItems } from './provide.mjs';
|
|
5
8
|
import { props } from './props.mjs';
|
|
@@ -14,11 +17,14 @@ var {
|
|
|
14
17
|
n,
|
|
15
18
|
classes
|
|
16
19
|
} = createNamespace('swipe');
|
|
17
|
-
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode,
|
|
20
|
+
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, Transition as _Transition, mergeProps as _mergeProps, renderList as _renderList, Fragment as _Fragment, resolveDirective as _resolveDirective, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
18
21
|
var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
|
|
19
22
|
var _hoisted_1 = ["onClick"];
|
|
20
23
|
function __render__(_ctx, _cache) {
|
|
21
|
-
|
|
24
|
+
var _component_var_icon = _resolveComponent("var-icon");
|
|
25
|
+
var _component_var_button = _resolveComponent("var-button");
|
|
26
|
+
var _directive_hover = _resolveDirective("hover");
|
|
27
|
+
return _withDirectives((_openBlock(), _createElementBlock("div", {
|
|
22
28
|
class: _normalizeClass(_ctx.n()),
|
|
23
29
|
ref: "swipeEl"
|
|
24
30
|
}, [_createElementVNode("div", {
|
|
@@ -38,13 +44,72 @@ function __render__(_ctx, _cache) {
|
|
|
38
44
|
onTouchend: _cache[2] || (_cache[2] = function () {
|
|
39
45
|
return _ctx.handleTouchend && _ctx.handleTouchend(...arguments);
|
|
40
46
|
})
|
|
41
|
-
}, [_renderSlot(_ctx.$slots, "default")], 38 /* CLASS, STYLE, HYDRATE_EVENTS */), _renderSlot(_ctx.$slots, "
|
|
47
|
+
}, [_renderSlot(_ctx.$slots, "default")], 38 /* CLASS, STYLE, HYDRATE_EVENTS */), _ctx.navigation ? _renderSlot(_ctx.$slots, "prev", _normalizeProps(_mergeProps({
|
|
48
|
+
key: 0
|
|
49
|
+
}, {
|
|
42
50
|
index: _ctx.index,
|
|
43
51
|
length: _ctx.length,
|
|
44
52
|
prev: _ctx.prev,
|
|
45
53
|
next: _ctx.next,
|
|
54
|
+
to: _ctx.to,
|
|
55
|
+
hovering: _ctx.hovering
|
|
56
|
+
})), () => [_createVNode(_Transition, {
|
|
57
|
+
name: _ctx.getNavigationAnimation('prev')
|
|
58
|
+
}, {
|
|
59
|
+
default: _withCtx(() => [_ctx.navigation === true || _ctx.hovering ? (_openBlock(), _createElementBlock("div", {
|
|
60
|
+
key: 0,
|
|
61
|
+
class: _normalizeClass(_ctx.classes(_ctx.n('navigation'), _ctx.n('navigation-prev'), [_ctx.vertical, _ctx.n('--navigation-vertical-prev')]))
|
|
62
|
+
}, [_createVNode(_component_var_button, {
|
|
63
|
+
"var-swipe-cover": "",
|
|
64
|
+
disabled: !_ctx.loop && _ctx.index === 0,
|
|
65
|
+
class: _normalizeClass(_ctx.n('navigation-prev-button')),
|
|
66
|
+
onClick: _cache[3] || (_cache[3] = $event => _ctx.prev())
|
|
67
|
+
}, {
|
|
68
|
+
default: _withCtx(() => [_createVNode(_component_var_icon, {
|
|
69
|
+
"var-swipe-cover": "",
|
|
70
|
+
class: _normalizeClass(_ctx.n('navigation-prev-button-icon')),
|
|
71
|
+
name: _ctx.vertical ? 'chevron-up' : 'chevron-left'
|
|
72
|
+
}, null, 8 /* PROPS */, ["class", "name"])]),
|
|
73
|
+
_: 1 /* STABLE */
|
|
74
|
+
}, 8 /* PROPS */, ["disabled", "class"])], 2 /* CLASS */)) : _createCommentVNode("v-if", true)]),
|
|
75
|
+
_: 1 /* STABLE */
|
|
76
|
+
}, 8 /* PROPS */, ["name"])]) : _createCommentVNode("v-if", true), _ctx.navigation ? _renderSlot(_ctx.$slots, "next", _normalizeProps(_mergeProps({
|
|
77
|
+
key: 1
|
|
78
|
+
}, {
|
|
79
|
+
index: _ctx.index,
|
|
80
|
+
length: _ctx.length,
|
|
81
|
+
hovering: _ctx.hovering,
|
|
82
|
+
prev: _ctx.prev,
|
|
83
|
+
next: _ctx.next,
|
|
84
|
+
to: _ctx.to
|
|
85
|
+
})), () => [_createVNode(_Transition, {
|
|
86
|
+
name: _ctx.getNavigationAnimation('next')
|
|
87
|
+
}, {
|
|
88
|
+
default: _withCtx(() => [_ctx.navigation === true || _ctx.hovering ? (_openBlock(), _createElementBlock("div", {
|
|
89
|
+
key: 0,
|
|
90
|
+
class: _normalizeClass(_ctx.classes(_ctx.n('navigation'), _ctx.n('navigation-next'), [_ctx.vertical, _ctx.n('--navigation-vertical-next')]))
|
|
91
|
+
}, [_createVNode(_component_var_button, {
|
|
92
|
+
"var-swipe-cover": "",
|
|
93
|
+
class: _normalizeClass(_ctx.n('navigation-next-button')),
|
|
94
|
+
disabled: !_ctx.loop && _ctx.index === _ctx.length - 1,
|
|
95
|
+
onClick: _cache[4] || (_cache[4] = $event => _ctx.next())
|
|
96
|
+
}, {
|
|
97
|
+
default: _withCtx(() => [_createVNode(_component_var_icon, {
|
|
98
|
+
"var-swipe-cover": "",
|
|
99
|
+
class: _normalizeClass(_ctx.n('navigation-next-button-icon')),
|
|
100
|
+
name: _ctx.vertical ? 'chevron-down' : 'chevron-right'
|
|
101
|
+
}, null, 8 /* PROPS */, ["class", "name"])]),
|
|
102
|
+
_: 1 /* STABLE */
|
|
103
|
+
}, 8 /* PROPS */, ["class", "disabled"])], 2 /* CLASS */)) : _createCommentVNode("v-if", true)]),
|
|
104
|
+
_: 1 /* STABLE */
|
|
105
|
+
}, 8 /* PROPS */, ["name"])]) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "indicator", _normalizeProps(_guardReactiveProps({
|
|
106
|
+
index: _ctx.index,
|
|
107
|
+
length: _ctx.length,
|
|
108
|
+
hovering: _ctx.hovering,
|
|
109
|
+
prev: _ctx.prev,
|
|
110
|
+
next: _ctx.next,
|
|
46
111
|
to: _ctx.to
|
|
47
|
-
}, () => [_ctx.indicator && _ctx.length ? (_openBlock(), _createElementBlock("div", {
|
|
112
|
+
})), () => [_ctx.indicator && _ctx.length ? (_openBlock(), _createElementBlock("div", {
|
|
48
113
|
key: 0,
|
|
49
114
|
class: _normalizeClass(_ctx.classes(_ctx.n('indicators'), [_ctx.vertical, _ctx.n('--indicators-vertical')]))
|
|
50
115
|
}, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.length, (l, idx) => {
|
|
@@ -56,11 +121,17 @@ function __render__(_ctx, _cache) {
|
|
|
56
121
|
key: l,
|
|
57
122
|
onClick: $event => _ctx.to(idx)
|
|
58
123
|
}, null, 14 /* CLASS, STYLE, PROPS */, _hoisted_1);
|
|
59
|
-
}), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */)) : _createCommentVNode("v-if", true)])], 2 /* CLASS */);
|
|
124
|
+
}), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */)) : _createCommentVNode("v-if", true)])], 2 /* CLASS */)), [[_directive_hover, _ctx.handleHovering]]);
|
|
60
125
|
}
|
|
61
|
-
|
|
62
126
|
var __sfc__ = defineComponent({
|
|
63
127
|
name,
|
|
128
|
+
directives: {
|
|
129
|
+
Hover
|
|
130
|
+
},
|
|
131
|
+
components: {
|
|
132
|
+
VarButton,
|
|
133
|
+
VarIcon
|
|
134
|
+
},
|
|
64
135
|
props,
|
|
65
136
|
setup(props) {
|
|
66
137
|
var swipeEl = ref(null);
|
|
@@ -70,6 +141,7 @@ var __sfc__ = defineComponent({
|
|
|
70
141
|
var trackTranslate = ref(0);
|
|
71
142
|
var lockDuration = ref(false);
|
|
72
143
|
var index = ref(0);
|
|
144
|
+
var hovering = ref(false);
|
|
73
145
|
var {
|
|
74
146
|
swipeItems,
|
|
75
147
|
bindSwipeItems,
|
|
@@ -389,6 +461,17 @@ var __sfc__ = defineComponent({
|
|
|
389
461
|
});
|
|
390
462
|
});
|
|
391
463
|
}
|
|
464
|
+
var handleHovering = value => {
|
|
465
|
+
if (props.navigation === 'hover') {
|
|
466
|
+
hovering.value = value;
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
function getNavigationAnimation(type) {
|
|
470
|
+
if (props.navigation !== 'hover') {
|
|
471
|
+
return '';
|
|
472
|
+
}
|
|
473
|
+
return props.vertical ? n("--navigation-vertical-" + type + "-animation") : n("--navigation-" + type + "-animation");
|
|
474
|
+
}
|
|
392
475
|
return {
|
|
393
476
|
length,
|
|
394
477
|
index,
|
|
@@ -396,6 +479,7 @@ var __sfc__ = defineComponent({
|
|
|
396
479
|
trackSize,
|
|
397
480
|
trackTranslate,
|
|
398
481
|
lockDuration,
|
|
482
|
+
hovering,
|
|
399
483
|
n,
|
|
400
484
|
classes,
|
|
401
485
|
handleTouchstart,
|
|
@@ -405,7 +489,9 @@ var __sfc__ = defineComponent({
|
|
|
405
489
|
prev,
|
|
406
490
|
to,
|
|
407
491
|
resize,
|
|
408
|
-
toNumber
|
|
492
|
+
toNumber,
|
|
493
|
+
handleHovering,
|
|
494
|
+
getNavigationAnimation
|
|
409
495
|
};
|
|
410
496
|
}
|
|
411
497
|
});
|
package/es/swipe/props.mjs
CHANGED
package/es/swipe/style/index.mjs
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import '../../styles/common.css'
|
|
2
|
+
import '../../styles/elevation.css'
|
|
3
|
+
import '../../hover-overlay/hoverOverlay.css'
|
|
4
|
+
import '../../ripple/ripple.css'
|
|
5
|
+
import '../../loading/loading.css'
|
|
6
|
+
import '../../icon/icon.css'
|
|
2
7
|
import '../swipe.css'
|
|
3
8
|
import '../SwipeSfc.css'
|
package/es/swipe/swipe.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --swipe-indicator-color: #fff; --swipe-indicators-offset: 10px; --swipe-indicator-offset: 4px;}.var-swipe { position: relative; overflow: hidden; user-select: none; width: 100%;}.var-swipe__track { width: 100%; height: 100%; display: flex; transition-property: transform;}.var-swipe__indicators { position: absolute; display: flex; bottom: var(--swipe-indicators-offset); left: 50%; transform: translateX(-50%);}.var-swipe__indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--swipe-indicator-color); opacity: 0.3; margin: 0 var(--swipe-indicator-offset); transition: opacity 0.3s;}.var-swipe--vertical { flex-direction: column;}.var-swipe--indicators-vertical { flex-direction: column; left: var(--swipe-indicators-offset); bottom: 50%; transform: translateY(50%);}.var-swipe--indicator-active { opacity: 1;}.var-swipe--indicator-vertical { margin: var(--swipe-indicator-offset) 0;}
|
|
1
|
+
:root { --swipe-indicator-color: #fff; --swipe-indicators-offset: 10px; --swipe-indicator-offset: 4px; --swipe-navigation-button-width: 36px; --swipe-navigation-button-height: 36px; --swipe-navigation-button-border-radius: 50%; --swipe-navigation-icon-size: 20px; --swipe-navigation-prev-left: 8px; --swipe-navigation-next-right: 8px; --swipe-navigation-prev-top: 8px; --swipe-navigation-next-bottom: 8px;}.var-swipe { position: relative; overflow: hidden; user-select: none; width: 100%;}.var-swipe__track { width: 100%; height: 100%; display: flex; transition-property: transform;}.var-swipe__navigation { position: absolute; top: 50%; z-index: 99;}.var-swipe__navigation-prev { left: 0; transform: translate(var(--swipe-navigation-prev-left), -50%);}.var-swipe__navigation-prev-button[var-swipe-cover] { width: var(--swipe-navigation-button-width); height: var(--swipe-navigation-button-height); border-radius: var(--swipe-navigation-button-border-radius);}.var-swipe__navigation-prev-button-icon[var-swipe-cover] { font-size: var(--swipe-navigation-icon-size);}.var-swipe__navigation-next { right: 0; transform: translate(calc(-1 * var(--swipe-navigation-next-right)), -50%);}.var-swipe__navigation-next-button[var-swipe-cover] { width: var(--swipe-navigation-button-width); height: var(--swipe-navigation-button-height); border-radius: var(--swipe-navigation-button-border-radius);}.var-swipe__navigation-next-button-icon[var-swipe-cover] { font-size: var(--swipe-navigation-icon-size);}.var-swipe__indicators { position: absolute; display: flex; bottom: var(--swipe-indicators-offset); left: 50%; transform: translateX(-50%);}.var-swipe__indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--swipe-indicator-color); opacity: 0.3; margin: 0 var(--swipe-indicator-offset); transition: opacity 0.3s;}.var-swipe--vertical { flex-direction: column;}.var-swipe--indicators-vertical { flex-direction: column; left: var(--swipe-indicators-offset); bottom: 50%; transform: translateY(50%);}.var-swipe--indicator-active { opacity: 1;}.var-swipe--indicator-vertical { margin: var(--swipe-indicator-offset) 0;}.var-swipe--navigation-vertical-prev { top: 0; left: 50%; right: unset; transform: translate(-50%, var(--swipe-navigation-prev-top));}.var-swipe--navigation-vertical-next { bottom: 0; left: 50%; right: unset; top: unset; transform: translate(-50%, calc(-1 * var(--swipe-navigation-next-bottom)));}.var-swipe--navigation-prev-animation-enter-active,.var-swipe--navigation-prev-animation-leave-active { transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.5, 1);}.var-swipe--navigation-prev-animation-enter-from,.var-swipe--navigation-prev-animation-leave-to { transform: translate(-100%, -50%);}.var-swipe--navigation-next-animation-enter-active,.var-swipe--navigation-next-animation-leave-active { transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.5, 1);}.var-swipe--navigation-next-animation-enter-from,.var-swipe--navigation-next-animation-leave-to { transform: translate(100%, -50%);}.var-swipe--navigation-vertical-prev-animation-enter-active,.var-swipe--navigation-vertical-prev-animation-leave-active { transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.5, 1);}.var-swipe--navigation-vertical-prev-animation-enter-from,.var-swipe--navigation-vertical-prev-animation-leave-to { transform: translate(-50%, -100%);}.var-swipe--navigation-vertical-next-animation-enter-active,.var-swipe--navigation-vertical-next-animation-leave-active { transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.5, 1);}.var-swipe--navigation-vertical-next-animation-enter-from,.var-swipe--navigation-vertical-next-animation-leave-to { transform: translate(-50%, 100%);}
|