@kteneyck/cesium-timeline-core 0.9.0 → 0.11.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 +79 -41
- package/dist/cesium-timeline-core.js +284 -280
- package/dist/cesium-timeline-core.umd.cjs +1 -1
- package/dist/index.d.ts +42 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ A canvas-based timeline component for **React** and **Angular** with Cesium Cloc
|
|
|
17
17
|
### React
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install @kteneyck/cesium-timeline-react
|
|
20
|
+
npm install @kteneyck/cesium-timeline-react
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Peer dependencies: `react` ≥ 19, `cesium` ≥ 1.100
|
|
@@ -25,7 +25,7 @@ Peer dependencies: `react` ≥ 19, `cesium` ≥ 1.100
|
|
|
25
25
|
### Angular
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm install @kteneyck/cesium-timeline-angular
|
|
28
|
+
npm install @kteneyck/cesium-timeline-angular
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Peer dependencies: `@angular/core` ≥ 17, `cesium` ≥ 1.100
|
|
@@ -127,12 +127,13 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
127
127
|
- **Netflix/Hulu-style controls** — transport buttons (⏮ ◀◀ ▶/⏸ ▶▶ ⏭) always stay centered; speed badge and LIVE button in the left column never cause layout shift.
|
|
128
128
|
- **Conditional start/end buttons** — ⏮ and ⏭ are only rendered when `startTime` and `endTime` props are explicitly provided.
|
|
129
129
|
- **Speed cycling** — FF cycles through `ffSpeeds` (default `2×→4×→8×→16×→32×→1×`); RW cycles through `rwSpeeds` (default `−1×→−2×→−4×→−8×→−16×→−32×`). Both arrays are fully configurable.
|
|
130
|
-
- **LIVE button** — filled
|
|
130
|
+
- **LIVE button** — shows a red dot + filled background when within 10 s of wall clock; dim outline otherwise. Clicking jumps to `Date.now()` and resets speed to 1×. Configurable size (`sm`/`md`/`lg`) and position (`left`/`right`). Dot color is themeable via `liveDotColor`.
|
|
131
131
|
- **Speed badge** — shown in the left column when multiplier ≠ 1×; click to reset to 1×.
|
|
132
132
|
- **Two-line datetime display** — time displayed large/bold; date displayed smaller in the theme's active color.
|
|
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
|
+
- **Ghost / preview needle** — while hovering over the timeline a semi-transparent (15% opacity) preview needle tracks the cursor so you can see exactly where a click or zoom-to-selection drag would land before committing. The ghost disappears when the cursor leaves the canvas or an interaction begins.
|
|
136
137
|
- **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.
|
|
137
138
|
- **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.
|
|
138
139
|
- **Fully themeable** — 16 theme properties cover every color, size, and font setting, including swim lane item border defaults.
|
|
@@ -145,38 +146,41 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
145
146
|
|
|
146
147
|
### `TimelineProps`
|
|
147
148
|
|
|
148
|
-
| Prop | Type | Default | Description
|
|
149
|
-
|
|
150
|
-
| `clock` | `Cesium.Clock` | — | Cesium clock to sync with. Falls back to `setInterval` if omitted.
|
|
151
|
-
| `startTime` | `JulianDate \| Date` | now − 12 h | Left bound of initial visible window. Also shows the ⏮ button when provided.
|
|
152
|
-
| `endTime` | `JulianDate \| Date` | now + 12 h | Right bound of initial visible window. Also shows the ⏭ button when provided.
|
|
153
|
-
| `currentTime` | `JulianDate \| Date` | `startTime` | Initial needle position
|
|
154
|
-
| `height` | `number` | `120` | Canvas height in pixels
|
|
155
|
-
| `showControls` | `boolean` | `true` | Show/hide the control bar
|
|
156
|
-
| `enableDrag` | `boolean` | `true` | Show/hide the canvas (drag/seek area)
|
|
157
|
-
| `showLabels` | `boolean` | — | Show/hide tick labels on the canvas
|
|
158
|
-
| `snapToTicks` | `boolean` | — | Snap needle to nearest tick on drag
|
|
159
|
-
| `tickInterval` | `TickInterval \| number` | auto | Override automatic tick interval
|
|
160
|
-
| `maxTicks` | `number` | unlimited | Maximum number of major ticks on the canvas at once. When exceeded the tick scale is automatically coarsened.
|
|
161
|
-
| `ffSpeeds` | `number[]` | `[2,4,8,16,32,1]` | Speed steps cycled by the ▶▶ button. Last entry wraps back to first.
|
|
162
|
-
| `rwSpeeds` | `number[]` | `[1,2,4,8,16,32]` | Absolute-value speed steps cycled by the ◀◀ button (negated internally).
|
|
163
|
-
| `dateTimeFormat` | `string` | `'MMM DD YYYY HH:mm:ss'` | Token-based format string for the controls datetime display
|
|
149
|
+
| Prop | Type | Default | Description |
|
|
150
|
+
|------|------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
151
|
+
| `clock` | `Cesium.Clock` | — | Cesium clock to sync with. Falls back to `setInterval` if omitted. |
|
|
152
|
+
| `startTime` | `JulianDate \| Date` | now − 12 h | Left bound of initial visible window. Also shows the ⏮ button when provided. |
|
|
153
|
+
| `endTime` | `JulianDate \| Date` | now + 12 h | Right bound of initial visible window. Also shows the ⏭ button when provided. |
|
|
154
|
+
| `currentTime` | `JulianDate \| Date` | `startTime` | Initial needle position |
|
|
155
|
+
| `height` | `number` | `120` | Canvas height in pixels |
|
|
156
|
+
| `showControls` | `boolean` | `true` | Show/hide the control bar |
|
|
157
|
+
| `enableDrag` | `boolean` | `true` | Show/hide the canvas (drag/seek area) |
|
|
158
|
+
| `showLabels` | `boolean` | — | Show/hide tick labels on the canvas |
|
|
159
|
+
| `snapToTicks` | `boolean` | — | Snap needle to nearest tick on drag |
|
|
160
|
+
| `tickInterval` | `TickInterval \| number` | auto | Override automatic tick interval |
|
|
161
|
+
| `maxTicks` | `number` | unlimited | Maximum number of major ticks on the canvas at once. When exceeded the tick scale is automatically coarsened. |
|
|
162
|
+
| `ffSpeeds` | `number[]` | `[2,4,8,16,32,1]` | Speed steps cycled by the ▶▶ button. Last entry wraps back to first. |
|
|
163
|
+
| `rwSpeeds` | `number[]` | `[1,2,4,8,16,32]` | Absolute-value speed steps cycled by the ◀◀ button (negated internally). |
|
|
164
|
+
| `dateTimeFormat` | `string` | `'MMM DD YYYY HH:mm:ss'` | Token-based format string for the controls datetime display |
|
|
164
165
|
| `timezone` | `string` | browser local | IANA timezone name (e.g. `'UTC'`, `'America/New_York'`) or `'local'` for the browser's timezone. Controls both tick labels and the datetime display. When set, a short abbreviation (e.g. `UTC`, `EST`) appears to the right of the date. |
|
|
165
|
-
| `onDateTimeClick` | `() => void` | — | Called when the user clicks the datetime display. Use to open your own date picker.
|
|
166
|
-
| `jumpToTime` | `JulianDate \| Date` | — | Set to programmatically jump the timeline to a moment (pans canvas + sets time).
|
|
167
|
-
| `theme` | `Partial<TimelineTheme>` | `defaultTheme` | Theme overrides (merged with defaults)
|
|
168
|
-
| `className` | `string` | — | CSS class applied to the root div
|
|
169
|
-
| `onTimeChange` | `(t: JulianDate) => void` | — | Fires when needle moves (drag, click, or clock tick)
|
|
170
|
-
| `onPlayPause` | `(playing: boolean) => void` | — | Fires on play/pause toggle
|
|
171
|
-
| `onMultiplierChange` | `(m: number) => void` | — | Fires when speed changes
|
|
172
|
-
| `swimLanes` | `SwimLane[]` | — | Array of swim lane definitions to render on the canvas
|
|
173
|
-
| `showSwimLanes` | `boolean` | `true` | Show or hide the swim lanes
|
|
174
|
-
| `onSwimLaneItemClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is clicked
|
|
175
|
-
| `onSwimLaneItemHover` | `(info: SwimLaneEventInfo \| null) => void` | — | Fires when mouse enters/leaves a swim lane item
|
|
176
|
-
| `onSwimLaneItemDoubleClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is double-clicked
|
|
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.
|
|
179
|
-
| `labels` | `Partial<TimelineLabels>` | English defaults | Override any control-bar label or tooltip string. See [Labels & i18n](#labels--i18n).
|
|
166
|
+
| `onDateTimeClick` | `() => void` | — | Called when the user clicks the datetime display. Use to open your own date picker. |
|
|
167
|
+
| `jumpToTime` | `JulianDate \| Date` | — | Set to programmatically jump the timeline to a moment (pans canvas + sets time). |
|
|
168
|
+
| `theme` | `Partial<TimelineTheme>` | `defaultTheme` | Theme overrides (merged with defaults) |
|
|
169
|
+
| `className` | `string` | — | CSS class applied to the root div |
|
|
170
|
+
| `onTimeChange` | `(t: JulianDate) => void` | — | Fires when needle moves (drag, click, or clock tick) |
|
|
171
|
+
| `onPlayPause` | `(playing: boolean) => void` | — | Fires on play/pause toggle |
|
|
172
|
+
| `onMultiplierChange` | `(m: number) => void` | — | Fires when speed changes |
|
|
173
|
+
| `swimLanes` | `SwimLane[]` | — | Array of swim lane definitions to render on the canvas |
|
|
174
|
+
| `showSwimLanes` | `boolean` | `true` | Show or hide the swim lanes |
|
|
175
|
+
| `onSwimLaneItemClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is clicked |
|
|
176
|
+
| `onSwimLaneItemHover` | `(info: SwimLaneEventInfo \| null) => void` | — | Fires when mouse enters/leaves a swim lane item |
|
|
177
|
+
| `onSwimLaneItemDoubleClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is double-clicked |
|
|
178
|
+
| `onSwimLaneReorder` | `(orderedIds: string[]) => void` | — | Fires when swim lanes are reordered via drag. Receives the new lane id order. |
|
|
179
|
+
| `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. |
|
|
180
|
+
| `labels` | `Partial<TimelineLabels>` | English defaults | Override any control-bar label or tooltip string. See [Labels & i18n](#labels--i18n). |
|
|
181
|
+
| `liveButtonSize` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of the LIVE button in the control bar. |
|
|
182
|
+
| `liveButtonPosition` | `'left' \| 'right'` | `'left'` | Position of the LIVE button — beside the datetime display (`'left'`) or the opposite side of the control bar (`'right'`). |
|
|
183
|
+
| `invertScrollZoom` | `boolean` | `false` | Reverses the scroll-wheel zoom direction. By default scroll up zooms in and scroll down zooms out. Set to `true` for scroll down zooms in, scroll up zooms out. |
|
|
180
184
|
|
|
181
185
|
---
|
|
182
186
|
|
|
@@ -215,6 +219,7 @@ Pass a partial `TimelineTheme` object to the `theme` prop. Any omitted propertie
|
|
|
215
219
|
| `buttonActiveColor` | `#d69826` | Active buttons, LIVE, speed badge, and date line colour |
|
|
216
220
|
| `swimLaneItemBorderColor` | `#666666` | Default border colour for swim lane interval bars. Can be overridden per-lane or per-item. |
|
|
217
221
|
| `swimLaneItemBorderWidth` | `0` | Default border width (px) for swim lane interval bars. Set to `0` to remove borders globally. Can be overridden per-lane or per-item. |
|
|
222
|
+
| `liveDotColor` | `#e53e3e` | Colour of the dot shown on the LIVE button when playback is live. |
|
|
218
223
|
|
|
219
224
|
> **Note:** Theme colours must be resolved hex/rgb values. CSS variables like `var(--primary-color)` do **not** work in canvas `ctx.fillStyle`. Use `getComputedStyle(document.documentElement).getPropertyValue('--primary-color').trim()` to resolve them first.
|
|
220
225
|
|
|
@@ -364,13 +369,16 @@ The control bar uses a 3-column CSS grid so the transport buttons are always cen
|
|
|
364
369
|
|
|
365
370
|
### LIVE Button
|
|
366
371
|
|
|
367
|
-
- Shows
|
|
368
|
-
- Shows `LIVE` (dim outline) otherwise.
|
|
369
|
-
- Clicking jumps to `Date.now()`, centers the visible window
|
|
372
|
+
- Shows a red dot and filled background when the current time is within 2 seconds of `Date.now()`.
|
|
373
|
+
- Shows `LIVE` (dim outline, no dot) otherwise.
|
|
374
|
+
- Clicking jumps to `Date.now()`, centers the visible window, and resets speed to 1×.
|
|
375
|
+
- **Size** — controlled by the `liveButtonSize` prop: `'sm'` | `'md'` (default) | `'lg'`.
|
|
376
|
+
- **Position** — controlled by the `liveButtonPosition` prop: `'left'` (default, beside the datetime display) | `'right'` (right side of the control bar).
|
|
377
|
+
- **Dot color** — controlled by `theme.liveDotColor` (default `#e53e3e`).
|
|
370
378
|
|
|
371
379
|
### Speed Badge
|
|
372
380
|
|
|
373
|
-
- Appears
|
|
381
|
+
- Appears inline beside the LIVE button when multiplier ≠ 1×.
|
|
374
382
|
- Shows `◀ N×` for reverse, `N× ▶` for fast-forward.
|
|
375
383
|
- Clicking resets to 1× speed.
|
|
376
384
|
|
|
@@ -426,7 +434,7 @@ Every label and tooltip in the control bar is overridable via the `labels` prop.
|
|
|
426
434
|
|-----|-------------------|-------|
|
|
427
435
|
| `dateTimeClickTooltip` | `"Click to jump to a date/time"` | Tooltip on the datetime display when `onDateTimeClick` is wired up |
|
|
428
436
|
| `liveLabel` | `"LIVE"` | LIVE button text when not at live time |
|
|
429
|
-
| `liveActiveLabel` | `"
|
|
437
|
+
| `liveActiveLabel` | `"LIVE"` | LIVE button text when at live time (red dot is rendered separately) |
|
|
430
438
|
| `liveTooltip` | `"Jump to live (now)"` | LIVE button tooltip when not at live time |
|
|
431
439
|
| `liveActiveTooltip` | `"Currently live"` | LIVE button tooltip when at live time |
|
|
432
440
|
| `resetSpeedTooltip` | `"Reset to 1× speed"` | Tooltip on the speed-reset badge |
|
|
@@ -456,7 +464,7 @@ const frLabels: Partial<TimelineLabels> = {
|
|
|
456
464
|
playTooltip: 'Lecture',
|
|
457
465
|
pauseTooltip: 'Pause',
|
|
458
466
|
liveLabel: 'EN DIRECT',
|
|
459
|
-
liveActiveLabel: '
|
|
467
|
+
liveActiveLabel: 'EN DIRECT',
|
|
460
468
|
liveTooltip: 'Aller en direct',
|
|
461
469
|
liveActiveTooltip: 'Vous êtes en direct',
|
|
462
470
|
rewindTooltip: 'Retour rapide',
|
|
@@ -482,7 +490,7 @@ export class AppComponent {
|
|
|
482
490
|
playTooltip: 'Lecture',
|
|
483
491
|
pauseTooltip: 'Pause',
|
|
484
492
|
liveLabel: 'EN DIRECT',
|
|
485
|
-
liveActiveLabel: '
|
|
493
|
+
liveActiveLabel: 'EN DIRECT',
|
|
486
494
|
liveTooltip: 'Aller en direct',
|
|
487
495
|
liveActiveTooltip: 'Vous êtes en direct',
|
|
488
496
|
rewindActiveTooltip: (n) => `Retour ${n}× — cliquer pour accélérer`,
|
|
@@ -759,6 +767,36 @@ onRangeSelect(range: { start: Cesium.JulianDate; end: Cesium.JulianDate }) {
|
|
|
759
767
|
|
|
760
768
|
---
|
|
761
769
|
|
|
770
|
+
## Ghost / Preview Needle
|
|
771
|
+
|
|
772
|
+
When the user hovers over the timeline canvas a **ghost needle** (a semi-transparent version of the current-time indicator) tracks the cursor position in real time. It renders at **15% opacity** using the same `indicatorColor` and `indicatorLineWidth` as the real needle, giving a clear preview of where a click-to-seek or zoom-to-selection drag would begin — without moving the actual current time.
|
|
773
|
+
|
|
774
|
+
### Behaviour summary
|
|
775
|
+
|
|
776
|
+
| State | Ghost visible? |
|
|
777
|
+
|---|---|
|
|
778
|
+
| Mouse idle over canvas | ✅ Follows cursor |
|
|
779
|
+
| Dragging (scrub / range-select / slide / zoom) | ❌ Hidden |
|
|
780
|
+
| Mouse leaves canvas | ❌ Hidden |
|
|
781
|
+
|
|
782
|
+
### Theming the ghost needle
|
|
783
|
+
|
|
784
|
+
The ghost needle inherits `indicatorColor` and `indicatorLineWidth` from your theme — no additional configuration is needed. To change its appearance, update those two theme properties:
|
|
785
|
+
|
|
786
|
+
```tsx
|
|
787
|
+
<Timeline
|
|
788
|
+
clock={viewer.clock}
|
|
789
|
+
theme={{
|
|
790
|
+
indicatorColor: '#ffd54f',
|
|
791
|
+
indicatorLineWidth: 3,
|
|
792
|
+
}}
|
|
793
|
+
/>
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
The ghost will render as the same colour at 15% opacity, and the real needle will render at full opacity.
|
|
797
|
+
|
|
798
|
+
---
|
|
799
|
+
|
|
762
800
|
## Swim Lanes
|
|
763
801
|
|
|
764
802
|
Swim lanes render time intervals (bars) and instants (markers) as horizontal rows directly on the timeline canvas, aligned with the ticks and needle. They are ideal for visualizing satellite passes, ground contacts, scheduled events, or any temporal data.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as A from "cesium";
|
|
2
|
-
function
|
|
2
|
+
function Ye(e, t) {
|
|
3
3
|
return typeof e == "function" ? e(t) : e;
|
|
4
4
|
}
|
|
5
|
-
const
|
|
5
|
+
const we = {
|
|
6
6
|
dateTimeClickTooltip: "Click to jump to a date/time",
|
|
7
7
|
liveLabel: "LIVE",
|
|
8
|
-
liveActiveLabel: "
|
|
8
|
+
liveActiveLabel: "LIVE",
|
|
9
9
|
liveTooltip: "Jump to live (now)",
|
|
10
10
|
liveActiveTooltip: "Currently live",
|
|
11
11
|
resetSpeedTooltip: "Reset to 1× speed",
|
|
@@ -36,7 +36,7 @@ const Ye = {
|
|
|
36
36
|
"Nov",
|
|
37
37
|
"Dec"
|
|
38
38
|
]
|
|
39
|
-
},
|
|
39
|
+
}, Ee = {
|
|
40
40
|
backgroundColor: "#1a1a1a",
|
|
41
41
|
tickColor: "#666666",
|
|
42
42
|
majorTickColor: "#999999",
|
|
@@ -52,9 +52,10 @@ const Ye = {
|
|
|
52
52
|
buttonHoverColor: "#888888",
|
|
53
53
|
buttonActiveColor: "#d69826",
|
|
54
54
|
swimLaneItemBorderColor: "#666666",
|
|
55
|
-
swimLaneItemBorderWidth: 0
|
|
55
|
+
swimLaneItemBorderWidth: 0,
|
|
56
|
+
liveDotColor: "#e53e3e"
|
|
56
57
|
};
|
|
57
|
-
var
|
|
58
|
+
var fe = /* @__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))(fe || {});
|
|
58
59
|
const J = {
|
|
59
60
|
color: "#4da6ff",
|
|
60
61
|
borderColor: "#2980b9",
|
|
@@ -64,23 +65,23 @@ const J = {
|
|
|
64
65
|
markerSize: 10,
|
|
65
66
|
labelColor: "#cccccc",
|
|
66
67
|
backgroundColor: "transparent"
|
|
67
|
-
},
|
|
68
|
-
function
|
|
68
|
+
}, F = 24;
|
|
69
|
+
function $e(e) {
|
|
69
70
|
return e instanceof A.JulianDate ? A.JulianDate.clone(e) : A.JulianDate.fromDate(e);
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
+
function oe(e) {
|
|
72
73
|
return e instanceof A.JulianDate ? A.JulianDate.toDate(e) : e;
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
75
|
+
function N(e) {
|
|
76
|
+
return oe(e).getTime();
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function Ie(e) {
|
|
78
79
|
return A.JulianDate.fromDate(new Date(e));
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
return
|
|
81
|
+
function Te(e, t) {
|
|
82
|
+
return N(t) - N(e);
|
|
82
83
|
}
|
|
83
|
-
const
|
|
84
|
+
const Se = ["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"], ue = {
|
|
84
85
|
/** e.g. "Feb 24 2026 14:04:07" — default */
|
|
85
86
|
DEFAULT: "MMM DD YYYY HH:mm:ss",
|
|
86
87
|
/** e.g. "Feb 24 2026 02:04:07 PM" */
|
|
@@ -95,16 +96,16 @@ const Te = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"
|
|
|
95
96
|
TIME_ONLY: "HH:mm:ss",
|
|
96
97
|
/** e.g. "02:04:07 PM" */
|
|
97
98
|
TIME_12: "hh:mm:ss A"
|
|
98
|
-
},
|
|
99
|
+
}, Pe = {
|
|
99
100
|
/** Use the browser's local timezone (default behavior). */
|
|
100
101
|
LOCAL: "local",
|
|
101
102
|
/** Coordinated Universal Time. */
|
|
102
103
|
UTC: "UTC"
|
|
103
104
|
};
|
|
104
|
-
function
|
|
105
|
+
function ne(e, t) {
|
|
105
106
|
if (!t || t === "local") {
|
|
106
|
-
const
|
|
107
|
-
return { yr:
|
|
107
|
+
const p = e.getFullYear(), u = e.getMonth(), L = e.getDate(), T = e.getHours(), M = T % 12 || 12, f = e.getMinutes(), d = e.getSeconds(), $ = e.getMilliseconds();
|
|
108
|
+
return { yr: p, mo: u, day: L, hr24: T, hr12: M, min: f, sec: d, ms: $, ampm: T < 12 ? "AM" : "PM" };
|
|
108
109
|
}
|
|
109
110
|
const o = new Intl.DateTimeFormat("en-US", {
|
|
110
111
|
timeZone: t,
|
|
@@ -116,104 +117,103 @@ function oe(e, t) {
|
|
|
116
117
|
second: "2-digit",
|
|
117
118
|
hour12: !1
|
|
118
119
|
}), s = {};
|
|
119
|
-
for (const
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
return { yr:
|
|
120
|
+
for (const p of o.formatToParts(e))
|
|
121
|
+
p.type !== "literal" && (s[p.type] = p.value);
|
|
122
|
+
const r = parseInt(s.year), l = parseInt(s.month) - 1, a = parseInt(s.day);
|
|
123
|
+
let i = parseInt(s.hour);
|
|
124
|
+
i === 24 && (i = 0);
|
|
125
|
+
const m = i % 12 || 12, c = parseInt(s.minute), S = parseInt(s.second), h = e.getMilliseconds();
|
|
126
|
+
return { yr: r, mo: l, day: a, hr24: i, hr12: m, min: c, sec: S, ms: h, ampm: i < 12 ? "AM" : "PM" };
|
|
126
127
|
}
|
|
127
128
|
function Re(e, t) {
|
|
128
|
-
var n;
|
|
129
129
|
if (!t || t === "local") return null;
|
|
130
|
-
const o =
|
|
131
|
-
return
|
|
130
|
+
const o = oe(e);
|
|
131
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
132
132
|
timeZone: t,
|
|
133
133
|
timeZoneName: "short"
|
|
134
|
-
}).formatToParts(o).find((
|
|
134
|
+
}).formatToParts(o).find((r) => r.type === "timeZoneName")?.value ?? null;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
const s =
|
|
138
|
-
YYYY: String(
|
|
139
|
-
YY: String(
|
|
140
|
-
MMMM:
|
|
141
|
-
MMM:
|
|
142
|
-
MM:
|
|
136
|
+
function be(e, t = ue.DEFAULT, o) {
|
|
137
|
+
const s = oe(e), { yr: r, mo: l, day: a, hr24: i, hr12: m, min: c, sec: S, ms: h, ampm: p } = ne(s, o), u = (M) => String(M).padStart(2, "0"), L = (M) => String(M).padStart(3, "0"), T = {
|
|
138
|
+
YYYY: String(r),
|
|
139
|
+
YY: String(r).slice(-2),
|
|
140
|
+
MMMM: ye[l],
|
|
141
|
+
MMM: Se[l],
|
|
142
|
+
MM: u(l + 1),
|
|
143
143
|
M: String(l + 1),
|
|
144
|
-
DD:
|
|
144
|
+
DD: u(a),
|
|
145
145
|
D: String(a),
|
|
146
|
-
HH:
|
|
147
|
-
H: String(
|
|
148
|
-
hh:
|
|
149
|
-
h: String(
|
|
150
|
-
mm:
|
|
151
|
-
ss:
|
|
152
|
-
SSS:
|
|
153
|
-
A:
|
|
154
|
-
a:
|
|
146
|
+
HH: u(i),
|
|
147
|
+
H: String(i),
|
|
148
|
+
hh: u(m),
|
|
149
|
+
h: String(m),
|
|
150
|
+
mm: u(c),
|
|
151
|
+
ss: u(S),
|
|
152
|
+
SSS: L(h),
|
|
153
|
+
A: p,
|
|
154
|
+
a: p.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
|
-
(
|
|
158
|
+
(M) => T[M] ?? M
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
function Je(e =
|
|
161
|
+
function Je(e = ue.DEFAULT) {
|
|
162
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
|
-
let
|
|
164
|
-
for (const a of t)
|
|
163
|
+
let r = e;
|
|
164
|
+
for (const a of t) r = r.replace(a, "");
|
|
165
165
|
let l = e;
|
|
166
166
|
for (const a of o) l = l.replace(a, "");
|
|
167
|
-
return { timeFormat: s(
|
|
167
|
+
return { timeFormat: s(r), dateFormat: s(l) };
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
return
|
|
169
|
+
function Fe(e, t = !1) {
|
|
170
|
+
return be(e, t ? "HH:mm:ss" : "HH:mm");
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
const
|
|
172
|
+
function De(e, t, o, s) {
|
|
173
|
+
const r = N(e), l = N(t), a = N(o);
|
|
174
174
|
if (a === l) return 0;
|
|
175
|
-
const
|
|
176
|
-
return Math.max(0, Math.min(1,
|
|
177
|
-
}
|
|
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));
|
|
175
|
+
const i = (r - l) / (a - l);
|
|
176
|
+
return Math.max(0, Math.min(1, i)) * s;
|
|
181
177
|
}
|
|
182
178
|
function Ne(e, t, o, s) {
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
179
|
+
const r = Math.max(0, Math.min(1, e / s)), l = N(t), a = N(o), i = l + r * (a - l);
|
|
180
|
+
return A.JulianDate.fromDate(new Date(i));
|
|
181
|
+
}
|
|
182
|
+
function _e(e, t, o, s) {
|
|
183
|
+
const r = [], l = Te(e, t), a = N(e);
|
|
184
|
+
let i;
|
|
185
|
+
typeof o == "number" && o in fe || typeof o == "number" ? i = o * 60 * 1e3 : i = 3600 * 1e3;
|
|
186
|
+
const m = i * 4;
|
|
187
|
+
let c = a, S = 0;
|
|
188
|
+
for (; c <= a + l; ) {
|
|
189
|
+
const h = S * i % m === 0, p = De(
|
|
190
|
+
new Date(c),
|
|
191
191
|
e,
|
|
192
192
|
t,
|
|
193
193
|
s
|
|
194
194
|
);
|
|
195
|
-
let
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
|
|
195
|
+
let u;
|
|
196
|
+
if (h) {
|
|
197
|
+
const L = new Date(c), T = L.getHours().toString().padStart(2, "0"), M = L.getMinutes().toString().padStart(2, "0");
|
|
198
|
+
u = `${T}:${M}`;
|
|
199
199
|
}
|
|
200
|
-
|
|
201
|
-
position:
|
|
202
|
-
isMajor:
|
|
203
|
-
label:
|
|
204
|
-
}),
|
|
200
|
+
r.push({
|
|
201
|
+
position: p,
|
|
202
|
+
isMajor: h,
|
|
203
|
+
label: u
|
|
204
|
+
}), c += i, S++;
|
|
205
205
|
}
|
|
206
|
-
return
|
|
206
|
+
return r;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
let s = t[0],
|
|
208
|
+
function We(e, t, o = 10) {
|
|
209
|
+
let s = t[0], r = Math.abs(s.position - e);
|
|
210
210
|
for (const l of t) {
|
|
211
211
|
const a = Math.abs(l.position - e);
|
|
212
|
-
a <
|
|
212
|
+
a < r && (r = a, s = l);
|
|
213
213
|
}
|
|
214
|
-
return
|
|
214
|
+
return r <= o ? s.position : e;
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const ke = 1e3, Le = 31536e9, k = [
|
|
217
217
|
1e-3,
|
|
218
218
|
2e-3,
|
|
219
219
|
5e-3,
|
|
@@ -262,56 +262,55 @@ const De = 1e3, Le = 31536e9, L = [
|
|
|
262
262
|
126144e5,
|
|
263
263
|
15768e6,
|
|
264
264
|
31536e6
|
|
265
|
-
],
|
|
265
|
+
], G = 36, O = 1, He = 6, ee = 6, Oe = 0.3, Ae = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
266
266
|
function E(e) {
|
|
267
267
|
return e < 10 ? `0${e}` : `${e}`;
|
|
268
268
|
}
|
|
269
|
-
function ce(e, t, o, s,
|
|
270
|
-
const l = new Date(e), { yr: a, mo:
|
|
269
|
+
function ce(e, t, o, s, r) {
|
|
270
|
+
const l = new Date(e), { yr: a, mo: i, day: m, hr24: c, hr12: S, min: h, sec: p, ms: u, ampm: L } = ne(l, o), T = s ? S : c, M = s ? ` ${L}` : "", f = r ?? Ae;
|
|
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 `${E(
|
|
276
|
-
if (t > 60) return `${E(
|
|
277
|
-
const
|
|
278
|
-
return `${E(
|
|
272
|
+
if (t > 31536e3) return `${f[i]} ${a}`;
|
|
273
|
+
if (t > 604800) return `${f[i]} ${m}`;
|
|
274
|
+
if (t > 86400) return `${f[i]} ${m} ${E(T)}:${E(h)}${M}`;
|
|
275
|
+
if (t > 3600) return `${E(T)}:${E(h)}${M}`;
|
|
276
|
+
if (t > 60) return `${E(T)}:${E(h)}:${E(p)}${M}`;
|
|
277
|
+
const d = u > 0 ? `.${String(u).padStart(3, "0")}` : "";
|
|
278
|
+
return `${E(T)}:${E(h)}:${E(p)}${d}${M}`;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function Ce(e, t, o) {
|
|
281
281
|
const s = new Date(e);
|
|
282
282
|
if (!o || o === "local") {
|
|
283
|
-
const
|
|
284
|
-
return t > 31536e4 ? new Date(Math.floor(
|
|
283
|
+
const m = s.getFullYear(), c = s.getMonth(), S = s.getDate();
|
|
284
|
+
return t > 31536e4 ? new Date(Math.floor(m / 100) * 100, 0).getTime() : t > 31536e3 ? new Date(Math.floor(m / 10) * 10, 0).getTime() : t > 86400 ? new Date(m, 0).getTime() : new Date(m, c, S).getTime();
|
|
285
285
|
}
|
|
286
|
-
const { yr:
|
|
287
|
-
return t > 31536e4 ? Date.UTC(Math.floor(
|
|
286
|
+
const { yr: r, hr24: l, min: a, sec: i } = ne(s, o);
|
|
287
|
+
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 - (l * 3600 + a * 60 + i) * 1e3;
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function te(e, t) {
|
|
290
290
|
return Math.ceil(e / t + 0.5) * t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
var s, n, l, a, r, c, m, d, p, M, h, y;
|
|
292
|
+
function he(e, t, o) {
|
|
294
293
|
return {
|
|
295
|
-
color:
|
|
296
|
-
borderColor:
|
|
297
|
-
borderWidth:
|
|
298
|
-
opacity:
|
|
299
|
-
markerShape:
|
|
300
|
-
markerSize:
|
|
294
|
+
color: t.style?.color ?? e.style?.color ?? J.color,
|
|
295
|
+
borderColor: t.style?.borderColor ?? e.style?.borderColor ?? o?.swimLaneItemBorderColor ?? J.borderColor,
|
|
296
|
+
borderWidth: t.style?.borderWidth ?? e.style?.borderWidth ?? o?.swimLaneItemBorderWidth ?? J.borderWidth,
|
|
297
|
+
opacity: t.style?.opacity ?? e.style?.opacity ?? J.opacity,
|
|
298
|
+
markerShape: t.style?.markerShape ?? e.style?.markerShape ?? J.markerShape,
|
|
299
|
+
markerSize: t.style?.markerSize ?? e.style?.markerSize ?? J.markerSize
|
|
301
300
|
};
|
|
302
301
|
}
|
|
303
|
-
function
|
|
304
|
-
return Math.max(
|
|
302
|
+
function pe(e) {
|
|
303
|
+
return Math.max(ke, Math.min(Le, e));
|
|
305
304
|
}
|
|
306
|
-
function
|
|
307
|
-
const s = t - e,
|
|
305
|
+
function Ue(e, t, o) {
|
|
306
|
+
const s = t - e, r = (e + t) / 2, l = pe(s * o);
|
|
308
307
|
return {
|
|
309
|
-
startMs:
|
|
310
|
-
endMs:
|
|
308
|
+
startMs: r - l / 2,
|
|
309
|
+
endMs: r + l / 2
|
|
311
310
|
};
|
|
312
311
|
}
|
|
313
|
-
function
|
|
314
|
-
const
|
|
312
|
+
function ve(e, t, o, s) {
|
|
313
|
+
const r = t - e, l = pe(r * o), a = r > 0 ? (s - e) / r : 0.5;
|
|
315
314
|
return {
|
|
316
315
|
startMs: s - a * l,
|
|
317
316
|
endMs: s + (1 - a) * l
|
|
@@ -319,28 +318,28 @@ function Ue(e, t, o, s) {
|
|
|
319
318
|
}
|
|
320
319
|
function Be(e) {
|
|
321
320
|
let t = 0;
|
|
322
|
-
for (const o of e) t += (o.height ??
|
|
321
|
+
for (const o of e) t += (o.height ?? F) + O;
|
|
323
322
|
return t;
|
|
324
323
|
}
|
|
325
|
-
function
|
|
326
|
-
const { swimLanes: l, showSwimLanes: a, scrollTop:
|
|
324
|
+
function ze(e, t, o, s, r) {
|
|
325
|
+
const { swimLanes: l, showSwimLanes: a, scrollTop: i, startMs: m, endMs: c, theme: S } = r;
|
|
327
326
|
if (!a || l.length === 0) return null;
|
|
328
|
-
const
|
|
329
|
-
if (t < 0 || t >=
|
|
330
|
-
let
|
|
331
|
-
for (const
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
334
|
-
for (const
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
if (e >= Math.max(0,
|
|
338
|
-
return { lane:
|
|
327
|
+
const h = Math.max(0, s - G);
|
|
328
|
+
if (t < 0 || t >= h) return null;
|
|
329
|
+
let p = -i;
|
|
330
|
+
for (const u of l) {
|
|
331
|
+
const L = u.height ?? F, T = p, M = p + L;
|
|
332
|
+
if (p += L + O, !(t < T || t >= M)) {
|
|
333
|
+
for (const f of u.items) {
|
|
334
|
+
if (f.interval) {
|
|
335
|
+
const d = A.JulianDate.toDate(f.interval.start).getTime(), $ = A.JulianDate.toDate(f.interval.stop).getTime(), j = (d - m) / (c - m) * o, C = ($ - m) / (c - m) * o;
|
|
336
|
+
if (e >= Math.max(0, j) && e <= Math.min(o, C))
|
|
337
|
+
return { lane: u, item: f };
|
|
339
338
|
}
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
if (Math.abs(e -
|
|
343
|
-
return { lane:
|
|
339
|
+
if (f.instant) {
|
|
340
|
+
const $ = (A.JulianDate.toDate(f.instant).getTime() - m) / (c - m) * o, j = he(u, f, S);
|
|
341
|
+
if (Math.abs(e - $) <= j.markerSize / 2 + 2)
|
|
342
|
+
return { lane: u, item: f };
|
|
344
343
|
}
|
|
345
344
|
}
|
|
346
345
|
return null;
|
|
@@ -348,200 +347,205 @@ function ve(e, t, o, s, n) {
|
|
|
348
347
|
}
|
|
349
348
|
return null;
|
|
350
349
|
}
|
|
351
|
-
function
|
|
352
|
-
const { swimLanes:
|
|
353
|
-
if (!l ||
|
|
354
|
-
const
|
|
355
|
-
if (t < 0 || t >=
|
|
356
|
-
let
|
|
357
|
-
for (const
|
|
358
|
-
const
|
|
359
|
-
if (t >=
|
|
360
|
-
|
|
350
|
+
function je(e, t, o, s) {
|
|
351
|
+
const { swimLanes: r, showSwimLanes: l, scrollTop: a } = s;
|
|
352
|
+
if (!l || r.length === 0 || e > 80) return null;
|
|
353
|
+
const i = Math.max(0, o - G);
|
|
354
|
+
if (t < 0 || t >= i) return null;
|
|
355
|
+
let m = -a;
|
|
356
|
+
for (const c of r) {
|
|
357
|
+
const S = c.height ?? F;
|
|
358
|
+
if (t >= m && t < m + S) return c;
|
|
359
|
+
m += S + O;
|
|
361
360
|
}
|
|
362
361
|
return null;
|
|
363
362
|
}
|
|
364
|
-
function
|
|
363
|
+
function Xe(e, t, o) {
|
|
365
364
|
if (!o.showSwimLanes || o.swimLanes.length === 0) return !1;
|
|
366
|
-
const s = Math.max(0, t -
|
|
365
|
+
const s = Math.max(0, t - G);
|
|
367
366
|
return e >= 0 && e < s;
|
|
368
367
|
}
|
|
369
|
-
function
|
|
368
|
+
function Ge(e, t, o, s) {
|
|
370
369
|
const {
|
|
371
|
-
startMs:
|
|
370
|
+
startMs: r,
|
|
372
371
|
endMs: l,
|
|
373
372
|
currentMs: a,
|
|
374
|
-
theme:
|
|
375
|
-
maxTicks:
|
|
376
|
-
swimLanes:
|
|
377
|
-
showSwimLanes:
|
|
378
|
-
reorderState:
|
|
379
|
-
timezone:
|
|
380
|
-
use12h:
|
|
381
|
-
months:
|
|
382
|
-
rangeSelection:
|
|
373
|
+
theme: i,
|
|
374
|
+
maxTicks: m,
|
|
375
|
+
swimLanes: c,
|
|
376
|
+
showSwimLanes: S,
|
|
377
|
+
reorderState: h,
|
|
378
|
+
timezone: p,
|
|
379
|
+
use12h: u,
|
|
380
|
+
months: L,
|
|
381
|
+
rangeSelection: T,
|
|
382
|
+
hoverMs: M
|
|
383
383
|
} = s;
|
|
384
384
|
let { scrollTop: f } = s;
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
387
|
-
e.fillStyle =
|
|
388
|
-
const
|
|
389
|
-
let
|
|
390
|
-
if (
|
|
391
|
-
for (const
|
|
392
|
-
const
|
|
393
|
-
if (f >
|
|
394
|
-
e.save(), e.beginPath(), e.rect(0, 0, t,
|
|
395
|
-
let
|
|
396
|
-
const
|
|
397
|
-
for (const
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
for (const
|
|
403
|
-
const H =
|
|
404
|
-
if (
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
385
|
+
const d = (l - r) / 1e3;
|
|
386
|
+
if (d <= 0) return f;
|
|
387
|
+
e.fillStyle = i.backgroundColor, e.fillRect(0, 0, t, o);
|
|
388
|
+
const $ = S && c.length > 0, C = $ ? Math.max(0, o - G) : 0;
|
|
389
|
+
let X = 0;
|
|
390
|
+
if ($)
|
|
391
|
+
for (const n of c) X += (n.height ?? F) + O;
|
|
392
|
+
const Z = Math.max(0, X - C);
|
|
393
|
+
if (f > Z && (f = Z), f < 0 && (f = 0), $ && C > 0) {
|
|
394
|
+
e.save(), e.beginPath(), e.rect(0, 0, t, C), e.clip();
|
|
395
|
+
let n = -f;
|
|
396
|
+
const y = (b) => (b - r) / (l - r) * t;
|
|
397
|
+
for (const b of c) {
|
|
398
|
+
const g = b.height ?? F, Y = n + g;
|
|
399
|
+
if (Y > 0 && n < C) {
|
|
400
|
+
const D = b.style, U = D?.backgroundColor ?? J.backgroundColor;
|
|
401
|
+
U && U !== "transparent" && (e.fillStyle = U, e.fillRect(0, n, t, g)), e.strokeStyle = i.tickColor + "44", e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, Y), e.lineTo(t, Y), e.stroke();
|
|
402
|
+
for (const I of b.items) {
|
|
403
|
+
const H = he(b, I, i);
|
|
404
|
+
if (I.interval) {
|
|
405
|
+
const q = A.JulianDate.toDate(I.interval.start).getTime(), w = A.JulianDate.toDate(I.interval.stop).getTime(), _ = y(q), W = y(w), Q = Math.max(0, _), x = Math.min(t, W) - Q;
|
|
406
|
+
if (x > 0) {
|
|
407
407
|
e.globalAlpha = H.opacity, e.fillStyle = H.color;
|
|
408
|
-
const
|
|
409
|
-
e.fillRect(
|
|
408
|
+
const le = 3, ae = n + le, me = g - le * 2;
|
|
409
|
+
e.fillRect(Q, ae, x, me), H.borderWidth > 0 && (e.strokeStyle = H.borderColor, e.lineWidth = H.borderWidth, e.strokeRect(Q, ae, x, me)), e.globalAlpha = 1;
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
if (
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
415
|
-
const
|
|
416
|
-
e.globalAlpha = H.opacity, e.fillStyle = H.color, H.markerShape === "diamond" ? (e.beginPath(), e.moveTo(
|
|
412
|
+
if (I.instant) {
|
|
413
|
+
const q = A.JulianDate.toDate(I.instant).getTime(), w = y(q);
|
|
414
|
+
if (w >= -H.markerSize && w <= t + H.markerSize) {
|
|
415
|
+
const _ = n + g / 2, W = H.markerSize;
|
|
416
|
+
e.globalAlpha = H.opacity, e.fillStyle = H.color, H.markerShape === "diamond" ? (e.beginPath(), e.moveTo(w, _ - W / 2), e.lineTo(w + W / 2, _), e.lineTo(w, _ + W / 2), e.lineTo(w - W / 2, _), e.closePath(), e.fill()) : H.markerShape === "circle" ? (e.beginPath(), e.arc(w, _, W / 2, 0, Math.PI * 2), e.fill()) : (e.strokeStyle = H.color, e.lineWidth = 2, e.beginPath(), e.moveTo(w, n + 2), e.lineTo(w, n + g - 2), e.stroke()), e.globalAlpha = 1;
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
e.font = `${Math.min(11,
|
|
420
|
+
e.font = `${Math.min(11, g - 4)}px system-ui, sans-serif`, e.textAlign = "left", e.textBaseline = "middle", e.fillStyle = D?.labelColor ?? J.labelColor, e.fillText(b.label, He, n + g / 2);
|
|
421
421
|
}
|
|
422
|
-
if (
|
|
422
|
+
if (n += g + O, n >= C) break;
|
|
423
423
|
}
|
|
424
|
-
if (
|
|
425
|
-
const
|
|
426
|
-
let
|
|
427
|
-
for (let
|
|
428
|
-
|
|
429
|
-
e.strokeStyle =
|
|
430
|
-
const
|
|
431
|
-
if (
|
|
432
|
-
const
|
|
433
|
-
let
|
|
434
|
-
for (const
|
|
435
|
-
if (
|
|
436
|
-
|
|
424
|
+
if (h && h.dragging) {
|
|
425
|
+
const b = h.currentY - h.dragStartY;
|
|
426
|
+
let g = -f;
|
|
427
|
+
for (let D = 0; D < c.length && D < h.insertIndex; D++)
|
|
428
|
+
g += (c[D].height ?? F) + O;
|
|
429
|
+
e.strokeStyle = i.indicatorColor, e.lineWidth = 2, e.beginPath(), e.moveTo(0, g), e.lineTo(t, g), e.stroke();
|
|
430
|
+
const Y = c.find((D) => D.id === h.dragLaneId);
|
|
431
|
+
if (Y) {
|
|
432
|
+
const D = Y.height ?? F;
|
|
433
|
+
let U = -f;
|
|
434
|
+
for (const I of c) {
|
|
435
|
+
if (I.id === h.dragLaneId) break;
|
|
436
|
+
U += (I.height ?? F) + O;
|
|
437
437
|
}
|
|
438
|
-
e.globalAlpha = 0.4, e.fillStyle =
|
|
438
|
+
e.globalAlpha = 0.4, e.fillStyle = i.indicatorColor, e.fillRect(0, U + b, t, D), e.globalAlpha = 1;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
if (
|
|
442
|
-
const
|
|
443
|
-
e.fillStyle =
|
|
441
|
+
if (X > C) {
|
|
442
|
+
const b = t - ee - 2, g = C / X, Y = Math.max(20, C * g), D = f / Z * (C - Y);
|
|
443
|
+
e.fillStyle = i.tickColor + "22", e.fillRect(b, 0, ee, C), e.fillStyle = i.tickColor + "88", e.fillRect(b, D, ee, Y);
|
|
444
444
|
}
|
|
445
445
|
e.restore();
|
|
446
446
|
}
|
|
447
|
-
e.font = `${
|
|
448
|
-
const
|
|
449
|
-
let
|
|
450
|
-
for (let
|
|
451
|
-
if (
|
|
452
|
-
|
|
447
|
+
e.font = `${i.fontSize}px monospace`;
|
|
448
|
+
const Me = ce(r + d * 500, d, p, u, L), de = e.measureText(Me).width + 24, ge = Math.max(de / t * d, d / 1e3);
|
|
449
|
+
let P = k[k.length - 1], v = k.length - 1;
|
|
450
|
+
for (let n = 0; n < k.length; n++)
|
|
451
|
+
if (k[n] > ge) {
|
|
452
|
+
P = k[n], v = n;
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
|
-
if (
|
|
456
|
-
for (; v <
|
|
457
|
-
v++,
|
|
455
|
+
if (m != null && m > 0)
|
|
456
|
+
for (; v < k.length - 1 && d / P > m; )
|
|
457
|
+
v++, P = k[v];
|
|
458
458
|
let R = 0;
|
|
459
|
-
for (let
|
|
460
|
-
if (
|
|
461
|
-
t * (
|
|
459
|
+
for (let n = v - 1; n >= 0; n--)
|
|
460
|
+
if (P % k[n] < 1e-4) {
|
|
461
|
+
t * (k[n] / d) >= 3 && (R = k[n]);
|
|
462
462
|
break;
|
|
463
463
|
}
|
|
464
|
-
let
|
|
464
|
+
let B = 0;
|
|
465
465
|
if (R > 0) {
|
|
466
|
-
for (let
|
|
467
|
-
if (R %
|
|
468
|
-
|
|
466
|
+
for (let n = 0; n < k.length && k[n] < R; n++)
|
|
467
|
+
if (R % k[n] < 1e-4 && t * (k[n] / d) >= 3) {
|
|
468
|
+
B = k[n];
|
|
469
469
|
break;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
const
|
|
473
|
-
if (
|
|
474
|
-
e.strokeStyle =
|
|
475
|
-
for (let
|
|
476
|
-
const
|
|
477
|
-
e.beginPath(), e.moveTo(
|
|
472
|
+
const re = Ce(r, d, p), z = (r - re) / 1e3, K = z + d, V = (n) => t * ((n - z) / d);
|
|
473
|
+
if (B > 0) {
|
|
474
|
+
e.strokeStyle = i.tickColor, e.lineWidth = 1;
|
|
475
|
+
for (let n = Math.floor(z / B) * B; n <= K; n = te(n, B)) {
|
|
476
|
+
const y = V(n);
|
|
477
|
+
e.beginPath(), e.moveTo(y, o - i.minorTickHeight), e.lineTo(y, o), e.stroke();
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
if (R > 0) {
|
|
481
|
-
e.strokeStyle =
|
|
482
|
-
for (let
|
|
483
|
-
const
|
|
484
|
-
e.beginPath(), e.moveTo(
|
|
481
|
+
e.strokeStyle = i.tickColor, e.lineWidth = 1;
|
|
482
|
+
for (let n = Math.floor(z / R) * R; n <= K; n = te(n, R)) {
|
|
483
|
+
const y = V(n);
|
|
484
|
+
e.beginPath(), e.moveTo(y, o - i.minorTickHeight), e.lineTo(y, o), e.stroke();
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
e.textAlign = "center", e.textBaseline = "bottom";
|
|
488
|
-
let
|
|
489
|
-
for (let
|
|
490
|
-
const
|
|
491
|
-
e.strokeStyle =
|
|
492
|
-
const
|
|
493
|
-
|
|
488
|
+
let ie = -1 / 0;
|
|
489
|
+
for (let n = Math.floor(z / P) * P; n <= K + P; n = te(n, P)) {
|
|
490
|
+
const y = V(n), b = re + n * 1e3;
|
|
491
|
+
e.strokeStyle = i.majorTickColor, e.lineWidth = 1, e.beginPath(), e.moveTo(y, o - i.majorTickHeight), e.lineTo(y, o), e.stroke();
|
|
492
|
+
const g = ce(b, d, p, u, L), Y = e.measureText(g).width, D = y - Y / 2;
|
|
493
|
+
D > ie && (e.fillStyle = i.labelColor, e.fillText(g, y, o - i.majorTickHeight - 4), ie = D + Y + 5);
|
|
494
|
+
}
|
|
495
|
+
if (T) {
|
|
496
|
+
const n = (T.startMs - r) / (l - r) * t, y = (T.endMs - r) / (l - r) * t, b = Math.min(n, y), g = Math.abs(y - n);
|
|
497
|
+
e.globalAlpha = 0.2, e.fillStyle = i.indicatorColor, e.fillRect(b, 0, g, o), e.globalAlpha = 1;
|
|
494
498
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
499
|
+
const se = (a - r) / (l - r) * t;
|
|
500
|
+
if (e.strokeStyle = i.indicatorColor, e.lineWidth = i.indicatorLineWidth, e.beginPath(), e.moveTo(se, 0), e.lineTo(se, o), e.stroke(), M != null) {
|
|
501
|
+
const n = (M - r) / (l - r) * t;
|
|
502
|
+
e.globalAlpha = 0.15, e.strokeStyle = i.indicatorColor, e.lineWidth = i.indicatorLineWidth, e.beginPath(), e.moveTo(n, 0), e.lineTo(n, o), e.stroke(), e.globalAlpha = 1;
|
|
498
503
|
}
|
|
499
|
-
|
|
500
|
-
return e.strokeStyle = r.indicatorColor, e.lineWidth = r.indicatorLineWidth, e.beginPath(), e.moveTo(ie, 0), e.lineTo(ie, o), e.stroke(), f;
|
|
504
|
+
return f;
|
|
501
505
|
}
|
|
502
506
|
export {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
we as DEFAULT_LABELS,
|
|
508
|
+
F as DEFAULT_LANE_HEIGHT,
|
|
509
|
+
ue as DateTimeFormats,
|
|
510
|
+
He as LABEL_PAD_LEFT,
|
|
511
|
+
O as LANE_GAP,
|
|
508
512
|
Le as MAX_SPAN_MS,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
513
|
+
ke as MIN_SPAN_MS,
|
|
514
|
+
Ae as MONTHS,
|
|
515
|
+
ee as SCROLLBAR_WIDTH,
|
|
516
|
+
Oe as SWIM_LANE_SCROLL_SPEED,
|
|
517
|
+
G as TICK_AREA_HEIGHT,
|
|
518
|
+
k as TIC_SCALES,
|
|
519
|
+
fe as TickInterval,
|
|
520
|
+
Pe as Timezones,
|
|
521
|
+
Ce as calcEpochMs,
|
|
522
|
+
pe as clampSpan,
|
|
519
523
|
J as defaultSwimLaneStyle,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
524
|
+
Ee as defaultTheme,
|
|
525
|
+
Ge as drawTimeline,
|
|
526
|
+
be as formatDateTime,
|
|
527
|
+
Fe as formatTime,
|
|
528
|
+
Ie as fromMilliseconds,
|
|
529
|
+
_e as generateTicks,
|
|
530
|
+
ne as getDateParts,
|
|
531
|
+
Te as getDurationMs,
|
|
528
532
|
Re as getTimezoneAbbr,
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
533
|
+
je as hitTestLaneLabel,
|
|
534
|
+
ze as hitTestSwimLane,
|
|
535
|
+
Xe as isInSwimLaneRegion,
|
|
532
536
|
ce as makeLabel,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
537
|
+
te as nextTic,
|
|
538
|
+
Ne as positionToTime,
|
|
539
|
+
he as resolveItemStyle,
|
|
540
|
+
Ye as resolveLabel,
|
|
541
|
+
We as snapToTick,
|
|
538
542
|
Je as splitForDisplay,
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
+
De as timeToPosition,
|
|
544
|
+
oe as toDate,
|
|
545
|
+
$e as toJulianDate,
|
|
546
|
+
N as toMilliseconds,
|
|
543
547
|
Be as totalSwimLaneHeight,
|
|
544
548
|
E as twoD,
|
|
545
|
-
|
|
546
|
-
|
|
549
|
+
ve as zoomAroundMs,
|
|
550
|
+
Ue as zoomRange
|
|
547
551
|
};
|
|
@@ -1 +1 @@
|
|
|
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"})}));
|
|
1
|
+
(function(l,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("cesium")):typeof define=="function"&&define.amd?define(["exports","cesium"],B):(l=typeof globalThis<"u"?globalThis:l||self,B(l.CesiumTimelineCore={},l.Cesium))})(this,(function(l,B){"use strict";function ke(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const H=ke(B);function He(e,t){return typeof e=="function"?e(t):e}const Ce={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"]},Ee={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,liveDotColor:"#e53e3e"};var ee=(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))(ee||{});const I={color:"#4da6ff",borderColor:"#2980b9",borderWidth:1,opacity:.8,markerShape:"diamond",markerSize:10,labelColor:"#cccccc",backgroundColor:"transparent"},P=24;function _e(e){return e instanceof H.JulianDate?H.JulianDate.clone(e):H.JulianDate.fromDate(e)}function K(e){return e instanceof H.JulianDate?H.JulianDate.toDate(e):e}function N(e){return K(e).getTime()}function we(e){return H.JulianDate.fromDate(new Date(e))}function fe(e,t){return N(t)-N(e)}const Ye=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ie=["January","February","March","April","May","June","July","August","September","October","November","December"],te={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"},Pe={LOCAL:"local",UTC:"UTC"};function Z(e,t){if(!t||t==="local"){const T=e.getFullYear(),h=e.getMonth(),k=e.getDate(),p=e.getHours(),M=p%12||12,u=e.getMinutes(),g=e.getSeconds(),R=e.getMilliseconds();return{yr:T,mo:h,day:k,hr24:p,hr12:M,min:u,sec:g,ms:R,ampm:p<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}),a={};for(const T of o.formatToParts(e))T.type!=="literal"&&(a[T.type]=T.value);const i=parseInt(a.year),s=parseInt(a.month)-1,m=parseInt(a.day);let r=parseInt(a.hour);r===24&&(r=0);const c=r%12||12,f=parseInt(a.minute),y=parseInt(a.second),d=e.getMilliseconds();return{yr:i,mo:s,day:m,hr24:r,hr12:c,min:f,sec:y,ms:d,ampm:r<12?"AM":"PM"}}function Ne(e,t){if(!t||t==="local")return null;const o=K(e);return new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"}).formatToParts(o).find(i=>i.type==="timeZoneName")?.value??null}function ue(e,t=te.DEFAULT,o){const a=K(e),{yr:i,mo:s,day:m,hr24:r,hr12:c,min:f,sec:y,ms:d,ampm:T}=Z(a,o),h=M=>String(M).padStart(2,"0"),k=M=>String(M).padStart(3,"0"),p={YYYY:String(i),YY:String(i).slice(-2),MMMM:Ie[s],MMM:Ye[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(y),SSS:k(d),A:T,a:T.toLowerCase()};return t.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,M=>p[M]??M)}function Re(e=te.DEFAULT){const t=["YYYY","YY","MMMM","MMM","MM","M","DD","D"],o=["HH","H","hh","h","mm","ss","SSS","A","a"],a=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:a(i),dateFormat:a(s)}}function Fe(e,t=!1){return ue(e,t?"HH:mm:ss":"HH:mm")}function he(e,t,o,a){const i=N(e),s=N(t),m=N(o);if(m===s)return 0;const r=(i-s)/(m-s);return Math.max(0,Math.min(1,r))*a}function $e(e,t,o,a){const i=Math.max(0,Math.min(1,e/a)),s=N(t),m=N(o),r=s+i*(m-s);return H.JulianDate.fromDate(new Date(r))}function Oe(e,t,o,a){const i=[],s=fe(e,t),m=N(e);let r;typeof o=="number"&&o in ee||typeof o=="number"?r=o*60*1e3:r=3600*1e3;const c=r*4;let f=m,y=0;for(;f<=m+s;){const d=y*r%c===0,T=he(new Date(f),e,t,a);let h;if(d){const k=new Date(f),p=k.getHours().toString().padStart(2,"0"),M=k.getMinutes().toString().padStart(2,"0");h=`${p}:${M}`}i.push({position:T,isMajor:d,label:h}),f+=r,y++}return i}function Je(e,t,o=10){let a=t[0],i=Math.abs(a.position-e);for(const s of t){const m=Math.abs(s.position-e);m<i&&(i=m,a=s)}return i<=o?a.position:e}const de=1e3,Te=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,$=1,Me=6,V=6,We=.3,ge=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function w(e){return e<10?`0${e}`:`${e}`}function oe(e,t,o,a,i){const s=new Date(e),{yr:m,mo:r,day:c,hr24:f,hr12:y,min:d,sec:T,ms:h,ampm:k}=Z(s,o),p=a?y:f,M=a?` ${k}`:"",u=i??ge;if(t>31536e4)return`${m}`;if(t>31536e3)return`${u[r]} ${m}`;if(t>604800)return`${u[r]} ${c}`;if(t>86400)return`${u[r]} ${c} ${w(p)}:${w(d)}${M}`;if(t>3600)return`${w(p)}:${w(d)}${M}`;if(t>60)return`${w(p)}:${w(d)}:${w(T)}${M}`;const g=h>0?`.${String(h).padStart(3,"0")}`:"";return`${w(p)}:${w(d)}:${w(T)}${g}${M}`}function Se(e,t,o){const a=new Date(e);if(!o||o==="local"){const c=a.getFullYear(),f=a.getMonth(),y=a.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,y).getTime()}const{yr:i,hr24:s,min:m,sec:r}=Z(a,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 ne(e,t,o){return{color:t.style?.color??e.style?.color??I.color,borderColor:t.style?.borderColor??e.style?.borderColor??o?.swimLaneItemBorderColor??I.borderColor,borderWidth:t.style?.borderWidth??e.style?.borderWidth??o?.swimLaneItemBorderWidth??I.borderWidth,opacity:t.style?.opacity??e.style?.opacity??I.opacity,markerShape:t.style?.markerShape??e.style?.markerShape??I.markerShape,markerSize:t.style?.markerSize??e.style?.markerSize??I.markerSize}}function ie(e){return Math.max(de,Math.min(Te,e))}function ve(e,t,o){const a=t-e,i=(e+t)/2,s=ie(a*o);return{startMs:i-s/2,endMs:i+s/2}}function Ue(e,t,o,a){const i=t-e,s=ie(i*o),m=i>0?(a-e)/i:.5;return{startMs:a-m*s,endMs:a+(1-m)*s}}function Be(e){let t=0;for(const o of e)t+=(o.height??P)+$;return t}function je(e,t,o,a,i){const{swimLanes:s,showSwimLanes:m,scrollTop:r,startMs:c,endMs:f,theme:y}=i;if(!m||s.length===0)return null;const d=Math.max(0,a-j);if(t<0||t>=d)return null;let T=-r;for(const h of s){const k=h.height??P,p=T,M=T+k;if(T+=k+$,!(t<p||t>=M)){for(const u of h.items){if(u.interval){const g=H.JulianDate.toDate(u.interval.start).getTime(),R=H.JulianDate.toDate(u.interval.stop).getTime(),Q=(g-c)/(f-c)*o,E=(R-c)/(f-c)*o;if(e>=Math.max(0,Q)&&e<=Math.min(o,E))return{lane:h,item:u}}if(u.instant){const R=(H.JulianDate.toDate(u.instant).getTime()-c)/(f-c)*o,Q=ne(h,u,y);if(Math.abs(e-R)<=Q.markerSize/2+2)return{lane:h,item:u}}}return null}}return null}function ze(e,t,o,a){const{swimLanes:i,showSwimLanes:s,scrollTop:m}=a;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 y=f.height??P;if(t>=c&&t<c+y)return f;c+=y+$}return null}function Xe(e,t,o){if(!o.showSwimLanes||o.swimLanes.length===0)return!1;const a=Math.max(0,t-j);return e>=0&&e<a}function Ge(e,t,o,a){const{startMs:i,endMs:s,currentMs:m,theme:r,maxTicks:c,swimLanes:f,showSwimLanes:y,reorderState:d,timezone:T,use12h:h,months:k,rangeSelection:p,hoverMs:M}=a;let{scrollTop:u}=a;const g=(s-i)/1e3;if(g<=0)return u;e.fillStyle=r.backgroundColor,e.fillRect(0,0,t,o);const R=y&&f.length>0,E=R?Math.max(0,o-j):0;let x=0;if(R)for(const n of f)x+=(n.height??P)+$;const re=Math.max(0,x-E);if(u>re&&(u=re),u<0&&(u=0),R&&E>0){e.save(),e.beginPath(),e.rect(0,0,t,E),e.clip();let n=-u;const D=L=>(L-i)/(s-i)*t;for(const L of f){const S=L.height??P,_=n+S;if(_>0&&n<E){const A=L.style,U=A?.backgroundColor??I.backgroundColor;U&&U!=="transparent"&&(e.fillStyle=U,e.fillRect(0,n,t,S)),e.strokeStyle=r.tickColor+"44",e.lineWidth=.5,e.beginPath(),e.moveTo(0,_),e.lineTo(t,_),e.stroke();for(const F of L.items){const C=ne(L,F,r);if(F.interval){const se=H.JulianDate.toDate(F.interval.start).getTime(),Y=H.JulianDate.toDate(F.interval.stop).getTime(),W=D(se),v=D(Y),me=Math.max(0,W),ce=Math.min(t,v)-me;if(ce>0){e.globalAlpha=C.opacity,e.fillStyle=C.color;const De=3,Le=n+De,Ae=S-De*2;e.fillRect(me,Le,ce,Ae),C.borderWidth>0&&(e.strokeStyle=C.borderColor,e.lineWidth=C.borderWidth,e.strokeRect(me,Le,ce,Ae)),e.globalAlpha=1}}if(F.instant){const se=H.JulianDate.toDate(F.instant).getTime(),Y=D(se);if(Y>=-C.markerSize&&Y<=t+C.markerSize){const W=n+S/2,v=C.markerSize;e.globalAlpha=C.opacity,e.fillStyle=C.color,C.markerShape==="diamond"?(e.beginPath(),e.moveTo(Y,W-v/2),e.lineTo(Y+v/2,W),e.lineTo(Y,W+v/2),e.lineTo(Y-v/2,W),e.closePath(),e.fill()):C.markerShape==="circle"?(e.beginPath(),e.arc(Y,W,v/2,0,Math.PI*2),e.fill()):(e.strokeStyle=C.color,e.lineWidth=2,e.beginPath(),e.moveTo(Y,n+2),e.lineTo(Y,n+S-2),e.stroke()),e.globalAlpha=1}}}e.font=`${Math.min(11,S-4)}px system-ui, sans-serif`,e.textAlign="left",e.textBaseline="middle",e.fillStyle=A?.labelColor??I.labelColor,e.fillText(L.label,Me,n+S/2)}if(n+=S+$,n>=E)break}if(d&&d.dragging){const L=d.currentY-d.dragStartY;let S=-u;for(let A=0;A<f.length&&A<d.insertIndex;A++)S+=(f[A].height??P)+$;e.strokeStyle=r.indicatorColor,e.lineWidth=2,e.beginPath(),e.moveTo(0,S),e.lineTo(t,S),e.stroke();const _=f.find(A=>A.id===d.dragLaneId);if(_){const A=_.height??P;let U=-u;for(const F of f){if(F.id===d.dragLaneId)break;U+=(F.height??P)+$}e.globalAlpha=.4,e.fillStyle=r.indicatorColor,e.fillRect(0,U+L,t,A),e.globalAlpha=1}}if(x>E){const L=t-V-2,S=E/x,_=Math.max(20,E*S),A=u/re*(E-_);e.fillStyle=r.tickColor+"22",e.fillRect(L,0,V,E),e.fillStyle=r.tickColor+"88",e.fillRect(L,A,V,_)}e.restore()}e.font=`${r.fontSize}px monospace`;const Ke=oe(i+g*500,g,T,h,k),Ze=e.measureText(Ke).width+24,Ve=Math.max(Ze/t*g,g/1e3);let O=b[b.length-1],z=b.length-1;for(let n=0;n<b.length;n++)if(b[n]>Ve){O=b[n],z=n;break}if(c!=null&&c>0)for(;z<b.length-1&&g/O>c;)z++,O=b[z];let J=0;for(let n=z-1;n>=0;n--)if(O%b[n]<1e-4){t*(b[n]/g)>=3&&(J=b[n]);break}let X=0;if(J>0){for(let n=0;n<b.length&&b[n]<J;n++)if(J%b[n]<1e-4&&t*(b[n]/g)>=3){X=b[n];break}}const pe=Se(i,g,T),G=(i-pe)/1e3,le=G+g,ae=n=>t*((n-G)/g);if(X>0){e.strokeStyle=r.tickColor,e.lineWidth=1;for(let n=Math.floor(G/X)*X;n<=le;n=q(n,X)){const D=ae(n);e.beginPath(),e.moveTo(D,o-r.minorTickHeight),e.lineTo(D,o),e.stroke()}}if(J>0){e.strokeStyle=r.tickColor,e.lineWidth=1;for(let n=Math.floor(G/J)*J;n<=le;n=q(n,J)){const D=ae(n);e.beginPath(),e.moveTo(D,o-r.minorTickHeight),e.lineTo(D,o),e.stroke()}}e.textAlign="center",e.textBaseline="bottom";let be=-1/0;for(let n=Math.floor(G/O)*O;n<=le+O;n=q(n,O)){const D=ae(n),L=pe+n*1e3;e.strokeStyle=r.majorTickColor,e.lineWidth=1,e.beginPath(),e.moveTo(D,o-r.majorTickHeight),e.lineTo(D,o),e.stroke();const S=oe(L,g,T,h,k),_=e.measureText(S).width,A=D-_/2;A>be&&(e.fillStyle=r.labelColor,e.fillText(S,D,o-r.majorTickHeight-4),be=A+_+5)}if(p){const n=(p.startMs-i)/(s-i)*t,D=(p.endMs-i)/(s-i)*t,L=Math.min(n,D),S=Math.abs(D-n);e.globalAlpha=.2,e.fillStyle=r.indicatorColor,e.fillRect(L,0,S,o),e.globalAlpha=1}const ye=(m-i)/(s-i)*t;if(e.strokeStyle=r.indicatorColor,e.lineWidth=r.indicatorLineWidth,e.beginPath(),e.moveTo(ye,0),e.lineTo(ye,o),e.stroke(),M!=null){const n=(M-i)/(s-i)*t;e.globalAlpha=.15,e.strokeStyle=r.indicatorColor,e.lineWidth=r.indicatorLineWidth,e.beginPath(),e.moveTo(n,0),e.lineTo(n,o),e.stroke(),e.globalAlpha=1}return u}l.DEFAULT_LABELS=Ce,l.DEFAULT_LANE_HEIGHT=P,l.DateTimeFormats=te,l.LABEL_PAD_LEFT=Me,l.LANE_GAP=$,l.MAX_SPAN_MS=Te,l.MIN_SPAN_MS=de,l.MONTHS=ge,l.SCROLLBAR_WIDTH=V,l.SWIM_LANE_SCROLL_SPEED=We,l.TICK_AREA_HEIGHT=j,l.TIC_SCALES=b,l.TickInterval=ee,l.Timezones=Pe,l.calcEpochMs=Se,l.clampSpan=ie,l.defaultSwimLaneStyle=I,l.defaultTheme=Ee,l.drawTimeline=Ge,l.formatDateTime=ue,l.formatTime=Fe,l.fromMilliseconds=we,l.generateTicks=Oe,l.getDateParts=Z,l.getDurationMs=fe,l.getTimezoneAbbr=Ne,l.hitTestLaneLabel=ze,l.hitTestSwimLane=je,l.isInSwimLaneRegion=Xe,l.makeLabel=oe,l.nextTic=q,l.positionToTime=$e,l.resolveItemStyle=ne,l.resolveLabel=He,l.snapToTick=Je,l.splitForDisplay=Re,l.timeToPosition=he,l.toDate=K,l.toJulianDate=_e,l.toMilliseconds=N,l.totalSwimLaneHeight=Be,l.twoD=w,l.zoomAroundMs=Ue,l.zoomRange=ve,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare interface ControlsBaseProps {
|
|
|
36
36
|
onJumpToLive: () => void;
|
|
37
37
|
/** Reset the playback speed to 1×. */
|
|
38
38
|
onResetSpeed: () => void;
|
|
39
|
-
/** Whether the needle is near the current wall-clock time (within
|
|
39
|
+
/** Whether the needle is near the current wall-clock time (within 2 s). */
|
|
40
40
|
isLive: boolean;
|
|
41
41
|
/** Whether to enable the ⏮ jump-to-start button (true when startTime prop was provided). */
|
|
42
42
|
hasStartTime: boolean;
|
|
@@ -57,6 +57,10 @@ export declare interface ControlsBaseProps {
|
|
|
57
57
|
* @see TimelineBaseProps.labels
|
|
58
58
|
*/
|
|
59
59
|
labels?: Partial<TimelineLabels>;
|
|
60
|
+
/** @see TimelineBaseProps.liveButtonSize */
|
|
61
|
+
liveButtonSize?: 'sm' | 'md' | 'lg';
|
|
62
|
+
/** @see TimelineBaseProps.liveButtonPosition */
|
|
63
|
+
liveButtonPosition?: 'left' | 'right';
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
/** Decomposed date/time fields extracted in a specific timezone. `mo` is 0-indexed. */
|
|
@@ -426,6 +430,34 @@ export declare interface TimelineBaseProps {
|
|
|
426
430
|
* want to change; everything else falls back to the English defaults.
|
|
427
431
|
*/
|
|
428
432
|
labels?: Partial<TimelineLabels>;
|
|
433
|
+
/**
|
|
434
|
+
* Size of the LIVE button in the control bar.
|
|
435
|
+
* `'sm'` is compact, `'md'` is the default, `'lg'` is prominent.
|
|
436
|
+
* @default 'md'
|
|
437
|
+
*/
|
|
438
|
+
liveButtonSize?: 'sm' | 'md' | 'lg';
|
|
439
|
+
/**
|
|
440
|
+
* Which side of the control bar the LIVE button appears on.
|
|
441
|
+
* `'left'` places it beside the datetime display (default).
|
|
442
|
+
* `'right'` moves it to the right side of the control bar.
|
|
443
|
+
* @default 'left'
|
|
444
|
+
*/
|
|
445
|
+
liveButtonPosition?: 'left' | 'right';
|
|
446
|
+
/**
|
|
447
|
+
* When `true`, the timeline is locked to live mode.
|
|
448
|
+
* Needle drag, datetime click, play/pause, rewind, fast-forward,
|
|
449
|
+
* jump-to-start, and jump-to-end are all disabled. The LIVE button
|
|
450
|
+
* becomes a non-interactive status indicator. Canvas zoom and pan
|
|
451
|
+
* remain fully interactive.
|
|
452
|
+
*/
|
|
453
|
+
live?: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* When `true`, reverses the scroll-wheel zoom direction so that
|
|
456
|
+
* scrolling down zooms in on time and scrolling up zooms out.
|
|
457
|
+
* By default (false) scrolling up zooms in and scrolling down zooms out.
|
|
458
|
+
* @default false
|
|
459
|
+
*/
|
|
460
|
+
invertScrollZoom?: boolean;
|
|
429
461
|
}
|
|
430
462
|
|
|
431
463
|
/**
|
|
@@ -547,6 +579,13 @@ export declare interface TimelineRenderState {
|
|
|
547
579
|
startMs: number;
|
|
548
580
|
endMs: number;
|
|
549
581
|
} | null;
|
|
582
|
+
/**
|
|
583
|
+
* Canvas-relative X position of the cursor (in CSS pixels) while the user is
|
|
584
|
+
* hovering over the timeline. When non-null a ghost needle is drawn at this
|
|
585
|
+
* position with 15 % opacity so the user can preview where a click / drag
|
|
586
|
+
* would land before committing.
|
|
587
|
+
*/
|
|
588
|
+
hoverMs?: number | null;
|
|
550
589
|
}
|
|
551
590
|
|
|
552
591
|
export declare interface TimelineTheme {
|
|
@@ -569,6 +608,8 @@ export declare interface TimelineTheme {
|
|
|
569
608
|
swimLaneItemBorderColor: string;
|
|
570
609
|
/** Default border width for swim lane items (px). Set to 0 to remove borders. */
|
|
571
610
|
swimLaneItemBorderWidth: number;
|
|
611
|
+
/** Color of the red dot shown on the LIVE button when playback is live. */
|
|
612
|
+
liveDotColor: string;
|
|
572
613
|
}
|
|
573
614
|
|
|
574
615
|
export declare interface TimePosition {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kteneyck/cesium-timeline-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Framework-agnostic core logic for the Cesium timeline component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "kteneyck",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
34
35
|
"import": "./dist/cesium-timeline-core.js",
|
|
35
|
-
"require": "./dist/cesium-timeline-core.umd.cjs"
|
|
36
|
-
"types": "./dist/index.d.ts"
|
|
36
|
+
"require": "./dist/cesium-timeline-core.umd.cjs"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"files": [
|