@kteneyck/cesium-timeline-react 0.4.0 → 0.6.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 +145 -2
- package/dist/cesium-timeline-react.js +705 -699
- package/dist/cesium-timeline-react.umd.cjs +4 -4
- package/dist/index.d.ts +9 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
123
123
|
- **Auto-scroll during playback** — visible window pans automatically when the needle reaches 10% from either edge.
|
|
124
124
|
- **Infinite scrolling window** — timeline is not clamped to `startTime`/`endTime`; the window can pan anywhere.
|
|
125
125
|
- **Adaptive tick labels** — label granularity adapts to zoom level: milliseconds → seconds → HH:MM:SS → HH:MM → Month Day → Month Year → Year. Tick dates are shown only when the visible window spans more than 24 hours.
|
|
126
|
-
- **
|
|
126
|
+
- **Configurable timezone** — tick labels and the datetime display can show any IANA timezone (e.g. `"UTC"`, `"America/New_York"`) or the browser's local time. A short abbreviation (e.g. `UTC`, `EST`, `PDT`) is displayed to the right of the date line whenever a non-local timezone is active.
|
|
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.
|
|
@@ -135,6 +135,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
135
135
|
- **Max tick limit** — `maxTicks` prop prevents the canvas from becoming overloaded at wide zoom levels by coarsening the tick scale automatically.
|
|
136
136
|
- **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
137
|
- **Fully themeable** — 16 theme properties cover every color, size, and font setting, including swim lane item border defaults.
|
|
138
|
+
- **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).
|
|
138
139
|
- **Responsive** — fills container width; `ResizeObserver` redraws on resize.
|
|
139
140
|
|
|
140
141
|
---
|
|
@@ -159,6 +160,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
159
160
|
| `ffSpeeds` | `number[]` | `[2,4,8,16,32,1]` | Speed steps cycled by the ▶▶ button. Last entry wraps back to first. |
|
|
160
161
|
| `rwSpeeds` | `number[]` | `[1,2,4,8,16,32]` | Absolute-value speed steps cycled by the ◀◀ button (negated internally). |
|
|
161
162
|
| `dateTimeFormat` | `string` | `'MMM DD YYYY HH:mm:ss'` | Token-based format string for the controls datetime display |
|
|
163
|
+
| `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. |
|
|
162
164
|
| `onDateTimeClick` | `() => void` | — | Called when the user clicks the datetime display. Use to open your own date picker. |
|
|
163
165
|
| `jumpToTime` | `JulianDate \| Date` | — | Set to programmatically jump the timeline to a moment (pans canvas + sets time). |
|
|
164
166
|
| `theme` | `Partial<TimelineTheme>` | `defaultTheme` | Theme overrides (merged with defaults) |
|
|
@@ -172,6 +174,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
|
|
|
172
174
|
| `onSwimLaneItemHover` | `(info: SwimLaneEventInfo \| null) => void` | — | Fires when mouse enters/leaves a swim lane item |
|
|
173
175
|
| `onSwimLaneItemDoubleClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is double-clicked |
|
|
174
176
|
| `onSwimLaneReorder` | `(orderedIds: string[]) => void` | — | Fires when swim lanes are reordered via drag. Receives the new lane id order. |
|
|
177
|
+
| `labels` | `Partial<TimelineLabels>` | English defaults | Override any control-bar label or tooltip string. See [Labels & i18n](#labels--i18n). |
|
|
175
178
|
|
|
176
179
|
---
|
|
177
180
|
|
|
@@ -229,6 +232,60 @@ const theme = useMemo(() => {
|
|
|
229
232
|
|
|
230
233
|
---
|
|
231
234
|
|
|
235
|
+
## Timezone
|
|
236
|
+
|
|
237
|
+
By default the timeline displays all times in the **browser's local timezone**. Pass the `timezone` prop to use UTC or any [IANA timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) instead.
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
// UTC
|
|
241
|
+
<Timeline clock={viewer.clock} timezone="UTC" ... />
|
|
242
|
+
|
|
243
|
+
// A named IANA zone
|
|
244
|
+
<Timeline clock={viewer.clock} timezone="America/New_York" ... />
|
|
245
|
+
|
|
246
|
+
// Back to local (or simply omit the prop)
|
|
247
|
+
<Timeline clock={viewer.clock} timezone="local" ... />
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Both the **canvas tick labels** and the **control bar datetime display** update to reflect the chosen timezone. When a non-local timezone is active a short abbreviation (e.g. `UTC`, `EST`, `PDT`) is shown to the right of the date line. The abbreviation is DST-aware — it automatically switches between `EST` and `EDT`, `PST` and `PDT`, etc.
|
|
251
|
+
|
|
252
|
+
### `Timezones` constants
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
import { Timezones } from '@kteneyck/cesium-timeline-react';
|
|
256
|
+
|
|
257
|
+
<Timeline timezone={Timezones.UTC} ... /> // "UTC"
|
|
258
|
+
<Timeline timezone={Timezones.LOCAL} ... /> // "local" (default behavior)
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### `getTimezoneAbbr` utility
|
|
262
|
+
|
|
263
|
+
Returns the short abbreviation for a given date and timezone, or `null` for local.
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
import { getTimezoneAbbr } from '@kteneyck/cesium-timeline-react';
|
|
267
|
+
|
|
268
|
+
getTimezoneAbbr(new Date(), 'UTC'); // → "UTC"
|
|
269
|
+
getTimezoneAbbr(new Date(), 'America/Chicago'); // → "CDT" or "CST"
|
|
270
|
+
getTimezoneAbbr(new Date()); // → null (local)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### `formatDateTime` with timezone
|
|
274
|
+
|
|
275
|
+
The `formatDateTime` utility accepts an optional third argument:
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
import { formatDateTime, DateTimeFormats } from '@kteneyck/cesium-timeline-react';
|
|
279
|
+
|
|
280
|
+
formatDateTime(new Date(), DateTimeFormats.ISO, 'UTC');
|
|
281
|
+
// → "2026-02-24 14:04:07" (always in UTC regardless of local browser timezone)
|
|
282
|
+
|
|
283
|
+
formatDateTime(new Date(), DateTimeFormats.DEFAULT, 'America/Los_Angeles');
|
|
284
|
+
// → "Feb 24 2026 06:04:07"
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
232
289
|
## DateTime Format
|
|
233
290
|
|
|
234
291
|
The `dateTimeFormat` prop controls the two-line datetime display in the control bar. It accepts a token-based format string.
|
|
@@ -357,6 +414,88 @@ const [pickerOpen, setPickerOpen] = useState(false);
|
|
|
357
414
|
|
|
358
415
|
---
|
|
359
416
|
|
|
417
|
+
## Labels & i18n
|
|
418
|
+
|
|
419
|
+
Every label and tooltip in the control bar is overridable via the `labels` prop. Pass a `Partial<TimelineLabels>` object — only the keys you provide are changed; everything else falls back to the English defaults.
|
|
420
|
+
|
|
421
|
+
### `TimelineLabels` reference
|
|
422
|
+
|
|
423
|
+
| Key | Default (English) | Notes |
|
|
424
|
+
|-----|-------------------|-------|
|
|
425
|
+
| `dateTimeClickTooltip` | `"Click to jump to a date/time"` | Tooltip on the datetime display when `onDateTimeClick` is wired up |
|
|
426
|
+
| `liveLabel` | `"LIVE"` | LIVE button text when not at live time |
|
|
427
|
+
| `liveActiveLabel` | `"● LIVE"` | LIVE button text when at live time |
|
|
428
|
+
| `liveTooltip` | `"Jump to live (now)"` | LIVE button tooltip when not at live time |
|
|
429
|
+
| `liveActiveTooltip` | `"Currently live"` | LIVE button tooltip when at live time |
|
|
430
|
+
| `resetSpeedTooltip` | `"Reset to 1× speed"` | Tooltip on the speed-reset badge |
|
|
431
|
+
| `jumpToStartTooltip` | `"Jump to start"` | ⏮ button tooltip when a start time is set |
|
|
432
|
+
| `noStartTimeTooltip` | `"No start time set"` | ⏮ button tooltip when no start time is set |
|
|
433
|
+
| `jumpToEndTooltip` | `"Jump to end"` | ⏭ button tooltip when an end time is set |
|
|
434
|
+
| `noEndTimeTooltip` | `"No end time set"` | ⏭ button tooltip when no end time is set |
|
|
435
|
+
| `rewindTooltip` | `"Rewind"` | ◀◀ button tooltip at normal speed |
|
|
436
|
+
| `rewindActiveTooltip` | `(n) => "Reverse N× — click to speed up…"` | ◀◀ button tooltip while rewinding — receives the current multiplier |
|
|
437
|
+
| `playTooltip` | `"Play"` | ▶ button tooltip when stopped |
|
|
438
|
+
| `playFromRewindTooltip` | `"Play (reset to 1×)"` | ▶ button tooltip when coming out of rewind |
|
|
439
|
+
| `pauseTooltip` | `"Pause"` | ▶ button tooltip when playing |
|
|
440
|
+
| `fastForwardTooltip` | `"Fast forward"` | ▶▶ button tooltip at normal speed |
|
|
441
|
+
| `fastForwardActiveTooltip` | `(n) => "N× speed — click to increase…"` | ▶▶ button tooltip while fast-forwarding — receives the current multiplier |
|
|
442
|
+
| `collapseSwimLanesTooltip` | `"Collapse swim lanes"` | Chevron button tooltip when lanes are visible |
|
|
443
|
+
| `expandSwimLanesTooltip` | `"Expand swim lanes"` | Chevron button tooltip when lanes are hidden |
|
|
444
|
+
|
|
445
|
+
Dynamic fields (`rewindActiveTooltip`, `fastForwardActiveTooltip`) accept either a **static string** or a **function** `(multiplier: number) => string`. Use a function when you want to embed the speed value in your translated string.
|
|
446
|
+
|
|
447
|
+
### React example
|
|
448
|
+
|
|
449
|
+
```tsx
|
|
450
|
+
import { Timeline } from '@kteneyck/cesium-timeline-react';
|
|
451
|
+
import type { TimelineLabels } from '@kteneyck/cesium-timeline-core';
|
|
452
|
+
|
|
453
|
+
const frLabels: Partial<TimelineLabels> = {
|
|
454
|
+
playTooltip: 'Lecture',
|
|
455
|
+
pauseTooltip: 'Pause',
|
|
456
|
+
liveLabel: 'EN DIRECT',
|
|
457
|
+
liveActiveLabel: '● EN DIRECT',
|
|
458
|
+
liveTooltip: 'Aller en direct',
|
|
459
|
+
liveActiveTooltip: 'Vous êtes en direct',
|
|
460
|
+
rewindTooltip: 'Retour rapide',
|
|
461
|
+
rewindActiveTooltip: (n) => `Retour ${n}× — cliquer pour accélérer`,
|
|
462
|
+
fastForwardTooltip: 'Avance rapide',
|
|
463
|
+
fastForwardActiveTooltip: (n) => `${n}× — cliquer pour augmenter la vitesse`,
|
|
464
|
+
collapseSwimLanesTooltip: 'Réduire les pistes',
|
|
465
|
+
expandSwimLanesTooltip: 'Développer les pistes',
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
<Timeline clock={viewer.clock} labels={frLabels} height={120} />
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### Angular example
|
|
472
|
+
|
|
473
|
+
```typescript
|
|
474
|
+
// component.ts
|
|
475
|
+
import type { TimelineLabels } from '@kteneyck/cesium-timeline-core';
|
|
476
|
+
|
|
477
|
+
@Component({ ... })
|
|
478
|
+
export class AppComponent {
|
|
479
|
+
frLabels: Partial<TimelineLabels> = {
|
|
480
|
+
playTooltip: 'Lecture',
|
|
481
|
+
pauseTooltip: 'Pause',
|
|
482
|
+
liveLabel: 'EN DIRECT',
|
|
483
|
+
liveActiveLabel: '● EN DIRECT',
|
|
484
|
+
liveTooltip: 'Aller en direct',
|
|
485
|
+
liveActiveTooltip: 'Vous êtes en direct',
|
|
486
|
+
rewindActiveTooltip: (n) => `Retour ${n}× — cliquer pour accélérer`,
|
|
487
|
+
fastForwardActiveTooltip: (n) => `${n}× — cliquer pour augmenter la vitesse`,
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
```html
|
|
493
|
+
<!-- component.html -->
|
|
494
|
+
<ct-timeline [clock]="clock" [labels]="frLabels" [height]="120" />
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
360
499
|
## Exports
|
|
361
500
|
|
|
362
501
|
### React
|
|
@@ -385,7 +524,10 @@ import {
|
|
|
385
524
|
```tsx
|
|
386
525
|
import {
|
|
387
526
|
DateTimeFormats, // Format string presets
|
|
388
|
-
|
|
527
|
+
Timezones, // { LOCAL: 'local', UTC: 'UTC' } convenience constants
|
|
528
|
+
DEFAULT_LABELS, // Default English label/tooltip strings
|
|
529
|
+
formatDateTime, // Token-based date formatter (date, format, timezone?)
|
|
530
|
+
getTimezoneAbbr, // Short timezone abbreviation for a date (date, timezone?)
|
|
389
531
|
splitForDisplay, // Split format string into time/date parts
|
|
390
532
|
toJulianDate, // Convert Date | JulianDate → JulianDate
|
|
391
533
|
toDate, // Convert Date | JulianDate → Date
|
|
@@ -401,6 +543,7 @@ import {
|
|
|
401
543
|
// TypeScript types
|
|
402
544
|
import type {
|
|
403
545
|
TimelineTheme,
|
|
546
|
+
TimelineLabels,
|
|
404
547
|
SwimLane,
|
|
405
548
|
SwimLaneItem,
|
|
406
549
|
SwimLaneItemStyle,
|