@varlet/ui 2.15.1 → 2.15.2-alpha.1693502641730

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/card/Card.mjs CHANGED
@@ -5,7 +5,8 @@ import VarIcon from '../icon/index.mjs';
5
5
  import VarButton from '../button/index.mjs';
6
6
  import { ref, defineComponent, watch, computed, nextTick } from 'vue';
7
7
  import { props } from './props.mjs';
8
- import { doubleRaf, toSizeUnit, getRect } from '../utils/elements.mjs';
8
+ import { toSizeUnit } from '../utils/elements.mjs';
9
+ import { doubleRaf, getRect } from '@varlet/shared';
9
10
  import { call, createNamespace, formatElevation } from '../utils/components.mjs';
10
11
  import { useZIndex } from '../context/zIndex.mjs';
11
12
  import { useLock } from '../context/lock.mjs';
@@ -1,10 +1,11 @@
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
+ 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 VarIcon from '../icon/index.mjs';
1
4
  import { defineComponent, ref, watch, computed } from 'vue';
2
- import { nextTickFrame, requestAnimationFrame } from '../utils/elements.mjs';
3
- import { isArray } from '@varlet/shared';
5
+ import { isArray, doubleRaf, raf } from '@varlet/shared';
4
6
  import { createNamespace, formatElevation } from '../utils/components.mjs';
5
7
  import { useCollapse } from './provide.mjs';
6
8
  import { props } from './props.mjs';
7
- import VarIcon from '../icon/index.mjs';
8
9
  var {
9
10
  n,
10
11
  classes
@@ -77,13 +78,14 @@ var __sfc__ = defineComponent({
77
78
  updateItem(props.name || index.value, !isShow.value);
78
79
  }
79
80
  };
80
- var openPanel = () => {
81
- if (!contentEl.value) {
82
- return;
83
- }
84
- contentEl.value.style.height = '';
85
- showContent.value = true;
86
- requestAnimationFrame(() => {
81
+ var openPanel = /*#__PURE__*/function () {
82
+ var _ref = _asyncToGenerator(function* () {
83
+ if (!contentEl.value) {
84
+ return;
85
+ }
86
+ contentEl.value.style.height = '';
87
+ showContent.value = true;
88
+ yield raf();
87
89
  if (!contentEl.value) {
88
90
  return;
89
91
  }
@@ -91,36 +93,42 @@ var __sfc__ = defineComponent({
91
93
  offsetHeight
92
94
  } = contentEl.value;
93
95
  contentEl.value.style.height = 0 + 'px';
94
- requestAnimationFrame(() => {
95
- if (!contentEl.value) {
96
- return;
97
- }
98
- contentEl.value.style.height = offsetHeight + 'px';
99
- if (!isInitToTrigger) {
100
- return;
101
- }
102
- nextTickFrame(() => {
103
- if (isInitToTrigger) {
104
- transitionend();
105
- }
106
- });
107
- });
96
+ yield raf();
97
+ if (!contentEl.value) {
98
+ return;
99
+ }
100
+ contentEl.value.style.height = offsetHeight + 'px';
101
+ if (!isInitToTrigger) {
102
+ return;
103
+ }
104
+ yield doubleRaf();
105
+ if (isInitToTrigger) {
106
+ transitionend();
107
+ }
108
108
  });
109
- };
109
+ return function openPanel() {
110
+ return _ref.apply(this, arguments);
111
+ };
112
+ }();
110
113
  var start = () => {
111
114
  isInitToTrigger = false;
112
115
  };
113
- var closePanel = () => {
114
- if (!contentEl.value) return;
115
- var {
116
- offsetHeight
117
- } = contentEl.value;
118
- contentEl.value.style.height = offsetHeight + 'px';
119
- requestAnimationFrame(() => {
120
- ;
116
+ var closePanel = /*#__PURE__*/function () {
117
+ var _ref2 = _asyncToGenerator(function* () {
118
+ if (!contentEl.value) {
119
+ return;
120
+ }
121
+ var {
122
+ offsetHeight
123
+ } = contentEl.value;
124
+ contentEl.value.style.height = offsetHeight + 'px';
125
+ yield raf();
121
126
  contentEl.value.style.height = 0 + 'px';
122
127
  });
123
- };
128
+ return function closePanel() {
129
+ return _ref2.apply(this, arguments);
130
+ };
131
+ }();
124
132
  var transitionend = () => {
125
133
  if (!isShow.value) {
126
134
  showContent.value = false;
@@ -134,7 +142,7 @@ var __sfc__ = defineComponent({
134
142
  };
135
143
  bindCollapse(collapseItemProvider);
136
144
  watch(isShow, value => {
137
- if (value) openPanel();else closePanel();
145
+ value ? openPanel() : closePanel();
138
146
  });
139
147
  return {
140
148
  n,
@@ -1,9 +1,8 @@
1
1
  import { defineComponent, onActivated, onDeactivated, onUnmounted, ref, watch } from 'vue';
2
2
  import { props } from './props.mjs';
3
- import { requestAnimationFrame, cancelAnimationFrame } from '../utils/elements.mjs';
4
3
  import { call, createNamespace } from '../utils/components.mjs';
5
4
  import { padStart } from '../utils/shared.mjs';
6
- import { toNumber } from '@varlet/shared';
5
+ import { toNumber, requestAnimationFrame, cancelAnimationFrame } from '@varlet/shared';
7
6
  var {
8
7
  n
9
8
  } = createNamespace('countdown');
@@ -1,11 +1,12 @@
1
- import { defineComponent, ref, computed, reactive, watch } from 'vue';
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
+ 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); }); }; }
2
3
  import dayjs from 'dayjs/esm';
3
4
  import MonthPickerPanel from './src/month-picker-panel.mjs';
4
5
  import YearPickerPanel from './src/year-picker-panel.mjs';
5
6
  import DayPickerPanel from './src/day-picker-panel.mjs';
7
+ import { defineComponent, ref, computed, reactive, watch } from 'vue';
6
8
  import { props, MONTH_LIST, WEEK_HEADER } from './props.mjs';
7
- import { isArray, toNumber } from '@varlet/shared';
8
- import { nextTickFrame } from '../utils/elements.mjs';
9
+ import { isArray, toNumber, doubleRaf } from '@varlet/shared';
9
10
  import { createNamespace, call, formatElevation } from '../utils/components.mjs';
10
11
  import { padStart } from '../utils/shared.mjs';
11
12
  import { pack } from '../locale/index.mjs';
@@ -250,14 +251,18 @@ var __sfc__ = defineComponent({
250
251
  touchDirection = getDirection(Math.abs(x), Math.abs(y));
251
252
  checkType = x > 0 ? 'prev' : 'next';
252
253
  };
253
- var handleTouchend = () => {
254
- if (isUntouchable.value || touchDirection !== 'x') return;
255
- var componentRef = getPanelType.value === 'month' ? monthPanelEl : dayPanelEl;
256
- nextTickFrame(() => {
254
+ var handleTouchend = /*#__PURE__*/function () {
255
+ var _ref = _asyncToGenerator(function* () {
256
+ if (isUntouchable.value || touchDirection !== 'x') return;
257
+ var componentRef = getPanelType.value === 'month' ? monthPanelEl : dayPanelEl;
258
+ yield doubleRaf();
257
259
  componentRef.value.forwardRef(checkType);
258
260
  resetState();
259
261
  });
260
- };
262
+ return function handleTouchend() {
263
+ return _ref.apply(this, arguments);
264
+ };
265
+ }();
261
266
  var updateRange = (date, type) => {
262
267
  var rangeDate = type === 'month' ? chooseRangeMonth : chooseRangeDay;
263
268
  rangeDate.value = rangeDone.value ? [date, date] : [rangeDate.value[0], date];
package/es/drag/Drag.mjs CHANGED
@@ -4,9 +4,9 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
4
4
  import { defineComponent, ref, reactive, watch } from 'vue';
5
5
  import { props } from './props.mjs';
6
6
  import { createNamespace, useTeleport, call } from '../utils/components.mjs';
7
- import { getRect, toPxNum } from '../utils/elements.mjs';
7
+ import { toPxNum } from '../utils/elements.mjs';
8
8
  import { onSmartMounted, onWindowResize, useTouch } from '@varlet/use';
9
- import { clamp } from '@varlet/shared';
9
+ import { clamp, getRect } from '@varlet/shared';
10
10
  var {
11
11
  n,
12
12
  classes
@@ -1,10 +1,9 @@
1
1
  import VarIcon from '../icon/index.mjs';
2
- import { defineComponent, ref, computed, onUpdated } from 'vue';
2
+ import { defineComponent, ref, onUpdated, computed } from 'vue';
3
3
  import { props } from './props.mjs';
4
- import { isEmpty } from '@varlet/shared';
4
+ import { isEmpty, getStyle } from '@varlet/shared';
5
5
  import { createNamespace, call } from '../utils/components.mjs';
6
6
  import { onWindowResize, onSmartMounted } from '@varlet/use';
7
- import { getStyle } from '../utils/elements.mjs';
8
7
  var {
9
8
  n,
10
9
  classes
@@ -1,9 +1,9 @@
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
3
  import { computed, defineComponent, ref, watch, onBeforeUnmount, onDeactivated, onActivated } from 'vue';
4
- import { isPlainObject, isWindow, toNumber } from '@varlet/shared';
4
+ import { isPlainObject, isWindow, toNumber, doubleRaf, requestAnimationFrame, getRect } from '@varlet/shared';
5
5
  import { easeInOutCubic } from '../utils/shared.mjs';
6
- import { doubleRaf, getParentScroller, getScrollLeft, getScrollTop, nextTickFrame, requestAnimationFrame, scrollTo as varScrollTo, toPxNum, getRect } from '../utils/elements.mjs';
6
+ import { getParentScroller, getScrollLeft, getScrollTop, scrollTo as varScrollTo, toPxNum } from '../utils/elements.mjs';
7
7
  import { useIndexAnchors } from './provide.mjs';
8
8
  import { props } from './props.mjs';
9
9
  import { createNamespace, call } from '../utils/components.mjs';
@@ -136,9 +136,8 @@ var __sfc__ = defineComponent({
136
136
  animation: easeInOutCubic,
137
137
  duration: toNumber(props.duration)
138
138
  });
139
- nextTickFrame(() => {
140
- clickedName.value = '';
141
- });
139
+ yield doubleRaf();
140
+ clickedName.value = '';
142
141
  });
143
142
  return function anchorClick(_x) {
144
143
  return _ref2.apply(this, arguments);
@@ -247,7 +247,7 @@ import './tooltip/style/index.mjs'
247
247
  import './uploader/style/index.mjs'
248
248
  import './watermark/style/index.mjs'
249
249
 
250
- const version = '2.15.1'
250
+ const version = '2.15.2-alpha.1693502641730'
251
251
 
252
252
  function install(app) {
253
253
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -164,7 +164,7 @@ export * from './tooltip/index.mjs'
164
164
  export * from './uploader/index.mjs'
165
165
  export * from './watermark/index.mjs'
166
166
 
167
- const version = '2.15.1'
167
+ const version = '2.15.2-alpha.1693502641730'
168
168
 
169
169
  function install(app) {
170
170
  ActionSheet.install && app.use(ActionSheet)
package/es/lazy/index.mjs CHANGED
@@ -1,8 +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
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
- import { doubleRaf, getAllParentScroller, inViewport } from '../utils/elements.mjs';
5
- import { removeItem, throttle } from '@varlet/shared';
4
+ import { getAllParentScroller } from '../utils/elements.mjs';
5
+ import { removeItem, throttle, doubleRaf, inViewport } from '@varlet/shared';
6
6
  import { createCache } from '../utils/shared.mjs';
7
7
  import { call } from '../utils/components.mjs';
8
8
  var BACKGROUND_IMAGE_ARG_NAME = 'background-image';
package/es/list/List.mjs CHANGED
@@ -3,9 +3,9 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
3
3
  import VarLoading from '../loading/index.mjs';
4
4
  import Ripple from '../ripple/index.mjs';
5
5
  import { defineComponent, ref, nextTick, watch } from 'vue';
6
- import { getParentScroller, getRect, toPxNum } from '../utils/elements.mjs';
6
+ import { getParentScroller, toPxNum } from '../utils/elements.mjs';
7
7
  import { props } from './props.mjs';
8
- import { isNumber } from '@varlet/shared';
8
+ import { isNumber, getRect } from '@varlet/shared';
9
9
  import { dt } from '../utils/shared.mjs';
10
10
  import { createNamespace, call } from '../utils/components.mjs';
11
11
  import { pack } from '../locale/index.mjs';
@@ -1,6 +1,6 @@
1
1
  import { createVNode as _createVNode } from "vue";
2
- import { defineComponent } from 'vue';
3
2
  import context from '../context/index.mjs';
3
+ import { defineComponent } from 'vue';
4
4
  import { createNamespace } from '../utils/components.mjs';
5
5
  import { toSizeUnit } from '../utils/elements.mjs';
6
6
  import { props } from './props.mjs';
@@ -1,7 +1,7 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import { ref } from 'vue';
3
2
  import zhCN from './zh-CN.mjs';
4
3
  import enUS from './en-US.mjs';
4
+ import { ref } from 'vue';
5
5
  function useLocale() {
6
6
  var packs = {};
7
7
  var pack = ref({});
@@ -5,7 +5,8 @@ import flip from '@popperjs/core/lib/modifiers/flip';
5
5
  import offset from '@popperjs/core/lib/modifiers/offset';
6
6
  import computeStyles from '@popperjs/core/lib/modifiers/computeStyles';
7
7
  import { useClickOutside } from '@varlet/use';
8
- import { doubleRaf, toPxNum, getStyle } from '../utils/elements.mjs';
8
+ import { doubleRaf, getStyle } from '@varlet/shared';
9
+ import { toPxNum } from '../utils/elements.mjs';
9
10
  import { call, useVModel } from '../utils/components.mjs';
10
11
  import { onMounted, onUnmounted, ref, watch } from 'vue';
11
12
  import { createPopper } from '@popperjs/core/lib/popper-lite';
@@ -1,11 +1,11 @@
1
1
  import VarCheckbox from '../checkbox/index.mjs';
2
2
  import Ripple from '../ripple/index.mjs';
3
+ import Hover from '../hover/index.mjs';
4
+ import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
3
5
  import { defineComponent, computed, ref, watch } from 'vue';
4
6
  import { useSelect } from './provide.mjs';
5
7
  import { createNamespace } from '../utils/components.mjs';
6
8
  import { props } from './props.mjs';
7
- import Hover from '../hover/index.mjs';
8
- import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
9
9
  var {
10
10
  n,
11
11
  classes
@@ -2,9 +2,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
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
3
  import VarIcon from '../icon/index.mjs';
4
4
  import { defineComponent, ref, computed, watch, nextTick } from 'vue';
5
- import { getParentScroller, getScrollTop, getTarget, getRect } from '../utils/elements.mjs';
5
+ import { getParentScroller, getScrollTop, getTarget } from '../utils/elements.mjs';
6
6
  import { props } from './props.mjs';
7
- import { isNumber, isString, toNumber } from '@varlet/shared';
7
+ import { isNumber, isString, toNumber, getRect } from '@varlet/shared';
8
8
  import { call, createNamespace } from '../utils/components.mjs';
9
9
  import { useEventListener, onSmartMounted } from '@varlet/use';
10
10
  var {
@@ -1,14 +1,14 @@
1
- import { computed, defineComponent } from 'vue';
2
- import { toNumber } from '@varlet/shared';
3
- import { props } from './props.mjs';
4
- import { createNamespace } from '../utils/components.mjs';
5
- import { toPxNum, toSizeUnit } from '../utils/elements.mjs';
6
1
  import Info from './Info.mjs';
7
2
  import Error from './Error.mjs';
8
3
  import Warning from './Warning.mjs';
9
4
  import Success from './Success.mjs';
10
5
  import Question from './Question.mjs';
11
6
  import Empty from './Empty.mjs';
7
+ import { computed, defineComponent } from 'vue';
8
+ import { toNumber } from '@varlet/shared';
9
+ import { props } from './props.mjs';
10
+ import { createNamespace } from '../utils/components.mjs';
11
+ import { toPxNum, toSizeUnit } from '../utils/elements.mjs';
12
12
  var {
13
13
  n,
14
14
  classes
@@ -1,6 +1,6 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  import context from '../context/index.mjs';
3
- import { supportTouch, getStyle, getRect } from '../utils/elements.mjs';
3
+ import { supportTouch, getStyle, getRect } from '@varlet/shared';
4
4
  import { createNamespace } from '../utils/components.mjs';
5
5
 
6
6
 
@@ -1,12 +1,12 @@
1
1
  import VarFormDetails from '../form-details/index.mjs';
2
+ import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
3
+ import Hover from '../hover/index.mjs';
2
4
  import { defineComponent, ref, onBeforeUnmount, computed, reactive, nextTick, watch, unref } from 'vue';
3
5
  import { useValidation, createNamespace, call } from '../utils/components.mjs';
4
6
  import { useForm } from '../form/provide.mjs';
5
- import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
6
- import Hover from '../hover/index.mjs';
7
- import { getLeft, multiplySizeUnit, getRect } from '../utils/elements.mjs';
7
+ import { getLeft, multiplySizeUnit } from '../utils/elements.mjs';
8
8
  import { warn } from '../utils/logger.mjs';
9
- import { isArray, isNumber, toNumber } from '@varlet/shared';
9
+ import { isArray, isNumber, toNumber, getRect } from '@varlet/shared';
10
10
  import { props, Thumbs } from './props.mjs';
11
11
  import { onSmartMounted } from '@varlet/use';
12
12
  var {
@@ -1,5 +1,5 @@
1
- import { defineComponent } from 'vue';
2
1
  import VarSnackbarCore from './core.mjs';
2
+ import { defineComponent } from 'vue';
3
3
  import { createNamespace, useTeleport } from '../utils/components.mjs';
4
4
  import { props } from './props.mjs';
5
5
  var {
package/es/step/Step.mjs CHANGED
@@ -1,7 +1,7 @@
1
+ import VarIcon from '../icon/index.mjs';
1
2
  import { computed, defineComponent } from 'vue';
2
3
  import { props } from './props.mjs';
3
4
  import { useSteps } from './provide.mjs';
4
- import VarIcon from '../icon/index.mjs';
5
5
  import { toNumber } from '@varlet/shared';
6
6
  import { createNamespace } from '../utils/components.mjs';
7
7
  var {
@@ -2,8 +2,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
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
3
  import { defineComponent, ref, computed, watch } from 'vue';
4
4
  import { props } from './props.mjs';
5
- import { doubleRaf, getParentScroller, raf, toPxNum, getRect } from '../utils/elements.mjs';
6
- import { toNumber } from '@varlet/shared';
5
+ import { getParentScroller, toPxNum } from '../utils/elements.mjs';
6
+ import { toNumber, raf, doubleRaf, getRect } from '@varlet/shared';
7
7
  import { call, createNamespace } from '../utils/components.mjs';
8
8
  import { useEventListener, onSmartMounted, onWindowResize, onSmartUnmounted } from '@varlet/use';
9
9
  var {
@@ -2,9 +2,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
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
3
  import { defineComponent, ref, computed, watch, onActivated } from 'vue';
4
4
  import { useSwipeItems } from './provide.mjs';
5
- import { doubleRaf, nextTickFrame } from '../utils/elements.mjs';
6
5
  import { props } from './props.mjs';
7
- import { clamp, isNumber, toNumber } from '@varlet/shared';
6
+ import { clamp, isNumber, toNumber, doubleRaf } from '@varlet/shared';
8
7
  import { call, createNamespace } from '../utils/components.mjs';
9
8
  import { onSmartUnmounted, onWindowResize, useTouch } from '@varlet/use';
10
9
  import { usePopup } from '../popup/provide.mjs';
@@ -153,23 +152,26 @@ var __sfc__ = defineComponent({
153
152
  }
154
153
  return clamp(index, 0, length.value - 1);
155
154
  };
156
- var fixPosition = fn => {
157
- var overLeft = trackTranslate.value >= size.value;
158
- var overRight = trackTranslate.value <= -trackSize.value;
159
- var leftTranslate = 0;
160
- var rightTranslate = -(trackSize.value - size.value);
161
- lockDuration.value = true;
162
- if (overLeft || overRight) {
155
+ var fixPosition = /*#__PURE__*/function () {
156
+ var _ref2 = _asyncToGenerator(function* () {
157
+ var overLeft = trackTranslate.value >= size.value;
158
+ var overRight = trackTranslate.value <= -trackSize.value;
159
+ var leftTranslate = 0;
160
+ var rightTranslate = -(trackSize.value - size.value);
163
161
  lockDuration.value = true;
164
- trackTranslate.value = overRight ? leftTranslate : rightTranslate;
165
- findSwipeItem(0).setTranslate(0);
166
- findSwipeItem(length.value - 1).setTranslate(0);
167
- }
168
- nextTickFrame(() => {
162
+ if (overLeft || overRight) {
163
+ lockDuration.value = true;
164
+ trackTranslate.value = overRight ? leftTranslate : rightTranslate;
165
+ findSwipeItem(0).setTranslate(0);
166
+ findSwipeItem(length.value - 1).setTranslate(0);
167
+ }
168
+ yield doubleRaf();
169
169
  lockDuration.value = false;
170
- call(fn);
171
170
  });
172
- };
171
+ return function fixPosition() {
172
+ return _ref2.apply(this, arguments);
173
+ };
174
+ }();
173
175
  var initialIndex = () => {
174
176
  if (initializedIndex) {
175
177
  return;
@@ -197,16 +199,20 @@ var __sfc__ = defineComponent({
197
199
  trackTranslate.value = value;
198
200
  dispatchSwipeItems();
199
201
  };
200
- var handleTouchstart = event => {
201
- if (length.value <= 1 || !props.touchable) {
202
- return;
203
- }
204
- startTouch(event);
205
- stopAutoplay();
206
- fixPosition(() => {
202
+ var handleTouchstart = /*#__PURE__*/function () {
203
+ var _ref3 = _asyncToGenerator(function* (event) {
204
+ if (length.value <= 1 || !props.touchable) {
205
+ return;
206
+ }
207
+ startTouch(event);
208
+ stopAutoplay();
209
+ yield fixPosition();
207
210
  lockDuration.value = true;
208
211
  });
209
- };
212
+ return function handleTouchstart(_x) {
213
+ return _ref3.apply(this, arguments);
214
+ };
215
+ }();
210
216
  var handleTouchmove = event => {
211
217
  var {
212
218
  touchable,
@@ -264,21 +270,22 @@ var __sfc__ = defineComponent({
264
270
  });
265
271
  };
266
272
  // expose
267
- var next = options => {
268
- if (length.value <= 1) {
269
- return;
270
- }
271
- initialIndex();
272
- var {
273
- loop,
274
- onChange
275
- } = props;
276
- var currentIndex = index.value;
277
- index.value = clampIndex(currentIndex + 1);
278
- if ((options == null ? void 0 : options.event) !== false) {
279
- call(onChange, index.value);
280
- }
281
- fixPosition(() => {
273
+ var next = /*#__PURE__*/function () {
274
+ var _ref4 = _asyncToGenerator(function* (options) {
275
+ if (length.value <= 1) {
276
+ return;
277
+ }
278
+ initialIndex();
279
+ var {
280
+ loop,
281
+ onChange
282
+ } = props;
283
+ var currentIndex = index.value;
284
+ index.value = clampIndex(currentIndex + 1);
285
+ if ((options == null ? void 0 : options.event) !== false) {
286
+ call(onChange, index.value);
287
+ }
288
+ yield fixPosition();
282
289
  if (currentIndex === length.value - 1 && loop) {
283
290
  findSwipeItem(0).setTranslate(trackSize.value);
284
291
  trackTranslate.value = length.value * -size.value;
@@ -288,23 +295,27 @@ var __sfc__ = defineComponent({
288
295
  trackTranslate.value = index.value * -size.value;
289
296
  }
290
297
  });
291
- };
298
+ return function next(_x2) {
299
+ return _ref4.apply(this, arguments);
300
+ };
301
+ }();
292
302
  // expose
293
- var prev = options => {
294
- if (length.value <= 1) {
295
- return;
296
- }
297
- initialIndex();
298
- var {
299
- loop,
300
- onChange
301
- } = props;
302
- var currentIndex = index.value;
303
- index.value = clampIndex(currentIndex - 1);
304
- if ((options == null ? void 0 : options.event) !== false) {
305
- call(onChange, index.value);
306
- }
307
- fixPosition(() => {
303
+ var prev = /*#__PURE__*/function () {
304
+ var _ref5 = _asyncToGenerator(function* (options) {
305
+ if (length.value <= 1) {
306
+ return;
307
+ }
308
+ initialIndex();
309
+ var {
310
+ loop,
311
+ onChange
312
+ } = props;
313
+ var currentIndex = index.value;
314
+ index.value = clampIndex(currentIndex - 1);
315
+ if ((options == null ? void 0 : options.event) !== false) {
316
+ call(onChange, index.value);
317
+ }
318
+ yield fixPosition();
308
319
  if (currentIndex === 0 && loop) {
309
320
  findSwipeItem(length.value - 1).setTranslate(-trackSize.value);
310
321
  trackTranslate.value = size.value;
@@ -314,7 +325,10 @@ var __sfc__ = defineComponent({
314
325
  trackTranslate.value = index.value * -size.value;
315
326
  }
316
327
  });
317
- };
328
+ return function prev(_x3) {
329
+ return _ref5.apply(this, arguments);
330
+ };
331
+ }();
318
332
  // expose
319
333
  var to = (idx, options) => {
320
334
  if (length.value <= 1 || idx === index.value) {
@@ -347,7 +361,7 @@ var __sfc__ = defineComponent({
347
361
  if (popup) {
348
362
  // watch popup show again
349
363
  watch(() => popup.show.value, /*#__PURE__*/function () {
350
- var _ref3 = _asyncToGenerator(function* (show) {
364
+ var _ref7 = _asyncToGenerator(function* (show) {
351
365
  if (show) {
352
366
  yield doubleRaf();
353
367
  resize();
@@ -355,8 +369,8 @@ var __sfc__ = defineComponent({
355
369
  stopAutoplay();
356
370
  }
357
371
  });
358
- return function (_x) {
359
- return _ref3.apply(this, arguments);
372
+ return function (_x4) {
373
+ return _ref7.apply(this, arguments);
360
374
  };
361
375
  }());
362
376
  }
package/es/tabs/Tabs.mjs CHANGED
@@ -4,9 +4,9 @@ import VarSticky from '../sticky/index.mjs';
4
4
  import { defineComponent, watch, ref, computed, Transition, onActivated } from 'vue';
5
5
  import { props } from './props.mjs';
6
6
  import { useTabList } from './provide.mjs';
7
- import { clamp, isNumber } from '@varlet/shared';
7
+ import { clamp, isNumber, doubleRaf } from '@varlet/shared';
8
8
  import { linear } from '../utils/shared.mjs';
9
- import { toSizeUnit, scrollTo, doubleRaf } from '../utils/elements.mjs';
9
+ import { toSizeUnit, scrollTo } from '../utils/elements.mjs';
10
10
  import { createNamespace, call, formatElevation } from '../utils/components.mjs';
11
11
  import { onWindowResize } from '@varlet/use';
12
12
  var {
@@ -5,7 +5,7 @@ import { defineComponent, watch, ref } from 'vue';
5
5
  import { useTabItem } from './provide.mjs';
6
6
  import { call, createNamespace } from '../utils/components.mjs';
7
7
  import { props } from './props.mjs';
8
- import { doubleRaf } from '../utils/elements.mjs';
8
+ import { doubleRaf } from '@varlet/shared';
9
9
  var {
10
10
  n
11
11
  } = createNamespace('tabs-items');