@kteneyck/cesium-timeline-core 0.3.0 → 0.4.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/cesium-timeline-core.js +276 -230
- package/dist/cesium-timeline-core.umd.cjs +1 -1
- package/dist/index.d.ts +49 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
const
|
|
1
|
+
import * as L from "cesium";
|
|
2
|
+
const ke = {
|
|
3
3
|
backgroundColor: "#1a1a1a",
|
|
4
4
|
tickColor: "#666666",
|
|
5
5
|
majorTickColor: "#999999",
|
|
@@ -17,8 +17,8 @@ const ye = {
|
|
|
17
17
|
swimLaneItemBorderColor: "#666666",
|
|
18
18
|
swimLaneItemBorderWidth: 0
|
|
19
19
|
};
|
|
20
|
-
var
|
|
21
|
-
const
|
|
20
|
+
var ce = /* @__PURE__ */ ((e) => (e[e.FIFTEEN_MIN = 15] = "FIFTEEN_MIN", e[e.THIRTY_MIN = 30] = "THIRTY_MIN", e[e.HOURLY = 60] = "HOURLY", e[e.CUSTOM = -1] = "CUSTOM", e))(ce || {});
|
|
21
|
+
const $ = {
|
|
22
22
|
color: "#4da6ff",
|
|
23
23
|
borderColor: "#2980b9",
|
|
24
24
|
borderWidth: 1,
|
|
@@ -28,22 +28,22 @@ const w = {
|
|
|
28
28
|
labelColor: "#cccccc",
|
|
29
29
|
backgroundColor: "transparent"
|
|
30
30
|
}, R = 24;
|
|
31
|
-
function
|
|
32
|
-
return e instanceof
|
|
31
|
+
function Le(e) {
|
|
32
|
+
return e instanceof L.JulianDate ? L.JulianDate.clone(e) : L.JulianDate.fromDate(e);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return e instanceof
|
|
34
|
+
function te(e) {
|
|
35
|
+
return e instanceof L.JulianDate ? L.JulianDate.toDate(e) : e;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function N(e) {
|
|
38
|
+
return te(e).getTime();
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
40
|
+
function Ce(e) {
|
|
41
|
+
return L.JulianDate.fromDate(new Date(e));
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
43
|
+
function Me(e, t) {
|
|
44
|
+
return N(t) - N(e);
|
|
45
45
|
}
|
|
46
|
-
const
|
|
46
|
+
const ge = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], de = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], fe = {
|
|
47
47
|
/** e.g. "Feb 24 2026 14:04:07" — default */
|
|
48
48
|
DEFAULT: "MMM DD YYYY HH:mm:ss",
|
|
49
49
|
/** e.g. "Feb 24 2026 02:04:07 PM" */
|
|
@@ -58,33 +58,70 @@ const he = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"
|
|
|
58
58
|
TIME_ONLY: "HH:mm:ss",
|
|
59
59
|
/** e.g. "02:04:07 PM" */
|
|
60
60
|
TIME_12: "hh:mm:ss A"
|
|
61
|
+
}, Ae = {
|
|
62
|
+
/** Use the browser's local timezone (default behavior). */
|
|
63
|
+
LOCAL: "local",
|
|
64
|
+
/** Coordinated Universal Time. */
|
|
65
|
+
UTC: "UTC"
|
|
61
66
|
};
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
function oe(e, t) {
|
|
68
|
+
if (!t || t === "local") {
|
|
69
|
+
const g = e.getFullYear(), f = e.getMonth(), u = e.getDate(), y = e.getHours(), H = y % 12 || 12, d = e.getMinutes(), E = e.getSeconds(), I = e.getMilliseconds();
|
|
70
|
+
return { yr: g, mo: f, day: u, hr24: y, hr12: H, min: d, sec: E, ms: I, ampm: y < 12 ? "AM" : "PM" };
|
|
71
|
+
}
|
|
72
|
+
const o = new Intl.DateTimeFormat("en-US", {
|
|
73
|
+
timeZone: t,
|
|
74
|
+
year: "numeric",
|
|
75
|
+
month: "2-digit",
|
|
76
|
+
day: "2-digit",
|
|
77
|
+
hour: "2-digit",
|
|
78
|
+
minute: "2-digit",
|
|
79
|
+
second: "2-digit",
|
|
80
|
+
hour12: !1
|
|
81
|
+
}), l = {};
|
|
82
|
+
for (const g of o.formatToParts(e))
|
|
83
|
+
g.type !== "literal" && (l[g.type] = g.value);
|
|
84
|
+
const r = parseInt(l.year), s = parseInt(l.month) - 1, a = parseInt(l.day);
|
|
85
|
+
let n = parseInt(l.hour);
|
|
86
|
+
n === 24 && (n = 0);
|
|
87
|
+
const m = n % 12 || 12, c = parseInt(l.minute), h = parseInt(l.second), M = e.getMilliseconds();
|
|
88
|
+
return { yr: r, mo: s, day: a, hr24: n, hr12: m, min: c, sec: h, ms: M, ampm: n < 12 ? "AM" : "PM" };
|
|
89
|
+
}
|
|
90
|
+
function Ye(e, t) {
|
|
91
|
+
var r;
|
|
92
|
+
if (!t || t === "local") return null;
|
|
93
|
+
const o = te(e);
|
|
94
|
+
return ((r = new Intl.DateTimeFormat("en-US", {
|
|
95
|
+
timeZone: t,
|
|
96
|
+
timeZoneName: "short"
|
|
97
|
+
}).formatToParts(o).find((s) => s.type === "timeZoneName")) == null ? void 0 : r.value) ?? null;
|
|
98
|
+
}
|
|
99
|
+
function Te(e, t = fe.DEFAULT, o) {
|
|
100
|
+
const l = te(e), { yr: r, mo: s, day: a, hr24: n, hr12: m, min: c, sec: h, ms: M, ampm: g } = oe(l, o), f = (H) => String(H).padStart(2, "0"), u = (H) => String(H).padStart(3, "0"), y = {
|
|
101
|
+
YYYY: String(r),
|
|
102
|
+
YY: String(r).slice(-2),
|
|
103
|
+
MMMM: de[s],
|
|
104
|
+
MMM: ge[s],
|
|
105
|
+
MM: f(s + 1),
|
|
106
|
+
M: String(s + 1),
|
|
107
|
+
DD: f(a),
|
|
108
|
+
D: String(a),
|
|
109
|
+
HH: f(n),
|
|
110
|
+
H: String(n),
|
|
111
|
+
hh: f(m),
|
|
112
|
+
h: String(m),
|
|
113
|
+
mm: f(c),
|
|
114
|
+
ss: f(h),
|
|
115
|
+
SSS: u(M),
|
|
116
|
+
A: g,
|
|
117
|
+
a: g.toLowerCase()
|
|
81
118
|
};
|
|
82
119
|
return t.replace(
|
|
83
120
|
/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,
|
|
84
|
-
(
|
|
121
|
+
(H) => y[H] ?? H
|
|
85
122
|
);
|
|
86
123
|
}
|
|
87
|
-
function
|
|
124
|
+
function Ee(e = fe.DEFAULT) {
|
|
88
125
|
const t = ["YYYY", "YY", "MMMM", "MMM", "MM", "M", "DD", "D"], o = ["HH", "H", "hh", "h", "mm", "ss", "SSS", "A", "a"], l = (a) => a.replace(/\s{2,}/g, " ").trim().replace(/^[\s\W]+|[\s\W]+$/g, "").trim();
|
|
89
126
|
let r = e;
|
|
90
127
|
for (const a of t) r = r.replace(a, "");
|
|
@@ -92,27 +129,27 @@ function Le(e = me.DEFAULT) {
|
|
|
92
129
|
for (const a of o) s = s.replace(a, "");
|
|
93
130
|
return { timeFormat: l(r), dateFormat: l(s) };
|
|
94
131
|
}
|
|
95
|
-
function
|
|
96
|
-
return
|
|
132
|
+
function Ie(e, t = !1) {
|
|
133
|
+
return Te(e, t ? "HH:mm:ss" : "HH:mm");
|
|
97
134
|
}
|
|
98
|
-
function
|
|
99
|
-
const r =
|
|
135
|
+
function pe(e, t, o, l) {
|
|
136
|
+
const r = N(e), s = N(t), a = N(o);
|
|
100
137
|
if (a === s) return 0;
|
|
101
|
-
const
|
|
102
|
-
return Math.max(0, Math.min(1,
|
|
138
|
+
const n = (r - s) / (a - s);
|
|
139
|
+
return Math.max(0, Math.min(1, n)) * l;
|
|
103
140
|
}
|
|
104
|
-
function
|
|
105
|
-
const r = Math.max(0, Math.min(1, e / l)), s =
|
|
106
|
-
return
|
|
141
|
+
function we(e, t, o, l) {
|
|
142
|
+
const r = Math.max(0, Math.min(1, e / l)), s = N(t), a = N(o), n = s + r * (a - s);
|
|
143
|
+
return L.JulianDate.fromDate(new Date(n));
|
|
107
144
|
}
|
|
108
|
-
function
|
|
109
|
-
const r = [], s =
|
|
110
|
-
let
|
|
111
|
-
typeof o == "number" && o in
|
|
112
|
-
const
|
|
113
|
-
let c = a,
|
|
145
|
+
function _e(e, t, o, l) {
|
|
146
|
+
const r = [], s = Me(e, t), a = N(e);
|
|
147
|
+
let n;
|
|
148
|
+
typeof o == "number" && o in ce || typeof o == "number" ? n = o * 60 * 1e3 : n = 3600 * 1e3;
|
|
149
|
+
const m = n * 4;
|
|
150
|
+
let c = a, h = 0;
|
|
114
151
|
for (; c <= a + s; ) {
|
|
115
|
-
const M =
|
|
152
|
+
const M = h * n % m === 0, g = pe(
|
|
116
153
|
new Date(c),
|
|
117
154
|
e,
|
|
118
155
|
t,
|
|
@@ -120,18 +157,18 @@ function Ae(e, t, o, l) {
|
|
|
120
157
|
);
|
|
121
158
|
let f;
|
|
122
159
|
if (M) {
|
|
123
|
-
const
|
|
124
|
-
f = `${
|
|
160
|
+
const u = new Date(c), y = u.getHours().toString().padStart(2, "0"), H = u.getMinutes().toString().padStart(2, "0");
|
|
161
|
+
f = `${y}:${H}`;
|
|
125
162
|
}
|
|
126
163
|
r.push({
|
|
127
|
-
position:
|
|
164
|
+
position: g,
|
|
128
165
|
isMajor: M,
|
|
129
166
|
label: f
|
|
130
|
-
}), c +=
|
|
167
|
+
}), c += n, h++;
|
|
131
168
|
}
|
|
132
169
|
return r;
|
|
133
170
|
}
|
|
134
|
-
function
|
|
171
|
+
function Pe(e, t, o = 10) {
|
|
135
172
|
let l = t[0], r = Math.abs(l.position - e);
|
|
136
173
|
for (const s of t) {
|
|
137
174
|
const a = Math.abs(s.position - e);
|
|
@@ -139,7 +176,7 @@ function Ee(e, t, o = 10) {
|
|
|
139
176
|
}
|
|
140
177
|
return r <= o ? l.position : e;
|
|
141
178
|
}
|
|
142
|
-
const Se = 1e3,
|
|
179
|
+
const Se = 1e3, be = 31536e9, S = [
|
|
143
180
|
1e-3,
|
|
144
181
|
2e-3,
|
|
145
182
|
5e-3,
|
|
@@ -188,73 +225,78 @@ const Se = 1e3, Te = 31536e9, S = [
|
|
|
188
225
|
126144e5,
|
|
189
226
|
15768e6,
|
|
190
227
|
31536e6
|
|
191
|
-
], G = 36,
|
|
192
|
-
function
|
|
228
|
+
], G = 36, F = 1, De = 6, Q = 6, $e = 0.3, x = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
229
|
+
function Y(e) {
|
|
193
230
|
return e < 10 ? `0${e}` : `${e}`;
|
|
194
231
|
}
|
|
195
|
-
function
|
|
196
|
-
const
|
|
197
|
-
if (t > 31536e4) return `${
|
|
198
|
-
if (t > 31536e3) return `${x[
|
|
199
|
-
if (t > 604800) return `${x[
|
|
200
|
-
if (t > 86400) return `${x[
|
|
201
|
-
if (t > 3600) return `${
|
|
202
|
-
if (t > 60) return `${
|
|
203
|
-
const
|
|
204
|
-
return `${
|
|
232
|
+
function me(e, t, o) {
|
|
233
|
+
const l = new Date(e), { yr: r, mo: s, day: a, hr24: n, min: m, sec: c, ms: h } = oe(l, o);
|
|
234
|
+
if (t > 31536e4) return `${r}`;
|
|
235
|
+
if (t > 31536e3) return `${x[s]} ${r}`;
|
|
236
|
+
if (t > 604800) return `${x[s]} ${a}`;
|
|
237
|
+
if (t > 86400) return `${x[s]} ${a} ${Y(n)}:${Y(m)}`;
|
|
238
|
+
if (t > 3600) return `${Y(n)}:${Y(m)}`;
|
|
239
|
+
if (t > 60) return `${Y(n)}:${Y(m)}:${Y(c)}`;
|
|
240
|
+
const M = h > 0 ? `.${String(h).padStart(3, "0")}` : "";
|
|
241
|
+
return `${Y(n)}:${Y(m)}:${Y(c)}${M}`;
|
|
205
242
|
}
|
|
206
|
-
function
|
|
207
|
-
const
|
|
208
|
-
|
|
243
|
+
function ye(e, t, o) {
|
|
244
|
+
const l = new Date(e);
|
|
245
|
+
if (!o || o === "local") {
|
|
246
|
+
const m = l.getFullYear(), c = l.getMonth(), h = l.getDate();
|
|
247
|
+
return t > 31536e4 ? new Date(Math.floor(m / 100) * 100, 0).getTime() : t > 31536e3 ? new Date(Math.floor(m / 10) * 10, 0).getTime() : t > 86400 ? new Date(m, 0).getTime() : new Date(m, c, h).getTime();
|
|
248
|
+
}
|
|
249
|
+
const { yr: r, hr24: s, min: a, sec: n } = oe(l, o);
|
|
250
|
+
return t > 31536e4 ? Date.UTC(Math.floor(r / 100) * 100, 0, 1) : t > 31536e3 ? Date.UTC(Math.floor(r / 10) * 10, 0, 1) : t > 86400 ? Date.UTC(r, 0, 1) : e - (s * 3600 + a * 60 + n) * 1e3;
|
|
209
251
|
}
|
|
210
252
|
function ee(e, t) {
|
|
211
253
|
return Math.ceil(e / t + 0.5) * t;
|
|
212
254
|
}
|
|
213
|
-
function
|
|
214
|
-
var l, r, s, a,
|
|
255
|
+
function ue(e, t, o) {
|
|
256
|
+
var l, r, s, a, n, m, c, h, M, g, f, u;
|
|
215
257
|
return {
|
|
216
|
-
color: ((l = t.style) == null ? void 0 : l.color) ?? ((r = e.style) == null ? void 0 : r.color) ??
|
|
217
|
-
borderColor: ((s = t.style) == null ? void 0 : s.borderColor) ?? ((a = e.style) == null ? void 0 : a.borderColor) ?? (o == null ? void 0 : o.swimLaneItemBorderColor) ??
|
|
218
|
-
borderWidth: ((
|
|
219
|
-
opacity: ((c = t.style) == null ? void 0 : c.opacity) ?? ((
|
|
220
|
-
markerShape: ((M = t.style) == null ? void 0 : M.markerShape) ?? ((
|
|
221
|
-
markerSize: ((f = t.style) == null ? void 0 : f.markerSize) ?? ((
|
|
258
|
+
color: ((l = t.style) == null ? void 0 : l.color) ?? ((r = e.style) == null ? void 0 : r.color) ?? $.color,
|
|
259
|
+
borderColor: ((s = t.style) == null ? void 0 : s.borderColor) ?? ((a = e.style) == null ? void 0 : a.borderColor) ?? (o == null ? void 0 : o.swimLaneItemBorderColor) ?? $.borderColor,
|
|
260
|
+
borderWidth: ((n = t.style) == null ? void 0 : n.borderWidth) ?? ((m = e.style) == null ? void 0 : m.borderWidth) ?? (o == null ? void 0 : o.swimLaneItemBorderWidth) ?? $.borderWidth,
|
|
261
|
+
opacity: ((c = t.style) == null ? void 0 : c.opacity) ?? ((h = e.style) == null ? void 0 : h.opacity) ?? $.opacity,
|
|
262
|
+
markerShape: ((M = t.style) == null ? void 0 : M.markerShape) ?? ((g = e.style) == null ? void 0 : g.markerShape) ?? $.markerShape,
|
|
263
|
+
markerSize: ((f = t.style) == null ? void 0 : f.markerSize) ?? ((u = e.style) == null ? void 0 : u.markerSize) ?? $.markerSize
|
|
222
264
|
};
|
|
223
265
|
}
|
|
224
|
-
function
|
|
225
|
-
return Math.max(Se, Math.min(
|
|
266
|
+
function He(e) {
|
|
267
|
+
return Math.max(Se, Math.min(be, e));
|
|
226
268
|
}
|
|
227
|
-
function
|
|
228
|
-
const l = t - e, r = (e + t) / 2, s =
|
|
269
|
+
function Re(e, t, o) {
|
|
270
|
+
const l = t - e, r = (e + t) / 2, s = He(l * o);
|
|
229
271
|
return {
|
|
230
272
|
startMs: r - s / 2,
|
|
231
273
|
endMs: r + s / 2
|
|
232
274
|
};
|
|
233
275
|
}
|
|
234
|
-
function
|
|
276
|
+
function Ne(e) {
|
|
235
277
|
let t = 0;
|
|
236
|
-
for (const o of e) t += (o.height ?? R) +
|
|
278
|
+
for (const o of e) t += (o.height ?? R) + F;
|
|
237
279
|
return t;
|
|
238
280
|
}
|
|
239
|
-
function
|
|
240
|
-
const { swimLanes: s, showSwimLanes: a, scrollTop:
|
|
281
|
+
function We(e, t, o, l, r) {
|
|
282
|
+
const { swimLanes: s, showSwimLanes: a, scrollTop: n, startMs: m, endMs: c, theme: h } = r;
|
|
241
283
|
if (!a || s.length === 0) return null;
|
|
242
284
|
const M = Math.max(0, l - G);
|
|
243
285
|
if (t < 0 || t >= M) return null;
|
|
244
|
-
let
|
|
286
|
+
let g = -n;
|
|
245
287
|
for (const f of s) {
|
|
246
|
-
const
|
|
247
|
-
if (
|
|
248
|
-
for (const
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
if (e >= Math.max(0,
|
|
252
|
-
return { lane: f, item:
|
|
288
|
+
const u = f.height ?? R, y = g, H = g + u;
|
|
289
|
+
if (g += u + F, !(t < y || t >= H)) {
|
|
290
|
+
for (const d of f.items) {
|
|
291
|
+
if (d.interval) {
|
|
292
|
+
const E = L.JulianDate.toDate(d.interval.start).getTime(), I = L.JulianDate.toDate(d.interval.stop).getTime(), U = (E - m) / (c - m) * o, X = (I - m) / (c - m) * o;
|
|
293
|
+
if (e >= Math.max(0, U) && e <= Math.min(o, X))
|
|
294
|
+
return { lane: f, item: d };
|
|
253
295
|
}
|
|
254
|
-
if (
|
|
255
|
-
const
|
|
256
|
-
if (Math.abs(e -
|
|
257
|
-
return { lane: f, item:
|
|
296
|
+
if (d.instant) {
|
|
297
|
+
const I = (L.JulianDate.toDate(d.instant).getTime() - m) / (c - m) * o, U = ue(f, d, h);
|
|
298
|
+
if (Math.abs(e - I) <= U.markerSize / 2 + 2)
|
|
299
|
+
return { lane: f, item: d };
|
|
258
300
|
}
|
|
259
301
|
}
|
|
260
302
|
return null;
|
|
@@ -262,186 +304,190 @@ function Re(e, t, o, l, r) {
|
|
|
262
304
|
}
|
|
263
305
|
return null;
|
|
264
306
|
}
|
|
265
|
-
function
|
|
307
|
+
function Je(e, t, o, l) {
|
|
266
308
|
const { swimLanes: r, showSwimLanes: s, scrollTop: a } = l;
|
|
267
309
|
if (!s || r.length === 0 || e > 80) return null;
|
|
268
|
-
const
|
|
269
|
-
if (t < 0 || t >=
|
|
270
|
-
let
|
|
310
|
+
const n = Math.max(0, o - G);
|
|
311
|
+
if (t < 0 || t >= n) return null;
|
|
312
|
+
let m = -a;
|
|
271
313
|
for (const c of r) {
|
|
272
|
-
const
|
|
273
|
-
if (t >=
|
|
274
|
-
|
|
314
|
+
const h = c.height ?? R;
|
|
315
|
+
if (t >= m && t < m + h) return c;
|
|
316
|
+
m += h + F;
|
|
275
317
|
}
|
|
276
318
|
return null;
|
|
277
319
|
}
|
|
278
|
-
function
|
|
320
|
+
function Fe(e, t, o) {
|
|
279
321
|
if (!o.showSwimLanes || o.swimLanes.length === 0) return !1;
|
|
280
322
|
const l = Math.max(0, t - G);
|
|
281
323
|
return e >= 0 && e < l;
|
|
282
324
|
}
|
|
283
|
-
function
|
|
325
|
+
function Oe(e, t, o, l) {
|
|
284
326
|
const {
|
|
285
327
|
startMs: r,
|
|
286
328
|
endMs: s,
|
|
287
329
|
currentMs: a,
|
|
288
|
-
theme:
|
|
289
|
-
maxTicks:
|
|
330
|
+
theme: n,
|
|
331
|
+
maxTicks: m,
|
|
290
332
|
swimLanes: c,
|
|
291
|
-
showSwimLanes:
|
|
292
|
-
reorderState: M
|
|
333
|
+
showSwimLanes: h,
|
|
334
|
+
reorderState: M,
|
|
335
|
+
timezone: g
|
|
293
336
|
} = l;
|
|
294
|
-
let { scrollTop:
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
e.fillStyle =
|
|
298
|
-
const
|
|
299
|
-
let
|
|
300
|
-
if (
|
|
301
|
-
for (const
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
304
|
-
e.save(), e.beginPath(), e.rect(0, 0, t,
|
|
305
|
-
let
|
|
306
|
-
const
|
|
337
|
+
let { scrollTop: f } = l;
|
|
338
|
+
const u = (s - r) / 1e3;
|
|
339
|
+
if (u <= 0) return f;
|
|
340
|
+
e.fillStyle = n.backgroundColor, e.fillRect(0, 0, t, o);
|
|
341
|
+
const y = h && c.length > 0, d = y ? Math.max(0, o - G) : 0;
|
|
342
|
+
let E = 0;
|
|
343
|
+
if (y)
|
|
344
|
+
for (const i of c) E += (i.height ?? R) + F;
|
|
345
|
+
const I = Math.max(0, E - d);
|
|
346
|
+
if (f > I && (f = I), f < 0 && (f = 0), y && d > 0) {
|
|
347
|
+
e.save(), e.beginPath(), e.rect(0, 0, t, d), e.clip();
|
|
348
|
+
let i = -f;
|
|
349
|
+
const b = (D) => (D - r) / (s - r) * t;
|
|
307
350
|
for (const D of c) {
|
|
308
|
-
const
|
|
309
|
-
if (
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
for (const
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
315
|
-
const
|
|
316
|
-
if (
|
|
317
|
-
e.globalAlpha =
|
|
318
|
-
const
|
|
319
|
-
e.fillRect(
|
|
351
|
+
const p = D.height ?? R, C = i + p;
|
|
352
|
+
if (C > 0 && i < d) {
|
|
353
|
+
const T = D.style, O = (T == null ? void 0 : T.backgroundColor) ?? $.backgroundColor;
|
|
354
|
+
O && O !== "transparent" && (e.fillStyle = O, e.fillRect(0, i, t, p)), e.strokeStyle = n.tickColor + "44", e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, C), e.lineTo(t, C), e.stroke();
|
|
355
|
+
for (const w of D.items) {
|
|
356
|
+
const k = ue(D, w, n);
|
|
357
|
+
if (w.interval) {
|
|
358
|
+
const K = L.JulianDate.toDate(w.interval.start).getTime(), A = L.JulianDate.toDate(w.interval.stop).getTime(), W = b(K), J = b(A), V = Math.max(0, W), q = Math.min(t, J) - V;
|
|
359
|
+
if (q > 0) {
|
|
360
|
+
e.globalAlpha = k.opacity, e.fillStyle = k.color;
|
|
361
|
+
const se = 3, le = i + se, ae = p - se * 2;
|
|
362
|
+
e.fillRect(V, le, q, ae), k.borderWidth > 0 && (e.strokeStyle = k.borderColor, e.lineWidth = k.borderWidth, e.strokeRect(V, le, q, ae)), e.globalAlpha = 1;
|
|
320
363
|
}
|
|
321
364
|
}
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
const
|
|
326
|
-
e.globalAlpha =
|
|
365
|
+
if (w.instant) {
|
|
366
|
+
const K = L.JulianDate.toDate(w.instant).getTime(), A = b(K);
|
|
367
|
+
if (A >= -k.markerSize && A <= t + k.markerSize) {
|
|
368
|
+
const W = i + p / 2, J = k.markerSize;
|
|
369
|
+
e.globalAlpha = k.opacity, e.fillStyle = k.color, k.markerShape === "diamond" ? (e.beginPath(), e.moveTo(A, W - J / 2), e.lineTo(A + J / 2, W), e.lineTo(A, W + J / 2), e.lineTo(A - J / 2, W), e.closePath(), e.fill()) : k.markerShape === "circle" ? (e.beginPath(), e.arc(A, W, J / 2, 0, Math.PI * 2), e.fill()) : (e.strokeStyle = k.color, e.lineWidth = 2, e.beginPath(), e.moveTo(A, i + 2), e.lineTo(A, i + p - 2), e.stroke()), e.globalAlpha = 1;
|
|
327
370
|
}
|
|
328
371
|
}
|
|
329
372
|
}
|
|
330
|
-
e.font = `${Math.min(11,
|
|
373
|
+
e.font = `${Math.min(11, p - 4)}px system-ui, sans-serif`, e.textAlign = "left", e.textBaseline = "middle", e.fillStyle = (T == null ? void 0 : T.labelColor) ?? $.labelColor, e.fillText(D.label, De, i + p / 2);
|
|
331
374
|
}
|
|
332
|
-
if (
|
|
375
|
+
if (i += p + F, i >= d) break;
|
|
333
376
|
}
|
|
334
377
|
if (M && M.dragging) {
|
|
335
378
|
const D = M.currentY - M.dragStartY;
|
|
336
|
-
let
|
|
337
|
-
for (let
|
|
338
|
-
|
|
339
|
-
e.strokeStyle =
|
|
340
|
-
const
|
|
341
|
-
if (
|
|
342
|
-
const
|
|
343
|
-
let
|
|
344
|
-
for (const
|
|
345
|
-
if (
|
|
346
|
-
|
|
379
|
+
let p = -f;
|
|
380
|
+
for (let T = 0; T < c.length && T < M.insertIndex; T++)
|
|
381
|
+
p += (c[T].height ?? R) + F;
|
|
382
|
+
e.strokeStyle = n.indicatorColor, e.lineWidth = 2, e.beginPath(), e.moveTo(0, p), e.lineTo(t, p), e.stroke();
|
|
383
|
+
const C = c.find((T) => T.id === M.dragLaneId);
|
|
384
|
+
if (C) {
|
|
385
|
+
const T = C.height ?? R;
|
|
386
|
+
let O = -f;
|
|
387
|
+
for (const w of c) {
|
|
388
|
+
if (w.id === M.dragLaneId) break;
|
|
389
|
+
O += (w.height ?? R) + F;
|
|
347
390
|
}
|
|
348
|
-
e.globalAlpha = 0.4, e.fillStyle =
|
|
391
|
+
e.globalAlpha = 0.4, e.fillStyle = n.indicatorColor, e.fillRect(0, O + D, t, T), e.globalAlpha = 1;
|
|
349
392
|
}
|
|
350
393
|
}
|
|
351
|
-
if (
|
|
352
|
-
const D = t -
|
|
353
|
-
e.fillStyle =
|
|
394
|
+
if (E > d) {
|
|
395
|
+
const D = t - Q - 2, p = d / E, C = Math.max(20, d * p), T = f / I * (d - C);
|
|
396
|
+
e.fillStyle = n.tickColor + "22", e.fillRect(D, 0, Q, d), e.fillStyle = n.tickColor + "88", e.fillRect(D, T, Q, C);
|
|
354
397
|
}
|
|
355
398
|
e.restore();
|
|
356
399
|
}
|
|
357
|
-
e.font = `${
|
|
358
|
-
const
|
|
359
|
-
let _ = S[S.length - 1],
|
|
360
|
-
for (let
|
|
361
|
-
if (S[
|
|
362
|
-
_ = S[
|
|
400
|
+
e.font = `${n.fontSize}px monospace`;
|
|
401
|
+
const U = me(r + u * 500, u, g), X = e.measureText(U).width + 24, he = Math.max(X / t * u, u / 1e3);
|
|
402
|
+
let _ = S[S.length - 1], B = S.length - 1;
|
|
403
|
+
for (let i = 0; i < S.length; i++)
|
|
404
|
+
if (S[i] > he) {
|
|
405
|
+
_ = S[i], B = i;
|
|
363
406
|
break;
|
|
364
407
|
}
|
|
365
|
-
if (
|
|
366
|
-
for (;
|
|
367
|
-
|
|
368
|
-
let
|
|
369
|
-
for (let
|
|
370
|
-
if (_ % S[
|
|
371
|
-
t * (S[
|
|
408
|
+
if (m != null && m > 0)
|
|
409
|
+
for (; B < S.length - 1 && u / _ > m; )
|
|
410
|
+
B++, _ = S[B];
|
|
411
|
+
let P = 0;
|
|
412
|
+
for (let i = B - 1; i >= 0; i--)
|
|
413
|
+
if (_ % S[i] < 1e-4) {
|
|
414
|
+
t * (S[i] / u) >= 3 && (P = S[i]);
|
|
372
415
|
break;
|
|
373
416
|
}
|
|
374
|
-
let
|
|
375
|
-
if (
|
|
376
|
-
for (let
|
|
377
|
-
if (
|
|
378
|
-
|
|
417
|
+
let z = 0;
|
|
418
|
+
if (P > 0) {
|
|
419
|
+
for (let i = 0; i < S.length && S[i] < P; i++)
|
|
420
|
+
if (P % S[i] < 1e-4 && t * (S[i] / u) >= 3) {
|
|
421
|
+
z = S[i];
|
|
379
422
|
break;
|
|
380
423
|
}
|
|
381
424
|
}
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
e.strokeStyle =
|
|
385
|
-
for (let
|
|
386
|
-
const
|
|
387
|
-
e.beginPath(), e.moveTo(
|
|
425
|
+
const ne = ye(r, u, g), j = (r - ne) / 1e3, Z = j + u, v = (i) => t * ((i - j) / u);
|
|
426
|
+
if (z > 0) {
|
|
427
|
+
e.strokeStyle = n.tickColor, e.lineWidth = 1;
|
|
428
|
+
for (let i = Math.floor(j / z) * z; i <= Z; i = ee(i, z)) {
|
|
429
|
+
const b = v(i);
|
|
430
|
+
e.beginPath(), e.moveTo(b, o - n.minorTickHeight), e.lineTo(b, o), e.stroke();
|
|
388
431
|
}
|
|
389
432
|
}
|
|
390
|
-
if (
|
|
391
|
-
e.strokeStyle =
|
|
392
|
-
for (let
|
|
393
|
-
const
|
|
394
|
-
e.beginPath(), e.moveTo(
|
|
433
|
+
if (P > 0) {
|
|
434
|
+
e.strokeStyle = n.tickColor, e.lineWidth = 1;
|
|
435
|
+
for (let i = Math.floor(j / P) * P; i <= Z; i = ee(i, P)) {
|
|
436
|
+
const b = v(i);
|
|
437
|
+
e.beginPath(), e.moveTo(b, o - n.minorTickHeight), e.lineTo(b, o), e.stroke();
|
|
395
438
|
}
|
|
396
439
|
}
|
|
397
440
|
e.textAlign = "center", e.textBaseline = "bottom";
|
|
398
|
-
let
|
|
399
|
-
for (let
|
|
400
|
-
const
|
|
401
|
-
e.strokeStyle =
|
|
402
|
-
const
|
|
403
|
-
|
|
441
|
+
let re = -1 / 0;
|
|
442
|
+
for (let i = Math.floor(j / _) * _; i <= Z + _; i = ee(i, _)) {
|
|
443
|
+
const b = v(i), D = ne + i * 1e3;
|
|
444
|
+
e.strokeStyle = n.majorTickColor, e.lineWidth = 1, e.beginPath(), e.moveTo(b, o - n.majorTickHeight), e.lineTo(b, o), e.stroke();
|
|
445
|
+
const p = me(D, u, g), C = e.measureText(p).width, T = b - C / 2;
|
|
446
|
+
T > re && (e.fillStyle = n.labelColor, e.fillText(p, b, o - n.majorTickHeight - 4), re = T + C + 5);
|
|
404
447
|
}
|
|
405
|
-
const
|
|
406
|
-
return e.strokeStyle =
|
|
448
|
+
const ie = (a - r) / (s - r) * t;
|
|
449
|
+
return e.strokeStyle = n.indicatorColor, e.lineWidth = n.indicatorLineWidth, e.beginPath(), e.moveTo(ie, 0), e.lineTo(ie, o), e.stroke(), f;
|
|
407
450
|
}
|
|
408
451
|
export {
|
|
409
452
|
R as DEFAULT_LANE_HEIGHT,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
453
|
+
fe as DateTimeFormats,
|
|
454
|
+
De as LABEL_PAD_LEFT,
|
|
455
|
+
F as LANE_GAP,
|
|
456
|
+
be as MAX_SPAN_MS,
|
|
414
457
|
Se as MIN_SPAN_MS,
|
|
415
458
|
x as MONTHS,
|
|
416
|
-
|
|
417
|
-
|
|
459
|
+
Q as SCROLLBAR_WIDTH,
|
|
460
|
+
$e as SWIM_LANE_SCROLL_SPEED,
|
|
418
461
|
G as TICK_AREA_HEIGHT,
|
|
419
462
|
S as TIC_SCALES,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
463
|
+
ce as TickInterval,
|
|
464
|
+
Ae as Timezones,
|
|
465
|
+
ye as calcEpochMs,
|
|
466
|
+
He as clampSpan,
|
|
467
|
+
$ as defaultSwimLaneStyle,
|
|
468
|
+
ke as defaultTheme,
|
|
469
|
+
Oe as drawTimeline,
|
|
470
|
+
Te as formatDateTime,
|
|
471
|
+
Ie as formatTime,
|
|
472
|
+
Ce as fromMilliseconds,
|
|
473
|
+
_e as generateTicks,
|
|
474
|
+
oe as getDateParts,
|
|
475
|
+
Me as getDurationMs,
|
|
476
|
+
Ye as getTimezoneAbbr,
|
|
477
|
+
Je as hitTestLaneLabel,
|
|
478
|
+
We as hitTestSwimLane,
|
|
479
|
+
Fe as isInSwimLaneRegion,
|
|
480
|
+
me as makeLabel,
|
|
435
481
|
ee as nextTic,
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
482
|
+
we as positionToTime,
|
|
483
|
+
ue as resolveItemStyle,
|
|
484
|
+
Pe as snapToTick,
|
|
485
|
+
Ee as splitForDisplay,
|
|
486
|
+
pe as timeToPosition,
|
|
487
|
+
te as toDate,
|
|
488
|
+
Le as toJulianDate,
|
|
489
|
+
N as toMilliseconds,
|
|
490
|
+
Ne as totalSwimLaneHeight,
|
|
491
|
+
Y as twoD,
|
|
492
|
+
Re as zoomRange
|
|
447
493
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(r,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("cesium")):typeof define=="function"&&define.amd?define(["exports","cesium"],B):(r=typeof globalThis<"u"?globalThis:r||self,B(r.CesiumTimelineCore={},r.Cesium))})(this,(function(r,B){"use strict";function Le(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const H=Le(B),He={backgroundColor:"#1a1a1a",tickColor:"#666666",majorTickColor:"#999999",labelColor:"#cccccc",indicatorColor:"#d69826",indicatorLineWidth:5,majorTickHeight:10,minorTickHeight:5,fontSize:12,controlBarBackground:"#242424",controlBarBorder:"#333333",buttonColor:"#666666",buttonHoverColor:"#888888",buttonActiveColor:"#d69826",swimLaneItemBorderColor:"#666666",swimLaneItemBorderWidth:0};var Q=(e=>(e[e.FIFTEEN_MIN=15]="FIFTEEN_MIN",e[e.THIRTY_MIN=30]="THIRTY_MIN",e[e.HOURLY=60]="HOURLY",e[e.CUSTOM=-1]="CUSTOM",e))(Q||{});const E={color:"#4da6ff",borderColor:"#2980b9",borderWidth:1,opacity:.8,markerShape:"diamond",markerSize:10,labelColor:"#cccccc",backgroundColor:"transparent"},w=24;function ke(e){return e instanceof H.JulianDate?H.JulianDate.clone(e):H.JulianDate.fromDate(e)}function Z(e){return e instanceof H.JulianDate?H.JulianDate.toDate(e):e}function I(e){return Z(e).getTime()}function pe(e){return H.JulianDate.fromDate(new Date(e))}function se(e,t){return I(t)-I(e)}const Ae=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ce=["January","February","March","April","May","June","July","August","September","October","November","December"],x={DEFAULT:"MMM DD YYYY HH:mm:ss",TWELVE_HR:"MMM DD YYYY hh:mm:ss A",ISO:"YYYY-MM-DD HH:mm:ss",US:"MM/DD/YYYY HH:mm",EU:"DD/MM/YYYY HH:mm",TIME_ONLY:"HH:mm:ss",TIME_12:"hh:mm:ss A"};function ce(e,t=x.DEFAULT){const o=Z(e),a=o.getFullYear(),i=o.getMonth(),s=o.getDate(),c=o.getHours(),l=c%12||12,M=o.getMinutes(),m=o.getSeconds(),T=o.getMilliseconds(),g=c<12?"AM":"PM",f=_=>String(_).padStart(2,"0"),u=_=>String(_).padStart(3,"0"),b={YYYY:String(a),YY:String(a).slice(-2),MMMM:Ce[i],MMM:Ae[i],MM:f(i+1),M:String(i+1),DD:f(s),D:String(s),HH:f(c),H:String(c),hh:f(l),h:String(l),mm:f(M),ss:f(m),SSS:u(T),A:g,a:g.toLowerCase()};return t.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,_=>b[_]??_)}function _e(e=x.DEFAULT){const t=["YYYY","YY","MMMM","MMM","MM","M","DD","D"],o=["HH","H","hh","h","mm","ss","SSS","A","a"],a=c=>c.replace(/\s{2,}/g," ").trim().replace(/^[\s\W]+|[\s\W]+$/g,"").trim();let i=e;for(const c of t)i=i.replace(c,"");let s=e;for(const c of o)s=s.replace(c,"");return{timeFormat:a(i),dateFormat:a(s)}}function Ye(e,t=!1){return ce(e,t?"HH:mm:ss":"HH:mm")}function me(e,t,o,a){const i=I(e),s=I(t),c=I(o);if(c===s)return 0;const l=(i-s)/(c-s);return Math.max(0,Math.min(1,l))*a}function Ee(e,t,o,a){const i=Math.max(0,Math.min(1,e/a)),s=I(t),c=I(o),l=s+i*(c-s);return H.JulianDate.fromDate(new Date(l))}function we(e,t,o,a){const i=[],s=se(e,t),c=I(e);let l;typeof o=="number"&&o in Q||typeof o=="number"?l=o*60*1e3:l=3600*1e3;const M=l*4;let m=c,T=0;for(;m<=c+s;){const g=T*l%M===0,f=me(new Date(m),e,t,a);let u;if(g){const b=new Date(m),_=b.getHours().toString().padStart(2,"0"),D=b.getMinutes().toString().padStart(2,"0");u=`${_}:${D}`}i.push({position:f,isMajor:g,label:u}),m+=l,T++}return i}function Ie(e,t,o=10){let a=t[0],i=Math.abs(a.position-e);for(const s of t){const c=Math.abs(s.position-e);c<i&&(i=c,a=s)}return i<=o?a.position:e}const fe=1e3,ue=31536e9,d=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],z=36,R=1,Me=6,K=6,Pe=.3,q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(e){return e<10?`0${e}`:`${e}`}function ee(e,t){const o=new Date(e),a=o.getFullYear(),i=o.getMonth(),s=o.getDate(),c=o.getHours(),l=o.getMinutes(),M=o.getSeconds(),m=o.getMilliseconds();if(t>31536e4)return`${a}`;if(t>31536e3)return`${q[i]} ${a}`;if(t>604800)return`${q[i]} ${s}`;if(t>86400)return`${q[i]} ${s} ${C(c)}:${C(l)}`;if(t>3600)return`${C(c)}:${C(l)}`;if(t>60)return`${C(c)}:${C(l)}:${C(M)}`;const T=m>0?`.${String(m).padStart(3,"0")}`:"";return`${C(c)}:${C(l)}:${C(M)}${T}`}function he(e,t){const o=new Date(e),a=o.getFullYear(),i=o.getMonth(),s=o.getDate();return t>31536e4?new Date(Math.floor(a/100)*100,0).getTime():t>31536e3?new Date(Math.floor(a/10)*10,0).getTime():t>86400?new Date(a,0).getTime():new Date(a,i,s).getTime()}function V(e,t){return Math.ceil(e/t+.5)*t}function te(e,t,o){var a,i,s,c,l,M,m,T,g,f,u,b;return{color:((a=t.style)==null?void 0:a.color)??((i=e.style)==null?void 0:i.color)??E.color,borderColor:((s=t.style)==null?void 0:s.borderColor)??((c=e.style)==null?void 0:c.borderColor)??(o==null?void 0:o.swimLaneItemBorderColor)??E.borderColor,borderWidth:((l=t.style)==null?void 0:l.borderWidth)??((M=e.style)==null?void 0:M.borderWidth)??(o==null?void 0:o.swimLaneItemBorderWidth)??E.borderWidth,opacity:((m=t.style)==null?void 0:m.opacity)??((T=e.style)==null?void 0:T.opacity)??E.opacity,markerShape:((g=t.style)==null?void 0:g.markerShape)??((f=e.style)==null?void 0:f.markerShape)??E.markerShape,markerSize:((u=t.style)==null?void 0:u.markerSize)??((b=e.style)==null?void 0:b.markerSize)??E.markerSize}}function ge(e){return Math.max(fe,Math.min(ue,e))}function Re(e,t,o){const a=t-e,i=(e+t)/2,s=ge(a*o);return{startMs:i-s/2,endMs:i+s/2}}function Ne(e){let t=0;for(const o of e)t+=(o.height??w)+R;return t}function Oe(e,t,o,a,i){const{swimLanes:s,showSwimLanes:c,scrollTop:l,startMs:M,endMs:m,theme:T}=i;if(!c||s.length===0)return null;const g=Math.max(0,a-z);if(t<0||t>=g)return null;let f=-l;for(const u of s){const b=u.height??w,_=f,D=f+b;if(f+=b+R,!(t<_||t>=D)){for(const k of u.items){if(k.interval){const F=H.JulianDate.toDate(k.interval.start).getTime(),j=H.JulianDate.toDate(k.interval.stop).getTime(),U=(F-M)/(m-M)*o,oe=(j-M)/(m-M)*o;if(e>=Math.max(0,U)&&e<=Math.min(o,oe))return{lane:u,item:k}}if(k.instant){const j=(H.JulianDate.toDate(k.instant).getTime()-M)/(m-M)*o,U=te(u,k,T);if(Math.abs(e-j)<=U.markerSize/2+2)return{lane:u,item:k}}}return null}}return null}function We(e,t,o,a){const{swimLanes:i,showSwimLanes:s,scrollTop:c}=a;if(!s||i.length===0||e>80)return null;const l=Math.max(0,o-z);if(t<0||t>=l)return null;let M=-c;for(const m of i){const T=m.height??w;if(t>=M&&t<M+T)return m;M+=T+R}return null}function $e(e,t,o){if(!o.showSwimLanes||o.swimLanes.length===0)return!1;const a=Math.max(0,t-z);return e>=0&&e<a}function Fe(e,t,o,a){const{startMs:i,endMs:s,currentMs:c,theme:l,maxTicks:M,swimLanes:m,showSwimLanes:T,reorderState:g}=a;let{scrollTop:f}=a;const u=(s-i)/1e3;if(u<=0)return f;e.fillStyle=l.backgroundColor,e.fillRect(0,0,t,o);const b=T&&m.length>0,D=b?Math.max(0,o-z):0;let k=0;if(b)for(const n of m)k+=(n.height??w)+R;const F=Math.max(0,k-D);if(f>F&&(f=F),f<0&&(f=0),b&&D>0){e.save(),e.beginPath(),e.rect(0,0,t,D),e.clip();let n=-f;const y=L=>(L-i)/(s-i)*t;for(const L of m){const S=L.height??w,A=n+S;if(A>0&&n<D){const h=L.style,J=(h==null?void 0:h.backgroundColor)??E.backgroundColor;J&&J!=="transparent"&&(e.fillStyle=J,e.fillRect(0,n,t,S)),e.strokeStyle=l.tickColor+"44",e.lineWidth=.5,e.beginPath(),e.moveTo(0,A),e.lineTo(t,A),e.stroke();for(const P of L.items){const p=te(L,P,l);if(P.interval){const re=H.JulianDate.toDate(P.interval.start).getTime(),Y=H.JulianDate.toDate(P.interval.stop).getTime(),W=y(re),$=y(Y),le=Math.max(0,W),ae=Math.min(t,$)-le;if(ae>0){e.globalAlpha=p.opacity,e.fillStyle=p.color;const be=3,De=n+be,ye=S-be*2;e.fillRect(le,De,ae,ye),p.borderWidth>0&&(e.strokeStyle=p.borderColor,e.lineWidth=p.borderWidth,e.strokeRect(le,De,ae,ye)),e.globalAlpha=1}}if(P.instant){const re=H.JulianDate.toDate(P.instant).getTime(),Y=y(re);if(Y>=-p.markerSize&&Y<=t+p.markerSize){const W=n+S/2,$=p.markerSize;e.globalAlpha=p.opacity,e.fillStyle=p.color,p.markerShape==="diamond"?(e.beginPath(),e.moveTo(Y,W-$/2),e.lineTo(Y+$/2,W),e.lineTo(Y,W+$/2),e.lineTo(Y-$/2,W),e.closePath(),e.fill()):p.markerShape==="circle"?(e.beginPath(),e.arc(Y,W,$/2,0,Math.PI*2),e.fill()):(e.strokeStyle=p.color,e.lineWidth=2,e.beginPath(),e.moveTo(Y,n+2),e.lineTo(Y,n+S-2),e.stroke()),e.globalAlpha=1}}}e.font=`${Math.min(11,S-4)}px system-ui, sans-serif`,e.textAlign="left",e.textBaseline="middle",e.fillStyle=(h==null?void 0:h.labelColor)??E.labelColor,e.fillText(L.label,Me,n+S/2)}if(n+=S+R,n>=D)break}if(g&&g.dragging){const L=g.currentY-g.dragStartY;let S=-f;for(let h=0;h<m.length&&h<g.insertIndex;h++)S+=(m[h].height??w)+R;e.strokeStyle=l.indicatorColor,e.lineWidth=2,e.beginPath(),e.moveTo(0,S),e.lineTo(t,S),e.stroke();const A=m.find(h=>h.id===g.dragLaneId);if(A){const h=A.height??w;let J=-f;for(const P of m){if(P.id===g.dragLaneId)break;J+=(P.height??w)+R}e.globalAlpha=.4,e.fillStyle=l.indicatorColor,e.fillRect(0,J+L,t,h),e.globalAlpha=1}}if(k>D){const L=t-K-2,S=D/k,A=Math.max(20,D*S),h=f/F*(D-A);e.fillStyle=l.tickColor+"22",e.fillRect(L,0,K,D),e.fillStyle=l.tickColor+"88",e.fillRect(L,h,K,A)}e.restore()}e.font=`${l.fontSize}px monospace`;const j=ee(i+u*500,u),U=e.measureText(j).width+24,oe=Math.max(U/t*u,u/1e3);let N=d[d.length-1],G=d.length-1;for(let n=0;n<d.length;n++)if(d[n]>oe){N=d[n],G=n;break}if(M!=null&&M>0)for(;G<d.length-1&&u/N>M;)G++,N=d[G];let O=0;for(let n=G-1;n>=0;n--)if(N%d[n]<1e-4){t*(d[n]/u)>=3&&(O=d[n]);break}let v=0;if(O>0){for(let n=0;n<d.length&&d[n]<O;n++)if(O%d[n]<1e-4&&t*(d[n]/u)>=3){v=d[n];break}}const de=he(i,u),X=(i-de)/1e3,ne=X+u,ie=n=>t*((n-X)/u);if(v>0){e.strokeStyle=l.tickColor,e.lineWidth=1;for(let n=Math.floor(X/v)*v;n<=ne;n=V(n,v)){const y=ie(n);e.beginPath(),e.moveTo(y,o-l.minorTickHeight),e.lineTo(y,o),e.stroke()}}if(O>0){e.strokeStyle=l.tickColor,e.lineWidth=1;for(let n=Math.floor(X/O)*O;n<=ne;n=V(n,O)){const y=ie(n);e.beginPath(),e.moveTo(y,o-l.minorTickHeight),e.lineTo(y,o),e.stroke()}}e.textAlign="center",e.textBaseline="bottom";let Se=-1/0;for(let n=Math.floor(X/N)*N;n<=ne+N;n=V(n,N)){const y=ie(n),L=de+n*1e3;e.strokeStyle=l.majorTickColor,e.lineWidth=1,e.beginPath(),e.moveTo(y,o-l.majorTickHeight),e.lineTo(y,o),e.stroke();const S=ee(L,u),A=e.measureText(S).width,h=y-A/2;h>Se&&(e.fillStyle=l.labelColor,e.fillText(S,y,o-l.majorTickHeight-4),Se=h+A+5)}const Te=(c-i)/(s-i)*t;return e.strokeStyle=l.indicatorColor,e.lineWidth=l.indicatorLineWidth,e.beginPath(),e.moveTo(Te,0),e.lineTo(Te,o),e.stroke(),f}r.DEFAULT_LANE_HEIGHT=w,r.DateTimeFormats=x,r.LABEL_PAD_LEFT=Me,r.LANE_GAP=R,r.MAX_SPAN_MS=ue,r.MIN_SPAN_MS=fe,r.MONTHS=q,r.SCROLLBAR_WIDTH=K,r.SWIM_LANE_SCROLL_SPEED=Pe,r.TICK_AREA_HEIGHT=z,r.TIC_SCALES=d,r.TickInterval=Q,r.calcEpochMs=he,r.clampSpan=ge,r.defaultSwimLaneStyle=E,r.defaultTheme=He,r.drawTimeline=Fe,r.formatDateTime=ce,r.formatTime=Ye,r.fromMilliseconds=pe,r.generateTicks=we,r.getDurationMs=se,r.hitTestLaneLabel=We,r.hitTestSwimLane=Oe,r.isInSwimLaneRegion=$e,r.makeLabel=ee,r.nextTic=V,r.positionToTime=Ee,r.resolveItemStyle=te,r.snapToTick=Ie,r.splitForDisplay=_e,r.timeToPosition=me,r.toDate=Z,r.toJulianDate=ke,r.toMilliseconds=I,r.totalSwimLaneHeight=Ne,r.twoD=C,r.zoomRange=Re,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(a,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("cesium")):typeof define=="function"&&define.amd?define(["exports","cesium"],B):(a=typeof globalThis<"u"?globalThis:a||self,B(a.CesiumTimelineCore={},a.Cesium))})(this,(function(a,B){"use strict";function Le(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,l.get?l:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const L=Le(B),He={backgroundColor:"#1a1a1a",tickColor:"#666666",majorTickColor:"#999999",labelColor:"#cccccc",indicatorColor:"#d69826",indicatorLineWidth:5,majorTickHeight:10,minorTickHeight:5,fontSize:12,controlBarBackground:"#242424",controlBarBorder:"#333333",buttonColor:"#666666",buttonHoverColor:"#888888",buttonActiveColor:"#d69826",swimLaneItemBorderColor:"#666666",swimLaneItemBorderWidth:0};var x=(e=>(e[e.FIFTEEN_MIN=15]="FIFTEEN_MIN",e[e.THIRTY_MIN=30]="THIRTY_MIN",e[e.HOURLY=60]="HOURLY",e[e.CUSTOM=-1]="CUSTOM",e))(x||{});const E={color:"#4da6ff",borderColor:"#2980b9",borderWidth:1,opacity:.8,markerShape:"diamond",markerSize:10,labelColor:"#cccccc",backgroundColor:"transparent"},I=24;function ke(e){return e instanceof L.JulianDate?L.JulianDate.clone(e):L.JulianDate.fromDate(e)}function K(e){return e instanceof L.JulianDate?L.JulianDate.toDate(e):e}function P(e){return K(e).getTime()}function Ae(e){return L.JulianDate.fromDate(new Date(e))}function me(e,t){return P(t)-P(e)}const Ce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],_e=["January","February","March","April","May","June","July","August","September","October","November","December"],ee={DEFAULT:"MMM DD YYYY HH:mm:ss",TWELVE_HR:"MMM DD YYYY hh:mm:ss A",ISO:"YYYY-MM-DD HH:mm:ss",US:"MM/DD/YYYY HH:mm",EU:"DD/MM/YYYY HH:mm",TIME_ONLY:"HH:mm:ss",TIME_12:"hh:mm:ss A"},Ye={LOCAL:"local",UTC:"UTC"};function Z(e,t){if(!t||t==="local"){const T=e.getFullYear(),u=e.getMonth(),h=e.getDate(),H=e.getHours(),k=H%12||12,d=e.getMinutes(),w=e.getSeconds(),N=e.getMilliseconds();return{yr:T,mo:u,day:h,hr24:H,hr12:k,min:d,sec:w,ms:N,ampm:H<12?"AM":"PM"}}const o=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),l={};for(const T of o.formatToParts(e))T.type!=="literal"&&(l[T.type]=T.value);const i=parseInt(l.year),s=parseInt(l.month)-1,m=parseInt(l.day);let n=parseInt(l.hour);n===24&&(n=0);const c=n%12||12,f=parseInt(l.minute),M=parseInt(l.second),g=e.getMilliseconds();return{yr:i,mo:s,day:m,hr24:n,hr12:c,min:f,sec:M,ms:g,ampm:n<12?"AM":"PM"}}function Ee(e,t){var i;if(!t||t==="local")return null;const o=K(e);return((i=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(o).find(s=>s.type==="timeZoneName"))==null?void 0:i.value)??null}function ce(e,t=ee.DEFAULT,o){const l=K(e),{yr:i,mo:s,day:m,hr24:n,hr12:c,min:f,sec:M,ms:g,ampm:T}=Z(l,o),u=k=>String(k).padStart(2,"0"),h=k=>String(k).padStart(3,"0"),H={YYYY:String(i),YY:String(i).slice(-2),MMMM:_e[s],MMM:Ce[s],MM:u(s+1),M:String(s+1),DD:u(m),D:String(m),HH:u(n),H:String(n),hh:u(c),h:String(c),mm:u(f),ss:u(M),SSS:h(g),A:T,a:T.toLowerCase()};return t.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,k=>H[k]??k)}function Ie(e=ee.DEFAULT){const t=["YYYY","YY","MMMM","MMM","MM","M","DD","D"],o=["HH","H","hh","h","mm","ss","SSS","A","a"],l=m=>m.replace(/\s{2,}/g," ").trim().replace(/^[\s\W]+|[\s\W]+$/g,"").trim();let i=e;for(const m of t)i=i.replace(m,"");let s=e;for(const m of o)s=s.replace(m,"");return{timeFormat:l(i),dateFormat:l(s)}}function Pe(e,t=!1){return ce(e,t?"HH:mm:ss":"HH:mm")}function fe(e,t,o,l){const i=P(e),s=P(t),m=P(o);if(m===s)return 0;const n=(i-s)/(m-s);return Math.max(0,Math.min(1,n))*l}function we(e,t,o,l){const i=Math.max(0,Math.min(1,e/l)),s=P(t),m=P(o),n=s+i*(m-s);return L.JulianDate.fromDate(new Date(n))}function Ne(e,t,o,l){const i=[],s=me(e,t),m=P(e);let n;typeof o=="number"&&o in x||typeof o=="number"?n=o*60*1e3:n=3600*1e3;const c=n*4;let f=m,M=0;for(;f<=m+s;){const g=M*n%c===0,T=fe(new Date(f),e,t,l);let u;if(g){const h=new Date(f),H=h.getHours().toString().padStart(2,"0"),k=h.getMinutes().toString().padStart(2,"0");u=`${H}:${k}`}i.push({position:T,isMajor:g,label:u}),f+=n,M++}return i}function Re(e,t,o=10){let l=t[0],i=Math.abs(l.position-e);for(const s of t){const m=Math.abs(s.position-e);m<i&&(i=m,l=s)}return i<=o?l.position:e}const ue=1e3,he=31536e9,b=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],z=36,O=1,Me=6,q=6,Oe=.3,V=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function _(e){return e<10?`0${e}`:`${e}`}function te(e,t,o){const l=new Date(e),{yr:i,mo:s,day:m,hr24:n,min:c,sec:f,ms:M}=Z(l,o);if(t>31536e4)return`${i}`;if(t>31536e3)return`${V[s]} ${i}`;if(t>604800)return`${V[s]} ${m}`;if(t>86400)return`${V[s]} ${m} ${_(n)}:${_(c)}`;if(t>3600)return`${_(n)}:${_(c)}`;if(t>60)return`${_(n)}:${_(c)}:${_(f)}`;const g=M>0?`.${String(M).padStart(3,"0")}`:"";return`${_(n)}:${_(c)}:${_(f)}${g}`}function ge(e,t,o){const l=new Date(e);if(!o||o==="local"){const c=l.getFullYear(),f=l.getMonth(),M=l.getDate();return t>31536e4?new Date(Math.floor(c/100)*100,0).getTime():t>31536e3?new Date(Math.floor(c/10)*10,0).getTime():t>86400?new Date(c,0).getTime():new Date(c,f,M).getTime()}const{yr:i,hr24:s,min:m,sec:n}=Z(l,o);return t>31536e4?Date.UTC(Math.floor(i/100)*100,0,1):t>31536e3?Date.UTC(Math.floor(i/10)*10,0,1):t>86400?Date.UTC(i,0,1):e-(s*3600+m*60+n)*1e3}function Q(e,t){return Math.ceil(e/t+.5)*t}function oe(e,t,o){var l,i,s,m,n,c,f,M,g,T,u,h;return{color:((l=t.style)==null?void 0:l.color)??((i=e.style)==null?void 0:i.color)??E.color,borderColor:((s=t.style)==null?void 0:s.borderColor)??((m=e.style)==null?void 0:m.borderColor)??(o==null?void 0:o.swimLaneItemBorderColor)??E.borderColor,borderWidth:((n=t.style)==null?void 0:n.borderWidth)??((c=e.style)==null?void 0:c.borderWidth)??(o==null?void 0:o.swimLaneItemBorderWidth)??E.borderWidth,opacity:((f=t.style)==null?void 0:f.opacity)??((M=e.style)==null?void 0:M.opacity)??E.opacity,markerShape:((g=t.style)==null?void 0:g.markerShape)??((T=e.style)==null?void 0:T.markerShape)??E.markerShape,markerSize:((u=t.style)==null?void 0:u.markerSize)??((h=e.style)==null?void 0:h.markerSize)??E.markerSize}}function Te(e){return Math.max(ue,Math.min(he,e))}function Fe(e,t,o){const l=t-e,i=(e+t)/2,s=Te(l*o);return{startMs:i-s/2,endMs:i+s/2}}function We(e){let t=0;for(const o of e)t+=(o.height??I)+O;return t}function $e(e,t,o,l,i){const{swimLanes:s,showSwimLanes:m,scrollTop:n,startMs:c,endMs:f,theme:M}=i;if(!m||s.length===0)return null;const g=Math.max(0,l-z);if(t<0||t>=g)return null;let T=-n;for(const u of s){const h=u.height??I,H=T,k=T+h;if(T+=h+O,!(t<H||t>=k)){for(const d of u.items){if(d.interval){const w=L.JulianDate.toDate(d.interval.start).getTime(),N=L.JulianDate.toDate(d.interval.stop).getTime(),j=(w-c)/(f-c)*o,ne=(N-c)/(f-c)*o;if(e>=Math.max(0,j)&&e<=Math.min(o,ne))return{lane:u,item:d}}if(d.instant){const N=(L.JulianDate.toDate(d.instant).getTime()-c)/(f-c)*o,j=oe(u,d,M);if(Math.abs(e-N)<=j.markerSize/2+2)return{lane:u,item:d}}}return null}}return null}function Je(e,t,o,l){const{swimLanes:i,showSwimLanes:s,scrollTop:m}=l;if(!s||i.length===0||e>80)return null;const n=Math.max(0,o-z);if(t<0||t>=n)return null;let c=-m;for(const f of i){const M=f.height??I;if(t>=c&&t<c+M)return f;c+=M+O}return null}function Ue(e,t,o){if(!o.showSwimLanes||o.swimLanes.length===0)return!1;const l=Math.max(0,t-z);return e>=0&&e<l}function Be(e,t,o,l){const{startMs:i,endMs:s,currentMs:m,theme:n,maxTicks:c,swimLanes:f,showSwimLanes:M,reorderState:g,timezone:T}=l;let{scrollTop:u}=l;const h=(s-i)/1e3;if(h<=0)return u;e.fillStyle=n.backgroundColor,e.fillRect(0,0,t,o);const H=M&&f.length>0,d=H?Math.max(0,o-z):0;let w=0;if(H)for(const r of f)w+=(r.height??I)+O;const N=Math.max(0,w-d);if(u>N&&(u=N),u<0&&(u=0),H&&d>0){e.save(),e.beginPath(),e.rect(0,0,t,d),e.clip();let r=-u;const y=p=>(p-i)/(s-i)*t;for(const p of f){const D=p.height??I,C=r+D;if(C>0&&r<d){const S=p.style,U=(S==null?void 0:S.backgroundColor)??E.backgroundColor;U&&U!=="transparent"&&(e.fillStyle=U,e.fillRect(0,r,t,D)),e.strokeStyle=n.tickColor+"44",e.lineWidth=.5,e.beginPath(),e.moveTo(0,C),e.lineTo(t,C),e.stroke();for(const R of p.items){const A=oe(p,R,n);if(R.interval){const ae=L.JulianDate.toDate(R.interval.start).getTime(),Y=L.JulianDate.toDate(R.interval.stop).getTime(),$=y(ae),J=y(Y),le=Math.max(0,$),se=Math.min(t,J)-le;if(se>0){e.globalAlpha=A.opacity,e.fillStyle=A.color;const De=3,ye=r+De,pe=D-De*2;e.fillRect(le,ye,se,pe),A.borderWidth>0&&(e.strokeStyle=A.borderColor,e.lineWidth=A.borderWidth,e.strokeRect(le,ye,se,pe)),e.globalAlpha=1}}if(R.instant){const ae=L.JulianDate.toDate(R.instant).getTime(),Y=y(ae);if(Y>=-A.markerSize&&Y<=t+A.markerSize){const $=r+D/2,J=A.markerSize;e.globalAlpha=A.opacity,e.fillStyle=A.color,A.markerShape==="diamond"?(e.beginPath(),e.moveTo(Y,$-J/2),e.lineTo(Y+J/2,$),e.lineTo(Y,$+J/2),e.lineTo(Y-J/2,$),e.closePath(),e.fill()):A.markerShape==="circle"?(e.beginPath(),e.arc(Y,$,J/2,0,Math.PI*2),e.fill()):(e.strokeStyle=A.color,e.lineWidth=2,e.beginPath(),e.moveTo(Y,r+2),e.lineTo(Y,r+D-2),e.stroke()),e.globalAlpha=1}}}e.font=`${Math.min(11,D-4)}px system-ui, sans-serif`,e.textAlign="left",e.textBaseline="middle",e.fillStyle=(S==null?void 0:S.labelColor)??E.labelColor,e.fillText(p.label,Me,r+D/2)}if(r+=D+O,r>=d)break}if(g&&g.dragging){const p=g.currentY-g.dragStartY;let D=-u;for(let S=0;S<f.length&&S<g.insertIndex;S++)D+=(f[S].height??I)+O;e.strokeStyle=n.indicatorColor,e.lineWidth=2,e.beginPath(),e.moveTo(0,D),e.lineTo(t,D),e.stroke();const C=f.find(S=>S.id===g.dragLaneId);if(C){const S=C.height??I;let U=-u;for(const R of f){if(R.id===g.dragLaneId)break;U+=(R.height??I)+O}e.globalAlpha=.4,e.fillStyle=n.indicatorColor,e.fillRect(0,U+p,t,S),e.globalAlpha=1}}if(w>d){const p=t-q-2,D=d/w,C=Math.max(20,d*D),S=u/N*(d-C);e.fillStyle=n.tickColor+"22",e.fillRect(p,0,q,d),e.fillStyle=n.tickColor+"88",e.fillRect(p,S,q,C)}e.restore()}e.font=`${n.fontSize}px monospace`;const j=te(i+h*500,h,T),ne=e.measureText(j).width+24,ze=Math.max(ne/t*h,h/1e3);let F=b[b.length-1],v=b.length-1;for(let r=0;r<b.length;r++)if(b[r]>ze){F=b[r],v=r;break}if(c!=null&&c>0)for(;v<b.length-1&&h/F>c;)v++,F=b[v];let W=0;for(let r=v-1;r>=0;r--)if(F%b[r]<1e-4){t*(b[r]/h)>=3&&(W=b[r]);break}let G=0;if(W>0){for(let r=0;r<b.length&&b[r]<W;r++)if(W%b[r]<1e-4&&t*(b[r]/h)>=3){G=b[r];break}}const de=ge(i,h,T),X=(i-de)/1e3,ie=X+h,re=r=>t*((r-X)/h);if(G>0){e.strokeStyle=n.tickColor,e.lineWidth=1;for(let r=Math.floor(X/G)*G;r<=ie;r=Q(r,G)){const y=re(r);e.beginPath(),e.moveTo(y,o-n.minorTickHeight),e.lineTo(y,o),e.stroke()}}if(W>0){e.strokeStyle=n.tickColor,e.lineWidth=1;for(let r=Math.floor(X/W)*W;r<=ie;r=Q(r,W)){const y=re(r);e.beginPath(),e.moveTo(y,o-n.minorTickHeight),e.lineTo(y,o),e.stroke()}}e.textAlign="center",e.textBaseline="bottom";let Se=-1/0;for(let r=Math.floor(X/F)*F;r<=ie+F;r=Q(r,F)){const y=re(r),p=de+r*1e3;e.strokeStyle=n.majorTickColor,e.lineWidth=1,e.beginPath(),e.moveTo(y,o-n.majorTickHeight),e.lineTo(y,o),e.stroke();const D=te(p,h,T),C=e.measureText(D).width,S=y-C/2;S>Se&&(e.fillStyle=n.labelColor,e.fillText(D,y,o-n.majorTickHeight-4),Se=S+C+5)}const be=(m-i)/(s-i)*t;return e.strokeStyle=n.indicatorColor,e.lineWidth=n.indicatorLineWidth,e.beginPath(),e.moveTo(be,0),e.lineTo(be,o),e.stroke(),u}a.DEFAULT_LANE_HEIGHT=I,a.DateTimeFormats=ee,a.LABEL_PAD_LEFT=Me,a.LANE_GAP=O,a.MAX_SPAN_MS=he,a.MIN_SPAN_MS=ue,a.MONTHS=V,a.SCROLLBAR_WIDTH=q,a.SWIM_LANE_SCROLL_SPEED=Oe,a.TICK_AREA_HEIGHT=z,a.TIC_SCALES=b,a.TickInterval=x,a.Timezones=Ye,a.calcEpochMs=ge,a.clampSpan=Te,a.defaultSwimLaneStyle=E,a.defaultTheme=He,a.drawTimeline=Be,a.formatDateTime=ce,a.formatTime=Pe,a.fromMilliseconds=Ae,a.generateTicks=Ne,a.getDateParts=Z,a.getDurationMs=me,a.getTimezoneAbbr=Ee,a.hitTestLaneLabel=Je,a.hitTestSwimLane=$e,a.isInSwimLaneRegion=Ue,a.makeLabel=te,a.nextTic=Q,a.positionToTime=we,a.resolveItemStyle=oe,a.snapToTick=Re,a.splitForDisplay=Ie,a.timeToPosition=fe,a.toDate=K,a.toJulianDate=ke,a.toMilliseconds=P,a.totalSwimLaneHeight=We,a.twoD=_,a.zoomRange=Fe,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Cesium from 'cesium';
|
|
2
2
|
|
|
3
3
|
/** Pick a round epoch near startMs so tick offsets are clean integers (mirrors Cesium). */
|
|
4
|
-
export declare function calcEpochMs(startMs: number, durationSec: number): number;
|
|
4
|
+
export declare function calcEpochMs(startMs: number, durationSec: number, timezone?: string): number;
|
|
5
5
|
|
|
6
6
|
/** Clamp a time span to the allowed zoom range. */
|
|
7
7
|
export declare function clampSpan(span: number): number;
|
|
@@ -18,6 +18,8 @@ export declare interface ControlsBaseProps {
|
|
|
18
18
|
multiplier: number;
|
|
19
19
|
/** @see TimelineBaseProps.dateTimeFormat */
|
|
20
20
|
dateTimeFormat?: string;
|
|
21
|
+
/** @see TimelineBaseProps.timezone */
|
|
22
|
+
timezone?: string;
|
|
21
23
|
/** @see TimelineBaseProps.onDateTimeClick */
|
|
22
24
|
onDateTimeClick?: () => void;
|
|
23
25
|
/** Toggle play / pause. */
|
|
@@ -52,6 +54,19 @@ export declare interface ControlsBaseProps {
|
|
|
52
54
|
onToggleSwimLanes?: () => void;
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
/** Decomposed date/time fields extracted in a specific timezone. `mo` is 0-indexed. */
|
|
58
|
+
export declare interface DateParts {
|
|
59
|
+
yr: number;
|
|
60
|
+
mo: number;
|
|
61
|
+
day: number;
|
|
62
|
+
hr24: number;
|
|
63
|
+
hr12: number;
|
|
64
|
+
min: number;
|
|
65
|
+
sec: number;
|
|
66
|
+
ms: number;
|
|
67
|
+
ampm: 'AM' | 'PM';
|
|
68
|
+
}
|
|
69
|
+
|
|
55
70
|
/** Built-in format presets. Pass one of these (or any custom string) as `dateTimeFormat`. */
|
|
56
71
|
export declare const DateTimeFormats: {
|
|
57
72
|
/** e.g. "Feb 24 2026 14:04:07" — default */
|
|
@@ -113,7 +128,7 @@ export declare function drawTimeline(ctx: CanvasRenderingContext2D, w: number, h
|
|
|
113
128
|
* A – AM / PM uppercase
|
|
114
129
|
* a – am / pm lowercase
|
|
115
130
|
*/
|
|
116
|
-
export declare function formatDateTime(date: Cesium.JulianDate | Date, format?: string): string;
|
|
131
|
+
export declare function formatDateTime(date: Cesium.JulianDate | Date, format?: string, timezone?: string): string;
|
|
117
132
|
|
|
118
133
|
/** @deprecated Use formatDateTime instead */
|
|
119
134
|
export declare function formatTime(date: Cesium.JulianDate | Date, includeSeconds?: boolean): string;
|
|
@@ -122,8 +137,21 @@ export declare function fromMilliseconds(ms: number): Cesium.JulianDate;
|
|
|
122
137
|
|
|
123
138
|
export declare function generateTicks(startTime: Cesium.JulianDate | Date, endTime: Cesium.JulianDate | Date, tickInterval: TickInterval | number, width: number): Tick[];
|
|
124
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Extract date/time components in the given timezone.
|
|
142
|
+
* When `timezone` is `undefined` or `'local'`, the browser's local time methods are used.
|
|
143
|
+
* Otherwise, `Intl.DateTimeFormat#formatToParts` is used for timezone-accurate extraction.
|
|
144
|
+
*/
|
|
145
|
+
export declare function getDateParts(date: Date, timezone?: string): DateParts;
|
|
146
|
+
|
|
125
147
|
export declare function getDurationMs(startTime: Cesium.JulianDate | Date, endTime: Cesium.JulianDate | Date): number;
|
|
126
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Return the short timezone abbreviation for the given date in the given timezone,
|
|
151
|
+
* e.g. `"UTC"`, `"EST"`, `"PDT"`. Returns `null` when timezone is `undefined` or `'local'`.
|
|
152
|
+
*/
|
|
153
|
+
export declare function getTimezoneAbbr(date: Cesium.JulianDate | Date, timezone?: string): string | null;
|
|
154
|
+
|
|
127
155
|
/** Check if a Y coordinate is in the swim lane label area (leftmost ~80px). */
|
|
128
156
|
export declare function hitTestLaneLabel(canvasX: number, canvasY: number, canvasH: number, state: Pick<TimelineRenderState, 'swimLanes' | 'showSwimLanes' | 'scrollTop'>): SwimLane | null;
|
|
129
157
|
|
|
@@ -141,7 +169,7 @@ export declare const LABEL_PAD_LEFT = 6;
|
|
|
141
169
|
/** Gap in pixels between swim lane rows. */
|
|
142
170
|
export declare const LANE_GAP = 1;
|
|
143
171
|
|
|
144
|
-
export declare function makeLabel(ms: number, durationSec: number): string;
|
|
172
|
+
export declare function makeLabel(ms: number, durationSec: number, timezone?: string): string;
|
|
145
173
|
|
|
146
174
|
/** Maximum visible span: ~1 000 years — stays within TIC_SCALES range. */
|
|
147
175
|
export declare const MAX_SPAN_MS = 31536000000000;
|
|
@@ -339,6 +367,14 @@ export declare interface TimelineBaseProps {
|
|
|
339
367
|
* Defaults to [1, 2, 4, 8, 16, 32].
|
|
340
368
|
*/
|
|
341
369
|
rwSpeeds?: number[];
|
|
370
|
+
/**
|
|
371
|
+
* IANA timezone string used for all datetime display on the timeline.
|
|
372
|
+
* Examples: `'UTC'`, `'America/New_York'`, `'Europe/London'`.
|
|
373
|
+
* Use `'local'` (default) to use the browser's local timezone.
|
|
374
|
+
* When set to a value other than `'local'`, a timezone abbreviation label
|
|
375
|
+
* (e.g. "UTC", "EST", "PDT") is shown to the right of the date display.
|
|
376
|
+
*/
|
|
377
|
+
timezone?: string;
|
|
342
378
|
/** Partial theme overrides merged with the default theme. */
|
|
343
379
|
theme?: Partial<TimelineTheme>;
|
|
344
380
|
/**
|
|
@@ -386,6 +422,8 @@ export declare interface TimelineRenderState {
|
|
|
386
422
|
showSwimLanes: boolean;
|
|
387
423
|
scrollTop: number;
|
|
388
424
|
reorderState: ReorderState | null;
|
|
425
|
+
/** @see TimelineBaseProps.timezone */
|
|
426
|
+
timezone?: string;
|
|
389
427
|
}
|
|
390
428
|
|
|
391
429
|
export declare interface TimelineTheme {
|
|
@@ -417,6 +455,14 @@ export declare interface TimePosition {
|
|
|
417
455
|
|
|
418
456
|
export declare function timeToPosition(time: Cesium.JulianDate | Date, startTime: Cesium.JulianDate | Date, endTime: Cesium.JulianDate | Date, width: number): number;
|
|
419
457
|
|
|
458
|
+
/** Convenience constants for the `timezone` prop. */
|
|
459
|
+
export declare const Timezones: {
|
|
460
|
+
/** Use the browser's local timezone (default behavior). */
|
|
461
|
+
readonly LOCAL: "local";
|
|
462
|
+
/** Coordinated Universal Time. */
|
|
463
|
+
readonly UTC: "UTC";
|
|
464
|
+
};
|
|
465
|
+
|
|
420
466
|
export declare function toDate(date: Cesium.JulianDate | Date): Date;
|
|
421
467
|
|
|
422
468
|
export declare function toJulianDate(date: Cesium.JulianDate | Date): Cesium.JulianDate;
|