time-runner 1.0.0 → 1.0.2
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/README.md +20 -3
- package/dist/TimeRunner.d.ts +1 -1
- package/dist/time-runner.css +1 -1
- package/dist/time-runner.es.js +197 -190
- package/dist/time-runner.umd.js +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -20,13 +20,13 @@ yarn add time-runner
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## 页面引入
|
|
23
|
-
```
|
|
23
|
+
```jsx
|
|
24
24
|
import { TimeRunner } from "time-runner";
|
|
25
25
|
import "time-runner/dist/time-runner.css";
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## 使用说明
|
|
29
|
-
```
|
|
29
|
+
```jsx
|
|
30
30
|
|
|
31
31
|
// 当前时间
|
|
32
32
|
<TimeRunner />
|
|
@@ -60,7 +60,7 @@ import "time-runner/dist/time-runner.css";
|
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
### 组件属性(props)
|
|
63
|
-
```
|
|
63
|
+
```jsx
|
|
64
64
|
/**
|
|
65
65
|
* 显示模式,默认:default
|
|
66
66
|
* default: 当前时间
|
|
@@ -73,6 +73,7 @@ showType?: string;
|
|
|
73
73
|
* card:卡片
|
|
74
74
|
* cube-v:上下翻转
|
|
75
75
|
* cube-h:左右翻转
|
|
76
|
+
* drift:漂浮
|
|
76
77
|
*/
|
|
77
78
|
mode?: TransMode;
|
|
78
79
|
/** 倒计时结束后执行的方法 */
|
|
@@ -97,8 +98,24 @@ borderColor?: string;
|
|
|
97
98
|
"YYYY/MM/DD HH:mm:ss",
|
|
98
99
|
```
|
|
99
100
|
|
|
101
|
+
### React版本
|
|
102
|
+
```
|
|
103
|
+
"react": ">=16.8.0",
|
|
104
|
+
"react-dom": ">=16.8.0"
|
|
105
|
+
```
|
|
106
|
+
|
|
100
107
|
|
|
101
108
|
# 更新日志
|
|
102
109
|
|
|
110
|
+
## [1.0.2] - 2025-10-11
|
|
111
|
+
### 更新内容
|
|
112
|
+
- 增加 mode = "drift" 效果
|
|
113
|
+
- 更新Readme内容
|
|
114
|
+
|
|
115
|
+
## [1.0.1] - 2025-10-07
|
|
116
|
+
### 更新内容
|
|
117
|
+
- 更新readme内容
|
|
118
|
+
|
|
119
|
+
|
|
103
120
|
## [1.0.0] - 2025-10-07
|
|
104
121
|
### 首次发布
|
package/dist/TimeRunner.d.ts
CHANGED
package/dist/time-runner.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.time-runner{width:max-content;display:flex;justify-content:space-between;align-items:center;margin:0 auto;-webkit-user-select:none;user-select:none;position:relative;font-variant-numeric:tabular-nums}.time-runner span{font-size:var(--card-size, 40px);margin:0 3px;padding-bottom:3px;display:inline-block}.time-runner>p{margin:0 3px}.time-runner>div{font-size:var(--card-size, 40px)}.time-runner>div>p{color:#333}.clock-card{position:relative;height:var(--card-h, 80px);width:var(--card-w, 50px);box-shadow:0 1px 5px #333;border-radius:6px}.clock-card:before{content:"";position:absolute;top:50%;left:0;background-color:#999;width:100%;height:1.5px;z-index:3;overflow:hidden}.clock-card .clock-f,.clock-card .clock-b{width:100%;height:100%;position:absolute;top:0;left:0}.clock-card .clock-f p,.clock-card .clock-b p{position:absolute;left:0;height:50%;width:100%;margin-bottom:0;text-align:center;font-size:var(--card-size, 40px);background-color:var(--bgColor, #333);color:#fff;overflow:hidden;border-left:solid 1px var(--borderColor, #999);border-right:solid 1px var(--borderColor, #999)}.clock-card .clock-f p:nth-child(1),.clock-card .clock-b p:nth-child(1){top:0;border-top:solid 1px var(--borderColor, #999)}.clock-card .clock-f p:nth-child(2),.clock-card .clock-b p:nth-child(2){bottom:0;border-bottom:solid 1px var(--borderColor, #999)}.clock-card .clock-f p:nth-child(1){line-height:calc(var(--card-h, 80px) - 2px);transform-origin:bottom;backface-visibility:hidden;border-radius:7px 7px 0 0}.clock-card .clock-f p:nth-child(2){line-height:2px;border-radius:0 0 6px 6px}.clock-card .clock-f.run p:nth-child(1){transition:var(--delay) ease-in-out;transform:perspective(50px) rotateX(-180deg)}.clock-card .clock-b p:nth-child(1){line-height:calc(var(--card-h, 80px) - 2px);border-radius:7px 7px 0 0}.clock-card .clock-b p:nth-child(2){line-height:2px;transform-origin:top;transform:perspective(50px) rotateX(179.99deg);backface-visibility:hidden;border-radius:0 0 6px 6px}.clock-card .clock-b.run p:nth-child(2){transition:var(--delay) ease-in-out;transform:rotateX(0);z-index:2}.
|
|
1
|
+
.time-runner{width:max-content;display:flex;justify-content:space-between;align-items:center;margin:0 auto;-webkit-user-select:none;user-select:none;position:relative;font-variant-numeric:tabular-nums}.time-runner span{font-size:var(--card-size, 40px);margin:0 3px;padding-bottom:3px;display:inline-block}.time-runner>p{margin:0 3px}.time-runner>div{font-size:var(--card-size, 40px)}.time-runner>div>p{color:#333}.clock-card{position:relative;height:var(--card-h, 80px);width:var(--card-w, 50px);box-shadow:0 1px 5px #333;border-radius:6px}.clock-card:before{content:"";position:absolute;top:50%;left:0;background-color:#999;width:100%;height:1.5px;z-index:3;overflow:hidden}.clock-card .clock-f,.clock-card .clock-b{width:100%;height:100%;position:absolute;top:0;left:0}.clock-card .clock-f p,.clock-card .clock-b p{position:absolute;left:0;height:50%;width:100%;margin-bottom:0;text-align:center;font-size:var(--card-size, 40px);background-color:var(--bgColor, #333);color:#fff;overflow:hidden;border-left:solid 1px var(--borderColor, #999);border-right:solid 1px var(--borderColor, #999)}.clock-card .clock-f p:nth-child(1),.clock-card .clock-b p:nth-child(1){top:0;border-top:solid 1px var(--borderColor, #999)}.clock-card .clock-f p:nth-child(2),.clock-card .clock-b p:nth-child(2){bottom:0;border-bottom:solid 1px var(--borderColor, #999)}.clock-card .clock-f p:nth-child(1){line-height:calc(var(--card-h, 80px) - 2px);transform-origin:bottom;backface-visibility:hidden;border-radius:7px 7px 0 0}.clock-card .clock-f p:nth-child(2){line-height:2px;border-radius:0 0 6px 6px}.clock-card .clock-f.run p:nth-child(1){transition:var(--delay) ease-in-out;transform:perspective(50px) rotateX(-180deg)}.clock-card .clock-b p:nth-child(1){line-height:calc(var(--card-h, 80px) - 2px);border-radius:7px 7px 0 0}.clock-card .clock-b p:nth-child(2){line-height:2px;transform-origin:top;transform:perspective(50px) rotateX(179.99deg);backface-visibility:hidden;border-radius:0 0 6px 6px}.clock-card .clock-b.run p:nth-child(2){transition:var(--delay) ease-in-out;transform:rotateX(0);z-index:2}.cube-v{width:var(--card-w, 50px);height:var(--card-h, 80px);position:relative;perspective:300px}.cube-v div{width:100%;height:100%;transform-style:preserve-3d;transform-origin:center center var(--transy)}.cube-v p{width:100%;height:100%;line-height:var(--card-h, 80px);text-align:center;font-size:var(--card-size, 40px);background-color:var(--bgColor, #333);border:solid 1px var(--borderColor, #999);color:#fff;margin-bottom:0;box-shadow:0 1px 2px #333;border-radius:2px}.cube-v p:nth-child(1){position:absolute;transform-origin:0 100%;transform:translateY(-100%) rotateX(90deg)}.cube-v.run div{transform:rotateX(-90deg);transition:var(--delay)}.cube-h{width:var(--card-w, 50px);height:var(--card-h, 80px);position:relative;perspective:300px}.cube-h div{width:100%;height:100%;transform-style:preserve-3d;transform-origin:center center var(--transx)}.cube-h p{width:100%;height:100%;line-height:var(--card-h, 80px);text-align:center;font-size:var(--card-size, 40px);background-color:var(--bgColor, #333);border:solid 1px var(--borderColor, #999);color:#fff;margin-bottom:0;box-shadow:0 1px 2px #333;border-radius:2px}.cube-h p:nth-child(1){position:absolute;transform-origin:100% 0;transform:translate(-100%) rotateY(-90deg)}.cube-h.run div{transform:rotateY(90deg);transition:var(--delay)}.drift{height:var(--card-h, 80px);width:var(--card-w, 50px);font-size:var(--card-size, 40px);background-color:var(--bgColor, #333);line-height:var(--card-h, 80px);text-align:center;border:solid 1px var(--borderColor, #999);color:#fff;box-shadow:0 1px 2px #333;border-radius:2px;position:relative}.drift:before{content:attr(data-digit);position:absolute;top:0;left:0;line-height:var(--card-h, 80px);width:100%;text-align:center;overflow:hidden;height:100%;background-color:var(--bgColor, #333);transform-origin:center}.drift.run:before{transform:translate(var(--driftX),var(--driftY)) rotate(var(--driftRZ)) rotateX(var(--driftRX));opacity:0;transition:var(--delay);border:solid 2px var(--borderColor, #999)}
|
package/dist/time-runner.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as ft, useState as ct, useRef as lt, useEffect as
|
|
3
|
-
function
|
|
4
|
-
return
|
|
1
|
+
import { jsx as o, Fragment as et, jsxs as W } from "react/jsx-runtime";
|
|
2
|
+
import { memo as ft, useState as ct, useRef as lt, useMemo as ht, useEffect as G } from "react";
|
|
3
|
+
function mt(M) {
|
|
4
|
+
return M && M.__esModule && Object.prototype.hasOwnProperty.call(M, "default") ? M.default : M;
|
|
5
5
|
}
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
return it || (it = 1, (function(
|
|
9
|
-
(function(
|
|
10
|
-
|
|
11
|
-
})(
|
|
12
|
-
var
|
|
6
|
+
var Q = { exports: {} }, $t = Q.exports, it;
|
|
7
|
+
function Mt() {
|
|
8
|
+
return it || (it = 1, (function(M, l) {
|
|
9
|
+
(function(d, f) {
|
|
10
|
+
M.exports = f();
|
|
11
|
+
})($t, (function() {
|
|
12
|
+
var d = 1e3, f = 6e4, Y = 36e5, S = "millisecond", _ = "second", y = "minute", O = "hour", H = "day", h = "week", m = "month", J = "quarter", p = "year", w = "date", R = "Invalid Date", q = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, K = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, x = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(s) {
|
|
13
13
|
var r = ["th", "st", "nd", "rd"], t = s % 100;
|
|
14
14
|
return "[" + s + (r[(t - 20) % 10] || r[t] || r[0]) + "]";
|
|
15
15
|
} }, A = function(s, r, t) {
|
|
@@ -20,40 +20,40 @@ function $t() {
|
|
|
20
20
|
return (r <= 0 ? "+" : "-") + A(n, 2, "0") + ":" + A(e, 2, "0");
|
|
21
21
|
}, m: function s(r, t) {
|
|
22
22
|
if (r.date() < t.date()) return -s(t, r);
|
|
23
|
-
var n = 12 * (t.year() - r.year()) + (t.month() - r.month()), e = r.clone().add(n,
|
|
23
|
+
var n = 12 * (t.year() - r.year()) + (t.month() - r.month()), e = r.clone().add(n, m), i = t - e < 0, a = r.clone().add(n + (i ? -1 : 1), m);
|
|
24
24
|
return +(-(n + (t - e) / (i ? e - a : a - e)) || 0);
|
|
25
25
|
}, a: function(s) {
|
|
26
26
|
return s < 0 ? Math.ceil(s) || 0 : Math.floor(s);
|
|
27
27
|
}, p: function(s) {
|
|
28
|
-
return { M:
|
|
28
|
+
return { M: m, y: p, w: h, d: H, D: w, h: O, m: y, s: _, ms: S, Q: J }[s] || String(s || "").toLowerCase().replace(/s$/, "");
|
|
29
29
|
}, u: function(s) {
|
|
30
30
|
return s === void 0;
|
|
31
|
-
} }, j = "en",
|
|
32
|
-
|
|
31
|
+
} }, j = "en", k = {};
|
|
32
|
+
k[j] = x;
|
|
33
33
|
var nt = "$isDayjsObject", tt = function(s) {
|
|
34
|
-
return s instanceof
|
|
34
|
+
return s instanceof X || !(!s || !s[nt]);
|
|
35
35
|
}, P = function s(r, t, n) {
|
|
36
36
|
var e;
|
|
37
37
|
if (!r) return j;
|
|
38
38
|
if (typeof r == "string") {
|
|
39
39
|
var i = r.toLowerCase();
|
|
40
|
-
|
|
40
|
+
k[i] && (e = i), t && (k[i] = t, e = i);
|
|
41
41
|
var a = r.split("-");
|
|
42
42
|
if (!e && a.length > 1) return s(a[0]);
|
|
43
43
|
} else {
|
|
44
|
-
var
|
|
45
|
-
|
|
44
|
+
var c = r.name;
|
|
45
|
+
k[c] = r, e = c;
|
|
46
46
|
}
|
|
47
47
|
return !n && e && (j = e), e || !n && j;
|
|
48
|
-
},
|
|
48
|
+
}, D = function(s, r) {
|
|
49
49
|
if (tt(s)) return s.clone();
|
|
50
50
|
var t = typeof r == "object" ? r : {};
|
|
51
|
-
return t.date = s, t.args = arguments, new
|
|
51
|
+
return t.date = s, t.args = arguments, new X(t);
|
|
52
52
|
}, u = z;
|
|
53
53
|
u.l = P, u.i = tt, u.w = function(s, r) {
|
|
54
|
-
return
|
|
54
|
+
return D(s, { locale: r.$L, utc: r.$u, x: r.$x, $offset: r.$offset });
|
|
55
55
|
};
|
|
56
|
-
var
|
|
56
|
+
var X = (function() {
|
|
57
57
|
function s(t) {
|
|
58
58
|
this.$L = P(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[nt] = !0;
|
|
59
59
|
}
|
|
@@ -67,8 +67,8 @@ function $t() {
|
|
|
67
67
|
if (typeof e == "string" && !/Z$/i.test(e)) {
|
|
68
68
|
var a = e.match(q);
|
|
69
69
|
if (a) {
|
|
70
|
-
var
|
|
71
|
-
return i ? new Date(Date.UTC(a[1],
|
|
70
|
+
var c = a[2] - 1 || 0, $ = (a[7] || "0").substring(0, 3);
|
|
71
|
+
return i ? new Date(Date.UTC(a[1], c, a[3] || 1, a[4] || 0, a[5] || 0, a[6] || 0, $)) : new Date(a[1], c, a[3] || 1, a[4] || 0, a[5] || 0, a[6] || 0, $);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return new Date(e);
|
|
@@ -79,14 +79,14 @@ function $t() {
|
|
|
79
79
|
}, r.$utils = function() {
|
|
80
80
|
return u;
|
|
81
81
|
}, r.isValid = function() {
|
|
82
|
-
return this.$d.toString() !==
|
|
82
|
+
return this.$d.toString() !== R;
|
|
83
83
|
}, r.isSame = function(t, n) {
|
|
84
|
-
var e =
|
|
84
|
+
var e = D(t);
|
|
85
85
|
return this.startOf(n) <= e && e <= this.endOf(n);
|
|
86
86
|
}, r.isAfter = function(t, n) {
|
|
87
|
-
return
|
|
87
|
+
return D(t) < this.startOf(n);
|
|
88
88
|
}, r.isBefore = function(t, n) {
|
|
89
|
-
return this.endOf(n) <
|
|
89
|
+
return this.endOf(n) < D(t);
|
|
90
90
|
}, r.$g = function(t, n, e) {
|
|
91
91
|
return u.u(t) ? this[n] : this.set(e, t);
|
|
92
92
|
}, r.unix = function() {
|
|
@@ -94,40 +94,40 @@ function $t() {
|
|
|
94
94
|
}, r.valueOf = function() {
|
|
95
95
|
return this.$d.getTime();
|
|
96
96
|
}, r.startOf = function(t, n) {
|
|
97
|
-
var e = this, i = !!u.u(n) || n, a = u.p(t),
|
|
98
|
-
var C = u.w(e.$u ? Date.UTC(e.$y,
|
|
99
|
-
return i ? C : C.endOf(
|
|
100
|
-
},
|
|
101
|
-
return u.w(e.toDate()[N].apply(e.toDate("s"), (i ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(
|
|
102
|
-
},
|
|
97
|
+
var e = this, i = !!u.u(n) || n, a = u.p(t), c = function(N, b) {
|
|
98
|
+
var C = u.w(e.$u ? Date.UTC(e.$y, b, N) : new Date(e.$y, b, N), e);
|
|
99
|
+
return i ? C : C.endOf(H);
|
|
100
|
+
}, $ = function(N, b) {
|
|
101
|
+
return u.w(e.toDate()[N].apply(e.toDate("s"), (i ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(b)), e);
|
|
102
|
+
}, v = this.$W, g = this.$M, T = this.$D, F = "set" + (this.$u ? "UTC" : "");
|
|
103
103
|
switch (a) {
|
|
104
|
-
case
|
|
105
|
-
return i ?
|
|
106
|
-
case
|
|
107
|
-
return i ?
|
|
108
|
-
case
|
|
109
|
-
var L = this.$locale().weekStart || 0,
|
|
110
|
-
return
|
|
111
|
-
case
|
|
112
|
-
case
|
|
113
|
-
return
|
|
114
|
-
case f:
|
|
115
|
-
return h(F + "Minutes", 1);
|
|
104
|
+
case p:
|
|
105
|
+
return i ? c(1, 0) : c(31, 11);
|
|
106
|
+
case m:
|
|
107
|
+
return i ? c(1, g) : c(0, g + 1);
|
|
108
|
+
case h:
|
|
109
|
+
var L = this.$locale().weekStart || 0, V = (v < L ? v + 7 : v) - L;
|
|
110
|
+
return c(i ? T - V : T + (6 - V), g);
|
|
111
|
+
case H:
|
|
112
|
+
case w:
|
|
113
|
+
return $(F + "Hours", 0);
|
|
116
114
|
case O:
|
|
117
|
-
return
|
|
118
|
-
case
|
|
119
|
-
return
|
|
115
|
+
return $(F + "Minutes", 1);
|
|
116
|
+
case y:
|
|
117
|
+
return $(F + "Seconds", 2);
|
|
118
|
+
case _:
|
|
119
|
+
return $(F + "Milliseconds", 3);
|
|
120
120
|
default:
|
|
121
121
|
return this.clone();
|
|
122
122
|
}
|
|
123
123
|
}, r.endOf = function(t) {
|
|
124
124
|
return this.startOf(t, !1);
|
|
125
125
|
}, r.$set = function(t, n) {
|
|
126
|
-
var e, i = u.p(t), a = "set" + (this.$u ? "UTC" : ""),
|
|
127
|
-
if (i ===
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
} else
|
|
126
|
+
var e, i = u.p(t), a = "set" + (this.$u ? "UTC" : ""), c = (e = {}, e[H] = a + "Date", e[w] = a + "Date", e[m] = a + "Month", e[p] = a + "FullYear", e[O] = a + "Hours", e[y] = a + "Minutes", e[_] = a + "Seconds", e[S] = a + "Milliseconds", e)[i], $ = i === H ? this.$D + (n - this.$W) : n;
|
|
127
|
+
if (i === m || i === p) {
|
|
128
|
+
var v = this.clone().set(w, 1);
|
|
129
|
+
v.$d[c]($), v.init(), this.$d = v.set(w, Math.min(this.$D, v.daysInMonth())).$d;
|
|
130
|
+
} else c && this.$d[c]($);
|
|
131
131
|
return this.init(), this;
|
|
132
132
|
}, r.set = function(t, n) {
|
|
133
133
|
return this.clone().$set(t, n);
|
|
@@ -136,30 +136,30 @@ function $t() {
|
|
|
136
136
|
}, r.add = function(t, n) {
|
|
137
137
|
var e, i = this;
|
|
138
138
|
t = Number(t);
|
|
139
|
-
var a = u.p(n),
|
|
140
|
-
var T =
|
|
141
|
-
return u.w(T.date(T.date() + Math.round(
|
|
139
|
+
var a = u.p(n), c = function(g) {
|
|
140
|
+
var T = D(i);
|
|
141
|
+
return u.w(T.date(T.date() + Math.round(g * t)), i);
|
|
142
142
|
};
|
|
143
|
-
if (a ===
|
|
144
|
-
if (a ===
|
|
145
|
-
if (a ===
|
|
146
|
-
if (a ===
|
|
147
|
-
var
|
|
148
|
-
return u.w(
|
|
143
|
+
if (a === m) return this.set(m, this.$M + t);
|
|
144
|
+
if (a === p) return this.set(p, this.$y + t);
|
|
145
|
+
if (a === H) return c(1);
|
|
146
|
+
if (a === h) return c(7);
|
|
147
|
+
var $ = (e = {}, e[y] = f, e[O] = Y, e[_] = d, e)[a] || 1, v = this.$d.getTime() + t * $;
|
|
148
|
+
return u.w(v, this);
|
|
149
149
|
}, r.subtract = function(t, n) {
|
|
150
150
|
return this.add(-1 * t, n);
|
|
151
151
|
}, r.format = function(t) {
|
|
152
152
|
var n = this, e = this.$locale();
|
|
153
|
-
if (!this.isValid()) return e.invalidDate ||
|
|
154
|
-
var i = t || "YYYY-MM-DDTHH:mm:ssZ", a = u.z(this),
|
|
155
|
-
return
|
|
156
|
-
},
|
|
157
|
-
return u.s(
|
|
158
|
-
}, N = F || function(
|
|
159
|
-
var
|
|
160
|
-
return U ?
|
|
153
|
+
if (!this.isValid()) return e.invalidDate || R;
|
|
154
|
+
var i = t || "YYYY-MM-DDTHH:mm:ssZ", a = u.z(this), c = this.$H, $ = this.$m, v = this.$M, g = e.weekdays, T = e.months, F = e.meridiem, L = function(b, C, U, B) {
|
|
155
|
+
return b && (b[C] || b(n, i)) || U[C].slice(0, B);
|
|
156
|
+
}, V = function(b) {
|
|
157
|
+
return u.s(c % 12 || 12, b, "0");
|
|
158
|
+
}, N = F || function(b, C, U) {
|
|
159
|
+
var B = b < 12 ? "AM" : "PM";
|
|
160
|
+
return U ? B.toLowerCase() : B;
|
|
161
161
|
};
|
|
162
|
-
return i.replace(
|
|
162
|
+
return i.replace(K, (function(b, C) {
|
|
163
163
|
return C || (function(U) {
|
|
164
164
|
switch (U) {
|
|
165
165
|
case "YY":
|
|
@@ -167,13 +167,13 @@ function $t() {
|
|
|
167
167
|
case "YYYY":
|
|
168
168
|
return u.s(n.$y, 4, "0");
|
|
169
169
|
case "M":
|
|
170
|
-
return
|
|
170
|
+
return v + 1;
|
|
171
171
|
case "MM":
|
|
172
|
-
return u.s(
|
|
172
|
+
return u.s(v + 1, 2, "0");
|
|
173
173
|
case "MMM":
|
|
174
|
-
return L(e.monthsShort,
|
|
174
|
+
return L(e.monthsShort, v, T, 3);
|
|
175
175
|
case "MMMM":
|
|
176
|
-
return L(T,
|
|
176
|
+
return L(T, v);
|
|
177
177
|
case "D":
|
|
178
178
|
return n.$D;
|
|
179
179
|
case "DD":
|
|
@@ -181,27 +181,27 @@ function $t() {
|
|
|
181
181
|
case "d":
|
|
182
182
|
return String(n.$W);
|
|
183
183
|
case "dd":
|
|
184
|
-
return L(e.weekdaysMin, n.$W,
|
|
184
|
+
return L(e.weekdaysMin, n.$W, g, 2);
|
|
185
185
|
case "ddd":
|
|
186
|
-
return L(e.weekdaysShort, n.$W,
|
|
186
|
+
return L(e.weekdaysShort, n.$W, g, 3);
|
|
187
187
|
case "dddd":
|
|
188
|
-
return
|
|
188
|
+
return g[n.$W];
|
|
189
189
|
case "H":
|
|
190
|
-
return String(
|
|
190
|
+
return String(c);
|
|
191
191
|
case "HH":
|
|
192
|
-
return u.s(
|
|
192
|
+
return u.s(c, 2, "0");
|
|
193
193
|
case "h":
|
|
194
|
-
return
|
|
194
|
+
return V(1);
|
|
195
195
|
case "hh":
|
|
196
|
-
return
|
|
196
|
+
return V(2);
|
|
197
197
|
case "a":
|
|
198
|
-
return N(
|
|
198
|
+
return N(c, $, !0);
|
|
199
199
|
case "A":
|
|
200
|
-
return N(
|
|
200
|
+
return N(c, $, !1);
|
|
201
201
|
case "m":
|
|
202
|
-
return String(
|
|
202
|
+
return String($);
|
|
203
203
|
case "mm":
|
|
204
|
-
return u.s(
|
|
204
|
+
return u.s($, 2, "0");
|
|
205
205
|
case "s":
|
|
206
206
|
return String(n.$s);
|
|
207
207
|
case "ss":
|
|
@@ -212,47 +212,47 @@ function $t() {
|
|
|
212
212
|
return a;
|
|
213
213
|
}
|
|
214
214
|
return null;
|
|
215
|
-
})(
|
|
215
|
+
})(b) || a.replace(":", "");
|
|
216
216
|
}));
|
|
217
217
|
}, r.utcOffset = function() {
|
|
218
218
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
219
219
|
}, r.diff = function(t, n, e) {
|
|
220
|
-
var i, a = this,
|
|
221
|
-
return u.m(a,
|
|
220
|
+
var i, a = this, c = u.p(n), $ = D(t), v = ($.utcOffset() - this.utcOffset()) * f, g = this - $, T = function() {
|
|
221
|
+
return u.m(a, $);
|
|
222
222
|
};
|
|
223
|
-
switch (
|
|
224
|
-
case
|
|
223
|
+
switch (c) {
|
|
224
|
+
case p:
|
|
225
225
|
i = T() / 12;
|
|
226
226
|
break;
|
|
227
|
-
case
|
|
227
|
+
case m:
|
|
228
228
|
i = T();
|
|
229
229
|
break;
|
|
230
|
-
case
|
|
230
|
+
case J:
|
|
231
231
|
i = T() / 3;
|
|
232
232
|
break;
|
|
233
|
-
case
|
|
234
|
-
i = (
|
|
233
|
+
case h:
|
|
234
|
+
i = (g - v) / 6048e5;
|
|
235
235
|
break;
|
|
236
|
-
case
|
|
237
|
-
i = (
|
|
238
|
-
break;
|
|
239
|
-
case f:
|
|
240
|
-
i = y / Y;
|
|
236
|
+
case H:
|
|
237
|
+
i = (g - v) / 864e5;
|
|
241
238
|
break;
|
|
242
239
|
case O:
|
|
243
|
-
i =
|
|
240
|
+
i = g / Y;
|
|
241
|
+
break;
|
|
242
|
+
case y:
|
|
243
|
+
i = g / f;
|
|
244
244
|
break;
|
|
245
|
-
case
|
|
246
|
-
i =
|
|
245
|
+
case _:
|
|
246
|
+
i = g / d;
|
|
247
247
|
break;
|
|
248
248
|
default:
|
|
249
|
-
i =
|
|
249
|
+
i = g;
|
|
250
250
|
}
|
|
251
251
|
return e ? i : u.a(i);
|
|
252
252
|
}, r.daysInMonth = function() {
|
|
253
|
-
return this.endOf(
|
|
253
|
+
return this.endOf(m).$D;
|
|
254
254
|
}, r.$locale = function() {
|
|
255
|
-
return
|
|
255
|
+
return k[this.$L];
|
|
256
256
|
}, r.locale = function(t, n) {
|
|
257
257
|
if (!t) return this.$L;
|
|
258
258
|
var e = this.clone(), i = P(t, n, !0);
|
|
@@ -268,126 +268,133 @@ function $t() {
|
|
|
268
268
|
}, r.toString = function() {
|
|
269
269
|
return this.$d.toUTCString();
|
|
270
270
|
}, s;
|
|
271
|
-
})(), st =
|
|
272
|
-
return
|
|
271
|
+
})(), st = X.prototype;
|
|
272
|
+
return D.prototype = st, [["$ms", S], ["$s", _], ["$m", y], ["$H", O], ["$W", H], ["$M", m], ["$y", p], ["$D", w]].forEach((function(s) {
|
|
273
273
|
st[s[1]] = function(r) {
|
|
274
274
|
return this.$g(r, s[0], s[1]);
|
|
275
275
|
};
|
|
276
|
-
})),
|
|
277
|
-
return s.$i || (s(r,
|
|
278
|
-
},
|
|
279
|
-
return
|
|
280
|
-
},
|
|
276
|
+
})), D.extend = function(s, r) {
|
|
277
|
+
return s.$i || (s(r, X, D), s.$i = !0), D;
|
|
278
|
+
}, D.locale = P, D.isDayjs = tt, D.unix = function(s) {
|
|
279
|
+
return D(1e3 * s);
|
|
280
|
+
}, D.en = k[j], D.Ls = k, D.p = {}, D;
|
|
281
281
|
}));
|
|
282
|
-
})(
|
|
282
|
+
})(Q)), Q.exports;
|
|
283
283
|
}
|
|
284
|
-
var pt =
|
|
285
|
-
const
|
|
284
|
+
var pt = Mt();
|
|
285
|
+
const E = /* @__PURE__ */ mt(pt), Z = 60, Dt = [
|
|
286
286
|
"YYYY-MM-DD",
|
|
287
287
|
"YYYY/MM/DD",
|
|
288
288
|
"YYYY-MM-DD HH:mm",
|
|
289
289
|
"YYYY/MM/DD HH:mm",
|
|
290
290
|
"YYYY-MM-DD HH:mm:ss",
|
|
291
291
|
"YYYY/MM/DD HH:mm:ss"
|
|
292
|
-
], at = (
|
|
293
|
-
if (!rt(
|
|
292
|
+
], at = (M) => {
|
|
293
|
+
if (!rt(M))
|
|
294
294
|
return "00:00:00";
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
295
|
+
const l = E(M).diff(E());
|
|
296
|
+
if (l <= 0)
|
|
297
297
|
return "00:00:00";
|
|
298
|
-
const
|
|
299
|
-
return `${
|
|
300
|
-
}, ut = (
|
|
301
|
-
const
|
|
302
|
-
return `${
|
|
303
|
-
}, rt = (
|
|
304
|
-
const { mode:
|
|
305
|
-
|
|
306
|
-
),
|
|
298
|
+
const d = Math.floor(l / 1e3), f = Math.floor(d / 86400), Y = Math.floor(d % 86400 / 3600), S = Math.floor(d % 3600 / 60), _ = d % 60;
|
|
299
|
+
return `${f ? `${f}:` : ""}${`${Y}`.padStart(2, "0")}:${`${S}`.padStart(2, "0")}:${`${_}`.padStart(2, "0")}`;
|
|
300
|
+
}, ut = (M) => {
|
|
301
|
+
const l = (d) => `${d}`.padStart(2, "0");
|
|
302
|
+
return `${l(Math.floor(M / Z / Z))}:${l(Math.floor(M / Z) % Z)}:${l(M % Z)}`;
|
|
303
|
+
}, rt = (M) => Dt.some((l) => E(M, l, !0).isValid()), ot = "HH:mm:ss", dt = 900, St = (M) => {
|
|
304
|
+
const { mode: l, showType: d = "default", size: f = 40, className: Y, bgColor: S, borderColor: _, finishCountFn: y } = M, [O, H] = ct(
|
|
305
|
+
d === "count" ? ut(0) : d === "default" ? E().format(ot) : at(d)
|
|
306
|
+
), h = lt({
|
|
307
307
|
t: null
|
|
308
|
-
}),
|
|
309
|
-
"--card-size": `${
|
|
310
|
-
"--card-w": `${
|
|
311
|
-
"--card-h": `${
|
|
308
|
+
}), m = {
|
|
309
|
+
"--card-size": `${f}px`,
|
|
310
|
+
"--card-w": `${f * 1.25}px`,
|
|
311
|
+
"--card-h": `${f * 2}px`,
|
|
312
312
|
// 下面两个必须是一个确定的数字,不能是表达式
|
|
313
|
-
"--transx": `${-
|
|
314
|
-
"--transy": `${-
|
|
313
|
+
"--transx": `${-f * 1.25 / 2}px`,
|
|
314
|
+
"--transy": `${-f}px`,
|
|
315
315
|
"--delay": `${dt / 1e3}s`,
|
|
316
|
-
"--bgColor":
|
|
317
|
-
"--borderColor":
|
|
316
|
+
"--bgColor": S,
|
|
317
|
+
"--borderColor": _
|
|
318
318
|
};
|
|
319
|
-
|
|
320
|
-
let
|
|
321
|
-
|
|
322
|
-
let
|
|
323
|
-
|
|
319
|
+
G(() => {
|
|
320
|
+
let p = Date.now();
|
|
321
|
+
h.current.t && (clearInterval(h.current.t), h.current.t = null, p = Date.now()), h.current.t = setInterval(() => {
|
|
322
|
+
let w = () => "";
|
|
323
|
+
d === "count" ? w = () => ut(Math.floor((Date.now() - p) / 1e3)) : d === "default" ? w = () => E().format(ot) : w = () => at(d), H(w());
|
|
324
324
|
}, 1e3);
|
|
325
|
-
}, [
|
|
326
|
-
rt(
|
|
327
|
-
|
|
325
|
+
}, [d]), G(() => {
|
|
326
|
+
rt(d) && O === "00:00:00" && y && setTimeout(() => {
|
|
327
|
+
y();
|
|
328
328
|
}, 1e3);
|
|
329
|
-
}, [
|
|
330
|
-
const
|
|
331
|
-
if (!
|
|
329
|
+
}, [O, d, y]);
|
|
330
|
+
const J = () => {
|
|
331
|
+
if (!O)
|
|
332
332
|
return null;
|
|
333
|
-
const
|
|
333
|
+
const p = O.split(":"), w = p[p.length - 3].split(""), R = p[p.length - 2].split(""), q = p[p.length - 1].split(""), K = p.length === 4 ? p[0].split("") : [], x = rt(d), A = K.map((j, k) => /* @__PURE__ */ o(I, { mode: l, time: +j, limit: x ? -9 : 9, size: f }, k)), z = /* @__PURE__ */ o("span", { children: ":" });
|
|
334
334
|
return /* @__PURE__ */ W(et, { children: [
|
|
335
335
|
A.length ? /* @__PURE__ */ W(et, { children: [
|
|
336
336
|
A,
|
|
337
|
-
|
|
337
|
+
x ? /* @__PURE__ */ o("p", { children: "天" }) : z
|
|
338
338
|
] }) : null,
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
|
|
345
|
-
/* @__PURE__ */
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
-
|
|
339
|
+
/* @__PURE__ */ o(I, { mode: l, time: +w[0], limit: x ? -2 : 2, size: f }),
|
|
340
|
+
/* @__PURE__ */ o(I, { mode: l, time: +w[1], limit: x ? -9 : 9, size: f }),
|
|
341
|
+
x ? /* @__PURE__ */ o("p", { children: "小时" }) : z,
|
|
342
|
+
/* @__PURE__ */ o(I, { mode: l, time: +R[0], limit: x ? -5 : 5, size: f }),
|
|
343
|
+
/* @__PURE__ */ o(I, { mode: l, time: +R[1], limit: x ? -9 : 9, size: f }),
|
|
344
|
+
x ? /* @__PURE__ */ o("p", { children: "分" }) : z,
|
|
345
|
+
/* @__PURE__ */ o(I, { mode: l, time: +q[0], limit: x ? -5 : 5, size: f }),
|
|
346
|
+
/* @__PURE__ */ o(I, { mode: l, time: +q[1], limit: x ? -9 : 9, size: f }),
|
|
347
|
+
x && /* @__PURE__ */ o("p", { children: "秒" })
|
|
348
348
|
] });
|
|
349
349
|
};
|
|
350
|
-
return /* @__PURE__ */
|
|
351
|
-
},
|
|
352
|
-
const { time:
|
|
353
|
-
t:
|
|
354
|
-
})
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
350
|
+
return /* @__PURE__ */ o("div", { className: `time-runner ${Y || ""}`, style: m, children: J() });
|
|
351
|
+
}, vt = (M) => {
|
|
352
|
+
const { time: l, limit: d, mode: f, size: Y } = M, [S, _] = ct(!1), y = lt({
|
|
353
|
+
t: l
|
|
354
|
+
}), O = ht(() => l !== y.current.t ? {
|
|
355
|
+
"--driftX": `${Math.floor(Math.random() * (-Y - Y + 1)) + Y}px`,
|
|
356
|
+
"--driftY": `${Math.floor(Math.random() * (-Y * 2 - Y * 2 + 1)) + Y * 2}px`,
|
|
357
|
+
"--driftRZ": `${Math.floor(Math.random() * 151) + 50}deg`,
|
|
358
|
+
"--driftRX": `${Math.floor(Math.random() * 151) + 50}deg`
|
|
359
|
+
} : null, [l, Y]);
|
|
360
|
+
return G(() => {
|
|
361
|
+
l !== y.current.t && _(!0);
|
|
362
|
+
}, [l]), G(() => {
|
|
363
|
+
S && setTimeout(() => {
|
|
364
|
+
y.current.t = l, _(!1);
|
|
360
365
|
}, dt);
|
|
361
|
-
}, [
|
|
362
|
-
const { t:
|
|
363
|
-
let
|
|
364
|
-
switch (
|
|
366
|
+
}, [S, l]), /* @__PURE__ */ o(et, { children: (() => {
|
|
367
|
+
const { t: h } = y.current;
|
|
368
|
+
let m = h;
|
|
369
|
+
switch (d > 0 ? m = h >= d ? 0 : h + 1 : m = h <= 0 ? Math.abs(d) : h - 1, f) {
|
|
365
370
|
case "card":
|
|
366
371
|
return /* @__PURE__ */ W("div", { className: "clock-card", children: [
|
|
367
|
-
/* @__PURE__ */ W("div", { className: `clock-b ${
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ W("div", { className: `clock-b ${S ? "run" : ""}`, children: [
|
|
373
|
+
/* @__PURE__ */ o("p", { children: m }),
|
|
374
|
+
/* @__PURE__ */ o("p", { children: m })
|
|
370
375
|
] }),
|
|
371
|
-
/* @__PURE__ */ W("div", { className: `clock-f ${
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ W("div", { className: `clock-f ${S ? "run" : ""}`, children: [
|
|
377
|
+
/* @__PURE__ */ o("p", { children: h }),
|
|
378
|
+
/* @__PURE__ */ o("p", { children: h })
|
|
374
379
|
] })
|
|
375
380
|
] });
|
|
376
381
|
case "cube-v":
|
|
377
|
-
return /* @__PURE__ */
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
382
|
+
return /* @__PURE__ */ o("div", { className: `cube-v ${S ? "run" : ""}`, children: /* @__PURE__ */ W("div", { children: [
|
|
383
|
+
/* @__PURE__ */ o("p", { children: m }),
|
|
384
|
+
/* @__PURE__ */ o("p", { children: h })
|
|
380
385
|
] }) });
|
|
381
386
|
case "cube-h":
|
|
382
|
-
return /* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
387
|
+
return /* @__PURE__ */ o("div", { className: `cube-h ${S ? "run" : ""}`, children: /* @__PURE__ */ W("div", { children: [
|
|
388
|
+
/* @__PURE__ */ o("p", { children: m }),
|
|
389
|
+
/* @__PURE__ */ o("p", { children: h })
|
|
385
390
|
] }) });
|
|
391
|
+
case "drift":
|
|
392
|
+
return /* @__PURE__ */ o("div", { className: `drift ${S ? "run" : ""}`, "data-digit": h, style: O, children: m });
|
|
386
393
|
default:
|
|
387
|
-
return /* @__PURE__ */
|
|
394
|
+
return /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("p", { children: h }) });
|
|
388
395
|
}
|
|
389
396
|
})() });
|
|
390
|
-
}, I = ft(
|
|
397
|
+
}, I = ft(vt);
|
|
391
398
|
export {
|
|
392
|
-
|
|
399
|
+
St as TimeRunner
|
|
393
400
|
};
|
package/dist/time-runner.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(j,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],o):(j=typeof globalThis<"u"?globalThis:j||self,o(j["time-runner"]={},j.jsxRuntime,j.React))})(this,(function(j,o,H){"use strict";function ut($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var P={exports:{}},ft=P.exports,rt;function lt(){return rt||(rt=1,(function($,l){(function(f,v){$.exports=v()})(ft,(function(){var f=1e3,v=6e4,Y=36e5,x="millisecond",g="second",b="minute",d="hour",D="day",k="week",O="month",B="quarter",m="year",S="date",z="Invalid Date",Q=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,tt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(s){var r=["th","st","nd","rd"],t=s%100;return"["+s+(r[(t-20)%10]||r[t]||r[0])+"]"}},A=function(s,r,t){var n=String(s);return!n||n.length>=r?s:""+Array(r+1-n.length).join(t)+s},U={s:A,z:function(s){var r=-s.utcOffset(),t=Math.abs(r),n=Math.floor(t/60),e=t%60;return(r<=0?"+":"-")+A(n,2,"0")+":"+A(e,2,"0")},m:function s(r,t){if(r.date()<t.date())return-s(t,r);var n=12*(t.year()-r.year())+(t.month()-r.month()),e=r.clone().add(n,O),i=t-e<0,a=r.clone().add(n+(i?-1:1),O);return+(-(n+(t-e)/(i?e-a:a-e))||0)},a:function(s){return s<0?Math.ceil(s)||0:Math.floor(s)},p:function(s){return{M:O,y:m,w:k,d:D,D:S,h:d,m:b,s:g,ms:x,Q:B}[s]||String(s||"").toLowerCase().replace(/s$/,"")},u:function(s){return s===void 0}},F="en",C={};C[F]=T;var ot="$isDayjsObject",et=function(s){return s instanceof K||!(!s||!s[ot])},G=function s(r,t,n){var e;if(!r)return F;if(typeof r=="string"){var i=r.toLowerCase();C[i]&&(e=i),t&&(C[i]=t,e=i);var a=r.split("-");if(!e&&a.length>1)return s(a[0])}else{var u=r.name;C[u]=r,e=u}return!n&&e&&(F=e),e||!n&&F},p=function(s,r){if(et(s))return s.clone();var t=typeof r=="object"?r:{};return t.date=s,t.args=arguments,new K(t)},c=U;c.l=G,c.i=et,c.w=function(s,r){return p(s,{locale:r.$L,utc:r.$u,x:r.$x,$offset:r.$offset})};var K=(function(){function s(t){this.$L=G(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[ot]=!0}var r=s.prototype;return r.parse=function(t){this.$d=(function(n){var e=n.date,i=n.utc;if(e===null)return new Date(NaN);if(c.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var a=e.match(Q);if(a){var u=a[2]-1||0,h=(a[7]||"0").substring(0,3);return i?new Date(Date.UTC(a[1],u,a[3]||1,a[4]||0,a[5]||0,a[6]||0,h)):new Date(a[1],u,a[3]||1,a[4]||0,a[5]||0,a[6]||0,h)}}return new Date(e)})(t),this.init()},r.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},r.$utils=function(){return c},r.isValid=function(){return this.$d.toString()!==z},r.isSame=function(t,n){var e=p(t);return this.startOf(n)<=e&&e<=this.endOf(n)},r.isAfter=function(t,n){return p(t)<this.startOf(n)},r.isBefore=function(t,n){return this.endOf(n)<p(t)},r.$g=function(t,n,e){return c.u(t)?this[n]:this.set(e,t)},r.unix=function(){return Math.floor(this.valueOf()/1e3)},r.valueOf=function(){return this.$d.getTime()},r.startOf=function(t,n){var e=this,i=!!c.u(n)||n,a=c.p(t),u=function(W,w){var L=c.w(e.$u?Date.UTC(e.$y,w,W):new Date(e.$y,w,W),e);return i?L:L.endOf(D)},h=function(W,w){return c.w(e.toDate()[W].apply(e.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(w)),e)},M=this.$W,y=this.$M,_=this.$D,E="set"+(this.$u?"UTC":"");switch(a){case m:return i?u(1,0):u(31,11);case O:return i?u(1,y):u(0,y+1);case k:var I=this.$locale().weekStart||0,J=(M<I?M+7:M)-I;return u(i?_-J:_+(6-J),y);case D:case S:return h(E+"Hours",0);case d:return h(E+"Minutes",1);case b:return h(E+"Seconds",2);case g:return h(E+"Milliseconds",3);default:return this.clone()}},r.endOf=function(t){return this.startOf(t,!1)},r.$set=function(t,n){var e,i=c.p(t),a="set"+(this.$u?"UTC":""),u=(e={},e[D]=a+"Date",e[S]=a+"Date",e[O]=a+"Month",e[m]=a+"FullYear",e[d]=a+"Hours",e[b]=a+"Minutes",e[g]=a+"Seconds",e[x]=a+"Milliseconds",e)[i],h=i===D?this.$D+(n-this.$W):n;if(i===O||i===m){var M=this.clone().set(S,1);M.$d[u](h),M.init(),this.$d=M.set(S,Math.min(this.$D,M.daysInMonth())).$d}else u&&this.$d[u](h);return this.init(),this},r.set=function(t,n){return this.clone().$set(t,n)},r.get=function(t){return this[c.p(t)]()},r.add=function(t,n){var e,i=this;t=Number(t);var a=c.p(n),u=function(y){var _=p(i);return c.w(_.date(_.date()+Math.round(y*t)),i)};if(a===O)return this.set(O,this.$M+t);if(a===m)return this.set(m,this.$y+t);if(a===D)return u(1);if(a===k)return u(7);var h=(e={},e[b]=v,e[d]=Y,e[g]=f,e)[a]||1,M=this.$d.getTime()+t*h;return c.w(M,this)},r.subtract=function(t,n){return this.add(-1*t,n)},r.format=function(t){var n=this,e=this.$locale();if(!this.isValid())return e.invalidDate||z;var i=t||"YYYY-MM-DDTHH:mm:ssZ",a=c.z(this),u=this.$H,h=this.$m,M=this.$M,y=e.weekdays,_=e.months,E=e.meridiem,I=function(w,L,Z,X){return w&&(w[L]||w(n,i))||Z[L].slice(0,X)},J=function(w){return c.s(u%12||12,w,"0")},W=E||function(w,L,Z){var X=w<12?"AM":"PM";return Z?X.toLowerCase():X};return i.replace(tt,(function(w,L){return L||(function(Z){switch(Z){case"YY":return String(n.$y).slice(-2);case"YYYY":return c.s(n.$y,4,"0");case"M":return M+1;case"MM":return c.s(M+1,2,"0");case"MMM":return I(e.monthsShort,M,_,3);case"MMMM":return I(_,M);case"D":return n.$D;case"DD":return c.s(n.$D,2,"0");case"d":return String(n.$W);case"dd":return I(e.weekdaysMin,n.$W,y,2);case"ddd":return I(e.weekdaysShort,n.$W,y,3);case"dddd":return y[n.$W];case"H":return String(u);case"HH":return c.s(u,2,"0");case"h":return J(1);case"hh":return J(2);case"a":return W(u,h,!0);case"A":return W(u,h,!1);case"m":return String(h);case"mm":return c.s(h,2,"0");case"s":return String(n.$s);case"ss":return c.s(n.$s,2,"0");case"SSS":return c.s(n.$ms,3,"0");case"Z":return a}return null})(w)||a.replace(":","")}))},r.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},r.diff=function(t,n,e){var i,a=this,u=c.p(n),h=p(t),M=(h.utcOffset()-this.utcOffset())*v,y=this-h,_=function(){return c.m(a,h)};switch(u){case m:i=_()/12;break;case O:i=_();break;case B:i=_()/3;break;case k:i=(y-M)/6048e5;break;case D:i=(y-M)/864e5;break;case d:i=y/Y;break;case b:i=y/v;break;case g:i=y/f;break;default:i=y}return e?i:c.a(i)},r.daysInMonth=function(){return this.endOf(O).$D},r.$locale=function(){return C[this.$L]},r.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),i=G(t,n,!0);return i&&(e.$L=i),e},r.clone=function(){return c.w(this.$d,this)},r.toDate=function(){return new Date(this.valueOf())},r.toJSON=function(){return this.isValid()?this.toISOString():null},r.toISOString=function(){return this.$d.toISOString()},r.toString=function(){return this.$d.toUTCString()},s})(),ct=K.prototype;return p.prototype=ct,[["$ms",x],["$s",g],["$m",b],["$H",d],["$W",D],["$M",O],["$y",m],["$D",S]].forEach((function(s){ct[s[1]]=function(r){return this.$g(r,s[0],s[1])}})),p.extend=function(s,r){return s.$i||(s(r,K,p),s.$i=!0),p},p.locale=G,p.isDayjs=et,p.unix=function(s){return p(1e3*s)},p.en=C[F],p.Ls=C,p.p={},p}))})(P)),P.exports}var dt=lt();const V=ut(dt),q=60,ht=["YYYY-MM-DD","YYYY/MM/DD","YYYY-MM-DD HH:mm","YYYY/MM/DD HH:mm","YYYY-MM-DD HH:mm:ss","YYYY/MM/DD HH:mm:ss"],nt=$=>{if(!R($))return"00:00:00";const l=V($).diff(V());if(l<=0)return"00:00:00";const f=Math.floor(l/1e3),v=Math.floor(f/86400),Y=Math.floor(f%86400/3600),x=Math.floor(f%3600/60),g=f%60;return`${v?`${v}:`:""}${`${Y}`.padStart(2,"0")}:${`${x}`.padStart(2,"0")}:${`${g}`.padStart(2,"0")}`},st=$=>{const l=f=>`${f}`.padStart(2,"0");return`${l(Math.floor($/q/q))}:${l(Math.floor($/q)%q)}:${l($%q)}`},R=$=>ht.some(l=>V($,l,!0).isValid()),it="HH:mm:ss",at=900,$t=$=>{const{mode:l,showType:f="default",size:v=40,className:Y,bgColor:x,borderColor:g,finishCountFn:b}=$,[d,D]=H.useState(f==="count"?st(0):f==="default"?V().format(it):nt(f)),k=H.useRef({t:null}),O={"--card-size":`${v}px`,"--card-w":`${v*1.25}px`,"--card-h":`${v*2}px`,"--transx":`${-v*1.25/2}px`,"--transy":`${-v}px`,"--delay":`${at/1e3}s`,"--bgColor":x,"--borderColor":g};H.useEffect(()=>{let m=Date.now();k.current.t&&(clearInterval(k.current.t),k.current.t=null,m=Date.now()),k.current.t=setInterval(()=>{let S=()=>"";f==="count"?S=()=>st(Math.floor((Date.now()-m)/1e3)):f==="default"?S=()=>V().format(it):S=()=>nt(f),D(S())},1e3)},[f]),H.useEffect(()=>{R(f)&&d==="00:00:00"&&b&&setTimeout(()=>{b()},1e3)},[d,f,b]);const B=()=>{if(!d)return null;const m=d.split(":"),S=m[m.length-3].split(""),z=m[m.length-2].split(""),Q=m[m.length-1].split(""),tt=m.length===4?m[0].split(""):[],T=R(f),A=tt.map((F,C)=>o.jsx(N,{mode:l,time:+F,limit:T?-9:9},C)),U=o.jsx("span",{children:":"});return o.jsxs(o.Fragment,{children:[A.length?o.jsxs(o.Fragment,{children:[A,T?o.jsx("p",{children:"天"}):U]}):null,o.jsx(N,{mode:l,time:+S[0],limit:T?-2:2}),o.jsx(N,{mode:l,time:+S[1],limit:T?-9:9}),T?o.jsx("p",{children:"小时"}):U,o.jsx(N,{mode:l,time:+z[0],limit:T?-5:5}),o.jsx(N,{mode:l,time:+z[1],limit:T?-9:9}),T?o.jsx("p",{children:"分"}):U,o.jsx(N,{mode:l,time:+Q[0],limit:T?-5:5}),o.jsx(N,{mode:l,time:+Q[1],limit:T?-9:9}),T&&o.jsx("p",{children:"秒"})]})};return o.jsx("div",{className:`time-runner ${Y||""}`,style:O,children:B()})},mt=$=>{const{time:l,limit:f,mode:v}=$,[Y,x]=H.useState(!1),g=H.useRef({t:l});H.useEffect(()=>{l!==g.current.t&&x(!0)},[l]),H.useEffect(()=>{Y&&setTimeout(()=>{g.current.t=l,x(!1)},at)},[Y,l]);const b=()=>{const{t:d}=g.current;let D=d;switch(f>0?D=d>=f?0:d+1:D=d<=0?Math.abs(f):d-1,v){case"card":return o.jsxs("div",{className:"clock-card",children:[o.jsxs("div",{className:`clock-b ${Y?"run":""}`,children:[o.jsx("p",{children:D}),o.jsx("p",{children:D})]}),o.jsxs("div",{className:`clock-f ${Y?"run":""}`,children:[o.jsx("p",{children:d}),o.jsx("p",{children:d})]})]});case"cube-v":return o.jsx("div",{className:`clock-cube-3d-v ${Y?"run":""}`,children:o.jsxs("div",{children:[o.jsx("p",{children:D}),o.jsx("p",{children:d})]})});case"cube-h":return o.jsx("div",{className:`clock-cube-3d-h ${Y?"run":""}`,children:o.jsxs("div",{children:[o.jsx("p",{children:D}),o.jsx("p",{children:d})]})});default:return o.jsx("div",{children:o.jsx("p",{children:d})})}};return o.jsx(o.Fragment,{children:b()})},N=H.memo(mt);j.TimeRunner=$t,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(j,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],i):(j=typeof globalThis<"u"?globalThis:j||self,i(j["time-runner"]={},j.jsxRuntime,j.React))})(this,(function(j,i,k){"use strict";function ct(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}var P={exports:{}},ft=P.exports,rt;function dt(){return rt||(rt=1,(function(p,f){(function(d,l){p.exports=l()})(ft,(function(){var d=1e3,l=6e4,Y=36e5,S="millisecond",O="second",v="minute",T="hour",x="day",h="week",$="month",X="quarter",M="year",w="date",q="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,tt=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(s){var r=["th","st","nd","rd"],t=s%100;return"["+s+(r[(t-20)%10]||r[t]||r[0])+"]"}},A=function(s,r,t){var n=String(s);return!n||n.length>=r?s:""+Array(r+1-n.length).join(t)+s},U={s:A,z:function(s){var r=-s.utcOffset(),t=Math.abs(r),n=Math.floor(t/60),e=t%60;return(r<=0?"+":"-")+A(n,2,"0")+":"+A(e,2,"0")},m:function s(r,t){if(r.date()<t.date())return-s(t,r);var n=12*(t.year()-r.year())+(t.month()-r.month()),e=r.clone().add(n,$),a=t-e<0,o=r.clone().add(n+(a?-1:1),$);return+(-(n+(t-e)/(a?e-o:o-e))||0)},a:function(s){return s<0?Math.ceil(s)||0:Math.floor(s)},p:function(s){return{M:$,y:M,w:h,d:x,D:w,h:T,m:v,s:O,ms:S,Q:X}[s]||String(s||"").toLowerCase().replace(/s$/,"")},u:function(s){return s===void 0}},F="en",C={};C[F]=_;var ot="$isDayjsObject",et=function(s){return s instanceof G||!(!s||!s[ot])},Q=function s(r,t,n){var e;if(!r)return F;if(typeof r=="string"){var a=r.toLowerCase();C[a]&&(e=a),t&&(C[a]=t,e=a);var o=r.split("-");if(!e&&o.length>1)return s(o[0])}else{var c=r.name;C[c]=r,e=c}return!n&&e&&(F=e),e||!n&&F},y=function(s,r){if(et(s))return s.clone();var t=typeof r=="object"?r:{};return t.date=s,t.args=arguments,new G(t)},u=U;u.l=Q,u.i=et,u.w=function(s,r){return y(s,{locale:r.$L,utc:r.$u,x:r.$x,$offset:r.$offset})};var G=(function(){function s(t){this.$L=Q(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[ot]=!0}var r=s.prototype;return r.parse=function(t){this.$d=(function(n){var e=n.date,a=n.utc;if(e===null)return new Date(NaN);if(u.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var o=e.match(B);if(o){var c=o[2]-1||0,m=(o[7]||"0").substring(0,3);return a?new Date(Date.UTC(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,m)):new Date(o[1],c,o[3]||1,o[4]||0,o[5]||0,o[6]||0,m)}}return new Date(e)})(t),this.init()},r.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},r.$utils=function(){return u},r.isValid=function(){return this.$d.toString()!==q},r.isSame=function(t,n){var e=y(t);return this.startOf(n)<=e&&e<=this.endOf(n)},r.isAfter=function(t,n){return y(t)<this.startOf(n)},r.isBefore=function(t,n){return this.endOf(n)<y(t)},r.$g=function(t,n,e){return u.u(t)?this[n]:this.set(e,t)},r.unix=function(){return Math.floor(this.valueOf()/1e3)},r.valueOf=function(){return this.$d.getTime()},r.startOf=function(t,n){var e=this,a=!!u.u(n)||n,o=u.p(t),c=function(W,b){var L=u.w(e.$u?Date.UTC(e.$y,b,W):new Date(e.$y,b,W),e);return a?L:L.endOf(x)},m=function(W,b){return u.w(e.toDate()[W].apply(e.toDate("s"),(a?[0,0,0,0]:[23,59,59,999]).slice(b)),e)},D=this.$W,g=this.$M,H=this.$D,E="set"+(this.$u?"UTC":"");switch(o){case M:return a?c(1,0):c(31,11);case $:return a?c(1,g):c(0,g+1);case h:var I=this.$locale().weekStart||0,Z=(D<I?D+7:D)-I;return c(a?H-Z:H+(6-Z),g);case x:case w:return m(E+"Hours",0);case T:return m(E+"Minutes",1);case v:return m(E+"Seconds",2);case O:return m(E+"Milliseconds",3);default:return this.clone()}},r.endOf=function(t){return this.startOf(t,!1)},r.$set=function(t,n){var e,a=u.p(t),o="set"+(this.$u?"UTC":""),c=(e={},e[x]=o+"Date",e[w]=o+"Date",e[$]=o+"Month",e[M]=o+"FullYear",e[T]=o+"Hours",e[v]=o+"Minutes",e[O]=o+"Seconds",e[S]=o+"Milliseconds",e)[a],m=a===x?this.$D+(n-this.$W):n;if(a===$||a===M){var D=this.clone().set(w,1);D.$d[c](m),D.init(),this.$d=D.set(w,Math.min(this.$D,D.daysInMonth())).$d}else c&&this.$d[c](m);return this.init(),this},r.set=function(t,n){return this.clone().$set(t,n)},r.get=function(t){return this[u.p(t)]()},r.add=function(t,n){var e,a=this;t=Number(t);var o=u.p(n),c=function(g){var H=y(a);return u.w(H.date(H.date()+Math.round(g*t)),a)};if(o===$)return this.set($,this.$M+t);if(o===M)return this.set(M,this.$y+t);if(o===x)return c(1);if(o===h)return c(7);var m=(e={},e[v]=l,e[T]=Y,e[O]=d,e)[o]||1,D=this.$d.getTime()+t*m;return u.w(D,this)},r.subtract=function(t,n){return this.add(-1*t,n)},r.format=function(t){var n=this,e=this.$locale();if(!this.isValid())return e.invalidDate||q;var a=t||"YYYY-MM-DDTHH:mm:ssZ",o=u.z(this),c=this.$H,m=this.$m,D=this.$M,g=e.weekdays,H=e.months,E=e.meridiem,I=function(b,L,J,K){return b&&(b[L]||b(n,a))||J[L].slice(0,K)},Z=function(b){return u.s(c%12||12,b,"0")},W=E||function(b,L,J){var K=b<12?"AM":"PM";return J?K.toLowerCase():K};return a.replace(tt,(function(b,L){return L||(function(J){switch(J){case"YY":return String(n.$y).slice(-2);case"YYYY":return u.s(n.$y,4,"0");case"M":return D+1;case"MM":return u.s(D+1,2,"0");case"MMM":return I(e.monthsShort,D,H,3);case"MMMM":return I(H,D);case"D":return n.$D;case"DD":return u.s(n.$D,2,"0");case"d":return String(n.$W);case"dd":return I(e.weekdaysMin,n.$W,g,2);case"ddd":return I(e.weekdaysShort,n.$W,g,3);case"dddd":return g[n.$W];case"H":return String(c);case"HH":return u.s(c,2,"0");case"h":return Z(1);case"hh":return Z(2);case"a":return W(c,m,!0);case"A":return W(c,m,!1);case"m":return String(m);case"mm":return u.s(m,2,"0");case"s":return String(n.$s);case"ss":return u.s(n.$s,2,"0");case"SSS":return u.s(n.$ms,3,"0");case"Z":return o}return null})(b)||o.replace(":","")}))},r.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},r.diff=function(t,n,e){var a,o=this,c=u.p(n),m=y(t),D=(m.utcOffset()-this.utcOffset())*l,g=this-m,H=function(){return u.m(o,m)};switch(c){case M:a=H()/12;break;case $:a=H();break;case X:a=H()/3;break;case h:a=(g-D)/6048e5;break;case x:a=(g-D)/864e5;break;case T:a=g/Y;break;case v:a=g/l;break;case O:a=g/d;break;default:a=g}return e?a:u.a(a)},r.daysInMonth=function(){return this.endOf($).$D},r.$locale=function(){return C[this.$L]},r.locale=function(t,n){if(!t)return this.$L;var e=this.clone(),a=Q(t,n,!0);return a&&(e.$L=a),e},r.clone=function(){return u.w(this.$d,this)},r.toDate=function(){return new Date(this.valueOf())},r.toJSON=function(){return this.isValid()?this.toISOString():null},r.toISOString=function(){return this.$d.toISOString()},r.toString=function(){return this.$d.toUTCString()},s})(),ut=G.prototype;return y.prototype=ut,[["$ms",S],["$s",O],["$m",v],["$H",T],["$W",x],["$M",$],["$y",M],["$D",w]].forEach((function(s){ut[s[1]]=function(r){return this.$g(r,s[0],s[1])}})),y.extend=function(s,r){return s.$i||(s(r,G,y),s.$i=!0),y},y.locale=Q,y.isDayjs=et,y.unix=function(s){return y(1e3*s)},y.en=C[F],y.Ls=C,y.p={},y}))})(P)),P.exports}var lt=dt();const z=ct(lt),V=60,ht=["YYYY-MM-DD","YYYY/MM/DD","YYYY-MM-DD HH:mm","YYYY/MM/DD HH:mm","YYYY-MM-DD HH:mm:ss","YYYY/MM/DD HH:mm:ss"],nt=p=>{if(!R(p))return"00:00:00";const f=z(p).diff(z());if(f<=0)return"00:00:00";const d=Math.floor(f/1e3),l=Math.floor(d/86400),Y=Math.floor(d%86400/3600),S=Math.floor(d%3600/60),O=d%60;return`${l?`${l}:`:""}${`${Y}`.padStart(2,"0")}:${`${S}`.padStart(2,"0")}:${`${O}`.padStart(2,"0")}`},st=p=>{const f=d=>`${d}`.padStart(2,"0");return`${f(Math.floor(p/V/V))}:${f(Math.floor(p/V)%V)}:${f(p%V)}`},R=p=>ht.some(f=>z(p,f,!0).isValid()),it="HH:mm:ss",at=900,$t=p=>{const{mode:f,showType:d="default",size:l=40,className:Y,bgColor:S,borderColor:O,finishCountFn:v}=p,[T,x]=k.useState(d==="count"?st(0):d==="default"?z().format(it):nt(d)),h=k.useRef({t:null}),$={"--card-size":`${l}px`,"--card-w":`${l*1.25}px`,"--card-h":`${l*2}px`,"--transx":`${-l*1.25/2}px`,"--transy":`${-l}px`,"--delay":`${at/1e3}s`,"--bgColor":S,"--borderColor":O};k.useEffect(()=>{let M=Date.now();h.current.t&&(clearInterval(h.current.t),h.current.t=null,M=Date.now()),h.current.t=setInterval(()=>{let w=()=>"";d==="count"?w=()=>st(Math.floor((Date.now()-M)/1e3)):d==="default"?w=()=>z().format(it):w=()=>nt(d),x(w())},1e3)},[d]),k.useEffect(()=>{R(d)&&T==="00:00:00"&&v&&setTimeout(()=>{v()},1e3)},[T,d,v]);const X=()=>{if(!T)return null;const M=T.split(":"),w=M[M.length-3].split(""),q=M[M.length-2].split(""),B=M[M.length-1].split(""),tt=M.length===4?M[0].split(""):[],_=R(d),A=tt.map((F,C)=>i.jsx(N,{mode:f,time:+F,limit:_?-9:9,size:l},C)),U=i.jsx("span",{children:":"});return i.jsxs(i.Fragment,{children:[A.length?i.jsxs(i.Fragment,{children:[A,_?i.jsx("p",{children:"天"}):U]}):null,i.jsx(N,{mode:f,time:+w[0],limit:_?-2:2,size:l}),i.jsx(N,{mode:f,time:+w[1],limit:_?-9:9,size:l}),_?i.jsx("p",{children:"小时"}):U,i.jsx(N,{mode:f,time:+q[0],limit:_?-5:5,size:l}),i.jsx(N,{mode:f,time:+q[1],limit:_?-9:9,size:l}),_?i.jsx("p",{children:"分"}):U,i.jsx(N,{mode:f,time:+B[0],limit:_?-5:5,size:l}),i.jsx(N,{mode:f,time:+B[1],limit:_?-9:9,size:l}),_&&i.jsx("p",{children:"秒"})]})};return i.jsx("div",{className:`time-runner ${Y||""}`,style:$,children:X()})},mt=p=>{const{time:f,limit:d,mode:l,size:Y}=p,[S,O]=k.useState(!1),v=k.useRef({t:f}),T=k.useMemo(()=>f!==v.current.t?{"--driftX":`${Math.floor(Math.random()*(-Y-Y+1))+Y}px`,"--driftY":`${Math.floor(Math.random()*(-Y*2-Y*2+1))+Y*2}px`,"--driftRZ":`${Math.floor(Math.random()*151)+50}deg`,"--driftRX":`${Math.floor(Math.random()*151)+50}deg`}:null,[f,Y]);k.useEffect(()=>{f!==v.current.t&&O(!0)},[f]),k.useEffect(()=>{S&&setTimeout(()=>{v.current.t=f,O(!1)},at)},[S,f]);const x=()=>{const{t:h}=v.current;let $=h;switch(d>0?$=h>=d?0:h+1:$=h<=0?Math.abs(d):h-1,l){case"card":return i.jsxs("div",{className:"clock-card",children:[i.jsxs("div",{className:`clock-b ${S?"run":""}`,children:[i.jsx("p",{children:$}),i.jsx("p",{children:$})]}),i.jsxs("div",{className:`clock-f ${S?"run":""}`,children:[i.jsx("p",{children:h}),i.jsx("p",{children:h})]})]});case"cube-v":return i.jsx("div",{className:`cube-v ${S?"run":""}`,children:i.jsxs("div",{children:[i.jsx("p",{children:$}),i.jsx("p",{children:h})]})});case"cube-h":return i.jsx("div",{className:`cube-h ${S?"run":""}`,children:i.jsxs("div",{children:[i.jsx("p",{children:$}),i.jsx("p",{children:h})]})});case"drift":return i.jsx("div",{className:`drift ${S?"run":""}`,"data-digit":h,style:T,children:$});default:return i.jsx("div",{children:i.jsx("p",{children:h})})}};return i.jsx(i.Fragment,{children:x()})},N=k.memo(mt);j.TimeRunner=$t,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "time-runner",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Displaying timer, current time, and countdown with light animation effects(React component)",
|
|
5
5
|
"keywords": ["react", "countdown", "timer", "hook", "card", "less", "animation", "vite"],
|
|
6
6
|
"main": "./dist/time-runner.umd.js",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"author": "feiqi",
|
|
11
11
|
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/feiqi80/time-runner"
|
|
15
|
+
},
|
|
12
16
|
"scripts": {
|
|
13
17
|
"build": "vite build",
|
|
14
18
|
"dev": "vite --port 3001"
|