@lincyaw/aegis-ui 0.19.0 → 0.20.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/dist/components/ui/AnchoredPopover.cjs +1 -1
- package/dist/components/ui/AnchoredPopover.cjs.map +1 -1
- package/dist/components/ui/AnchoredPopover.d.ts +7 -1
- package/dist/components/ui/AnchoredPopover.js +64 -62
- package/dist/components/ui/AnchoredPopover.js.map +1 -1
- package/dist/components/ui/DataTable.cjs +1 -1
- package/dist/components/ui/DataTable.cjs.map +1 -1
- package/dist/components/ui/DataTable.d.ts +11 -1
- package/dist/components/ui/DataTable.js +78 -74
- package/dist/components/ui/DataTable.js.map +1 -1
- package/dist/components/ui/DetailBeside.cjs +1 -1
- package/dist/components/ui/DetailBeside.cjs.map +1 -1
- package/dist/components/ui/DetailBeside.d.ts +7 -2
- package/dist/components/ui/DetailBeside.js +91 -77
- package/dist/components/ui/DetailBeside.js.map +1 -1
- package/dist/components/ui/IdentityCell.cjs +1 -1
- package/dist/components/ui/IdentityCell.cjs.map +1 -1
- package/dist/components/ui/IdentityCell.d.ts +6 -1
- package/dist/components/ui/IdentityCell.js +17 -15
- package/dist/components/ui/IdentityCell.js.map +1 -1
- package/dist/components/ui/PaneLayout.cjs +1 -1
- package/dist/components/ui/PaneLayout.cjs.map +1 -1
- package/dist/components/ui/PaneLayout.d.ts +7 -2
- package/dist/components/ui/PaneLayout.js +20 -22
- package/dist/components/ui/PaneLayout.js.map +1 -1
- package/dist/components/ui/Select.cjs +1 -1
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.d.ts +8 -2
- package/dist/components/ui/Select.js +44 -38
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/components/ui/TimeDisplay.cjs +1 -1
- package/dist/components/ui/TimeDisplay.cjs.map +1 -1
- package/dist/components/ui/TimeDisplay.d.ts +11 -3
- package/dist/components/ui/TimeDisplay.js +39 -34
- package/dist/components/ui/TimeDisplay.js.map +1 -1
- package/dist/components/ui/Timeline.cjs +1 -1
- package/dist/components/ui/Timeline.cjs.map +1 -1
- package/dist/components/ui/Timeline.d.ts +17 -4
- package/dist/components/ui/Timeline.js +88 -67
- package/dist/components/ui/Timeline.js.map +1 -1
- package/dist/components/ui/Toolbar.cjs.map +1 -1
- package/dist/components/ui/Toolbar.d.ts +2 -1
- package/dist/components/ui/Toolbar.js.map +1 -1
- package/dist/components/ui/TraceTree.cjs +1 -1
- package/dist/components/ui/TraceTree.cjs.map +1 -1
- package/dist/components/ui/TraceTree.d.ts +7 -1
- package/dist/components/ui/TraceTree.js +127 -119
- package/dist/components/ui/TraceTree.js.map +1 -1
- package/dist/components/ui/linkComponent.cjs +1 -1
- package/dist/components/ui/linkComponent.cjs.map +1 -1
- package/dist/components/ui/linkComponent.d.ts +6 -4
- package/dist/components/ui/linkComponent.js +12 -10
- package/dist/components/ui/linkComponent.js.map +1 -1
- package/dist/layouts/shell/AegisShell.cjs +1 -1
- package/dist/layouts/shell/AegisShell.cjs.map +1 -1
- package/dist/layouts/shell/AegisShell.js +24 -24
- package/dist/layouts/shell/AegisShell.js.map +1 -1
- package/dist/layouts/shell/RouterLink.cjs +1 -1
- package/dist/layouts/shell/RouterLink.cjs.map +1 -1
- package/dist/layouts/shell/RouterLink.js +14 -12
- package/dist/layouts/shell/RouterLink.js.map +1 -1
- package/dist/layouts/shell/types.d.ts +6 -0
- package/dist/locale/strings.cjs +1 -1
- package/dist/locale/strings.cjs.map +1 -1
- package/dist/locale/strings.d.ts +2 -0
- package/dist/locale/strings.js +7 -5
- package/dist/locale/strings.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,124 +1,145 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { usePrimitiveSurface as
|
|
1
|
+
import { jsx as t, jsxs as g, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as L, useState as q, useLayoutEffect as K } from "react";
|
|
3
|
+
import { usePrimitiveSurface as M } from "../../agent/core/usePrimitiveSurface.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
import { DefaultLink as P } from "./linkComponent.js";
|
|
6
|
+
function Q({
|
|
7
|
+
items: l,
|
|
8
|
+
variant: v = "dot",
|
|
9
|
+
density: k = "comfortable",
|
|
10
|
+
mode: N = "listbox",
|
|
11
|
+
selectedId: a,
|
|
12
|
+
onSelect: d,
|
|
13
|
+
linkComponent: y,
|
|
14
|
+
scrollable: w = !1,
|
|
15
|
+
ariaLabel: I,
|
|
16
|
+
className: C,
|
|
17
|
+
style: T,
|
|
18
|
+
surface: x
|
|
16
19
|
}) {
|
|
17
|
-
const
|
|
20
|
+
const r = L(null), D = M(x, l, "timeline", r), [S, _] = q(void 0), u = v === "numbered", h = k === "compact", s = N === "list", c = !s && d !== void 0, j = y ?? P, A = [
|
|
18
21
|
"aegis-timeline",
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
u ? "aegis-timeline--numbered" : "",
|
|
23
|
+
h ? "aegis-timeline--compact" : "",
|
|
24
|
+
c ? "aegis-timeline--selectable" : "",
|
|
25
|
+
s ? "aegis-timeline--list" : "",
|
|
26
|
+
w ? "aegis-timeline--scrollable" : "",
|
|
27
|
+
C ?? ""
|
|
28
|
+
].filter(Boolean).join(" "), B = l.findIndex((e) => e.id === a), b = l.findIndex((e) => e.id === S), H = b >= 0 ? b : Math.max(B, 0);
|
|
29
|
+
K(() => {
|
|
30
|
+
const e = r.current, i = e?.querySelector(
|
|
27
31
|
":scope > .aegis-timeline__item--selected"
|
|
28
32
|
);
|
|
29
|
-
if (!e || !
|
|
33
|
+
if (!e || !i)
|
|
30
34
|
return;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
}, [
|
|
34
|
-
const
|
|
35
|
-
e < 0 || e >=
|
|
36
|
-
},
|
|
35
|
+
const o = i.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop, n = o + i.offsetHeight;
|
|
36
|
+
o < e.scrollTop ? e.scrollTop = o : n > e.scrollTop + e.clientHeight && (e.scrollTop = n - e.clientHeight);
|
|
37
|
+
}, [a]);
|
|
38
|
+
const m = (e) => {
|
|
39
|
+
e < 0 || e >= l.length || (_(l[e].id), r.current?.querySelectorAll(':scope > [role="option"]')[e]?.focus());
|
|
40
|
+
}, R = (e, i) => {
|
|
37
41
|
switch (e.key) {
|
|
38
42
|
case "ArrowDown":
|
|
39
|
-
|
|
43
|
+
m(i + 1);
|
|
40
44
|
break;
|
|
41
45
|
case "ArrowUp":
|
|
42
|
-
|
|
46
|
+
m(i - 1);
|
|
43
47
|
break;
|
|
44
48
|
case "Home":
|
|
45
|
-
|
|
49
|
+
m(0);
|
|
46
50
|
break;
|
|
47
51
|
case "End":
|
|
48
|
-
|
|
52
|
+
m(l.length - 1);
|
|
49
53
|
break;
|
|
50
54
|
case "Enter":
|
|
51
55
|
case " ":
|
|
52
|
-
|
|
56
|
+
d?.(l[i]);
|
|
53
57
|
break;
|
|
54
58
|
default:
|
|
55
59
|
return;
|
|
56
60
|
}
|
|
57
61
|
e.preventDefault();
|
|
58
62
|
};
|
|
59
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ t(
|
|
60
64
|
"ol",
|
|
61
65
|
{
|
|
62
|
-
ref:
|
|
63
|
-
className:
|
|
64
|
-
style:
|
|
65
|
-
role:
|
|
66
|
-
"aria-label":
|
|
67
|
-
...
|
|
68
|
-
children:
|
|
69
|
-
const
|
|
66
|
+
ref: r,
|
|
67
|
+
className: A,
|
|
68
|
+
style: T,
|
|
69
|
+
role: c ? "listbox" : s ? "list" : void 0,
|
|
70
|
+
"aria-label": I,
|
|
71
|
+
...D,
|
|
72
|
+
children: l.map((e, i) => {
|
|
73
|
+
const o = e.id === a, n = s ? e.href : void 0, p = [
|
|
70
74
|
"aegis-timeline__item",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
u ? "aegis-timeline__item--numbered" : "",
|
|
76
|
+
(c || s) && o ? "aegis-timeline__item--selected" : "",
|
|
77
|
+
n !== void 0 ? "aegis-timeline__item--link" : ""
|
|
78
|
+
].filter(Boolean).join(" "), f = /* @__PURE__ */ g(F, { children: [
|
|
79
|
+
u ? /* @__PURE__ */ t("span", { className: "aegis-timeline__marker", children: e.marker ?? String(i + 1).padStart(2, "0") }) : /* @__PURE__ */ t(
|
|
75
80
|
"span",
|
|
76
81
|
{
|
|
77
82
|
className: "aegis-timeline__dot",
|
|
78
83
|
style: e.dotColor ? { background: e.dotColor } : void 0
|
|
79
84
|
}
|
|
80
85
|
),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ g("div", { className: "aegis-timeline__body", children: [
|
|
87
|
+
/* @__PURE__ */ g("div", { className: "aegis-timeline__row", children: [
|
|
88
|
+
/* @__PURE__ */ t(
|
|
84
89
|
"span",
|
|
85
90
|
{
|
|
86
91
|
className: "aegis-timeline__title",
|
|
87
|
-
title:
|
|
88
|
-
children:
|
|
92
|
+
title: h && typeof e.title == "string" ? e.title : void 0,
|
|
93
|
+
children: n !== void 0 ? /* @__PURE__ */ t(
|
|
94
|
+
j,
|
|
95
|
+
{
|
|
96
|
+
to: n,
|
|
97
|
+
className: "aegis-timeline__link",
|
|
98
|
+
"aria-current": o ? "true" : void 0,
|
|
99
|
+
children: e.title
|
|
100
|
+
}
|
|
101
|
+
) : e.title
|
|
89
102
|
}
|
|
90
103
|
),
|
|
91
|
-
e.meta ? /* @__PURE__ */
|
|
104
|
+
e.meta ? /* @__PURE__ */ t("span", { className: "aegis-timeline__meta", children: e.meta }) : null
|
|
92
105
|
] }),
|
|
93
|
-
e.description ? /* @__PURE__ */
|
|
94
|
-
e.timestamp ? /* @__PURE__ */
|
|
106
|
+
e.description ? /* @__PURE__ */ t("div", { className: "aegis-timeline__desc", children: e.description }) : null,
|
|
107
|
+
e.timestamp ? /* @__PURE__ */ t("div", { className: "aegis-timeline__time", children: e.timestamp }) : null
|
|
95
108
|
] })
|
|
96
109
|
] });
|
|
97
|
-
return
|
|
110
|
+
return s ? /* @__PURE__ */ t(
|
|
98
111
|
"li",
|
|
99
112
|
{
|
|
100
|
-
className:
|
|
113
|
+
className: p,
|
|
114
|
+
"aria-current": o && n === void 0 ? "true" : void 0,
|
|
115
|
+
children: f
|
|
116
|
+
},
|
|
117
|
+
e.id
|
|
118
|
+
) : c ? /* @__PURE__ */ t(
|
|
119
|
+
"li",
|
|
120
|
+
{
|
|
121
|
+
className: p,
|
|
101
122
|
role: "option",
|
|
102
|
-
"aria-selected": e.id ===
|
|
103
|
-
tabIndex:
|
|
123
|
+
"aria-selected": e.id === a,
|
|
124
|
+
tabIndex: i === H ? 0 : -1,
|
|
104
125
|
onClick: () => {
|
|
105
|
-
|
|
126
|
+
d(e);
|
|
106
127
|
},
|
|
107
|
-
onKeyDown: (
|
|
108
|
-
|
|
128
|
+
onKeyDown: (E) => {
|
|
129
|
+
R(E, i);
|
|
109
130
|
},
|
|
110
131
|
onFocus: () => {
|
|
111
|
-
|
|
132
|
+
_(e.id);
|
|
112
133
|
},
|
|
113
|
-
children:
|
|
134
|
+
children: f
|
|
114
135
|
},
|
|
115
136
|
e.id
|
|
116
|
-
) : /* @__PURE__ */
|
|
137
|
+
) : /* @__PURE__ */ t("li", { className: p, children: f }, e.id);
|
|
117
138
|
})
|
|
118
139
|
}
|
|
119
140
|
);
|
|
120
141
|
}
|
|
121
142
|
export {
|
|
122
|
-
|
|
143
|
+
Q as Timeline
|
|
123
144
|
};
|
|
124
145
|
//# sourceMappingURL=Timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeline.js","sources":["../../../src/components/ui/Timeline.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport './Timeline.css';\n\nexport interface TimelineItem {\n id: string;\n /** Headline — actor / event / verb, e.g. \"alice@aegis updated `db.dsn`\". */\n title: ReactNode;\n /** Body — optional secondary line. */\n description?: ReactNode;\n /** Absolute timestamp, in the numeric face. */\n timestamp?: ReactNode;\n /** Slot at the end of the title row, in the numeric face (e.g. a revision). */\n meta?: ReactNode;\n /** CSS colour for the dot, e.g. `var(--accent-success)`. */\n dotColor?: string;\n /**\n * Leading label in the `numbered` variant, e.g. a step number.\n * Defaults to the 1-based position, zero-padded to two digits.\n */\n marker?: ReactNode;\n}\n\nexport type TimelineSurface = PrimitiveSurface<TimelineItem[]>;\n\ninterface TimelineProps {\n items: TimelineItem[];\n /**\n * `numbered` replaces the dot and connector with a leading marker\n * column, separates rows with hairlines and keeps the line breaks of\n * each description.\n */\n variant?: 'dot' | 'numbered';\n /**\n * `compact` keeps each title on one line with an ellipsis (a string title\n * shows in full on hover) and tightens the rows.\n */\n density?: 'comfortable' | 'compact';\n /**\n * The selected item, drawn inverted when `onSelect` is set. With `onSelect` the list is a\n * listbox: each item is an option, clicked or chosen with Enter or Space,\n * and ↑ ↓ Home End move between them from one tab stop.\n */\n selectedId?: string;\n onSelect?: (item: TimelineItem) => void;\n /**\n * Bounds the list to `--timeline-scroll-max-height` and scrolls it. The\n * list scrolls itself, never the page, to keep the selected item in view\n * when it mounts and when `selectedId` changes.\n */\n scrollable?: boolean;\n /** The list's accessible name; name a selectable list. */\n ariaLabel?: string;\n className?: string;\n style?: CSSProperties;\n surface?: TimelineSurface;\n}\n\nexport function Timeline({\n items,\n variant = 'dot',\n density = 'comfortable',\n selectedId,\n onSelect,\n scrollable = false,\n ariaLabel,\n className,\n style,\n surface,\n}: TimelineProps) {\n const wrapRef = useRef<HTMLOListElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'timeline', wrapRef);\n const [focusedId, setFocusedId] = useState<string | undefined>(undefined);\n const numbered = variant === 'numbered';\n const compact = density === 'compact';\n const selectable = onSelect !== undefined;\n const rootClass = [\n 'aegis-timeline',\n numbered ? 'aegis-timeline--numbered' : '',\n compact ? 'aegis-timeline--compact' : '',\n selectable ? 'aegis-timeline--selectable' : '',\n scrollable ? 'aegis-timeline--scrollable' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const selectedIndex = items.findIndex((it) => it.id === selectedId);\n const focusedIndex = items.findIndex((it) => it.id === focusedId);\n const tabStopIndex =\n focusedIndex >= 0 ? focusedIndex : Math.max(selectedIndex, 0);\n\n useLayoutEffect(() => {\n const list = wrapRef.current;\n const item = list?.querySelector<HTMLElement>(\n ':scope > .aegis-timeline__item--selected',\n );\n if (!list || !item) {\n return;\n }\n const top =\n item.getBoundingClientRect().top -\n list.getBoundingClientRect().top +\n list.scrollTop;\n const bottom = top + item.offsetHeight;\n if (top < list.scrollTop) {\n list.scrollTop = top;\n } else if (bottom > list.scrollTop + list.clientHeight) {\n list.scrollTop = bottom - list.clientHeight;\n }\n }, [selectedId]);\n\n const focusItem = (index: number): void => {\n if (index < 0 || index >= items.length) {\n return;\n }\n setFocusedId(items[index].id);\n wrapRef.current\n ?.querySelectorAll<HTMLElement>(':scope > [role=\"option\"]')\n [index]?.focus();\n };\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLLIElement>,\n index: number,\n ): void => {\n switch (event.key) {\n case 'ArrowDown':\n focusItem(index + 1);\n break;\n case 'ArrowUp':\n focusItem(index - 1);\n break;\n case 'Home':\n focusItem(0);\n break;\n case 'End':\n focusItem(items.length - 1);\n break;\n case 'Enter':\n case ' ':\n onSelect?.(items[index]);\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n\n return (\n <ol\n ref={wrapRef}\n className={rootClass}\n style={style}\n role={selectable ? 'listbox' : undefined}\n aria-label={ariaLabel}\n {...agentAttrs}\n >\n {items.map((it, index) => {\n const className = [\n 'aegis-timeline__item',\n numbered ? 'aegis-timeline__item--numbered' : '',\n selectable && it.id === selectedId\n ? 'aegis-timeline__item--selected'\n : '',\n ]\n .filter(Boolean)\n .join(' ');\n const content = (\n <>\n {numbered ? (\n <span className=\"aegis-timeline__marker\">\n {it.marker ?? String(index + 1).padStart(2, '0')}\n </span>\n ) : (\n <span\n className=\"aegis-timeline__dot\"\n style={it.dotColor ? { background: it.dotColor } : undefined}\n />\n )}\n <div className=\"aegis-timeline__body\">\n <div className=\"aegis-timeline__row\">\n <span\n className=\"aegis-timeline__title\"\n title={\n compact && typeof it.title === 'string'\n ? it.title\n : undefined\n }\n >\n {it.title}\n </span>\n {it.meta ? (\n <span className=\"aegis-timeline__meta\">{it.meta}</span>\n ) : null}\n </div>\n {it.description ? (\n <div className=\"aegis-timeline__desc\">{it.description}</div>\n ) : null}\n {it.timestamp ? (\n <div className=\"aegis-timeline__time\">{it.timestamp}</div>\n ) : null}\n </div>\n </>\n );\n if (!selectable) {\n return (\n <li key={it.id} className={className}>\n {content}\n </li>\n );\n }\n return (\n <li\n key={it.id}\n className={className}\n role=\"option\"\n aria-selected={it.id === selectedId}\n tabIndex={index === tabStopIndex ? 0 : -1}\n onClick={() => {\n onSelect(it);\n }}\n onKeyDown={(event) => {\n handleKeyDown(event, index);\n }}\n onFocus={() => {\n setFocusedId(it.id);\n }}\n >\n {content}\n </li>\n );\n })}\n </ol>\n );\n}\n"],"names":["Timeline","items","variant","density","selectedId","onSelect","scrollable","ariaLabel","className","style","surface","wrapRef","useRef","agentAttrs","usePrimitiveSurface","focusedId","setFocusedId","useState","numbered","compact","selectable","rootClass","selectedIndex","it","focusedIndex","tabStopIndex","useLayoutEffect","list","item","top","bottom","focusItem","index","handleKeyDown","event","js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AGP;"}
|
|
1
|
+
{"version":3,"file":"Timeline.js","sources":["../../../src/components/ui/Timeline.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport './Timeline.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\n\nexport interface TimelineItem {\n id: string;\n /** Headline — actor / event / verb, e.g. \"alice@aegis updated `db.dsn`\". */\n title: ReactNode;\n /** Body — optional secondary line. */\n description?: ReactNode;\n /** Absolute timestamp, in the numeric face. */\n timestamp?: ReactNode;\n /** Slot at the end of the title row, in the numeric face (e.g. a revision). */\n meta?: ReactNode;\n /** CSS colour for the dot, e.g. `var(--accent-success)`. */\n dotColor?: string;\n /**\n * Leading label in the `numbered` variant, e.g. a step number.\n * Defaults to the 1-based position, zero-padded to two digits.\n */\n marker?: ReactNode;\n /** In the `list` mode, makes the item a link to this destination. */\n href?: string;\n}\n\nexport type TimelineSurface = PrimitiveSurface<TimelineItem[]>;\n\ninterface TimelineProps {\n items: TimelineItem[];\n /**\n * `numbered` replaces the dot and connector with a leading marker\n * column, separates rows with hairlines and keeps the line breaks of\n * each description.\n */\n variant?: 'dot' | 'numbered';\n /**\n * `compact` keeps each title on one line with an ellipsis (a string title\n * shows in full on hover) and tightens the rows.\n */\n density?: 'comfortable' | 'compact';\n /**\n * `listbox` (default): with `onSelect` the list is a listbox. `list`: the\n * list stays a list of items, the selected one marked `aria-current` and\n * each item with an `href` a link, e.g. one per run that opens its page.\n */\n mode?: 'listbox' | 'list';\n /**\n * The selected item, drawn inverted when `onSelect` is set or in the\n * `list` mode. With `onSelect` in the `listbox` mode each item is an\n * option, clicked or chosen with Enter or Space, and ↑ ↓ Home End move\n * between them from one tab stop.\n */\n selectedId?: string;\n /** Fired when an item is chosen in the `listbox` mode; a `list` follows its links instead. */\n onSelect?: (item: TimelineItem) => void;\n /** Renders the `list` mode's links. Defaults to an `<a href>`; routed apps pass their Link adapter. */\n linkComponent?: LinkComponent;\n /**\n * Bounds the list to `--timeline-scroll-max-height` and scrolls it. The\n * list scrolls itself, never the page, to keep the selected item in view\n * when it mounts and when `selectedId` changes.\n */\n scrollable?: boolean;\n /** The list's accessible name; name a selectable list. */\n ariaLabel?: string;\n className?: string;\n style?: CSSProperties;\n surface?: TimelineSurface;\n}\n\nexport function Timeline({\n items,\n variant = 'dot',\n density = 'comfortable',\n mode = 'listbox',\n selectedId,\n onSelect,\n linkComponent,\n scrollable = false,\n ariaLabel,\n className,\n style,\n surface,\n}: TimelineProps) {\n const wrapRef = useRef<HTMLOListElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, items, 'timeline', wrapRef);\n const [focusedId, setFocusedId] = useState<string | undefined>(undefined);\n const numbered = variant === 'numbered';\n const compact = density === 'compact';\n const list = mode === 'list';\n const selectable = !list && onSelect !== undefined;\n const LinkImpl = linkComponent ?? DefaultLink;\n const rootClass = [\n 'aegis-timeline',\n numbered ? 'aegis-timeline--numbered' : '',\n compact ? 'aegis-timeline--compact' : '',\n selectable ? 'aegis-timeline--selectable' : '',\n list ? 'aegis-timeline--list' : '',\n scrollable ? 'aegis-timeline--scrollable' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const selectedIndex = items.findIndex((it) => it.id === selectedId);\n const focusedIndex = items.findIndex((it) => it.id === focusedId);\n const tabStopIndex =\n focusedIndex >= 0 ? focusedIndex : Math.max(selectedIndex, 0);\n\n useLayoutEffect(() => {\n const list = wrapRef.current;\n const item = list?.querySelector<HTMLElement>(\n ':scope > .aegis-timeline__item--selected',\n );\n if (!list || !item) {\n return;\n }\n const top =\n item.getBoundingClientRect().top -\n list.getBoundingClientRect().top +\n list.scrollTop;\n const bottom = top + item.offsetHeight;\n if (top < list.scrollTop) {\n list.scrollTop = top;\n } else if (bottom > list.scrollTop + list.clientHeight) {\n list.scrollTop = bottom - list.clientHeight;\n }\n }, [selectedId]);\n\n const focusItem = (index: number): void => {\n if (index < 0 || index >= items.length) {\n return;\n }\n setFocusedId(items[index].id);\n wrapRef.current\n ?.querySelectorAll<HTMLElement>(':scope > [role=\"option\"]')\n [index]?.focus();\n };\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLLIElement>,\n index: number,\n ): void => {\n switch (event.key) {\n case 'ArrowDown':\n focusItem(index + 1);\n break;\n case 'ArrowUp':\n focusItem(index - 1);\n break;\n case 'Home':\n focusItem(0);\n break;\n case 'End':\n focusItem(items.length - 1);\n break;\n case 'Enter':\n case ' ':\n onSelect?.(items[index]);\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n\n return (\n <ol\n ref={wrapRef}\n className={rootClass}\n style={style}\n role={selectable ? 'listbox' : list ? 'list' : undefined}\n aria-label={ariaLabel}\n {...agentAttrs}\n >\n {items.map((it, index) => {\n const current = it.id === selectedId;\n const href = list ? it.href : undefined;\n const className = [\n 'aegis-timeline__item',\n numbered ? 'aegis-timeline__item--numbered' : '',\n (selectable || list) && current\n ? 'aegis-timeline__item--selected'\n : '',\n href !== undefined ? 'aegis-timeline__item--link' : '',\n ]\n .filter(Boolean)\n .join(' ');\n const content = (\n <>\n {numbered ? (\n <span className=\"aegis-timeline__marker\">\n {it.marker ?? String(index + 1).padStart(2, '0')}\n </span>\n ) : (\n <span\n className=\"aegis-timeline__dot\"\n style={it.dotColor ? { background: it.dotColor } : undefined}\n />\n )}\n <div className=\"aegis-timeline__body\">\n <div className=\"aegis-timeline__row\">\n <span\n className=\"aegis-timeline__title\"\n title={\n compact && typeof it.title === 'string'\n ? it.title\n : undefined\n }\n >\n {href !== undefined ? (\n <LinkImpl\n to={href}\n className=\"aegis-timeline__link\"\n aria-current={current ? 'true' : undefined}\n >\n {it.title}\n </LinkImpl>\n ) : (\n it.title\n )}\n </span>\n {it.meta ? (\n <span className=\"aegis-timeline__meta\">{it.meta}</span>\n ) : null}\n </div>\n {it.description ? (\n <div className=\"aegis-timeline__desc\">{it.description}</div>\n ) : null}\n {it.timestamp ? (\n <div className=\"aegis-timeline__time\">{it.timestamp}</div>\n ) : null}\n </div>\n </>\n );\n if (list) {\n return (\n <li\n key={it.id}\n className={className}\n aria-current={current && href === undefined ? 'true' : undefined}\n >\n {content}\n </li>\n );\n }\n if (!selectable) {\n return (\n <li key={it.id} className={className}>\n {content}\n </li>\n );\n }\n return (\n <li\n key={it.id}\n className={className}\n role=\"option\"\n aria-selected={it.id === selectedId}\n tabIndex={index === tabStopIndex ? 0 : -1}\n onClick={() => {\n onSelect(it);\n }}\n onKeyDown={(event) => {\n handleKeyDown(event, index);\n }}\n onFocus={() => {\n setFocusedId(it.id);\n }}\n >\n {content}\n </li>\n );\n })}\n </ol>\n );\n}\n"],"names":["Timeline","items","variant","density","mode","selectedId","onSelect","linkComponent","scrollable","ariaLabel","className","style","surface","wrapRef","useRef","agentAttrs","usePrimitiveSurface","focusedId","setFocusedId","useState","numbered","compact","list","selectable","LinkImpl","DefaultLink","rootClass","selectedIndex","it","focusedIndex","tabStopIndex","useLayoutEffect","item","top","bottom","focusItem","index","handleKeyDown","event","jsx","current","href","content","jsxs","Fragment"],"mappings":";;;;;AAkFO,SAASA,EAAS;AAAA,EACvB,OAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AACF,GAAkB;AAChB,QAAMC,IAAUC,EAAyB,IAAI,GACvCC,IAAaC,EAAoBJ,GAASX,GAAO,YAAYY,CAAO,GACpE,CAACI,GAAWC,CAAY,IAAIC,EAA6B,MAAS,GAClEC,IAAWlB,MAAY,YACvBmB,IAAUlB,MAAY,WACtBmB,IAAOlB,MAAS,QAChBmB,IAAa,CAACD,K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C,EAAA,GADMd,EAAG,EAEZ;AAAA,MAuBN,CAAC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.cjs","sources":["../../../src/components/ui/Toolbar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport './Toolbar.css';\n\nexport interface ToolbarProps {\n /** Leading controls, e.g. a `SearchInput` and its filter chips. */\n left?: ReactNode;\n center?: ReactNode;\n /** Trailing actions. */\n right?: ReactNode;\n /**\n * `default` is a padded row over a list or table. `page` is a page's top\n * bar, `--page-bar-height` high: its title on the left (a `PanelTitle`\n * as `h1`), its selectors and buttons on the right. `sub` is the\n * `--sub-bar-height` row under it, e.g. a trace path or a run's facts.\n * Each draws a hairline below; `page` and `sub` sit flush with the page's\n * edges, so a bleed page stacks them over its `PaneLayout
|
|
1
|
+
{"version":3,"file":"Toolbar.cjs","sources":["../../../src/components/ui/Toolbar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport './Toolbar.css';\n\nexport interface ToolbarProps {\n /** Leading controls, e.g. a `SearchInput` and its filter chips. */\n left?: ReactNode;\n center?: ReactNode;\n /** Trailing actions. */\n right?: ReactNode;\n /**\n * `default` is a padded row over a list or table. `page` is a page's top\n * bar, `--page-bar-height` high: its title on the left (a `PanelTitle`\n * as `h1`), its selectors and buttons on the right. `sub` is the\n * `--sub-bar-height` row under it, e.g. a trace path or a run's facts.\n * Each draws a hairline below; `page` and `sub` sit flush with the page's\n * edges, so a bleed page stacks them over its `PaneLayout`. At 768 px or\n * narrower a `page` bar's right slot wraps and shrinks within its width.\n */\n variant?: 'default' | 'page' | 'sub';\n className?: string;\n}\n\n/** A row of controls over a list or table: left, optional center, right. */\nexport function Toolbar({\n left,\n center,\n right,\n variant = 'default',\n className,\n}: ToolbarProps) {\n const cls = [\n 'aegis-toolbar',\n variant === 'default' ? '' : `aegis-toolbar--${variant}`,\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <div className={cls}>\n <div className=\"aegis-toolbar__left\">{left}</div>\n {center !== undefined ? (\n <div className=\"aegis-toolbar__center\">{center}</div>\n ) : null}\n {right !== undefined ? (\n <div className=\"aegis-toolbar__right\">{right}</div>\n ) : null}\n </div>\n );\n}\n"],"names":["Toolbar","left","center","right","variant","className","cls","jsxs","jsx"],"mappings":"kJAwBO,SAASA,EAAQ,CACtB,KAAAC,EACA,OAAAC,EACA,MAAAC,EACA,QAAAC,EAAU,UACV,UAAAC,CACF,EAAiB,CACf,MAAMC,EAAM,CACV,gBACAF,IAAY,UAAY,GAAK,kBAAkBA,CAAO,GACtDC,GAAa,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG,EACX,OACEE,EAAAA,KAAC,MAAA,CAAI,UAAWD,EACd,SAAA,CAAAE,EAAAA,IAAC,MAAA,CAAI,UAAU,sBAAuB,SAAAP,EAAK,EAC1CC,IAAW,OACVM,EAAAA,IAAC,OAAI,UAAU,wBAAyB,WAAO,EAC7C,KACHL,IAAU,OACTK,EAAAA,IAAC,OAAI,UAAU,uBAAwB,WAAM,EAC3C,IAAA,EACN,CAEJ"}
|
|
@@ -11,7 +11,8 @@ export interface ToolbarProps {
|
|
|
11
11
|
* as `h1`), its selectors and buttons on the right. `sub` is the
|
|
12
12
|
* `--sub-bar-height` row under it, e.g. a trace path or a run's facts.
|
|
13
13
|
* Each draws a hairline below; `page` and `sub` sit flush with the page's
|
|
14
|
-
* edges, so a bleed page stacks them over its `PaneLayout`.
|
|
14
|
+
* edges, so a bleed page stacks them over its `PaneLayout`. At 768 px or
|
|
15
|
+
* narrower a `page` bar's right slot wraps and shrinks within its width.
|
|
15
16
|
*/
|
|
16
17
|
variant?: 'default' | 'page' | 'sub';
|
|
17
18
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.js","sources":["../../../src/components/ui/Toolbar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport './Toolbar.css';\n\nexport interface ToolbarProps {\n /** Leading controls, e.g. a `SearchInput` and its filter chips. */\n left?: ReactNode;\n center?: ReactNode;\n /** Trailing actions. */\n right?: ReactNode;\n /**\n * `default` is a padded row over a list or table. `page` is a page's top\n * bar, `--page-bar-height` high: its title on the left (a `PanelTitle`\n * as `h1`), its selectors and buttons on the right. `sub` is the\n * `--sub-bar-height` row under it, e.g. a trace path or a run's facts.\n * Each draws a hairline below; `page` and `sub` sit flush with the page's\n * edges, so a bleed page stacks them over its `PaneLayout
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sources":["../../../src/components/ui/Toolbar.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport './Toolbar.css';\n\nexport interface ToolbarProps {\n /** Leading controls, e.g. a `SearchInput` and its filter chips. */\n left?: ReactNode;\n center?: ReactNode;\n /** Trailing actions. */\n right?: ReactNode;\n /**\n * `default` is a padded row over a list or table. `page` is a page's top\n * bar, `--page-bar-height` high: its title on the left (a `PanelTitle`\n * as `h1`), its selectors and buttons on the right. `sub` is the\n * `--sub-bar-height` row under it, e.g. a trace path or a run's facts.\n * Each draws a hairline below; `page` and `sub` sit flush with the page's\n * edges, so a bleed page stacks them over its `PaneLayout`. At 768 px or\n * narrower a `page` bar's right slot wraps and shrinks within its width.\n */\n variant?: 'default' | 'page' | 'sub';\n className?: string;\n}\n\n/** A row of controls over a list or table: left, optional center, right. */\nexport function Toolbar({\n left,\n center,\n right,\n variant = 'default',\n className,\n}: ToolbarProps) {\n const cls = [\n 'aegis-toolbar',\n variant === 'default' ? '' : `aegis-toolbar--${variant}`,\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n return (\n <div className={cls}>\n <div className=\"aegis-toolbar__left\">{left}</div>\n {center !== undefined ? (\n <div className=\"aegis-toolbar__center\">{center}</div>\n ) : null}\n {right !== undefined ? (\n <div className=\"aegis-toolbar__right\">{right}</div>\n ) : null}\n </div>\n );\n}\n"],"names":["Toolbar","left","center","right","variant","className","cls","jsxs","jsx"],"mappings":";;AAwBO,SAASA,EAAQ;AAAA,EACtB,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AACF,GAAiB;AACf,QAAMC,IAAM;AAAA,IACV;AAAA,IACAF,MAAY,YAAY,KAAK,kBAAkBA,CAAO;AAAA,IACtDC,KAAa;AAAA,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG;AACX,SACE,gBAAAE,EAAC,OAAA,EAAI,WAAWD,GACd,UAAA;AAAA,IAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,uBAAuB,UAAAP,GAAK;AAAA,IAC1CC,MAAW,SACV,gBAAAM,EAAC,SAAI,WAAU,yBAAyB,aAAO,IAC7C;AAAA,IACHL,MAAU,SACT,gBAAAK,EAAC,SAAI,WAAU,wBAAwB,aAAM,IAC3C;AAAA,EAAA,GACN;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),f=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),f=require("react"),_e=require("antd"),ve=require("../../agent/core/usePrimitiveSurface.cjs"),we=require("../../hooks/useResizable.cjs"),xe=require("../../lib/breakAtSeparators.cjs"),q=require("../../lib/format.cjs"),Se=require("./Chip.cjs"),be=require("./StatusDot.cjs");;/* empty css */const Me=require("./linkComponent.cjs"),je=require("./selectedRowDetail.cjs"),ke=require("./traceStatus.cjs"),Ne=require("../../locale/useStrings.cjs"),ye=180,Ee=700,De=320;function C(c){return c.startMs!==void 0&&c.durationMs!==void 0}function Q(c){c.every(r=>r.span.startMs!==void 0)&&c.sort((r,n)=>(r.span.startMs??0)-(n.span.startMs??0))}function Re(c){const r=new Map;c.forEach(o=>{r.set(o.id,{span:o,parent:null,children:[],depth:0})});const n=[];r.forEach(o=>{const p=o.span.parentId,d=p?r.get(p):void 0;d?(o.parent=d,d.children.push(o)):n.push(o)});const l=new Set,u=(o,p)=>{l.add(o),o.depth=p,o.children.forEach(d=>{u(d,p+1)})};n.forEach(o=>{u(o,0)}),r.forEach(o=>{if(l.has(o))return;const p=new Set;let d=o;for(;d.parent!==null&&!p.has(d);)p.add(d),d=d.parent;const h=d;h.parent!==null&&(h.parent.children=h.parent.children.filter(k=>k!==h),h.parent=null),n.push(h),u(h,0)});const S=o=>{Q(o.children),o.children.forEach(S)};return Q(n),n.forEach(S),n}function j(c,r){for(const n of c){if(n.span.id===r)return n;const l=j(n.children,r);if(l)return l}}function Z(c,r,n){let l=r;for(let u=j(c,n)?.parent??null;u!==null;u=u.parent)l.has(u.span.id)&&(l===r&&(l=new Set(r)),l.delete(u.span.id));return l}function ee(c,r,n=[]){return c.forEach((l,u)=>{n.push({node:l,position:u+1,siblings:c.length}),r.has(l.span.id)||ee(l.children,r,n)}),n}function qe({spans:c,selectedId:r,onSelect:n,defaultCollapsedDepth:l=Number.POSITIVE_INFINITY,ariaLabel:u,linkComponent:S=Me.DefaultLink,className:o,style:p,surface:d,nameColumnWidth:h,defaultNameColumnWidth:k=De,onNameColumnWidthChange:A,persistKey:T,wrapName:L=!1,nameFont:I="mono"}){const P=f.useRef(null),z=f.useRef(null),te=ve.usePrimitiveSurface(d,c,"tree",P),N=Ne.useStrings(),re=f.useId(),F=f.useContext(je.SelectedRowDetailContext),{roots:m,traceDuration:K,traceStart:O,timed:y}=f.useMemo(()=>{const e=Re(c),s=c.filter(C),a=s.length?Math.min(...s.map(t=>t.startMs)):0,g=s.length?Math.max(...s.map(t=>t.startMs+t.durationMs)):1;return{roots:e,traceStart:a,traceDuration:Math.max(g-a,1),timed:s.length>0}},[c]),[v,$]=f.useState(()=>{const e=new Set,s=a=>{a.depth>=l&&a.children.length>0&&e.add(a.span.id),a.children.forEach(s)};return m.forEach(s),r===void 0?e:Z(m,e,r)}),[B,W]=f.useState(()=>r!==void 0&&j(m,r)?r:void 0);if(r===void 0&&B!==void 0&&W(void 0),r!==void 0&&r!==B&&j(m,r)){W(r);const e=Z(m,v,r);e!==v&&$(e)}const[ae,U]=f.useState(void 0),_=f.useMemo(()=>ee(m,v),[m,v]),H=e=>e===void 0?-1:_.findIndex(s=>s.node.span.id===e),V=H(ae),se=V>=0?V:Math.max(H(r),0),ne=T!==void 0?`aegis-trace-tree-name-w:${T}`:void 0,{width:E,handleProps:ie,isDragging:oe}=we.useResizable({initialWidth:k,minWidth:ye,maxWidth:Ee,side:"left",persistKey:ne}),ce=h??E;f.useEffect(()=>{h===void 0&&A?.(E)},[E,h,A]);const D=e=>{$(s=>{const a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})},w=e=>{if(e<0||e>=_.length)return;U(_[e].node.span.id),z.current?.querySelectorAll(':scope > [role="treeitem"]')[e]?.focus()},le=(e,s)=>{const{node:a}=_[s],g=a.children.length>0,t=g&&!v.has(a.span.id);switch(e.key){case"ArrowDown":w(s+1);break;case"ArrowUp":w(s-1);break;case"Home":w(0);break;case"End":w(_.length-1);break;case"ArrowRight":t?w(s+1):g&&D(a.span.id);break;case"ArrowLeft":if(t)D(a.span.id);else if(a.parent!==null){const x=a.parent;w(_.findIndex(b=>b.node===x))}break;case"Enter":a.span.to!==void 0?e.currentTarget.querySelector(".aegis-trace-tree__name a")?.click():n?.(a.span);break;case" ":n?.(a.span);break;default:return}e.preventDefault()},de=(e,s)=>{if(e.target instanceof Element&&e.target.closest("[data-trace-tree-caret]")!==null){D(s.span.id);return}(e.ctrlKey||e.metaKey||e.shiftKey)&&e.target instanceof Element&&e.target.closest(".aegis-trace-tree__name a")!==null||n?.(s.span)},ue=["aegis-trace-tree",oe?"aegis-trace-tree--dragging":"",L?"aegis-trace-tree--wrap":"",I==="ui"?"aegis-trace-tree--ui-names":"",y?"":"aegis-trace-tree--untimed",o??""].filter(Boolean).join(" "),he={...p,"--aegis-trace-tree-name-w":`${String(ce)}px`};return i.jsxs("div",{ref:P,className:ue,style:he,...te,children:[i.jsx("div",{ref:z,className:"aegis-trace-tree__rows",role:"tree","aria-label":u??N.traceSpans,children:_.map(({node:e,position:s,siblings:a},g)=>{const t=e.span,x=e.children.length>0,b=v.has(t.id),M=r===t.id,fe=["aegis-trace-tree__row",t.muted?"aegis-trace-tree__row--muted":"",M?"aegis-trace-tree__row--selected":"",t.status==="error"?"aegis-trace-tree__row--error":""].filter(Boolean).join(" "),pe=C(t)?N.traceSpanTiming(q.formatDuration(t.startMs-O),q.formatDuration(t.durationMs)):"",ge=t.kind??"",X=[pe,ge].filter(Boolean).join(" · "),Y=`${re}-note-${String(g)}`,G=t.note!==void 0&&t.note!==null,J=L?xe.breakAtSeparators(t.name):t.name,me=i.jsxs("div",{className:"aegis-trace-tree__tooltip",children:[i.jsx("div",{className:I==="ui"?"aegis-trace-tree__tooltip-name aegis-trace-tree__tooltip-name--ui":"aegis-trace-tree__tooltip-name",children:t.name}),X&&i.jsx("div",{className:"aegis-trace-tree__tooltip-meta",children:X})]});return i.jsxs(f.Fragment,{children:[i.jsxs("div",{ref:M?F?.placeRow:void 0,className:fe,role:"treeitem","aria-label":t.ariaLabel,"aria-describedby":G?Y:void 0,"aria-level":e.depth+1,"aria-posinset":s,"aria-setsize":a,"aria-expanded":x?!b:void 0,"aria-selected":M?!0:void 0,tabIndex:g===se?0:-1,onClick:R=>{de(R,e)},onKeyDown:R=>{le(R,g)},onFocus:()=>{U(t.id)},children:[i.jsxs("div",{className:"aegis-trace-tree__label",style:{"--depth":e.depth},children:[i.jsx("span",{className:x?"aegis-trace-tree__caret":"aegis-trace-tree__caret aegis-trace-tree__caret--leaf","aria-hidden":"true","data-trace-tree-caret":x?"":void 0,children:x?b?"▸":"▾":null}),i.jsx(be.StatusDot,{tone:ke.statusTone(t.status),size:6}),t.kind?i.jsx(Se.Chip,{tone:"ghost",className:"aegis-trace-tree__kind",children:t.kind}):null,i.jsx(_e.Tooltip,{placement:"topLeft",mouseEnterDelay:.3,styles:{root:{maxWidth:"var(--tooltip-max-width)"}},title:me,children:i.jsx("span",{className:"aegis-trace-tree__name",children:t.to===void 0?J:i.jsx(S,{to:t.to,className:"aegis-trace-tree__link",tabIndex:-1,children:J})})}),G?i.jsx("span",{id:Y,className:"aegis-trace-tree__note","aria-hidden":"true",children:t.note}):null]}),y&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"aegis-trace-tree__gutter","aria-hidden":"true"}),i.jsx("div",{className:"aegis-trace-tree__bar-track","aria-hidden":"true",children:C(t)&&i.jsx("span",{className:"aegis-trace-tree__bar",style:{left:`${((t.startMs-O)/K*100).toString()}%`,width:`${Math.max(t.durationMs/K*100,.5).toString()}%`}})}),i.jsx("div",{className:"aegis-trace-tree__duration",children:t.durationMs!==void 0&&q.formatDuration(t.durationMs)})]})]}),M?F?.inline:null]},t.id)})}),y&&i.jsx("div",{...ie,className:"aegis-trace-tree__handle","aria-label":N.resizeNameColumn})]})}exports.TraceTree=qe;
|
|
2
2
|
//# sourceMappingURL=TraceTree.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TraceTree.cjs","sources":["../../../src/components/ui/TraceTree.tsx"],"sourcesContent":["import {\n type CSSProperties,\n Fragment,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { Tooltip } from 'antd';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport { useResizable } from '../../hooks/useResizable';\nimport { breakAtSeparators } from '../../lib/breakAtSeparators';\nimport type { ChartColor } from '../../lib/chart';\nimport { formatDuration } from '../../lib/format';\nimport { useStrings } from '../../locale';\nimport { Chip } from './Chip';\nimport { StatusDot } from './StatusDot';\nimport './TraceTree.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\nimport { SelectedRowDetailContext } from './selectedRowDetail';\nimport { statusTone } from './traceStatus';\n\nexport type TraceTreeSurface = PrimitiveSurface<TraceSpan[]>;\n\nexport interface TraceSpan {\n id: string;\n parentId?: string | null;\n name: string;\n /**\n * Milliseconds since trace start. Leave `startMs` and `durationMs` out for a\n * span whose time is not recorded: its row draws no bar, and siblings that are\n * not all timed keep the order they are given in.\n */\n startMs?: number;\n durationMs?: number;\n status?: 'ok' | 'error' | 'unset';\n /**\n * The span's category: a chip on the left of its `TraceTree` row, and,\n * without `color`, the colour of its `TimelineChart` bar (one per kind).\n */\n kind?: string;\n /**\n * The colour of its `TimelineChart` bar. Set it from a stable key when\n * `kind` is translated, so the colour does not follow the language.\n */\n color?: ChartColor;\n /** Drawn at the end of the span's `TimelineChart` bar. */\n badge?: ReactNode;\n /**\n * Drawn at the end of the span's name in its `TraceTree` row, e.g. a change\n * mark or a count. It is the row's accessible description, not part of its\n * name. Give a Chip in it `inverted` while the span is selected.\n */\n note?: ReactNode;\n /**\n * Draws the span's `TraceTree` row in muted ink, e.g. for a span that only\n * the trace it is compared with has.\n */\n muted?: boolean;\n /** The accessible name of the span's `TraceTree` row. Default: the row's text. */\n ariaLabel?: string;\n /**\n * Makes the span's name in its `TraceTree` row a link to this\n * destination. The row stays the tree's tab stop: the link is not a tab\n * stop, and Enter on the row follows it.\n */\n to?: string;\n /** Free-form attributes — only used by the inspector pane, not by the row itself. */\n attrs?: Record<string, unknown>;\n}\n\ninterface TimedSpan extends TraceSpan {\n startMs: number;\n durationMs: number;\n}\n\ninterface TraceTreeProps {\n /**\n * The spans in any order. A span whose `parentId` names no span is a root;\n * spans whose parents form a cycle are cut at one span of the cycle, which\n * becomes a root.\n */\n spans: TraceSpan[];\n /**\n * The selected span. Its row is revealed: when the tree mounts, and each\n * time `selectedId` changes, the rows it hangs under expand, so a tree\n * opened with `defaultCollapsedDepth` shows the path to it. Rows the\n * viewer collapses later stay collapsed.\n */\n selectedId?: string;\n onSelect?: (span: TraceSpan) => void;\n /**\n * Rows at this depth or deeper start collapsed when they have children.\n * Roots are depth 0, so `0` shows only the roots and `1` the roots and\n * their children. Applies to the spans present when the tree mounts.\n * Default: every row expanded.\n */\n defaultCollapsedDepth?: number;\n /** The tree's accessible name. Default: the locale's `traceSpans`. */\n ariaLabel?: string;\n /** Renders the names of spans with `to`. Defaults to an `<a href>`; routed apps pass their Link adapter. */\n linkComponent?: LinkComponent;\n className?: string;\n style?: CSSProperties;\n surface?: TraceTreeSurface;\n nameColumnWidth?: number;\n defaultNameColumnWidth?: number;\n onNameColumnWidthChange?: (w: number) => void;\n persistKey?: string;\n /**\n * Wraps a long name over lines instead of truncating it: between words and\n * after `_ . - / :`, and inside a word only when it cannot fit a line. The\n * name keeps its runs of spaces, its tabs and its line breaks.\n */\n wrapName?: boolean;\n}\n\ninterface Node {\n span: TraceSpan;\n parent: Node | null;\n children: Node[];\n depth: number;\n}\n\ninterface VisibleRow {\n node: Node;\n /** 1-based position among its siblings. */\n position: number;\n siblings: number;\n}\n\nconst NAME_COL_MIN = 180;\nconst NAME_COL_MAX = 700;\nconst NAME_COL_DEFAULT = 320;\n\nfunction isTimed(span: TraceSpan): span is TimedSpan {\n return span.startMs !== undefined && span.durationMs !== undefined;\n}\n\nfunction sortByStart(nodes: Node[]): void {\n if (nodes.every((n) => n.span.startMs !== undefined)) {\n nodes.sort((a, b) => (a.span.startMs ?? 0) - (b.span.startMs ?? 0));\n }\n}\n\nfunction buildForest(spans: TraceSpan[]): Node[] {\n const byId = new Map<string, Node>();\n spans.forEach((span) => {\n byId.set(span.id, { span, parent: null, children: [], depth: 0 });\n });\n const roots: Node[] = [];\n byId.forEach((node) => {\n const pid = node.span.parentId;\n const parent = pid ? byId.get(pid) : undefined;\n if (parent) {\n node.parent = parent;\n parent.children.push(node);\n } else {\n roots.push(node);\n }\n });\n\n const placed = new Set<Node>();\n const place = (node: Node, depth: number): void => {\n placed.add(node);\n node.depth = depth;\n node.children.forEach((child) => {\n place(child, depth + 1);\n });\n };\n roots.forEach((root) => {\n place(root, 0);\n });\n // A span no root reaches hangs below a cycle of parents. Climbing from it\n // comes back round to a span on the cycle, which becomes a root.\n byId.forEach((node) => {\n if (placed.has(node)) {\n return;\n }\n const climbed = new Set<Node>();\n let onCycle = node;\n while (onCycle.parent !== null && !climbed.has(onCycle)) {\n climbed.add(onCycle);\n onCycle = onCycle.parent;\n }\n const cut = onCycle;\n if (cut.parent !== null) {\n cut.parent.children = cut.parent.children.filter((c) => c !== cut);\n cut.parent = null;\n }\n roots.push(cut);\n place(cut, 0);\n });\n\n const sortRec = (n: Node): void => {\n sortByStart(n.children);\n n.children.forEach(sortRec);\n };\n sortByStart(roots);\n roots.forEach(sortRec);\n return roots;\n}\n\nfunction findNode(roots: Node[], id: string): Node | undefined {\n for (const root of roots) {\n if (root.span.id === id) {\n return root;\n }\n const found = findNode(root.children, id);\n if (found) {\n return found;\n }\n }\n return undefined;\n}\n\n/** `collapsed` without the ancestors of the row `id`, or `collapsed` itself when none of them is collapsed. */\nfunction revealRow(\n roots: Node[],\n collapsed: Set<string>,\n id: string,\n): Set<string> {\n let next = collapsed;\n for (\n let ancestor = findNode(roots, id)?.parent ?? null;\n ancestor !== null;\n ancestor = ancestor.parent\n ) {\n if (next.has(ancestor.span.id)) {\n if (next === collapsed) {\n next = new Set(collapsed);\n }\n next.delete(ancestor.span.id);\n }\n }\n return next;\n}\n\nfunction flatten(\n nodes: Node[],\n collapsed: Set<string>,\n out: VisibleRow[] = [],\n): VisibleRow[] {\n nodes.forEach((node, index) => {\n out.push({ node, position: index + 1, siblings: nodes.length });\n if (!collapsed.has(node.span.id)) {\n flatten(node.children, collapsed, out);\n }\n });\n return out;\n}\n\nexport function TraceTree({\n spans,\n selectedId,\n onSelect,\n defaultCollapsedDepth = Number.POSITIVE_INFINITY,\n ariaLabel,\n linkComponent: Link = DefaultLink,\n className,\n style,\n surface,\n nameColumnWidth,\n defaultNameColumnWidth = NAME_COL_DEFAULT,\n onNameColumnWidthChange,\n persistKey,\n wrapName = false,\n}: TraceTreeProps) {\n const wrapRef = useRef<HTMLDivElement>(null);\n const treeRef = useRef<HTMLDivElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, spans, 'tree', wrapRef);\n const strings = useStrings();\n const idPrefix = useId();\n const selection = useContext(SelectedRowDetailContext);\n const { roots, traceDuration, traceStart, timed } = useMemo(() => {\n const r = buildForest(spans);\n const timedSpans = spans.filter(isTimed);\n const start = timedSpans.length\n ? Math.min(...timedSpans.map((s) => s.startMs))\n : 0;\n const end = timedSpans.length\n ? Math.max(...timedSpans.map((s) => s.startMs + s.durationMs))\n : 1;\n return {\n roots: r,\n traceStart: start,\n traceDuration: Math.max(end - start, 1),\n timed: timedSpans.length > 0,\n };\n }, [spans]);\n\n const [collapsed, setCollapsed] = useState<Set<string>>(() => {\n const init = new Set<string>();\n const walk = (n: Node): void => {\n if (n.depth >= defaultCollapsedDepth && n.children.length > 0) {\n init.add(n.span.id);\n }\n n.children.forEach(walk);\n };\n roots.forEach(walk);\n return selectedId === undefined ? init : revealRow(roots, init, selectedId);\n });\n // The selection the tree last revealed, so a new selectedId is revealed\n // once, before it is painted, and a span that arrives later is revealed\n // when it arrives.\n const [revealed, setRevealed] = useState<string | undefined>(() =>\n selectedId !== undefined && findNode(roots, selectedId)\n ? selectedId\n : undefined,\n );\n if (selectedId === undefined && revealed !== undefined) {\n setRevealed(undefined);\n }\n if (\n selectedId !== undefined &&\n selectedId !== revealed &&\n findNode(roots, selectedId)\n ) {\n setRevealed(selectedId);\n const next = revealRow(roots, collapsed, selectedId);\n if (next !== collapsed) {\n setCollapsed(next);\n }\n }\n const [focusedId, setFocusedId] = useState<string | undefined>(undefined);\n\n const visible = useMemo(() => flatten(roots, collapsed), [roots, collapsed]);\n\n // One tab stop: the row last focused, else the selected row, else the first.\n const rowIndexOf = (id: string | undefined): number =>\n id === undefined ? -1 : visible.findIndex((r) => r.node.span.id === id);\n const focusedIndex = rowIndexOf(focusedId);\n const tabStopIndex =\n focusedIndex >= 0 ? focusedIndex : Math.max(rowIndexOf(selectedId), 0);\n\n const resizePersistKey =\n persistKey !== undefined\n ? `aegis-trace-tree-name-w:${persistKey}`\n : undefined;\n\n const {\n width: internalWidth,\n handleProps,\n isDragging,\n } = useResizable({\n initialWidth: defaultNameColumnWidth,\n minWidth: NAME_COL_MIN,\n maxWidth: NAME_COL_MAX,\n side: 'left',\n persistKey: resizePersistKey,\n });\n\n const effectiveWidth = nameColumnWidth ?? internalWidth;\n\n useEffect(() => {\n if (nameColumnWidth === undefined) {\n onNameColumnWidthChange?.(internalWidth);\n }\n }, [internalWidth, nameColumnWidth, onNameColumnWidthChange]);\n\n const toggle = (id: string): void => {\n setCollapsed((prev) => {\n const next = new Set(prev);\n if (next.has(id)) {\n next.delete(id);\n } else {\n next.add(id);\n }\n return next;\n });\n };\n\n const focusRow = (index: number): void => {\n if (index < 0 || index >= visible.length) {\n return;\n }\n setFocusedId(visible[index].node.span.id);\n const row = treeRef.current?.querySelectorAll<HTMLElement>(\n ':scope > [role=\"treeitem\"]',\n )[index];\n row?.focus();\n };\n\n const handleRowKeyDown = (\n event: KeyboardEvent<HTMLDivElement>,\n index: number,\n ): void => {\n const { node } = visible[index];\n const expandable = node.children.length > 0;\n const expanded = expandable && !collapsed.has(node.span.id);\n switch (event.key) {\n case 'ArrowDown':\n focusRow(index + 1);\n break;\n case 'ArrowUp':\n focusRow(index - 1);\n break;\n case 'Home':\n focusRow(0);\n break;\n case 'End':\n focusRow(visible.length - 1);\n break;\n case 'ArrowRight':\n if (expanded) {\n focusRow(index + 1);\n } else if (expandable) {\n toggle(node.span.id);\n }\n break;\n case 'ArrowLeft':\n if (expanded) {\n toggle(node.span.id);\n } else if (node.parent !== null) {\n const parent = node.parent;\n focusRow(visible.findIndex((r) => r.node === parent));\n }\n break;\n // The link's click reaches the row, which selects it too.\n case 'Enter':\n if (node.span.to !== undefined) {\n event.currentTarget\n .querySelector<HTMLElement>('.aegis-trace-tree__name a')\n ?.click();\n } else {\n onSelect?.(node.span);\n }\n break;\n case ' ':\n onSelect?.(node.span);\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n\n const handleRowClick = (event: MouseEvent<HTMLDivElement>, node: Node) => {\n if (\n event.target instanceof Element &&\n event.target.closest('[data-trace-tree-caret]') !== null\n ) {\n toggle(node.span.id);\n return;\n }\n // A modified click opens the name's link elsewhere and leaves this\n // page's selection alone.\n if (\n (event.ctrlKey || event.metaKey || event.shiftKey) &&\n event.target instanceof Element &&\n event.target.closest('.aegis-trace-tree__name a') !== null\n ) {\n return;\n }\n onSelect?.(node.span);\n };\n\n const cls = [\n 'aegis-trace-tree',\n isDragging ? 'aegis-trace-tree--dragging' : '',\n wrapName ? 'aegis-trace-tree--wrap' : '',\n timed ? '' : 'aegis-trace-tree--untimed',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const rootStyle = {\n ...style,\n '--aegis-trace-tree-name-w': `${String(effectiveWidth)}px`,\n } as CSSProperties;\n\n return (\n <div ref={wrapRef} className={cls} style={rootStyle} {...agentAttrs}>\n <div\n ref={treeRef}\n className=\"aegis-trace-tree__rows\"\n role=\"tree\"\n aria-label={ariaLabel ?? strings.traceSpans}\n >\n {visible.map(({ node, position, siblings }, index) => {\n const span = node.span;\n const hasChildren = node.children.length > 0;\n const isCollapsed = collapsed.has(span.id);\n const isSelected = selectedId === span.id;\n const rowCls = [\n 'aegis-trace-tree__row',\n span.muted ? 'aegis-trace-tree__row--muted' : '',\n isSelected ? 'aegis-trace-tree__row--selected' : '',\n span.status === 'error' ? 'aegis-trace-tree__row--error' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const timing = isTimed(span)\n ? strings.traceSpanTiming(\n formatDuration(span.startMs - traceStart),\n formatDuration(span.durationMs),\n )\n : '';\n const kind = span.kind ?? '';\n const meta = [timing, kind].filter(Boolean).join(' · ');\n const noteId = `${idPrefix}-note-${String(index)}`;\n const hasNote = span.note !== undefined && span.note !== null;\n const name = wrapName ? breakAtSeparators(span.name) : span.name;\n const tooltipContent = (\n <div className=\"aegis-trace-tree__tooltip\">\n <div className=\"aegis-trace-tree__tooltip-name\">{span.name}</div>\n {meta && (\n <div className=\"aegis-trace-tree__tooltip-meta\">{meta}</div>\n )}\n </div>\n );\n\n return (\n <Fragment key={span.id}>\n <div\n ref={isSelected ? selection?.placeRow : undefined}\n className={rowCls}\n role=\"treeitem\"\n aria-label={span.ariaLabel}\n aria-describedby={hasNote ? noteId : undefined}\n aria-level={node.depth + 1}\n aria-posinset={position}\n aria-setsize={siblings}\n aria-expanded={hasChildren ? !isCollapsed : undefined}\n aria-selected={isSelected ? true : undefined}\n tabIndex={index === tabStopIndex ? 0 : -1}\n onClick={(event) => {\n handleRowClick(event, node);\n }}\n onKeyDown={(event) => {\n handleRowKeyDown(event, index);\n }}\n onFocus={() => {\n setFocusedId(span.id);\n }}\n >\n <div\n className=\"aegis-trace-tree__label\"\n style={\n {\n '--depth': node.depth,\n } as CSSProperties\n }\n >\n <span\n className={\n hasChildren\n ? 'aegis-trace-tree__caret'\n : 'aegis-trace-tree__caret aegis-trace-tree__caret--leaf'\n }\n aria-hidden=\"true\"\n data-trace-tree-caret={hasChildren ? '' : undefined}\n >\n {hasChildren ? (isCollapsed ? '▸' : '▾') : null}\n </span>\n <StatusDot tone={statusTone(span.status)} size={6} />\n {span.kind ? (\n <Chip tone=\"ghost\" className=\"aegis-trace-tree__kind\">\n {span.kind}\n </Chip>\n ) : null}\n <Tooltip\n placement=\"topLeft\"\n mouseEnterDelay={0.3}\n styles={{ root: { maxWidth: 'var(--tooltip-max-width)' } }}\n title={tooltipContent}\n >\n <span className=\"aegis-trace-tree__name\">\n {span.to === undefined ? (\n name\n ) : (\n <Link\n to={span.to}\n className=\"aegis-trace-tree__link\"\n tabIndex={-1}\n >\n {name}\n </Link>\n )}\n </span>\n </Tooltip>\n {hasNote ? (\n <span\n id={noteId}\n className=\"aegis-trace-tree__note\"\n aria-hidden=\"true\"\n >\n {span.note}\n </span>\n ) : null}\n </div>\n {timed && (\n <>\n <span\n className=\"aegis-trace-tree__gutter\"\n aria-hidden=\"true\"\n />\n <div\n className=\"aegis-trace-tree__bar-track\"\n aria-hidden=\"true\"\n >\n {isTimed(span) && (\n <span\n className=\"aegis-trace-tree__bar\"\n style={{\n left: `${(((span.startMs - traceStart) / traceDuration) * 100).toString()}%`,\n width: `${Math.max((span.durationMs / traceDuration) * 100, 0.5).toString()}%`,\n }}\n />\n )}\n </div>\n <div className=\"aegis-trace-tree__duration\">\n {span.durationMs !== undefined &&\n formatDuration(span.durationMs)}\n </div>\n </>\n )}\n </div>\n {isSelected ? selection?.inline : null}\n </Fragment>\n );\n })}\n </div>\n {timed && (\n <div\n {...handleProps}\n className=\"aegis-trace-tree__handle\"\n aria-label={strings.resizeNameColumn}\n />\n )}\n </div>\n );\n}\n"],"names":["NAME_COL_MIN","NAME_COL_MAX","NAME_COL_DEFAULT","isTimed","span","sortByStart","nodes","n","a","b","buildForest","spans","byId","roots","node","pid","parent","placed","place","depth","child","root","climbed","onCycle","cut","c","sortRec","findNode","id","found","revealRow","collapsed","next","ancestor","flatten","out","index","TraceTree","selectedId","onSelect","defaultCollapsedDepth","ariaLabel","Link","DefaultLink","className","style","surface","nameColumnWidth","defaultNameColumnWidth","onNameColumnWidthChange","persistKey","wrapName","wrapRef","useRef","treeRef","agentAttrs","usePrimitiveSurface","strings","useStrings","idPrefix","useId","selection","useContext","SelectedRowDetailContext","traceDuration","traceStart","timed","useMemo","r","timedSpans","start","s","end","setCollapsed","useState","init","walk","revealed","setRevealed","focusedId","setFocusedId","visible","rowIndexOf","focusedIndex","tabStopIndex","resizePersistKey","internalWidth","handleProps","isDragging","useResizable","effectiveWidth","useEffect","toggle","prev","focusRow","handleRowKeyDown","event","expandable","expanded","handleRowClick","cls","rootStyle","jsxs","jsx","position","siblings","hasChildren","isCollapsed","isSelected","rowCls","timing","formatDuration","kind","meta","noteId","hasNote","name","breakAtSeparators","tooltipContent","Fragment","StatusDot","statusTone","Chip","Tooltip"],"mappings":"2jBA6IMA,GAAe,IACfC,GAAe,IACf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AAlH,EAAK,KAAO,OACXgH,EAEAb,EAAAA,IAAC7D,EAAA,CACC,GAAItC,EAAK,GACT,UAAU,yBACV,SAAU,GAET,SAAAgH,CAAA,CAAA,CACH,CAEJ,CAAA,CAAA,EAEDD,EACCZ,EAAAA,IAAC,OAAA,CACC,GAAIW,EACJ,UAAU,yBACV,cAAY,OAEX,SAAA9G,EAAK,IAAA,CAAA,EAEN,IAAA,CAAA,CAAA,EAEL8D,GACCoC,EAAAA,KAAAiB,WAAA,CACE,SAAA,CAAAhB,EAAAA,IAAC,OAAA,CACC,UAAU,2BACV,cAAY,MAAA,CAAA,EAEdA,EAAAA,IAAC,MAAA,CACC,UAAU,8BACV,cAAY,OAEX,SAAApG,EAAQC,CAAI,GACXmG,EAAAA,IAAC,OAAA,CACC,UAAU,wBACV,MAAO,CACL,KAAM,KAAMnG,EAAK,QAAU6D,GAAcD,EAAiB,KAAK,UAAU,IACzE,MAAO,GAAG,KAAK,IAAK5D,EAAK,WAAa4D,EAAiB,IAAK,EAAG,EAAE,SAAA,CAAU,GAAA,CAC7E,CAAA,CACF,CAAA,EAGJuC,EAAAA,IAAC,MAAA,CAAI,UAAU,6BACZ,SAAAnG,EAAK,aAAe,QACnB2G,EAAAA,eAAe3G,EAAK,UAAU,CAAA,CAClC,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,EAGHwG,EAAa/C,GAAW,OAAS,IAAA,CAAA,EAzGrBzD,EAAK,EA0GpB,CAEJ,CAAC,CAAA,CAAA,EAEF8D,GACCqC,EAAAA,IAAC,MAAA,CACE,GAAGhB,GACJ,UAAU,2BACV,aAAY9B,EAAQ,gBAAA,CAAA,CACtB,EAEJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"TraceTree.cjs","sources":["../../../src/components/ui/TraceTree.tsx"],"sourcesContent":["import {\n type CSSProperties,\n Fragment,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { Tooltip } from 'antd';\n\nimport {\n type PrimitiveSurface,\n usePrimitiveSurface,\n} from '../../agent/core/usePrimitiveSurface';\nimport { useResizable } from '../../hooks/useResizable';\nimport { breakAtSeparators } from '../../lib/breakAtSeparators';\nimport type { ChartColor } from '../../lib/chart';\nimport { formatDuration } from '../../lib/format';\nimport { useStrings } from '../../locale';\nimport { Chip } from './Chip';\nimport { StatusDot } from './StatusDot';\nimport './TraceTree.css';\nimport { DefaultLink, type LinkComponent } from './linkComponent';\nimport { SelectedRowDetailContext } from './selectedRowDetail';\nimport { statusTone } from './traceStatus';\n\nexport type TraceTreeSurface = PrimitiveSurface<TraceSpan[]>;\n\nexport interface TraceSpan {\n id: string;\n parentId?: string | null;\n name: string;\n /**\n * Milliseconds since trace start. Leave `startMs` and `durationMs` out for a\n * span whose time is not recorded: its row draws no bar, and siblings that are\n * not all timed keep the order they are given in.\n */\n startMs?: number;\n durationMs?: number;\n status?: 'ok' | 'error' | 'unset';\n /**\n * The span's category: a chip on the left of its `TraceTree` row, and,\n * without `color`, the colour of its `TimelineChart` bar (one per kind).\n */\n kind?: string;\n /**\n * The colour of its `TimelineChart` bar. Set it from a stable key when\n * `kind` is translated, so the colour does not follow the language.\n */\n color?: ChartColor;\n /** Drawn at the end of the span's `TimelineChart` bar. */\n badge?: ReactNode;\n /**\n * Drawn at the end of the span's name in its `TraceTree` row, e.g. a change\n * mark or a count. It is the row's accessible description, not part of its\n * name. Give a Chip in it `inverted` while the span is selected.\n */\n note?: ReactNode;\n /**\n * Draws the span's `TraceTree` row in muted ink, e.g. for a span that only\n * the trace it is compared with has.\n */\n muted?: boolean;\n /** The accessible name of the span's `TraceTree` row. Default: the row's text. */\n ariaLabel?: string;\n /**\n * Makes the span's name in its `TraceTree` row a link to this\n * destination. The row stays the tree's tab stop: the link is not a tab\n * stop, and Enter on the row follows it.\n */\n to?: string;\n /** Free-form attributes — only used by the inspector pane, not by the row itself. */\n attrs?: Record<string, unknown>;\n}\n\ninterface TimedSpan extends TraceSpan {\n startMs: number;\n durationMs: number;\n}\n\ninterface TraceTreeProps {\n /**\n * The spans in any order. A span whose `parentId` names no span is a root;\n * spans whose parents form a cycle are cut at one span of the cycle, which\n * becomes a root.\n */\n spans: TraceSpan[];\n /**\n * The selected span. Its row is revealed: when the tree mounts, and each\n * time `selectedId` changes, the rows it hangs under expand, so a tree\n * opened with `defaultCollapsedDepth` shows the path to it. Rows the\n * viewer collapses later stay collapsed.\n */\n selectedId?: string;\n onSelect?: (span: TraceSpan) => void;\n /**\n * Rows at this depth or deeper start collapsed when they have children.\n * Roots are depth 0, so `0` shows only the roots and `1` the roots and\n * their children. Applies to the spans present when the tree mounts.\n * Default: every row expanded.\n */\n defaultCollapsedDepth?: number;\n /** The tree's accessible name. Default: the locale's `traceSpans`. */\n ariaLabel?: string;\n /** Renders the names of spans with `to`. Defaults to an `<a href>`; routed apps pass their Link adapter. */\n linkComponent?: LinkComponent;\n className?: string;\n style?: CSSProperties;\n surface?: TraceTreeSurface;\n nameColumnWidth?: number;\n defaultNameColumnWidth?: number;\n onNameColumnWidthChange?: (w: number) => void;\n persistKey?: string;\n /**\n * Wraps a long name over lines instead of truncating it: between words and\n * after `_ . - / :`, and inside a word only when it cannot fit a line. The\n * name keeps its runs of spaces, its tabs and its line breaks.\n */\n wrapName?: boolean;\n /**\n * `mono` (default) sets each name in `--font-mono`, for identifiers such as\n * span or file names; `ui` sets it in `--font-ui`, for names that are\n * words, such as areas, tasks or modules.\n */\n nameFont?: 'mono' | 'ui';\n}\n\ninterface Node {\n span: TraceSpan;\n parent: Node | null;\n children: Node[];\n depth: number;\n}\n\ninterface VisibleRow {\n node: Node;\n /** 1-based position among its siblings. */\n position: number;\n siblings: number;\n}\n\nconst NAME_COL_MIN = 180;\nconst NAME_COL_MAX = 700;\nconst NAME_COL_DEFAULT = 320;\n\nfunction isTimed(span: TraceSpan): span is TimedSpan {\n return span.startMs !== undefined && span.durationMs !== undefined;\n}\n\nfunction sortByStart(nodes: Node[]): void {\n if (nodes.every((n) => n.span.startMs !== undefined)) {\n nodes.sort((a, b) => (a.span.startMs ?? 0) - (b.span.startMs ?? 0));\n }\n}\n\nfunction buildForest(spans: TraceSpan[]): Node[] {\n const byId = new Map<string, Node>();\n spans.forEach((span) => {\n byId.set(span.id, { span, parent: null, children: [], depth: 0 });\n });\n const roots: Node[] = [];\n byId.forEach((node) => {\n const pid = node.span.parentId;\n const parent = pid ? byId.get(pid) : undefined;\n if (parent) {\n node.parent = parent;\n parent.children.push(node);\n } else {\n roots.push(node);\n }\n });\n\n const placed = new Set<Node>();\n const place = (node: Node, depth: number): void => {\n placed.add(node);\n node.depth = depth;\n node.children.forEach((child) => {\n place(child, depth + 1);\n });\n };\n roots.forEach((root) => {\n place(root, 0);\n });\n // A span no root reaches hangs below a cycle of parents. Climbing from it\n // comes back round to a span on the cycle, which becomes a root.\n byId.forEach((node) => {\n if (placed.has(node)) {\n return;\n }\n const climbed = new Set<Node>();\n let onCycle = node;\n while (onCycle.parent !== null && !climbed.has(onCycle)) {\n climbed.add(onCycle);\n onCycle = onCycle.parent;\n }\n const cut = onCycle;\n if (cut.parent !== null) {\n cut.parent.children = cut.parent.children.filter((c) => c !== cut);\n cut.parent = null;\n }\n roots.push(cut);\n place(cut, 0);\n });\n\n const sortRec = (n: Node): void => {\n sortByStart(n.children);\n n.children.forEach(sortRec);\n };\n sortByStart(roots);\n roots.forEach(sortRec);\n return roots;\n}\n\nfunction findNode(roots: Node[], id: string): Node | undefined {\n for (const root of roots) {\n if (root.span.id === id) {\n return root;\n }\n const found = findNode(root.children, id);\n if (found) {\n return found;\n }\n }\n return undefined;\n}\n\n/** `collapsed` without the ancestors of the row `id`, or `collapsed` itself when none of them is collapsed. */\nfunction revealRow(\n roots: Node[],\n collapsed: Set<string>,\n id: string,\n): Set<string> {\n let next = collapsed;\n for (\n let ancestor = findNode(roots, id)?.parent ?? null;\n ancestor !== null;\n ancestor = ancestor.parent\n ) {\n if (next.has(ancestor.span.id)) {\n if (next === collapsed) {\n next = new Set(collapsed);\n }\n next.delete(ancestor.span.id);\n }\n }\n return next;\n}\n\nfunction flatten(\n nodes: Node[],\n collapsed: Set<string>,\n out: VisibleRow[] = [],\n): VisibleRow[] {\n nodes.forEach((node, index) => {\n out.push({ node, position: index + 1, siblings: nodes.length });\n if (!collapsed.has(node.span.id)) {\n flatten(node.children, collapsed, out);\n }\n });\n return out;\n}\n\nexport function TraceTree({\n spans,\n selectedId,\n onSelect,\n defaultCollapsedDepth = Number.POSITIVE_INFINITY,\n ariaLabel,\n linkComponent: Link = DefaultLink,\n className,\n style,\n surface,\n nameColumnWidth,\n defaultNameColumnWidth = NAME_COL_DEFAULT,\n onNameColumnWidthChange,\n persistKey,\n wrapName = false,\n nameFont = 'mono',\n}: TraceTreeProps) {\n const wrapRef = useRef<HTMLDivElement>(null);\n const treeRef = useRef<HTMLDivElement>(null);\n const agentAttrs = usePrimitiveSurface(surface, spans, 'tree', wrapRef);\n const strings = useStrings();\n const idPrefix = useId();\n const selection = useContext(SelectedRowDetailContext);\n const { roots, traceDuration, traceStart, timed } = useMemo(() => {\n const r = buildForest(spans);\n const timedSpans = spans.filter(isTimed);\n const start = timedSpans.length\n ? Math.min(...timedSpans.map((s) => s.startMs))\n : 0;\n const end = timedSpans.length\n ? Math.max(...timedSpans.map((s) => s.startMs + s.durationMs))\n : 1;\n return {\n roots: r,\n traceStart: start,\n traceDuration: Math.max(end - start, 1),\n timed: timedSpans.length > 0,\n };\n }, [spans]);\n\n const [collapsed, setCollapsed] = useState<Set<string>>(() => {\n const init = new Set<string>();\n const walk = (n: Node): void => {\n if (n.depth >= defaultCollapsedDepth && n.children.length > 0) {\n init.add(n.span.id);\n }\n n.children.forEach(walk);\n };\n roots.forEach(walk);\n return selectedId === undefined ? init : revealRow(roots, init, selectedId);\n });\n // The selection the tree last revealed, so a new selectedId is revealed\n // once, before it is painted, and a span that arrives later is revealed\n // when it arrives.\n const [revealed, setRevealed] = useState<string | undefined>(() =>\n selectedId !== undefined && findNode(roots, selectedId)\n ? selectedId\n : undefined,\n );\n if (selectedId === undefined && revealed !== undefined) {\n setRevealed(undefined);\n }\n if (\n selectedId !== undefined &&\n selectedId !== revealed &&\n findNode(roots, selectedId)\n ) {\n setRevealed(selectedId);\n const next = revealRow(roots, collapsed, selectedId);\n if (next !== collapsed) {\n setCollapsed(next);\n }\n }\n const [focusedId, setFocusedId] = useState<string | undefined>(undefined);\n\n const visible = useMemo(() => flatten(roots, collapsed), [roots, collapsed]);\n\n // One tab stop: the row last focused, else the selected row, else the first.\n const rowIndexOf = (id: string | undefined): number =>\n id === undefined ? -1 : visible.findIndex((r) => r.node.span.id === id);\n const focusedIndex = rowIndexOf(focusedId);\n const tabStopIndex =\n focusedIndex >= 0 ? focusedIndex : Math.max(rowIndexOf(selectedId), 0);\n\n const resizePersistKey =\n persistKey !== undefined\n ? `aegis-trace-tree-name-w:${persistKey}`\n : undefined;\n\n const {\n width: internalWidth,\n handleProps,\n isDragging,\n } = useResizable({\n initialWidth: defaultNameColumnWidth,\n minWidth: NAME_COL_MIN,\n maxWidth: NAME_COL_MAX,\n side: 'left',\n persistKey: resizePersistKey,\n });\n\n const effectiveWidth = nameColumnWidth ?? internalWidth;\n\n useEffect(() => {\n if (nameColumnWidth === undefined) {\n onNameColumnWidthChange?.(internalWidth);\n }\n }, [internalWidth, nameColumnWidth, onNameColumnWidthChange]);\n\n const toggle = (id: string): void => {\n setCollapsed((prev) => {\n const next = new Set(prev);\n if (next.has(id)) {\n next.delete(id);\n } else {\n next.add(id);\n }\n return next;\n });\n };\n\n const focusRow = (index: number): void => {\n if (index < 0 || index >= visible.length) {\n return;\n }\n setFocusedId(visible[index].node.span.id);\n const row = treeRef.current?.querySelectorAll<HTMLElement>(\n ':scope > [role=\"treeitem\"]',\n )[index];\n row?.focus();\n };\n\n const handleRowKeyDown = (\n event: KeyboardEvent<HTMLDivElement>,\n index: number,\n ): void => {\n const { node } = visible[index];\n const expandable = node.children.length > 0;\n const expanded = expandable && !collapsed.has(node.span.id);\n switch (event.key) {\n case 'ArrowDown':\n focusRow(index + 1);\n break;\n case 'ArrowUp':\n focusRow(index - 1);\n break;\n case 'Home':\n focusRow(0);\n break;\n case 'End':\n focusRow(visible.length - 1);\n break;\n case 'ArrowRight':\n if (expanded) {\n focusRow(index + 1);\n } else if (expandable) {\n toggle(node.span.id);\n }\n break;\n case 'ArrowLeft':\n if (expanded) {\n toggle(node.span.id);\n } else if (node.parent !== null) {\n const parent = node.parent;\n focusRow(visible.findIndex((r) => r.node === parent));\n }\n break;\n // The link's click reaches the row, which selects it too.\n case 'Enter':\n if (node.span.to !== undefined) {\n event.currentTarget\n .querySelector<HTMLElement>('.aegis-trace-tree__name a')\n ?.click();\n } else {\n onSelect?.(node.span);\n }\n break;\n case ' ':\n onSelect?.(node.span);\n break;\n default:\n return;\n }\n event.preventDefault();\n };\n\n const handleRowClick = (event: MouseEvent<HTMLDivElement>, node: Node) => {\n if (\n event.target instanceof Element &&\n event.target.closest('[data-trace-tree-caret]') !== null\n ) {\n toggle(node.span.id);\n return;\n }\n // A modified click opens the name's link elsewhere and leaves this\n // page's selection alone.\n if (\n (event.ctrlKey || event.metaKey || event.shiftKey) &&\n event.target instanceof Element &&\n event.target.closest('.aegis-trace-tree__name a') !== null\n ) {\n return;\n }\n onSelect?.(node.span);\n };\n\n const cls = [\n 'aegis-trace-tree',\n isDragging ? 'aegis-trace-tree--dragging' : '',\n wrapName ? 'aegis-trace-tree--wrap' : '',\n nameFont === 'ui' ? 'aegis-trace-tree--ui-names' : '',\n timed ? '' : 'aegis-trace-tree--untimed',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const rootStyle = {\n ...style,\n '--aegis-trace-tree-name-w': `${String(effectiveWidth)}px`,\n } as CSSProperties;\n\n return (\n <div ref={wrapRef} className={cls} style={rootStyle} {...agentAttrs}>\n <div\n ref={treeRef}\n className=\"aegis-trace-tree__rows\"\n role=\"tree\"\n aria-label={ariaLabel ?? strings.traceSpans}\n >\n {visible.map(({ node, position, siblings }, index) => {\n const span = node.span;\n const hasChildren = node.children.length > 0;\n const isCollapsed = collapsed.has(span.id);\n const isSelected = selectedId === span.id;\n const rowCls = [\n 'aegis-trace-tree__row',\n span.muted ? 'aegis-trace-tree__row--muted' : '',\n isSelected ? 'aegis-trace-tree__row--selected' : '',\n span.status === 'error' ? 'aegis-trace-tree__row--error' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n const timing = isTimed(span)\n ? strings.traceSpanTiming(\n formatDuration(span.startMs - traceStart),\n formatDuration(span.durationMs),\n )\n : '';\n const kind = span.kind ?? '';\n const meta = [timing, kind].filter(Boolean).join(' · ');\n const noteId = `${idPrefix}-note-${String(index)}`;\n const hasNote = span.note !== undefined && span.note !== null;\n const name = wrapName ? breakAtSeparators(span.name) : span.name;\n const tooltipContent = (\n <div className=\"aegis-trace-tree__tooltip\">\n <div\n className={\n nameFont === 'ui'\n ? 'aegis-trace-tree__tooltip-name aegis-trace-tree__tooltip-name--ui'\n : 'aegis-trace-tree__tooltip-name'\n }\n >\n {span.name}\n </div>\n {meta && (\n <div className=\"aegis-trace-tree__tooltip-meta\">{meta}</div>\n )}\n </div>\n );\n\n return (\n <Fragment key={span.id}>\n <div\n ref={isSelected ? selection?.placeRow : undefined}\n className={rowCls}\n role=\"treeitem\"\n aria-label={span.ariaLabel}\n aria-describedby={hasNote ? noteId : undefined}\n aria-level={node.depth + 1}\n aria-posinset={position}\n aria-setsize={siblings}\n aria-expanded={hasChildren ? !isCollapsed : undefined}\n aria-selected={isSelected ? true : undefined}\n tabIndex={index === tabStopIndex ? 0 : -1}\n onClick={(event) => {\n handleRowClick(event, node);\n }}\n onKeyDown={(event) => {\n handleRowKeyDown(event, index);\n }}\n onFocus={() => {\n setFocusedId(span.id);\n }}\n >\n <div\n className=\"aegis-trace-tree__label\"\n style={\n {\n '--depth': node.depth,\n } as CSSProperties\n }\n >\n <span\n className={\n hasChildren\n ? 'aegis-trace-tree__caret'\n : 'aegis-trace-tree__caret aegis-trace-tree__caret--leaf'\n }\n aria-hidden=\"true\"\n data-trace-tree-caret={hasChildren ? '' : undefined}\n >\n {hasChildren ? (isCollapsed ? '▸' : '▾') : null}\n </span>\n <StatusDot tone={statusTone(span.status)} size={6} />\n {span.kind ? (\n <Chip tone=\"ghost\" className=\"aegis-trace-tree__kind\">\n {span.kind}\n </Chip>\n ) : null}\n <Tooltip\n placement=\"topLeft\"\n mouseEnterDelay={0.3}\n styles={{ root: { maxWidth: 'var(--tooltip-max-width)' } }}\n title={tooltipContent}\n >\n <span className=\"aegis-trace-tree__name\">\n {span.to === undefined ? (\n name\n ) : (\n <Link\n to={span.to}\n className=\"aegis-trace-tree__link\"\n tabIndex={-1}\n >\n {name}\n </Link>\n )}\n </span>\n </Tooltip>\n {hasNote ? (\n <span\n id={noteId}\n className=\"aegis-trace-tree__note\"\n aria-hidden=\"true\"\n >\n {span.note}\n </span>\n ) : null}\n </div>\n {timed && (\n <>\n <span\n className=\"aegis-trace-tree__gutter\"\n aria-hidden=\"true\"\n />\n <div\n className=\"aegis-trace-tree__bar-track\"\n aria-hidden=\"true\"\n >\n {isTimed(span) && (\n <span\n className=\"aegis-trace-tree__bar\"\n style={{\n left: `${(((span.startMs - traceStart) / traceDuration) * 100).toString()}%`,\n width: `${Math.max((span.durationMs / traceDuration) * 100, 0.5).toString()}%`,\n }}\n />\n )}\n </div>\n <div className=\"aegis-trace-tree__duration\">\n {span.durationMs !== undefined &&\n formatDuration(span.durationMs)}\n </div>\n </>\n )}\n </div>\n {isSelected ? selection?.inline : null}\n </Fragment>\n );\n })}\n </div>\n {timed && (\n <div\n {...handleProps}\n className=\"aegis-trace-tree__handle\"\n aria-label={strings.resizeNameColumn}\n />\n )}\n </div>\n );\n}\n"],"names":["NAME_COL_MIN","NAME_COL_MAX","NAME_COL_DEFAULT","isTimed","span","sortByStart","nodes","n","a","b","buildForest","spans","byId","roots","node","pid","parent","placed","place","depth","child","root","climbed","onCycle","cut","c","sortRec","findNode","id","found","revealRow","collapsed","next","ancestor","flatten","out","index","TraceTree","selectedId","onSelect","defaultCollapsedDepth","ariaLabel","Link","DefaultLink","className","style","surface","nameColumnWidth","defaultNameColumnWidth","onNameColumnWidthChange","persistKey","wrapName","nameFont","wrapRef","useRef","treeRef","agentAttrs","usePrimitiveSurface","strings","useStrings","idPrefix","useId","selection","useContext","SelectedRowDetailContext","traceDuration","traceStart","timed","useMemo","r","timedSpans","start","s","end","setCollapsed","useState","init","walk","revealed","setRevealed","focusedId","setFocusedId","visible","rowIndexOf","focusedIndex","tabStopIndex","resizePersistKey","internalWidth","handleProps","isDragging","useResizable","effectiveWidth","useEffect","toggle","prev","focusRow","handleRowKeyDown","event","expandable","expanded","handleRowClick","cls","rootStyle","jsxs","jsx","position","siblings","hasChildren","isCollapsed","isSelected","rowCls","timing","formatDuration","kind","meta","noteId","hasNote","name","breakAtSeparators","tooltipContent","Fragment","StatusDot","statusTone","Chip","Tooltip"],"mappings":"2jBAmJMA,GAAe,IACfC,GAAe,IACfC,GAAmB,IAEzB,SAASC,EAAQC,EAAoC,CACnD,OAAOA,EAAK,UAAY,QAAaA,EAAK,aAAe,MAC3D,CAEA,SAASC,EAAYC,EAAqB,CACpCA,EAAM,MAAOC,GAAMA,EAAE,KAAK,UAAY,MAAS,GACjDD,EAAM,KAAK,CAACE,EAAGC,KAAOD,EAAE,KAAK,SAAW,IAAMC,EAAE,KAAK,SAAW,EAAE,CAEtE,CAEA,SAASC,GAAYC,EAA4B,CAC/C,MAAMC,MAAW,IACjBD,EAAM,QAASP,GAAS,CACtBQ,EAAK,IAAIR,EAAK,GAAI,CAAE,KAAAA,EAAM,OAAQ,KAAM,SAAU,CAAA,EAAI,MAAO,CAAA,CAAG,CAClE,CAAC,EACD,MAAMS,EAAgB,CAAA,EACtBD,EAAK,QAASE,GAAS,CACrB,MAAMC,EAAMD,EAAK,KAAK,SAChBE,EAASD,EAAMH,EAAK,IAAIG,CAAG,EAAI,OACjCC,GACFF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KAAMpG,EAAK,QAAU8D,GAAcD,EAAiB,KAAK,UAAU,IACzE,MAAO,GAAG,KAAK,IAAK7D,EAAK,WAAa6D,EAAiB,IAAK,EAAG,EAAE,SAAA,CAAU,GAAA,CAC7E,CAAA,CACF,CAAA,EAGJuC,EAAAA,IAAC,MAAA,CAAI,UAAU,6BACZ,SAAApG,EAAK,aAAe,QACnB4G,EAAAA,eAAe5G,EAAK,UAAU,CAAA,CAClC,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,EAGHyG,EAAa/C,GAAW,OAAS,IAAA,CAAA,EAzGrB1D,EAAK,EA0GpB,CAEJ,CAAC,CAAA,CAAA,EAEF+D,GACCqC,EAAAA,IAAC,MAAA,CACE,GAAGhB,GACJ,UAAU,2BACV,aAAY9B,EAAQ,gBAAA,CAAA,CACtB,EAEJ,CAEJ"}
|
|
@@ -88,6 +88,12 @@ interface TraceTreeProps {
|
|
|
88
88
|
* name keeps its runs of spaces, its tabs and its line breaks.
|
|
89
89
|
*/
|
|
90
90
|
wrapName?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* `mono` (default) sets each name in `--font-mono`, for identifiers such as
|
|
93
|
+
* span or file names; `ui` sets it in `--font-ui`, for names that are
|
|
94
|
+
* words, such as areas, tasks or modules.
|
|
95
|
+
*/
|
|
96
|
+
nameFont?: 'mono' | 'ui';
|
|
91
97
|
}
|
|
92
|
-
export declare function TraceTree({ spans, selectedId, onSelect, defaultCollapsedDepth, ariaLabel, linkComponent: Link, className, style, surface, nameColumnWidth, defaultNameColumnWidth, onNameColumnWidthChange, persistKey, wrapName, }: TraceTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
98
|
+
export declare function TraceTree({ spans, selectedId, onSelect, defaultCollapsedDepth, ariaLabel, linkComponent: Link, className, style, surface, nameColumnWidth, defaultNameColumnWidth, onNameColumnWidthChange, persistKey, wrapName, nameFont, }: TraceTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
93
99
|
export {};
|