@varlet/ui 2.10.2 → 2.10.3-alpha.1683717781836

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
@@ -22,6 +22,7 @@ const isURL = (val) => {
22
22
  return /^(http)|(\.*\/)/.test(val);
23
23
  };
24
24
  const isEmpty = (val) => val === void 0 || val === null || val === "" || Array.isArray(val) && !val.length;
25
+ const isWindow = (val) => val === window;
25
26
  const toNumber = (val) => {
26
27
  if (val == null)
27
28
  return 0;
@@ -147,45 +148,53 @@ function error$1(source, message) {
147
148
  function warn(source, message) {
148
149
  console.warn("Varlet [" + source + "]: " + message);
149
150
  }
150
- function asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, key, arg) {
151
- try {
152
- var info = gen[key](arg);
153
- var value = info.value;
154
- } catch (error2) {
155
- reject(error2);
156
- return;
157
- }
158
- if (info.done) {
159
- resolve(value);
160
- } else {
161
- Promise.resolve(value).then(_next, _throw);
162
- }
163
- }
164
- function _asyncToGenerator$e(fn2) {
165
- return function() {
166
- var self2 = this, args = arguments;
167
- return new Promise(function(resolve, reject) {
168
- var gen = fn2.apply(self2, args);
169
- function _next(value) {
170
- asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, "next", value);
171
- }
172
- function _throw(err) {
173
- asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, "throw", err);
151
+ function _extends$q() {
152
+ _extends$q = Object.assign ? Object.assign.bind() : function(target) {
153
+ for (var i = 1; i < arguments.length; i++) {
154
+ var source = arguments[i];
155
+ for (var key in source) {
156
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
157
+ target[key] = source[key];
158
+ }
174
159
  }
175
- _next(void 0);
176
- });
160
+ }
161
+ return target;
177
162
  };
163
+ return _extends$q.apply(this, arguments);
164
+ }
165
+ function getStyle$1(element) {
166
+ return window.getComputedStyle(element);
167
+ }
168
+ function getRect(element) {
169
+ if (isWindow(element)) {
170
+ var width = element.innerWidth;
171
+ var height = element.innerHeight;
172
+ var rect = {
173
+ x: 0,
174
+ y: 0,
175
+ top: 0,
176
+ left: 0,
177
+ right: width,
178
+ bottom: height,
179
+ width,
180
+ height
181
+ };
182
+ return _extends$q({}, rect, {
183
+ toJSON: () => rect
184
+ });
185
+ }
186
+ return element.getBoundingClientRect();
178
187
  }
179
188
  function getLeft(element) {
180
189
  var {
181
190
  left: left2
182
- } = element.getBoundingClientRect();
191
+ } = getRect(element);
183
192
  return left2 + (document.body.scrollLeft || document.documentElement.scrollLeft);
184
193
  }
185
194
  function getTop$1(element) {
186
195
  var {
187
196
  top: top2
188
- } = element.getBoundingClientRect();
197
+ } = getRect(element);
189
198
  return top2 + (document.body.scrollTop || document.documentElement.scrollTop);
190
199
  }
191
200
  function getScrollTop(element) {
@@ -196,32 +205,25 @@ function getScrollLeft(element) {
196
205
  var left2 = "scrollLeft" in element ? element.scrollLeft : element.pageXOffset;
197
206
  return Math.max(left2, 0);
198
207
  }
199
- function inViewport(_x) {
200
- return _inViewport.apply(this, arguments);
201
- }
202
- function _inViewport() {
203
- _inViewport = _asyncToGenerator$e(function* (element) {
204
- yield doubleRaf();
205
- var {
206
- top: top2,
207
- bottom: bottom2,
208
- left: left2,
209
- right: right2
210
- } = element.getBoundingClientRect();
211
- var {
212
- innerWidth,
213
- innerHeight
214
- } = window;
215
- var xInViewport = left2 <= innerWidth && right2 >= 0;
216
- var yInViewport = top2 <= innerHeight && bottom2 >= 0;
217
- return xInViewport && yInViewport;
218
- });
219
- return _inViewport.apply(this, arguments);
208
+ function inViewport(element) {
209
+ var {
210
+ top: top2,
211
+ bottom: bottom2,
212
+ left: left2,
213
+ right: right2
214
+ } = getRect(element);
215
+ var {
216
+ width,
217
+ height
218
+ } = getRect(window);
219
+ var xInViewport = left2 <= width && right2 >= 0;
220
+ var yInViewport = top2 <= height && bottom2 >= 0;
221
+ return xInViewport && yInViewport;
220
222
  }
221
223
  function getTranslate(el) {
222
224
  var {
223
225
  transform
224
- } = window.getComputedStyle(el);
226
+ } = getStyle$1(el);
225
227
  return +transform.slice(transform.lastIndexOf(",") + 2, transform.length - 1);
226
228
  }
227
229
  function getParentScroller(el) {
@@ -238,7 +240,7 @@ function getParentScroller(el) {
238
240
  var {
239
241
  overflowY,
240
242
  overflow
241
- } = window.getComputedStyle(element);
243
+ } = getStyle$1(element);
242
244
  if (scrollRE.test(overflowY) || scrollRE.test(overflow)) {
243
245
  return element;
244
246
  }
@@ -248,7 +250,7 @@ function getParentScroller(el) {
248
250
  function getAllParentScroller(el) {
249
251
  var allParentScroller = [];
250
252
  var element = el;
251
- while (element !== window) {
253
+ while (!isWindow(element)) {
252
254
  element = getParentScroller(element);
253
255
  allParentScroller.push(element);
254
256
  }
@@ -268,15 +270,15 @@ function getTarget(target, componentName) {
268
270
  }
269
271
  function getViewportSize() {
270
272
  var {
271
- innerWidth,
272
- innerHeight
273
- } = window;
274
- return innerWidth > innerHeight ? {
275
- vMin: innerHeight,
276
- vMax: innerWidth
273
+ width,
274
+ height
275
+ } = getRect(window);
276
+ return width > height ? {
277
+ vMin: height,
278
+ vMax: width
277
279
  } : {
278
- vMin: innerWidth,
279
- vMax: innerHeight
280
+ vMin: width,
281
+ vMax: height
280
282
  };
281
283
  }
282
284
  var isRem = (value) => isString(value) && value.endsWith("rem");
@@ -295,15 +297,19 @@ var toPxNum = (value) => {
295
297
  if (isPx(value)) {
296
298
  return +value.replace("px", "");
297
299
  }
300
+ var {
301
+ width,
302
+ height
303
+ } = getRect(window);
298
304
  if (isVw(value)) {
299
- return +value.replace("vw", "") * window.innerWidth / 100;
305
+ return +value.replace("vw", "") * width / 100;
300
306
  }
301
307
  if (isVh(value)) {
302
- return +value.replace("vh", "") * window.innerHeight / 100;
308
+ return +value.replace("vh", "") * height / 100;
303
309
  }
304
310
  if (isRem(value)) {
305
311
  var num = +value.replace("rem", "");
306
- var rootFontSize = window.getComputedStyle(document.documentElement).fontSize;
312
+ var rootFontSize = getStyle$1(document.documentElement).fontSize;
307
313
  return num * parseFloat(rootFontSize);
308
314
  }
309
315
  if (isVMin(value)) {
@@ -2254,7 +2260,10 @@ function check(_x) {
2254
2260
  }
2255
2261
  function _check() {
2256
2262
  _check = _asyncToGenerator$b(function* (el) {
2257
- (yield inViewport(el)) && attemptLoad(el);
2263
+ yield doubleRaf();
2264
+ if (inViewport(el)) {
2265
+ attemptLoad(el);
2266
+ }
2258
2267
  });
2259
2268
  return _check.apply(this, arguments);
2260
2269
  }
@@ -6009,7 +6018,7 @@ var __sfc__$W = vue.defineComponent({
6009
6018
  var {
6010
6019
  offsetHeight
6011
6020
  } = contentEl.value;
6012
- contentEl.value.style.height = 0 + "px";
6021
+ contentEl.value.style.height = "0px";
6013
6022
  requestAnimationFrame(() => {
6014
6023
  contentEl.value.style.height = offsetHeight + "px";
6015
6024
  if (!isInitToTrigger)
@@ -6032,7 +6041,7 @@ var __sfc__$W = vue.defineComponent({
6032
6041
  } = contentEl.value;
6033
6042
  contentEl.value.style.height = offsetHeight + "px";
6034
6043
  requestAnimationFrame(() => {
6035
- contentEl.value.style.height = 0 + "px";
6044
+ contentEl.value.style.height = "0px";
6036
6045
  });
6037
6046
  };
6038
6047
  var transitionend = () => {
@@ -7597,7 +7606,8 @@ function finalise(x, sd, rm, isTruncated) {
7597
7606
  }
7598
7607
  }
7599
7608
  isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
7600
- roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
7609
+ roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
7610
+ (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
7601
7611
  if (sd < 1 || !xd[0]) {
7602
7612
  xd.length = 0;
7603
7613
  if (roundUp) {
@@ -9159,9 +9169,9 @@ Utils.w = wrapper;
9159
9169
  var parseDate = function parseDate2(cfg) {
9160
9170
  var date = cfg.date, utc = cfg.utc;
9161
9171
  if (date === null)
9162
- return new Date(NaN);
9172
+ return /* @__PURE__ */ new Date(NaN);
9163
9173
  if (Utils.u(date))
9164
- return new Date();
9174
+ return /* @__PURE__ */ new Date();
9165
9175
  if (date instanceof Date)
9166
9176
  return new Date(date);
9167
9177
  if (typeof date === "string" && !/Z$/i.test(date)) {
@@ -14181,7 +14191,7 @@ var __sfc__$I = vue.defineComponent({
14181
14191
  bindSwipeItems,
14182
14192
  length
14183
14193
  } = useSwipeItems();
14184
- var isCalledPrevOrNext = false;
14194
+ var initializedIndex = false;
14185
14195
  var touching = false;
14186
14196
  var timer = -1;
14187
14197
  var startX;
@@ -14265,7 +14275,11 @@ var __sfc__$I = vue.defineComponent({
14265
14275
  });
14266
14276
  };
14267
14277
  var initialIndex = () => {
14278
+ if (initializedIndex) {
14279
+ return;
14280
+ }
14268
14281
  index.value = boundaryIndex(toNumber(props2.initialIndex));
14282
+ initializedIndex = true;
14269
14283
  };
14270
14284
  var startAutoplay = () => {
14271
14285
  var {
@@ -14376,7 +14390,7 @@ var __sfc__$I = vue.defineComponent({
14376
14390
  if (length.value <= 1) {
14377
14391
  return;
14378
14392
  }
14379
- isCalledPrevOrNext = true;
14393
+ initialIndex();
14380
14394
  var {
14381
14395
  loop,
14382
14396
  onChange
@@ -14401,7 +14415,7 @@ var __sfc__$I = vue.defineComponent({
14401
14415
  if (length.value <= 1) {
14402
14416
  return;
14403
14417
  }
14404
- isCalledPrevOrNext = true;
14418
+ initialIndex();
14405
14419
  var {
14406
14420
  loop,
14407
14421
  onChange
@@ -14444,9 +14458,8 @@ var __sfc__$I = vue.defineComponent({
14444
14458
  };
14445
14459
  bindSwipeItems(swipeProvider);
14446
14460
  vue.watch(() => length.value, /* @__PURE__ */ _asyncToGenerator$7(function* () {
14447
- isCalledPrevOrNext = false;
14448
14461
  yield doubleRaf();
14449
- !isCalledPrevOrNext && initialIndex();
14462
+ initialIndex();
14450
14463
  resize();
14451
14464
  }));
14452
14465
  vue.onActivated(resize);
@@ -15753,10 +15766,6 @@ function __render__$B(_ctx, _cache) {
15753
15766
  "div",
15754
15767
  {
15755
15768
  class: vue.normalizeClass(_ctx.classes(_ctx.n(), _ctx.n("$--box"), _ctx.n("--" + _ctx.variant), [_ctx.size === "small", _ctx.n("--small")], [_ctx.disabled, _ctx.n("--disabled")])),
15756
- style: vue.normalizeStyle({
15757
- "--field-decorator-legend-max-width": _ctx.legendMaxWidth,
15758
- "--filed-decorator-controller-width": _ctx.controllerWidth
15759
- }),
15760
15769
  onClick: _cache[0] || (_cache[0] = function() {
15761
15770
  return _ctx.handleClick && _ctx.handleClick(...arguments);
15762
15771
  })
@@ -15768,14 +15777,14 @@ function __render__$B(_ctx, _cache) {
15768
15777
  ref: "controllerEl",
15769
15778
  style: vue.normalizeStyle({
15770
15779
  color: _ctx.color,
15771
- cursor: _ctx.cursor
15780
+ cursor: _ctx.cursor,
15781
+ overflow: _ctx.isFloating ? "visible" : "hidden"
15772
15782
  })
15773
15783
  },
15774
15784
  [vue.createElementVNode(
15775
15785
  "div",
15776
15786
  {
15777
- class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [!_ctx.hint, _ctx.n("--icon-non-hint")])),
15778
- ref: "prependIconEl"
15787
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [!_ctx.hint, _ctx.n("--icon-non-hint")]))
15779
15788
  },
15780
15789
  [vue.renderSlot(_ctx.$slots, "prepend-icon")],
15781
15790
  2
@@ -15783,41 +15792,44 @@ function __render__$B(_ctx, _cache) {
15783
15792
  ), vue.createElementVNode(
15784
15793
  "div",
15785
15794
  {
15795
+ ref: "middleEl",
15786
15796
  class: vue.normalizeClass(_ctx.classes(_ctx.n("middle"), [!_ctx.hint, _ctx.n("--middle-non-hint")]))
15787
15797
  },
15788
- [vue.renderSlot(_ctx.$slots, "default"), _ctx.hint || _ctx.alwaysCustomPlaceholder ? (vue.openBlock(), vue.createElementBlock(
15789
- "label",
15790
- {
15791
- key: 0,
15792
- class: vue.normalizeClass(_ctx.classes(_ctx.n("placeholder"), _ctx.n("$--ellipsis"), [_ctx.isFocus, _ctx.n("--focus")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")], [_ctx.errorMessage, _ctx.n("--error")], [!_ctx.hint, _ctx.n("--placeholder-non-hint")], _ctx.computePlaceholderState())),
15793
- style: vue.normalizeStyle({
15794
- transform: _ctx.placeholderTransform,
15795
- color: _ctx.color
15796
- }),
15797
- for: _ctx.id
15798
- },
15799
- [vue.createElementVNode(
15800
- "span",
15801
- null,
15802
- vue.toDisplayString(_ctx.placeholder),
15803
- 1
15804
- /* TEXT */
15805
- ), vue.createElementVNode(
15806
- "span",
15807
- {
15808
- class: vue.normalizeClass(_ctx.n("placeholder-text")),
15809
- ref: "placeholderTextEl"
15810
- },
15811
- vue.toDisplayString(_ctx.placeholder),
15812
- 3
15813
- /* TEXT, CLASS */
15814
- )],
15815
- 14,
15816
- _hoisted_1$f
15817
- )) : vue.createCommentVNode("v-if", true)],
15798
+ [vue.renderSlot(_ctx.$slots, "default")],
15818
15799
  2
15819
15800
  /* CLASS */
15820
- ), vue.createElementVNode(
15801
+ ), (_ctx.hint || _ctx.alwaysCustomPlaceholder) && _ctx.placeholderTransform ? (vue.openBlock(), vue.createElementBlock(
15802
+ "label",
15803
+ {
15804
+ key: 0,
15805
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("placeholder"), _ctx.n("$--ellipsis"), [_ctx.isFocus, _ctx.n("--focus")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")], [_ctx.errorMessage, _ctx.n("--error")], [!_ctx.hint, _ctx.n("--placeholder-non-hint")], _ctx.computePlaceholderState())),
15806
+ style: vue.normalizeStyle({
15807
+ color: _ctx.color,
15808
+ transform: _ctx.placeholderTransform,
15809
+ maxWidth: _ctx.placeholderMaxWidth
15810
+ }),
15811
+ for: _ctx.id
15812
+ },
15813
+ [vue.createElementVNode(
15814
+ "span",
15815
+ null,
15816
+ vue.toDisplayString(_ctx.placeholder),
15817
+ 1
15818
+ /* TEXT */
15819
+ )],
15820
+ 14,
15821
+ _hoisted_1$f
15822
+ )) : vue.createCommentVNode("v-if", true), _ctx.variant === "outlined" ? (vue.openBlock(), vue.createElementBlock(
15823
+ "span",
15824
+ {
15825
+ key: 1,
15826
+ ref: "placeholderTextEl",
15827
+ class: vue.normalizeClass([_ctx.n("placeholder-text"), _ctx.n("$--ellipsis")])
15828
+ },
15829
+ vue.toDisplayString(_ctx.placeholder),
15830
+ 3
15831
+ /* TEXT, CLASS */
15832
+ )) : vue.createCommentVNode("v-if", true), vue.createElementVNode(
15821
15833
  "div",
15822
15834
  {
15823
15835
  class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [!_ctx.hint, _ctx.n("--icon-non-hint")]))
@@ -15850,23 +15862,24 @@ function __render__$B(_ctx, _cache) {
15850
15862
  {
15851
15863
  key: 0,
15852
15864
  class: vue.normalizeClass(_ctx.classes(_ctx.n("line"), [_ctx.isFocus, _ctx.n("--line-focus")], [_ctx.errorMessage, _ctx.n("--line-error")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--line-disabled")])),
15853
- ref: "fieldsetEl"
15865
+ style: vue.normalizeStyle({
15866
+ borderColor: _ctx.color
15867
+ })
15854
15868
  },
15855
15869
  [vue.createElementVNode(
15856
15870
  "legend",
15857
15871
  {
15858
- class: vue.normalizeClass(_ctx.classes(_ctx.n("line-legend"), [_ctx.isFloating(), _ctx.n("line-legend--hint")])),
15872
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("line-legend"), [_ctx.isFloating, _ctx.n("line-legend--hint")])),
15859
15873
  style: vue.normalizeStyle({
15860
- width: _ctx.legendWidth,
15861
- maxWidth: _ctx.legendMaxWidth
15874
+ width: _ctx.legendWidth
15862
15875
  })
15863
15876
  },
15864
15877
  null,
15865
15878
  6
15866
15879
  /* CLASS, STYLE */
15867
15880
  )],
15868
- 2
15869
- /* CLASS */
15881
+ 6
15882
+ /* CLASS, STYLE */
15870
15883
  )) : (vue.openBlock(), vue.createElementBlock(
15871
15884
  "div",
15872
15885
  {
@@ -15894,8 +15907,8 @@ function __render__$B(_ctx, _cache) {
15894
15907
  2112
15895
15908
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
15896
15909
  )) : vue.createCommentVNode("v-if", true)],
15897
- 6
15898
- /* CLASS, STYLE */
15910
+ 2
15911
+ /* CLASS */
15899
15912
  );
15900
15913
  }
15901
15914
  var __sfc__$C = vue.defineComponent({
@@ -15905,61 +15918,49 @@ var __sfc__$C = vue.defineComponent({
15905
15918
  },
15906
15919
  props: props$y,
15907
15920
  setup(props2) {
15908
- var fieldsetEl = vue.ref(null);
15909
15921
  var controllerEl = vue.ref(null);
15922
+ var middleEl = vue.ref(null);
15910
15923
  var placeholderTextEl = vue.ref(null);
15911
- var prependIconEl = vue.ref(null);
15912
- var legendMaxWidth = vue.ref("");
15913
15924
  var legendWidth = vue.ref("");
15914
- var controllerWidth = vue.ref("");
15915
15925
  var placeholderTransform = vue.ref("");
15926
+ var placeholderMaxWidth = vue.ref("");
15916
15927
  var color = vue.computed(() => !props2.errorMessage ? props2.isFocus ? props2.focusColor : props2.blurColor : void 0);
15928
+ var isFloating = vue.computed(() => props2.hint && (!isEmpty(props2.value) || props2.isFocus));
15917
15929
  var computePlaceholderState = () => {
15918
15930
  var {
15919
15931
  hint,
15920
15932
  value,
15921
- isFocus,
15922
15933
  composing
15923
15934
  } = props2;
15924
15935
  if (!hint && (!isEmpty(value) || composing)) {
15925
15936
  return n$A("--placeholder-hidden");
15926
15937
  }
15927
- if (hint && (!isEmpty(value) || isFocus)) {
15928
- return n$A("--placeholder-hint");
15929
- }
15930
15938
  };
15931
- var resetSize = () => {
15932
- legendWidth.value = "";
15933
- legendMaxWidth.value = "";
15934
- placeholderTransform.value = "";
15935
- controllerWidth.value = "";
15936
- };
15937
- var isFloating = () => props2.hint && (!isEmpty(props2.value) || props2.isFocus);
15938
15939
  var resize = () => {
15939
- var _window$getComputedSt, _window$getComputedSt2;
15940
15940
  var {
15941
15941
  size,
15942
+ hint,
15942
15943
  placeholder,
15943
15944
  variant
15944
15945
  } = props2;
15945
- if (!isFloating() || !placeholder) {
15946
- resetSize();
15946
+ if (!isFloating.value || !placeholder) {
15947
+ var controllerRect = getRect(controllerEl.value);
15948
+ var middleRect = getRect(middleEl.value);
15949
+ var translateX = middleRect.left - controllerRect.left + "px";
15950
+ placeholderTransform.value = hint ? "translate(" + translateX + ", calc(var(--field-decorator-" + variant + "-" + size + "-placeholder-translate-y) + var(--field-decorator-middle-offset-y))) scale(1)" : "translate(" + translateX + ", -50%)";
15951
+ placeholderMaxWidth.value = middleRect.width + "px";
15947
15952
  return;
15948
15953
  }
15949
- var placeholderSpace = "var(--field-decorator-outlined-" + size + "-placeholder-space)";
15950
- var placeholderTextWidth = (_window$getComputedSt = window.getComputedStyle(placeholderTextEl.value)) == null ? void 0 : _window$getComputedSt.width;
15951
- var prependIconWidth = (_window$getComputedSt2 = window.getComputedStyle(prependIconEl.value)) == null ? void 0 : _window$getComputedSt2.width;
15954
+ var controllerStyle = getStyle$1(controllerEl.value);
15952
15955
  var translateY = variant === "outlined" ? "-50%" : "0";
15953
- placeholderTransform.value = "translate(-" + prependIconWidth + ", " + translateY + ") scale(0.75)";
15954
- controllerWidth.value = window.getComputedStyle(controllerEl.value).width;
15956
+ placeholderTransform.value = "translate(" + controllerStyle.paddingLeft + ", " + translateY + ") scale(0.75)";
15955
15957
  if (variant === "outlined") {
15956
- var {
15957
- width,
15958
- paddingLeft,
15959
- paddingRight
15960
- } = window.getComputedStyle(fieldsetEl.value);
15961
- legendWidth.value = "calc(" + placeholderTextWidth + " * 0.75 + 2 * " + placeholderSpace + ")";
15962
- legendMaxWidth.value = "calc(" + width + " - " + paddingLeft + " - " + paddingRight + ")";
15958
+ var placeholderTextStyle = getStyle$1(placeholderTextEl.value);
15959
+ var placeholderSpace = "var(--field-decorator-outlined-" + size + "-placeholder-space)";
15960
+ legendWidth.value = "calc(" + placeholderTextStyle.width + " * 0.75 + " + placeholderSpace + " * 2)";
15961
+ placeholderMaxWidth.value = "calc((100% - var(--field-decorator-outlined-" + size + "-padding-left) - var(--field-decorator-outlined-" + size + "-padding-right)) * 1.33)";
15962
+ } else {
15963
+ placeholderMaxWidth.value = "133%";
15963
15964
  }
15964
15965
  };
15965
15966
  var handleClear = (e) => {
@@ -15968,19 +15969,17 @@ var __sfc__$C = vue.defineComponent({
15968
15969
  var handleClick = (e) => {
15969
15970
  call(props2.onClick, e);
15970
15971
  };
15971
- vue.watch(() => [props2.size, props2.placeholder, props2.hint, props2.value, props2.isFocus, props2.variant], resize);
15972
+ vue.onUpdated(resize);
15972
15973
  useMounted(resize);
15973
15974
  useEventListener(() => window, "resize", resize);
15974
15975
  return {
15975
- fieldsetEl,
15976
15976
  controllerEl,
15977
+ middleEl,
15977
15978
  placeholderTextEl,
15978
- prependIconEl,
15979
15979
  placeholderTransform,
15980
+ placeholderMaxWidth,
15980
15981
  color,
15981
15982
  legendWidth,
15982
- legendMaxWidth,
15983
- controllerWidth,
15984
15983
  isFloating,
15985
15984
  computePlaceholderState,
15986
15985
  n: n$A,
@@ -16761,10 +16760,12 @@ var __sfc__$z = vue.defineComponent({
16761
16760
  call(props2.onLoad);
16762
16761
  };
16763
16762
  var isReachBottom = () => {
16764
- var containerBottom = scroller === window ? window.innerHeight : scroller.getBoundingClientRect().bottom;
16763
+ var {
16764
+ bottom: containerBottom
16765
+ } = getRect(scroller);
16765
16766
  var {
16766
16767
  bottom: detectorBottom
16767
- } = detectorEl.value.getBoundingClientRect();
16768
+ } = getRect(detectorEl.value);
16768
16769
  return Math.floor(detectorBottom) - toPxNum(props2.offset) <= containerBottom;
16769
16770
  };
16770
16771
  var removeScrollerListener = () => {
@@ -22964,9 +22965,7 @@ function __render__$6(_ctx, _cache) {
22964
22965
  "var-tab-item-cover": ""
22965
22966
  },
22966
22967
  {
22967
- default: vue.withCtx(() => [_ctx.initSlot ? vue.renderSlot(_ctx.$slots, "default", {
22968
- key: 0
22969
- }) : vue.createCommentVNode("v-if", true)]),
22968
+ default: vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "default")]),
22970
22969
  _: 3
22971
22970
  /* FORWARDED */
22972
22971
  },
@@ -22982,16 +22981,12 @@ var __sfc__$6 = vue.defineComponent({
22982
22981
  props: props$5,
22983
22982
  setup(props2) {
22984
22983
  var current = vue.ref(false);
22985
- var initSlot = vue.ref(false);
22986
22984
  var name = vue.computed(() => props2.name);
22987
22985
  var {
22988
22986
  index,
22989
22987
  bindTabsItems
22990
22988
  } = useTabsItems();
22991
22989
  var setCurrent = (value) => {
22992
- if (!initSlot.value && value) {
22993
- initSlot.value = true;
22994
- }
22995
22990
  current.value = value;
22996
22991
  };
22997
22992
  var tabItemProvider = {
@@ -23003,8 +22998,7 @@ var __sfc__$6 = vue.defineComponent({
23003
22998
  return {
23004
22999
  n: n$6,
23005
23000
  classes: classes$5,
23006
- current,
23007
- initSlot
23001
+ current
23008
23002
  };
23009
23003
  }
23010
23004
  });
@@ -25397,9 +25391,9 @@ const skeleton = "";
25397
25391
  const SkeletonSfc = "";
25398
25392
  const slider = "";
25399
25393
  const SliderSfc = "";
25394
+ const SnackbarSfc = "";
25400
25395
  const snackbar = "";
25401
25396
  const coreSfc = "";
25402
- const SnackbarSfc = "";
25403
25397
  const space = "";
25404
25398
  const step = "";
25405
25399
  const StepSfc = "";
@@ -25424,7 +25418,7 @@ const TimePickerSfc = "";
25424
25418
  const TooltipSfc = "";
25425
25419
  const uploader = "";
25426
25420
  const UploaderSfc = "";
25427
- const version = "2.10.2";
25421
+ const version = "2.10.3-alpha.1683717781836";
25428
25422
  function install(app) {
25429
25423
  ActionSheet.install && app.use(ActionSheet);
25430
25424
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.10.2",
3
+ "version": "2.10.3-alpha.1683717781836",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -46,9 +46,9 @@
46
46
  "@popperjs/core": "^2.11.6",
47
47
  "dayjs": "^1.10.4",
48
48
  "decimal.js": "^10.2.1",
49
- "@varlet/icons": "2.10.2",
50
- "@varlet/shared": "2.10.2",
51
- "@varlet/use": "2.10.2"
49
+ "@varlet/icons": "2.10.3-alpha.1683717781836",
50
+ "@varlet/use": "2.10.3-alpha.1683717781836",
51
+ "@varlet/shared": "2.10.3-alpha.1683717781836"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/jest": "^26.0.15",
@@ -63,8 +63,8 @@
63
63
  "typescript": "^4.4.4",
64
64
  "vue": "3.2.47",
65
65
  "vue-router": "4.1.6",
66
- "@varlet/cli": "2.10.2",
67
- "@varlet/touch-emulator": "2.10.2"
66
+ "@varlet/cli": "2.10.3-alpha.1683717781836",
67
+ "@varlet/touch-emulator": "2.10.3-alpha.1683717781836"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",