@kteneyck/cesium-timeline-core 0.8.0 → 0.9.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/README.md +62 -0
- package/dist/cesium-timeline-core.js +242 -237
- package/dist/cesium-timeline-core.umd.cjs +1 -1
- package/dist/index.d.ts +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -133,6 +133,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
133
133
|
- **Clickable datetime** — pass `onDateTimeClick` to open your own date picker; pass the result back via `jumpToTime` to pan the canvas and set the time.
|
|
134
134
|
- **Token-based datetime format** — built-in presets plus custom format strings with 17 supported tokens.
|
|
135
135
|
- **Max tick limit** — `maxTicks` prop prevents the canvas from becoming overloaded at wide zoom levels by coarsening the tick scale automatically.
|
|
136
|
+
- **Zoom to selection** — drag in the tick area (away from the needle) to draw a time-range highlight with a crosshair cursor; on release the visible window zooms to exactly the selected span and fires `onRangeSelect` (React) / `rangeSelect` (Angular) with the resulting start and end times.
|
|
136
137
|
- **Swim lanes** — display time intervals and instants as horizontal rows inside the canvas. Supports customizable styling, click/hover/double-click event hooks, drag-to-reorder, and vertical scrolling when lanes overflow.
|
|
137
138
|
- **Fully themeable** — 16 theme properties cover every color, size, and font setting, including swim lane item border defaults.
|
|
138
139
|
- **Localizable labels** — every control-bar label and tooltip is overridable via the `labels` prop; dynamic tooltips accept a `(multiplier: number) => string` callback. See [Labels & i18n](#labels--i18n).
|
|
@@ -174,6 +175,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
174
175
|
| `onSwimLaneItemHover` | `(info: SwimLaneEventInfo \| null) => void` | — | Fires when mouse enters/leaves a swim lane item |
|
|
175
176
|
| `onSwimLaneItemDoubleClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is double-clicked |
|
|
176
177
|
| `onSwimLaneReorder` | `(orderedIds: string[]) => void` | — | Fires when swim lanes are reordered via drag. Receives the new lane id order. |
|
|
178
|
+
| `onRangeSelect` | `(start: JulianDate, end: JulianDate) => void` | — | Fires when the user completes a click-and-drag in the tick area. The visible window zooms to the selected span; receives the resulting start and end times. |
|
|
177
179
|
| `labels` | `Partial<TimelineLabels>` | English defaults | Override any control-bar label or tooltip string. See [Labels & i18n](#labels--i18n). |
|
|
178
180
|
|
|
179
181
|
---
|
|
@@ -596,6 +598,12 @@ const CesiumWithTimeline = () => {
|
|
|
596
598
|
onTimeChange={(t) => { clock.currentTime = t; }}
|
|
597
599
|
onPlayPause={(playing) => { clock.shouldAnimate = playing; }}
|
|
598
600
|
onMultiplierChange={(m) => { clock.multiplier = m; }}
|
|
601
|
+
onRangeSelect={(start, end) => {
|
|
602
|
+
// Zoom the Cesium clock range to match the selected span
|
|
603
|
+
clock.startTime = start;
|
|
604
|
+
clock.stopTime = end;
|
|
605
|
+
clock.currentTime = start;
|
|
606
|
+
}}
|
|
599
607
|
/>
|
|
600
608
|
)}
|
|
601
609
|
</div>
|
|
@@ -695,6 +703,60 @@ const StandaloneTimeline = () => {
|
|
|
695
703
|
};
|
|
696
704
|
```
|
|
697
705
|
|
|
706
|
+
### Zoom to Selection
|
|
707
|
+
|
|
708
|
+
Click-and-drag in the tick area (the bottom strip, away from the needle) to draw a time-range highlight. The cursor becomes a crosshair while dragging. On mouse-up the **visible window zooms to exactly the selected span** and `onRangeSelect` fires with the start and end `JulianDate`.
|
|
709
|
+
|
|
710
|
+
A short click (no drag) in the tick area still moves the needle normally.
|
|
711
|
+
|
|
712
|
+
```tsx
|
|
713
|
+
import { useState } from 'react';
|
|
714
|
+
import * as Cesium from 'cesium';
|
|
715
|
+
import { Timeline } from '@kteneyck/cesium-timeline-react';
|
|
716
|
+
|
|
717
|
+
const ZoomableTimeline = () => {
|
|
718
|
+
const [selectedRange, setSelectedRange] = useState<{ start: Date; end: Date } | null>(null);
|
|
719
|
+
|
|
720
|
+
return (
|
|
721
|
+
<>
|
|
722
|
+
{selectedRange && (
|
|
723
|
+
<p>
|
|
724
|
+
Selected: {selectedRange.start.toISOString()} → {selectedRange.end.toISOString()}
|
|
725
|
+
</p>
|
|
726
|
+
)}
|
|
727
|
+
<Timeline
|
|
728
|
+
clock={viewer.clock}
|
|
729
|
+
height={120}
|
|
730
|
+
onRangeSelect={(start, end) => {
|
|
731
|
+
setSelectedRange({
|
|
732
|
+
start: Cesium.JulianDate.toDate(start),
|
|
733
|
+
end: Cesium.JulianDate.toDate(end),
|
|
734
|
+
});
|
|
735
|
+
}}
|
|
736
|
+
/>
|
|
737
|
+
</>
|
|
738
|
+
);
|
|
739
|
+
};
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
In Angular, listen to the `(rangeSelect)` output — the event payload is `{ start: Cesium.JulianDate, end: Cesium.JulianDate }`:
|
|
743
|
+
|
|
744
|
+
```html
|
|
745
|
+
<ct-timeline
|
|
746
|
+
[clock]="viewer.clock"
|
|
747
|
+
[height]="120"
|
|
748
|
+
(rangeSelect)="onRangeSelect($event)"
|
|
749
|
+
/>
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
```typescript
|
|
753
|
+
onRangeSelect(range: { start: Cesium.JulianDate; end: Cesium.JulianDate }) {
|
|
754
|
+
this.viewer.clock.startTime = range.start;
|
|
755
|
+
this.viewer.clock.stopTime = range.end;
|
|
756
|
+
this.viewer.clock.currentTime = range.start;
|
|
757
|
+
}
|
|
758
|
+
```
|
|
759
|
+
|
|
698
760
|
---
|
|
699
761
|
|
|
700
762
|
## Swim Lanes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as A from "cesium";
|
|
2
2
|
function Ce(e, t) {
|
|
3
3
|
return typeof e == "function" ? e(t) : e;
|
|
4
4
|
}
|
|
5
|
-
const
|
|
5
|
+
const Ye = {
|
|
6
6
|
dateTimeClickTooltip: "Click to jump to a date/time",
|
|
7
7
|
liveLabel: "LIVE",
|
|
8
8
|
liveActiveLabel: "● LIVE",
|
|
@@ -36,7 +36,7 @@ const Ae = {
|
|
|
36
36
|
"Nov",
|
|
37
37
|
"Dec"
|
|
38
38
|
]
|
|
39
|
-
},
|
|
39
|
+
}, we = {
|
|
40
40
|
backgroundColor: "#1a1a1a",
|
|
41
41
|
tickColor: "#666666",
|
|
42
42
|
majorTickColor: "#999999",
|
|
@@ -54,8 +54,8 @@ const Ae = {
|
|
|
54
54
|
swimLaneItemBorderColor: "#666666",
|
|
55
55
|
swimLaneItemBorderWidth: 0
|
|
56
56
|
};
|
|
57
|
-
var
|
|
58
|
-
const
|
|
57
|
+
var me = /* @__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))(me || {});
|
|
58
|
+
const J = {
|
|
59
59
|
color: "#4da6ff",
|
|
60
60
|
borderColor: "#2980b9",
|
|
61
61
|
borderWidth: 1,
|
|
@@ -64,23 +64,23 @@ const P = {
|
|
|
64
64
|
markerSize: 10,
|
|
65
65
|
labelColor: "#cccccc",
|
|
66
66
|
backgroundColor: "transparent"
|
|
67
|
-
},
|
|
68
|
-
function
|
|
69
|
-
return e instanceof
|
|
67
|
+
}, P = 24;
|
|
68
|
+
function Ee(e) {
|
|
69
|
+
return e instanceof A.JulianDate ? A.JulianDate.clone(e) : A.JulianDate.fromDate(e);
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
return e instanceof
|
|
71
|
+
function te(e) {
|
|
72
|
+
return e instanceof A.JulianDate ? A.JulianDate.toDate(e) : e;
|
|
73
73
|
}
|
|
74
74
|
function F(e) {
|
|
75
|
-
return
|
|
75
|
+
return te(e).getTime();
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
77
|
+
function $e(e) {
|
|
78
|
+
return A.JulianDate.fromDate(new Date(e));
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function ge(e, t) {
|
|
81
81
|
return F(t) - F(e);
|
|
82
82
|
}
|
|
83
|
-
const
|
|
83
|
+
const Te = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], Se = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], fe = {
|
|
84
84
|
/** e.g. "Feb 24 2026 14:04:07" — default */
|
|
85
85
|
DEFAULT: "MMM DD YYYY HH:mm:ss",
|
|
86
86
|
/** e.g. "Feb 24 2026 02:04:07 PM" */
|
|
@@ -95,16 +95,16 @@ const ge = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"
|
|
|
95
95
|
TIME_ONLY: "HH:mm:ss",
|
|
96
96
|
/** e.g. "02:04:07 PM" */
|
|
97
97
|
TIME_12: "hh:mm:ss A"
|
|
98
|
-
},
|
|
98
|
+
}, Ie = {
|
|
99
99
|
/** Use the browser's local timezone (default behavior). */
|
|
100
100
|
LOCAL: "local",
|
|
101
101
|
/** Coordinated Universal Time. */
|
|
102
102
|
UTC: "UTC"
|
|
103
103
|
};
|
|
104
|
-
function
|
|
104
|
+
function oe(e, t) {
|
|
105
105
|
if (!t || t === "local") {
|
|
106
|
-
const M = e.getFullYear(),
|
|
107
|
-
return { yr: M, mo:
|
|
106
|
+
const M = e.getFullYear(), h = e.getMonth(), y = e.getDate(), S = e.getHours(), f = S % 12 || 12, u = e.getMinutes(), w = e.getSeconds(), O = e.getMilliseconds();
|
|
107
|
+
return { yr: M, mo: h, day: y, hr24: S, hr12: f, min: u, sec: w, ms: O, ampm: S < 12 ? "AM" : "PM" };
|
|
108
108
|
}
|
|
109
109
|
const o = new Intl.DateTimeFormat("en-US", {
|
|
110
110
|
timeZone: t,
|
|
@@ -115,105 +115,105 @@ function te(e, t) {
|
|
|
115
115
|
minute: "2-digit",
|
|
116
116
|
second: "2-digit",
|
|
117
117
|
hour12: !1
|
|
118
|
-
}),
|
|
118
|
+
}), s = {};
|
|
119
119
|
for (const M of o.formatToParts(e))
|
|
120
|
-
M.type !== "literal" && (
|
|
121
|
-
const n = parseInt(
|
|
122
|
-
let r = parseInt(
|
|
120
|
+
M.type !== "literal" && (s[M.type] = M.value);
|
|
121
|
+
const n = parseInt(s.year), l = parseInt(s.month) - 1, a = parseInt(s.day);
|
|
122
|
+
let r = parseInt(s.hour);
|
|
123
123
|
r === 24 && (r = 0);
|
|
124
|
-
const c = r % 12 || 12, m = parseInt(
|
|
124
|
+
const c = r % 12 || 12, m = parseInt(s.minute), d = parseInt(s.second), p = e.getMilliseconds();
|
|
125
125
|
return { yr: n, mo: l, day: a, hr24: r, hr12: c, min: m, sec: d, ms: p, ampm: r < 12 ? "AM" : "PM" };
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Re(e, t) {
|
|
128
128
|
var n;
|
|
129
129
|
if (!t || t === "local") return null;
|
|
130
|
-
const o =
|
|
130
|
+
const o = te(e);
|
|
131
131
|
return ((n = new Intl.DateTimeFormat("en-US", {
|
|
132
132
|
timeZone: t,
|
|
133
133
|
timeZoneName: "short"
|
|
134
134
|
}).formatToParts(o).find((l) => l.type === "timeZoneName")) == null ? void 0 : n.value) ?? null;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
const
|
|
136
|
+
function ye(e, t = fe.DEFAULT, o) {
|
|
137
|
+
const s = te(e), { yr: n, mo: l, day: a, hr24: r, hr12: c, min: m, sec: d, ms: p, ampm: M } = oe(s, o), h = (f) => String(f).padStart(2, "0"), y = (f) => String(f).padStart(3, "0"), S = {
|
|
138
138
|
YYYY: String(n),
|
|
139
139
|
YY: String(n).slice(-2),
|
|
140
|
-
MMMM:
|
|
141
|
-
MMM:
|
|
142
|
-
MM:
|
|
140
|
+
MMMM: Se[l],
|
|
141
|
+
MMM: Te[l],
|
|
142
|
+
MM: h(l + 1),
|
|
143
143
|
M: String(l + 1),
|
|
144
|
-
DD:
|
|
144
|
+
DD: h(a),
|
|
145
145
|
D: String(a),
|
|
146
|
-
HH:
|
|
146
|
+
HH: h(r),
|
|
147
147
|
H: String(r),
|
|
148
|
-
hh:
|
|
148
|
+
hh: h(c),
|
|
149
149
|
h: String(c),
|
|
150
|
-
mm:
|
|
151
|
-
ss:
|
|
152
|
-
SSS:
|
|
150
|
+
mm: h(m),
|
|
151
|
+
ss: h(d),
|
|
152
|
+
SSS: y(p),
|
|
153
153
|
A: M,
|
|
154
154
|
a: M.toLowerCase()
|
|
155
155
|
};
|
|
156
156
|
return t.replace(
|
|
157
157
|
/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,
|
|
158
|
-
(f) =>
|
|
158
|
+
(f) => S[f] ?? f
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
function Je(e =
|
|
162
|
-
const t = ["YYYY", "YY", "MMMM", "MMM", "MM", "M", "DD", "D"], o = ["HH", "H", "hh", "h", "mm", "ss", "SSS", "A", "a"],
|
|
161
|
+
function Je(e = fe.DEFAULT) {
|
|
162
|
+
const t = ["YYYY", "YY", "MMMM", "MMM", "MM", "M", "DD", "D"], o = ["HH", "H", "hh", "h", "mm", "ss", "SSS", "A", "a"], s = (a) => a.replace(/\s{2,}/g, " ").trim().replace(/^[\s\W]+|[\s\W]+$/g, "").trim();
|
|
163
163
|
let n = e;
|
|
164
164
|
for (const a of t) n = n.replace(a, "");
|
|
165
165
|
let l = e;
|
|
166
166
|
for (const a of o) l = l.replace(a, "");
|
|
167
|
-
return { timeFormat:
|
|
167
|
+
return { timeFormat: s(n), dateFormat: s(l) };
|
|
168
168
|
}
|
|
169
169
|
function Pe(e, t = !1) {
|
|
170
|
-
return
|
|
170
|
+
return ye(e, t ? "HH:mm:ss" : "HH:mm");
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function be(e, t, o, s) {
|
|
173
173
|
const n = F(e), l = F(t), a = F(o);
|
|
174
174
|
if (a === l) return 0;
|
|
175
175
|
const r = (n - l) / (a - l);
|
|
176
|
-
return Math.max(0, Math.min(1, r)) *
|
|
176
|
+
return Math.max(0, Math.min(1, r)) * s;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
const n = Math.max(0, Math.min(1, e /
|
|
180
|
-
return
|
|
178
|
+
function Fe(e, t, o, s) {
|
|
179
|
+
const n = Math.max(0, Math.min(1, e / s)), l = F(t), a = F(o), r = l + n * (a - l);
|
|
180
|
+
return A.JulianDate.fromDate(new Date(r));
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const n = [], l =
|
|
182
|
+
function Ne(e, t, o, s) {
|
|
183
|
+
const n = [], l = ge(e, t), a = F(e);
|
|
184
184
|
let r;
|
|
185
|
-
typeof o == "number" && o in
|
|
185
|
+
typeof o == "number" && o in me || typeof o == "number" ? r = o * 60 * 1e3 : r = 3600 * 1e3;
|
|
186
186
|
const c = r * 4;
|
|
187
187
|
let m = a, d = 0;
|
|
188
188
|
for (; m <= a + l; ) {
|
|
189
|
-
const p = d * r % c === 0, M =
|
|
189
|
+
const p = d * r % c === 0, M = be(
|
|
190
190
|
new Date(m),
|
|
191
191
|
e,
|
|
192
192
|
t,
|
|
193
|
-
|
|
193
|
+
s
|
|
194
194
|
);
|
|
195
|
-
let
|
|
195
|
+
let h;
|
|
196
196
|
if (p) {
|
|
197
|
-
const
|
|
198
|
-
|
|
197
|
+
const y = new Date(m), S = y.getHours().toString().padStart(2, "0"), f = y.getMinutes().toString().padStart(2, "0");
|
|
198
|
+
h = `${S}:${f}`;
|
|
199
199
|
}
|
|
200
200
|
n.push({
|
|
201
201
|
position: M,
|
|
202
202
|
isMajor: p,
|
|
203
|
-
label:
|
|
203
|
+
label: h
|
|
204
204
|
}), m += r, d++;
|
|
205
205
|
}
|
|
206
206
|
return n;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
let
|
|
208
|
+
function _e(e, t, o = 10) {
|
|
209
|
+
let s = t[0], n = Math.abs(s.position - e);
|
|
210
210
|
for (const l of t) {
|
|
211
211
|
const a = Math.abs(l.position - e);
|
|
212
|
-
a < n && (n = a,
|
|
212
|
+
a < n && (n = a, s = l);
|
|
213
213
|
}
|
|
214
|
-
return n <= o ?
|
|
214
|
+
return n <= o ? s.position : e;
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const De = 1e3, Le = 31536e9, L = [
|
|
217
217
|
1e-3,
|
|
218
218
|
2e-3,
|
|
219
219
|
5e-3,
|
|
@@ -262,85 +262,85 @@ const be = 1e3, De = 31536e9, D = [
|
|
|
262
262
|
126144e5,
|
|
263
263
|
15768e6,
|
|
264
264
|
31536e6
|
|
265
|
-
],
|
|
266
|
-
function
|
|
265
|
+
], X = 36, W = 1, ke = 6, x = 6, We = 0.3, He = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
266
|
+
function E(e) {
|
|
267
267
|
return e < 10 ? `0${e}` : `${e}`;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
const l = new Date(e), { yr: a, mo: r, day: c, hr24: m, hr12: d, min: p, sec: M, ms:
|
|
269
|
+
function ce(e, t, o, s, n) {
|
|
270
|
+
const l = new Date(e), { yr: a, mo: r, day: c, hr24: m, hr12: d, min: p, sec: M, ms: h, ampm: y } = oe(l, o), S = s ? d : m, f = s ? ` ${y}` : "", u = n ?? He;
|
|
271
271
|
if (t > 31536e4) return `${a}`;
|
|
272
|
-
if (t > 31536e3) return `${
|
|
273
|
-
if (t > 604800) return `${
|
|
274
|
-
if (t > 86400) return `${
|
|
275
|
-
if (t > 3600) return `${
|
|
276
|
-
if (t > 60) return `${
|
|
277
|
-
const
|
|
278
|
-
return `${
|
|
272
|
+
if (t > 31536e3) return `${u[r]} ${a}`;
|
|
273
|
+
if (t > 604800) return `${u[r]} ${c}`;
|
|
274
|
+
if (t > 86400) return `${u[r]} ${c} ${E(S)}:${E(p)}${f}`;
|
|
275
|
+
if (t > 3600) return `${E(S)}:${E(p)}${f}`;
|
|
276
|
+
if (t > 60) return `${E(S)}:${E(p)}:${E(M)}${f}`;
|
|
277
|
+
const w = h > 0 ? `.${String(h).padStart(3, "0")}` : "";
|
|
278
|
+
return `${E(S)}:${E(p)}:${E(M)}${w}${f}`;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
const
|
|
280
|
+
function Ae(e, t, o) {
|
|
281
|
+
const s = new Date(e);
|
|
282
282
|
if (!o || o === "local") {
|
|
283
|
-
const c =
|
|
283
|
+
const c = s.getFullYear(), m = s.getMonth(), d = s.getDate();
|
|
284
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();
|
|
285
285
|
}
|
|
286
|
-
const { yr: n, hr24: l, min: a, sec: r } =
|
|
286
|
+
const { yr: n, hr24: l, min: a, sec: r } = oe(s, o);
|
|
287
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;
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function ee(e, t) {
|
|
290
290
|
return Math.ceil(e / t + 0.5) * t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
var
|
|
292
|
+
function ue(e, t, o) {
|
|
293
|
+
var s, n, l, a, r, c, m, d, p, M, h, y;
|
|
294
294
|
return {
|
|
295
|
-
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) ??
|
|
297
|
-
borderWidth: ((r = t.style) == null ? void 0 : r.borderWidth) ?? ((c = e.style) == null ? void 0 : c.borderWidth) ?? (o == null ? void 0 : o.swimLaneItemBorderWidth) ??
|
|
298
|
-
opacity: ((m = t.style) == null ? void 0 : m.opacity) ?? ((d = e.style) == null ? void 0 : d.opacity) ??
|
|
299
|
-
markerShape: ((p = t.style) == null ? void 0 : p.markerShape) ?? ((M = e.style) == null ? void 0 : M.markerShape) ??
|
|
300
|
-
markerSize: ((
|
|
295
|
+
color: ((s = t.style) == null ? void 0 : s.color) ?? ((n = e.style) == null ? void 0 : n.color) ?? J.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) ?? J.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) ?? J.borderWidth,
|
|
298
|
+
opacity: ((m = t.style) == null ? void 0 : m.opacity) ?? ((d = e.style) == null ? void 0 : d.opacity) ?? J.opacity,
|
|
299
|
+
markerShape: ((p = t.style) == null ? void 0 : p.markerShape) ?? ((M = e.style) == null ? void 0 : M.markerShape) ?? J.markerShape,
|
|
300
|
+
markerSize: ((h = t.style) == null ? void 0 : h.markerSize) ?? ((y = e.style) == null ? void 0 : y.markerSize) ?? J.markerSize
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
return Math.max(
|
|
303
|
+
function he(e) {
|
|
304
|
+
return Math.max(De, Math.min(Le, e));
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
const
|
|
306
|
+
function Oe(e, t, o) {
|
|
307
|
+
const s = t - e, n = (e + t) / 2, l = he(s * o);
|
|
308
308
|
return {
|
|
309
309
|
startMs: n - l / 2,
|
|
310
310
|
endMs: n + l / 2
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
const n = t - e, l =
|
|
313
|
+
function Ue(e, t, o, s) {
|
|
314
|
+
const n = t - e, l = he(n * o), a = n > 0 ? (s - e) / n : 0.5;
|
|
315
315
|
return {
|
|
316
|
-
startMs:
|
|
317
|
-
endMs:
|
|
316
|
+
startMs: s - a * l,
|
|
317
|
+
endMs: s + (1 - a) * l
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function Be(e) {
|
|
321
321
|
let t = 0;
|
|
322
|
-
for (const o of e) t += (o.height ??
|
|
322
|
+
for (const o of e) t += (o.height ?? P) + W;
|
|
323
323
|
return t;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function ve(e, t, o, s, n) {
|
|
326
326
|
const { swimLanes: l, showSwimLanes: a, scrollTop: r, startMs: c, endMs: m, theme: d } = n;
|
|
327
327
|
if (!a || l.length === 0) return null;
|
|
328
|
-
const p = Math.max(0,
|
|
328
|
+
const p = Math.max(0, s - X);
|
|
329
329
|
if (t < 0 || t >= p) return null;
|
|
330
330
|
let M = -r;
|
|
331
|
-
for (const
|
|
332
|
-
const
|
|
333
|
-
if (M +=
|
|
334
|
-
for (const
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
if (e >= Math.max(0,
|
|
338
|
-
return { lane:
|
|
331
|
+
for (const h of l) {
|
|
332
|
+
const y = h.height ?? P, S = M, f = M + y;
|
|
333
|
+
if (M += y + W, !(t < S || t >= f)) {
|
|
334
|
+
for (const u of h.items) {
|
|
335
|
+
if (u.interval) {
|
|
336
|
+
const w = A.JulianDate.toDate(u.interval.start).getTime(), O = A.JulianDate.toDate(u.interval.stop).getTime(), k = (w - c) / (m - c) * o, U = (O - c) / (m - c) * o;
|
|
337
|
+
if (e >= Math.max(0, k) && e <= Math.min(o, U))
|
|
338
|
+
return { lane: h, item: u };
|
|
339
339
|
}
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
if (Math.abs(e -
|
|
343
|
-
return { lane:
|
|
340
|
+
if (u.instant) {
|
|
341
|
+
const O = (A.JulianDate.toDate(u.instant).getTime() - c) / (m - c) * o, k = ue(h, u, d);
|
|
342
|
+
if (Math.abs(e - O) <= k.markerSize / 2 + 2)
|
|
343
|
+
return { lane: h, item: u };
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
return null;
|
|
@@ -348,25 +348,25 @@ function Be(e, t, o, i, n) {
|
|
|
348
348
|
}
|
|
349
349
|
return null;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
const { swimLanes: n, showSwimLanes: l, scrollTop: a } =
|
|
351
|
+
function ze(e, t, o, s) {
|
|
352
|
+
const { swimLanes: n, showSwimLanes: l, scrollTop: a } = s;
|
|
353
353
|
if (!l || n.length === 0 || e > 80) return null;
|
|
354
|
-
const r = Math.max(0, o -
|
|
354
|
+
const r = Math.max(0, o - X);
|
|
355
355
|
if (t < 0 || t >= r) return null;
|
|
356
356
|
let c = -a;
|
|
357
357
|
for (const m of n) {
|
|
358
|
-
const d = m.height ??
|
|
358
|
+
const d = m.height ?? P;
|
|
359
359
|
if (t >= c && t < c + d) return m;
|
|
360
|
-
c += d +
|
|
360
|
+
c += d + W;
|
|
361
361
|
}
|
|
362
362
|
return null;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function je(e, t, o) {
|
|
365
365
|
if (!o.showSwimLanes || o.swimLanes.length === 0) return !1;
|
|
366
|
-
const
|
|
367
|
-
return e >= 0 && e <
|
|
366
|
+
const s = Math.max(0, t - X);
|
|
367
|
+
return e >= 0 && e < s;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Xe(e, t, o, s) {
|
|
370
370
|
const {
|
|
371
371
|
startMs: n,
|
|
372
372
|
endMs: l,
|
|
@@ -377,166 +377,171 @@ function je(e, t, o, i) {
|
|
|
377
377
|
showSwimLanes: d,
|
|
378
378
|
reorderState: p,
|
|
379
379
|
timezone: M,
|
|
380
|
-
use12h:
|
|
381
|
-
months:
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
380
|
+
use12h: h,
|
|
381
|
+
months: y,
|
|
382
|
+
rangeSelection: S
|
|
383
|
+
} = s;
|
|
384
|
+
let { scrollTop: f } = s;
|
|
385
|
+
const u = (l - n) / 1e3;
|
|
386
|
+
if (u <= 0) return f;
|
|
386
387
|
e.fillStyle = r.backgroundColor, e.fillRect(0, 0, t, o);
|
|
387
|
-
const
|
|
388
|
-
let
|
|
389
|
-
if (
|
|
390
|
-
for (const
|
|
391
|
-
const
|
|
392
|
-
if (
|
|
393
|
-
e.save(), e.beginPath(), e.rect(0, 0, t,
|
|
394
|
-
let
|
|
395
|
-
const
|
|
396
|
-
for (const
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
const g =
|
|
400
|
-
|
|
401
|
-
for (const
|
|
402
|
-
const H =
|
|
403
|
-
if (
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
388
|
+
const w = d && m.length > 0, k = w ? Math.max(0, o - X) : 0;
|
|
389
|
+
let U = 0;
|
|
390
|
+
if (w)
|
|
391
|
+
for (const i of m) U += (i.height ?? P) + W;
|
|
392
|
+
const G = Math.max(0, U - k);
|
|
393
|
+
if (f > G && (f = G), f < 0 && (f = 0), w && k > 0) {
|
|
394
|
+
e.save(), e.beginPath(), e.rect(0, 0, t, k), e.clip();
|
|
395
|
+
let i = -f;
|
|
396
|
+
const b = (D) => (D - n) / (l - n) * t;
|
|
397
|
+
for (const D of m) {
|
|
398
|
+
const T = D.height ?? P, C = i + T;
|
|
399
|
+
if (C > 0 && i < k) {
|
|
400
|
+
const g = D.style, B = (g == null ? void 0 : g.backgroundColor) ?? J.backgroundColor;
|
|
401
|
+
B && B !== "transparent" && (e.fillStyle = B, e.fillRect(0, i, t, T)), e.strokeStyle = r.tickColor + "44", e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, C), e.lineTo(t, C), e.stroke();
|
|
402
|
+
for (const $ of D.items) {
|
|
403
|
+
const H = ue(D, $, r);
|
|
404
|
+
if ($.interval) {
|
|
405
|
+
const V = A.JulianDate.toDate($.interval.start).getTime(), Y = A.JulianDate.toDate($.interval.stop).getTime(), N = b(V), _ = b(Y), q = Math.max(0, N), Q = Math.min(t, _) - q;
|
|
406
|
+
if (Q > 0) {
|
|
406
407
|
e.globalAlpha = H.opacity, e.fillStyle = H.color;
|
|
407
|
-
const
|
|
408
|
-
e.fillRect(
|
|
408
|
+
const se = 3, le = i + se, ae = T - se * 2;
|
|
409
|
+
e.fillRect(q, le, Q, ae), H.borderWidth > 0 && (e.strokeStyle = H.borderColor, e.lineWidth = H.borderWidth, e.strokeRect(q, le, Q, ae)), e.globalAlpha = 1;
|
|
409
410
|
}
|
|
410
411
|
}
|
|
411
|
-
if (
|
|
412
|
-
const
|
|
412
|
+
if ($.instant) {
|
|
413
|
+
const V = A.JulianDate.toDate($.instant).getTime(), Y = b(V);
|
|
413
414
|
if (Y >= -H.markerSize && Y <= t + H.markerSize) {
|
|
414
|
-
const
|
|
415
|
-
e.globalAlpha = H.opacity, e.fillStyle = H.color, H.markerShape === "diamond" ? (e.beginPath(), e.moveTo(Y,
|
|
415
|
+
const N = i + T / 2, _ = H.markerSize;
|
|
416
|
+
e.globalAlpha = H.opacity, e.fillStyle = H.color, H.markerShape === "diamond" ? (e.beginPath(), e.moveTo(Y, N - _ / 2), e.lineTo(Y + _ / 2, N), e.lineTo(Y, N + _ / 2), e.lineTo(Y - _ / 2, N), e.closePath(), e.fill()) : H.markerShape === "circle" ? (e.beginPath(), e.arc(Y, N, _ / 2, 0, Math.PI * 2), e.fill()) : (e.strokeStyle = H.color, e.lineWidth = 2, e.beginPath(), e.moveTo(Y, i + 2), e.lineTo(Y, i + T - 2), e.stroke()), e.globalAlpha = 1;
|
|
416
417
|
}
|
|
417
418
|
}
|
|
418
419
|
}
|
|
419
|
-
e.font = `${Math.min(11,
|
|
420
|
+
e.font = `${Math.min(11, T - 4)}px system-ui, sans-serif`, e.textAlign = "left", e.textBaseline = "middle", e.fillStyle = (g == null ? void 0 : g.labelColor) ?? J.labelColor, e.fillText(D.label, ke, i + T / 2);
|
|
420
421
|
}
|
|
421
|
-
if (
|
|
422
|
+
if (i += T + W, i >= k) break;
|
|
422
423
|
}
|
|
423
424
|
if (p && p.dragging) {
|
|
424
|
-
const
|
|
425
|
-
let
|
|
425
|
+
const D = p.currentY - p.dragStartY;
|
|
426
|
+
let T = -f;
|
|
426
427
|
for (let g = 0; g < m.length && g < p.insertIndex; g++)
|
|
427
|
-
|
|
428
|
-
e.strokeStyle = r.indicatorColor, e.lineWidth = 2, e.beginPath(), e.moveTo(0,
|
|
429
|
-
const
|
|
430
|
-
if (
|
|
431
|
-
const g =
|
|
432
|
-
let
|
|
433
|
-
for (const
|
|
434
|
-
if (
|
|
435
|
-
|
|
428
|
+
T += (m[g].height ?? P) + W;
|
|
429
|
+
e.strokeStyle = r.indicatorColor, e.lineWidth = 2, e.beginPath(), e.moveTo(0, T), e.lineTo(t, T), e.stroke();
|
|
430
|
+
const C = m.find((g) => g.id === p.dragLaneId);
|
|
431
|
+
if (C) {
|
|
432
|
+
const g = C.height ?? P;
|
|
433
|
+
let B = -f;
|
|
434
|
+
for (const $ of m) {
|
|
435
|
+
if ($.id === p.dragLaneId) break;
|
|
436
|
+
B += ($.height ?? P) + W;
|
|
436
437
|
}
|
|
437
|
-
e.globalAlpha = 0.4, e.fillStyle = r.indicatorColor, e.fillRect(0,
|
|
438
|
+
e.globalAlpha = 0.4, e.fillStyle = r.indicatorColor, e.fillRect(0, B + D, t, g), e.globalAlpha = 1;
|
|
438
439
|
}
|
|
439
440
|
}
|
|
440
|
-
if (
|
|
441
|
-
const
|
|
442
|
-
e.fillStyle = r.tickColor + "22", e.fillRect(
|
|
441
|
+
if (U > k) {
|
|
442
|
+
const D = t - x - 2, T = k / U, C = Math.max(20, k * T), g = f / G * (k - C);
|
|
443
|
+
e.fillStyle = r.tickColor + "22", e.fillRect(D, 0, x, k), e.fillStyle = r.tickColor + "88", e.fillRect(D, g, x, C);
|
|
443
444
|
}
|
|
444
445
|
e.restore();
|
|
445
446
|
}
|
|
446
447
|
e.font = `${r.fontSize}px monospace`;
|
|
447
|
-
const
|
|
448
|
-
let I =
|
|
449
|
-
for (let
|
|
450
|
-
if (
|
|
451
|
-
I =
|
|
448
|
+
const pe = ce(n + u * 500, u, M, h, y), Me = e.measureText(pe).width + 24, de = Math.max(Me / t * u, u / 1e3);
|
|
449
|
+
let I = L[L.length - 1], v = L.length - 1;
|
|
450
|
+
for (let i = 0; i < L.length; i++)
|
|
451
|
+
if (L[i] > de) {
|
|
452
|
+
I = L[i], v = i;
|
|
452
453
|
break;
|
|
453
454
|
}
|
|
454
455
|
if (c != null && c > 0)
|
|
455
|
-
for (; v <
|
|
456
|
-
v++, I =
|
|
457
|
-
let
|
|
458
|
-
for (let
|
|
459
|
-
if (I %
|
|
460
|
-
t * (
|
|
456
|
+
for (; v < L.length - 1 && u / I > c; )
|
|
457
|
+
v++, I = L[v];
|
|
458
|
+
let R = 0;
|
|
459
|
+
for (let i = v - 1; i >= 0; i--)
|
|
460
|
+
if (I % L[i] < 1e-4) {
|
|
461
|
+
t * (L[i] / u) >= 3 && (R = L[i]);
|
|
461
462
|
break;
|
|
462
463
|
}
|
|
463
464
|
let z = 0;
|
|
464
|
-
if (
|
|
465
|
-
for (let
|
|
466
|
-
if (
|
|
467
|
-
z =
|
|
465
|
+
if (R > 0) {
|
|
466
|
+
for (let i = 0; i < L.length && L[i] < R; i++)
|
|
467
|
+
if (R % L[i] < 1e-4 && t * (L[i] / u) >= 3) {
|
|
468
|
+
z = L[i];
|
|
468
469
|
break;
|
|
469
470
|
}
|
|
470
471
|
}
|
|
471
|
-
const
|
|
472
|
+
const ne = Ae(n, u, M), j = (n - ne) / 1e3, Z = j + u, K = (i) => t * ((i - j) / u);
|
|
472
473
|
if (z > 0) {
|
|
473
474
|
e.strokeStyle = r.tickColor, e.lineWidth = 1;
|
|
474
|
-
for (let
|
|
475
|
-
const
|
|
476
|
-
e.beginPath(), e.moveTo(
|
|
475
|
+
for (let i = Math.floor(j / z) * z; i <= Z; i = ee(i, z)) {
|
|
476
|
+
const b = K(i);
|
|
477
|
+
e.beginPath(), e.moveTo(b, o - r.minorTickHeight), e.lineTo(b, o), e.stroke();
|
|
477
478
|
}
|
|
478
479
|
}
|
|
479
|
-
if (
|
|
480
|
+
if (R > 0) {
|
|
480
481
|
e.strokeStyle = r.tickColor, e.lineWidth = 1;
|
|
481
|
-
for (let
|
|
482
|
-
const
|
|
483
|
-
e.beginPath(), e.moveTo(
|
|
482
|
+
for (let i = Math.floor(j / R) * R; i <= Z; i = ee(i, R)) {
|
|
483
|
+
const b = K(i);
|
|
484
|
+
e.beginPath(), e.moveTo(b, o - r.minorTickHeight), e.lineTo(b, o), e.stroke();
|
|
484
485
|
}
|
|
485
486
|
}
|
|
486
487
|
e.textAlign = "center", e.textBaseline = "bottom";
|
|
487
|
-
let
|
|
488
|
-
for (let
|
|
489
|
-
const
|
|
490
|
-
e.strokeStyle = r.majorTickColor, e.lineWidth = 1, e.beginPath(), e.moveTo(
|
|
491
|
-
const
|
|
492
|
-
g >
|
|
488
|
+
let re = -1 / 0;
|
|
489
|
+
for (let i = Math.floor(j / I) * I; i <= Z + I; i = ee(i, I)) {
|
|
490
|
+
const b = K(i), D = ne + i * 1e3;
|
|
491
|
+
e.strokeStyle = r.majorTickColor, e.lineWidth = 1, e.beginPath(), e.moveTo(b, o - r.majorTickHeight), e.lineTo(b, o), e.stroke();
|
|
492
|
+
const T = ce(D, u, M, h, y), C = e.measureText(T).width, g = b - C / 2;
|
|
493
|
+
g > re && (e.fillStyle = r.labelColor, e.fillText(T, b, o - r.majorTickHeight - 4), re = g + C + 5);
|
|
494
|
+
}
|
|
495
|
+
if (S) {
|
|
496
|
+
const i = (S.startMs - n) / (l - n) * t, b = (S.endMs - n) / (l - n) * t, D = Math.min(i, b), T = Math.abs(b - i);
|
|
497
|
+
e.globalAlpha = 0.2, e.fillStyle = r.indicatorColor, e.fillRect(D, 0, T, o), e.globalAlpha = 1;
|
|
493
498
|
}
|
|
494
|
-
const
|
|
495
|
-
return e.strokeStyle = r.indicatorColor, e.lineWidth = r.indicatorLineWidth, e.beginPath(), e.moveTo(
|
|
499
|
+
const ie = (a - n) / (l - n) * t;
|
|
500
|
+
return e.strokeStyle = r.indicatorColor, e.lineWidth = r.indicatorLineWidth, e.beginPath(), e.moveTo(ie, 0), e.lineTo(ie, o), e.stroke(), f;
|
|
496
501
|
}
|
|
497
502
|
export {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
503
|
+
Ye as DEFAULT_LABELS,
|
|
504
|
+
P as DEFAULT_LANE_HEIGHT,
|
|
505
|
+
fe as DateTimeFormats,
|
|
506
|
+
ke as LABEL_PAD_LEFT,
|
|
507
|
+
W as LANE_GAP,
|
|
508
|
+
Le as MAX_SPAN_MS,
|
|
509
|
+
De as MIN_SPAN_MS,
|
|
510
|
+
He as MONTHS,
|
|
511
|
+
x as SCROLLBAR_WIDTH,
|
|
512
|
+
We as SWIM_LANE_SCROLL_SPEED,
|
|
513
|
+
X as TICK_AREA_HEIGHT,
|
|
514
|
+
L as TIC_SCALES,
|
|
515
|
+
me as TickInterval,
|
|
516
|
+
Ie as Timezones,
|
|
517
|
+
Ae as calcEpochMs,
|
|
518
|
+
he as clampSpan,
|
|
519
|
+
J as defaultSwimLaneStyle,
|
|
520
|
+
we as defaultTheme,
|
|
521
|
+
Xe as drawTimeline,
|
|
522
|
+
ye as formatDateTime,
|
|
518
523
|
Pe as formatTime,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
524
|
+
$e as fromMilliseconds,
|
|
525
|
+
Ne as generateTicks,
|
|
526
|
+
oe as getDateParts,
|
|
527
|
+
ge as getDurationMs,
|
|
528
|
+
Re as getTimezoneAbbr,
|
|
529
|
+
ze as hitTestLaneLabel,
|
|
530
|
+
ve as hitTestSwimLane,
|
|
531
|
+
je as isInSwimLaneRegion,
|
|
532
|
+
ce as makeLabel,
|
|
533
|
+
ee as nextTic,
|
|
534
|
+
Fe as positionToTime,
|
|
535
|
+
ue as resolveItemStyle,
|
|
531
536
|
Ce as resolveLabel,
|
|
532
|
-
|
|
537
|
+
_e as snapToTick,
|
|
533
538
|
Je as splitForDisplay,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
539
|
+
be as timeToPosition,
|
|
540
|
+
te as toDate,
|
|
541
|
+
Ee as toJulianDate,
|
|
537
542
|
F as toMilliseconds,
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
543
|
+
Be as totalSwimLaneHeight,
|
|
544
|
+
E as twoD,
|
|
545
|
+
Ue as zoomAroundMs,
|
|
546
|
+
Oe as zoomRange
|
|
542
547
|
};
|
|
@@ -1 +1 @@
|
|
|
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"})}));
|
|
1
|
+
(function(l,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("cesium")):typeof define=="function"&&define.amd?define(["exports","cesium"],j):(l=typeof globalThis<"u"?globalThis:l||self,j(l.CesiumTimelineCore={},l.Cesium))})(this,(function(l,j){"use strict";function Ae(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const k=Ae(j);function He(e,t){return typeof e=="function"?e(t):e}const ke={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"]},Ce={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 I={color:"#4da6ff",borderColor:"#2980b9",borderWidth:1,opacity:.8,markerShape:"diamond",markerSize:10,labelColor:"#cccccc",backgroundColor:"transparent"},P=24;function Ee(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 N(e){return Z(e).getTime()}function _e(e){return k.JulianDate.fromDate(new Date(e))}function me(e,t){return N(t)-N(e)}const we=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ye=["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"},Ie={LOCAL:"local",UTC:"UTC"};function V(e,t){if(!t||t==="local"){const d=e.getFullYear(),M=e.getMonth(),D=e.getDate(),b=e.getHours(),u=b%12||12,h=e.getMinutes(),Y=e.getSeconds(),U=e.getMilliseconds();return{yr:d,mo:M,day:D,hr24:b,hr12:u,min:h,sec:Y,ms:U,ampm:b<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}),i={};for(const d of o.formatToParts(e))d.type!=="literal"&&(i[d.type]=d.value);const n=parseInt(i.year),s=parseInt(i.month)-1,c=parseInt(i.day);let r=parseInt(i.hour);r===24&&(r=0);const m=r%12||12,f=parseInt(i.minute),g=parseInt(i.second),T=e.getMilliseconds();return{yr:n,mo:s,day:c,hr24:r,hr12:m,min:f,sec:g,ms:T,ampm:r<12?"AM":"PM"}}function Pe(e,t){var n;if(!t||t==="local")return null;const o=Z(e);return((n=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(o).find(s=>s.type==="timeZoneName"))==null?void 0:n.value)??null}function fe(e,t=ee.DEFAULT,o){const i=Z(e),{yr:n,mo:s,day:c,hr24:r,hr12:m,min:f,sec:g,ms:T,ampm:d}=V(i,o),M=u=>String(u).padStart(2,"0"),D=u=>String(u).padStart(3,"0"),b={YYYY:String(n),YY:String(n).slice(-2),MMMM:Ye[s],MMM:we[s],MM:M(s+1),M:String(s+1),DD:M(c),D:String(c),HH:M(r),H:String(r),hh:M(m),h:String(m),mm:M(f),ss:M(g),SSS:D(T),A:d,a:d.toLowerCase()};return t.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,u=>b[u]??u)}function Ne(e=ee.DEFAULT){const t=["YYYY","YY","MMMM","MMM","MM","M","DD","D"],o=["HH","H","hh","h","mm","ss","SSS","A","a"],i=c=>c.replace(/\s{2,}/g," ").trim().replace(/^[\s\W]+|[\s\W]+$/g,"").trim();let n=e;for(const c of t)n=n.replace(c,"");let s=e;for(const c of o)s=s.replace(c,"");return{timeFormat:i(n),dateFormat:i(s)}}function Re(e,t=!1){return fe(e,t?"HH:mm:ss":"HH:mm")}function ue(e,t,o,i){const n=N(e),s=N(t),c=N(o);if(c===s)return 0;const r=(n-s)/(c-s);return Math.max(0,Math.min(1,r))*i}function Fe(e,t,o,i){const n=Math.max(0,Math.min(1,e/i)),s=N(t),c=N(o),r=s+n*(c-s);return k.JulianDate.fromDate(new Date(r))}function $e(e,t,o,i){const n=[],s=me(e,t),c=N(e);let r;typeof o=="number"&&o in x||typeof o=="number"?r=o*60*1e3:r=3600*1e3;const m=r*4;let f=c,g=0;for(;f<=c+s;){const T=g*r%m===0,d=ue(new Date(f),e,t,i);let M;if(T){const D=new Date(f),b=D.getHours().toString().padStart(2,"0"),u=D.getMinutes().toString().padStart(2,"0");M=`${b}:${u}`}n.push({position:d,isMajor:T,label:M}),f+=r,g++}return n}function Oe(e,t,o=10){let i=t[0],n=Math.abs(i.position-e);for(const s of t){const c=Math.abs(s.position-e);c<n&&(n=c,i=s)}return n<=o?i.position:e}const he=1e3,Me=31536e9,y=[.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,F=1,Te=6,q=6,Je=.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,i,n){const s=new Date(e),{yr:c,mo:r,day:m,hr24:f,hr12:g,min:T,sec:d,ms:M,ampm:D}=V(s,o),b=i?g:f,u=i?` ${D}`:"",h=n??de;if(t>31536e4)return`${c}`;if(t>31536e3)return`${h[r]} ${c}`;if(t>604800)return`${h[r]} ${m}`;if(t>86400)return`${h[r]} ${m} ${_(b)}:${_(T)}${u}`;if(t>3600)return`${_(b)}:${_(T)}${u}`;if(t>60)return`${_(b)}:${_(T)}:${_(d)}${u}`;const Y=M>0?`.${String(M).padStart(3,"0")}`:"";return`${_(b)}:${_(T)}:${_(d)}${Y}${u}`}function ge(e,t,o){const i=new Date(e);if(!o||o==="local"){const m=i.getFullYear(),f=i.getMonth(),g=i.getDate();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,f,g).getTime()}const{yr:n,hr24:s,min:c,sec:r}=V(i,o);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-(s*3600+c*60+r)*1e3}function Q(e,t){return Math.ceil(e/t+.5)*t}function oe(e,t,o){var i,n,s,c,r,m,f,g,T,d,M,D;return{color:((i=t.style)==null?void 0:i.color)??((n=e.style)==null?void 0:n.color)??I.color,borderColor:((s=t.style)==null?void 0:s.borderColor)??((c=e.style)==null?void 0:c.borderColor)??(o==null?void 0:o.swimLaneItemBorderColor)??I.borderColor,borderWidth:((r=t.style)==null?void 0:r.borderWidth)??((m=e.style)==null?void 0:m.borderWidth)??(o==null?void 0:o.swimLaneItemBorderWidth)??I.borderWidth,opacity:((f=t.style)==null?void 0:f.opacity)??((g=e.style)==null?void 0:g.opacity)??I.opacity,markerShape:((T=t.style)==null?void 0:T.markerShape)??((d=e.style)==null?void 0:d.markerShape)??I.markerShape,markerSize:((M=t.style)==null?void 0:M.markerSize)??((D=e.style)==null?void 0:D.markerSize)??I.markerSize}}function ne(e){return Math.max(he,Math.min(Me,e))}function We(e,t,o){const i=t-e,n=(e+t)/2,s=ne(i*o);return{startMs:n-s/2,endMs:n+s/2}}function Ue(e,t,o,i){const n=t-e,s=ne(n*o),c=n>0?(i-e)/n:.5;return{startMs:i-c*s,endMs:i+(1-c)*s}}function ve(e){let t=0;for(const o of e)t+=(o.height??P)+F;return t}function Be(e,t,o,i,n){const{swimLanes:s,showSwimLanes:c,scrollTop:r,startMs:m,endMs:f,theme:g}=n;if(!c||s.length===0)return null;const T=Math.max(0,i-z);if(t<0||t>=T)return null;let d=-r;for(const M of s){const D=M.height??P,b=d,u=d+D;if(d+=D+F,!(t<b||t>=u)){for(const h of M.items){if(h.interval){const Y=k.JulianDate.toDate(h.interval.start).getTime(),U=k.JulianDate.toDate(h.interval.stop).getTime(),H=(Y-m)/(f-m)*o,v=(U-m)/(f-m)*o;if(e>=Math.max(0,H)&&e<=Math.min(o,v))return{lane:M,item:h}}if(h.instant){const U=(k.JulianDate.toDate(h.instant).getTime()-m)/(f-m)*o,H=oe(M,h,g);if(Math.abs(e-U)<=H.markerSize/2+2)return{lane:M,item:h}}}return null}}return null}function je(e,t,o,i){const{swimLanes:n,showSwimLanes:s,scrollTop:c}=i;if(!s||n.length===0||e>80)return null;const r=Math.max(0,o-z);if(t<0||t>=r)return null;let m=-c;for(const f of n){const g=f.height??P;if(t>=m&&t<m+g)return f;m+=g+F}return null}function ze(e,t,o){if(!o.showSwimLanes||o.swimLanes.length===0)return!1;const i=Math.max(0,t-z);return e>=0&&e<i}function Ge(e,t,o,i){const{startMs:n,endMs:s,currentMs:c,theme:r,maxTicks:m,swimLanes:f,showSwimLanes:g,reorderState:T,timezone:d,use12h:M,months:D,rangeSelection:b}=i;let{scrollTop:u}=i;const h=(s-n)/1e3;if(h<=0)return u;e.fillStyle=r.backgroundColor,e.fillRect(0,0,t,o);const Y=g&&f.length>0,H=Y?Math.max(0,o-z):0;let v=0;if(Y)for(const a of f)v+=(a.height??P)+F;const ie=Math.max(0,v-H);if(u>ie&&(u=ie),u<0&&(u=0),Y&&H>0){e.save(),e.beginPath(),e.rect(0,0,t,H),e.clip();let a=-u;const L=A=>(A-n)/(s-n)*t;for(const A of f){const p=A.height??P,E=a+p;if(E>0&&a<H){const S=A.style,B=(S==null?void 0:S.backgroundColor)??I.backgroundColor;B&&B!=="transparent"&&(e.fillStyle=B,e.fillRect(0,a,t,p)),e.strokeStyle=r.tickColor+"44",e.lineWidth=.5,e.beginPath(),e.moveTo(0,E),e.lineTo(t,E),e.stroke();for(const R of A.items){const C=oe(A,R,r);if(R.interval){const le=k.JulianDate.toDate(R.interval.start).getTime(),w=k.JulianDate.toDate(R.interval.stop).getTime(),J=L(le),W=L(w),se=Math.max(0,J),ce=Math.min(t,W)-se;if(ce>0){e.globalAlpha=C.opacity,e.fillStyle=C.color;const ye=3,De=a+ye,Le=p-ye*2;e.fillRect(se,De,ce,Le),C.borderWidth>0&&(e.strokeStyle=C.borderColor,e.lineWidth=C.borderWidth,e.strokeRect(se,De,ce,Le)),e.globalAlpha=1}}if(R.instant){const le=k.JulianDate.toDate(R.instant).getTime(),w=L(le);if(w>=-C.markerSize&&w<=t+C.markerSize){const J=a+p/2,W=C.markerSize;e.globalAlpha=C.opacity,e.fillStyle=C.color,C.markerShape==="diamond"?(e.beginPath(),e.moveTo(w,J-W/2),e.lineTo(w+W/2,J),e.lineTo(w,J+W/2),e.lineTo(w-W/2,J),e.closePath(),e.fill()):C.markerShape==="circle"?(e.beginPath(),e.arc(w,J,W/2,0,Math.PI*2),e.fill()):(e.strokeStyle=C.color,e.lineWidth=2,e.beginPath(),e.moveTo(w,a+2),e.lineTo(w,a+p-2),e.stroke()),e.globalAlpha=1}}}e.font=`${Math.min(11,p-4)}px system-ui, sans-serif`,e.textAlign="left",e.textBaseline="middle",e.fillStyle=(S==null?void 0:S.labelColor)??I.labelColor,e.fillText(A.label,Te,a+p/2)}if(a+=p+F,a>=H)break}if(T&&T.dragging){const A=T.currentY-T.dragStartY;let p=-u;for(let S=0;S<f.length&&S<T.insertIndex;S++)p+=(f[S].height??P)+F;e.strokeStyle=r.indicatorColor,e.lineWidth=2,e.beginPath(),e.moveTo(0,p),e.lineTo(t,p),e.stroke();const E=f.find(S=>S.id===T.dragLaneId);if(E){const S=E.height??P;let B=-u;for(const R of f){if(R.id===T.dragLaneId)break;B+=(R.height??P)+F}e.globalAlpha=.4,e.fillStyle=r.indicatorColor,e.fillRect(0,B+A,t,S),e.globalAlpha=1}}if(v>H){const A=t-q-2,p=H/v,E=Math.max(20,H*p),S=u/ie*(H-E);e.fillStyle=r.tickColor+"22",e.fillRect(A,0,q,H),e.fillStyle=r.tickColor+"88",e.fillRect(A,S,q,E)}e.restore()}e.font=`${r.fontSize}px monospace`;const Xe=te(n+h*500,h,d,M,D),Ke=e.measureText(Xe).width+24,Ze=Math.max(Ke/t*h,h/1e3);let $=y[y.length-1],G=y.length-1;for(let a=0;a<y.length;a++)if(y[a]>Ze){$=y[a],G=a;break}if(m!=null&&m>0)for(;G<y.length-1&&h/$>m;)G++,$=y[G];let O=0;for(let a=G-1;a>=0;a--)if($%y[a]<1e-4){t*(y[a]/h)>=3&&(O=y[a]);break}let X=0;if(O>0){for(let a=0;a<y.length&&y[a]<O;a++)if(O%y[a]<1e-4&&t*(y[a]/h)>=3){X=y[a];break}}const Se=ge(n,h,d),K=(n-Se)/1e3,re=K+h,ae=a=>t*((a-K)/h);if(X>0){e.strokeStyle=r.tickColor,e.lineWidth=1;for(let a=Math.floor(K/X)*X;a<=re;a=Q(a,X)){const L=ae(a);e.beginPath(),e.moveTo(L,o-r.minorTickHeight),e.lineTo(L,o),e.stroke()}}if(O>0){e.strokeStyle=r.tickColor,e.lineWidth=1;for(let a=Math.floor(K/O)*O;a<=re;a=Q(a,O)){const L=ae(a);e.beginPath(),e.moveTo(L,o-r.minorTickHeight),e.lineTo(L,o),e.stroke()}}e.textAlign="center",e.textBaseline="bottom";let pe=-1/0;for(let a=Math.floor(K/$)*$;a<=re+$;a=Q(a,$)){const L=ae(a),A=Se+a*1e3;e.strokeStyle=r.majorTickColor,e.lineWidth=1,e.beginPath(),e.moveTo(L,o-r.majorTickHeight),e.lineTo(L,o),e.stroke();const p=te(A,h,d,M,D),E=e.measureText(p).width,S=L-E/2;S>pe&&(e.fillStyle=r.labelColor,e.fillText(p,L,o-r.majorTickHeight-4),pe=S+E+5)}if(b){const a=(b.startMs-n)/(s-n)*t,L=(b.endMs-n)/(s-n)*t,A=Math.min(a,L),p=Math.abs(L-a);e.globalAlpha=.2,e.fillStyle=r.indicatorColor,e.fillRect(A,0,p,o),e.globalAlpha=1}const be=(c-n)/(s-n)*t;return e.strokeStyle=r.indicatorColor,e.lineWidth=r.indicatorLineWidth,e.beginPath(),e.moveTo(be,0),e.lineTo(be,o),e.stroke(),u}l.DEFAULT_LABELS=ke,l.DEFAULT_LANE_HEIGHT=P,l.DateTimeFormats=ee,l.LABEL_PAD_LEFT=Te,l.LANE_GAP=F,l.MAX_SPAN_MS=Me,l.MIN_SPAN_MS=he,l.MONTHS=de,l.SCROLLBAR_WIDTH=q,l.SWIM_LANE_SCROLL_SPEED=Je,l.TICK_AREA_HEIGHT=z,l.TIC_SCALES=y,l.TickInterval=x,l.Timezones=Ie,l.calcEpochMs=ge,l.clampSpan=ne,l.defaultSwimLaneStyle=I,l.defaultTheme=Ce,l.drawTimeline=Ge,l.formatDateTime=fe,l.formatTime=Re,l.fromMilliseconds=_e,l.generateTicks=$e,l.getDateParts=V,l.getDurationMs=me,l.getTimezoneAbbr=Pe,l.hitTestLaneLabel=je,l.hitTestSwimLane=Be,l.isInSwimLaneRegion=ze,l.makeLabel=te,l.nextTic=Q,l.positionToTime=Fe,l.resolveItemStyle=oe,l.resolveLabel=He,l.snapToTick=Oe,l.splitForDisplay=Ne,l.timeToPosition=ue,l.toDate=Z,l.toJulianDate=Ee,l.toMilliseconds=N,l.totalSwimLaneHeight=ve,l.twoD=_,l.zoomAroundMs=Ue,l.zoomRange=We,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -539,6 +539,14 @@ export declare interface TimelineRenderState {
|
|
|
539
539
|
use12h?: boolean;
|
|
540
540
|
/** Abbreviated month names for tick labels. Falls back to English when omitted. */
|
|
541
541
|
months?: string[];
|
|
542
|
+
/**
|
|
543
|
+
* Active range selection (set while the user is dragging to select a range).
|
|
544
|
+
* When non-null, a highlight is rendered over the selected time span in the tick area.
|
|
545
|
+
*/
|
|
546
|
+
rangeSelection?: {
|
|
547
|
+
startMs: number;
|
|
548
|
+
endMs: number;
|
|
549
|
+
} | null;
|
|
542
550
|
}
|
|
543
551
|
|
|
544
552
|
export declare interface TimelineTheme {
|