react-av-timeline 1.0.2 → 1.1.1
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/dist/Component.d.ts +2 -1
- package/dist/index.css +1 -0
- package/dist/index.js +311 -0
- package/dist/index.umd.cjs +22 -0
- package/package.json +9 -9
- package/dist/assets/index-4pe00mnL.js +0 -9
- package/dist/assets/index-DzZLKPs2.css +0 -1
- package/dist/index.html +0 -14
package/dist/Component.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ export interface itemsType {
|
|
|
4
4
|
style?: CSSProperties;
|
|
5
5
|
content?: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export default function Component({ items, currentTime, totalTime, scale, indicator }: {
|
|
7
|
+
export default function Component({ items, currentTime, totalTime, scale, indicator, itemStyle }: {
|
|
8
8
|
items: itemsType[];
|
|
9
|
+
itemStyle?: CSSProperties;
|
|
9
10
|
currentTime: number;
|
|
10
11
|
totalTime: number;
|
|
11
12
|
scale?: number;
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._timeline_160ei_1{position:relative;overflow:clip;width:100%}._timeline-items_160ei_6{transform:translate(var(--translate));display:flex;transition:all .13s;height:100%;width:100%}._timeline-item_160ei_6{display:flex;align-items:center;justify-content:center;color:#000;background:var(--bg);flex-shrink:0;border-right:2px solid white;box-sizing:border-box}._timeline-indicator_160ei_23{z-index:1;position:absolute;top:0;left:50%;background-color:#000;transform:translate(-50%);width:3px;opacity:.4;height:100%}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import te from "react";
|
|
2
|
+
var k = { exports: {} }, R = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var L;
|
|
13
|
+
function ne() {
|
|
14
|
+
if (L) return R;
|
|
15
|
+
L = 1;
|
|
16
|
+
var n = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
|
|
17
|
+
function u(c, i, l) {
|
|
18
|
+
var _ = null;
|
|
19
|
+
if (l !== void 0 && (_ = "" + l), i.key !== void 0 && (_ = "" + i.key), "key" in i) {
|
|
20
|
+
l = {};
|
|
21
|
+
for (var f in i)
|
|
22
|
+
f !== "key" && (l[f] = i[f]);
|
|
23
|
+
} else l = i;
|
|
24
|
+
return i = l.ref, {
|
|
25
|
+
$$typeof: n,
|
|
26
|
+
type: c,
|
|
27
|
+
key: _,
|
|
28
|
+
ref: i !== void 0 ? i : null,
|
|
29
|
+
props: l
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return R.Fragment = s, R.jsx = u, R.jsxs = u, R;
|
|
33
|
+
}
|
|
34
|
+
var v = {};
|
|
35
|
+
/**
|
|
36
|
+
* @license React
|
|
37
|
+
* react-jsx-runtime.development.js
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
+
*
|
|
41
|
+
* This source code is licensed under the MIT license found in the
|
|
42
|
+
* LICENSE file in the root directory of this source tree.
|
|
43
|
+
*/
|
|
44
|
+
var W;
|
|
45
|
+
function oe() {
|
|
46
|
+
return W || (W = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
47
|
+
function n(e) {
|
|
48
|
+
if (e == null) return null;
|
|
49
|
+
if (typeof e == "function")
|
|
50
|
+
return e.$$typeof === K ? null : e.displayName || e.name || null;
|
|
51
|
+
if (typeof e == "string") return e;
|
|
52
|
+
switch (e) {
|
|
53
|
+
case O:
|
|
54
|
+
return "Fragment";
|
|
55
|
+
case z:
|
|
56
|
+
return "Profiler";
|
|
57
|
+
case J:
|
|
58
|
+
return "StrictMode";
|
|
59
|
+
case B:
|
|
60
|
+
return "Suspense";
|
|
61
|
+
case H:
|
|
62
|
+
return "SuspenseList";
|
|
63
|
+
case Q:
|
|
64
|
+
return "Activity";
|
|
65
|
+
}
|
|
66
|
+
if (typeof e == "object")
|
|
67
|
+
switch (typeof e.tag == "number" && console.error(
|
|
68
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
+
), e.$$typeof) {
|
|
70
|
+
case q:
|
|
71
|
+
return "Portal";
|
|
72
|
+
case V:
|
|
73
|
+
return (e.displayName || "Context") + ".Provider";
|
|
74
|
+
case G:
|
|
75
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case X:
|
|
77
|
+
var r = e.render;
|
|
78
|
+
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
+
case Z:
|
|
80
|
+
return r = e.displayName || null, r !== null ? r : n(e.type) || "Memo";
|
|
81
|
+
case C:
|
|
82
|
+
r = e._payload, e = e._init;
|
|
83
|
+
try {
|
|
84
|
+
return n(e(r));
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function s(e) {
|
|
91
|
+
return "" + e;
|
|
92
|
+
}
|
|
93
|
+
function u(e) {
|
|
94
|
+
try {
|
|
95
|
+
s(e);
|
|
96
|
+
var r = !1;
|
|
97
|
+
} catch {
|
|
98
|
+
r = !0;
|
|
99
|
+
}
|
|
100
|
+
if (r) {
|
|
101
|
+
r = console;
|
|
102
|
+
var t = r.error, o = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
+
return t.call(
|
|
104
|
+
r,
|
|
105
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
+
o
|
|
107
|
+
), s(e);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function c(e) {
|
|
111
|
+
if (e === O) return "<>";
|
|
112
|
+
if (typeof e == "object" && e !== null && e.$$typeof === C)
|
|
113
|
+
return "<...>";
|
|
114
|
+
try {
|
|
115
|
+
var r = n(e);
|
|
116
|
+
return r ? "<" + r + ">" : "<...>";
|
|
117
|
+
} catch {
|
|
118
|
+
return "<...>";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function i() {
|
|
122
|
+
var e = g.A;
|
|
123
|
+
return e === null ? null : e.getOwner();
|
|
124
|
+
}
|
|
125
|
+
function l() {
|
|
126
|
+
return Error("react-stack-top-frame");
|
|
127
|
+
}
|
|
128
|
+
function _(e) {
|
|
129
|
+
if (Y.call(e, "key")) {
|
|
130
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
+
if (r && r.isReactWarning) return !1;
|
|
132
|
+
}
|
|
133
|
+
return e.key !== void 0;
|
|
134
|
+
}
|
|
135
|
+
function f(e, r) {
|
|
136
|
+
function t() {
|
|
137
|
+
M || (M = !0, console.error(
|
|
138
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
+
r
|
|
140
|
+
));
|
|
141
|
+
}
|
|
142
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
+
get: t,
|
|
144
|
+
configurable: !0
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function E() {
|
|
148
|
+
var e = n(this.type);
|
|
149
|
+
return D[e] || (D[e] = !0, console.error(
|
|
150
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
|
+
}
|
|
153
|
+
function x(e, r, t, o, d, m, S, w) {
|
|
154
|
+
return t = m.ref, e = {
|
|
155
|
+
$$typeof: N,
|
|
156
|
+
type: e,
|
|
157
|
+
key: r,
|
|
158
|
+
props: m,
|
|
159
|
+
_owner: d
|
|
160
|
+
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
|
+
enumerable: !1,
|
|
162
|
+
get: E
|
|
163
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
|
+
configurable: !1,
|
|
165
|
+
enumerable: !1,
|
|
166
|
+
writable: !0,
|
|
167
|
+
value: 0
|
|
168
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
169
|
+
configurable: !1,
|
|
170
|
+
enumerable: !1,
|
|
171
|
+
writable: !0,
|
|
172
|
+
value: null
|
|
173
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
174
|
+
configurable: !1,
|
|
175
|
+
enumerable: !1,
|
|
176
|
+
writable: !0,
|
|
177
|
+
value: S
|
|
178
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
179
|
+
configurable: !1,
|
|
180
|
+
enumerable: !1,
|
|
181
|
+
writable: !0,
|
|
182
|
+
value: w
|
|
183
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
|
+
}
|
|
185
|
+
function p(e, r, t, o, d, m, S, w) {
|
|
186
|
+
var a = r.children;
|
|
187
|
+
if (a !== void 0)
|
|
188
|
+
if (o)
|
|
189
|
+
if (ee(a)) {
|
|
190
|
+
for (o = 0; o < a.length; o++)
|
|
191
|
+
y(a[o]);
|
|
192
|
+
Object.freeze && Object.freeze(a);
|
|
193
|
+
} else
|
|
194
|
+
console.error(
|
|
195
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
|
+
);
|
|
197
|
+
else y(a);
|
|
198
|
+
if (Y.call(r, "key")) {
|
|
199
|
+
a = n(e);
|
|
200
|
+
var b = Object.keys(r).filter(function(re) {
|
|
201
|
+
return re !== "key";
|
|
202
|
+
});
|
|
203
|
+
o = 0 < b.length ? "{key: someKey, " + b.join(": ..., ") + ": ...}" : "{key: someKey}", F[a + o] || (b = 0 < b.length ? "{" + b.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
205
|
+
let props = %s;
|
|
206
|
+
<%s {...props} />
|
|
207
|
+
React keys must be passed directly to JSX without using spread:
|
|
208
|
+
let props = %s;
|
|
209
|
+
<%s key={someKey} {...props} />`,
|
|
210
|
+
o,
|
|
211
|
+
a,
|
|
212
|
+
b,
|
|
213
|
+
a
|
|
214
|
+
), F[a + o] = !0);
|
|
215
|
+
}
|
|
216
|
+
if (a = null, t !== void 0 && (u(t), a = "" + t), _(r) && (u(r.key), a = "" + r.key), "key" in r) {
|
|
217
|
+
t = {};
|
|
218
|
+
for (var P in r)
|
|
219
|
+
P !== "key" && (t[P] = r[P]);
|
|
220
|
+
} else t = r;
|
|
221
|
+
return a && f(
|
|
222
|
+
t,
|
|
223
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
+
), x(
|
|
225
|
+
e,
|
|
226
|
+
a,
|
|
227
|
+
m,
|
|
228
|
+
d,
|
|
229
|
+
i(),
|
|
230
|
+
t,
|
|
231
|
+
S,
|
|
232
|
+
w
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function y(e) {
|
|
236
|
+
typeof e == "object" && e !== null && e.$$typeof === N && e._store && (e._store.validated = 1);
|
|
237
|
+
}
|
|
238
|
+
var T = te, N = Symbol.for("react.transitional.element"), q = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), J = Symbol.for("react.strict_mode"), z = Symbol.for("react.profiler"), G = Symbol.for("react.consumer"), V = Symbol.for("react.context"), X = Symbol.for("react.forward_ref"), B = Symbol.for("react.suspense"), H = Symbol.for("react.suspense_list"), Z = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), Q = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), g = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, ee = Array.isArray, j = console.createTask ? console.createTask : function() {
|
|
239
|
+
return null;
|
|
240
|
+
};
|
|
241
|
+
T = {
|
|
242
|
+
react_stack_bottom_frame: function(e) {
|
|
243
|
+
return e();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
var M, D = {}, $ = T.react_stack_bottom_frame.bind(
|
|
247
|
+
T,
|
|
248
|
+
l
|
|
249
|
+
)(), I = j(c(l)), F = {};
|
|
250
|
+
v.Fragment = O, v.jsx = function(e, r, t, o, d) {
|
|
251
|
+
var m = 1e4 > g.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return p(
|
|
253
|
+
e,
|
|
254
|
+
r,
|
|
255
|
+
t,
|
|
256
|
+
!1,
|
|
257
|
+
o,
|
|
258
|
+
d,
|
|
259
|
+
m ? Error("react-stack-top-frame") : $,
|
|
260
|
+
m ? j(c(e)) : I
|
|
261
|
+
);
|
|
262
|
+
}, v.jsxs = function(e, r, t, o, d) {
|
|
263
|
+
var m = 1e4 > g.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return p(
|
|
265
|
+
e,
|
|
266
|
+
r,
|
|
267
|
+
t,
|
|
268
|
+
!0,
|
|
269
|
+
o,
|
|
270
|
+
d,
|
|
271
|
+
m ? Error("react-stack-top-frame") : $,
|
|
272
|
+
m ? j(c(e)) : I
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
})()), v;
|
|
276
|
+
}
|
|
277
|
+
var U;
|
|
278
|
+
function ae() {
|
|
279
|
+
return U || (U = 1, process.env.NODE_ENV === "production" ? k.exports = ne() : k.exports = oe()), k.exports;
|
|
280
|
+
}
|
|
281
|
+
var h = ae();
|
|
282
|
+
const se = "_timeline_160ei_1", A = {
|
|
283
|
+
timeline: se,
|
|
284
|
+
"timeline-items": "_timeline-items_160ei_6",
|
|
285
|
+
"timeline-item": "_timeline-item_160ei_6",
|
|
286
|
+
"timeline-indicator": "_timeline-indicator_160ei_23"
|
|
287
|
+
};
|
|
288
|
+
function ie() {
|
|
289
|
+
var n = Math.floor(156 + Math.random() * 100), s = Math.floor(156 + Math.random() * 100), u = Math.floor(156 + Math.random() * 100);
|
|
290
|
+
return "rgb(" + n + "," + s + "," + u + ")";
|
|
291
|
+
}
|
|
292
|
+
function le(n, s) {
|
|
293
|
+
return s === n.length - 1 ? n[s] - n[s - 1] : n[s + 1] - n[s];
|
|
294
|
+
}
|
|
295
|
+
const ue = new Array(10).fill(0).map(ie);
|
|
296
|
+
function fe({ items: n, currentTime: s, totalTime: u, scale: c = 1, indicator: i, itemStyle: l }) {
|
|
297
|
+
const _ = n.map((f) => f.time);
|
|
298
|
+
return h.jsxs("div", { className: A.timeline, children: [h.jsx("div", { className: A["timeline-indicator"], ...i }), h.jsx("div", { className: A["timeline-items"], style: {
|
|
299
|
+
"--translate": `${c * 50 / c - s / u * c * 100}%`
|
|
300
|
+
}, children: n.map((f, E) => {
|
|
301
|
+
const p = le(_, E) / u * c * 100 + "%";
|
|
302
|
+
return h.jsx("span", { className: A["timeline-item"], style: {
|
|
303
|
+
"--bg": f.style?.background || ue[E > 10 ? E % 10 : E],
|
|
304
|
+
width: p,
|
|
305
|
+
...l
|
|
306
|
+
}, children: f.content });
|
|
307
|
+
}) })] });
|
|
308
|
+
}
|
|
309
|
+
export {
|
|
310
|
+
fe as default
|
|
311
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(function(b,d){typeof exports=="object"&&typeof module<"u"?module.exports=d(require("react")):typeof define=="function"&&define.amd?define(["react"],d):(b=typeof globalThis<"u"?globalThis:b||self,b.index=d(b.react))})(this,(function(b){"use strict";var d={exports:{}},p={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var P;function J(){if(P)return p;P=1;var n=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function c(l,i,u){var E=null;if(u!==void 0&&(E=""+u),i.key!==void 0&&(E=""+i.key),"key"in i){u={};for(var f in i)f!=="key"&&(u[f]=i[f])}else u=i;return i=u.ref,{$$typeof:n,type:l,key:E,ref:i!==void 0?i:null,props:u}}return p.Fragment=s,p.jsx=c,p.jsxs=c,p}var T={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var N;function z(){return N||(N=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case K:return"Profiler";case Q:return"StrictMode";case ne:return"Suspense";case oe:return"SuspenseList";case se:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case Z:return"Portal";case re:return(e.displayName||"Context")+".Provider";case ee:return(e._context.displayName||"Context")+".Consumer";case te:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return r=e.displayName||null,r!==null?r:n(e.type)||"Memo";case I:r=e._payload,e=e._init;try{return n(e(r))}catch{}}return null}function s(e){return""+e}function c(e){try{s(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),s(e)}}function l(e){if(e===j)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===I)return"<...>";try{var r=n(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function i(){var e=S.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function E(e){if(F.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function f(e,r){function t(){$||($=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function R(){var e=n(this.type);return L[e]||(L[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Y(e,r,t,o,_,m,w,x){return t=m.ref,e={$$typeof:D,type:e,key:r,props:m,_owner:_},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:R}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function A(e,r,t,o,_,m,w,x){var a=r.children;if(a!==void 0)if(o)if(ue(a)){for(o=0;o<a.length;o++)M(a[o]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else M(a);if(F.call(r,"key")){a=n(e);var v=Object.keys(r).filter(function(ce){return ce!=="key"});o=0<v.length?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}",q[a+o]||(v=0<v.length?"{"+v.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,o,a,v,a),q[a+o]=!0)}if(a=null,t!==void 0&&(c(t),a=""+t),E(r)&&(c(r.key),a=""+r.key),"key"in r){t={};for(var y in r)y!=="key"&&(t[y]=r[y])}else t=r;return a&&f(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),Y(e,a,m,_,i(),t,w,x)}function M(e){typeof e=="object"&&e!==null&&e.$$typeof===D&&e._store&&(e._store.validated=1)}var O=b,D=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),re=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),ie=Symbol.for("react.client.reference"),S=O.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,ue=Array.isArray,g=console.createTask?console.createTask:function(){return null};O={react_stack_bottom_frame:function(e){return e()}};var $,L={},W=O.react_stack_bottom_frame.bind(O,u)(),U=g(l(u)),q={};T.Fragment=j,T.jsx=function(e,r,t,o,_){var m=1e4>S.recentlyCreatedOwnerStacks++;return A(e,r,t,!1,o,_,m?Error("react-stack-top-frame"):W,m?g(l(e)):U)},T.jsxs=function(e,r,t,o,_){var m=1e4>S.recentlyCreatedOwnerStacks++;return A(e,r,t,!0,o,_,m?Error("react-stack-top-frame"):W,m?g(l(e)):U)}})()),T}var C;function G(){return C||(C=1,process.env.NODE_ENV==="production"?d.exports=J():d.exports=z()),d.exports}var k=G();const h={timeline:"_timeline_160ei_1","timeline-items":"_timeline-items_160ei_6","timeline-item":"_timeline-item_160ei_6","timeline-indicator":"_timeline-indicator_160ei_23"};function V(){var n=Math.floor(156+Math.random()*100),s=Math.floor(156+Math.random()*100),c=Math.floor(156+Math.random()*100);return"rgb("+n+","+s+","+c+")"}function X(n,s){return s===n.length-1?n[s]-n[s-1]:n[s+1]-n[s]}const B=new Array(10).fill(0).map(V);function H({items:n,currentTime:s,totalTime:c,scale:l=1,indicator:i,itemStyle:u}){const E=n.map(f=>f.time);return k.jsxs("div",{className:h.timeline,children:[k.jsx("div",{className:h["timeline-indicator"],...i}),k.jsx("div",{className:h["timeline-items"],style:{"--translate":`${l*50/l-s/c*l*100}%`},children:n.map((f,R)=>{const A=X(E,R)/c*l*100+"%";return k.jsx("span",{className:h["timeline-item"],style:{"--bg":f.style?.background||B[R>10?R%10:R],width:A,...u},children:f.content})})})]})}return H}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-av-timeline",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "React 音视频时间线组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"homepage": "https://os.arsrna.cn/demo/nodejs/react-timeline",
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
43
|
-
"@types/node": "^24.
|
|
44
|
-
"@types/react": "^19.
|
|
45
|
-
"@types/react-dom": "^19.1
|
|
46
|
-
"@vitejs/plugin-react": "^5.0.
|
|
43
|
+
"@types/node": "^24.7.0",
|
|
44
|
+
"@types/react": "^19.2.2",
|
|
45
|
+
"@types/react-dom": "^19.2.1",
|
|
46
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
47
47
|
"react": "^18.3.1",
|
|
48
48
|
"react-dom": "^18.2.0",
|
|
49
49
|
"tslib": "^2.8.1",
|
|
50
50
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
51
|
-
"vite": "^7.1.
|
|
51
|
+
"vite": "^7.1.9",
|
|
52
52
|
"vite-plugin-sass": "^0.1.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"react": "^
|
|
56
|
-
"react-dom": "^
|
|
57
|
-
"typescript": "^5.9.
|
|
55
|
+
"react": "^19.1.1",
|
|
56
|
+
"react-dom": "^19.1.1",
|
|
57
|
+
"typescript": "^5.9.3"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import b,{useRef as E,useState as O,useEffect as L,StrictMode as S}from"react";import q from"react-dom";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))a(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const m of c.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&a(m)}).observe(document,{childList:!0,subtree:!0});function s(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(r){if(r.ep)return;r.ep=!0;const c=s(r);fetch(r.href,c)}})();var _={exports:{}},d={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var R;function A(){if(R)return d;R=1;var t=b,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function m(l,i,p){var o,u={},y=null,x=null;p!==void 0&&(y=""+p),i.key!==void 0&&(y=""+i.key),i.ref!==void 0&&(x=i.ref);for(o in i)a.call(i,o)&&!c.hasOwnProperty(o)&&(u[o]=i[o]);if(l&&l.defaultProps)for(o in i=l.defaultProps,i)u[o]===void 0&&(u[o]=i[o]);return{$$typeof:e,type:l,key:y,ref:x,props:u,_owner:r.current}}return d.Fragment=s,d.jsx=m,d.jsxs=m,d}var j;function N(){return j||(j=1,_.exports=A()),_.exports}var n=N(),h={},C;function B(){if(C)return h;C=1;var t=q;return h.createRoot=t.createRoot,h.hydrateRoot=t.hydrateRoot,h}var M=B();const P="_timeline_1tjsb_1",f={timeline:P,"timeline-items":"_timeline-items_1tjsb_6","timeline-item":"_timeline-item_1tjsb_6","timeline-indicator":"_timeline-indicator_1tjsb_23"};function T(){var t=Math.floor(156+Math.random()*100),e=Math.floor(156+Math.random()*100),s=Math.floor(156+Math.random()*100);return"rgb("+t+","+e+","+s+")"}function w(t,e){return e===t.length-1?t[e]-t[e-1]:t[e+1]-t[e]}function v({items:t,currentTime:e,totalTime:s,scale:a=1,indicator:r}){const c=E(new Array(t.length).fill(0).map(T));return n.jsxs("div",{className:f.timeline,children:[n.jsx("div",{className:f["timeline-indicator"],...r}),n.jsx("div",{className:f["timeline-items"],style:{"--translate":`${a*50/a-e/s*a*100}%`},children:t.map((m,l)=>{const i=t.map(u=>u.time),o=w(i,l)/s*a*100+"%";return n.jsx("span",{className:f["timeline-item"],style:{"--bg":m.style?.background||c.current[l],width:o},children:m.content})})})]})}const $=[{t:0,c:" 作词 : ChiliChill"},{t:1,c:" 作曲 : ChiliChill"},{t:2,c:" 制作人 : ChiliChill"},{t:10.473,c:"船 摇啊摇"},{t:12.239,c:"摇到陌生的远方摇断了船桨"},{t:16.087,c:"进土壤 长成了愿望和新故乡"},{t:20.342,c:"(Bora sana, Bora sana)"},{t:20.724,c:"我的朋友"},{t:22.759,c:"你在哪 是否凝望同一轮月光"},{t:26.474,c:"有没有 成为期待的英雄模样"},{t:30.752,c:"期待的模样"},{t:40.368,c:"(Nzuri Sana)"},{t:41.777,c:"风 绕啊绕"},{t:43.573,c:"绕成年轮记录西山来的歌谣"},{t:47.421,c:"轻唱着 十八万个寂静的夜色"},{t:51.631,c:""},{t:52.178,c:"我的朋友"},{t:53.929,c:"若岁月是一条能够逆流的河"},{t:57.787,c:"你是否 还会踏上未知的远走"},{t:62.323,c:""},{t:62.675,c:"Hakunamatata my friend"},{t:65.085,c:"层岩上雕刻着你的画"},{t:67.563,c:"Hakunamatata my friend"},{t:70.766,c:"庆贺的佳酿千里飘香"},{t:72.859,c:"Latata!Latata!"},{t:75.27,c:"从风花到雪月 从东南到北呀"},{t:78.163,c:"地脉记录着你传奇的诗篇到永远 永远"},{t:83.19,c:""},{t:83.543,c:"船 摇啊摇"},{t:85.28,c:"摇到太阳下班月儿挂树梢"},{t:89.033,c:"歇歇脚 默念早睡早起身体好"},{t:93.814,c:"我的朋友"},{t:95.69,c:"要是累了病了找我瞧一瞧"},{t:99.50800000000001,c:"不得了 三丘丘快采药让四丘丘熬"},{t:103.95,c:""},{t:104.436,c:"Hakunamatata my friend"},{t:106.86,c:"森林里传来可爱回响"},{t:109.324,c:"Hakunamatata my friend"},{t:112.006,c:"见你点燃勇敢的火把"},{t:114.721,c:"Latata!Latata!"},{t:117.02600000000001,c:"从桓那兰那到欧庇克莱呀"},{t:119.814,c:"地脉记录着你传奇的诗篇到永远 永远"},{t:127.237,c:"永远…"},{t:137.056,c:""},{t:138.25,c:"船 摇啊摇"},{t:140.144,c:"摇到陌生的远方摇断了船桨"},{t:144.195,c:"进土壤 长成了愿望和新故乡"},{t:148.982,c:"我的朋友"},{t:151.328,c:"你在哪 是否凝望同一轮月光"},{t:155.184,c:"有没有…"},{t:158.164,c:""},{t:162.578,c:"Hakunamatata my friend"},{t:167.78199999999998,c:"船 摇啊摇"},{t:169.518,c:"摇到陌生的远方摇断了船桨"},{t:173.422,c:"进土壤 长成了愿望和新故乡"},{t:177.966,c:"我的朋友"},{t:179.935,c:"你在哪 是否凝望同一轮月光"},{t:183.714,c:"有没有 成为期待的英雄模样"},{t:188.102,c:""},{t:188.666,c:"船 摇啊摇 摇啊摇啊摇啊摇"},{t:193.865,c:"风 绕啊绕 绕啊绕啊绕啊绕"},{t:198.731,c:""},{t:199.098,c:"我的朋友"},{t:200.951,c:"请带走这一首歌"},{t:204.127,c:"去更远的远方…"},{t:209.063,c:""},{t:209.98,c:""},{t:212.466,c:" 音乐制作 : ChiliChill"},{t:213.299,c:" 笛子 : Akshat Mehrotra"},{t:214.132,c:" 上海录音 : ChiliChill@Staff Only Studio"},{t:214.965,c:" 北京录音 : Kevin刘瀚文@Studio21A"},{t:215.798,c:" 混音 : ChiliChill"},{t:216.631,c:" 母带 : Joe LaPorta"}],k=[{time:0,characters:[]},{time:10.473,characters:[0]},{time:30.752,characters:[1]},{time:40.368,characters:[0,1,2,3,4,5,6]},{time:41.777,characters:[1]},{time:52.178,characters:[2]},{time:62.675,characters:[0,1,2,3,4,5,6]},{time:65.085,characters:[3]},{time:67.563,characters:[0,1,2,3,4,5,6]},{time:70.766,characters:[3]},{time:83.543,characters:[4]},{time:104.436,characters:[0,1,2,3,4,5,6]},{time:106.86,characters:[6]},{time:109.324,characters:[0,1,2,3,4,5,6]},{time:112.006,characters:[6]},{time:114.721,characters:[0,1,2,3,4,5,6]},{time:117.02600000000001,characters:[6]},{time:127.237,characters:[5]},{time:158.164,characters:[]},{time:162.578,characters:[0,1,2,3,4,5,6]},{time:167.78199999999998,characters:[0]},{time:209.063,characters:[]}],g=[{name:"荧",cv:"宴宁",color:"#EEDCA2"},{name:"茜特菈莉",cv:"柳知萧",color:"#B986AE"},{name:"丝柯克",cv:"谢莹",color:"#2B3882"},{name:"嘉明",cv:"谢莹",color:"#611E10"},{name:"胡桃",cv:"陶典",color:"#ECB79A"},{name:"蒂莱尔",cv:"闫夜桥",color:"#253B64"},{name:"凯亚",cv:"孙晔",color:"#456886"}],D=$.map(t=>({time:t.t,content:t.c})),I=k.map(t=>({time:t.time,content:t.characters.length===g.length?"合唱":t.characters.map(e=>g[e].cv).join(" ")}));function J(){const t=E(null),[e,s]=O(0);function a(){s(t.current.currentTime+.3),requestAnimationFrame(a)}return L(()=>{t.current!==null&&a()},[]),n.jsxs(n.Fragment,{children:[n.jsx(v,{items:[{time:1,content:"这是第一秒展示的内容"},{time:69,content:"这是第69秒展示的内容"}],currentTime:0,scale:.2,totalTime:91}),n.jsx(v,{items:D,currentTime:e,scale:10,totalTime:t.current?.duration}),n.jsx(v,{items:I,currentTime:e,scale:5,totalTime:t.current?.duration}),n.jsx("audio",{src:"/index.mp3",controls:!0,ref:t,style:{width:"100%"}})]})}M.createRoot(document.getElementById("root")).render(n.jsx(S,{children:n.jsx(J,{})}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._timeline_1tjsb_1{position:relative;overflow:clip;width:100%}._timeline-items_1tjsb_6{transform:translate(var(--translate));display:flex;transition:all .13s;height:100%;width:100%}._timeline-item_1tjsb_6{display:flex;align-items:center;justify-content:center;color:#000;background-color:var(--bg);flex-shrink:0;border-right:2px solid white;box-sizing:border-box}._timeline-indicator_1tjsb_23{z-index:1;position:absolute;top:0;left:50%;background-color:#000;transform:translate(-50%);width:3px;opacity:.4;height:100%}body{margin:0}a{color:#0ff;text-decoration:none}
|
package/dist/index.html
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="zh">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Vite + React + TS</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-4pe00mnL.js"></script>
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-DzZLKPs2.css">
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<div id="root"></div>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|