awesome-timeline-react 0.6.0 → 0.6.1
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/dist/_tsup-dts-rollup.d.mts +32 -5
- package/dist/_tsup-dts-rollup.d.ts +32 -5
- package/dist/index.js +9 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -14,14 +14,24 @@ export declare type AnimationConfig = boolean | {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Assigns a vertical lane (stacking order) to each window-visible event of a
|
|
17
|
-
* single row
|
|
18
|
-
*
|
|
17
|
+
* single row: interval partitioning, so a row opens exactly as many lanes as
|
|
18
|
+
* its peak concurrency and NO event is ever laid over another.
|
|
19
|
+
*
|
|
20
|
+
* Each event takes the lowest lane whose last event has already ended; if every
|
|
21
|
+
* lane is still busy it opens a new one. Semantics:
|
|
19
22
|
*
|
|
20
23
|
* - Events outside [windowStart, windowEnd] are skipped and do not influence
|
|
21
24
|
* lane assignment at all.
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
+
* - Touching events (prev.endTime === next.startTime) do not overlap, so they
|
|
26
|
+
* share a lane.
|
|
27
|
+
* - Lowest-free-lane means the assignment is deterministic, and a row with N
|
|
28
|
+
* concurrent events ends up exactly N lanes tall.
|
|
29
|
+
*
|
|
30
|
+
* Replaces the algorithm inlined in the original use-produce-content.tsx, whose
|
|
31
|
+
* occupancy scan was bounded by the previously-placed event's lane and reset
|
|
32
|
+
* whenever a lane freed: after a lane freed mid-row, later events were placed
|
|
33
|
+
* in lanes that had never been checked, and were drawn on top of the events
|
|
34
|
+
* still running there (visible on capacity rows with 3+ concurrent events).
|
|
25
35
|
*
|
|
26
36
|
* `rowEvents` must already be filtered to one row and sorted with
|
|
27
37
|
* helpers/sort-events (startTime asc, endTime asc).
|
|
@@ -931,6 +941,23 @@ declare type TimelineHandle = {
|
|
|
931
941
|
export { TimelineHandle }
|
|
932
942
|
export { TimelineHandle as TimelineHandle_alias_1 }
|
|
933
943
|
|
|
944
|
+
/**
|
|
945
|
+
* Lane stacking on a row whose events genuinely run in parallel (a shared pool / capacity row: one
|
|
946
|
+
* row, many concurrent bars). A row must open as many lanes as its peak concurrency so every bar is
|
|
947
|
+
* drawn in full — no bar may be laid over another.
|
|
948
|
+
*
|
|
949
|
+
* Both rows here are the same story with different data:
|
|
950
|
+
* - **Pool A** is the minimal case: four bars stack up, then lane 0's occupant ends and a new bar
|
|
951
|
+
* takes the freed lane, and the bars after it collide.
|
|
952
|
+
* - **Pool B** is the same failure in a realistic shape: a pool admitting a bar every 15 min, with
|
|
953
|
+
* runs of mixed length (one short "Hold"), so lane releases stop lining up with admissions.
|
|
954
|
+
*
|
|
955
|
+
* The panel above the board is computed by calling the SAME `assignLanes` the renderer uses, next to
|
|
956
|
+
* the peak concurrency the data actually needs — so it reports whether the layout is correct rather
|
|
957
|
+
* than asking you to eyeball it. `overlapping pairs` must be 0 and `lanes` must equal `needs`.
|
|
958
|
+
*/
|
|
959
|
+
export declare const TimelineLaneStacking: () => React_2.JSX.Element;
|
|
960
|
+
|
|
934
961
|
/**
|
|
935
962
|
* Long row labels: names that exceed the 100px header width wrap to multiple
|
|
936
963
|
* lines, stay centered, and grow the row height (and its canvas dividers) to
|
|
@@ -14,14 +14,24 @@ export declare type AnimationConfig = boolean | {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Assigns a vertical lane (stacking order) to each window-visible event of a
|
|
17
|
-
* single row
|
|
18
|
-
*
|
|
17
|
+
* single row: interval partitioning, so a row opens exactly as many lanes as
|
|
18
|
+
* its peak concurrency and NO event is ever laid over another.
|
|
19
|
+
*
|
|
20
|
+
* Each event takes the lowest lane whose last event has already ended; if every
|
|
21
|
+
* lane is still busy it opens a new one. Semantics:
|
|
19
22
|
*
|
|
20
23
|
* - Events outside [windowStart, windowEnd] are skipped and do not influence
|
|
21
24
|
* lane assignment at all.
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
+
* - Touching events (prev.endTime === next.startTime) do not overlap, so they
|
|
26
|
+
* share a lane.
|
|
27
|
+
* - Lowest-free-lane means the assignment is deterministic, and a row with N
|
|
28
|
+
* concurrent events ends up exactly N lanes tall.
|
|
29
|
+
*
|
|
30
|
+
* Replaces the algorithm inlined in the original use-produce-content.tsx, whose
|
|
31
|
+
* occupancy scan was bounded by the previously-placed event's lane and reset
|
|
32
|
+
* whenever a lane freed: after a lane freed mid-row, later events were placed
|
|
33
|
+
* in lanes that had never been checked, and were drawn on top of the events
|
|
34
|
+
* still running there (visible on capacity rows with 3+ concurrent events).
|
|
25
35
|
*
|
|
26
36
|
* `rowEvents` must already be filtered to one row and sorted with
|
|
27
37
|
* helpers/sort-events (startTime asc, endTime asc).
|
|
@@ -931,6 +941,23 @@ declare type TimelineHandle = {
|
|
|
931
941
|
export { TimelineHandle }
|
|
932
942
|
export { TimelineHandle as TimelineHandle_alias_1 }
|
|
933
943
|
|
|
944
|
+
/**
|
|
945
|
+
* Lane stacking on a row whose events genuinely run in parallel (a shared pool / capacity row: one
|
|
946
|
+
* row, many concurrent bars). A row must open as many lanes as its peak concurrency so every bar is
|
|
947
|
+
* drawn in full — no bar may be laid over another.
|
|
948
|
+
*
|
|
949
|
+
* Both rows here are the same story with different data:
|
|
950
|
+
* - **Pool A** is the minimal case: four bars stack up, then lane 0's occupant ends and a new bar
|
|
951
|
+
* takes the freed lane, and the bars after it collide.
|
|
952
|
+
* - **Pool B** is the same failure in a realistic shape: a pool admitting a bar every 15 min, with
|
|
953
|
+
* runs of mixed length (one short "Hold"), so lane releases stop lining up with admissions.
|
|
954
|
+
*
|
|
955
|
+
* The panel above the board is computed by calling the SAME `assignLanes` the renderer uses, next to
|
|
956
|
+
* the peak concurrency the data actually needs — so it reports whether the layout is correct rather
|
|
957
|
+
* than asking you to eyeball it. `overlapping pairs` must be 0 and `lanes` must equal `needs`.
|
|
958
|
+
*/
|
|
959
|
+
export declare const TimelineLaneStacking: () => React_2.JSX.Element;
|
|
960
|
+
|
|
934
961
|
/**
|
|
935
962
|
* Long row labels: names that exceed the 100px header width wrap to multiple
|
|
936
963
|
* lines, stay centered, and grow the row height (and its canvas dividers) to
|
package/dist/index.js
CHANGED
|
@@ -703,36 +703,20 @@ var laneTop = (lane, g = DEFAULT_GEOMETRY) => g.laneTopOffset + g.laneHeight * l
|
|
|
703
703
|
var rowMinHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.rowBaseHeight + highestLane * g.laneHeight;
|
|
704
704
|
var staticEventHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.staticEventBaseHeight + highestLane * g.laneHeight;
|
|
705
705
|
var assignLanes = (rowEvents, windowStart, windowEnd) => {
|
|
706
|
-
|
|
707
|
-
const prevEvent = [];
|
|
708
|
-
let highestEventOrder = 0;
|
|
706
|
+
const laneEnd = [];
|
|
709
707
|
const laneOf = /* @__PURE__ */ new Map();
|
|
710
708
|
for (const event of rowEvents) {
|
|
711
709
|
if (!intersectsWindow(event, windowStart, windowEnd)) continue;
|
|
712
|
-
let
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (eventOrder > highestEventOrder) {
|
|
719
|
-
highestEventOrder = eventOrder;
|
|
720
|
-
}
|
|
721
|
-
eventOrder = 0;
|
|
722
|
-
assignEventOrder = false;
|
|
723
|
-
break;
|
|
724
|
-
}
|
|
710
|
+
let lane = laneEnd.findIndex((end) => end <= event.startTime);
|
|
711
|
+
if (lane === -1) {
|
|
712
|
+
lane = laneEnd.length;
|
|
713
|
+
laneEnd.push(event.endTime);
|
|
714
|
+
} else if (event.endTime > laneEnd[lane]) {
|
|
715
|
+
laneEnd[lane] = event.endTime;
|
|
725
716
|
}
|
|
726
|
-
|
|
727
|
-
eventOrder = tempEventOrder;
|
|
728
|
-
}
|
|
729
|
-
prevEvent[tempEventOrder] = event;
|
|
730
|
-
laneOf.set(event.id, tempEventOrder);
|
|
731
|
-
}
|
|
732
|
-
if (eventOrder > highestEventOrder) {
|
|
733
|
-
highestEventOrder = eventOrder;
|
|
717
|
+
laneOf.set(event.id, lane);
|
|
734
718
|
}
|
|
735
|
-
return { laneOf, highestLane:
|
|
719
|
+
return { laneOf, highestLane: Math.max(0, laneEnd.length - 1) };
|
|
736
720
|
};
|
|
737
721
|
|
|
738
722
|
// src/core/interactions.ts
|