@deck.gl-community/timeline-layers 9.2.8 → 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.
- package/package.json +9 -9
- package/src/index.ts +42 -0
- package/src/layers/timeline-layer/timeline-collision.ts +51 -0
- package/src/layers/timeline-layer/timeline-layer.ts +868 -0
- package/src/layers/timeline-layer/timeline-layout.ts +80 -0
- package/src/layers/timeline-layer/timeline-types.ts +146 -0
- package/src/layers/timeline-layer/timeline-utils.ts +85 -0
- package/dist/index.cjs +0 -538
- package/dist/index.cjs.map +0 -7
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -9
- package/dist/index.js.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts +0 -23
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js +0 -33
- package/dist/layers/horizon-graph-layer/horizon-graph-layer-uniforms.js.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts +0 -38
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts +0 -3
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js +0 -53
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.fs.js.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.js +0 -138
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.js.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts +0 -3
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js +0 -24
- package/dist/layers/horizon-graph-layer/horizon-graph-layer.vs.js.map +0 -1
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts +0 -23
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.d.ts.map +0 -1
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js +0 -100
- package/dist/layers/horizon-graph-layer/multi-horizon-graph-layer.js.map +0 -1
- package/dist/layers/time-axis-layer.d.ts +0 -56
- package/dist/layers/time-axis-layer.d.ts.map +0 -1
- package/dist/layers/time-axis-layer.js +0 -78
- package/dist/layers/time-axis-layer.js.map +0 -1
- package/dist/layers/vertical-grid-layer.d.ts +0 -41
- package/dist/layers/vertical-grid-layer.d.ts.map +0 -1
- package/dist/layers/vertical-grid-layer.js +0 -43
- package/dist/layers/vertical-grid-layer.js.map +0 -1
- package/dist/utils/format-utils.d.ts +0 -7
- package/dist/utils/format-utils.d.ts.map +0 -1
- package/dist/utils/format-utils.js +0 -75
- package/dist/utils/format-utils.js.map +0 -1
- package/dist/utils/tick-utils.d.ts +0 -10
- package/dist/utils/tick-utils.d.ts.map +0 -1
- package/dist/utils/tick-utils.js +0 -32
- package/dist/utils/tick-utils.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deck.gl-community/timeline-layers",
|
|
3
|
-
"version": "9.
|
|
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.
|
|
37
|
-
"@deck.gl/layers": "~9.
|
|
38
|
-
"@luma.gl/core": "~9.2
|
|
39
|
-
"@luma.gl/engine": "~9.2
|
|
40
|
-
"@luma.gl/shadertools": "~9.2
|
|
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.
|
|
44
|
-
"@luma.gl/webgpu": "~9.2
|
|
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": "
|
|
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
|
+
}
|