@varlet/ui 2.18.0-alpha.1697555377370 → 2.18.0-alpha.1697608760113

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.
@@ -22,7 +22,8 @@ function __render__(_ctx, _cache) {
22
22
  _ctx.n("$--box"),
23
23
  [_ctx.isInternalSize(_ctx.size), _ctx.n(`--${_ctx.size}`)],
24
24
  [_ctx.round, _ctx.n("--round")],
25
- [_ctx.bordered, _ctx.n("--bordered")]
25
+ [_ctx.bordered, _ctx.n("--bordered")],
26
+ [_ctx.hoverable, _ctx.n("--hoverable")]
26
27
  )
27
28
  ),
28
29
  style: _normalizeStyle({
@@ -1 +1 @@
1
- :root { --avatar-text-color: #f5f5f5; --avatar-border-radius: 4px; --avatar-mini-size: 28px; --avatar-small-size: 36px; --avatar-normal-size: 48px; --avatar-large-size: 64px; --avatar-border: 2px solid #fff; --avatar-background-color: #bebebe;}.var-avatar { display: inline-flex; overflow: hidden; align-items: center; justify-content: center; color: var(--avatar-text-color); border-radius: var(--avatar-border-radius); background-color: var(--avatar-background-color); transition: background-color 0.25s;}.var-avatar img { width: 100%; height: 100%;}.var-avatar--mini { width: var(--avatar-mini-size); height: var(--avatar-mini-size);}.var-avatar--small { width: var(--avatar-small-size); height: var(--avatar-small-size);}.var-avatar--normal { width: var(--avatar-normal-size); height: var(--avatar-normal-size);}.var-avatar--large { width: var(--avatar-large-size); height: var(--avatar-large-size);}.var-avatar--round { border-radius: 50%;}.var-avatar--bordered { border: var(--avatar-border);}.var-avatar__text { padding: 0 4px; white-space: nowrap;}
1
+ :root { --avatar-text-color: #f5f5f5; --avatar-border-radius: 4px; --avatar-mini-size: 28px; --avatar-small-size: 36px; --avatar-normal-size: 48px; --avatar-large-size: 64px; --avatar-border: 2px solid #fff; --avatar-background-color: #bebebe; --avatar-hover-transform: scale(1.1);}.var-avatar { display: inline-flex; overflow: hidden; align-items: center; justify-content: center; color: var(--avatar-text-color); border-radius: var(--avatar-border-radius); background-color: var(--avatar-background-color); transition: background-color 0.25s;}.var-avatar img { width: 100%; height: 100%;}.var-avatar--mini { width: var(--avatar-mini-size); height: var(--avatar-mini-size);}.var-avatar--small { width: var(--avatar-small-size); height: var(--avatar-small-size);}.var-avatar--normal { width: var(--avatar-normal-size); height: var(--avatar-normal-size);}.var-avatar--large { width: var(--avatar-large-size); height: var(--avatar-large-size);}.var-avatar--round { border-radius: 50%;}.var-avatar--bordered { border: var(--avatar-border);}.var-avatar__text { padding: 0 4px; white-space: nowrap;}.var-avatar--hoverable { transition: transform 0.2s;}.var-avatar--hoverable:hover { transform: var(--avatar-hover-transform); cursor: pointer;}
@@ -20,6 +20,7 @@ const props = {
20
20
  loading: String,
21
21
  error: String,
22
22
  lazy: Boolean,
23
+ hoverable: Boolean,
23
24
  onClick: defineListenerProp(),
24
25
  onLoad: defineListenerProp(),
25
26
  onError: defineListenerProp()
@@ -2,17 +2,9 @@ import VarButton from "../button/index.mjs";
2
2
  import VarIcon from "../icon/index.mjs";
3
3
  import { defineComponent, ref, onMounted, onActivated } from "vue";
4
4
  import { props } from "./props.mjs";
5
- import { throttle } from "@varlet/shared";
5
+ import { throttle, getScrollTop, getScrollLeft } from "@varlet/shared";
6
6
  import { easeInOutCubic } from "../utils/shared.mjs";
7
- import {
8
- getScrollTop,
9
- getScrollLeft,
10
- scrollTo,
11
- getParentScroller,
12
- toPxNum,
13
- toSizeUnit,
14
- getTarget
15
- } from "../utils/elements.mjs";
7
+ import { scrollTo, getParentScroller, toPxNum, toSizeUnit, getTarget } from "../utils/elements.mjs";
16
8
  import { call, createNamespace } from "../utils/components.mjs";
17
9
  import { onSmartUnmounted } from "@varlet/use";
18
10
  const { name, n, classes } = createNamespace("back-top");
@@ -17,7 +17,7 @@ function __render__(_ctx, _cache) {
17
17
  _createElementVNode(
18
18
  "div",
19
19
  {
20
- class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.safeArea, _ctx.n("--safe-area")], _ctx.formatElevation(_ctx.elevation, 2))),
20
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.safeArea, _ctx.n("--safe-area")], _ctx.formatElevation(_ctx.elevation, 3))),
21
21
  style: _normalizeStyle({
22
22
  height: `${_ctx.toSizeUnit(_ctx.maxAnchor)}`,
23
23
  transform: `translateY(calc(100% - ${_ctx.toSizeUnit(_ctx.visibleHeight)}))`,
@@ -1 +1 @@
1
- :root { --floating-panel-z-index: 999; --floating-panel-border-top: none; --floating-panel-border-radius: 0; --floating-panel-background: #fff; --floating-panel-header-height: 40px; --floating-panel-toolbar-width: 20px; --floating-panel-toolbar-height: 3px; --floating-panel-toolbar-border-radius: 10px; --floating-panel-toolbar-background: #ddd; --floating-panel-transition-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);}.var-floating-panel { position: fixed; left: 0; bottom: 0; width: 100%; display: flex; flex-direction: column; z-index: var(--floating-panel-z-index); border-top: var(--floating-panel-border-top); border-top-left-radius: var(--floating-panel-border-radius); border-top-right-radius: var(--floating-panel-border-radius); border-bottom-right-radius: 0; border-bottom-left-radius: 0; background-color: var(--floating-panel-background); will-change: transform; touch-action: none;}.var-floating-panel::after { content: ''; display: block; position: absolute; bottom: -100vh; height: 100vh; width: 100vw; background-color: inherit;}.var-floating-panel__header { height: var(--floating-panel-header-height); display: flex; justify-content: center; align-items: center; cursor: grab; user-select: none;}.var-floating-panel__header-toolbar { width: var(--floating-panel-toolbar-width); height: var(--floating-panel-toolbar-height); border-radius: var(--floating-panel-toolbar-border-radius); background: var(--floating-panel-toolbar-background);}.var-floating-panel__content { flex: 1; overflow-y: auto;}.var-floating-panel--safe-area { padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);}
1
+ :root { --floating-panel-z-index: 999; --floating-panel-border-top: none; --floating-panel-border-radius: 0; --floating-panel-background: #fff; --floating-panel-header-height: 40px; --floating-panel-toolbar-width: 20px; --floating-panel-toolbar-height: 3px; --floating-panel-toolbar-border-radius: 10px; --floating-panel-toolbar-background: #ddd; --floating-panel-transition-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);}.var-floating-panel { position: fixed; left: 0; bottom: 0; width: 100%; display: flex; flex-direction: column; z-index: var(--floating-panel-z-index); border-top: var(--floating-panel-border-top); border-top-left-radius: var(--floating-panel-border-radius); border-top-right-radius: var(--floating-panel-border-radius); border-bottom-right-radius: 0; border-bottom-left-radius: 0; background-color: var(--floating-panel-background); will-change: transform; touch-action: none;}.var-floating-panel::after { content: ''; display: block; position: absolute; bottom: -100vh; height: 100vh; width: 100%; background-color: inherit; box-shadow: 0 -1px var(--floating-panel-background);}.var-floating-panel__header { height: var(--floating-panel-header-height); display: flex; justify-content: center; align-items: center; cursor: grab; user-select: none;}.var-floating-panel__header-toolbar { width: var(--floating-panel-toolbar-width); height: var(--floating-panel-toolbar-height); border-radius: var(--floating-panel-toolbar-border-radius); background: var(--floating-panel-toolbar-background);}.var-floating-panel__content { flex: 1; overflow-y: auto;}.var-floating-panel--safe-area { padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);}
@@ -19,9 +19,18 @@ var __async = (__this, __arguments, generator) => {
19
19
  });
20
20
  };
21
21
  import { computed, defineComponent, ref, watch, onBeforeUnmount, onDeactivated, onActivated } from "vue";
22
- import { isPlainObject, isWindow, toNumber, doubleRaf, requestAnimationFrame, getRect } from "@varlet/shared";
22
+ import {
23
+ isPlainObject,
24
+ isWindow,
25
+ toNumber,
26
+ doubleRaf,
27
+ requestAnimationFrame,
28
+ getRect,
29
+ getScrollLeft,
30
+ getScrollTop
31
+ } from "@varlet/shared";
23
32
  import { easeInOutCubic } from "../utils/shared.mjs";
24
- import { getParentScroller, getScrollLeft, getScrollTop, scrollTo as varScrollTo, toPxNum } from "../utils/elements.mjs";
33
+ import { getParentScroller, scrollTo as varScrollTo, toPxNum } from "../utils/elements.mjs";
25
34
  import { useIndexAnchors } from "./provide.mjs";
26
35
  import { props } from "./props.mjs";
27
36
  import { createNamespace, call } from "../utils/components.mjs";
@@ -259,7 +259,7 @@ import './tooltip/style/index.mjs'
259
259
  import './uploader/style/index.mjs'
260
260
  import './watermark/style/index.mjs'
261
261
 
262
- const version = '2.18.0-alpha.1697555377370'
262
+ const version = '2.18.0-alpha.1697608760113'
263
263
 
264
264
  function install(app) {
265
265
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -172,7 +172,7 @@ export * from './tooltip/index.mjs'
172
172
  export * from './uploader/index.mjs'
173
173
  export * from './watermark/index.mjs'
174
174
 
175
- const version = '2.18.0-alpha.1697555377370'
175
+ const version = '2.18.0-alpha.1697608760113'
176
176
 
177
177
  function install(app) {
178
178
  ActionSheet.install && app.use(ActionSheet)
@@ -20,11 +20,11 @@ var __async = (__this, __arguments, generator) => {
20
20
  };
21
21
  import VarIcon from "../icon/index.mjs";
22
22
  import { defineComponent, ref, computed, watch, nextTick } from "vue";
23
- import { getParentScroller, getScrollTop, getTarget } from "../utils/elements.mjs";
23
+ import { getParentScroller, getTarget } from "../utils/elements.mjs";
24
24
  import { props } from "./props.mjs";
25
- import { isNumber, isString, toNumber, getRect, preventDefault } from "@varlet/shared";
25
+ import { isNumber, isString, toNumber, getRect, preventDefault, getScrollTop } from "@varlet/shared";
26
26
  import { call, createNamespace } from "../utils/components.mjs";
27
- import { useEventListener, onSmartMounted } from "@varlet/use";
27
+ import { useEventListener, onSmartMounted, useTouch } from "@varlet/use";
28
28
  const { name, n, classes } = createNamespace("pull-refresh");
29
29
  const ICON_TRANSITION = 150;
30
30
  import { resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, createVNode as _createVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
@@ -35,9 +35,9 @@ function __render__(_ctx, _cache) {
35
35
  {
36
36
  ref: "freshNode",
37
37
  class: _normalizeClass(_ctx.n()),
38
- onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.touchStart && _ctx.touchStart(...args)),
39
- onTouchend: _cache[1] || (_cache[1] = (...args) => _ctx.touchEnd && _ctx.touchEnd(...args)),
40
- onTouchcancel: _cache[2] || (_cache[2] = (...args) => _ctx.touchEnd && _ctx.touchEnd(...args))
38
+ onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.handleTouchstart && _ctx.handleTouchstart(...args)),
39
+ onTouchend: _cache[1] || (_cache[1] = (...args) => _ctx.handleTouchend && _ctx.handleTouchend(...args)),
40
+ onTouchcancel: _cache[2] || (_cache[2] = (...args) => _ctx.handleTouchend && _ctx.handleTouchend(...args))
41
41
  },
42
42
  [
43
43
  _createElementVNode(
@@ -88,10 +88,9 @@ const __sfc__ = defineComponent({
88
88
  background: isSuccess.value ? props2.successBgColor : props2.bgColor,
89
89
  color: isSuccess.value ? props2.successColor : props2.color
90
90
  }));
91
+ const { startTouch, moveTouch, endTouch, isReachTop } = useTouch();
91
92
  let scroller;
92
93
  let eventTargetScroller;
93
- let startY = 0;
94
- let deltaY = 0;
95
94
  watch(
96
95
  () => props2.modelValue,
97
96
  (newValue) => {
@@ -107,7 +106,7 @@ const __sfc__ = defineComponent({
107
106
  }
108
107
  );
109
108
  onSmartMounted(setScroller);
110
- useEventListener(freshNode, "touchmove", touchMove);
109
+ useEventListener(freshNode, "touchmove", handleTouchmove);
111
110
  function startIconTransition(name2) {
112
111
  return __async(this, null, function* () {
113
112
  if (iconName.value === name2) {
@@ -123,16 +122,16 @@ const __sfc__ = defineComponent({
123
122
  const el = "classList" in scroller ? scroller : document.body;
124
123
  el.classList[action](`${n()}--lock`);
125
124
  }
126
- function touchStart(event) {
125
+ function handleTouchstart(event) {
126
+ startTouch(event);
127
127
  if (controlPosition.value === 0) {
128
128
  const { width } = getRect(controlNode.value);
129
129
  controlPosition.value = -(width + width * 0.25);
130
130
  }
131
- startY = event.touches[0].clientY;
132
- deltaY = 0;
133
131
  eventTargetScroller = getParentScroller(event.target);
134
132
  }
135
- function touchMove(event) {
133
+ function handleTouchmove(event) {
134
+ moveTouch(event);
136
135
  if (!isTouchable.value || !eventTargetScroller) {
137
136
  return;
138
137
  }
@@ -143,25 +142,23 @@ const __sfc__ = defineComponent({
143
142
  if (scrollTop > 0) {
144
143
  return;
145
144
  }
146
- const isReachTop = scrollTop === 0;
147
- const touch = event.touches[0];
148
- deltaY = touch.clientY - startY;
149
- if (isReachTop && deltaY >= 0) {
145
+ if (isReachTop(scroller)) {
150
146
  preventDefault(event);
151
147
  }
152
148
  if (refreshStatus.value !== "pulling") {
153
149
  refreshStatus.value = "pulling";
154
150
  startPosition.value = event.touches[0].clientY;
155
151
  }
156
- if (isReachTop && isNumber(distance.value) && distance.value > controlPosition.value) {
152
+ if (isReachTop(scroller) && isNumber(distance.value) && distance.value > controlPosition.value) {
157
153
  lockEvent("add");
158
154
  }
159
155
  const moveDistance = (event.touches[0].clientY - startPosition.value) / 2 + controlPosition.value;
160
156
  distance.value = moveDistance >= maxDistance.value ? maxDistance.value : moveDistance;
161
157
  startIconTransition(distance.value >= maxDistance.value * 0.2 ? "refresh" : "arrow-down");
162
158
  }
163
- function touchEnd() {
159
+ function handleTouchend() {
164
160
  return __async(this, null, function* () {
161
+ endTouch();
165
162
  if (!isTouchable.value) {
166
163
  return;
167
164
  }
@@ -207,9 +204,9 @@ const __sfc__ = defineComponent({
207
204
  isSuccess,
208
205
  n,
209
206
  classes,
210
- touchStart,
211
- touchMove,
212
- touchEnd
207
+ handleTouchstart,
208
+ handleTouchmove,
209
+ handleTouchend
213
210
  };
214
211
  }
215
212
  });
@@ -1,8 +1,8 @@
1
1
  import '../../styles/common.css'
2
+ import '../SnackbarSfc.css'
2
3
  import '../../styles/elevation.css'
3
4
  import '../../loading/loading.css'
4
5
  import '../../button/button.css'
5
6
  import '../../icon/icon.css'
6
7
  import '../snackbar.css'
7
8
  import '../coreSfc.css'
8
- import '../SnackbarSfc.css'