@mechane-ai/elements 0.59.0 → 0.61.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 +54 -53
- package/dist/ai.js +269 -200
- package/dist/catalog.json +41 -1
- package/dist/chart-range-Du1gDxCY.js +163 -0
- package/dist/charts/cartesian.js +1 -1
- package/dist/charts/figure.js +2 -2
- package/dist/charts/timeline.js +3 -1
- package/dist/kits/operations.js +2 -2
- package/dist/kits/research.js +1 -1
- package/dist/packages/ai/src/command-activity.d.ts +5 -1
- package/dist/packages/ai/src/index.d.ts +1 -1
- package/dist/packages/ai/src/message.d.ts +9 -1
- package/dist/packages/charts/src/timeline/index.d.ts +5 -1
- package/dist/packages/charts/src/timeline/trace-timeline-layout.d.ts +106 -0
- package/dist/packages/charts/src/timeline/trace-timeline.d.ts +39 -0
- package/dist/packages/charts/src/timeline/waterfall.d.ts +23 -7
- package/dist/styles2.css +67 -7
- package/dist/{time-series-CoAtNizi.js → time-series-BbUBF3IE.js} +521 -679
- package/dist/timeline-kDb6bY7M.js +712 -0
- package/dist/waterfall-Dre6i02Z.js +684 -0
- package/package.json +1 -1
- package/dist/waterfall-BjUXqaWu.js +0 -615
package/dist/catalog.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@mechane-ai/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.0",
|
|
4
4
|
"recipes": [
|
|
5
5
|
{
|
|
6
6
|
"slug": "allocation-report",
|
|
@@ -1511,6 +1511,10 @@
|
|
|
1511
1511
|
"kind": "type",
|
|
1512
1512
|
"declaration": "dist/packages/ai/src/message.d.ts"
|
|
1513
1513
|
},
|
|
1514
|
+
"MessageSpeakerTone": {
|
|
1515
|
+
"kind": "type",
|
|
1516
|
+
"declaration": "dist/packages/ai/src/message.d.ts"
|
|
1517
|
+
},
|
|
1514
1518
|
"MessageProps": {
|
|
1515
1519
|
"kind": "type",
|
|
1516
1520
|
"declaration": "dist/packages/ai/src/message.d.ts"
|
|
@@ -2425,6 +2429,42 @@
|
|
|
2425
2429
|
"kind": "value",
|
|
2426
2430
|
"declaration": "dist/packages/charts/src/timeline/event-strip.d.ts"
|
|
2427
2431
|
},
|
|
2432
|
+
"TraceAction": {
|
|
2433
|
+
"kind": "type",
|
|
2434
|
+
"declaration": "dist/packages/charts/src/timeline/trace-timeline-layout.d.ts"
|
|
2435
|
+
},
|
|
2436
|
+
"TraceCategory": {
|
|
2437
|
+
"kind": "type",
|
|
2438
|
+
"declaration": "dist/packages/charts/src/timeline/trace-timeline-layout.d.ts"
|
|
2439
|
+
},
|
|
2440
|
+
"TraceLane": {
|
|
2441
|
+
"kind": "type",
|
|
2442
|
+
"declaration": "dist/packages/charts/src/timeline/trace-timeline-layout.d.ts"
|
|
2443
|
+
},
|
|
2444
|
+
"TraceLink": {
|
|
2445
|
+
"kind": "type",
|
|
2446
|
+
"declaration": "dist/packages/charts/src/timeline/trace-timeline-layout.d.ts"
|
|
2447
|
+
},
|
|
2448
|
+
"TraceSpan": {
|
|
2449
|
+
"kind": "type",
|
|
2450
|
+
"declaration": "dist/packages/charts/src/timeline/trace-timeline-layout.d.ts"
|
|
2451
|
+
},
|
|
2452
|
+
"traceTimelineLimits": {
|
|
2453
|
+
"kind": "value",
|
|
2454
|
+
"declaration": "dist/packages/charts/src/timeline/trace-timeline-layout.d.ts"
|
|
2455
|
+
},
|
|
2456
|
+
"TraceTimelineProps": {
|
|
2457
|
+
"kind": "type",
|
|
2458
|
+
"declaration": "dist/packages/charts/src/timeline/trace-timeline.d.ts"
|
|
2459
|
+
},
|
|
2460
|
+
"TraceTimeline": {
|
|
2461
|
+
"kind": "value",
|
|
2462
|
+
"declaration": "dist/packages/charts/src/timeline/trace-timeline.d.ts"
|
|
2463
|
+
},
|
|
2464
|
+
"WaterfallDensity": {
|
|
2465
|
+
"kind": "type",
|
|
2466
|
+
"declaration": "dist/packages/charts/src/timeline/waterfall.d.ts"
|
|
2467
|
+
},
|
|
2428
2468
|
"WaterfallGeometry": {
|
|
2429
2469
|
"kind": "type",
|
|
2430
2470
|
"declaration": "dist/packages/charts/src/timeline/waterfall.d.ts"
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as e from "@stylexjs/stylex";
|
|
2
|
+
import { createParts as t } from "@ui-sdk/react/primitive";
|
|
3
|
+
import { createChange as n, createSpans as r, definePrimitive as i } from "@ui-sdk/core";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
// packages/charts/src/chart-range.tsx
|
|
6
|
+
var s = "axis", c = "selected", l = "drawn";
|
|
7
|
+
function u({ value: e }) {
|
|
8
|
+
return {
|
|
9
|
+
value: e,
|
|
10
|
+
spans: e === null ? [] : [{
|
|
11
|
+
id: c,
|
|
12
|
+
track: s,
|
|
13
|
+
start: e[0],
|
|
14
|
+
end: e[1]
|
|
15
|
+
}]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function d(e, t) {
|
|
19
|
+
let { draft: n } = e;
|
|
20
|
+
return n?.action === "draw" ? t.filter((e) => e.id === n.id) : t;
|
|
21
|
+
}
|
|
22
|
+
var f = i({
|
|
23
|
+
name: "chart-range",
|
|
24
|
+
options: {
|
|
25
|
+
value: "value",
|
|
26
|
+
onValueChange: "callback",
|
|
27
|
+
min: "number",
|
|
28
|
+
max: "number",
|
|
29
|
+
step: "number",
|
|
30
|
+
describe: "value"
|
|
31
|
+
},
|
|
32
|
+
controlled: ["value"],
|
|
33
|
+
state: (e) => ({
|
|
34
|
+
...u(e),
|
|
35
|
+
draft: null
|
|
36
|
+
}),
|
|
37
|
+
sync: u,
|
|
38
|
+
api: (e) => {
|
|
39
|
+
let t = n(e);
|
|
40
|
+
function i(n, { id: r, action: i, reason: a, event: o }) {
|
|
41
|
+
let s = i === "delete" ? void 0 : n.find((e) => e.id === r), c = s === void 0 ? null : [s.start, s.end], l = t("value", c, o === void 0 ? { reason: a } : {
|
|
42
|
+
reason: a,
|
|
43
|
+
event: o
|
|
44
|
+
});
|
|
45
|
+
return l && i === "delete" && e.element("root")?.querySelector("[tabindex=\"0\"]:not([data-span-id])")?.focus(), l;
|
|
46
|
+
}
|
|
47
|
+
let a = r(e, {
|
|
48
|
+
key: "spans",
|
|
49
|
+
draft: "draft",
|
|
50
|
+
axis: "x",
|
|
51
|
+
min: () => e.options().min,
|
|
52
|
+
max: () => e.options().max,
|
|
53
|
+
step: () => e.options().step,
|
|
54
|
+
create: (e) => ({
|
|
55
|
+
...e,
|
|
56
|
+
id: l
|
|
57
|
+
}),
|
|
58
|
+
label: (t) => e.options().describe([t.start, t.end]),
|
|
59
|
+
createAutoScroll: !1,
|
|
60
|
+
set: (e, t) => i(e, t)
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
spans: a,
|
|
64
|
+
shown(t) {
|
|
65
|
+
return d(t, a.spans(t)).map((t) => ({
|
|
66
|
+
id: t.id,
|
|
67
|
+
label: e.options().describe([t.start, t.end])
|
|
68
|
+
}));
|
|
69
|
+
},
|
|
70
|
+
draw(e) {
|
|
71
|
+
e.button === 0 && e.pointerType !== "touch" && a.trackPointerdown(e, s);
|
|
72
|
+
},
|
|
73
|
+
setRange(n, r) {
|
|
74
|
+
let { min: i, max: a, step: o } = e.options(), s = [Number(n), Number(r)].map((e) => i + Math.round((e - i) / o) * o), c = Math.max(i, Math.min(...s)), l = Math.min(a, Math.max(...s));
|
|
75
|
+
if (!Number.isFinite(c) || !Number.isFinite(l) || c >= l) throw Error(`Give a start and a later end between ${i} and ${a}.`);
|
|
76
|
+
return t("value", [c, l], { reason: "imperative" });
|
|
77
|
+
},
|
|
78
|
+
clear() {
|
|
79
|
+
return t("value", null, { reason: "imperative" });
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
slots: (e) => ({
|
|
84
|
+
root: e({
|
|
85
|
+
role: "group",
|
|
86
|
+
state: (e, { api: t }) => ({ spans: t.shown(e) }),
|
|
87
|
+
on: { pointerdown: (e, { api: t }) => t.draw(e) }
|
|
88
|
+
}),
|
|
89
|
+
track: e({ bind: (e, { api: t }) => t.spans.bindTrack(e, s) }),
|
|
90
|
+
span: e({
|
|
91
|
+
role: "group",
|
|
92
|
+
props: { value: "string" },
|
|
93
|
+
attrs: (e, { api: t, key: n }) => {
|
|
94
|
+
let r = t.spans.spans(e).find((e) => e.id === n);
|
|
95
|
+
return {
|
|
96
|
+
...t.spans.spanAttrs(e, n),
|
|
97
|
+
tabindex: "0",
|
|
98
|
+
style: r === void 0 ? void 0 : t.spans.spanStyle(r)
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
bind: (e, { api: t, key: n }) => t.spans.bindSpan(e, n),
|
|
102
|
+
on: {
|
|
103
|
+
pointerdown: (e, { api: t, key: n }) => t.spans.spanPointerdown(e, n),
|
|
104
|
+
keydown: (e, { api: t, key: n }) => {
|
|
105
|
+
t.spans.keydown(e, n);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
agent: { actions: ["setRange", "clear"] }
|
|
111
|
+
}), p = t(f, {
|
|
112
|
+
root: "div",
|
|
113
|
+
track: "div",
|
|
114
|
+
span: "div"
|
|
115
|
+
}), m = p.Root, h = p.Track, g = p.Span, _ = {
|
|
116
|
+
kVAEAm: "x10l6tqk",
|
|
117
|
+
k87sOh: "x13vifvy",
|
|
118
|
+
kfzvcC: "x47corl",
|
|
119
|
+
$$css: !0
|
|
120
|
+
}, v = { track: (e, t, n) => [
|
|
121
|
+
_,
|
|
122
|
+
{
|
|
123
|
+
kbCHJM: e == null ? e : "xgq9j65",
|
|
124
|
+
kzqmXN: t == null ? t : "x5lhr3w",
|
|
125
|
+
kZKoxP: n == null ? n : "x16ye13r",
|
|
126
|
+
$$css: !0
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
130
|
+
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t),
|
|
131
|
+
"--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(n)
|
|
132
|
+
}
|
|
133
|
+
] };
|
|
134
|
+
function y({ left: t, width: n, height: r, label: i, children: s, ...c }) {
|
|
135
|
+
return /* @__PURE__ */ a(m, {
|
|
136
|
+
...c,
|
|
137
|
+
"aria-label": i,
|
|
138
|
+
className: "x1n2onr6 xeuugli",
|
|
139
|
+
render: (i, { spans: c }) => /* @__PURE__ */ o("div", {
|
|
140
|
+
...i,
|
|
141
|
+
children: [s, /* @__PURE__ */ a(h, {
|
|
142
|
+
...e.props(v.track(t, n, r)),
|
|
143
|
+
children: c.map((e) => /* @__PURE__ */ o(g, {
|
|
144
|
+
value: e.id,
|
|
145
|
+
"aria-label": `Selected range, ${e.label}. Use arrow keys to move it, Shift and an arrow to move its end, and Delete to clear it.`,
|
|
146
|
+
className: "x10l6tqk x13vifvy x5yr21d x9f619 x1qatu44 x1l0rsgs x1616tdu xbsl7fq xbm8b0d x1n2ykn x1t137rt x19rmrnh x9v5kkp x13qnu6 x1bqaal",
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ a("span", { className: "x10l6tqk x67bb7w x5ve5x3 x7it7wx x1ey2m1c xdk7pt x1jm3nie x1o753nm x1jzqe4 x3onkmb" }),
|
|
149
|
+
/* @__PURE__ */ a("span", {
|
|
150
|
+
"data-span-edge": "start",
|
|
151
|
+
className: "x10l6tqk x67bb7w x5ve5x3 x13vifvy x5yr21d x1fsd2vl x7eptgl x1765b1"
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ a("span", {
|
|
154
|
+
"data-span-edge": "end",
|
|
155
|
+
className: "x10l6tqk x67bb7w x5ve5x3 x13vifvy x5yr21d x1fsd2vl x7eptgl xpa5qit"
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
}, e.id))
|
|
159
|
+
})]
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
export { y as t };
|
package/dist/charts/cartesian.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as AreaChart, p as BarChart, m as BarChartPlaceholder, f as BreakdownBar, d as BridgeChart, n as LineChart, l as ScatterPlot, r as SmallMultiples, i as SmallMultiplesPlaceholder, s as Sparkline, a as TimeSeriesChartPlaceholder, u as scatterLimits, o as timeSeriesBandLimits, c as timeSeriesLimits } from "../time-series-
|
|
1
|
+
export { t as AreaChart, p as BarChart, m as BarChartPlaceholder, f as BreakdownBar, d as BridgeChart, n as LineChart, l as ScatterPlot, r as SmallMultiples, i as SmallMultiplesPlaceholder, s as Sparkline, a as TimeSeriesChartPlaceholder, u as scatterLimits, o as timeSeriesBandLimits, c as timeSeriesLimits } from "../time-series-BbUBF3IE.js";
|
package/dist/charts/figure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as e, f as t, l as n, n as r, p as i, r as a, s as o, t as s } from "../time-series-
|
|
1
|
+
import { d as e, f as t, l as n, n as r, p as i, r as a, s as o, t as s } from "../time-series-BbUBF3IE.js";
|
|
2
2
|
import { a as c, r as l, t as u } from "../dumbbell-plot-BeHhL-01.js";
|
|
3
3
|
import { a as d, d as f, f as p, l as ee, r as te, s as ne, t as re, u as ie } from "../violin-plot-ULdC_dcY.js";
|
|
4
4
|
import { a as ae, r as oe, s as se, t as ce } from "../tree-diagram-BDj4TGXb.js";
|
|
@@ -7,7 +7,7 @@ import { a as de, r as fe, t as pe } from "../image-grid-DB5U7Jtx.js";
|
|
|
7
7
|
import { c as me, i as he, o as m, r as ge, t as _e, u as ve } from "../token-heatmap-o_9l6vaq.js";
|
|
8
8
|
import { a as ye, l as be, r as xe, s as Se, t as Ce } from "../embedding-map-DbETVJXp.js";
|
|
9
9
|
import { a as we, c as Te, r as h, t as Ee } from "../token-predictions-DaAztlOS.js";
|
|
10
|
-
import { n as De, t as Oe } from "../waterfall-
|
|
10
|
+
import { n as De, t as Oe } from "../waterfall-Dre6i02Z.js";
|
|
11
11
|
import { a as ke, l as Ae, r as je, s as Me, t as Ne } from "../slope-chart-DTyF1lNG.js";
|
|
12
12
|
import { m as g } from "../values-963L6n1m.js";
|
|
13
13
|
import { a as _, r as v } from "../figure-frame-ClYRIRAq.js";
|
package/dist/charts/timeline.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "../waterfall-Dre6i02Z.js";
|
|
2
|
+
import { n as i, t as a } from "../timeline-kDb6bY7M.js";
|
|
3
|
+
export { t as EventStrip, a as TraceTimeline, r as Waterfall, n as eventStripGutter, e as eventStripLimits, i as traceTimelineLimits };
|
package/dist/kits/operations.js
CHANGED
|
@@ -3,8 +3,8 @@ import { r as t } from "../figure-format-B8kRZMlo.js";
|
|
|
3
3
|
import { t as n } from "../tone-scope-DKiSw-JR.js";
|
|
4
4
|
import { c as r, i, o as a, s as o } from "../src-9EJskqB_.js";
|
|
5
5
|
import { m as s } from "../src-C-Wg9m9H.js";
|
|
6
|
-
import { n as c } from "../waterfall-
|
|
7
|
-
import { r as l, s as u } from "../time-series-
|
|
6
|
+
import { n as c } from "../waterfall-Dre6i02Z.js";
|
|
7
|
+
import { r as l, s as u } from "../time-series-BbUBF3IE.js";
|
|
8
8
|
import { i as d, r as f } from "../src-4qgpiWvP.js";
|
|
9
9
|
import "@stylexjs/stylex";
|
|
10
10
|
import { useId as p } from "react";
|
package/dist/kits/research.js
CHANGED
|
@@ -6,7 +6,7 @@ import { D as w, _ as T, i as E, n as D } from "../src-Cuwx-PLT.js";
|
|
|
6
6
|
import { r as O } from "../figure-format-B8kRZMlo.js";
|
|
7
7
|
import { n as k } from "../src-na2DdkKI.js";
|
|
8
8
|
import { a as A, t as j } from "../tree-diagram-BDj4TGXb.js";
|
|
9
|
-
import { f as M } from "../time-series-
|
|
9
|
+
import { f as M } from "../time-series-BbUBF3IE.js";
|
|
10
10
|
import { i as N } from "../src-BAlO76fa.js";
|
|
11
11
|
import "@stylexjs/stylex";
|
|
12
12
|
import { useEffect as ee, useState as P } from "react";
|
|
@@ -3,5 +3,9 @@ import type { CommandDetailsProps } from './command-details.tsx';
|
|
|
3
3
|
export type CommandStatus = 'pending' | 'running' | 'complete' | 'failed' | 'stopped' | 'unknown';
|
|
4
4
|
export type CommandActivityProps = Omit<CommandDetailsProps, 'isRunning'> & {
|
|
5
5
|
readonly status: CommandStatus;
|
|
6
|
+
/** Optional right-aligned duration readout shown on the collapsed header row, e.g. `"1.5s"` or `"556ms"`. */
|
|
7
|
+
readonly duration?: string | undefined;
|
|
8
|
+
/** Optional right-aligned metadata beside `duration`, e.g. `"↑ 20.9K ↓ 372"`. */
|
|
9
|
+
readonly meta?: string | undefined;
|
|
6
10
|
};
|
|
7
|
-
export declare function CommandActivity({ status, ...details }: CommandActivityProps): ReactNode;
|
|
11
|
+
export declare function CommandActivity({ status, duration, meta, ...details }: CommandActivityProps): ReactNode;
|
|
@@ -6,7 +6,7 @@ export { CommandDetails } from './command-details.tsx';
|
|
|
6
6
|
export type { CommandDetailsProps } from './command-details.tsx';
|
|
7
7
|
export type { ConversationRootProps, ConversationViewportProps, ConversationContentProps, ConversationItemProps, ConversationJumpProps, ConversationControlsProps, ConversationLatestButtonProps, } from './conversation.tsx';
|
|
8
8
|
export { Conversation } from './conversation.tsx';
|
|
9
|
-
export type { MessageKind, MessageProps, MessageAttachmentProps } from './message.tsx';
|
|
9
|
+
export type { MessageKind, MessageSpeakerTone, MessageProps, MessageAttachmentProps } from './message.tsx';
|
|
10
10
|
export { Message, MessageAttachment } from './message.tsx';
|
|
11
11
|
export type { MessageActionProps } from './message-action.tsx';
|
|
12
12
|
export { MessageAction } from './message-action.tsx';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
export type MessageKind = 'user' | 'assistant' | 'system';
|
|
3
|
+
/** Semantic tone for the optional inline `speaker` pill badge on a `Message`. */
|
|
4
|
+
export type MessageSpeakerTone = 'neutral' | 'accent' | 'positive' | 'warning' | 'negative';
|
|
3
5
|
export type MessageProps = {
|
|
4
6
|
readonly author: string;
|
|
5
7
|
readonly children: ReactNode;
|
|
@@ -10,6 +12,12 @@ export type MessageProps = {
|
|
|
10
12
|
readonly actions?: ReactNode;
|
|
11
13
|
readonly attachments?: ReactNode;
|
|
12
14
|
readonly variant?: 'default' | 'chat';
|
|
15
|
+
/** Optional compact inline pill badge naming the speaker role in a multi-agent thread, e.g. `"Coordinator"`. */
|
|
16
|
+
readonly speaker?: string | undefined;
|
|
17
|
+
/** Semantic tone for the `speaker` pill badge. Defaults to `'neutral'`. */
|
|
18
|
+
readonly speakerTone?: MessageSpeakerTone | undefined;
|
|
19
|
+
/** Optional compact single-line quoted handoff context rendered with a subtle left rule above the message body. */
|
|
20
|
+
readonly quote?: string | undefined;
|
|
13
21
|
};
|
|
14
22
|
export type MessageAttachmentProps = {
|
|
15
23
|
readonly name: string;
|
|
@@ -17,5 +25,5 @@ export type MessageAttachmentProps = {
|
|
|
17
25
|
readonly href?: string;
|
|
18
26
|
readonly actions?: ReactNode;
|
|
19
27
|
};
|
|
20
|
-
export declare function Message({ author, children, id, kind, meta, avatar, actions, attachments, variant, }: MessageProps): ReactNode;
|
|
28
|
+
export declare function Message({ author, children, id, kind, meta, avatar, actions, attachments, variant, speaker, speakerTone, quote, }: MessageProps): ReactNode;
|
|
21
29
|
export declare function MessageAttachment({ name, description, href, actions }: MessageAttachmentProps): ReactNode;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export type { EventStripItem, EventStripLane, EventStripMarker, EventStripProps, EventStripTime, EventStripWindow, } from './event-strip.tsx';
|
|
2
2
|
export { EventStrip, eventStripGutter, eventStripLimits } from './event-strip.tsx';
|
|
3
|
-
export type {
|
|
3
|
+
export type { TraceAction, TraceCategory, TraceLane, TraceLink, TraceSpan } from './trace-timeline-layout.ts';
|
|
4
|
+
export { traceTimelineLimits } from './trace-timeline-layout.ts';
|
|
5
|
+
export type { TraceTimelineProps } from './trace-timeline.tsx';
|
|
6
|
+
export { TraceTimeline } from './trace-timeline.tsx';
|
|
7
|
+
export type { WaterfallDensity, WaterfallGeometry, WaterfallItem, WaterfallProps, WaterfallSelectDetails, WaterfallTone, } from './waterfall.tsx';
|
|
4
8
|
export { Waterfall } from './waterfall.tsx';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
2
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
3
|
+
/** One horizontal swimlane in a trace timeline, such as a thread, worker, or service. */
|
|
4
|
+
export type TraceLane = {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
/** Default hue for spans in this lane when neither the span nor its category sets one. */
|
|
8
|
+
readonly tone?: ChartTone | undefined;
|
|
9
|
+
};
|
|
10
|
+
/** One named span category used for color-coding and legend filtering. */
|
|
11
|
+
export type TraceCategory = {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly tone: ChartTone;
|
|
15
|
+
};
|
|
16
|
+
/** One timed execution span drawn as a horizontal bar in a swimlane. */
|
|
17
|
+
export type TraceSpan = {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly laneId: string;
|
|
20
|
+
readonly parentId?: string | undefined;
|
|
21
|
+
readonly label: string;
|
|
22
|
+
readonly detail?: string | undefined;
|
|
23
|
+
/** Start offset in the timeline's numeric unit. */
|
|
24
|
+
readonly start: number;
|
|
25
|
+
/** End offset in the timeline's numeric unit; must be >= start. */
|
|
26
|
+
readonly end: number;
|
|
27
|
+
/** Category id matching `categories` for color-coding and filtering. */
|
|
28
|
+
readonly category?: string | undefined;
|
|
29
|
+
/** Direct hue override; takes precedence over category and lane tone. */
|
|
30
|
+
readonly tone?: ChartTone | undefined;
|
|
31
|
+
/** Short badge shown beside the span name in the selection bar, such as an HTTP status or token count. */
|
|
32
|
+
readonly badge?: string | undefined;
|
|
33
|
+
/** Other span ids kept at full emphasis when this span is selected. */
|
|
34
|
+
readonly relatedIds?: ReadonlyArray<string> | undefined;
|
|
35
|
+
};
|
|
36
|
+
/** An action wired into the contextual selection bar below the timeline. */
|
|
37
|
+
export type TraceAction = {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly label: string;
|
|
40
|
+
readonly onSelect?: (() => void) | undefined;
|
|
41
|
+
readonly href?: string | undefined;
|
|
42
|
+
readonly isExternal?: boolean | undefined;
|
|
43
|
+
};
|
|
44
|
+
/** A directed handoff or causal connector drawn between two spans across lanes. */
|
|
45
|
+
export type TraceLink = {
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly fromSpanId: string;
|
|
48
|
+
readonly toSpanId: string;
|
|
49
|
+
readonly label?: string | undefined;
|
|
50
|
+
readonly tone?: ChartTone | undefined;
|
|
51
|
+
};
|
|
52
|
+
/** The most lanes and spans one trace timeline draws before requiring aggregation. */
|
|
53
|
+
export declare const traceTimelineLimits: {
|
|
54
|
+
readonly lanes: 24;
|
|
55
|
+
readonly spans: 2000;
|
|
56
|
+
};
|
|
57
|
+
export declare const TRACE_ROW_HEIGHT = 26;
|
|
58
|
+
export declare const TRACE_LANE_PADDING = 6;
|
|
59
|
+
export declare const TRACE_BAR_HEIGHT = 18;
|
|
60
|
+
export declare const TRACE_BAR_MIN_WIDTH = 4;
|
|
61
|
+
export declare function traceProblem({ lanes, spans, domain, }: {
|
|
62
|
+
readonly lanes: ReadonlyArray<TraceLane>;
|
|
63
|
+
readonly spans: ReadonlyArray<TraceSpan>;
|
|
64
|
+
readonly domain: NumericDomain;
|
|
65
|
+
}): string | undefined;
|
|
66
|
+
export declare function clampRange(range: NumericDomain, domain: NumericDomain): NumericDomain;
|
|
67
|
+
export declare function zoomRange({ visible, domain, direction, anchorRatio, }: {
|
|
68
|
+
readonly visible: NumericDomain;
|
|
69
|
+
readonly domain: NumericDomain;
|
|
70
|
+
readonly direction: 'in' | 'out';
|
|
71
|
+
readonly anchorRatio?: number | undefined;
|
|
72
|
+
}): NumericDomain;
|
|
73
|
+
export declare function panRange({ visible, domain, direction, }: {
|
|
74
|
+
readonly visible: NumericDomain;
|
|
75
|
+
readonly domain: NumericDomain;
|
|
76
|
+
readonly direction: 'left' | 'right';
|
|
77
|
+
}): NumericDomain;
|
|
78
|
+
export declare function shiftRange({ visible, domain, delta, }: {
|
|
79
|
+
readonly visible: NumericDomain;
|
|
80
|
+
readonly domain: NumericDomain;
|
|
81
|
+
readonly delta: number;
|
|
82
|
+
}): NumericDomain;
|
|
83
|
+
export declare function fitSpanRange(span: TraceSpan, domain: NumericDomain): NumericDomain;
|
|
84
|
+
export declare function computeRelatedIds(selectedId: string | null | undefined, spans: ReadonlyArray<TraceSpan>, links?: ReadonlyArray<TraceLink>): ReadonlySet<string> | undefined;
|
|
85
|
+
export type TraceSpanGeometry = {
|
|
86
|
+
readonly x1: number;
|
|
87
|
+
readonly x2: number;
|
|
88
|
+
readonly y: number;
|
|
89
|
+
};
|
|
90
|
+
export type TraceLinkGeometry = {
|
|
91
|
+
readonly path: string;
|
|
92
|
+
readonly arrowPoints: string;
|
|
93
|
+
};
|
|
94
|
+
export declare function traceLinkGeometry({ from, to, }: {
|
|
95
|
+
readonly from: TraceSpanGeometry;
|
|
96
|
+
readonly to: TraceSpanGeometry;
|
|
97
|
+
}): TraceLinkGeometry;
|
|
98
|
+
export declare function packLaneSpans({ lanes, spans, minExtent, }: {
|
|
99
|
+
readonly lanes: ReadonlyArray<TraceLane>;
|
|
100
|
+
readonly spans: ReadonlyArray<TraceSpan>;
|
|
101
|
+
readonly minExtent: number;
|
|
102
|
+
}): {
|
|
103
|
+
readonly rowBySpanId: ReadonlyMap<string, number>;
|
|
104
|
+
readonly rowCountByLane: ReadonlyArray<number>;
|
|
105
|
+
};
|
|
106
|
+
export declare function fitBarLabel(label: string, duration: string, widthPx: number): string | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
5
|
+
import type { TraceAction, TraceCategory, TraceLane, TraceLink, TraceSpan } from './trace-timeline-layout.ts';
|
|
6
|
+
/** Props for an APM-style swimlane span timeline with minimap zoom, panning, and causal highlighting. */
|
|
7
|
+
export type TraceTimelineProps = FigureProps & FigureSelectionProps & {
|
|
8
|
+
readonly lanes: ReadonlyArray<TraceLane>;
|
|
9
|
+
readonly spans: ReadonlyArray<TraceSpan>;
|
|
10
|
+
/** Optional directed handoff or causal links drawn as curved arrows between spans across lanes. */
|
|
11
|
+
readonly links?: ReadonlyArray<TraceLink> | undefined;
|
|
12
|
+
/** Full trace domain in `offsetFormat` units, such as `[0, 47.5]` seconds or `[0, 47500]` ms. */
|
|
13
|
+
readonly domain: NumericDomain;
|
|
14
|
+
/** Optional categories used to color-code bars and render clickable filter pills. */
|
|
15
|
+
readonly categories?: ReadonlyArray<TraceCategory> | undefined;
|
|
16
|
+
/** Controlled visible time window inside `domain`. Leave unset for uncontrolled zoom/pan. */
|
|
17
|
+
readonly visibleRange?: NumericDomain | undefined;
|
|
18
|
+
readonly onVisibleRangeChange?: ((range: NumericDomain) => void) | undefined;
|
|
19
|
+
/** How offsets and durations are formatted along the axis and selection bar. */
|
|
20
|
+
readonly offsetFormat: ValueFormat;
|
|
21
|
+
/**
|
|
22
|
+
* Explicit span ids kept at full emphasis; when omitted, selection highlights ancestors, children, and
|
|
23
|
+
* `relatedIds`.
|
|
24
|
+
*/
|
|
25
|
+
readonly highlightedIds?: ReadonlyArray<string> | undefined;
|
|
26
|
+
/** Called when the reader activates a span by double-clicking or pressing Enter while it is selected. */
|
|
27
|
+
readonly onActivateSpan?: ((span: TraceSpan) => void) | undefined;
|
|
28
|
+
/** Contextual actions rendered in the slim selection bar beneath the plot for the selected span. */
|
|
29
|
+
readonly spanActions?: ((span: TraceSpan) => ReadonlyArray<TraceAction>) | undefined;
|
|
30
|
+
/** Whether to display the brushable minimap overview scrubber above the swimlanes. Defaults to true. */
|
|
31
|
+
readonly isMinimapVisible?: boolean | undefined;
|
|
32
|
+
/** Label for the horizontal time axis. Defaults to "Elapsed". */
|
|
33
|
+
readonly xTitle?: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* An APM-style swimlane span timeline for multi-step execution traces. It draws color-coded duration bars stacked per
|
|
37
|
+
* lane on a relative time axis. Readers can zoom and pan, highlight causally related spans, and trigger wired actions.
|
|
38
|
+
*/
|
|
39
|
+
export declare function TraceTimeline({ lanes, spans, links, domain, categories, visibleRange, onVisibleRangeChange, offsetFormat, selected, onSelectedChange, highlightedIds, onActivateSpan, spanActions, isMinimapVisible, xTitle, ...figure }: TraceTimelineProps): ReactNode;
|
|
@@ -3,6 +3,7 @@ import type { ReactNode, Ref } from 'react';
|
|
|
3
3
|
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
4
4
|
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
5
5
|
import type { FigureProps } from '../figure/figure-props.ts';
|
|
6
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
6
7
|
/** A row's timing: two recorded endpoints, one recorded instant, or none. Nothing is drawn from a missing endpoint. */
|
|
7
8
|
export type WaterfallGeometry = {
|
|
8
9
|
readonly kind: 'interval';
|
|
@@ -15,11 +16,17 @@ export type WaterfallGeometry = {
|
|
|
15
16
|
} | {
|
|
16
17
|
readonly kind: 'unavailable';
|
|
17
18
|
};
|
|
18
|
-
/** The
|
|
19
|
-
export type WaterfallTone =
|
|
19
|
+
/** The hues a waterfall row takes: neutral, semantic positive/negative, or any numbered series hue. */
|
|
20
|
+
export type WaterfallTone = ChartTone;
|
|
21
|
+
/** Row height density: compact single-line APM rows or comfortable uniform two-line rows. */
|
|
22
|
+
export type WaterfallDensity = 'compact' | 'comfortable';
|
|
20
23
|
/** One timed row. Rows keep the supplied order and share one scale. */
|
|
21
24
|
export type WaterfallItem = {
|
|
22
25
|
readonly id: string;
|
|
26
|
+
/** Optional parent row id to indent nested child spans and enable branch collapse. */
|
|
27
|
+
readonly parentId?: string | undefined;
|
|
28
|
+
/** Optional explicit indentation level (0–6) when `parentId` is omitted. */
|
|
29
|
+
readonly depth?: number | undefined;
|
|
23
30
|
readonly label: string;
|
|
24
31
|
readonly detail: string;
|
|
25
32
|
readonly summary: string;
|
|
@@ -31,23 +38,32 @@ export type WaterfallItem = {
|
|
|
31
38
|
};
|
|
32
39
|
/** Why the selection wants to change: a press or Enter on a row, or a call such as an agent's step. */
|
|
33
40
|
export type WaterfallSelectDetails = Parameters<NonNullable<SpansProps['onValueChange']>>[1];
|
|
41
|
+
/** Props for a uniform-row timing waterfall supporting full series color-coding, tree nesting, and zoom sync. */
|
|
34
42
|
export type WaterfallProps = Pick<FigureProps, 'title' | 'description' | 'report' | 'actions' | 'locale' | 'source' | 'transforms' | 'emptyLabel'> & {
|
|
35
43
|
readonly items: ReadonlyArray<WaterfallItem>;
|
|
36
|
-
/** The time domain every row shares, in the unit of `offsetFormat`. */
|
|
44
|
+
/** The full time domain every row shares, in the unit of `offsetFormat`. */
|
|
37
45
|
readonly start: number;
|
|
38
46
|
readonly end: number;
|
|
47
|
+
/** Optional zoomed time window inside `[start, end]` to sync with a parent timeline. */
|
|
48
|
+
readonly visibleRange?: NumericDomain | undefined;
|
|
39
49
|
readonly rowLabel: string;
|
|
40
50
|
readonly summaryLabel: string;
|
|
51
|
+
/** Uniform row density. Defaults to `'comfortable'`. */
|
|
52
|
+
readonly density?: WaterfallDensity | undefined;
|
|
41
53
|
readonly selected?: string | null | undefined;
|
|
42
54
|
/** The selected row, which takes focus, so an owner can return focus to it. */
|
|
43
55
|
readonly selectedRef?: Ref<HTMLDivElement> | undefined;
|
|
44
56
|
readonly onSelectedChange: (id: string, details: WaterfallSelectDetails) => void;
|
|
57
|
+
/** Optional row ids kept at full emphasis while non-matching rows recede. */
|
|
58
|
+
readonly highlightedIds?: ReadonlyArray<string> | undefined;
|
|
59
|
+
/** Called when the reader activates a row by double-clicking it. */
|
|
60
|
+
readonly onActivate?: ((id: string) => void) | undefined;
|
|
45
61
|
/** How a time from the start of the domain is written, with its unit. */
|
|
46
62
|
readonly offsetFormat: ValueFormat;
|
|
47
63
|
};
|
|
48
64
|
/**
|
|
49
|
-
* Recorded intervals and instants of many rows on one time scale, such as the steps of a request or
|
|
50
|
-
*
|
|
51
|
-
*
|
|
65
|
+
* Recorded intervals and instants of many rows on one time scale, such as the steps of a request or an agent run. Every
|
|
66
|
+
* row keeps a uniform fixed height with single-line ellipsis truncation, supports full series color-coding, optional
|
|
67
|
+
* parent-child hierarchy, and synced zoom windows via `visibleRange`.
|
|
52
68
|
*/
|
|
53
|
-
export declare function Waterfall({ items, start, end, rowLabel, summaryLabel, emptyLabel, selected, selectedRef, onSelectedChange, offsetFormat, ...frame }: WaterfallProps): ReactNode;
|
|
69
|
+
export declare function Waterfall({ items, start, end, visibleRange, rowLabel, summaryLabel, density, emptyLabel, selected, selectedRef, onSelectedChange, highlightedIds, onActivate, offsetFormat, ...frame }: WaterfallProps): ReactNode;
|