@kteneyck/cesium-timeline-core 0.8.0 → 0.10.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 +140 -40
- package/dist/cesium-timeline-core.js +298 -287
- package/dist/cesium-timeline-core.umd.cjs +1 -1
- package/dist/index.d.ts +50 -1
- package/package.json +1 -1
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,14 @@ 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.
|
|
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.
|
|
136
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.
|
|
137
139
|
- **Fully themeable** — 16 theme properties cover every color, size, and font setting, including swim lane item border defaults.
|
|
138
140
|
- **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).
|
|
@@ -144,37 +146,41 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
144
146
|
|
|
145
147
|
### `TimelineProps`
|
|
146
148
|
|
|
147
|
-
| Prop | Type | Default | Description
|
|
148
|
-
|
|
149
|
-
| `clock` | `Cesium.Clock` | — | Cesium clock to sync with. Falls back to `setInterval` if omitted.
|
|
150
|
-
| `startTime` | `JulianDate \| Date` | now − 12 h | Left bound of initial visible window. Also shows the ⏮ button when provided.
|
|
151
|
-
| `endTime` | `JulianDate \| Date` | now + 12 h | Right bound of initial visible window. Also shows the ⏭ button when provided.
|
|
152
|
-
| `currentTime` | `JulianDate \| Date` | `startTime` | Initial needle position
|
|
153
|
-
| `height` | `number` | `120` | Canvas height in pixels
|
|
154
|
-
| `showControls` | `boolean` | `true` | Show/hide the control bar
|
|
155
|
-
| `enableDrag` | `boolean` | `true` | Show/hide the canvas (drag/seek area)
|
|
156
|
-
| `showLabels` | `boolean` | — | Show/hide tick labels on the canvas
|
|
157
|
-
| `snapToTicks` | `boolean` | — | Snap needle to nearest tick on drag
|
|
158
|
-
| `tickInterval` | `TickInterval \| number` | auto | Override automatic tick interval
|
|
159
|
-
| `maxTicks` | `number` | unlimited | Maximum number of major ticks on the canvas at once. When exceeded the tick scale is automatically coarsened.
|
|
160
|
-
| `ffSpeeds` | `number[]` | `[2,4,8,16,32,1]` | Speed steps cycled by the ▶▶ button. Last entry wraps back to first.
|
|
161
|
-
| `rwSpeeds` | `number[]` | `[1,2,4,8,16,32]` | Absolute-value speed steps cycled by the ◀◀ button (negated internally).
|
|
162
|
-
| `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 |
|
|
163
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. |
|
|
164
|
-
| `onDateTimeClick` | `() => void` | — | Called when the user clicks the datetime display. Use to open your own date picker.
|
|
165
|
-
| `jumpToTime` | `JulianDate \| Date` | — | Set to programmatically jump the timeline to a moment (pans canvas + sets time).
|
|
166
|
-
| `theme` | `Partial<TimelineTheme>` | `defaultTheme` | Theme overrides (merged with defaults)
|
|
167
|
-
| `className` | `string` | — | CSS class applied to the root div
|
|
168
|
-
| `onTimeChange` | `(t: JulianDate) => void` | — | Fires when needle moves (drag, click, or clock tick)
|
|
169
|
-
| `onPlayPause` | `(playing: boolean) => void` | — | Fires on play/pause toggle
|
|
170
|
-
| `onMultiplierChange` | `(m: number) => void` | — | Fires when speed changes
|
|
171
|
-
| `swimLanes` | `SwimLane[]` | — | Array of swim lane definitions to render on the canvas
|
|
172
|
-
| `showSwimLanes` | `boolean` | `true` | Show or hide the swim lanes
|
|
173
|
-
| `onSwimLaneItemClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is clicked
|
|
174
|
-
| `onSwimLaneItemHover` | `(info: SwimLaneEventInfo \| null) => void` | — | Fires when mouse enters/leaves a swim lane item
|
|
175
|
-
| `onSwimLaneItemDoubleClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is double-clicked
|
|
176
|
-
| `onSwimLaneReorder` | `(orderedIds: string[]) => void` | — | Fires when swim lanes are reordered via drag. Receives the new lane id order.
|
|
177
|
-
| `
|
|
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. |
|
|
178
184
|
|
|
179
185
|
---
|
|
180
186
|
|
|
@@ -213,6 +219,7 @@ Pass a partial `TimelineTheme` object to the `theme` prop. Any omitted propertie
|
|
|
213
219
|
| `buttonActiveColor` | `#d69826` | Active buttons, LIVE, speed badge, and date line colour |
|
|
214
220
|
| `swimLaneItemBorderColor` | `#666666` | Default border colour for swim lane interval bars. Can be overridden per-lane or per-item. |
|
|
215
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. |
|
|
216
223
|
|
|
217
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.
|
|
218
225
|
|
|
@@ -362,13 +369,16 @@ The control bar uses a 3-column CSS grid so the transport buttons are always cen
|
|
|
362
369
|
|
|
363
370
|
### LIVE Button
|
|
364
371
|
|
|
365
|
-
- Shows
|
|
366
|
-
- Shows `LIVE` (dim outline) otherwise.
|
|
367
|
-
- 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`).
|
|
368
378
|
|
|
369
379
|
### Speed Badge
|
|
370
380
|
|
|
371
|
-
- Appears
|
|
381
|
+
- Appears inline beside the LIVE button when multiplier ≠ 1×.
|
|
372
382
|
- Shows `◀ N×` for reverse, `N× ▶` for fast-forward.
|
|
373
383
|
- Clicking resets to 1× speed.
|
|
374
384
|
|
|
@@ -424,7 +434,7 @@ Every label and tooltip in the control bar is overridable via the `labels` prop.
|
|
|
424
434
|
|-----|-------------------|-------|
|
|
425
435
|
| `dateTimeClickTooltip` | `"Click to jump to a date/time"` | Tooltip on the datetime display when `onDateTimeClick` is wired up |
|
|
426
436
|
| `liveLabel` | `"LIVE"` | LIVE button text when not at live time |
|
|
427
|
-
| `liveActiveLabel` | `"
|
|
437
|
+
| `liveActiveLabel` | `"LIVE"` | LIVE button text when at live time (red dot is rendered separately) |
|
|
428
438
|
| `liveTooltip` | `"Jump to live (now)"` | LIVE button tooltip when not at live time |
|
|
429
439
|
| `liveActiveTooltip` | `"Currently live"` | LIVE button tooltip when at live time |
|
|
430
440
|
| `resetSpeedTooltip` | `"Reset to 1× speed"` | Tooltip on the speed-reset badge |
|
|
@@ -454,7 +464,7 @@ const frLabels: Partial<TimelineLabels> = {
|
|
|
454
464
|
playTooltip: 'Lecture',
|
|
455
465
|
pauseTooltip: 'Pause',
|
|
456
466
|
liveLabel: 'EN DIRECT',
|
|
457
|
-
liveActiveLabel: '
|
|
467
|
+
liveActiveLabel: 'EN DIRECT',
|
|
458
468
|
liveTooltip: 'Aller en direct',
|
|
459
469
|
liveActiveTooltip: 'Vous êtes en direct',
|
|
460
470
|
rewindTooltip: 'Retour rapide',
|
|
@@ -480,7 +490,7 @@ export class AppComponent {
|
|
|
480
490
|
playTooltip: 'Lecture',
|
|
481
491
|
pauseTooltip: 'Pause',
|
|
482
492
|
liveLabel: 'EN DIRECT',
|
|
483
|
-
liveActiveLabel: '
|
|
493
|
+
liveActiveLabel: 'EN DIRECT',
|
|
484
494
|
liveTooltip: 'Aller en direct',
|
|
485
495
|
liveActiveTooltip: 'Vous êtes en direct',
|
|
486
496
|
rewindActiveTooltip: (n) => `Retour ${n}× — cliquer pour accélérer`,
|
|
@@ -596,6 +606,12 @@ const CesiumWithTimeline = () => {
|
|
|
596
606
|
onTimeChange={(t) => { clock.currentTime = t; }}
|
|
597
607
|
onPlayPause={(playing) => { clock.shouldAnimate = playing; }}
|
|
598
608
|
onMultiplierChange={(m) => { clock.multiplier = m; }}
|
|
609
|
+
onRangeSelect={(start, end) => {
|
|
610
|
+
// Zoom the Cesium clock range to match the selected span
|
|
611
|
+
clock.startTime = start;
|
|
612
|
+
clock.stopTime = end;
|
|
613
|
+
clock.currentTime = start;
|
|
614
|
+
}}
|
|
599
615
|
/>
|
|
600
616
|
)}
|
|
601
617
|
</div>
|
|
@@ -695,6 +711,90 @@ const StandaloneTimeline = () => {
|
|
|
695
711
|
};
|
|
696
712
|
```
|
|
697
713
|
|
|
714
|
+
### Zoom to Selection
|
|
715
|
+
|
|
716
|
+
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`.
|
|
717
|
+
|
|
718
|
+
A short click (no drag) in the tick area still moves the needle normally.
|
|
719
|
+
|
|
720
|
+
```tsx
|
|
721
|
+
import { useState } from 'react';
|
|
722
|
+
import * as Cesium from 'cesium';
|
|
723
|
+
import { Timeline } from '@kteneyck/cesium-timeline-react';
|
|
724
|
+
|
|
725
|
+
const ZoomableTimeline = () => {
|
|
726
|
+
const [selectedRange, setSelectedRange] = useState<{ start: Date; end: Date } | null>(null);
|
|
727
|
+
|
|
728
|
+
return (
|
|
729
|
+
<>
|
|
730
|
+
{selectedRange && (
|
|
731
|
+
<p>
|
|
732
|
+
Selected: {selectedRange.start.toISOString()} → {selectedRange.end.toISOString()}
|
|
733
|
+
</p>
|
|
734
|
+
)}
|
|
735
|
+
<Timeline
|
|
736
|
+
clock={viewer.clock}
|
|
737
|
+
height={120}
|
|
738
|
+
onRangeSelect={(start, end) => {
|
|
739
|
+
setSelectedRange({
|
|
740
|
+
start: Cesium.JulianDate.toDate(start),
|
|
741
|
+
end: Cesium.JulianDate.toDate(end),
|
|
742
|
+
});
|
|
743
|
+
}}
|
|
744
|
+
/>
|
|
745
|
+
</>
|
|
746
|
+
);
|
|
747
|
+
};
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
In Angular, listen to the `(rangeSelect)` output — the event payload is `{ start: Cesium.JulianDate, end: Cesium.JulianDate }`:
|
|
751
|
+
|
|
752
|
+
```html
|
|
753
|
+
<ct-timeline
|
|
754
|
+
[clock]="viewer.clock"
|
|
755
|
+
[height]="120"
|
|
756
|
+
(rangeSelect)="onRangeSelect($event)"
|
|
757
|
+
/>
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
```typescript
|
|
761
|
+
onRangeSelect(range: { start: Cesium.JulianDate; end: Cesium.JulianDate }) {
|
|
762
|
+
this.viewer.clock.startTime = range.start;
|
|
763
|
+
this.viewer.clock.stopTime = range.end;
|
|
764
|
+
this.viewer.clock.currentTime = range.start;
|
|
765
|
+
}
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
---
|
|
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
|
+
|
|
698
798
|
---
|
|
699
799
|
|
|
700
800
|
## Swim Lanes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
function
|
|
1
|
+
import * as A from "cesium";
|
|
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 Ae = {
|
|
|
36
36
|
"Nov",
|
|
37
37
|
"Dec"
|
|
38
38
|
]
|
|
39
|
-
},
|
|
39
|
+
}, Ee = {
|
|
40
40
|
backgroundColor: "#1a1a1a",
|
|
41
41
|
tickColor: "#666666",
|
|
42
42
|
majorTickColor: "#999999",
|
|
@@ -52,10 +52,11 @@ const Ae = {
|
|
|
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
|
-
const
|
|
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 || {});
|
|
59
|
+
const J = {
|
|
59
60
|
color: "#4da6ff",
|
|
60
61
|
borderColor: "#2980b9",
|
|
61
62
|
borderWidth: 1,
|
|
@@ -64,23 +65,23 @@ const P = {
|
|
|
64
65
|
markerSize: 10,
|
|
65
66
|
labelColor: "#cccccc",
|
|
66
67
|
backgroundColor: "transparent"
|
|
67
|
-
},
|
|
68
|
-
function
|
|
69
|
-
return e instanceof
|
|
68
|
+
}, F = 24;
|
|
69
|
+
function $e(e) {
|
|
70
|
+
return e instanceof A.JulianDate ? A.JulianDate.clone(e) : A.JulianDate.fromDate(e);
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
-
return e instanceof
|
|
72
|
+
function oe(e) {
|
|
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
|
-
return
|
|
78
|
+
function Ie(e) {
|
|
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"], be = ["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 ge = ["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(), f = e.getMonth(), y = e.getDate(), b = e.getHours(), d = b % 12 || 12, u = e.getMinutes(), T = e.getSeconds(), $ = e.getMilliseconds();
|
|
108
|
+
return { yr: p, mo: f, day: y, hr24: b, hr12: d, min: u, sec: T, ms: $, ampm: b < 12 ? "AM" : "PM" };
|
|
108
109
|
}
|
|
109
110
|
const o = new Intl.DateTimeFormat("en-US", {
|
|
110
111
|
timeZone: t,
|
|
@@ -115,105 +116,105 @@ function te(e, t) {
|
|
|
115
116
|
minute: "2-digit",
|
|
116
117
|
second: "2-digit",
|
|
117
118
|
hour12: !1
|
|
118
|
-
}),
|
|
119
|
-
for (const
|
|
120
|
-
|
|
121
|
-
const n = parseInt(
|
|
122
|
-
let
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
return { yr: n, mo: l, day: a, hr24:
|
|
119
|
+
}), s = {};
|
|
120
|
+
for (const p of o.formatToParts(e))
|
|
121
|
+
p.type !== "literal" && (s[p.type] = p.value);
|
|
122
|
+
const n = 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), M = parseInt(s.second), h = e.getMilliseconds();
|
|
126
|
+
return { yr: n, mo: l, day: a, hr24: i, hr12: m, min: c, sec: M, ms: h, ampm: i < 12 ? "AM" : "PM" };
|
|
126
127
|
}
|
|
127
|
-
function
|
|
128
|
+
function Re(e, t) {
|
|
128
129
|
var n;
|
|
129
130
|
if (!t || t === "local") return null;
|
|
130
|
-
const o =
|
|
131
|
+
const o = oe(e);
|
|
131
132
|
return ((n = new Intl.DateTimeFormat("en-US", {
|
|
132
133
|
timeZone: t,
|
|
133
134
|
timeZoneName: "short"
|
|
134
135
|
}).formatToParts(o).find((l) => l.type === "timeZoneName")) == null ? void 0 : n.value) ?? null;
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
-
const
|
|
137
|
+
function ye(e, t = ue.DEFAULT, o) {
|
|
138
|
+
const s = oe(e), { yr: n, mo: l, day: a, hr24: i, hr12: m, min: c, sec: M, ms: h, ampm: p } = ne(s, o), f = (d) => String(d).padStart(2, "0"), y = (d) => String(d).padStart(3, "0"), b = {
|
|
138
139
|
YYYY: String(n),
|
|
139
140
|
YY: String(n).slice(-2),
|
|
140
|
-
MMMM:
|
|
141
|
-
MMM:
|
|
142
|
-
MM:
|
|
141
|
+
MMMM: be[l],
|
|
142
|
+
MMM: Se[l],
|
|
143
|
+
MM: f(l + 1),
|
|
143
144
|
M: String(l + 1),
|
|
144
|
-
DD:
|
|
145
|
+
DD: f(a),
|
|
145
146
|
D: String(a),
|
|
146
|
-
HH:
|
|
147
|
-
H: String(
|
|
148
|
-
hh:
|
|
149
|
-
h: String(
|
|
150
|
-
mm:
|
|
151
|
-
ss:
|
|
152
|
-
SSS:
|
|
153
|
-
A:
|
|
154
|
-
a:
|
|
147
|
+
HH: f(i),
|
|
148
|
+
H: String(i),
|
|
149
|
+
hh: f(m),
|
|
150
|
+
h: String(m),
|
|
151
|
+
mm: f(c),
|
|
152
|
+
ss: f(M),
|
|
153
|
+
SSS: y(h),
|
|
154
|
+
A: p,
|
|
155
|
+
a: p.toLowerCase()
|
|
155
156
|
};
|
|
156
157
|
return t.replace(
|
|
157
158
|
/YYYY|YY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|ss|SSS|A|a/g,
|
|
158
|
-
(
|
|
159
|
+
(d) => b[d] ?? d
|
|
159
160
|
);
|
|
160
161
|
}
|
|
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"],
|
|
162
|
+
function Je(e = ue.DEFAULT) {
|
|
163
|
+
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
164
|
let n = e;
|
|
164
165
|
for (const a of t) n = n.replace(a, "");
|
|
165
166
|
let l = e;
|
|
166
167
|
for (const a of o) l = l.replace(a, "");
|
|
167
|
-
return { timeFormat:
|
|
168
|
+
return { timeFormat: s(n), dateFormat: s(l) };
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
-
return
|
|
170
|
+
function Fe(e, t = !1) {
|
|
171
|
+
return ye(e, t ? "HH:mm:ss" : "HH:mm");
|
|
171
172
|
}
|
|
172
|
-
function
|
|
173
|
-
const n =
|
|
173
|
+
function De(e, t, o, s) {
|
|
174
|
+
const n = N(e), l = N(t), a = N(o);
|
|
174
175
|
if (a === l) return 0;
|
|
175
|
-
const
|
|
176
|
-
return Math.max(0, Math.min(1,
|
|
176
|
+
const i = (n - l) / (a - l);
|
|
177
|
+
return Math.max(0, Math.min(1, i)) * s;
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
-
const n = Math.max(0, Math.min(1, e /
|
|
180
|
-
return
|
|
179
|
+
function Ne(e, t, o, s) {
|
|
180
|
+
const n = Math.max(0, Math.min(1, e / s)), l = N(t), a = N(o), i = l + n * (a - l);
|
|
181
|
+
return A.JulianDate.fromDate(new Date(i));
|
|
181
182
|
}
|
|
182
|
-
function
|
|
183
|
-
const n = [], l =
|
|
184
|
-
let
|
|
185
|
-
typeof o == "number" && o in
|
|
186
|
-
const
|
|
187
|
-
let
|
|
188
|
-
for (;
|
|
189
|
-
const
|
|
190
|
-
new Date(
|
|
183
|
+
function _e(e, t, o, s) {
|
|
184
|
+
const n = [], l = Te(e, t), a = N(e);
|
|
185
|
+
let i;
|
|
186
|
+
typeof o == "number" && o in fe || typeof o == "number" ? i = o * 60 * 1e3 : i = 3600 * 1e3;
|
|
187
|
+
const m = i * 4;
|
|
188
|
+
let c = a, M = 0;
|
|
189
|
+
for (; c <= a + l; ) {
|
|
190
|
+
const h = M * i % m === 0, p = De(
|
|
191
|
+
new Date(c),
|
|
191
192
|
e,
|
|
192
193
|
t,
|
|
193
|
-
|
|
194
|
+
s
|
|
194
195
|
);
|
|
195
|
-
let
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
|
|
196
|
+
let f;
|
|
197
|
+
if (h) {
|
|
198
|
+
const y = new Date(c), b = y.getHours().toString().padStart(2, "0"), d = y.getMinutes().toString().padStart(2, "0");
|
|
199
|
+
f = `${b}:${d}`;
|
|
199
200
|
}
|
|
200
201
|
n.push({
|
|
201
|
-
position:
|
|
202
|
-
isMajor:
|
|
203
|
-
label:
|
|
204
|
-
}),
|
|
202
|
+
position: p,
|
|
203
|
+
isMajor: h,
|
|
204
|
+
label: f
|
|
205
|
+
}), c += i, M++;
|
|
205
206
|
}
|
|
206
207
|
return n;
|
|
207
208
|
}
|
|
208
|
-
function
|
|
209
|
-
let
|
|
209
|
+
function We(e, t, o = 10) {
|
|
210
|
+
let s = t[0], n = Math.abs(s.position - e);
|
|
210
211
|
for (const l of t) {
|
|
211
212
|
const a = Math.abs(l.position - e);
|
|
212
|
-
a < n && (n = a,
|
|
213
|
+
a < n && (n = a, s = l);
|
|
213
214
|
}
|
|
214
|
-
return n <= o ?
|
|
215
|
+
return n <= o ? s.position : e;
|
|
215
216
|
}
|
|
216
|
-
const
|
|
217
|
+
const ke = 1e3, Le = 31536e9, L = [
|
|
217
218
|
1e-3,
|
|
218
219
|
2e-3,
|
|
219
220
|
5e-3,
|
|
@@ -262,85 +263,85 @@ const be = 1e3, De = 31536e9, D = [
|
|
|
262
263
|
126144e5,
|
|
263
264
|
15768e6,
|
|
264
265
|
31536e6
|
|
265
|
-
], G = 36, O = 1,
|
|
266
|
-
function
|
|
266
|
+
], G = 36, O = 1, He = 6, ee = 6, Oe = 0.3, Ae = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
267
|
+
function E(e) {
|
|
267
268
|
return e < 10 ? `0${e}` : `${e}`;
|
|
268
269
|
}
|
|
269
|
-
function
|
|
270
|
-
const l = new Date(e), { yr: a, mo:
|
|
270
|
+
function ce(e, t, o, s, n) {
|
|
271
|
+
const l = new Date(e), { yr: a, mo: i, day: m, hr24: c, hr12: M, min: h, sec: p, ms: f, ampm: y } = ne(l, o), b = s ? M : c, d = s ? ` ${y}` : "", u = n ?? Ae;
|
|
271
272
|
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 `${
|
|
273
|
+
if (t > 31536e3) return `${u[i]} ${a}`;
|
|
274
|
+
if (t > 604800) return `${u[i]} ${m}`;
|
|
275
|
+
if (t > 86400) return `${u[i]} ${m} ${E(b)}:${E(h)}${d}`;
|
|
276
|
+
if (t > 3600) return `${E(b)}:${E(h)}${d}`;
|
|
277
|
+
if (t > 60) return `${E(b)}:${E(h)}:${E(p)}${d}`;
|
|
278
|
+
const T = f > 0 ? `.${String(f).padStart(3, "0")}` : "";
|
|
279
|
+
return `${E(b)}:${E(h)}:${E(p)}${T}${d}`;
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
-
const
|
|
281
|
+
function Ce(e, t, o) {
|
|
282
|
+
const s = new Date(e);
|
|
282
283
|
if (!o || o === "local") {
|
|
283
|
-
const
|
|
284
|
-
return t > 31536e4 ? new Date(Math.floor(
|
|
284
|
+
const m = s.getFullYear(), c = s.getMonth(), M = s.getDate();
|
|
285
|
+
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, M).getTime();
|
|
285
286
|
}
|
|
286
|
-
const { yr: n, hr24: l, min: a, sec:
|
|
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 +
|
|
287
|
+
const { yr: n, hr24: l, min: a, sec: i } = ne(s, o);
|
|
288
|
+
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 + i) * 1e3;
|
|
288
289
|
}
|
|
289
|
-
function
|
|
290
|
+
function te(e, t) {
|
|
290
291
|
return Math.ceil(e / t + 0.5) * t;
|
|
291
292
|
}
|
|
292
|
-
function
|
|
293
|
-
var
|
|
293
|
+
function he(e, t, o) {
|
|
294
|
+
var s, n, l, a, i, m, c, M, h, p, f, y;
|
|
294
295
|
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: ((
|
|
298
|
-
opacity: ((
|
|
299
|
-
markerShape: ((
|
|
300
|
-
markerSize: ((
|
|
296
|
+
color: ((s = t.style) == null ? void 0 : s.color) ?? ((n = e.style) == null ? void 0 : n.color) ?? J.color,
|
|
297
|
+
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,
|
|
298
|
+
borderWidth: ((i = t.style) == null ? void 0 : i.borderWidth) ?? ((m = e.style) == null ? void 0 : m.borderWidth) ?? (o == null ? void 0 : o.swimLaneItemBorderWidth) ?? J.borderWidth,
|
|
299
|
+
opacity: ((c = t.style) == null ? void 0 : c.opacity) ?? ((M = e.style) == null ? void 0 : M.opacity) ?? J.opacity,
|
|
300
|
+
markerShape: ((h = t.style) == null ? void 0 : h.markerShape) ?? ((p = e.style) == null ? void 0 : p.markerShape) ?? J.markerShape,
|
|
301
|
+
markerSize: ((f = t.style) == null ? void 0 : f.markerSize) ?? ((y = e.style) == null ? void 0 : y.markerSize) ?? J.markerSize
|
|
301
302
|
};
|
|
302
303
|
}
|
|
303
|
-
function
|
|
304
|
-
return Math.max(
|
|
304
|
+
function pe(e) {
|
|
305
|
+
return Math.max(ke, Math.min(Le, e));
|
|
305
306
|
}
|
|
306
|
-
function
|
|
307
|
-
const
|
|
307
|
+
function Ue(e, t, o) {
|
|
308
|
+
const s = t - e, n = (e + t) / 2, l = pe(s * o);
|
|
308
309
|
return {
|
|
309
310
|
startMs: n - l / 2,
|
|
310
311
|
endMs: n + l / 2
|
|
311
312
|
};
|
|
312
313
|
}
|
|
313
|
-
function
|
|
314
|
-
const n = t - e, l =
|
|
314
|
+
function ve(e, t, o, s) {
|
|
315
|
+
const n = t - e, l = pe(n * o), a = n > 0 ? (s - e) / n : 0.5;
|
|
315
316
|
return {
|
|
316
|
-
startMs:
|
|
317
|
-
endMs:
|
|
317
|
+
startMs: s - a * l,
|
|
318
|
+
endMs: s + (1 - a) * l
|
|
318
319
|
};
|
|
319
320
|
}
|
|
320
|
-
function
|
|
321
|
+
function Be(e) {
|
|
321
322
|
let t = 0;
|
|
322
|
-
for (const o of e) t += (o.height ??
|
|
323
|
+
for (const o of e) t += (o.height ?? F) + O;
|
|
323
324
|
return t;
|
|
324
325
|
}
|
|
325
|
-
function
|
|
326
|
-
const { swimLanes: l, showSwimLanes: a, scrollTop:
|
|
326
|
+
function ze(e, t, o, s, n) {
|
|
327
|
+
const { swimLanes: l, showSwimLanes: a, scrollTop: i, startMs: m, endMs: c, theme: M } = n;
|
|
327
328
|
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:
|
|
329
|
+
const h = Math.max(0, s - G);
|
|
330
|
+
if (t < 0 || t >= h) return null;
|
|
331
|
+
let p = -i;
|
|
332
|
+
for (const f of l) {
|
|
333
|
+
const y = f.height ?? F, b = p, d = p + y;
|
|
334
|
+
if (p += y + O, !(t < b || t >= d)) {
|
|
335
|
+
for (const u of f.items) {
|
|
336
|
+
if (u.interval) {
|
|
337
|
+
const T = A.JulianDate.toDate(u.interval.start).getTime(), $ = A.JulianDate.toDate(u.interval.stop).getTime(), j = (T - m) / (c - m) * o, C = ($ - m) / (c - m) * o;
|
|
338
|
+
if (e >= Math.max(0, j) && e <= Math.min(o, C))
|
|
339
|
+
return { lane: f, item: u };
|
|
339
340
|
}
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
if (Math.abs(e -
|
|
343
|
-
return { lane:
|
|
341
|
+
if (u.instant) {
|
|
342
|
+
const $ = (A.JulianDate.toDate(u.instant).getTime() - m) / (c - m) * o, j = he(f, u, M);
|
|
343
|
+
if (Math.abs(e - $) <= j.markerSize / 2 + 2)
|
|
344
|
+
return { lane: f, item: u };
|
|
344
345
|
}
|
|
345
346
|
}
|
|
346
347
|
return null;
|
|
@@ -348,195 +349,205 @@ function Be(e, t, o, i, n) {
|
|
|
348
349
|
}
|
|
349
350
|
return null;
|
|
350
351
|
}
|
|
351
|
-
function
|
|
352
|
-
const { swimLanes: n, showSwimLanes: l, scrollTop: a } =
|
|
352
|
+
function je(e, t, o, s) {
|
|
353
|
+
const { swimLanes: n, showSwimLanes: l, scrollTop: a } = s;
|
|
353
354
|
if (!l || n.length === 0 || e > 80) return null;
|
|
354
|
-
const
|
|
355
|
-
if (t < 0 || t >=
|
|
356
|
-
let
|
|
357
|
-
for (const
|
|
358
|
-
const
|
|
359
|
-
if (t >=
|
|
360
|
-
|
|
355
|
+
const i = Math.max(0, o - G);
|
|
356
|
+
if (t < 0 || t >= i) return null;
|
|
357
|
+
let m = -a;
|
|
358
|
+
for (const c of n) {
|
|
359
|
+
const M = c.height ?? F;
|
|
360
|
+
if (t >= m && t < m + M) return c;
|
|
361
|
+
m += M + O;
|
|
361
362
|
}
|
|
362
363
|
return null;
|
|
363
364
|
}
|
|
364
|
-
function
|
|
365
|
+
function Xe(e, t, o) {
|
|
365
366
|
if (!o.showSwimLanes || o.swimLanes.length === 0) return !1;
|
|
366
|
-
const
|
|
367
|
-
return e >= 0 && e <
|
|
367
|
+
const s = Math.max(0, t - G);
|
|
368
|
+
return e >= 0 && e < s;
|
|
368
369
|
}
|
|
369
|
-
function
|
|
370
|
+
function Ge(e, t, o, s) {
|
|
370
371
|
const {
|
|
371
372
|
startMs: n,
|
|
372
373
|
endMs: l,
|
|
373
374
|
currentMs: a,
|
|
374
|
-
theme:
|
|
375
|
-
maxTicks:
|
|
376
|
-
swimLanes:
|
|
377
|
-
showSwimLanes:
|
|
378
|
-
reorderState:
|
|
379
|
-
timezone:
|
|
380
|
-
use12h:
|
|
381
|
-
months:
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
375
|
+
theme: i,
|
|
376
|
+
maxTicks: m,
|
|
377
|
+
swimLanes: c,
|
|
378
|
+
showSwimLanes: M,
|
|
379
|
+
reorderState: h,
|
|
380
|
+
timezone: p,
|
|
381
|
+
use12h: f,
|
|
382
|
+
months: y,
|
|
383
|
+
rangeSelection: b,
|
|
384
|
+
hoverMs: d
|
|
385
|
+
} = s;
|
|
386
|
+
let { scrollTop: u } = s;
|
|
387
|
+
const T = (l - n) / 1e3;
|
|
388
|
+
if (T <= 0) return u;
|
|
389
|
+
e.fillStyle = i.backgroundColor, e.fillRect(0, 0, t, o);
|
|
390
|
+
const $ = M && c.length > 0, C = $ ? Math.max(0, o - G) : 0;
|
|
391
|
+
let X = 0;
|
|
392
|
+
if ($)
|
|
393
|
+
for (const r of c) X += (r.height ?? F) + O;
|
|
394
|
+
const Z = Math.max(0, X - C);
|
|
395
|
+
if (u > Z && (u = Z), u < 0 && (u = 0), $ && C > 0) {
|
|
396
|
+
e.save(), e.beginPath(), e.rect(0, 0, t, C), e.clip();
|
|
397
|
+
let r = -u;
|
|
398
|
+
const D = (k) => (k - n) / (l - n) * t;
|
|
399
|
+
for (const k of c) {
|
|
400
|
+
const S = k.height ?? F, Y = r + S;
|
|
401
|
+
if (Y > 0 && r < C) {
|
|
402
|
+
const g = k.style, U = (g == null ? void 0 : g.backgroundColor) ?? J.backgroundColor;
|
|
403
|
+
U && U !== "transparent" && (e.fillStyle = U, e.fillRect(0, r, t, S)), e.strokeStyle = i.tickColor + "44", e.lineWidth = 0.5, e.beginPath(), e.moveTo(0, Y), e.lineTo(t, Y), e.stroke();
|
|
404
|
+
for (const I of k.items) {
|
|
405
|
+
const H = he(k, I, i);
|
|
406
|
+
if (I.interval) {
|
|
407
|
+
const q = A.JulianDate.toDate(I.interval.start).getTime(), w = A.JulianDate.toDate(I.interval.stop).getTime(), _ = D(q), W = D(w), Q = Math.max(0, _), x = Math.min(t, W) - Q;
|
|
408
|
+
if (x > 0) {
|
|
406
409
|
e.globalAlpha = H.opacity, e.fillStyle = H.color;
|
|
407
|
-
const
|
|
408
|
-
e.fillRect(
|
|
410
|
+
const le = 3, ae = r + le, me = S - le * 2;
|
|
411
|
+
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;
|
|
409
412
|
}
|
|
410
413
|
}
|
|
411
|
-
if (
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
const _ =
|
|
415
|
-
e.globalAlpha = H.opacity, e.fillStyle = H.color, H.markerShape === "diamond" ? (e.beginPath(), e.moveTo(
|
|
414
|
+
if (I.instant) {
|
|
415
|
+
const q = A.JulianDate.toDate(I.instant).getTime(), w = D(q);
|
|
416
|
+
if (w >= -H.markerSize && w <= t + H.markerSize) {
|
|
417
|
+
const _ = r + S / 2, W = H.markerSize;
|
|
418
|
+
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, r + 2), e.lineTo(w, r + S - 2), e.stroke()), e.globalAlpha = 1;
|
|
416
419
|
}
|
|
417
420
|
}
|
|
418
421
|
}
|
|
419
|
-
e.font = `${Math.min(11,
|
|
422
|
+
e.font = `${Math.min(11, S - 4)}px system-ui, sans-serif`, e.textAlign = "left", e.textBaseline = "middle", e.fillStyle = (g == null ? void 0 : g.labelColor) ?? J.labelColor, e.fillText(k.label, He, r + S / 2);
|
|
420
423
|
}
|
|
421
|
-
if (
|
|
424
|
+
if (r += S + O, r >= C) break;
|
|
422
425
|
}
|
|
423
|
-
if (
|
|
424
|
-
const k =
|
|
425
|
-
let
|
|
426
|
-
for (let g = 0; g <
|
|
427
|
-
|
|
428
|
-
e.strokeStyle =
|
|
429
|
-
const
|
|
430
|
-
if (
|
|
431
|
-
const g =
|
|
432
|
-
let U = -
|
|
433
|
-
for (const
|
|
434
|
-
if (
|
|
435
|
-
U += (
|
|
426
|
+
if (h && h.dragging) {
|
|
427
|
+
const k = h.currentY - h.dragStartY;
|
|
428
|
+
let S = -u;
|
|
429
|
+
for (let g = 0; g < c.length && g < h.insertIndex; g++)
|
|
430
|
+
S += (c[g].height ?? F) + O;
|
|
431
|
+
e.strokeStyle = i.indicatorColor, e.lineWidth = 2, e.beginPath(), e.moveTo(0, S), e.lineTo(t, S), e.stroke();
|
|
432
|
+
const Y = c.find((g) => g.id === h.dragLaneId);
|
|
433
|
+
if (Y) {
|
|
434
|
+
const g = Y.height ?? F;
|
|
435
|
+
let U = -u;
|
|
436
|
+
for (const I of c) {
|
|
437
|
+
if (I.id === h.dragLaneId) break;
|
|
438
|
+
U += (I.height ?? F) + O;
|
|
436
439
|
}
|
|
437
|
-
e.globalAlpha = 0.4, e.fillStyle =
|
|
440
|
+
e.globalAlpha = 0.4, e.fillStyle = i.indicatorColor, e.fillRect(0, U + k, t, g), e.globalAlpha = 1;
|
|
438
441
|
}
|
|
439
442
|
}
|
|
440
|
-
if (
|
|
441
|
-
const k = t -
|
|
442
|
-
e.fillStyle =
|
|
443
|
+
if (X > C) {
|
|
444
|
+
const k = t - ee - 2, S = C / X, Y = Math.max(20, C * S), g = u / Z * (C - Y);
|
|
445
|
+
e.fillStyle = i.tickColor + "22", e.fillRect(k, 0, ee, C), e.fillStyle = i.tickColor + "88", e.fillRect(k, g, ee, Y);
|
|
443
446
|
}
|
|
444
447
|
e.restore();
|
|
445
448
|
}
|
|
446
|
-
e.font = `${
|
|
447
|
-
const
|
|
448
|
-
let
|
|
449
|
-
for (let
|
|
450
|
-
if (
|
|
451
|
-
|
|
449
|
+
e.font = `${i.fontSize}px monospace`;
|
|
450
|
+
const Me = ce(n + T * 500, T, p, f, y), de = e.measureText(Me).width + 24, ge = Math.max(de / t * T, T / 1e3);
|
|
451
|
+
let P = L[L.length - 1], v = L.length - 1;
|
|
452
|
+
for (let r = 0; r < L.length; r++)
|
|
453
|
+
if (L[r] > ge) {
|
|
454
|
+
P = L[r], v = r;
|
|
452
455
|
break;
|
|
453
456
|
}
|
|
454
|
-
if (
|
|
455
|
-
for (; v <
|
|
456
|
-
v++,
|
|
457
|
-
let
|
|
458
|
-
for (let
|
|
459
|
-
if (
|
|
460
|
-
t * (
|
|
457
|
+
if (m != null && m > 0)
|
|
458
|
+
for (; v < L.length - 1 && T / P > m; )
|
|
459
|
+
v++, P = L[v];
|
|
460
|
+
let R = 0;
|
|
461
|
+
for (let r = v - 1; r >= 0; r--)
|
|
462
|
+
if (P % L[r] < 1e-4) {
|
|
463
|
+
t * (L[r] / T) >= 3 && (R = L[r]);
|
|
461
464
|
break;
|
|
462
465
|
}
|
|
463
|
-
let
|
|
464
|
-
if (
|
|
465
|
-
for (let
|
|
466
|
-
if (
|
|
467
|
-
|
|
466
|
+
let B = 0;
|
|
467
|
+
if (R > 0) {
|
|
468
|
+
for (let r = 0; r < L.length && L[r] < R; r++)
|
|
469
|
+
if (R % L[r] < 1e-4 && t * (L[r] / T) >= 3) {
|
|
470
|
+
B = L[r];
|
|
468
471
|
break;
|
|
469
472
|
}
|
|
470
473
|
}
|
|
471
|
-
const
|
|
472
|
-
if (
|
|
473
|
-
e.strokeStyle =
|
|
474
|
-
for (let
|
|
475
|
-
const
|
|
476
|
-
e.beginPath(), e.moveTo(
|
|
474
|
+
const re = Ce(n, T, p), z = (n - re) / 1e3, K = z + T, V = (r) => t * ((r - z) / T);
|
|
475
|
+
if (B > 0) {
|
|
476
|
+
e.strokeStyle = i.tickColor, e.lineWidth = 1;
|
|
477
|
+
for (let r = Math.floor(z / B) * B; r <= K; r = te(r, B)) {
|
|
478
|
+
const D = V(r);
|
|
479
|
+
e.beginPath(), e.moveTo(D, o - i.minorTickHeight), e.lineTo(D, o), e.stroke();
|
|
477
480
|
}
|
|
478
481
|
}
|
|
479
|
-
if (
|
|
480
|
-
e.strokeStyle =
|
|
481
|
-
for (let
|
|
482
|
-
const
|
|
483
|
-
e.beginPath(), e.moveTo(
|
|
482
|
+
if (R > 0) {
|
|
483
|
+
e.strokeStyle = i.tickColor, e.lineWidth = 1;
|
|
484
|
+
for (let r = Math.floor(z / R) * R; r <= K; r = te(r, R)) {
|
|
485
|
+
const D = V(r);
|
|
486
|
+
e.beginPath(), e.moveTo(D, o - i.minorTickHeight), e.lineTo(D, o), e.stroke();
|
|
484
487
|
}
|
|
485
488
|
}
|
|
486
489
|
e.textAlign = "center", e.textBaseline = "bottom";
|
|
487
|
-
let
|
|
488
|
-
for (let
|
|
489
|
-
const
|
|
490
|
-
e.strokeStyle =
|
|
491
|
-
const
|
|
492
|
-
g >
|
|
490
|
+
let ie = -1 / 0;
|
|
491
|
+
for (let r = Math.floor(z / P) * P; r <= K + P; r = te(r, P)) {
|
|
492
|
+
const D = V(r), k = re + r * 1e3;
|
|
493
|
+
e.strokeStyle = i.majorTickColor, e.lineWidth = 1, e.beginPath(), e.moveTo(D, o - i.majorTickHeight), e.lineTo(D, o), e.stroke();
|
|
494
|
+
const S = ce(k, T, p, f, y), Y = e.measureText(S).width, g = D - Y / 2;
|
|
495
|
+
g > ie && (e.fillStyle = i.labelColor, e.fillText(S, D, o - i.majorTickHeight - 4), ie = g + Y + 5);
|
|
496
|
+
}
|
|
497
|
+
if (b) {
|
|
498
|
+
const r = (b.startMs - n) / (l - n) * t, D = (b.endMs - n) / (l - n) * t, k = Math.min(r, D), S = Math.abs(D - r);
|
|
499
|
+
e.globalAlpha = 0.2, e.fillStyle = i.indicatorColor, e.fillRect(k, 0, S, o), e.globalAlpha = 1;
|
|
500
|
+
}
|
|
501
|
+
const se = (a - n) / (l - n) * t;
|
|
502
|
+
if (e.strokeStyle = i.indicatorColor, e.lineWidth = i.indicatorLineWidth, e.beginPath(), e.moveTo(se, 0), e.lineTo(se, o), e.stroke(), d != null) {
|
|
503
|
+
const r = (d - n) / (l - n) * t;
|
|
504
|
+
e.globalAlpha = 0.15, e.strokeStyle = i.indicatorColor, e.lineWidth = i.indicatorLineWidth, e.beginPath(), e.moveTo(r, 0), e.lineTo(r, o), e.stroke(), e.globalAlpha = 1;
|
|
493
505
|
}
|
|
494
|
-
|
|
495
|
-
return e.strokeStyle = r.indicatorColor, e.lineWidth = r.indicatorLineWidth, e.beginPath(), e.moveTo(re, 0), e.lineTo(re, o), e.stroke(), h;
|
|
506
|
+
return u;
|
|
496
507
|
}
|
|
497
508
|
export {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
509
|
+
we as DEFAULT_LABELS,
|
|
510
|
+
F as DEFAULT_LANE_HEIGHT,
|
|
511
|
+
ue as DateTimeFormats,
|
|
512
|
+
He as LABEL_PAD_LEFT,
|
|
502
513
|
O as LANE_GAP,
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
514
|
+
Le as MAX_SPAN_MS,
|
|
515
|
+
ke as MIN_SPAN_MS,
|
|
516
|
+
Ae as MONTHS,
|
|
517
|
+
ee as SCROLLBAR_WIDTH,
|
|
518
|
+
Oe as SWIM_LANE_SCROLL_SPEED,
|
|
508
519
|
G as TICK_AREA_HEIGHT,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
520
|
+
L as TIC_SCALES,
|
|
521
|
+
fe as TickInterval,
|
|
522
|
+
Pe as Timezones,
|
|
523
|
+
Ce as calcEpochMs,
|
|
524
|
+
pe as clampSpan,
|
|
525
|
+
J as defaultSwimLaneStyle,
|
|
526
|
+
Ee as defaultTheme,
|
|
527
|
+
Ge as drawTimeline,
|
|
528
|
+
ye as formatDateTime,
|
|
529
|
+
Fe as formatTime,
|
|
530
|
+
Ie as fromMilliseconds,
|
|
531
|
+
_e as generateTicks,
|
|
532
|
+
ne as getDateParts,
|
|
533
|
+
Te as getDurationMs,
|
|
534
|
+
Re as getTimezoneAbbr,
|
|
535
|
+
je as hitTestLaneLabel,
|
|
536
|
+
ze as hitTestSwimLane,
|
|
537
|
+
Xe as isInSwimLaneRegion,
|
|
538
|
+
ce as makeLabel,
|
|
539
|
+
te as nextTic,
|
|
540
|
+
Ne as positionToTime,
|
|
541
|
+
he as resolveItemStyle,
|
|
542
|
+
Ye as resolveLabel,
|
|
543
|
+
We as snapToTick,
|
|
533
544
|
Je as splitForDisplay,
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
545
|
+
De as timeToPosition,
|
|
546
|
+
oe as toDate,
|
|
547
|
+
$e as toJulianDate,
|
|
548
|
+
N as toMilliseconds,
|
|
549
|
+
Be as totalSwimLaneHeight,
|
|
550
|
+
E as twoD,
|
|
551
|
+
ve as zoomAroundMs,
|
|
552
|
+
Ue as zoomRange
|
|
542
553
|
};
|
|
@@ -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(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 ke(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,l.get?l:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const 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(),u=e.getMonth(),L=e.getDate(),y=e.getHours(),g=y%12||12,h=e.getMinutes(),p=e.getSeconds(),R=e.getMilliseconds();return{yr:T,mo:u,day:L,hr24:y,hr12:g,min:h,sec:p,ms:R,ampm:y<12?"AM":"PM"}}const o=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),l={};for(const T of o.formatToParts(e))T.type!=="literal"&&(l[T.type]=T.value);const n=parseInt(l.year),s=parseInt(l.month)-1,m=parseInt(l.day);let r=parseInt(l.hour);r===24&&(r=0);const c=r%12||12,f=parseInt(l.minute),M=parseInt(l.second),d=e.getMilliseconds();return{yr:n,mo:s,day:m,hr24:r,hr12:c,min:f,sec:M,ms:d,ampm:r<12?"AM":"PM"}}function Ne(e,t){var n;if(!t||t==="local")return null;const o=K(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 ue(e,t=te.DEFAULT,o){const l=K(e),{yr:n,mo:s,day:m,hr24:r,hr12:c,min:f,sec:M,ms:d,ampm:T}=Z(l,o),u=g=>String(g).padStart(2,"0"),L=g=>String(g).padStart(3,"0"),y={YYYY:String(n),YY:String(n).slice(-2),MMMM:Ie[s],MMM:Ye[s],MM:u(s+1),M:String(s+1),DD:u(m),D:String(m),HH:u(r),H:String(r),hh:u(c),h:String(c),mm:u(f),ss:u(M),SSS:L(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,g=>y[g]??g)}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"],l=m=>m.replace(/\s{2,}/g," ").trim().replace(/^[\s\W]+|[\s\W]+$/g,"").trim();let n=e;for(const m of t)n=n.replace(m,"");let s=e;for(const m of o)s=s.replace(m,"");return{timeFormat:l(n),dateFormat:l(s)}}function Fe(e,t=!1){return ue(e,t?"HH:mm:ss":"HH:mm")}function he(e,t,o,l){const n=N(e),s=N(t),m=N(o);if(m===s)return 0;const r=(n-s)/(m-s);return Math.max(0,Math.min(1,r))*l}function $e(e,t,o,l){const n=Math.max(0,Math.min(1,e/l)),s=N(t),m=N(o),r=s+n*(m-s);return H.JulianDate.fromDate(new Date(r))}function Oe(e,t,o,l){const n=[],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,M=0;for(;f<=m+s;){const d=M*r%c===0,T=he(new Date(f),e,t,l);let u;if(d){const L=new Date(f),y=L.getHours().toString().padStart(2,"0"),g=L.getMinutes().toString().padStart(2,"0");u=`${y}:${g}`}n.push({position:T,isMajor:d,label:u}),f+=r,M++}return n}function Je(e,t,o=10){let l=t[0],n=Math.abs(l.position-e);for(const s of t){const m=Math.abs(s.position-e);m<n&&(n=m,l=s)}return n<=o?l.position:e}const de=1e3,Te=31536e9,D=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],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,l,n){const s=new Date(e),{yr:m,mo:r,day:c,hr24:f,hr12:M,min:d,sec:T,ms:u,ampm:L}=Z(s,o),y=l?M:f,g=l?` ${L}`:"",h=n??ge;if(t>31536e4)return`${m}`;if(t>31536e3)return`${h[r]} ${m}`;if(t>604800)return`${h[r]} ${c}`;if(t>86400)return`${h[r]} ${c} ${w(y)}:${w(d)}${g}`;if(t>3600)return`${w(y)}:${w(d)}${g}`;if(t>60)return`${w(y)}:${w(d)}:${w(T)}${g}`;const p=u>0?`.${String(u).padStart(3,"0")}`:"";return`${w(y)}:${w(d)}:${w(T)}${p}${g}`}function Se(e,t,o){const l=new Date(e);if(!o||o==="local"){const c=l.getFullYear(),f=l.getMonth(),M=l.getDate();return t>31536e4?new Date(Math.floor(c/100)*100,0).getTime():t>31536e3?new Date(Math.floor(c/10)*10,0).getTime():t>86400?new Date(c,0).getTime():new Date(c,f,M).getTime()}const{yr:n,hr24:s,min:m,sec:r}=Z(l,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+m*60+r)*1e3}function q(e,t){return Math.ceil(e/t+.5)*t}function ne(e,t,o){var l,n,s,m,r,c,f,M,d,T,u,L;return{color:((l=t.style)==null?void 0:l.color)??((n=e.style)==null?void 0:n.color)??I.color,borderColor:((s=t.style)==null?void 0:s.borderColor)??((m=e.style)==null?void 0:m.borderColor)??(o==null?void 0:o.swimLaneItemBorderColor)??I.borderColor,borderWidth:((r=t.style)==null?void 0:r.borderWidth)??((c=e.style)==null?void 0:c.borderWidth)??(o==null?void 0:o.swimLaneItemBorderWidth)??I.borderWidth,opacity:((f=t.style)==null?void 0:f.opacity)??((M=e.style)==null?void 0:M.opacity)??I.opacity,markerShape:((d=t.style)==null?void 0:d.markerShape)??((T=e.style)==null?void 0:T.markerShape)??I.markerShape,markerSize:((u=t.style)==null?void 0:u.markerSize)??((L=e.style)==null?void 0:L.markerSize)??I.markerSize}}function ie(e){return Math.max(de,Math.min(Te,e))}function ve(e,t,o){const l=t-e,n=(e+t)/2,s=ie(l*o);return{startMs:n-s/2,endMs:n+s/2}}function Ue(e,t,o,l){const n=t-e,s=ie(n*o),m=n>0?(l-e)/n:.5;return{startMs:l-m*s,endMs:l+(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,l,n){const{swimLanes:s,showSwimLanes:m,scrollTop:r,startMs:c,endMs:f,theme:M}=n;if(!m||s.length===0)return null;const d=Math.max(0,l-j);if(t<0||t>=d)return null;let T=-r;for(const u of s){const L=u.height??P,y=T,g=T+L;if(T+=L+$,!(t<y||t>=g)){for(const h of u.items){if(h.interval){const p=H.JulianDate.toDate(h.interval.start).getTime(),R=H.JulianDate.toDate(h.interval.stop).getTime(),Q=(p-c)/(f-c)*o,E=(R-c)/(f-c)*o;if(e>=Math.max(0,Q)&&e<=Math.min(o,E))return{lane:u,item:h}}if(h.instant){const R=(H.JulianDate.toDate(h.instant).getTime()-c)/(f-c)*o,Q=ne(u,h,M);if(Math.abs(e-R)<=Q.markerSize/2+2)return{lane:u,item:h}}}return null}}return null}function ze(e,t,o,l){const{swimLanes:n,showSwimLanes:s,scrollTop:m}=l;if(!s||n.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 n){const M=f.height??P;if(t>=c&&t<c+M)return f;c+=M+$}return null}function Xe(e,t,o){if(!o.showSwimLanes||o.swimLanes.length===0)return!1;const l=Math.max(0,t-j);return e>=0&&e<l}function Ge(e,t,o,l){const{startMs:n,endMs:s,currentMs:m,theme:r,maxTicks:c,swimLanes:f,showSwimLanes:M,reorderState:d,timezone:T,use12h:u,months:L,rangeSelection:y,hoverMs:g}=l;let{scrollTop:h}=l;const p=(s-n)/1e3;if(p<=0)return h;e.fillStyle=r.backgroundColor,e.fillRect(0,0,t,o);const R=M&&f.length>0,E=R?Math.max(0,o-j):0;let x=0;if(R)for(const i of f)x+=(i.height??P)+$;const re=Math.max(0,x-E);if(h>re&&(h=re),h<0&&(h=0),R&&E>0){e.save(),e.beginPath(),e.rect(0,0,t,E),e.clip();let i=-h;const A=k=>(k-n)/(s-n)*t;for(const k of f){const b=k.height??P,_=i+b;if(_>0&&i<E){const S=k.style,U=(S==null?void 0:S.backgroundColor)??I.backgroundColor;U&&U!=="transparent"&&(e.fillStyle=U,e.fillRect(0,i,t,b)),e.strokeStyle=r.tickColor+"44",e.lineWidth=.5,e.beginPath(),e.moveTo(0,_),e.lineTo(t,_),e.stroke();for(const F of k.items){const C=ne(k,F,r);if(F.interval){const se=H.JulianDate.toDate(F.interval.start).getTime(),Y=H.JulianDate.toDate(F.interval.stop).getTime(),W=A(se),v=A(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=i+De,Ae=b-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=A(se);if(Y>=-C.markerSize&&Y<=t+C.markerSize){const W=i+b/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,i+2),e.lineTo(Y,i+b-2),e.stroke()),e.globalAlpha=1}}}e.font=`${Math.min(11,b-4)}px system-ui, sans-serif`,e.textAlign="left",e.textBaseline="middle",e.fillStyle=(S==null?void 0:S.labelColor)??I.labelColor,e.fillText(k.label,Me,i+b/2)}if(i+=b+$,i>=E)break}if(d&&d.dragging){const k=d.currentY-d.dragStartY;let b=-h;for(let S=0;S<f.length&&S<d.insertIndex;S++)b+=(f[S].height??P)+$;e.strokeStyle=r.indicatorColor,e.lineWidth=2,e.beginPath(),e.moveTo(0,b),e.lineTo(t,b),e.stroke();const _=f.find(S=>S.id===d.dragLaneId);if(_){const S=_.height??P;let U=-h;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+k,t,S),e.globalAlpha=1}}if(x>E){const k=t-V-2,b=E/x,_=Math.max(20,E*b),S=h/re*(E-_);e.fillStyle=r.tickColor+"22",e.fillRect(k,0,V,E),e.fillStyle=r.tickColor+"88",e.fillRect(k,S,V,_)}e.restore()}e.font=`${r.fontSize}px monospace`;const Ke=oe(n+p*500,p,T,u,L),Ze=e.measureText(Ke).width+24,Ve=Math.max(Ze/t*p,p/1e3);let O=D[D.length-1],z=D.length-1;for(let i=0;i<D.length;i++)if(D[i]>Ve){O=D[i],z=i;break}if(c!=null&&c>0)for(;z<D.length-1&&p/O>c;)z++,O=D[z];let J=0;for(let i=z-1;i>=0;i--)if(O%D[i]<1e-4){t*(D[i]/p)>=3&&(J=D[i]);break}let X=0;if(J>0){for(let i=0;i<D.length&&D[i]<J;i++)if(J%D[i]<1e-4&&t*(D[i]/p)>=3){X=D[i];break}}const pe=Se(n,p,T),G=(n-pe)/1e3,le=G+p,ae=i=>t*((i-G)/p);if(X>0){e.strokeStyle=r.tickColor,e.lineWidth=1;for(let i=Math.floor(G/X)*X;i<=le;i=q(i,X)){const A=ae(i);e.beginPath(),e.moveTo(A,o-r.minorTickHeight),e.lineTo(A,o),e.stroke()}}if(J>0){e.strokeStyle=r.tickColor,e.lineWidth=1;for(let i=Math.floor(G/J)*J;i<=le;i=q(i,J)){const A=ae(i);e.beginPath(),e.moveTo(A,o-r.minorTickHeight),e.lineTo(A,o),e.stroke()}}e.textAlign="center",e.textBaseline="bottom";let be=-1/0;for(let i=Math.floor(G/O)*O;i<=le+O;i=q(i,O)){const A=ae(i),k=pe+i*1e3;e.strokeStyle=r.majorTickColor,e.lineWidth=1,e.beginPath(),e.moveTo(A,o-r.majorTickHeight),e.lineTo(A,o),e.stroke();const b=oe(k,p,T,u,L),_=e.measureText(b).width,S=A-_/2;S>be&&(e.fillStyle=r.labelColor,e.fillText(b,A,o-r.majorTickHeight-4),be=S+_+5)}if(y){const i=(y.startMs-n)/(s-n)*t,A=(y.endMs-n)/(s-n)*t,k=Math.min(i,A),b=Math.abs(A-i);e.globalAlpha=.2,e.fillStyle=r.indicatorColor,e.fillRect(k,0,b,o),e.globalAlpha=1}const ye=(m-n)/(s-n)*t;if(e.strokeStyle=r.indicatorColor,e.lineWidth=r.indicatorLineWidth,e.beginPath(),e.moveTo(ye,0),e.lineTo(ye,o),e.stroke(),g!=null){const i=(g-n)/(s-n)*t;e.globalAlpha=.15,e.strokeStyle=r.indicatorColor,e.lineWidth=r.indicatorLineWidth,e.beginPath(),e.moveTo(i,0),e.lineTo(i,o),e.stroke(),e.globalAlpha=1}return h}a.DEFAULT_LABELS=Ce,a.DEFAULT_LANE_HEIGHT=P,a.DateTimeFormats=te,a.LABEL_PAD_LEFT=Me,a.LANE_GAP=$,a.MAX_SPAN_MS=Te,a.MIN_SPAN_MS=de,a.MONTHS=ge,a.SCROLLBAR_WIDTH=V,a.SWIM_LANE_SCROLL_SPEED=We,a.TICK_AREA_HEIGHT=j,a.TIC_SCALES=D,a.TickInterval=ee,a.Timezones=Pe,a.calcEpochMs=Se,a.clampSpan=ie,a.defaultSwimLaneStyle=I,a.defaultTheme=Ee,a.drawTimeline=Ge,a.formatDateTime=ue,a.formatTime=Fe,a.fromMilliseconds=we,a.generateTicks=Oe,a.getDateParts=Z,a.getDurationMs=fe,a.getTimezoneAbbr=Ne,a.hitTestLaneLabel=ze,a.hitTestSwimLane=je,a.isInSwimLaneRegion=Xe,a.makeLabel=oe,a.nextTic=q,a.positionToTime=$e,a.resolveItemStyle=ne,a.resolveLabel=He,a.snapToTick=Je,a.splitForDisplay=Re,a.timeToPosition=he,a.toDate=K,a.toJulianDate=_e,a.toMilliseconds=N,a.totalSwimLaneHeight=Be,a.twoD=w,a.zoomAroundMs=Ue,a.zoomRange=ve,Object.defineProperty(a,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
|
/**
|
|
@@ -539,6 +571,21 @@ export declare interface TimelineRenderState {
|
|
|
539
571
|
use12h?: boolean;
|
|
540
572
|
/** Abbreviated month names for tick labels. Falls back to English when omitted. */
|
|
541
573
|
months?: string[];
|
|
574
|
+
/**
|
|
575
|
+
* Active range selection (set while the user is dragging to select a range).
|
|
576
|
+
* When non-null, a highlight is rendered over the selected time span in the tick area.
|
|
577
|
+
*/
|
|
578
|
+
rangeSelection?: {
|
|
579
|
+
startMs: number;
|
|
580
|
+
endMs: number;
|
|
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;
|
|
542
589
|
}
|
|
543
590
|
|
|
544
591
|
export declare interface TimelineTheme {
|
|
@@ -561,6 +608,8 @@ export declare interface TimelineTheme {
|
|
|
561
608
|
swimLaneItemBorderColor: string;
|
|
562
609
|
/** Default border width for swim lane items (px). Set to 0 to remove borders. */
|
|
563
610
|
swimLaneItemBorderWidth: number;
|
|
611
|
+
/** Color of the red dot shown on the LIVE button when playback is live. */
|
|
612
|
+
liveDotColor: string;
|
|
564
613
|
}
|
|
565
614
|
|
|
566
615
|
export declare interface TimePosition {
|