@deck.gl-community/timeline-layers 9.2.5 → 9.3.1-alpha.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.
Files changed (50) hide show
  1. package/README.md +2 -0
  2. package/package.json +9 -9
  3. package/src/index.ts +42 -0
  4. package/src/layers/timeline-layer/timeline-collision.ts +51 -0
  5. package/src/layers/timeline-layer/timeline-layer.ts +868 -0
  6. package/src/layers/timeline-layer/timeline-layout.ts +80 -0
  7. package/src/layers/timeline-layer/timeline-types.ts +146 -0
  8. package/src/layers/timeline-layer/timeline-utils.ts +85 -0
  9. package/dist/index.cjs +0 -538
  10. package/dist/index.cjs.map +0 -7
  11. package/dist/index.d.ts +0 -10
  12. package/dist/index.d.ts.map +0 -1
  13. package/dist/index.js +0 -9
  14. package/dist/index.js.map +0 -1
  15. package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts +0 -23
  16. package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts.map +0 -1
  17. package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js +0 -33
  18. package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js.map +0 -1
  19. package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts +0 -38
  20. package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts.map +0 -1
  21. package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts +0 -3
  22. package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts.map +0 -1
  23. package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js +0 -53
  24. package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js.map +0 -1
  25. package/dist/layers/horizon-graph-layer/horizon-graph-layer.js +0 -138
  26. package/dist/layers/horizon-graph-layer/horizon-graph-layer.js.map +0 -1
  27. package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts +0 -3
  28. package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts.map +0 -1
  29. package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js +0 -24
  30. package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js.map +0 -1
  31. package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts +0 -23
  32. package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts.map +0 -1
  33. package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js +0 -100
  34. package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js.map +0 -1
  35. package/dist/layers/time-axis-layer.d.ts +0 -56
  36. package/dist/layers/time-axis-layer.d.ts.map +0 -1
  37. package/dist/layers/time-axis-layer.js +0 -78
  38. package/dist/layers/time-axis-layer.js.map +0 -1
  39. package/dist/layers/vertical-grid-layer.d.ts +0 -41
  40. package/dist/layers/vertical-grid-layer.d.ts.map +0 -1
  41. package/dist/layers/vertical-grid-layer.js +0 -43
  42. package/dist/layers/vertical-grid-layer.js.map +0 -1
  43. package/dist/utils/format-utils.d.ts +0 -7
  44. package/dist/utils/format-utils.d.ts.map +0 -1
  45. package/dist/utils/format-utils.js +0 -75
  46. package/dist/utils/format-utils.js.map +0 -1
  47. package/dist/utils/tick-utils.d.ts +0 -10
  48. package/dist/utils/tick-utils.d.ts.map +0 -1
  49. package/dist/utils/tick-utils.js +0 -32
  50. package/dist/utils/tick-utils.js.map +0 -1
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Overview
2
2
 
3
+ [![NPM Version](https://img.shields.io/npm/v/@deck.gl-community/timeline-layers.svg)](https://www.npmjs.com/package/@deck.gl-community/timeline-layers)
4
+ [![NPM Downloads](https://img.shields.io/npm/dw/@deck.gl-community/timeline-layers.svg)](https://www.npmjs.com/package/@deck.gl-community/timeline-layers)
3
5
  ![deck.gl v9](https://img.shields.io/badge/deck.gl-v9-green.svg?style=flat-square")
4
6
  ![WebGPU not supported](https://img.shields.io/badge/webgpu-no-red.svg?style=flat-square")
5
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deck.gl-community/timeline-layers",
3
- "version": "9.2.5",
3
+ "version": "9.3.1-alpha.0",
4
4
  "description": "Layers for compact timeline visualizations in deck.gl",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -33,16 +33,16 @@
33
33
  "test-watch": "vitest"
34
34
  },
35
35
  "dependencies": {
36
- "@deck.gl/core": "~9.2.8",
37
- "@deck.gl/layers": "~9.2.8",
38
- "@luma.gl/core": "~9.2.6",
39
- "@luma.gl/engine": "~9.2.6",
40
- "@luma.gl/shadertools": "~9.2.6"
36
+ "@deck.gl/core": "~9.3.0",
37
+ "@deck.gl/layers": "~9.3.0",
38
+ "@luma.gl/core": "~9.3.2",
39
+ "@luma.gl/engine": "~9.3.2",
40
+ "@luma.gl/shadertools": "~9.3.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@deck.gl/test-utils": "~9.2.8",
44
- "@luma.gl/webgpu": "~9.2.6",
43
+ "@deck.gl/test-utils": "~9.3.0",
44
+ "@luma.gl/webgpu": "~9.3.2",
45
45
  "@probe.gl/test-utils": "^4.0.4"
46
46
  },
47
- "gitHead": "c6b0f45b1e7f9916c1b79a43c39b839a8096c163"
47
+ "gitHead": "dd572a3491cb15a6ff2f0008e93ae1dc38962b06"
48
48
  }
package/src/index.ts CHANGED
@@ -2,12 +2,54 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
+ // HORIZON GRAPH LAYERS
5
6
  export type {HorizonGraphLayerProps} from './layers/horizon-graph-layer/horizon-graph-layer';
6
7
  export {HorizonGraphLayer} from './layers/horizon-graph-layer/horizon-graph-layer';
7
8
  export type {MultiHorizonGraphLayerProps} from './layers/horizon-graph-layer/multi-horizon-graph-layer';
8
9
  export {MultiHorizonGraphLayer} from './layers/horizon-graph-layer/multi-horizon-graph-layer';
10
+
11
+ // AXIS LAYERS
9
12
  export type {TimeAxisLayerProps} from './layers/time-axis-layer';
10
13
  export {TimeAxisLayer} from './layers/time-axis-layer';
11
14
  export type {VerticalGridLayerProps} from './layers/vertical-grid-layer';
12
15
  export {VerticalGridLayer} from './layers/vertical-grid-layer';
13
16
  export {formatTimeMs, formatTimeRangeMs} from './utils/format-utils';
17
+
18
+ // TIMELINE LAYER
19
+ export type {TimelineLayerProps} from './layers/timeline-layer/timeline-layer';
20
+ export {TimelineLayer} from './layers/timeline-layer/timeline-layer';
21
+
22
+ export type {
23
+ TimelineClip,
24
+ ClipWithSubtrack,
25
+ TimelineTrack,
26
+ TrackWithSubtracks,
27
+ TrackPosition,
28
+ TrackBackgroundData,
29
+ TrackLabelData,
30
+ ClipPolygonData,
31
+ ClipLabelData,
32
+ SeparatorLineData,
33
+ AxisLineData,
34
+ AxisLabelData,
35
+ ScrubberLineData,
36
+ ScrubberHandleData,
37
+ ScrubberLabelData,
38
+ TimelineTick,
39
+ TimelineViewport,
40
+ TimelineClipInfo,
41
+ TimelineTrackInfo,
42
+ TimelineScrubberInfo,
43
+ TimelineViewportInfo,
44
+ TimeAxisLabelFormatter
45
+ } from './layers/timeline-layer/timeline-types';
46
+
47
+ export type {SelectionStyle, TimelineLayout} from './layers/timeline-layer/timeline-layout';
48
+ export {DEFAULT_TIMELINE_LAYOUT} from './layers/timeline-layer/timeline-layout';
49
+
50
+ export {
51
+ positionToTime,
52
+ timeToPosition,
53
+ timeAxisFormatters,
54
+ type GenerateTicksOptions
55
+ } from './layers/timeline-layer/timeline-utils';
@@ -0,0 +1,51 @@
1
+ // deck.gl-community
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {TimelineClip, ClipWithSubtrack} from './timeline-types';
6
+
7
+ export type {ClipWithSubtrack};
8
+ /**
9
+ * Detects overlapping clips and assigns them to subtracks.
10
+ * Uses a greedy algorithm to minimize the number of subtracks needed.
11
+ */
12
+ export function assignClipsToSubtracks(clips: TimelineClip[]): ClipWithSubtrack[] {
13
+ if (clips.length === 0) return [];
14
+
15
+ // Sort clips by start time
16
+ const sortedClips = [...clips].sort((a, b) => a.startMs - b.startMs);
17
+
18
+ // Track the end time of the last clip in each subtrack
19
+ const subtrackEndTimes: number[] = [];
20
+ const result: ClipWithSubtrack[] = [];
21
+
22
+ for (const clip of sortedClips) {
23
+ let assignedSubtrack = -1;
24
+
25
+ for (let i = 0; i < subtrackEndTimes.length; i++) {
26
+ if (clip.startMs >= subtrackEndTimes[i]) {
27
+ assignedSubtrack = i;
28
+ subtrackEndTimes[i] = clip.endMs;
29
+ break;
30
+ }
31
+ }
32
+
33
+ if (assignedSubtrack === -1) {
34
+ assignedSubtrack = subtrackEndTimes.length;
35
+ subtrackEndTimes.push(clip.endMs);
36
+ }
37
+
38
+ result.push({...clip, subtrackIndex: assignedSubtrack});
39
+ }
40
+
41
+ return result;
42
+ }
43
+
44
+ /**
45
+ * Calculate the number of subtracks needed for a set of clips.
46
+ */
47
+ export function calculateSubtrackCount(clips: TimelineClip[]): number {
48
+ if (clips.length === 0) return 1;
49
+ const clipsWithSubtracks = assignClipsToSubtracks(clips);
50
+ return Math.max(...clipsWithSubtracks.map((c) => c.subtrackIndex)) + 1;
51
+ }