@varlet/ui 2.9.3 → 2.9.4-alpha.1679927847009

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "2.9.3",
4
+ "version": "2.9.4-alpha.1679927847009",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "2.9.3",
4
+ "version": "2.9.4-alpha.1679927847009",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
package/lib/varlet.cjs.js CHANGED
@@ -140,6 +140,12 @@ var padStart$1 = function(str, maxLength, fillString) {
140
140
  var repeatCount = Math.floor(len / fillString.length);
141
141
  return fillString.repeat(repeatCount) + fillString.slice(0, len % fillString.length) + str;
142
142
  };
143
+ function error$1(source, message) {
144
+ throw Error("Varlet [" + source + "]: " + message);
145
+ }
146
+ function warn(source, message) {
147
+ console.warn("Varlet [" + source + "]: " + message);
148
+ }
143
149
  function asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, key, arg) {
144
150
  try {
145
151
  var info = gen[key](arg);
@@ -251,19 +257,34 @@ function getTarget(target, componentName) {
251
257
  if (isString(target)) {
252
258
  var el = document.querySelector(target);
253
259
  if (!el) {
254
- throw Error("[Varlet] " + componentName + ": target element cannot found");
260
+ error$1(componentName, "target element cannot found");
255
261
  }
256
262
  return el;
257
263
  }
258
264
  if (isObject(target))
259
265
  return target;
260
- throw Error("[Varlet] " + componentName + ': type of prop "target" should be a selector or an element object');
266
+ error$1(componentName, 'type of prop "target" should be a selector or an element object');
267
+ }
268
+ function getViewportSize() {
269
+ var {
270
+ innerWidth,
271
+ innerHeight
272
+ } = window;
273
+ return innerWidth > innerHeight ? {
274
+ vMin: innerHeight,
275
+ vMax: innerWidth
276
+ } : {
277
+ vMin: innerWidth,
278
+ vMax: innerHeight
279
+ };
261
280
  }
262
281
  var isRem = (value) => isString(value) && value.endsWith("rem");
263
282
  var isPx = (value) => isString(value) && value.endsWith("px") || isNumber(value);
264
283
  var isPercent = (value) => isString(value) && value.endsWith("%");
265
284
  var isVw = (value) => isString(value) && value.endsWith("vw");
266
285
  var isVh = (value) => isString(value) && value.endsWith("vh");
286
+ var isVMin = (value) => isString(value) && value.endsWith("vmin");
287
+ var isVMax = (value) => isString(value) && value.endsWith("vmax");
267
288
  var isCalc = (value) => isString(value) && value.startsWith("calc(");
268
289
  var isVar = (value) => isString(value) && value.startsWith("var(");
269
290
  var toPxNum = (value) => {
@@ -284,6 +305,12 @@ var toPxNum = (value) => {
284
305
  var rootFontSize = window.getComputedStyle(document.documentElement).fontSize;
285
306
  return num * parseFloat(rootFontSize);
286
307
  }
308
+ if (isVMin(value)) {
309
+ return getViewportSize().vMin;
310
+ }
311
+ if (isVMax(value)) {
312
+ return getViewportSize().vMax;
313
+ }
287
314
  if (isString(value)) {
288
315
  return toNumber(value);
289
316
  }
@@ -293,7 +320,7 @@ var toSizeUnit = (value) => {
293
320
  if (value == null) {
294
321
  return void 0;
295
322
  }
296
- if (isPercent(value) || isVw(value) || isVh(value) || isRem(value) || isCalc(value) || isVar(value)) {
323
+ if (isPercent(value) || isVw(value) || isVh(value) || isRem(value) || isCalc(value) || isVar(value) || isVMin(value) || isVMax(value)) {
297
324
  return value;
298
325
  }
299
326
  return toPxNum(value) + "px";
@@ -3744,7 +3771,7 @@ function useBottomNavigation() {
3744
3771
  bindParent
3745
3772
  } = useParent(BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY);
3746
3773
  if (!bindParent) {
3747
- throw Error("<var-bottom-navigation-item/> must in <var-bottom-navigation/>");
3774
+ error$1("BottomNavigationItem", "<var-bottom-navigation-item/> must in <var-bottom-navigation/>");
3748
3775
  }
3749
3776
  return {
3750
3777
  index,
@@ -3912,7 +3939,7 @@ function useBreadcrumb() {
3912
3939
  index
3913
3940
  } = useParent(BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY);
3914
3941
  if (!bindParent) {
3915
- throw Error("<var-breadcrumb/> must in <var-breadcrumbs/>");
3942
+ error$1("Breadcrumb", "<var-breadcrumb/> must in <var-breadcrumbs/>");
3916
3943
  }
3917
3944
  return {
3918
3945
  index,
@@ -5801,7 +5828,7 @@ function useCollapse() {
5801
5828
  bindParent
5802
5829
  } = useParent(COLLAPSE_BIND_COLLAPSE_ITEM_KEY);
5803
5830
  if (!bindParent) {
5804
- throw Error("[Varlet] Collapse: <var-collapse-item/> must in <var-collapse>");
5831
+ error$1("Collapse", "<var-collapse-item/> must in <var-collapse>");
5805
5832
  }
5806
5833
  return {
5807
5834
  index,
@@ -14432,7 +14459,7 @@ function useSwipe() {
14432
14459
  parentProvider
14433
14460
  } = useParent(SWIPE_BIND_SWIPE_ITEM_KEY);
14434
14461
  if (!bindParent) {
14435
- throw Error("<var-swipe-item/> must in <var-swipe/>");
14462
+ error$1("SwipeItem", "<var-swipe-item/> must in <var-swipe/>");
14436
14463
  }
14437
14464
  return {
14438
14465
  index,
@@ -15205,7 +15232,7 @@ function useIndexBar() {
15205
15232
  bindParent
15206
15233
  } = useParent(INDEX_BAR_BIND_INDEX_ANCHOR_KEY);
15207
15234
  if (!bindParent) {
15208
- throw Error('[Varlet] IndexAnchor: You should use this component in "IndexBar"');
15235
+ error$1("IndexAnchor", 'You should use this component in "IndexBar"');
15209
15236
  }
15210
15237
  return {
15211
15238
  index,
@@ -16777,7 +16804,7 @@ function useSelect() {
16777
16804
  bindParent
16778
16805
  } = useParent(SELECT_BIND_OPTION_KEY);
16779
16806
  if (!bindParent) {
16780
- throw Error("<var-option/> must in <var-select/>");
16807
+ error$1("Option", "<var-option/> must in <var-select/>");
16781
16808
  }
16782
16809
  return {
16783
16810
  index,
@@ -18572,7 +18599,9 @@ var __sfc__$s = vue.defineComponent({
18572
18599
  refreshStatus.value = "loading";
18573
18600
  distance.value = maxDistance.value * 0.3;
18574
18601
  call(props2["onUpdate:modelValue"], true);
18575
- call(props2.onRefresh);
18602
+ vue.nextTick(() => {
18603
+ call(props2.onRefresh);
18604
+ });
18576
18605
  lockEvent("remove");
18577
18606
  } else {
18578
18607
  refreshStatus.value = "loosing";
@@ -20345,7 +20374,7 @@ var __sfc__$g = vue.defineComponent({
20345
20374
  modelValue
20346
20375
  } = props2;
20347
20376
  if (multiple2 && !isArray(modelValue)) {
20348
- throw Error("The modelValue must be an array when multiple is true");
20377
+ error$1("Select", "The modelValue must be an array when multiple is true");
20349
20378
  }
20350
20379
  });
20351
20380
  vue.watch(() => props2.modelValue, syncOptions, {
@@ -21057,11 +21086,11 @@ var __sfc__$e = vue.defineComponent({
21057
21086
  var stepValidator = () => {
21058
21087
  var stepNumber = toNumber(props2.step);
21059
21088
  if (isNaN(stepNumber)) {
21060
- console.warn('[Varlet] Slider: type of prop "step" should be Number');
21089
+ warn("Slider", 'type of prop "step" should be Number');
21061
21090
  return false;
21062
21091
  }
21063
21092
  if (stepNumber < 0) {
21064
- console.warn('[Varlet] Slider: "step" should be > 0');
21093
+ warn("Slider", '"step" should be > 0');
21065
21094
  return false;
21066
21095
  }
21067
21096
  return true;
@@ -21832,7 +21861,7 @@ function useSteps() {
21832
21861
  bindParent
21833
21862
  } = useParent(STEPS_BIND_STEP_KEY);
21834
21863
  if (!bindParent) {
21835
- throw Error("[Varlet] Steps: <step/> must in <steps>");
21864
+ error$1("Steps", "<step/> must in <steps>");
21836
21865
  }
21837
21866
  return {
21838
21867
  index,
@@ -22423,7 +22452,7 @@ function useTabs() {
22423
22452
  index
22424
22453
  } = useParent(TABS_BIND_TAB_KEY);
22425
22454
  if (!bindParent) {
22426
- throw Error("<var-tab/> must in <var-tabs/>");
22455
+ error$1("Tab", "<var-tab/> must in <var-tabs/>");
22427
22456
  }
22428
22457
  return {
22429
22458
  index,
@@ -22556,7 +22585,7 @@ function useTabsItems() {
22556
22585
  index
22557
22586
  } = useParent(TABS_ITEMS_BIND_TAB_ITEM_KEY);
22558
22587
  if (!bindParent) {
22559
- throw Error("<var-tab-item/> must in <var-tabs-items/>");
22588
+ error$1("TabItem", "<var-tab-item/> must in <var-tabs-items/>");
22560
22589
  }
22561
22590
  return {
22562
22591
  index,
@@ -25017,7 +25046,7 @@ const TimePickerSfc = "";
25017
25046
  const TooltipSfc = "";
25018
25047
  const uploader = "";
25019
25048
  const UploaderSfc = "";
25020
- const version = "2.9.3";
25049
+ const version = "2.9.4-alpha.1679927847009";
25021
25050
  function install(app) {
25022
25051
  ActionSheet.install && app.use(ActionSheet);
25023
25052
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.9.3",
3
+ "version": "2.9.4-alpha.1679927847009",
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.9.3",
50
- "@varlet/shared": "2.9.3",
51
- "@varlet/use": "2.9.3"
49
+ "@varlet/shared": "2.9.4-alpha.1679927847009",
50
+ "@varlet/icons": "2.9.4-alpha.1679927847009",
51
+ "@varlet/use": "2.9.4-alpha.1679927847009"
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.25",
65
65
  "vue-router": "4.0.12",
66
- "@varlet/cli": "2.9.3",
67
- "@varlet/touch-emulator": "2.9.3"
66
+ "@varlet/cli": "2.9.4-alpha.1679927847009",
67
+ "@varlet/touch-emulator": "2.9.4-alpha.1679927847009"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",