@tangle-network/charts 0.7.0 → 0.9.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 +64 -7
- package/dist/figure.css +96 -2
- package/dist/index.d.ts +39 -4
- package/dist/index.js +732 -377
- package/dist/react/index.d.ts +12 -6
- package/dist/react/index.js +57 -7
- package/dist/react/live.css +20 -1
- package/dist/timeline-BAwebuqb.js +1185 -0
- package/dist/timeline-CNHABOS1.d.ts +293 -0
- package/package.json +1 -1
- package/dist/events-Cw6abvgR.js +0 -491
- package/dist/timeline-BAjzF-wL.d.ts +0 -183
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as Refusal, O as Figure, S as YTick, _ as MarkVerdict, b as YScale, d as PointFields, f as PointGlyph, g as MarkKind, h as ChartMark, i as TimelineTick, l as TickOutcome, m as ChartBand, n as TimelineOptions, p as BandKind, r as TimelineSpan, t as TimelineLane, v as MarkerShape, x as YTarget, y as XCategory } from "../timeline-CNHABOS1.js";
|
|
2
2
|
import { ReactElement, ReactNode } from "react";
|
|
3
3
|
//#region src/react/sparkline.d.ts
|
|
4
4
|
type SparklineDirection = "rising" | "falling" | "flat";
|
|
@@ -138,10 +138,6 @@ interface WaterfallHeaderProps extends WaterfallTimeAxisProps {
|
|
|
138
138
|
}
|
|
139
139
|
export declare function WaterfallHeader({ label, attribution, durationLabel, ...axis }: WaterfallHeaderProps): import("react").JSX.Element;
|
|
140
140
|
//#endregion
|
|
141
|
-
//#region src/svg.d.ts
|
|
142
|
-
/** Point shapes: the second channel that keeps series distinct without colour. */
|
|
143
|
-
type MarkerShape = "circle" | "square" | "triangle" | "diamond";
|
|
144
|
-
//#endregion
|
|
145
141
|
//#region src/react/live.d.ts
|
|
146
142
|
export declare const LIVE_SERIES: readonly ['#8b7cf6', '#0ea5a0', '#c98500', '#e2508f', '#4a90e2'];
|
|
147
143
|
export declare const formatCompact: (value: number | null | undefined) => string;
|
|
@@ -259,4 +255,14 @@ interface FigureViewProps {
|
|
|
259
255
|
}
|
|
260
256
|
export declare function FigureView({ figure, presentation }: FigureViewProps): import("react").JSX.Element;
|
|
261
257
|
//#endregion
|
|
262
|
-
|
|
258
|
+
//#region src/react/timeline-view.d.ts
|
|
259
|
+
interface TimelineViewProps {
|
|
260
|
+
lanes: TimelineLane[];
|
|
261
|
+
options: Omit<TimelineOptions, 'collapsed'>;
|
|
262
|
+
/** Lane ids folded on first render, such as every lead on a large team. */
|
|
263
|
+
defaultCollapsed?: string[];
|
|
264
|
+
presentation?: FigureViewProps['presentation'];
|
|
265
|
+
}
|
|
266
|
+
export declare function TimelineView({ lanes, options, defaultCollapsed, presentation }: TimelineViewProps): import("react").JSX.Element;
|
|
267
|
+
//#endregion
|
|
268
|
+
export type { BandKind, ChartBand, ChartMark, Figure, FigureViewProps, LineSeries, MarkKind, MarkVerdict, MarkerShape, MeterSegment, PointFields, PointGlyph, Refusal, SparklineDirection, SparklineGeometry, SparklineGeometryOptions, SparklineLabelOptions, SparklinePoint, SparklineProps, SparklineValues, StackedBarBucket, StackedBarChartProps, StackedBarSegment, StackedBarSeries, TickOutcome, TimelineLane, TimelineOptions, TimelineSpan, TimelineTick, TimelineViewProps, WaterfallBarProps, WaterfallHeaderProps, WaterfallRowProps, WaterfallSpanGeometry, WaterfallTimeAxisProps, WaterfallWindow, XCategory, YScale, YTarget, YTick };
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as markerPath, U as hatchPath, _ as markName, c as MARK_HEADS, p as eventsGap, t as timeline, v as isRefusal } from "../timeline-BAwebuqb.js";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Fragment as Fragment$1, useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import { Fragment as Fragment$1, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
4
|
//#region src/react/sparkline.tsx
|
|
5
5
|
const DEFAULT_SPARKLINE_WIDTH = 96;
|
|
6
6
|
const DEFAULT_SPARKLINE_HEIGHT = 24;
|
|
@@ -1268,13 +1268,17 @@ function Band({ band, x, y, width, height }) {
|
|
|
1268
1268
|
]
|
|
1269
1269
|
});
|
|
1270
1270
|
}
|
|
1271
|
-
/** A vertical event rule with its label; kinds differ by stroke pattern
|
|
1271
|
+
/** A vertical event rule with its label; kinds differ by stroke pattern, the died cross and the release, steer, ruling
|
|
1272
|
+
* and wake head shapes as well as colour, and a recorded verdict colours the rule. */
|
|
1272
1273
|
function Mark({ mark, x, top, bottom, row, em, flip }) {
|
|
1273
1274
|
const s = Math.max(3, em / 4);
|
|
1275
|
+
const head = MARK_HEADS[mark.kind];
|
|
1274
1276
|
return /* @__PURE__ */ jsxs("g", {
|
|
1275
1277
|
"data-mark": mark.kind,
|
|
1278
|
+
"data-verdict": mark.verdict,
|
|
1279
|
+
className: mark.verdict ? `ov-verdict-${mark.verdict}` : void 0,
|
|
1276
1280
|
children: [
|
|
1277
|
-
/* @__PURE__ */ jsx("title", { children: mark
|
|
1281
|
+
/* @__PURE__ */ jsx("title", { children: markName(mark) }),
|
|
1278
1282
|
/* @__PURE__ */ jsx("line", {
|
|
1279
1283
|
x1: x,
|
|
1280
1284
|
x2: x,
|
|
@@ -1286,12 +1290,16 @@ function Mark({ mark, x, top, bottom, row, em, flip }) {
|
|
|
1286
1290
|
d: `M${x - s} ${bottom - 2 * s}L${x + s} ${bottom}M${x - s} ${bottom}L${x + s} ${bottom - 2 * s}`,
|
|
1287
1291
|
className: "ov-mark ov-mark-died"
|
|
1288
1292
|
}),
|
|
1293
|
+
head && /* @__PURE__ */ jsx("path", {
|
|
1294
|
+
d: markerPath(head, x, top + s, s),
|
|
1295
|
+
className: "ov-mark-head"
|
|
1296
|
+
}),
|
|
1289
1297
|
/* @__PURE__ */ jsx("text", {
|
|
1290
1298
|
x: flip ? x - em * .3 : x + em * .3,
|
|
1291
1299
|
y: top + em * (.9 + row),
|
|
1292
1300
|
textAnchor: flip ? "end" : "start",
|
|
1293
1301
|
className: "ov-mark-label",
|
|
1294
|
-
children: mark
|
|
1302
|
+
children: markName(mark)
|
|
1295
1303
|
})
|
|
1296
1304
|
]
|
|
1297
1305
|
});
|
|
@@ -1302,7 +1310,7 @@ function EventList({ marks, bands, format }) {
|
|
|
1302
1310
|
const items = [...marks.map((m) => ({
|
|
1303
1311
|
at: m.at,
|
|
1304
1312
|
kind: m.kind,
|
|
1305
|
-
text: `${m
|
|
1313
|
+
text: `${markName(m)} · ${format(m.at)}${m.verdict ? ` · ${m.verdict}` : ""}`
|
|
1306
1314
|
})), ...bands.map((b) => ({
|
|
1307
1315
|
at: b.from,
|
|
1308
1316
|
kind: b.kind,
|
|
@@ -1683,4 +1691,46 @@ function FigureView({ figure, presentation = "chart" }) {
|
|
|
1683
1691
|
});
|
|
1684
1692
|
}
|
|
1685
1693
|
//#endregion
|
|
1686
|
-
|
|
1694
|
+
//#region src/react/timeline-view.tsx
|
|
1695
|
+
/** The static `timeline` in React, with lanes that fold by subtree. A parent lane's label is a toggle: a click, Enter
|
|
1696
|
+
* or Space folds its descendants away, and the folded lane's ticks and counts then total its subtree. */
|
|
1697
|
+
function TimelineView({ lanes, options, defaultCollapsed = [], presentation }) {
|
|
1698
|
+
const [collapsed, setCollapsed] = useState(defaultCollapsed);
|
|
1699
|
+
const box = useRef(null);
|
|
1700
|
+
const refocus = useRef(null);
|
|
1701
|
+
const figure = useMemo(() => timeline(lanes, {
|
|
1702
|
+
...options,
|
|
1703
|
+
collapsed
|
|
1704
|
+
}), [
|
|
1705
|
+
lanes,
|
|
1706
|
+
options,
|
|
1707
|
+
collapsed
|
|
1708
|
+
]);
|
|
1709
|
+
useEffect(() => {
|
|
1710
|
+
const id = refocus.current;
|
|
1711
|
+
refocus.current = null;
|
|
1712
|
+
if (id === null || !box.current) return;
|
|
1713
|
+
Array.from(box.current.querySelectorAll("[data-toggle]")).find((element) => element.getAttribute("data-toggle") === id)?.focus();
|
|
1714
|
+
}, [figure]);
|
|
1715
|
+
const fold = (target, keyboard) => {
|
|
1716
|
+
const id = target instanceof Element ? target.closest("[data-toggle]")?.getAttribute("data-toggle") : null;
|
|
1717
|
+
if (!id) return false;
|
|
1718
|
+
if (keyboard) refocus.current = id;
|
|
1719
|
+
setCollapsed((list) => list.includes(id) ? list.filter((other) => other !== id) : [...list, id]);
|
|
1720
|
+
return true;
|
|
1721
|
+
};
|
|
1722
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1723
|
+
ref: box,
|
|
1724
|
+
className: "tgc-timeline-view",
|
|
1725
|
+
onClick: (event) => fold(event.target, false),
|
|
1726
|
+
onKeyDown: (event) => {
|
|
1727
|
+
if ((event.key === "Enter" || event.key === " ") && fold(event.target, true)) event.preventDefault();
|
|
1728
|
+
},
|
|
1729
|
+
children: /* @__PURE__ */ jsx(FigureView, {
|
|
1730
|
+
figure,
|
|
1731
|
+
presentation
|
|
1732
|
+
})
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
//#endregion
|
|
1736
|
+
export { DEFAULT_SPARKLINE_EMPTY_LABEL, DEFAULT_SPARKLINE_HEIGHT, DEFAULT_SPARKLINE_LABEL, DEFAULT_SPARKLINE_UNAVAILABLE_LABEL, DEFAULT_SPARKLINE_WIDTH, DayBars, FigureView, Gantt, HBars, Histogram, LIVE_SERIES, Lines, Meter, Spark, Sparkline, StackedBarChart, TimelineView, WaterfallBar, WaterfallHeader, WaterfallRow, WaterfallTimeAxis, formatCompact, formatSparklineValue, formatWaterfallDuration, sparklineGeometry, sparklineLabel, sparklinePointsAttribute, sparklineReadings, waterfallSpanGeometry, waterfallTicks };
|
package/dist/react/live.css
CHANGED
|
@@ -31,9 +31,25 @@ line.ov-gridline { stroke: color-mix(in srgb, var(--chart-live-faint, #777) 22%,
|
|
|
31
31
|
.ov-mark-deadline { stroke: var(--chart-live-fg, var(--chart-ink)); stroke-dasharray: 5 3; }
|
|
32
32
|
.ov-mark-died { stroke: var(--chart-live-danger, var(--chart-breach, var(--status-error))); stroke-width: 2; }
|
|
33
33
|
.ov-mark-event { stroke: var(--chart-live-muted, var(--chart-ink-muted)); stroke-dasharray: 1 3; stroke-linecap: round; }
|
|
34
|
+
.ov-mark-release { stroke: var(--chart-live-muted, var(--chart-ink-muted)); }
|
|
35
|
+
.ov-mark-steer { stroke: var(--chart-live-accent, var(--chart-accent)); stroke-dasharray: 1 3; stroke-linecap: round; }
|
|
36
|
+
.ov-mark-ruling { stroke: var(--chart-live-fg, var(--chart-ink)); stroke-dasharray: 6 2 1 2; }
|
|
37
|
+
.ov-mark-wake { stroke: var(--chart-live-muted, var(--chart-ink-muted)); stroke-dasharray: 1 3; stroke-linecap: round; }
|
|
38
|
+
.ov-mark-head { fill: var(--chart-live-muted, var(--chart-ink-muted)); stroke: var(--chart-live-surface, var(--chart-canvas)); stroke-width: 1; }
|
|
39
|
+
[data-mark="steer"] .ov-mark-head { fill: var(--chart-live-accent, var(--chart-accent)); }
|
|
40
|
+
[data-mark="ruling"] .ov-mark-head { fill: var(--chart-live-fg, var(--chart-ink)); }
|
|
41
|
+
.ov-verdict-pass .ov-mark { stroke: var(--chart-live-pass, var(--chart-pass, var(--status-running))); }
|
|
42
|
+
.ov-verdict-pass .ov-mark-head { fill: var(--chart-live-pass, var(--chart-pass, var(--status-running))); }
|
|
43
|
+
.ov-verdict-fail .ov-mark { stroke: var(--chart-live-danger, var(--chart-breach, var(--status-error))); }
|
|
44
|
+
.ov-verdict-fail .ov-mark-head { fill: var(--chart-live-danger, var(--chart-breach, var(--status-error))); }
|
|
45
|
+
.ov-verdict-unknown .ov-mark { stroke: var(--chart-live-faint, var(--chart-muted)); }
|
|
46
|
+
.ov-verdict-unknown .ov-mark-head { fill: var(--chart-live-faint, var(--chart-muted)); }
|
|
34
47
|
.ov-mark-label { fill: var(--chart-live-fg, var(--chart-ink)); font-size: .75em; paint-order: stroke; stroke: var(--chart-live-surface, var(--chart-canvas)); stroke-width: 3px; stroke-linejoin: round; }
|
|
35
48
|
.ov-band-after-pass { fill: color-mix(in srgb, var(--chart-live-pass, var(--chart-pass, var(--status-running))) 12%, transparent); }
|
|
36
49
|
.ov-band-idle { fill: var(--chart-live-hover, var(--chart-shade)); }
|
|
50
|
+
.ov-band-blocked { fill: color-mix(in srgb, var(--chart-live-danger, var(--chart-breach, var(--status-error))) 9%, transparent); }
|
|
51
|
+
/* A group band labels a run of positions; in the live renderer it is an outline, never a fill over the data. */
|
|
52
|
+
.ov-band-group { fill: none; stroke: var(--chart-live-border, var(--chart-rule)); stroke-dasharray: 2 3; }
|
|
37
53
|
/* Missing data is hatched, never drawn as zero. */
|
|
38
54
|
.ov-hatch-bg { fill: color-mix(in srgb, var(--chart-live-faint, var(--chart-muted)) 10%, transparent); }
|
|
39
55
|
.ov-hatch { fill: none; stroke: var(--chart-live-faint, var(--chart-muted)); stroke-width: 1; }
|
|
@@ -49,7 +65,10 @@ line.ov-gridline { stroke: color-mix(in srgb, var(--chart-live-faint, #777) 22%,
|
|
|
49
65
|
.ov-event-pass { border-left: 2px solid var(--chart-live-pass, var(--chart-pass, var(--status-running))); border-radius: 0; width: 0; }
|
|
50
66
|
.ov-event-deadline { border-left: 2px dashed var(--chart-live-fg, var(--chart-ink)); border-radius: 0; width: 0; }
|
|
51
67
|
.ov-event-died { border-left: 2px solid var(--chart-live-danger, var(--chart-breach, var(--status-error))); border-radius: 0; width: 0; }
|
|
52
|
-
.ov-event-event { border-left: 2px dotted var(--chart-live-muted, var(--chart-ink-muted)); border-radius: 0; width: 0; }
|
|
68
|
+
.ov-event-event, .ov-event-steer, .ov-event-wake { border-left: 2px dotted var(--chart-live-muted, var(--chart-ink-muted)); border-radius: 0; width: 0; }
|
|
69
|
+
.ov-event-release { border-left: 2px solid var(--chart-live-muted, var(--chart-ink-muted)); border-radius: 0; width: 0; }
|
|
70
|
+
.ov-event-ruling { border-left: 2px dashed var(--chart-live-fg, var(--chart-ink)); border-radius: 0; width: 0; }
|
|
71
|
+
.ov-event-blocked { background: color-mix(in srgb, var(--chart-live-danger, var(--chart-breach, var(--status-error))) 25%, transparent); }
|
|
53
72
|
.ov-event-after-pass { background: color-mix(in srgb, var(--chart-live-pass, var(--chart-pass, var(--status-running))) 25%, transparent); }
|
|
54
73
|
.ov-event-idle { background: var(--chart-live-hover, var(--chart-shade)); }
|
|
55
74
|
.ov-event-missing { background: repeating-linear-gradient(135deg, var(--chart-live-faint, var(--chart-muted)) 0 1px, transparent 1px 4px); }
|