@kteneyck/cesium-timeline-core 0.6.0 → 0.8.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 +310 -286
- package/dist/cesium-timeline-core.umd.cjs +1 -1
- package/dist/index.d.ts +42 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
function
|
|
1
|
+
import * as C from "cesium";
|
|
2
|
+
function Ce(e, t) {
|
|
3
3
|
return typeof e == "function" ? e(t) : e;
|
|
4
4
|
}
|
|
5
|
-
const
|
|
5
|
+
const Ae = {
|
|
6
6
|
dateTimeClickTooltip: "Click to jump to a date/time",
|
|
7
7
|
liveLabel: "LIVE",
|
|
8
8
|
liveActiveLabel: "● LIVE",
|
|
@@ -21,8 +21,22 @@ const He = {
|
|
|
21
21
|
fastForwardTooltip: "Fast forward",
|
|
22
22
|
fastForwardActiveTooltip: (e) => `${e}× speed — click to increase, click again at max to reset`,
|
|
23
23
|
collapseSwimLanesTooltip: "Collapse swim lanes",
|
|
24
|
-
expandSwimLanesTooltip: "Expand swim lanes"
|
|
25
|
-
|
|
24
|
+
expandSwimLanesTooltip: "Expand swim lanes",
|
|
25
|
+
months: [
|
|
26
|
+
"Jan",
|
|
27
|
+
"Feb",
|
|
28
|
+
"Mar",
|
|
29
|
+
"Apr",
|
|
30
|
+
"May",
|
|
31
|
+
"Jun",
|
|
32
|
+
"Jul",
|
|
33
|
+
"Aug",
|
|
34
|
+
"Sep",
|
|
35
|
+
"Oct",
|
|
36
|
+
"Nov",
|
|
37
|
+
"Dec"
|
|
38
|
+
]
|
|
39
|
+
}, Ye = {
|
|
26
40
|
backgroundColor: "#1a1a1a",
|
|
27
41
|
tickColor: "#666666",
|
|
28
42
|
majorTickColor: "#999999",
|
|
@@ -41,7 +55,7 @@ const He = {
|
|
|
41
55
|
swimLaneItemBorderWidth: 0
|
|
42
56
|
};
|
|
43
57
|
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 || {});
|
|
44
|
-
const
|
|
58
|
+
const P = {
|
|
45
59
|
color: "#4da6ff",
|
|
46
60
|
borderColor: "#2980b9",
|
|
47
61
|
borderWidth: 1,
|
|
@@ -50,23 +64,23 @@ const _ = {
|
|
|
50
64
|
markerSize: 10,
|
|
51
65
|
labelColor: "#cccccc",
|
|
52
66
|
backgroundColor: "transparent"
|
|
53
|
-
},
|
|
54
|
-
function
|
|
55
|
-
return e instanceof
|
|
67
|
+
}, R = 24;
|
|
68
|
+
function we(e) {
|
|
69
|
+
return e instanceof C.JulianDate ? C.JulianDate.clone(e) : C.JulianDate.fromDate(e);
|
|
56
70
|
}
|
|
57
|
-
function
|
|
58
|
-
return e instanceof
|
|
71
|
+
function ee(e) {
|
|
72
|
+
return e instanceof C.JulianDate ? C.JulianDate.toDate(e) : e;
|
|
59
73
|
}
|
|
60
74
|
function F(e) {
|
|
61
|
-
return
|
|
75
|
+
return ee(e).getTime();
|
|
62
76
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
77
|
+
function Ee(e) {
|
|
78
|
+
return C.JulianDate.fromDate(new Date(e));
|
|
65
79
|
}
|
|
66
|
-
function
|
|
80
|
+
function de(e, t) {
|
|
67
81
|
return F(t) - F(e);
|
|
68
82
|
}
|
|
69
|
-
const
|
|
83
|
+
const ge = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], Te = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], me = {
|
|
70
84
|
/** e.g. "Feb 24 2026 14:04:07" — default */
|
|
71
85
|
DEFAULT: "MMM DD YYYY HH:mm:ss",
|
|
72
86
|
/** e.g. "Feb 24 2026 02:04:07 PM" */
|
|
@@ -81,16 +95,16 @@ const Me = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"
|
|
|
81
95
|
TIME_ONLY: "HH:mm:ss",
|
|
82
96
|
/** e.g. "02:04:07 PM" */
|
|
83
97
|
TIME_12: "hh:mm:ss A"
|
|
84
|
-
},
|
|
98
|
+
}, $e = {
|
|
85
99
|
/** Use the browser's local timezone (default behavior). */
|
|
86
100
|
LOCAL: "local",
|
|
87
101
|
/** Coordinated Universal Time. */
|
|
88
102
|
UTC: "UTC"
|
|
89
103
|
};
|
|
90
|
-
function
|
|
104
|
+
function te(e, t) {
|
|
91
105
|
if (!t || t === "local") {
|
|
92
|
-
const M = e.getFullYear(),
|
|
93
|
-
return { yr: M, mo:
|
|
106
|
+
const M = e.getFullYear(), u = e.getMonth(), S = e.getDate(), h = e.getHours(), f = h % 12 || 12, T = e.getMinutes(), N = e.getSeconds(), b = e.getMilliseconds();
|
|
107
|
+
return { yr: M, mo: u, day: S, hr24: h, hr12: f, min: T, sec: N, ms: b, ampm: h < 12 ? "AM" : "PM" };
|
|
94
108
|
}
|
|
95
109
|
const o = new Intl.DateTimeFormat("en-US", {
|
|
96
110
|
timeZone: t,
|
|
@@ -101,105 +115,105 @@ function oe(e, t) {
|
|
|
101
115
|
minute: "2-digit",
|
|
102
116
|
second: "2-digit",
|
|
103
117
|
hour12: !1
|
|
104
|
-
}),
|
|
118
|
+
}), i = {};
|
|
105
119
|
for (const M of o.formatToParts(e))
|
|
106
|
-
M.type !== "literal" && (
|
|
107
|
-
const
|
|
108
|
-
let
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
return { yr:
|
|
120
|
+
M.type !== "literal" && (i[M.type] = M.value);
|
|
121
|
+
const n = parseInt(i.year), l = parseInt(i.month) - 1, a = parseInt(i.day);
|
|
122
|
+
let r = parseInt(i.hour);
|
|
123
|
+
r === 24 && (r = 0);
|
|
124
|
+
const c = r % 12 || 12, m = parseInt(i.minute), d = parseInt(i.second), p = e.getMilliseconds();
|
|
125
|
+
return { yr: n, mo: l, day: a, hr24: r, hr12: c, min: m, sec: d, ms: p, ampm: r < 12 ? "AM" : "PM" };
|
|
112
126
|
}
|
|
113
|
-
function
|
|
114
|
-
var
|
|
127
|
+
function Ie(e, t) {
|
|
128
|
+
var n;
|
|
115
129
|
if (!t || t === "local") return null;
|
|
116
|
-
const o =
|
|
117
|
-
return ((
|
|
130
|
+
const o = ee(e);
|
|
131
|
+
return ((n = new Intl.DateTimeFormat("en-US", {
|
|
118
132
|
timeZone: t,
|
|
119
133
|
timeZoneName: "short"
|
|
120
|
-
}).formatToParts(o).find((
|
|
134
|
+
}).formatToParts(o).find((l) => l.type === "timeZoneName")) == null ? void 0 : n.value) ?? null;
|
|
121
135
|
}
|
|
122
|
-
function
|
|
123
|
-
const
|
|
124
|
-
YYYY: String(
|
|
125
|
-
YY: String(
|
|
126
|
-
MMMM:
|
|
127
|
-
MMM:
|
|
128
|
-
MM:
|
|
129
|
-
M: String(
|
|
130
|
-
DD:
|
|
136
|
+
function Se(e, t = me.DEFAULT, o) {
|
|
137
|
+
const i = ee(e), { yr: n, mo: l, day: a, hr24: r, hr12: c, min: m, sec: d, ms: p, ampm: M } = te(i, o), u = (f) => String(f).padStart(2, "0"), S = (f) => String(f).padStart(3, "0"), h = {
|
|
138
|
+
YYYY: String(n),
|
|
139
|
+
YY: String(n).slice(-2),
|
|
140
|
+
MMMM: Te[l],
|
|
141
|
+
MMM: ge[l],
|
|
142
|
+
MM: u(l + 1),
|
|
143
|
+
M: String(l + 1),
|
|
144
|
+
DD: u(a),
|
|
131
145
|
D: String(a),
|
|
132
|
-
HH:
|
|
133
|
-
H: String(
|
|
134
|
-
hh:
|
|
135
|
-
h: String(
|
|
136
|
-
mm:
|
|
137
|
-
ss:
|
|
138
|
-
SSS:
|
|
146
|
+
HH: u(r),
|
|
147
|
+
H: String(r),
|
|
148
|
+
hh: u(c),
|
|
149
|
+
h: String(c),
|
|
150
|
+
mm: u(m),
|
|
151
|
+
ss: u(d),
|
|
152
|
+
SSS: S(p),
|
|
139
153
|
A: M,
|
|
140
154
|
a: M.toLowerCase()
|
|
141
155
|
};
|
|
142
156
|
return t.replace(
|
|
143
157
|
/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,
|
|
144
|
-
(
|
|
158
|
+
(f) => h[f] ?? f
|
|
145
159
|
);
|
|
146
160
|
}
|
|
147
|
-
function
|
|
148
|
-
const t = ["YYYY", "YY", "MMMM", "MMM", "MM", "M", "DD", "D"], o = ["HH", "H", "hh", "h", "mm", "ss", "SSS", "A", "a"],
|
|
149
|
-
let
|
|
150
|
-
for (const a of t)
|
|
151
|
-
let
|
|
152
|
-
for (const a of o)
|
|
153
|
-
return { timeFormat:
|
|
161
|
+
function Je(e = me.DEFAULT) {
|
|
162
|
+
const t = ["YYYY", "YY", "MMMM", "MMM", "MM", "M", "DD", "D"], o = ["HH", "H", "hh", "h", "mm", "ss", "SSS", "A", "a"], i = (a) => a.replace(/\s{2,}/g, " ").trim().replace(/^[\s\W]+|[\s\W]+$/g, "").trim();
|
|
163
|
+
let n = e;
|
|
164
|
+
for (const a of t) n = n.replace(a, "");
|
|
165
|
+
let l = e;
|
|
166
|
+
for (const a of o) l = l.replace(a, "");
|
|
167
|
+
return { timeFormat: i(n), dateFormat: i(l) };
|
|
154
168
|
}
|
|
155
169
|
function Pe(e, t = !1) {
|
|
156
|
-
return
|
|
170
|
+
return Se(e, t ? "HH:mm:ss" : "HH:mm");
|
|
157
171
|
}
|
|
158
|
-
function
|
|
159
|
-
const
|
|
160
|
-
if (a ===
|
|
161
|
-
const
|
|
162
|
-
return Math.max(0, Math.min(1,
|
|
172
|
+
function ye(e, t, o, i) {
|
|
173
|
+
const n = F(e), l = F(t), a = F(o);
|
|
174
|
+
if (a === l) return 0;
|
|
175
|
+
const r = (n - l) / (a - l);
|
|
176
|
+
return Math.max(0, Math.min(1, r)) * i;
|
|
163
177
|
}
|
|
164
|
-
function Re(e, t, o,
|
|
165
|
-
const
|
|
166
|
-
return
|
|
178
|
+
function Re(e, t, o, i) {
|
|
179
|
+
const n = Math.max(0, Math.min(1, e / i)), l = F(t), a = F(o), r = l + n * (a - l);
|
|
180
|
+
return C.JulianDate.fromDate(new Date(r));
|
|
167
181
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
170
|
-
let
|
|
171
|
-
typeof o == "number" && o in ce || typeof o == "number" ?
|
|
172
|
-
const
|
|
173
|
-
let
|
|
174
|
-
for (;
|
|
175
|
-
const p =
|
|
176
|
-
new Date(
|
|
182
|
+
function Fe(e, t, o, i) {
|
|
183
|
+
const n = [], l = de(e, t), a = F(e);
|
|
184
|
+
let r;
|
|
185
|
+
typeof o == "number" && o in ce || typeof o == "number" ? r = o * 60 * 1e3 : r = 3600 * 1e3;
|
|
186
|
+
const c = r * 4;
|
|
187
|
+
let m = a, d = 0;
|
|
188
|
+
for (; m <= a + l; ) {
|
|
189
|
+
const p = d * r % c === 0, M = ye(
|
|
190
|
+
new Date(m),
|
|
177
191
|
e,
|
|
178
192
|
t,
|
|
179
|
-
|
|
193
|
+
i
|
|
180
194
|
);
|
|
181
|
-
let
|
|
195
|
+
let u;
|
|
182
196
|
if (p) {
|
|
183
|
-
const
|
|
184
|
-
|
|
197
|
+
const S = new Date(m), h = S.getHours().toString().padStart(2, "0"), f = S.getMinutes().toString().padStart(2, "0");
|
|
198
|
+
u = `${h}:${f}`;
|
|
185
199
|
}
|
|
186
|
-
|
|
200
|
+
n.push({
|
|
187
201
|
position: M,
|
|
188
202
|
isMajor: p,
|
|
189
|
-
label:
|
|
190
|
-
}),
|
|
203
|
+
label: u
|
|
204
|
+
}), m += r, d++;
|
|
191
205
|
}
|
|
192
|
-
return
|
|
206
|
+
return n;
|
|
193
207
|
}
|
|
194
|
-
function
|
|
195
|
-
let
|
|
196
|
-
for (const
|
|
197
|
-
const a = Math.abs(
|
|
198
|
-
a <
|
|
208
|
+
function Ne(e, t, o = 10) {
|
|
209
|
+
let i = t[0], n = Math.abs(i.position - e);
|
|
210
|
+
for (const l of t) {
|
|
211
|
+
const a = Math.abs(l.position - e);
|
|
212
|
+
a < n && (n = a, i = l);
|
|
199
213
|
}
|
|
200
|
-
return
|
|
214
|
+
return n <= o ? i.position : e;
|
|
201
215
|
}
|
|
202
|
-
const
|
|
216
|
+
const be = 1e3, De = 31536e9, D = [
|
|
203
217
|
1e-3,
|
|
204
218
|
2e-3,
|
|
205
219
|
5e-3,
|
|
@@ -248,78 +262,85 @@ const Se = 1e3, ye = 31536e9, S = [
|
|
|
248
262
|
126144e5,
|
|
249
263
|
15768e6,
|
|
250
264
|
31536e6
|
|
251
|
-
],
|
|
252
|
-
function
|
|
265
|
+
], G = 36, O = 1, Le = 6, Q = 6, _e = 0.3, ke = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
266
|
+
function w(e) {
|
|
253
267
|
return e < 10 ? `0${e}` : `${e}`;
|
|
254
268
|
}
|
|
255
|
-
function
|
|
256
|
-
const l = new Date(e), { yr:
|
|
257
|
-
if (t > 31536e4) return `${
|
|
258
|
-
if (t > 31536e3) return `${
|
|
259
|
-
if (t > 604800) return `${
|
|
260
|
-
if (t > 86400) return `${
|
|
261
|
-
if (t > 3600) return `${
|
|
262
|
-
if (t > 60) return `${
|
|
263
|
-
const
|
|
264
|
-
return `${
|
|
269
|
+
function ae(e, t, o, i, n) {
|
|
270
|
+
const l = new Date(e), { yr: a, mo: r, day: c, hr24: m, hr12: d, min: p, sec: M, ms: u, ampm: S } = te(l, o), h = i ? d : m, f = i ? ` ${S}` : "", T = n ?? ke;
|
|
271
|
+
if (t > 31536e4) return `${a}`;
|
|
272
|
+
if (t > 31536e3) return `${T[r]} ${a}`;
|
|
273
|
+
if (t > 604800) return `${T[r]} ${c}`;
|
|
274
|
+
if (t > 86400) return `${T[r]} ${c} ${w(h)}:${w(p)}${f}`;
|
|
275
|
+
if (t > 3600) return `${w(h)}:${w(p)}${f}`;
|
|
276
|
+
if (t > 60) return `${w(h)}:${w(p)}:${w(M)}${f}`;
|
|
277
|
+
const N = u > 0 ? `.${String(u).padStart(3, "0")}` : "";
|
|
278
|
+
return `${w(h)}:${w(p)}:${w(M)}${N}${f}`;
|
|
265
279
|
}
|
|
266
|
-
function
|
|
267
|
-
const
|
|
280
|
+
function He(e, t, o) {
|
|
281
|
+
const i = new Date(e);
|
|
268
282
|
if (!o || o === "local") {
|
|
269
|
-
const
|
|
270
|
-
return t > 31536e4 ? new Date(Math.floor(
|
|
283
|
+
const c = i.getFullYear(), m = i.getMonth(), d = i.getDate();
|
|
284
|
+
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, m, d).getTime();
|
|
271
285
|
}
|
|
272
|
-
const { yr:
|
|
273
|
-
return t > 31536e4 ? Date.UTC(Math.floor(
|
|
286
|
+
const { yr: n, hr24: l, min: a, sec: r } = te(i, o);
|
|
287
|
+
return t > 31536e4 ? Date.UTC(Math.floor(n / 100) * 100, 0, 1) : t > 31536e3 ? Date.UTC(Math.floor(n / 10) * 10, 0, 1) : t > 86400 ? Date.UTC(n, 0, 1) : e - (l * 3600 + a * 60 + r) * 1e3;
|
|
274
288
|
}
|
|
275
|
-
function
|
|
289
|
+
function x(e, t) {
|
|
276
290
|
return Math.ceil(e / t + 0.5) * t;
|
|
277
291
|
}
|
|
278
|
-
function
|
|
279
|
-
var
|
|
292
|
+
function fe(e, t, o) {
|
|
293
|
+
var i, n, l, a, r, c, m, d, p, M, u, S;
|
|
280
294
|
return {
|
|
281
|
-
color: ((
|
|
282
|
-
borderColor: ((
|
|
283
|
-
borderWidth: ((
|
|
284
|
-
opacity: ((
|
|
285
|
-
markerShape: ((p = t.style) == null ? void 0 : p.markerShape) ?? ((M = e.style) == null ? void 0 : M.markerShape) ??
|
|
286
|
-
markerSize: ((
|
|
295
|
+
color: ((i = t.style) == null ? void 0 : i.color) ?? ((n = e.style) == null ? void 0 : n.color) ?? P.color,
|
|
296
|
+
borderColor: ((l = t.style) == null ? void 0 : l.borderColor) ?? ((a = e.style) == null ? void 0 : a.borderColor) ?? (o == null ? void 0 : o.swimLaneItemBorderColor) ?? P.borderColor,
|
|
297
|
+
borderWidth: ((r = t.style) == null ? void 0 : r.borderWidth) ?? ((c = e.style) == null ? void 0 : c.borderWidth) ?? (o == null ? void 0 : o.swimLaneItemBorderWidth) ?? P.borderWidth,
|
|
298
|
+
opacity: ((m = t.style) == null ? void 0 : m.opacity) ?? ((d = e.style) == null ? void 0 : d.opacity) ?? P.opacity,
|
|
299
|
+
markerShape: ((p = t.style) == null ? void 0 : p.markerShape) ?? ((M = e.style) == null ? void 0 : M.markerShape) ?? P.markerShape,
|
|
300
|
+
markerSize: ((u = t.style) == null ? void 0 : u.markerSize) ?? ((S = e.style) == null ? void 0 : S.markerSize) ?? P.markerSize
|
|
287
301
|
};
|
|
288
302
|
}
|
|
289
|
-
function
|
|
290
|
-
return Math.max(
|
|
303
|
+
function ue(e) {
|
|
304
|
+
return Math.max(be, Math.min(De, e));
|
|
291
305
|
}
|
|
292
|
-
function
|
|
293
|
-
const
|
|
306
|
+
function We(e, t, o) {
|
|
307
|
+
const i = t - e, n = (e + t) / 2, l = ue(i * o);
|
|
294
308
|
return {
|
|
295
|
-
startMs:
|
|
296
|
-
endMs:
|
|
309
|
+
startMs: n - l / 2,
|
|
310
|
+
endMs: n + l / 2
|
|
297
311
|
};
|
|
298
312
|
}
|
|
299
|
-
function
|
|
313
|
+
function Oe(e, t, o, i) {
|
|
314
|
+
const n = t - e, l = ue(n * o), a = n > 0 ? (i - e) / n : 0.5;
|
|
315
|
+
return {
|
|
316
|
+
startMs: i - a * l,
|
|
317
|
+
endMs: i + (1 - a) * l
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function Ue(e) {
|
|
300
321
|
let t = 0;
|
|
301
|
-
for (const o of e) t += (o.height ??
|
|
322
|
+
for (const o of e) t += (o.height ?? R) + O;
|
|
302
323
|
return t;
|
|
303
324
|
}
|
|
304
|
-
function
|
|
305
|
-
const { swimLanes:
|
|
306
|
-
if (!a ||
|
|
307
|
-
const p = Math.max(0,
|
|
325
|
+
function Be(e, t, o, i, n) {
|
|
326
|
+
const { swimLanes: l, showSwimLanes: a, scrollTop: r, startMs: c, endMs: m, theme: d } = n;
|
|
327
|
+
if (!a || l.length === 0) return null;
|
|
328
|
+
const p = Math.max(0, i - G);
|
|
308
329
|
if (t < 0 || t >= p) return null;
|
|
309
|
-
let M = -
|
|
310
|
-
for (const
|
|
311
|
-
const
|
|
312
|
-
if (M +=
|
|
313
|
-
for (const
|
|
314
|
-
if (
|
|
315
|
-
const
|
|
316
|
-
if (e >= Math.max(0,
|
|
317
|
-
return { lane:
|
|
330
|
+
let M = -r;
|
|
331
|
+
for (const u of l) {
|
|
332
|
+
const S = u.height ?? R, h = M, f = M + S;
|
|
333
|
+
if (M += S + O, !(t < h || t >= f)) {
|
|
334
|
+
for (const T of u.items) {
|
|
335
|
+
if (T.interval) {
|
|
336
|
+
const N = C.JulianDate.toDate(T.interval.start).getTime(), b = C.JulianDate.toDate(T.interval.stop).getTime(), $ = (N - c) / (m - c) * o, B = (b - c) / (m - c) * o;
|
|
337
|
+
if (e >= Math.max(0, $) && e <= Math.min(o, B))
|
|
338
|
+
return { lane: u, item: T };
|
|
318
339
|
}
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
if (Math.abs(e -
|
|
322
|
-
return { lane:
|
|
340
|
+
if (T.instant) {
|
|
341
|
+
const b = (C.JulianDate.toDate(T.instant).getTime() - c) / (m - c) * o, $ = fe(u, T, d);
|
|
342
|
+
if (Math.abs(e - b) <= $.markerSize / 2 + 2)
|
|
343
|
+
return { lane: u, item: T };
|
|
323
344
|
}
|
|
324
345
|
}
|
|
325
346
|
return null;
|
|
@@ -327,192 +348,195 @@ function We(e, t, o, l, r) {
|
|
|
327
348
|
}
|
|
328
349
|
return null;
|
|
329
350
|
}
|
|
330
|
-
function
|
|
331
|
-
const { swimLanes:
|
|
332
|
-
if (!
|
|
333
|
-
const
|
|
334
|
-
if (t < 0 || t >=
|
|
335
|
-
let
|
|
336
|
-
for (const
|
|
337
|
-
const
|
|
338
|
-
if (t >=
|
|
339
|
-
|
|
351
|
+
function ve(e, t, o, i) {
|
|
352
|
+
const { swimLanes: n, showSwimLanes: l, scrollTop: a } = i;
|
|
353
|
+
if (!l || n.length === 0 || e > 80) return null;
|
|
354
|
+
const r = Math.max(0, o - G);
|
|
355
|
+
if (t < 0 || t >= r) return null;
|
|
356
|
+
let c = -a;
|
|
357
|
+
for (const m of n) {
|
|
358
|
+
const d = m.height ?? R;
|
|
359
|
+
if (t >= c && t < c + d) return m;
|
|
360
|
+
c += d + O;
|
|
340
361
|
}
|
|
341
362
|
return null;
|
|
342
363
|
}
|
|
343
|
-
function
|
|
364
|
+
function ze(e, t, o) {
|
|
344
365
|
if (!o.showSwimLanes || o.swimLanes.length === 0) return !1;
|
|
345
|
-
const
|
|
346
|
-
return e >= 0 && e <
|
|
366
|
+
const i = Math.max(0, t - G);
|
|
367
|
+
return e >= 0 && e < i;
|
|
347
368
|
}
|
|
348
|
-
function
|
|
369
|
+
function je(e, t, o, i) {
|
|
349
370
|
const {
|
|
350
|
-
startMs:
|
|
351
|
-
endMs:
|
|
371
|
+
startMs: n,
|
|
372
|
+
endMs: l,
|
|
352
373
|
currentMs: a,
|
|
353
|
-
theme:
|
|
354
|
-
maxTicks:
|
|
355
|
-
swimLanes:
|
|
356
|
-
showSwimLanes:
|
|
374
|
+
theme: r,
|
|
375
|
+
maxTicks: c,
|
|
376
|
+
swimLanes: m,
|
|
377
|
+
showSwimLanes: d,
|
|
357
378
|
reorderState: p,
|
|
358
|
-
timezone: M
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
379
|
+
timezone: M,
|
|
380
|
+
use12h: u,
|
|
381
|
+
months: S
|
|
382
|
+
} = i;
|
|
383
|
+
let { scrollTop: h } = i;
|
|
384
|
+
const f = (l - n) / 1e3;
|
|
385
|
+
if (f <= 0) return h;
|
|
386
|
+
e.fillStyle = r.backgroundColor, e.fillRect(0, 0, t, o);
|
|
387
|
+
const T = d && m.length > 0, b = T ? Math.max(0, o - G) : 0;
|
|
388
|
+
let $ = 0;
|
|
389
|
+
if (T)
|
|
390
|
+
for (const s of m) $ += (s.height ?? R) + O;
|
|
391
|
+
const B = Math.max(0, $ - b);
|
|
392
|
+
if (h > B && (h = B), h < 0 && (h = 0), T && b > 0) {
|
|
393
|
+
e.save(), e.beginPath(), e.rect(0, 0, t, b), e.clip();
|
|
394
|
+
let s = -h;
|
|
395
|
+
const L = (k) => (k - n) / (l - n) * t;
|
|
396
|
+
for (const k of m) {
|
|
397
|
+
const y = k.height ?? R, A = s + y;
|
|
398
|
+
if (A > 0 && s < b) {
|
|
399
|
+
const g = k.style, U = (g == null ? void 0 : g.backgroundColor) ?? P.backgroundColor;
|
|
400
|
+
U && U !== "transparent" && (e.fillStyle = U, e.fillRect(0, s, t, y)), e.strokeStyle = r.tickColor + "44", e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, A), e.lineTo(t, A), e.stroke();
|
|
401
|
+
for (const E of k.items) {
|
|
402
|
+
const H = fe(k, E, r);
|
|
403
|
+
if (E.interval) {
|
|
404
|
+
const K = C.JulianDate.toDate(E.interval.start).getTime(), Y = C.JulianDate.toDate(E.interval.stop).getTime(), _ = L(K), W = L(Y), V = Math.max(0, _), q = Math.min(t, W) - V;
|
|
382
405
|
if (q > 0) {
|
|
383
|
-
e.globalAlpha =
|
|
384
|
-
const
|
|
385
|
-
e.fillRect(V,
|
|
406
|
+
e.globalAlpha = H.opacity, e.fillStyle = H.color;
|
|
407
|
+
const ie = 3, se = s + ie, le = y - ie * 2;
|
|
408
|
+
e.fillRect(V, se, q, le), H.borderWidth > 0 && (e.strokeStyle = H.borderColor, e.lineWidth = H.borderWidth, e.strokeRect(V, se, q, le)), e.globalAlpha = 1;
|
|
386
409
|
}
|
|
387
410
|
}
|
|
388
|
-
if (
|
|
389
|
-
const K =
|
|
390
|
-
if (
|
|
391
|
-
const
|
|
392
|
-
e.globalAlpha =
|
|
411
|
+
if (E.instant) {
|
|
412
|
+
const K = C.JulianDate.toDate(E.instant).getTime(), Y = L(K);
|
|
413
|
+
if (Y >= -H.markerSize && Y <= t + H.markerSize) {
|
|
414
|
+
const _ = s + y / 2, W = H.markerSize;
|
|
415
|
+
e.globalAlpha = H.opacity, e.fillStyle = H.color, H.markerShape === "diamond" ? (e.beginPath(), e.moveTo(Y, _ - W / 2), e.lineTo(Y + W / 2, _), e.lineTo(Y, _ + W / 2), e.lineTo(Y - W / 2, _), e.closePath(), e.fill()) : H.markerShape === "circle" ? (e.beginPath(), e.arc(Y, _, W / 2, 0, Math.PI * 2), e.fill()) : (e.strokeStyle = H.color, e.lineWidth = 2, e.beginPath(), e.moveTo(Y, s + 2), e.lineTo(Y, s + y - 2), e.stroke()), e.globalAlpha = 1;
|
|
393
416
|
}
|
|
394
417
|
}
|
|
395
418
|
}
|
|
396
|
-
e.font = `${Math.min(11,
|
|
419
|
+
e.font = `${Math.min(11, y - 4)}px system-ui, sans-serif`, e.textAlign = "left", e.textBaseline = "middle", e.fillStyle = (g == null ? void 0 : g.labelColor) ?? P.labelColor, e.fillText(k.label, Le, s + y / 2);
|
|
397
420
|
}
|
|
398
|
-
if (
|
|
421
|
+
if (s += y + O, s >= b) break;
|
|
399
422
|
}
|
|
400
423
|
if (p && p.dragging) {
|
|
401
|
-
const
|
|
402
|
-
let
|
|
403
|
-
for (let g = 0; g <
|
|
404
|
-
|
|
405
|
-
e.strokeStyle =
|
|
406
|
-
const
|
|
407
|
-
if (
|
|
408
|
-
const g =
|
|
409
|
-
let
|
|
410
|
-
for (const
|
|
411
|
-
if (
|
|
412
|
-
|
|
424
|
+
const k = p.currentY - p.dragStartY;
|
|
425
|
+
let y = -h;
|
|
426
|
+
for (let g = 0; g < m.length && g < p.insertIndex; g++)
|
|
427
|
+
y += (m[g].height ?? R) + O;
|
|
428
|
+
e.strokeStyle = r.indicatorColor, e.lineWidth = 2, e.beginPath(), e.moveTo(0, y), e.lineTo(t, y), e.stroke();
|
|
429
|
+
const A = m.find((g) => g.id === p.dragLaneId);
|
|
430
|
+
if (A) {
|
|
431
|
+
const g = A.height ?? R;
|
|
432
|
+
let U = -h;
|
|
433
|
+
for (const E of m) {
|
|
434
|
+
if (E.id === p.dragLaneId) break;
|
|
435
|
+
U += (E.height ?? R) + O;
|
|
413
436
|
}
|
|
414
|
-
e.globalAlpha = 0.4, e.fillStyle =
|
|
437
|
+
e.globalAlpha = 0.4, e.fillStyle = r.indicatorColor, e.fillRect(0, U + k, t, g), e.globalAlpha = 1;
|
|
415
438
|
}
|
|
416
439
|
}
|
|
417
|
-
if (
|
|
418
|
-
const
|
|
419
|
-
e.fillStyle =
|
|
440
|
+
if ($ > b) {
|
|
441
|
+
const k = t - Q - 2, y = b / $, A = Math.max(20, b * y), g = h / B * (b - A);
|
|
442
|
+
e.fillStyle = r.tickColor + "22", e.fillRect(k, 0, Q, b), e.fillStyle = r.tickColor + "88", e.fillRect(k, g, Q, A);
|
|
420
443
|
}
|
|
421
444
|
e.restore();
|
|
422
445
|
}
|
|
423
|
-
e.font = `${
|
|
424
|
-
const
|
|
425
|
-
let
|
|
426
|
-
for (let
|
|
427
|
-
if (
|
|
428
|
-
|
|
446
|
+
e.font = `${r.fontSize}px monospace`;
|
|
447
|
+
const he = ae(n + f * 500, f, M, u, S), pe = e.measureText(he).width + 24, Me = Math.max(pe / t * f, f / 1e3);
|
|
448
|
+
let I = D[D.length - 1], v = D.length - 1;
|
|
449
|
+
for (let s = 0; s < D.length; s++)
|
|
450
|
+
if (D[s] > Me) {
|
|
451
|
+
I = D[s], v = s;
|
|
429
452
|
break;
|
|
430
453
|
}
|
|
431
|
-
if (
|
|
432
|
-
for (; v <
|
|
433
|
-
v++,
|
|
434
|
-
let
|
|
435
|
-
for (let
|
|
436
|
-
if (
|
|
437
|
-
t * (
|
|
454
|
+
if (c != null && c > 0)
|
|
455
|
+
for (; v < D.length - 1 && f / I > c; )
|
|
456
|
+
v++, I = D[v];
|
|
457
|
+
let J = 0;
|
|
458
|
+
for (let s = v - 1; s >= 0; s--)
|
|
459
|
+
if (I % D[s] < 1e-4) {
|
|
460
|
+
t * (D[s] / f) >= 3 && (J = D[s]);
|
|
438
461
|
break;
|
|
439
462
|
}
|
|
440
|
-
let
|
|
441
|
-
if (
|
|
442
|
-
for (let
|
|
443
|
-
if (
|
|
444
|
-
|
|
463
|
+
let z = 0;
|
|
464
|
+
if (J > 0) {
|
|
465
|
+
for (let s = 0; s < D.length && D[s] < J; s++)
|
|
466
|
+
if (J % D[s] < 1e-4 && t * (D[s] / f) >= 3) {
|
|
467
|
+
z = D[s];
|
|
445
468
|
break;
|
|
446
469
|
}
|
|
447
470
|
}
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
450
|
-
e.strokeStyle =
|
|
451
|
-
for (let
|
|
452
|
-
const
|
|
453
|
-
e.beginPath(), e.moveTo(
|
|
471
|
+
const oe = He(n, f, M), j = (n - oe) / 1e3, X = j + f, Z = (s) => t * ((s - j) / f);
|
|
472
|
+
if (z > 0) {
|
|
473
|
+
e.strokeStyle = r.tickColor, e.lineWidth = 1;
|
|
474
|
+
for (let s = Math.floor(j / z) * z; s <= X; s = x(s, z)) {
|
|
475
|
+
const L = Z(s);
|
|
476
|
+
e.beginPath(), e.moveTo(L, o - r.minorTickHeight), e.lineTo(L, o), e.stroke();
|
|
454
477
|
}
|
|
455
478
|
}
|
|
456
|
-
if (
|
|
457
|
-
e.strokeStyle =
|
|
458
|
-
for (let
|
|
459
|
-
const
|
|
460
|
-
e.beginPath(), e.moveTo(
|
|
479
|
+
if (J > 0) {
|
|
480
|
+
e.strokeStyle = r.tickColor, e.lineWidth = 1;
|
|
481
|
+
for (let s = Math.floor(j / J) * J; s <= X; s = x(s, J)) {
|
|
482
|
+
const L = Z(s);
|
|
483
|
+
e.beginPath(), e.moveTo(L, o - r.minorTickHeight), e.lineTo(L, o), e.stroke();
|
|
461
484
|
}
|
|
462
485
|
}
|
|
463
486
|
e.textAlign = "center", e.textBaseline = "bottom";
|
|
464
|
-
let
|
|
465
|
-
for (let
|
|
466
|
-
const
|
|
467
|
-
e.strokeStyle =
|
|
468
|
-
const
|
|
469
|
-
g >
|
|
487
|
+
let ne = -1 / 0;
|
|
488
|
+
for (let s = Math.floor(j / I) * I; s <= X + I; s = x(s, I)) {
|
|
489
|
+
const L = Z(s), k = oe + s * 1e3;
|
|
490
|
+
e.strokeStyle = r.majorTickColor, e.lineWidth = 1, e.beginPath(), e.moveTo(L, o - r.majorTickHeight), e.lineTo(L, o), e.stroke();
|
|
491
|
+
const y = ae(k, f, M, u, S), A = e.measureText(y).width, g = L - A / 2;
|
|
492
|
+
g > ne && (e.fillStyle = r.labelColor, e.fillText(y, L, o - r.majorTickHeight - 4), ne = g + A + 5);
|
|
470
493
|
}
|
|
471
|
-
const
|
|
472
|
-
return e.strokeStyle =
|
|
494
|
+
const re = (a - n) / (l - n) * t;
|
|
495
|
+
return e.strokeStyle = r.indicatorColor, e.lineWidth = r.indicatorLineWidth, e.beginPath(), e.moveTo(re, 0), e.lineTo(re, o), e.stroke(), h;
|
|
473
496
|
}
|
|
474
497
|
export {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
498
|
+
Ae as DEFAULT_LABELS,
|
|
499
|
+
R as DEFAULT_LANE_HEIGHT,
|
|
500
|
+
me as DateTimeFormats,
|
|
501
|
+
Le as LABEL_PAD_LEFT,
|
|
502
|
+
O as LANE_GAP,
|
|
503
|
+
De as MAX_SPAN_MS,
|
|
504
|
+
be as MIN_SPAN_MS,
|
|
505
|
+
ke as MONTHS,
|
|
483
506
|
Q as SCROLLBAR_WIDTH,
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
507
|
+
_e as SWIM_LANE_SCROLL_SPEED,
|
|
508
|
+
G as TICK_AREA_HEIGHT,
|
|
509
|
+
D as TIC_SCALES,
|
|
487
510
|
ce as TickInterval,
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
511
|
+
$e as Timezones,
|
|
512
|
+
He as calcEpochMs,
|
|
513
|
+
ue as clampSpan,
|
|
514
|
+
P as defaultSwimLaneStyle,
|
|
515
|
+
Ye as defaultTheme,
|
|
516
|
+
je as drawTimeline,
|
|
517
|
+
Se as formatDateTime,
|
|
495
518
|
Pe as formatTime,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
519
|
+
Ee as fromMilliseconds,
|
|
520
|
+
Fe as generateTicks,
|
|
521
|
+
te as getDateParts,
|
|
522
|
+
de as getDurationMs,
|
|
523
|
+
Ie as getTimezoneAbbr,
|
|
524
|
+
ve as hitTestLaneLabel,
|
|
525
|
+
Be as hitTestSwimLane,
|
|
526
|
+
ze as isInSwimLaneRegion,
|
|
527
|
+
ae as makeLabel,
|
|
528
|
+
x as nextTic,
|
|
506
529
|
Re as positionToTime,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
530
|
+
fe as resolveItemStyle,
|
|
531
|
+
Ce as resolveLabel,
|
|
532
|
+
Ne as snapToTick,
|
|
533
|
+
Je as splitForDisplay,
|
|
534
|
+
ye as timeToPosition,
|
|
535
|
+
ee as toDate,
|
|
536
|
+
we as toJulianDate,
|
|
514
537
|
F as toMilliseconds,
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
538
|
+
Ue as totalSwimLaneHeight,
|
|
539
|
+
w as twoD,
|
|
540
|
+
Oe as zoomAroundMs,
|
|
541
|
+
We as zoomRange
|
|
518
542
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("cesium")):typeof define=="function"&&define.amd?define(["exports","cesium"],U):(i=typeof globalThis<"u"?globalThis:i||self,U(i.CesiumTimelineCore={},i.Cesium))})(this,(function(i,U){"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(U);function Ae(e,t){return typeof e=="function"?e(t):e}const He={dateTimeClickTooltip:"Click to jump to a date/time",liveLabel:"LIVE",liveActiveLabel:"● LIVE",liveTooltip:"Jump to live (now)",liveActiveTooltip:"Currently live",resetSpeedTooltip:"Reset to 1× speed",jumpToStartTooltip:"Jump to start",noStartTimeTooltip:"No start time set",jumpToEndTooltip:"Jump to end",noEndTimeTooltip:"No end time set",rewindTooltip:"Rewind",rewindActiveTooltip:e=>`Reverse ${e}× — click to speed up, press play to stop`,playTooltip:"Play",playFromRewindTooltip:"Play (reset to 1×)",pauseTooltip:"Pause",fastForwardTooltip:"Fast forward",fastForwardActiveTooltip:e=>`${e}× speed — click to increase, click again at max to reset`,collapseSwimLanesTooltip:"Collapse swim lanes",expandSwimLanesTooltip:"Expand swim lanes"},ke={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 w={color:"#4da6ff",borderColor:"#2980b9",borderWidth:1,opacity:.8,markerShape:"diamond",markerSize:10,labelColor:"#cccccc",backgroundColor:"transparent"},Y=24;function Ce(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 I(e){return K(e).getTime()}function Ee(e){return L.JulianDate.fromDate(new Date(e))}function me(e,t){return I(t)-I(e)}const _e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],we=["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 M=e.getFullYear(),u=e.getMonth(),h=e.getDate(),A=e.getHours(),H=A%12||12,g=e.getMinutes(),P=e.getSeconds(),R=e.getMilliseconds();return{yr:M,mo:u,day:h,hr24:A,hr12:H,min:g,sec:P,ms:R,ampm:A<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 M of o.formatToParts(e))M.type!=="literal"&&(l[M.type]=M.value);const r=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),T=parseInt(l.second),d=e.getMilliseconds();return{yr:r,mo:s,day:m,hr24:n,hr12:c,min:f,sec:T,ms:d,ampm:n<12?"AM":"PM"}}function Ie(e,t){var r;if(!t||t==="local")return null;const o=K(e);return((r=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(o).find(s=>s.type==="timeZoneName"))==null?void 0:r.value)??null}function ce(e,t=ee.DEFAULT,o){const l=K(e),{yr:r,mo:s,day:m,hr24:n,hr12:c,min:f,sec:T,ms:d,ampm:M}=Z(l,o),u=H=>String(H).padStart(2,"0"),h=H=>String(H).padStart(3,"0"),A={YYYY:String(r),YY:String(r).slice(-2),MMMM:we[s],MMM:_e[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(T),SSS:h(d),A:M,a:M.toLowerCase()};return t.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,H=>A[H]??H)}function Pe(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 r=e;for(const m of t)r=r.replace(m,"");let s=e;for(const m of o)s=s.replace(m,"");return{timeFormat:l(r),dateFormat:l(s)}}function Re(e,t=!1){return ce(e,t?"HH:mm:ss":"HH:mm")}function fe(e,t,o,l){const r=I(e),s=I(t),m=I(o);if(m===s)return 0;const n=(r-s)/(m-s);return Math.max(0,Math.min(1,n))*l}function Ne(e,t,o,l){const r=Math.max(0,Math.min(1,e/l)),s=I(t),m=I(o),n=s+r*(m-s);return L.JulianDate.fromDate(new Date(n))}function Fe(e,t,o,l){const r=[],s=me(e,t),m=I(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,T=0;for(;f<=m+s;){const d=T*n%c===0,M=fe(new Date(f),e,t,l);let u;if(d){const h=new Date(f),A=h.getHours().toString().padStart(2,"0"),H=h.getMinutes().toString().padStart(2,"0");u=`${A}:${H}`}r.push({position:M,isMajor:d,label:u}),f+=n,T++}return r}function Oe(e,t,o=10){let l=t[0],r=Math.abs(l.position-e);for(const s of t){const m=Math.abs(s.position-e);m<r&&(r=m,l=s)}return r<=o?l.position:e}const ue=1e3,he=31536e9,p=[.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],B=36,F=1,Te=6,V=6,$e=.3,q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(e){return e<10?`0${e}`:`${e}`}function te(e,t,o){const l=new Date(e),{yr:r,mo:s,day:m,hr24:n,min:c,sec:f,ms:T}=Z(l,o);if(t>31536e4)return`${r}`;if(t>31536e3)return`${q[s]} ${r}`;if(t>604800)return`${q[s]} ${m}`;if(t>86400)return`${q[s]} ${m} ${E(n)}:${E(c)}`;if(t>3600)return`${E(n)}:${E(c)}`;if(t>60)return`${E(n)}:${E(c)}:${E(f)}`;const d=T>0?`.${String(T).padStart(3,"0")}`:"";return`${E(n)}:${E(c)}:${E(f)}${d}`}function de(e,t,o){const l=new Date(e);if(!o||o==="local"){const c=l.getFullYear(),f=l.getMonth(),T=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,T).getTime()}const{yr:r,hr24:s,min:m,sec:n}=Z(l,o);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+m*60+n)*1e3}function Q(e,t){return Math.ceil(e/t+.5)*t}function oe(e,t,o){var l,r,s,m,n,c,f,T,d,M,u,h;return{color:((l=t.style)==null?void 0:l.color)??((r=e.style)==null?void 0:r.color)??w.color,borderColor:((s=t.style)==null?void 0:s.borderColor)??((m=e.style)==null?void 0:m.borderColor)??(o==null?void 0:o.swimLaneItemBorderColor)??w.borderColor,borderWidth:((n=t.style)==null?void 0:n.borderWidth)??((c=e.style)==null?void 0:c.borderWidth)??(o==null?void 0:o.swimLaneItemBorderWidth)??w.borderWidth,opacity:((f=t.style)==null?void 0:f.opacity)??((T=e.style)==null?void 0:T.opacity)??w.opacity,markerShape:((d=t.style)==null?void 0:d.markerShape)??((M=e.style)==null?void 0:M.markerShape)??w.markerShape,markerSize:((u=t.style)==null?void 0:u.markerSize)??((h=e.style)==null?void 0:h.markerSize)??w.markerSize}}function Me(e){return Math.max(ue,Math.min(he,e))}function Je(e,t,o){const l=t-e,r=(e+t)/2,s=Me(l*o);return{startMs:r-s/2,endMs:r+s/2}}function We(e){let t=0;for(const o of e)t+=(o.height??Y)+F;return t}function ve(e,t,o,l,r){const{swimLanes:s,showSwimLanes:m,scrollTop:n,startMs:c,endMs:f,theme:T}=r;if(!m||s.length===0)return null;const d=Math.max(0,l-B);if(t<0||t>=d)return null;let M=-n;for(const u of s){const h=u.height??Y,A=M,H=M+h;if(M+=h+F,!(t<A||t>=H)){for(const g of u.items){if(g.interval){const P=L.JulianDate.toDate(g.interval.start).getTime(),R=L.JulianDate.toDate(g.interval.stop).getTime(),j=(P-c)/(f-c)*o,ne=(R-c)/(f-c)*o;if(e>=Math.max(0,j)&&e<=Math.min(o,ne))return{lane:u,item:g}}if(g.instant){const R=(L.JulianDate.toDate(g.instant).getTime()-c)/(f-c)*o,j=oe(u,g,T);if(Math.abs(e-R)<=j.markerSize/2+2)return{lane:u,item:g}}}return null}}return null}function Ue(e,t,o,l){const{swimLanes:r,showSwimLanes:s,scrollTop:m}=l;if(!s||r.length===0||e>80)return null;const n=Math.max(0,o-B);if(t<0||t>=n)return null;let c=-m;for(const f of r){const T=f.height??Y;if(t>=c&&t<c+T)return f;c+=T+F}return null}function Be(e,t,o){if(!o.showSwimLanes||o.swimLanes.length===0)return!1;const l=Math.max(0,t-B);return e>=0&&e<l}function je(e,t,o,l){const{startMs:r,endMs:s,currentMs:m,theme:n,maxTicks:c,swimLanes:f,showSwimLanes:T,reorderState:d,timezone:M}=l;let{scrollTop:u}=l;const h=(s-r)/1e3;if(h<=0)return u;e.fillStyle=n.backgroundColor,e.fillRect(0,0,t,o);const A=T&&f.length>0,g=A?Math.max(0,o-B):0;let P=0;if(A)for(const a of f)P+=(a.height??Y)+F;const R=Math.max(0,P-g);if(u>R&&(u=R),u<0&&(u=0),A&&g>0){e.save(),e.beginPath(),e.rect(0,0,t,g),e.clip();let a=-u;const y=D=>(D-r)/(s-r)*t;for(const D of f){const b=D.height??Y,C=a+b;if(C>0&&a<g){const S=D.style,v=(S==null?void 0:S.backgroundColor)??w.backgroundColor;v&&v!=="transparent"&&(e.fillStyle=v,e.fillRect(0,a,t,b)),e.strokeStyle=n.tickColor+"44",e.lineWidth=.5,e.beginPath(),e.moveTo(0,C),e.lineTo(t,C),e.stroke();for(const N of D.items){const k=oe(D,N,n);if(N.interval){const ae=L.JulianDate.toDate(N.interval.start).getTime(),_=L.JulianDate.toDate(N.interval.stop).getTime(),J=y(ae),W=y(_),le=Math.max(0,J),se=Math.min(t,W)-le;if(se>0){e.globalAlpha=k.opacity,e.fillStyle=k.color;const be=3,ye=a+be,De=b-be*2;e.fillRect(le,ye,se,De),k.borderWidth>0&&(e.strokeStyle=k.borderColor,e.lineWidth=k.borderWidth,e.strokeRect(le,ye,se,De)),e.globalAlpha=1}}if(N.instant){const ae=L.JulianDate.toDate(N.instant).getTime(),_=y(ae);if(_>=-k.markerSize&&_<=t+k.markerSize){const J=a+b/2,W=k.markerSize;e.globalAlpha=k.opacity,e.fillStyle=k.color,k.markerShape==="diamond"?(e.beginPath(),e.moveTo(_,J-W/2),e.lineTo(_+W/2,J),e.lineTo(_,J+W/2),e.lineTo(_-W/2,J),e.closePath(),e.fill()):k.markerShape==="circle"?(e.beginPath(),e.arc(_,J,W/2,0,Math.PI*2),e.fill()):(e.strokeStyle=k.color,e.lineWidth=2,e.beginPath(),e.moveTo(_,a+2),e.lineTo(_,a+b-2),e.stroke()),e.globalAlpha=1}}}e.font=`${Math.min(11,b-4)}px system-ui, sans-serif`,e.textAlign="left",e.textBaseline="middle",e.fillStyle=(S==null?void 0:S.labelColor)??w.labelColor,e.fillText(D.label,Te,a+b/2)}if(a+=b+F,a>=g)break}if(d&&d.dragging){const D=d.currentY-d.dragStartY;let b=-u;for(let S=0;S<f.length&&S<d.insertIndex;S++)b+=(f[S].height??Y)+F;e.strokeStyle=n.indicatorColor,e.lineWidth=2,e.beginPath(),e.moveTo(0,b),e.lineTo(t,b),e.stroke();const C=f.find(S=>S.id===d.dragLaneId);if(C){const S=C.height??Y;let v=-u;for(const N of f){if(N.id===d.dragLaneId)break;v+=(N.height??Y)+F}e.globalAlpha=.4,e.fillStyle=n.indicatorColor,e.fillRect(0,v+D,t,S),e.globalAlpha=1}}if(P>g){const D=t-V-2,b=g/P,C=Math.max(20,g*b),S=u/R*(g-C);e.fillStyle=n.tickColor+"22",e.fillRect(D,0,V,g),e.fillStyle=n.tickColor+"88",e.fillRect(D,S,V,C)}e.restore()}e.font=`${n.fontSize}px monospace`;const j=te(r+h*500,h,M),ne=e.measureText(j).width+24,ze=Math.max(ne/t*h,h/1e3);let O=p[p.length-1],z=p.length-1;for(let a=0;a<p.length;a++)if(p[a]>ze){O=p[a],z=a;break}if(c!=null&&c>0)for(;z<p.length-1&&h/O>c;)z++,O=p[z];let $=0;for(let a=z-1;a>=0;a--)if(O%p[a]<1e-4){t*(p[a]/h)>=3&&($=p[a]);break}let G=0;if($>0){for(let a=0;a<p.length&&p[a]<$;a++)if($%p[a]<1e-4&&t*(p[a]/h)>=3){G=p[a];break}}const ge=de(r,h,M),X=(r-ge)/1e3,ie=X+h,re=a=>t*((a-X)/h);if(G>0){e.strokeStyle=n.tickColor,e.lineWidth=1;for(let a=Math.floor(X/G)*G;a<=ie;a=Q(a,G)){const y=re(a);e.beginPath(),e.moveTo(y,o-n.minorTickHeight),e.lineTo(y,o),e.stroke()}}if($>0){e.strokeStyle=n.tickColor,e.lineWidth=1;for(let a=Math.floor(X/$)*$;a<=ie;a=Q(a,$)){const y=re(a);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 a=Math.floor(X/O)*O;a<=ie+O;a=Q(a,O)){const y=re(a),D=ge+a*1e3;e.strokeStyle=n.majorTickColor,e.lineWidth=1,e.beginPath(),e.moveTo(y,o-n.majorTickHeight),e.lineTo(y,o),e.stroke();const b=te(D,h,M),C=e.measureText(b).width,S=y-C/2;S>Se&&(e.fillStyle=n.labelColor,e.fillText(b,y,o-n.majorTickHeight-4),Se=S+C+5)}const pe=(m-r)/(s-r)*t;return e.strokeStyle=n.indicatorColor,e.lineWidth=n.indicatorLineWidth,e.beginPath(),e.moveTo(pe,0),e.lineTo(pe,o),e.stroke(),u}i.DEFAULT_LABELS=He,i.DEFAULT_LANE_HEIGHT=Y,i.DateTimeFormats=ee,i.LABEL_PAD_LEFT=Te,i.LANE_GAP=F,i.MAX_SPAN_MS=he,i.MIN_SPAN_MS=ue,i.MONTHS=q,i.SCROLLBAR_WIDTH=V,i.SWIM_LANE_SCROLL_SPEED=$e,i.TICK_AREA_HEIGHT=B,i.TIC_SCALES=p,i.TickInterval=x,i.Timezones=Ye,i.calcEpochMs=de,i.clampSpan=Me,i.defaultSwimLaneStyle=w,i.defaultTheme=ke,i.drawTimeline=je,i.formatDateTime=ce,i.formatTime=Re,i.fromMilliseconds=Ee,i.generateTicks=Fe,i.getDateParts=Z,i.getDurationMs=me,i.getTimezoneAbbr=Ie,i.hitTestLaneLabel=Ue,i.hitTestSwimLane=ve,i.isInSwimLaneRegion=Be,i.makeLabel=te,i.nextTic=Q,i.positionToTime=Ne,i.resolveItemStyle=oe,i.resolveLabel=Ae,i.snapToTick=Oe,i.splitForDisplay=Pe,i.timeToPosition=fe,i.toDate=K,i.toJulianDate=Ce,i.toMilliseconds=I,i.totalSwimLaneHeight=We,i.twoD=E,i.zoomRange=Je,Object.defineProperty(i,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 n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const k=Le(B);function Ae(e,t){return typeof e=="function"?e(t):e}const He={dateTimeClickTooltip:"Click to jump to a date/time",liveLabel:"LIVE",liveActiveLabel:"● LIVE",liveTooltip:"Jump to live (now)",liveActiveTooltip:"Currently live",resetSpeedTooltip:"Reset to 1× speed",jumpToStartTooltip:"Jump to start",noStartTimeTooltip:"No start time set",jumpToEndTooltip:"Jump to end",noEndTimeTooltip:"No end time set",rewindTooltip:"Rewind",rewindActiveTooltip:e=>`Reverse ${e}× — click to speed up, press play to stop`,playTooltip:"Play",playFromRewindTooltip:"Play (reset to 1×)",pauseTooltip:"Pause",fastForwardTooltip:"Fast forward",fastForwardActiveTooltip:e=>`${e}× speed — click to increase, click again at max to reset`,collapseSwimLanesTooltip:"Collapse swim lanes",expandSwimLanesTooltip:"Expand swim lanes",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},ke={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 Y={color:"#4da6ff",borderColor:"#2980b9",borderWidth:1,opacity:.8,markerShape:"diamond",markerSize:10,labelColor:"#cccccc",backgroundColor:"transparent"},I=24;function Ce(e){return e instanceof k.JulianDate?k.JulianDate.clone(e):k.JulianDate.fromDate(e)}function Z(e){return e instanceof k.JulianDate?k.JulianDate.toDate(e):e}function P(e){return Z(e).getTime()}function Ee(e){return k.JulianDate.fromDate(new Date(e))}function me(e,t){return P(t)-P(e)}const _e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],we=["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 V(e,t){if(!t||t==="local"){const M=e.getFullYear(),h=e.getMonth(),y=e.getDate(),T=e.getHours(),u=T%12||12,p=e.getMinutes(),J=e.getSeconds(),L=e.getMilliseconds();return{yr:M,mo:h,day:y,hr24:T,hr12:u,min:p,sec:J,ms:L,ampm:T<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}),n={};for(const M of o.formatToParts(e))M.type!=="literal"&&(n[M.type]=M.value);const i=parseInt(n.year),s=parseInt(n.month)-1,m=parseInt(n.day);let r=parseInt(n.hour);r===24&&(r=0);const c=r%12||12,f=parseInt(n.minute),g=parseInt(n.second),d=e.getMilliseconds();return{yr:i,mo:s,day:m,hr24:r,hr12:c,min:f,sec:g,ms:d,ampm:r<12?"AM":"PM"}}function Ie(e,t){var i;if(!t||t==="local")return null;const o=Z(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 n=Z(e),{yr:i,mo:s,day:m,hr24:r,hr12:c,min:f,sec:g,ms:d,ampm:M}=V(n,o),h=u=>String(u).padStart(2,"0"),y=u=>String(u).padStart(3,"0"),T={YYYY:String(i),YY:String(i).slice(-2),MMMM:we[s],MMM:_e[s],MM:h(s+1),M:String(s+1),DD:h(m),D:String(m),HH:h(r),H:String(r),hh:h(c),h:String(c),mm:h(f),ss:h(g),SSS:y(d),A:M,a:M.toLowerCase()};return t.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,u=>T[u]??u)}function Pe(e=ee.DEFAULT){const t=["YYYY","YY","MMMM","MMM","MM","M","DD","D"],o=["HH","H","hh","h","mm","ss","SSS","A","a"],n=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:n(i),dateFormat:n(s)}}function Ne(e,t=!1){return ce(e,t?"HH:mm:ss":"HH:mm")}function fe(e,t,o,n){const i=P(e),s=P(t),m=P(o);if(m===s)return 0;const r=(i-s)/(m-s);return Math.max(0,Math.min(1,r))*n}function Re(e,t,o,n){const i=Math.max(0,Math.min(1,e/n)),s=P(t),m=P(o),r=s+i*(m-s);return k.JulianDate.fromDate(new Date(r))}function Fe(e,t,o,n){const i=[],s=me(e,t),m=P(e);let r;typeof o=="number"&&o in x||typeof o=="number"?r=o*60*1e3:r=3600*1e3;const c=r*4;let f=m,g=0;for(;f<=m+s;){const d=g*r%c===0,M=fe(new Date(f),e,t,n);let h;if(d){const y=new Date(f),T=y.getHours().toString().padStart(2,"0"),u=y.getMinutes().toString().padStart(2,"0");h=`${T}:${u}`}i.push({position:M,isMajor:d,label:h}),f+=r,g++}return i}function $e(e,t,o=10){let n=t[0],i=Math.abs(n.position-e);for(const s of t){const m=Math.abs(s.position-e);m<i&&(i=m,n=s)}return i<=o?n.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],j=36,R=1,Te=6,q=6,Oe=.3,de=["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,n,i){const s=new Date(e),{yr:m,mo:r,day:c,hr24:f,hr12:g,min:d,sec:M,ms:h,ampm:y}=V(s,o),T=n?g:f,u=n?` ${y}`:"",p=i??de;if(t>31536e4)return`${m}`;if(t>31536e3)return`${p[r]} ${m}`;if(t>604800)return`${p[r]} ${c}`;if(t>86400)return`${p[r]} ${c} ${_(T)}:${_(d)}${u}`;if(t>3600)return`${_(T)}:${_(d)}${u}`;if(t>60)return`${_(T)}:${_(d)}:${_(M)}${u}`;const J=h>0?`.${String(h).padStart(3,"0")}`:"";return`${_(T)}:${_(d)}:${_(M)}${J}${u}`}function Me(e,t,o){const n=new Date(e);if(!o||o==="local"){const c=n.getFullYear(),f=n.getMonth(),g=n.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,g).getTime()}const{yr:i,hr24:s,min:m,sec:r}=V(n,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+r)*1e3}function Q(e,t){return Math.ceil(e/t+.5)*t}function oe(e,t,o){var n,i,s,m,r,c,f,g,d,M,h,y;return{color:((n=t.style)==null?void 0:n.color)??((i=e.style)==null?void 0:i.color)??Y.color,borderColor:((s=t.style)==null?void 0:s.borderColor)??((m=e.style)==null?void 0:m.borderColor)??(o==null?void 0:o.swimLaneItemBorderColor)??Y.borderColor,borderWidth:((r=t.style)==null?void 0:r.borderWidth)??((c=e.style)==null?void 0:c.borderWidth)??(o==null?void 0:o.swimLaneItemBorderWidth)??Y.borderWidth,opacity:((f=t.style)==null?void 0:f.opacity)??((g=e.style)==null?void 0:g.opacity)??Y.opacity,markerShape:((d=t.style)==null?void 0:d.markerShape)??((M=e.style)==null?void 0:M.markerShape)??Y.markerShape,markerSize:((h=t.style)==null?void 0:h.markerSize)??((y=e.style)==null?void 0:y.markerSize)??Y.markerSize}}function ne(e){return Math.max(ue,Math.min(he,e))}function Je(e,t,o){const n=t-e,i=(e+t)/2,s=ne(n*o);return{startMs:i-s/2,endMs:i+s/2}}function We(e,t,o,n){const i=t-e,s=ne(i*o),m=i>0?(n-e)/i:.5;return{startMs:n-m*s,endMs:n+(1-m)*s}}function Ue(e){let t=0;for(const o of e)t+=(o.height??I)+R;return t}function ve(e,t,o,n,i){const{swimLanes:s,showSwimLanes:m,scrollTop:r,startMs:c,endMs:f,theme:g}=i;if(!m||s.length===0)return null;const d=Math.max(0,n-j);if(t<0||t>=d)return null;let M=-r;for(const h of s){const y=h.height??I,T=M,u=M+y;if(M+=y+R,!(t<T||t>=u)){for(const p of h.items){if(p.interval){const J=k.JulianDate.toDate(p.interval.start).getTime(),L=k.JulianDate.toDate(p.interval.stop).getTime(),F=(J-c)/(f-c)*o,z=(L-c)/(f-c)*o;if(e>=Math.max(0,F)&&e<=Math.min(o,z))return{lane:h,item:p}}if(p.instant){const L=(k.JulianDate.toDate(p.instant).getTime()-c)/(f-c)*o,F=oe(h,p,g);if(Math.abs(e-L)<=F.markerSize/2+2)return{lane:h,item:p}}}return null}}return null}function Be(e,t,o,n){const{swimLanes:i,showSwimLanes:s,scrollTop:m}=n;if(!s||i.length===0||e>80)return null;const r=Math.max(0,o-j);if(t<0||t>=r)return null;let c=-m;for(const f of i){const g=f.height??I;if(t>=c&&t<c+g)return f;c+=g+R}return null}function je(e,t,o){if(!o.showSwimLanes||o.swimLanes.length===0)return!1;const n=Math.max(0,t-j);return e>=0&&e<n}function ze(e,t,o,n){const{startMs:i,endMs:s,currentMs:m,theme:r,maxTicks:c,swimLanes:f,showSwimLanes:g,reorderState:d,timezone:M,use12h:h,months:y}=n;let{scrollTop:T}=n;const u=(s-i)/1e3;if(u<=0)return T;e.fillStyle=r.backgroundColor,e.fillRect(0,0,t,o);const p=g&&f.length>0,L=p?Math.max(0,o-j):0;let F=0;if(p)for(const l of f)F+=(l.height??I)+R;const z=Math.max(0,F-L);if(T>z&&(T=z),T<0&&(T=0),p&&L>0){e.save(),e.beginPath(),e.rect(0,0,t,L),e.clip();let l=-T;const A=H=>(H-i)/(s-i)*t;for(const H of f){const D=H.height??I,E=l+D;if(E>0&&l<L){const S=H.style,v=(S==null?void 0:S.backgroundColor)??Y.backgroundColor;v&&v!=="transparent"&&(e.fillStyle=v,e.fillRect(0,l,t,D)),e.strokeStyle=r.tickColor+"44",e.lineWidth=.5,e.beginPath(),e.moveTo(0,E),e.lineTo(t,E),e.stroke();for(const N of H.items){const C=oe(H,N,r);if(N.interval){const ae=k.JulianDate.toDate(N.interval.start).getTime(),w=k.JulianDate.toDate(N.interval.stop).getTime(),W=A(ae),U=A(w),le=Math.max(0,W),se=Math.min(t,U)-le;if(se>0){e.globalAlpha=C.opacity,e.fillStyle=C.color;const be=3,ye=l+be,De=D-be*2;e.fillRect(le,ye,se,De),C.borderWidth>0&&(e.strokeStyle=C.borderColor,e.lineWidth=C.borderWidth,e.strokeRect(le,ye,se,De)),e.globalAlpha=1}}if(N.instant){const ae=k.JulianDate.toDate(N.instant).getTime(),w=A(ae);if(w>=-C.markerSize&&w<=t+C.markerSize){const W=l+D/2,U=C.markerSize;e.globalAlpha=C.opacity,e.fillStyle=C.color,C.markerShape==="diamond"?(e.beginPath(),e.moveTo(w,W-U/2),e.lineTo(w+U/2,W),e.lineTo(w,W+U/2),e.lineTo(w-U/2,W),e.closePath(),e.fill()):C.markerShape==="circle"?(e.beginPath(),e.arc(w,W,U/2,0,Math.PI*2),e.fill()):(e.strokeStyle=C.color,e.lineWidth=2,e.beginPath(),e.moveTo(w,l+2),e.lineTo(w,l+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)??Y.labelColor,e.fillText(H.label,Te,l+D/2)}if(l+=D+R,l>=L)break}if(d&&d.dragging){const H=d.currentY-d.dragStartY;let D=-T;for(let S=0;S<f.length&&S<d.insertIndex;S++)D+=(f[S].height??I)+R;e.strokeStyle=r.indicatorColor,e.lineWidth=2,e.beginPath(),e.moveTo(0,D),e.lineTo(t,D),e.stroke();const E=f.find(S=>S.id===d.dragLaneId);if(E){const S=E.height??I;let v=-T;for(const N of f){if(N.id===d.dragLaneId)break;v+=(N.height??I)+R}e.globalAlpha=.4,e.fillStyle=r.indicatorColor,e.fillRect(0,v+H,t,S),e.globalAlpha=1}}if(F>L){const H=t-q-2,D=L/F,E=Math.max(20,L*D),S=T/z*(L-E);e.fillStyle=r.tickColor+"22",e.fillRect(H,0,q,L),e.fillStyle=r.tickColor+"88",e.fillRect(H,S,q,E)}e.restore()}e.font=`${r.fontSize}px monospace`;const Ge=te(i+u*500,u,M,h,y),Xe=e.measureText(Ge).width+24,Ke=Math.max(Xe/t*u,u/1e3);let $=b[b.length-1],G=b.length-1;for(let l=0;l<b.length;l++)if(b[l]>Ke){$=b[l],G=l;break}if(c!=null&&c>0)for(;G<b.length-1&&u/$>c;)G++,$=b[G];let O=0;for(let l=G-1;l>=0;l--)if($%b[l]<1e-4){t*(b[l]/u)>=3&&(O=b[l]);break}let X=0;if(O>0){for(let l=0;l<b.length&&b[l]<O;l++)if(O%b[l]<1e-4&&t*(b[l]/u)>=3){X=b[l];break}}const ge=Me(i,u,M),K=(i-ge)/1e3,ie=K+u,re=l=>t*((l-K)/u);if(X>0){e.strokeStyle=r.tickColor,e.lineWidth=1;for(let l=Math.floor(K/X)*X;l<=ie;l=Q(l,X)){const A=re(l);e.beginPath(),e.moveTo(A,o-r.minorTickHeight),e.lineTo(A,o),e.stroke()}}if(O>0){e.strokeStyle=r.tickColor,e.lineWidth=1;for(let l=Math.floor(K/O)*O;l<=ie;l=Q(l,O)){const A=re(l);e.beginPath(),e.moveTo(A,o-r.minorTickHeight),e.lineTo(A,o),e.stroke()}}e.textAlign="center",e.textBaseline="bottom";let Se=-1/0;for(let l=Math.floor(K/$)*$;l<=ie+$;l=Q(l,$)){const A=re(l),H=ge+l*1e3;e.strokeStyle=r.majorTickColor,e.lineWidth=1,e.beginPath(),e.moveTo(A,o-r.majorTickHeight),e.lineTo(A,o),e.stroke();const D=te(H,u,M,h,y),E=e.measureText(D).width,S=A-E/2;S>Se&&(e.fillStyle=r.labelColor,e.fillText(D,A,o-r.majorTickHeight-4),Se=S+E+5)}const pe=(m-i)/(s-i)*t;return e.strokeStyle=r.indicatorColor,e.lineWidth=r.indicatorLineWidth,e.beginPath(),e.moveTo(pe,0),e.lineTo(pe,o),e.stroke(),T}a.DEFAULT_LABELS=He,a.DEFAULT_LANE_HEIGHT=I,a.DateTimeFormats=ee,a.LABEL_PAD_LEFT=Te,a.LANE_GAP=R,a.MAX_SPAN_MS=he,a.MIN_SPAN_MS=ue,a.MONTHS=de,a.SCROLLBAR_WIDTH=q,a.SWIM_LANE_SCROLL_SPEED=Oe,a.TICK_AREA_HEIGHT=j,a.TIC_SCALES=b,a.TickInterval=x,a.Timezones=Ye,a.calcEpochMs=Me,a.clampSpan=ne,a.defaultSwimLaneStyle=Y,a.defaultTheme=ke,a.drawTimeline=ze,a.formatDateTime=ce,a.formatTime=Ne,a.fromMilliseconds=Ee,a.generateTicks=Fe,a.getDateParts=V,a.getDurationMs=me,a.getTimezoneAbbr=Ie,a.hitTestLaneLabel=Be,a.hitTestSwimLane=ve,a.isInSwimLaneRegion=je,a.makeLabel=te,a.nextTic=Q,a.positionToTime=Re,a.resolveItemStyle=oe,a.resolveLabel=Ae,a.snapToTick=$e,a.splitForDisplay=Pe,a.timeToPosition=fe,a.toDate=Z,a.toJulianDate=Ce,a.toMilliseconds=P,a.totalSwimLaneHeight=Ue,a.twoD=_,a.zoomAroundMs=We,a.zoomRange=Je,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -177,7 +177,7 @@ export declare const LABEL_PAD_LEFT = 6;
|
|
|
177
177
|
/** Gap in pixels between swim lane rows. */
|
|
178
178
|
export declare const LANE_GAP = 1;
|
|
179
179
|
|
|
180
|
-
export declare function makeLabel(ms: number, durationSec: number, timezone?: string): string;
|
|
180
|
+
export declare function makeLabel(ms: number, durationSec: number, timezone?: string, use12h?: boolean, months?: string[]): string;
|
|
181
181
|
|
|
182
182
|
/** Maximum visible span: ~1 000 years — stays within TIC_SCALES range. */
|
|
183
183
|
export declare const MAX_SPAN_MS = 31536000000000;
|
|
@@ -494,6 +494,32 @@ export declare interface TimelineLabels {
|
|
|
494
494
|
collapseSwimLanesTooltip: string;
|
|
495
495
|
/** Tooltip on the chevron button when swim lanes are currently hidden (click will expand). */
|
|
496
496
|
expandSwimLanesTooltip: string;
|
|
497
|
+
/**
|
|
498
|
+
* Abbreviated month names used for timeline tick labels (Jan–Dec zoom levels).
|
|
499
|
+
* Provide all 12 entries in calendar order (January first) to translate the
|
|
500
|
+
* month labels shown on the canvas.
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* ```ts
|
|
504
|
+
* // French
|
|
505
|
+
* months: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun',
|
|
506
|
+
* 'Jul', 'Aoû', 'Sep', 'Oct', 'Nov', 'Déc']
|
|
507
|
+
* ```
|
|
508
|
+
*/
|
|
509
|
+
months: [
|
|
510
|
+
string,
|
|
511
|
+
string,
|
|
512
|
+
string,
|
|
513
|
+
string,
|
|
514
|
+
string,
|
|
515
|
+
string,
|
|
516
|
+
string,
|
|
517
|
+
string,
|
|
518
|
+
string,
|
|
519
|
+
string,
|
|
520
|
+
string,
|
|
521
|
+
string
|
|
522
|
+
];
|
|
497
523
|
}
|
|
498
524
|
|
|
499
525
|
/** Mutable state the engine reads during a draw call. */
|
|
@@ -509,6 +535,10 @@ export declare interface TimelineRenderState {
|
|
|
509
535
|
reorderState: ReorderState | null;
|
|
510
536
|
/** @see TimelineBaseProps.timezone */
|
|
511
537
|
timezone?: string;
|
|
538
|
+
/** When true, tick labels use 12-hour (hh:mm AM/PM) format instead of 24-hour. */
|
|
539
|
+
use12h?: boolean;
|
|
540
|
+
/** Abbreviated month names for tick labels. Falls back to English when omitted. */
|
|
541
|
+
months?: string[];
|
|
512
542
|
}
|
|
513
543
|
|
|
514
544
|
export declare interface TimelineTheme {
|
|
@@ -559,6 +589,17 @@ export declare function totalSwimLaneHeight(lanes: SwimLane[]): number;
|
|
|
559
589
|
|
|
560
590
|
export declare function twoD(n: number): string;
|
|
561
591
|
|
|
592
|
+
/**
|
|
593
|
+
* Compute a new visible range after zooming by `amount` around a specific
|
|
594
|
+
* pivot time. The pivot stays at the same fractional position on-screen,
|
|
595
|
+
* which is the expected behaviour for pinch-to-zoom (pivot = midpoint between
|
|
596
|
+
* the two fingers) and mouse-wheel zoom anchored to the cursor.
|
|
597
|
+
*/
|
|
598
|
+
export declare function zoomAroundMs(startMs: number, endMs: number, amount: number, pivotMs: number): {
|
|
599
|
+
startMs: number;
|
|
600
|
+
endMs: number;
|
|
601
|
+
};
|
|
602
|
+
|
|
562
603
|
/** Compute a new visible range after zooming by `amount` around the center. */
|
|
563
604
|
export declare function zoomRange(startMs: number, endMs: number, amount: number): {
|
|
564
605
|
startMs: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kteneyck/cesium-timeline-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Framework-agnostic core logic for the Cesium timeline component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "kteneyck",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "vite build",
|
|
44
|
-
"test": "vitest"
|
|
44
|
+
"test": "vitest run"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"cesium": "^1.100.0"
|