@kteneyck/cesium-timeline-react 0.5.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 CHANGED
@@ -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
  ---
@@ -173,6 +174,7 @@ Angular components use standalone imports — no NgModule required. Selectors: `
173
174
  | `onSwimLaneItemHover` | `(info: SwimLaneEventInfo \| null) => void` | — | Fires when mouse enters/leaves a swim lane item |
174
175
  | `onSwimLaneItemDoubleClick` | `(info: SwimLaneEventInfo) => void` | — | Fires when a swim lane item is double-clicked |
175
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). |
176
178
 
177
179
  ---
178
180
 
@@ -412,6 +414,88 @@ const [pickerOpen, setPickerOpen] = useState(false);
412
414
 
413
415
  ---
414
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
+
415
499
  ## Exports
416
500
 
417
501
  ### React
@@ -441,6 +525,7 @@ import {
441
525
  import {
442
526
  DateTimeFormats, // Format string presets
443
527
  Timezones, // { LOCAL: 'local', UTC: 'UTC' } convenience constants
528
+ DEFAULT_LABELS, // Default English label/tooltip strings
444
529
  formatDateTime, // Token-based date formatter (date, format, timezone?)
445
530
  getTimezoneAbbr, // Short timezone abbreviation for a date (date, timezone?)
446
531
  splitForDisplay, // Split format string into time/date parts
@@ -458,6 +543,7 @@ import {
458
543
  // TypeScript types
459
544
  import type {
460
545
  TimelineTheme,
546
+ TimelineLabels,
461
547
  SwimLane,
462
548
  SwimLaneItem,
463
549
  SwimLaneItemStyle,