@cyca/react-timeline-editor 0.2.3-alpha.8 → 0.2.4-alpha.0
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/index-Do2XgyZc.js +77 -0
- package/dist/index-HslTC57T.cjs +1 -0
- package/dist/react-timeline-editor.cjs +4 -4
- package/dist/react-timeline-editor.js +1160 -1213
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.ts +107 -0
- package/dist/utils.js +10 -0
- package/package.json +6 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const T = "timeline-editor", i = 0, _ = 1, E = 10, u = 160, A = 20, l = 1, L = 8, f = 32, C = 20;
|
|
2
|
+
function a(n, t) {
|
|
3
|
+
const {
|
|
4
|
+
startLeft: s,
|
|
5
|
+
scale: o,
|
|
6
|
+
scaleWidth: c
|
|
7
|
+
} = t;
|
|
8
|
+
return s + n / o * c;
|
|
9
|
+
}
|
|
10
|
+
function r(n, t) {
|
|
11
|
+
const {
|
|
12
|
+
startLeft: s,
|
|
13
|
+
scale: o,
|
|
14
|
+
scaleWidth: c
|
|
15
|
+
} = t;
|
|
16
|
+
return (n - s) / c * o;
|
|
17
|
+
}
|
|
18
|
+
function D(n, t) {
|
|
19
|
+
const {
|
|
20
|
+
left: s,
|
|
21
|
+
width: o
|
|
22
|
+
} = n, c = r(s, t), e = r(s + o, t);
|
|
23
|
+
return {
|
|
24
|
+
start: c,
|
|
25
|
+
end: e
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function S(n, t) {
|
|
29
|
+
const {
|
|
30
|
+
start: s,
|
|
31
|
+
end: o
|
|
32
|
+
} = n, c = a(s, t), e = a(o, t) - c;
|
|
33
|
+
return {
|
|
34
|
+
left: c,
|
|
35
|
+
width: e
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function h(n, t) {
|
|
39
|
+
let s = 0;
|
|
40
|
+
return n.forEach((c) => {
|
|
41
|
+
c.actions.forEach((e) => {
|
|
42
|
+
s = Math.max(s, e.end);
|
|
43
|
+
});
|
|
44
|
+
}), Math.ceil(s / t.scale) + (t.pad ?? 2);
|
|
45
|
+
}
|
|
46
|
+
function U(n, t) {
|
|
47
|
+
const {
|
|
48
|
+
startLeft: s,
|
|
49
|
+
scaleWidth: o
|
|
50
|
+
} = t, c = Math.ceil((n - s) / o);
|
|
51
|
+
return Math.max(c + 2, t.scaleCount);
|
|
52
|
+
}
|
|
53
|
+
function d(n, t) {
|
|
54
|
+
const s = [];
|
|
55
|
+
return n.forEach((o) => {
|
|
56
|
+
s.push(a(o.start, t)), s.push(a(o.end, t));
|
|
57
|
+
}), s;
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
f as D,
|
|
61
|
+
C as M,
|
|
62
|
+
T as P,
|
|
63
|
+
i as S,
|
|
64
|
+
_ as a,
|
|
65
|
+
E as b,
|
|
66
|
+
u as c,
|
|
67
|
+
A as d,
|
|
68
|
+
l as e,
|
|
69
|
+
L as f,
|
|
70
|
+
S as g,
|
|
71
|
+
D as h,
|
|
72
|
+
U as i,
|
|
73
|
+
r as j,
|
|
74
|
+
d as k,
|
|
75
|
+
h as l,
|
|
76
|
+
a as p
|
|
77
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c="timeline-editor";function _(n,t){const{startLeft:T,scale:o,scaleWidth:s}=t;return T+n/o*s}function E(n,t){const{startLeft:T,scale:o,scaleWidth:s}=t;return(n-T)/s*o}function A(n,t){const{left:T,width:o}=n,s=E(T,t),e=E(T+o,t);return{start:s,end:e}}function r(n,t){const{start:T,end:o}=n,s=_(T,t),e=_(o,t)-s;return{left:s,width:e}}function L(n,t){let T=0;return n.forEach(s=>{s.actions.forEach(e=>{T=Math.max(T,e.end)})}),Math.ceil(T/t.scale)+(t.pad??2)}function i(n,t){const{startLeft:T,scaleWidth:o}=t,s=Math.ceil((n-T)/o);return Math.max(s+2,t.scaleCount)}function S(n,t){const T=[];return n.forEach(o=>{T.push(_(o.start,t)),T.push(_(o.end,t))}),T}exports.DEFAULT_MOVE_GRID=1;exports.DEFAULT_ROW_HEIGHT=32;exports.DEFAULT_SCALE=1;exports.DEFAULT_SCALE_SPLIT_COUNT=10;exports.DEFAULT_SCALE_WIDTH=160;exports.DEFAULT_SNAP_DISTANCE=8;exports.DEFAULT_START_LEFT=20;exports.MIN_SCALE_COUNT=20;exports.PREFIX=c;exports.START_CURSOR_TIME=0;exports.getScaleCountByPixel=i;exports.getScaleCountByRows=L;exports.parserActionsToPositions=S;exports.parserPixelToTime=E;exports.parserTimeToPixel=_;exports.parserTimeToTransform=r;exports.parserTransformToTime=A;
|