@varlet/ui 2.8.6-alpha.1678026868230 → 2.8.6

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.8.6-alpha.1678026868230",
4
+ "version": "2.8.6",
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.8.6-alpha.1678026868230",
4
+ "version": "2.8.6",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
package/lib/varlet.cjs.js CHANGED
@@ -5869,11 +5869,7 @@ var __sfc__$U = vue.defineComponent({
5869
5869
  name: "VarCountdown",
5870
5870
  props: props$L,
5871
5871
  setup(props2) {
5872
- var endTime = vue.ref(0);
5873
- var isStart = vue.ref(false);
5874
5872
  var showTime = vue.ref("");
5875
- var handle = vue.ref(0);
5876
- var pauseTime = vue.ref(0);
5877
5873
  var timeData = vue.ref({
5878
5874
  days: 0,
5879
5875
  hours: 0,
@@ -5881,6 +5877,10 @@ var __sfc__$U = vue.defineComponent({
5881
5877
  seconds: 0,
5882
5878
  milliseconds: 0
5883
5879
  });
5880
+ var endTime = 0;
5881
+ var isStart = false;
5882
+ var handle = 0;
5883
+ var remainingTime = 0;
5884
5884
  var cacheIsStart;
5885
5885
  var parseFormat = (format2, time) => {
5886
5886
  var scannedTimes = Object.values(time);
@@ -5905,7 +5905,7 @@ var __sfc__$U = vue.defineComponent({
5905
5905
  }
5906
5906
  return format2;
5907
5907
  };
5908
- var formatTime = (durationTime) => {
5908
+ var displayTime = (durationTime) => {
5909
5909
  var days = Math.floor(durationTime / DAY);
5910
5910
  var hours = Math.floor(durationTime % DAY / HOUR);
5911
5911
  var minutes = Math.floor(durationTime % HOUR / MINUTE);
@@ -5925,59 +5925,65 @@ var __sfc__$U = vue.defineComponent({
5925
5925
  var countdown = () => {
5926
5926
  var {
5927
5927
  time,
5928
- onEnd,
5929
- autoStart
5928
+ onEnd
5930
5929
  } = props2;
5931
5930
  var now = performance.now();
5932
- if (!endTime.value) {
5933
- endTime.value = now + toNumber(time);
5931
+ if (!endTime) {
5932
+ endTime = now + toNumber(time);
5934
5933
  }
5935
- var durationTime = endTime.value - now;
5936
- if (durationTime < 0) {
5937
- durationTime = 0;
5934
+ remainingTime = endTime - now;
5935
+ if (remainingTime < 0) {
5936
+ remainingTime = 0;
5938
5937
  }
5939
- pauseTime.value = durationTime;
5940
- formatTime(durationTime);
5941
- if (durationTime === 0) {
5938
+ displayTime(remainingTime);
5939
+ if (remainingTime === 0) {
5942
5940
  call(onEnd);
5943
5941
  return;
5944
5942
  }
5945
- if (autoStart || isStart.value) {
5946
- handle.value = requestAnimationFrame(countdown);
5943
+ if (isStart) {
5944
+ handle = requestAnimationFrame(countdown);
5947
5945
  }
5948
5946
  };
5949
- var start2 = () => {
5950
- if (isStart.value) {
5947
+ var start2 = function(resume) {
5948
+ if (resume === void 0) {
5949
+ resume = false;
5950
+ }
5951
+ if (isStart && !resume) {
5951
5952
  return;
5952
5953
  }
5953
- isStart.value = true;
5954
- endTime.value = performance.now() + (pauseTime.value || toNumber(props2.time));
5954
+ isStart = true;
5955
+ endTime = performance.now() + (remainingTime || toNumber(props2.time));
5955
5956
  countdown();
5956
5957
  };
5957
5958
  var pause = () => {
5958
- isStart.value = false;
5959
- cancelAnimationFrame(handle.value);
5959
+ isStart = false;
5960
+ cancelAnimationFrame(handle);
5960
5961
  };
5961
5962
  var reset = () => {
5962
- endTime.value = 0;
5963
- isStart.value = false;
5964
- cancelAnimationFrame(handle.value);
5963
+ endTime = 0;
5964
+ isStart = false;
5965
+ cancelAnimationFrame(handle);
5965
5966
  countdown();
5966
5967
  };
5967
- vue.watch(() => props2.time, reset, {
5968
+ vue.watch(() => props2.time, () => {
5969
+ reset();
5970
+ if (props2.autoStart) {
5971
+ start2();
5972
+ }
5973
+ }, {
5968
5974
  immediate: true
5969
5975
  });
5970
5976
  vue.onActivated(() => {
5971
5977
  if (cacheIsStart == null) {
5972
5978
  return;
5973
5979
  }
5974
- isStart.value = cacheIsStart;
5975
- if (isStart.value === true) {
5976
- countdown();
5980
+ isStart = cacheIsStart;
5981
+ if (isStart === true) {
5982
+ start2(true);
5977
5983
  }
5978
5984
  });
5979
5985
  vue.onDeactivated(() => {
5980
- cacheIsStart = isStart.value;
5986
+ cacheIsStart = isStart;
5981
5987
  pause();
5982
5988
  });
5983
5989
  vue.onUnmounted(pause);
@@ -24513,7 +24519,7 @@ const TimePickerSfc = "";
24513
24519
  const TooltipSfc = "";
24514
24520
  const uploader = "";
24515
24521
  const UploaderSfc = "";
24516
- const version = "2.8.6-alpha.1678026868230";
24522
+ const version = "2.8.6";
24517
24523
  function install(app) {
24518
24524
  ActionSheet.install && app.use(ActionSheet);
24519
24525
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.8.6-alpha.1678026868230",
3
+ "version": "2.8.6",
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.8.6-alpha.1678026868230",
50
- "@varlet/shared": "2.8.6-alpha.1678026868230",
51
- "@varlet/use": "2.8.6-alpha.1678026868230"
49
+ "@varlet/icons": "2.8.6",
50
+ "@varlet/use": "2.8.6",
51
+ "@varlet/shared": "2.8.6"
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.8.6-alpha.1678026868230",
67
- "@varlet/touch-emulator": "2.8.6-alpha.1678026868230"
66
+ "@varlet/cli": "2.8.6",
67
+ "@varlet/touch-emulator": "2.8.6"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",