@lincyaw/aegis-ui 0.19.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/components/ui/AnchoredPopover.cjs +1 -1
  2. package/dist/components/ui/AnchoredPopover.cjs.map +1 -1
  3. package/dist/components/ui/AnchoredPopover.d.ts +7 -1
  4. package/dist/components/ui/AnchoredPopover.js +64 -62
  5. package/dist/components/ui/AnchoredPopover.js.map +1 -1
  6. package/dist/components/ui/DataTable.cjs +1 -1
  7. package/dist/components/ui/DataTable.cjs.map +1 -1
  8. package/dist/components/ui/DataTable.d.ts +11 -1
  9. package/dist/components/ui/DataTable.js +78 -74
  10. package/dist/components/ui/DataTable.js.map +1 -1
  11. package/dist/components/ui/DetailBeside.cjs +1 -1
  12. package/dist/components/ui/DetailBeside.cjs.map +1 -1
  13. package/dist/components/ui/DetailBeside.d.ts +9 -4
  14. package/dist/components/ui/DetailBeside.js +91 -77
  15. package/dist/components/ui/DetailBeside.js.map +1 -1
  16. package/dist/components/ui/IdentityCell.cjs +1 -1
  17. package/dist/components/ui/IdentityCell.cjs.map +1 -1
  18. package/dist/components/ui/IdentityCell.d.ts +6 -1
  19. package/dist/components/ui/IdentityCell.js +17 -15
  20. package/dist/components/ui/IdentityCell.js.map +1 -1
  21. package/dist/components/ui/PaneLayout.cjs +1 -1
  22. package/dist/components/ui/PaneLayout.cjs.map +1 -1
  23. package/dist/components/ui/PaneLayout.d.ts +7 -2
  24. package/dist/components/ui/PaneLayout.js +20 -22
  25. package/dist/components/ui/PaneLayout.js.map +1 -1
  26. package/dist/components/ui/Select.cjs +1 -1
  27. package/dist/components/ui/Select.cjs.map +1 -1
  28. package/dist/components/ui/Select.d.ts +8 -2
  29. package/dist/components/ui/Select.js +44 -38
  30. package/dist/components/ui/Select.js.map +1 -1
  31. package/dist/components/ui/TimeDisplay.cjs +1 -1
  32. package/dist/components/ui/TimeDisplay.cjs.map +1 -1
  33. package/dist/components/ui/TimeDisplay.d.ts +11 -3
  34. package/dist/components/ui/TimeDisplay.js +39 -34
  35. package/dist/components/ui/TimeDisplay.js.map +1 -1
  36. package/dist/components/ui/Timeline.cjs +1 -1
  37. package/dist/components/ui/Timeline.cjs.map +1 -1
  38. package/dist/components/ui/Timeline.d.ts +17 -4
  39. package/dist/components/ui/Timeline.js +88 -67
  40. package/dist/components/ui/Timeline.js.map +1 -1
  41. package/dist/components/ui/Toolbar.cjs.map +1 -1
  42. package/dist/components/ui/Toolbar.d.ts +2 -1
  43. package/dist/components/ui/Toolbar.js.map +1 -1
  44. package/dist/components/ui/TraceTree.cjs +1 -1
  45. package/dist/components/ui/TraceTree.cjs.map +1 -1
  46. package/dist/components/ui/TraceTree.d.ts +7 -1
  47. package/dist/components/ui/TraceTree.js +127 -119
  48. package/dist/components/ui/TraceTree.js.map +1 -1
  49. package/dist/components/ui/linkComponent.cjs +1 -1
  50. package/dist/components/ui/linkComponent.cjs.map +1 -1
  51. package/dist/components/ui/linkComponent.d.ts +6 -4
  52. package/dist/components/ui/linkComponent.js +12 -10
  53. package/dist/components/ui/linkComponent.js.map +1 -1
  54. package/dist/layouts/shell/AegisShell.cjs +1 -1
  55. package/dist/layouts/shell/AegisShell.cjs.map +1 -1
  56. package/dist/layouts/shell/AegisShell.js +24 -24
  57. package/dist/layouts/shell/AegisShell.js.map +1 -1
  58. package/dist/layouts/shell/RouterLink.cjs +1 -1
  59. package/dist/layouts/shell/RouterLink.cjs.map +1 -1
  60. package/dist/layouts/shell/RouterLink.js +14 -12
  61. package/dist/layouts/shell/RouterLink.js.map +1 -1
  62. package/dist/layouts/shell/types.d.ts +6 -0
  63. package/dist/locale/strings.cjs +1 -1
  64. package/dist/locale/strings.cjs.map +1 -1
  65. package/dist/locale/strings.d.ts +2 -0
  66. package/dist/locale/strings.js +7 -5
  67. package/dist/locale/strings.js.map +1 -1
  68. package/dist/style.css +1 -1
  69. package/package.json +1 -1
@@ -1,146 +1,147 @@
1
- import { jsxs as b, jsx as l, Fragment as we } from "react/jsx-runtime";
2
- import { useRef as Q, useId as be, useContext as Me, useMemo as Z, useState as C, useEffect as Ne, Fragment as Se } from "react";
3
- import { Tooltip as ke } from "antd";
4
- import { usePrimitiveSurface as Ee } from "../../agent/core/usePrimitiveSurface.js";
5
- import { useResizable as ye } from "../../hooks/useResizable.js";
6
- import { breakAtSeparators as xe } from "../../lib/breakAtSeparators.js";
1
+ import { jsxs as b, jsx as l, Fragment as be } from "react/jsx-runtime";
2
+ import { useRef as Z, useId as Me, useContext as Ne, useMemo as ee, useState as C, useEffect as Se, Fragment as ke } from "react";
3
+ import { Tooltip as Ee } from "antd";
4
+ import { usePrimitiveSurface as ye } from "../../agent/core/usePrimitiveSurface.js";
5
+ import { useResizable as xe } from "../../hooks/useResizable.js";
6
+ import { breakAtSeparators as De } from "../../lib/breakAtSeparators.js";
7
7
  import { formatDuration as T } from "../../lib/format.js";
8
- import { Chip as De } from "./Chip.js";
9
- import { StatusDot as Re } from "./StatusDot.js";
8
+ import { Chip as Re } from "./Chip.js";
9
+ import { StatusDot as Ae } from "./StatusDot.js";
10
10
  /* empty css */
11
- import { DefaultLink as Ae } from "./linkComponent.js";
12
- import { SelectedRowDetailContext as Ce } from "./selectedRowDetail.js";
13
- import { statusTone as Te } from "./traceStatus.js";
11
+ import { DefaultLink as Ce } from "./linkComponent.js";
12
+ import { SelectedRowDetailContext as Te } from "./selectedRowDetail.js";
13
+ import { statusTone as Le } from "./traceStatus.js";
14
14
  import { useStrings as Fe } from "../../locale/useStrings.js";
15
- const Le = 180, Ie = 700, $e = 320;
16
- function F(o) {
15
+ const Ie = 180, $e = 700, Ke = 320;
16
+ function L(o) {
17
17
  return o.startMs !== void 0 && o.durationMs !== void 0;
18
18
  }
19
- function ee(o) {
20
- o.every((r) => r.span.startMs !== void 0) && o.sort((r, i) => (r.span.startMs ?? 0) - (i.span.startMs ?? 0));
19
+ function te(o) {
20
+ o.every((r) => r.span.startMs !== void 0) && o.sort((r, n) => (r.span.startMs ?? 0) - (n.span.startMs ?? 0));
21
21
  }
22
- function Ke(o) {
22
+ function je(o) {
23
23
  const r = /* @__PURE__ */ new Map();
24
24
  o.forEach((s) => {
25
25
  r.set(s.id, { span: s, parent: null, children: [], depth: 0 });
26
26
  });
27
- const i = [];
27
+ const n = [];
28
28
  r.forEach((s) => {
29
- const h = s.span.parentId, d = h ? r.get(h) : void 0;
30
- d ? (s.parent = d, d.children.push(s)) : i.push(s);
29
+ const u = s.span.parentId, d = u ? r.get(u) : void 0;
30
+ d ? (s.parent = d, d.children.push(s)) : n.push(s);
31
31
  });
32
- const c = /* @__PURE__ */ new Set(), f = (s, h) => {
33
- c.add(s), s.depth = h, s.children.forEach((d) => {
34
- f(d, h + 1);
32
+ const c = /* @__PURE__ */ new Set(), f = (s, u) => {
33
+ c.add(s), s.depth = u, s.children.forEach((d) => {
34
+ f(d, u + 1);
35
35
  });
36
36
  };
37
- i.forEach((s) => {
37
+ n.forEach((s) => {
38
38
  f(s, 0);
39
39
  }), r.forEach((s) => {
40
40
  if (c.has(s))
41
41
  return;
42
- const h = /* @__PURE__ */ new Set();
42
+ const u = /* @__PURE__ */ new Set();
43
43
  let d = s;
44
- for (; d.parent !== null && !h.has(d); )
45
- h.add(d), d = d.parent;
44
+ for (; d.parent !== null && !u.has(d); )
45
+ u.add(d), d = d.parent;
46
46
  const p = d;
47
- p.parent !== null && (p.parent.children = p.parent.children.filter((E) => E !== p), p.parent = null), i.push(p), f(p, 0);
47
+ p.parent !== null && (p.parent.children = p.parent.children.filter((E) => E !== p), p.parent = null), n.push(p), f(p, 0);
48
48
  });
49
49
  const M = (s) => {
50
- ee(s.children), s.children.forEach(M);
50
+ te(s.children), s.children.forEach(M);
51
51
  };
52
- return ee(i), i.forEach(M), i;
52
+ return te(n), n.forEach(M), n;
53
53
  }
54
54
  function k(o, r) {
55
- for (const i of o) {
56
- if (i.span.id === r)
57
- return i;
58
- const c = k(i.children, r);
55
+ for (const n of o) {
56
+ if (n.span.id === r)
57
+ return n;
58
+ const c = k(n.children, r);
59
59
  if (c)
60
60
  return c;
61
61
  }
62
62
  }
63
- function te(o, r, i) {
63
+ function re(o, r, n) {
64
64
  let c = r;
65
- for (let f = k(o, i)?.parent ?? null; f !== null; f = f.parent)
65
+ for (let f = k(o, n)?.parent ?? null; f !== null; f = f.parent)
66
66
  c.has(f.span.id) && (c === r && (c = new Set(r)), c.delete(f.span.id));
67
67
  return c;
68
68
  }
69
- function re(o, r, i = []) {
69
+ function ae(o, r, n = []) {
70
70
  return o.forEach((c, f) => {
71
- i.push({ node: c, position: f + 1, siblings: o.length }), r.has(c.span.id) || re(c.children, r, i);
72
- }), i;
71
+ n.push({ node: c, position: f + 1, siblings: o.length }), r.has(c.span.id) || ae(c.children, r, n);
72
+ }), n;
73
73
  }
74
- function Qe({
74
+ function Ze({
75
75
  spans: o,
76
76
  selectedId: r,
77
- onSelect: i,
77
+ onSelect: n,
78
78
  defaultCollapsedDepth: c = Number.POSITIVE_INFINITY,
79
79
  ariaLabel: f,
80
- linkComponent: M = Ae,
80
+ linkComponent: M = Ce,
81
81
  className: s,
82
- style: h,
82
+ style: u,
83
83
  surface: d,
84
84
  nameColumnWidth: p,
85
- defaultNameColumnWidth: E = $e,
86
- onNameColumnWidthChange: L,
85
+ defaultNameColumnWidth: E = Ke,
86
+ onNameColumnWidthChange: F,
87
87
  persistKey: I,
88
- wrapName: $ = !1
88
+ wrapName: $ = !1,
89
+ nameFont: K = "mono"
89
90
  }) {
90
- const K = Q(null), j = Q(null), ae = Ee(d, o, "tree", K), y = Fe(), ne = be(), z = Me(Ce), { roots: m, traceDuration: O, traceStart: P, timed: x } = Z(() => {
91
- const e = Ke(o), n = o.filter(F), a = n.length ? Math.min(...n.map((t) => t.startMs)) : 0, u = n.length ? Math.max(...n.map((t) => t.startMs + t.durationMs)) : 1;
91
+ const j = Z(null), z = Z(null), ie = ye(d, o, "tree", j), y = Fe(), ne = Me(), O = Ne(Te), { roots: m, traceDuration: P, traceStart: B, timed: x } = ee(() => {
92
+ const e = je(o), i = o.filter(L), a = i.length ? Math.min(...i.map((t) => t.startMs)) : 0, h = i.length ? Math.max(...i.map((t) => t.startMs + t.durationMs)) : 1;
92
93
  return {
93
94
  roots: e,
94
95
  traceStart: a,
95
- traceDuration: Math.max(u - a, 1),
96
- timed: n.length > 0
96
+ traceDuration: Math.max(h - a, 1),
97
+ timed: i.length > 0
97
98
  };
98
- }, [o]), [_, B] = C(() => {
99
- const e = /* @__PURE__ */ new Set(), n = (a) => {
100
- a.depth >= c && a.children.length > 0 && e.add(a.span.id), a.children.forEach(n);
99
+ }, [o]), [_, W] = C(() => {
100
+ const e = /* @__PURE__ */ new Set(), i = (a) => {
101
+ a.depth >= c && a.children.length > 0 && e.add(a.span.id), a.children.forEach(i);
101
102
  };
102
- return m.forEach(n), r === void 0 ? e : te(m, e, r);
103
- }), [W, q] = C(
103
+ return m.forEach(i), r === void 0 ? e : re(m, e, r);
104
+ }), [q, U] = C(
104
105
  () => r !== void 0 && k(m, r) ? r : void 0
105
106
  );
106
- if (r === void 0 && W !== void 0 && q(void 0), r !== void 0 && r !== W && k(m, r)) {
107
- q(r);
108
- const e = te(m, _, r);
109
- e !== _ && B(e);
107
+ if (r === void 0 && q !== void 0 && U(void 0), r !== void 0 && r !== q && k(m, r)) {
108
+ U(r);
109
+ const e = re(m, _, r);
110
+ e !== _ && W(e);
110
111
  }
111
- const [ie, U] = C(void 0), g = Z(() => re(m, _), [m, _]), H = (e) => e === void 0 ? -1 : g.findIndex((n) => n.node.span.id === e), V = H(ie), se = V >= 0 ? V : Math.max(H(r), 0), oe = I !== void 0 ? `aegis-trace-tree-name-w:${I}` : void 0, {
112
+ const [se, H] = C(void 0), g = ee(() => ae(m, _), [m, _]), V = (e) => e === void 0 ? -1 : g.findIndex((i) => i.node.span.id === e), X = V(se), oe = X >= 0 ? X : Math.max(V(r), 0), ce = I !== void 0 ? `aegis-trace-tree-name-w:${I}` : void 0, {
112
113
  width: D,
113
- handleProps: ce,
114
- isDragging: le
115
- } = ye({
114
+ handleProps: le,
115
+ isDragging: de
116
+ } = xe({
116
117
  initialWidth: E,
117
- minWidth: Le,
118
- maxWidth: Ie,
118
+ minWidth: Ie,
119
+ maxWidth: $e,
119
120
  side: "left",
120
- persistKey: oe
121
- }), de = p ?? D;
122
- Ne(() => {
123
- p === void 0 && L?.(D);
124
- }, [D, p, L]);
121
+ persistKey: ce
122
+ }), fe = p ?? D;
123
+ Se(() => {
124
+ p === void 0 && F?.(D);
125
+ }, [D, p, F]);
125
126
  const R = (e) => {
126
- B((n) => {
127
- const a = new Set(n);
127
+ W((i) => {
128
+ const a = new Set(i);
128
129
  return a.has(e) ? a.delete(e) : a.add(e), a;
129
130
  });
130
131
  }, v = (e) => {
131
132
  if (e < 0 || e >= g.length)
132
133
  return;
133
- U(g[e].node.span.id), j.current?.querySelectorAll(
134
+ H(g[e].node.span.id), z.current?.querySelectorAll(
134
135
  ':scope > [role="treeitem"]'
135
136
  )[e]?.focus();
136
- }, fe = (e, n) => {
137
- const { node: a } = g[n], u = a.children.length > 0, t = u && !_.has(a.span.id);
137
+ }, pe = (e, i) => {
138
+ const { node: a } = g[i], h = a.children.length > 0, t = h && !_.has(a.span.id);
138
139
  switch (e.key) {
139
140
  case "ArrowDown":
140
- v(n + 1);
141
+ v(i + 1);
141
142
  break;
142
143
  case "ArrowUp":
143
- v(n - 1);
144
+ v(i - 1);
144
145
  break;
145
146
  case "Home":
146
147
  v(0);
@@ -149,7 +150,7 @@ function Qe({
149
150
  v(g.length - 1);
150
151
  break;
151
152
  case "ArrowRight":
152
- t ? v(n + 1) : u && R(a.span.id);
153
+ t ? v(i + 1) : h && R(a.span.id);
153
154
  break;
154
155
  case "ArrowLeft":
155
156
  if (t)
@@ -160,75 +161,82 @@ function Qe({
160
161
  }
161
162
  break;
162
163
  case "Enter":
163
- a.span.to !== void 0 ? e.currentTarget.querySelector(".aegis-trace-tree__name a")?.click() : i?.(a.span);
164
+ a.span.to !== void 0 ? e.currentTarget.querySelector(".aegis-trace-tree__name a")?.click() : n?.(a.span);
164
165
  break;
165
166
  case " ":
166
- i?.(a.span);
167
+ n?.(a.span);
167
168
  break;
168
169
  default:
169
170
  return;
170
171
  }
171
172
  e.preventDefault();
172
- }, pe = (e, n) => {
173
+ }, ue = (e, i) => {
173
174
  if (e.target instanceof Element && e.target.closest("[data-trace-tree-caret]") !== null) {
174
- R(n.span.id);
175
+ R(i.span.id);
175
176
  return;
176
177
  }
177
- (e.ctrlKey || e.metaKey || e.shiftKey) && e.target instanceof Element && e.target.closest(".aegis-trace-tree__name a") !== null || i?.(n.span);
178
+ (e.ctrlKey || e.metaKey || e.shiftKey) && e.target instanceof Element && e.target.closest(".aegis-trace-tree__name a") !== null || n?.(i.span);
178
179
  }, he = [
179
180
  "aegis-trace-tree",
180
- le ? "aegis-trace-tree--dragging" : "",
181
+ de ? "aegis-trace-tree--dragging" : "",
181
182
  $ ? "aegis-trace-tree--wrap" : "",
183
+ K === "ui" ? "aegis-trace-tree--ui-names" : "",
182
184
  x ? "" : "aegis-trace-tree--untimed",
183
185
  s ?? ""
184
- ].filter(Boolean).join(" "), ue = {
185
- ...h,
186
- "--aegis-trace-tree-name-w": `${String(de)}px`
186
+ ].filter(Boolean).join(" "), me = {
187
+ ...u,
188
+ "--aegis-trace-tree-name-w": `${String(fe)}px`
187
189
  };
188
- return /* @__PURE__ */ b("div", { ref: K, className: he, style: ue, ...ae, children: [
190
+ return /* @__PURE__ */ b("div", { ref: j, className: he, style: me, ...ie, children: [
189
191
  /* @__PURE__ */ l(
190
192
  "div",
191
193
  {
192
- ref: j,
194
+ ref: z,
193
195
  className: "aegis-trace-tree__rows",
194
196
  role: "tree",
195
197
  "aria-label": f ?? y.traceSpans,
196
- children: g.map(({ node: e, position: n, siblings: a }, u) => {
197
- const t = e.span, w = e.children.length > 0, N = _.has(t.id), S = r === t.id, me = [
198
+ children: g.map(({ node: e, position: i, siblings: a }, h) => {
199
+ const t = e.span, w = e.children.length > 0, N = _.has(t.id), S = r === t.id, ge = [
198
200
  "aegis-trace-tree__row",
199
201
  t.muted ? "aegis-trace-tree__row--muted" : "",
200
202
  S ? "aegis-trace-tree__row--selected" : "",
201
203
  t.status === "error" ? "aegis-trace-tree__row--error" : ""
202
- ].filter(Boolean).join(" "), ge = F(t) ? y.traceSpanTiming(
203
- T(t.startMs - P),
204
+ ].filter(Boolean).join(" "), _e = L(t) ? y.traceSpanTiming(
205
+ T(t.startMs - B),
204
206
  T(t.durationMs)
205
- ) : "", _e = t.kind ?? "", X = [ge, _e].filter(Boolean).join(" · "), Y = `${ne}-note-${String(u)}`, G = t.note !== void 0 && t.note !== null, J = $ ? xe(t.name) : t.name, ve = /* @__PURE__ */ b("div", { className: "aegis-trace-tree__tooltip", children: [
206
- /* @__PURE__ */ l("div", { className: "aegis-trace-tree__tooltip-name", children: t.name }),
207
- X && /* @__PURE__ */ l("div", { className: "aegis-trace-tree__tooltip-meta", children: X })
207
+ ) : "", ve = t.kind ?? "", Y = [_e, ve].filter(Boolean).join(" · "), G = `${ne}-note-${String(h)}`, J = t.note !== void 0 && t.note !== null, Q = $ ? De(t.name) : t.name, we = /* @__PURE__ */ b("div", { className: "aegis-trace-tree__tooltip", children: [
208
+ /* @__PURE__ */ l(
209
+ "div",
210
+ {
211
+ className: K === "ui" ? "aegis-trace-tree__tooltip-name aegis-trace-tree__tooltip-name--ui" : "aegis-trace-tree__tooltip-name",
212
+ children: t.name
213
+ }
214
+ ),
215
+ Y && /* @__PURE__ */ l("div", { className: "aegis-trace-tree__tooltip-meta", children: Y })
208
216
  ] });
209
- return /* @__PURE__ */ b(Se, { children: [
217
+ return /* @__PURE__ */ b(ke, { children: [
210
218
  /* @__PURE__ */ b(
211
219
  "div",
212
220
  {
213
- ref: S ? z?.placeRow : void 0,
214
- className: me,
221
+ ref: S ? O?.placeRow : void 0,
222
+ className: ge,
215
223
  role: "treeitem",
216
224
  "aria-label": t.ariaLabel,
217
- "aria-describedby": G ? Y : void 0,
225
+ "aria-describedby": J ? G : void 0,
218
226
  "aria-level": e.depth + 1,
219
- "aria-posinset": n,
227
+ "aria-posinset": i,
220
228
  "aria-setsize": a,
221
229
  "aria-expanded": w ? !N : void 0,
222
230
  "aria-selected": S ? !0 : void 0,
223
- tabIndex: u === se ? 0 : -1,
231
+ tabIndex: h === oe ? 0 : -1,
224
232
  onClick: (A) => {
225
- pe(A, e);
233
+ ue(A, e);
226
234
  },
227
235
  onKeyDown: (A) => {
228
- fe(A, u);
236
+ pe(A, h);
229
237
  },
230
238
  onFocus: () => {
231
- U(t.id);
239
+ H(t.id);
232
240
  },
233
241
  children: [
234
242
  /* @__PURE__ */ b(
@@ -248,30 +256,30 @@ function Qe({
248
256
  children: w ? N ? "▸" : "▾" : null
249
257
  }
250
258
  ),
251
- /* @__PURE__ */ l(Re, { tone: Te(t.status), size: 6 }),
252
- t.kind ? /* @__PURE__ */ l(De, { tone: "ghost", className: "aegis-trace-tree__kind", children: t.kind }) : null,
259
+ /* @__PURE__ */ l(Ae, { tone: Le(t.status), size: 6 }),
260
+ t.kind ? /* @__PURE__ */ l(Re, { tone: "ghost", className: "aegis-trace-tree__kind", children: t.kind }) : null,
253
261
  /* @__PURE__ */ l(
254
- ke,
262
+ Ee,
255
263
  {
256
264
  placement: "topLeft",
257
265
  mouseEnterDelay: 0.3,
258
266
  styles: { root: { maxWidth: "var(--tooltip-max-width)" } },
259
- title: ve,
260
- children: /* @__PURE__ */ l("span", { className: "aegis-trace-tree__name", children: t.to === void 0 ? J : /* @__PURE__ */ l(
267
+ title: we,
268
+ children: /* @__PURE__ */ l("span", { className: "aegis-trace-tree__name", children: t.to === void 0 ? Q : /* @__PURE__ */ l(
261
269
  M,
262
270
  {
263
271
  to: t.to,
264
272
  className: "aegis-trace-tree__link",
265
273
  tabIndex: -1,
266
- children: J
274
+ children: Q
267
275
  }
268
276
  ) })
269
277
  }
270
278
  ),
271
- G ? /* @__PURE__ */ l(
279
+ J ? /* @__PURE__ */ l(
272
280
  "span",
273
281
  {
274
- id: Y,
282
+ id: G,
275
283
  className: "aegis-trace-tree__note",
276
284
  "aria-hidden": "true",
277
285
  children: t.note
@@ -280,7 +288,7 @@ function Qe({
280
288
  ]
281
289
  }
282
290
  ),
283
- x && /* @__PURE__ */ b(we, { children: [
291
+ x && /* @__PURE__ */ b(be, { children: [
284
292
  /* @__PURE__ */ l(
285
293
  "span",
286
294
  {
@@ -293,13 +301,13 @@ function Qe({
293
301
  {
294
302
  className: "aegis-trace-tree__bar-track",
295
303
  "aria-hidden": "true",
296
- children: F(t) && /* @__PURE__ */ l(
304
+ children: L(t) && /* @__PURE__ */ l(
297
305
  "span",
298
306
  {
299
307
  className: "aegis-trace-tree__bar",
300
308
  style: {
301
- left: `${((t.startMs - P) / O * 100).toString()}%`,
302
- width: `${Math.max(t.durationMs / O * 100, 0.5).toString()}%`
309
+ left: `${((t.startMs - B) / P * 100).toString()}%`,
310
+ width: `${Math.max(t.durationMs / P * 100, 0.5).toString()}%`
303
311
  }
304
312
  }
305
313
  )
@@ -310,7 +318,7 @@ function Qe({
310
318
  ]
311
319
  }
312
320
  ),
313
- S ? z?.inline : null
321
+ S ? O?.inline : null
314
322
  ] }, t.id);
315
323
  })
316
324
  }
@@ -318,7 +326,7 @@ function Qe({
318
326
  x && /* @__PURE__ */ l(
319
327
  "div",
320
328
  {
321
- ...ce,
329
+ ...le,
322
330
  className: "aegis-trace-tree__handle",
323
331
  "aria-label": y.resizeNameColumn
324
332
  }
@@ -326,6 +334,6 @@ function Qe({
326
334
  ] });
327
335
  }
328
336
  export {
329
- Qe as TraceTree
337
+ Ze as TraceTree
330
338
  };
331
339
  //# sourceMappingURL=TraceTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TraceTree.js","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":";;;;;;;;;;;;;;AA6IA,MAAMA,KAAe,KACfC,KAAe,KACfC,KAAmB;AAEzB,SAASC,EAAQC,GAAoC;AACnD,SAAOA,EAAK,YAAY,UAAaA,EAAK,eAAe;AAC3D;AAEA,SAASC,GAAYC,GAAqB;AACxC,EAAIA,EAAM,MAAM,CAACC,MAAMA,EAAE,KAAK,YAAY,MAAS,KACjDD,EAAM,KAAK,CAACE,GAAGC,OAAOD,EAAE,KAAK,WAAW,MAAMC,EAAE,KAAK,WAAW,EAAE;AAEtE;AAEA,SAASC,GAAYC,GAA4B;AAC/C,QAAMC,wBAAW,IAAA;AACjB,EAAAD,EAAM,QAAQ,CAACP,MAAS;AACtB,IAAAQ,EAAK,IAAIR,EAAK,IAAI,EAAE,MAAAA,GAAM,QAAQ,MAAM,UAAU,CAAA,GAAI,OAAO,EAAA,CAAG;AAAA,EAClE,CAAC;AACD,QAAMS,IAAgB,CAAA;AACtB,EAAAD,EAAK,QAAQ,CAACE,MAAS;AACrB,UAAMC,IAAMD,EAAK,KAAK,UAChBE,IAASD,IAAMH,EAAK,IAAIG,CAAG,IAAI;AACrC,IAAIC,KACFF,EAAK,SAASE,GACdA,EAAO,SAAS,KAAKF,CAAI,KAEzBD,EAAM,KAAKC,CAAI;AAAA,EAEnB,CAAC;AAED,QAAMG,wBAAa,IAAA,GACbC,IAAQ,CAACJ,GAAYK,MAAwB;AACjD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4D,IAAiB,KAAK,GAAG,EAAE,SAAA,CAAU;AAAA,4BAAA;AAAA,0BAC7E;AAAA,wBAAA;AAAA,sBACF;AAAA,oBAAA;AAAA,oBAGJ,gBAAAuC,EAAC,OAAA,EAAI,WAAU,8BACZ,UAAAnG,EAAK,eAAe,UACnB2G,EAAe3G,EAAK,UAAU,EAAA,CAClC;AAAA,kBAAA,EAAA,CACF;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,YAGHwG,IAAa/C,GAAW,SAAS;AAAA,UAAA,EAAA,GAzGrBzD,EAAK,EA0GpB;AAAA,QAEJ,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF8D,KACC,gBAAAqC;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAGhB;AAAA,QACJ,WAAU;AAAA,QACV,cAAY9B,EAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EACtB,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"TraceTree.js","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":";;;;;;;;;;;;;;AAmJA,MAAMA,KAAe,KACfC,KAAe,KACfC,KAAmB;AAEzB,SAASC,EAAQC,GAAoC;AACnD,SAAOA,EAAK,YAAY,UAAaA,EAAK,eAAe;AAC3D;AAEA,SAASC,GAAYC,GAAqB;AACxC,EAAIA,EAAM,MAAM,CAACC,MAAMA,EAAE,KAAK,YAAY,MAAS,KACjDD,EAAM,KAAK,CAACE,GAAGC,OAAOD,EAAE,KAAK,WAAW,MAAMC,EAAE,KAAK,WAAW,EAAE;AAEtE;AAEA,SAASC,GAAYC,GAA4B;AAC/C,QAAMC,wBAAW,IAAA;AACjB,EAAAD,EAAM,QAAQ,CAACP,MAAS;AACtB,IAAAQ,EAAK,IAAIR,EAAK,IAAI,EAAE,MAAAA,GAAM,QAAQ,MAAM,UAAU,CAAA,GAAI,OAAO,EAAA,CAAG;AAAA,EAClE,CAAC;AACD,QAAMS,IAAgB,CAAA;AACtB,EAAAD,EAAK,QAAQ,CAACE,MAAS;AACrB,UAAMC,IAAMD,EAAK,KAAK,UAChBE,IAASD,IAAMH,EAAK,IAAIG,CAAG,IAAI;AACrC,IAAIC,KACFF,EAAK,SAASE,GACdA,EAAO,SAAS,KAAKF,CAAI,KAEzBD,EAAM,KAAKC,CAAI;AAAA,EAEnB,CAAC;AAED,QAAMG,wBAAa,IAAA,GACbC,IAAQ,CAACJ,GAAYK,MAAwB;AACjD,IAAAF,EAAO,IAAIH,CAAI,GACfA,EAAK,QAAQK,GACbL,EAAK,SAAS,QAAQ,CAACM,MAAU;AAC/B,MAAAF,EAAME,GAAOD,IAAQ,CAAC;AAAA,IACxB,CAAC;AAAA,EACH;AACA,EAAAN,EAAM,QAAQ,CAACQ,MAAS;AACtB,IAAAH,EAAMG,GAAM,CAAC;AAAA,EACf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BAGJ,gBAAAuC,EAAC,OAAA,EAAI,WAAU,8BACZ,UAAApG,EAAK,eAAe,UACnB4G,EAAe5G,EAAK,UAAU,EAAA,CAClC;AAAA,kBAAA,EAAA,CACF;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,YAGHyG,IAAa/C,GAAW,SAAS;AAAA,UAAA,EAAA,GAzGrB1D,EAAK,EA0GpB;AAAA,QAEJ,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF+D,KACC,gBAAAqC;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAGhB;AAAA,QACJ,WAAU;AAAA,QACV,cAAY9B,EAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EACtB,GAEJ;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=({to:e,className:r,"aria-current":t,tabIndex:a,children:i})=>n.jsx("a",{href:e,className:r,"aria-current":t,tabIndex:a,children:i});exports.DefaultLink=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=({to:e,className:a,"aria-current":r,"aria-label":t,tabIndex:i,children:l})=>n.jsx("a",{href:e,className:a,"aria-current":r,"aria-label":t,tabIndex:i,children:l});exports.DefaultLink=u;
2
2
  //# sourceMappingURL=linkComponent.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"linkComponent.cjs","sources":["../../../src/components/ui/linkComponent.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from 'react';\n\n/**\n * Router link adapter for primitives that render links. Routed apps pass a\n * wrapper around their router's `<Link>`; without one the primitive renders\n * a plain `<a href>`, so primitives stay router-agnostic. Pass\n * `aria-current` and `tabIndex` on to the anchor: navigation primitives\n * mark the current page with the first, and a tree keeps the links in its\n * rows out of the tab order with the second.\n */\nexport type LinkComponent = ComponentType<{\n to: string;\n className?: string;\n 'aria-current'?: 'page';\n tabIndex?: number;\n children: ReactNode;\n}>;\n\nexport const DefaultLink: LinkComponent = ({\n to,\n className,\n 'aria-current': ariaCurrent,\n tabIndex,\n children,\n}) => (\n <a\n href={to}\n className={className}\n aria-current={ariaCurrent}\n tabIndex={tabIndex}\n >\n {children}\n </a>\n);\n"],"names":["DefaultLink","to","className","ariaCurrent","tabIndex","children","jsx"],"mappings":"qHAkBaA,EAA6B,CAAC,CACzC,GAAAC,EACA,UAAAC,EACA,eAAgBC,EAChB,SAAAC,EACA,SAAAC,CACF,IACEC,EAAAA,IAAC,IAAA,CACC,KAAML,EACN,UAAAC,EACA,eAAcC,EACd,SAAAC,EAEC,SAAAC,CAAA,CACH"}
1
+ {"version":3,"file":"linkComponent.cjs","sources":["../../../src/components/ui/linkComponent.tsx"],"sourcesContent":["import type { ComponentType, ReactNode } from 'react';\n\n/**\n * Router link adapter for primitives that render links. Routed apps pass a\n * wrapper around their router's `<Link>`; without one the primitive renders\n * a plain `<a href>`, so primitives stay router-agnostic. Pass\n * `aria-current`, `aria-label` and `tabIndex` on to the anchor: navigation\n * primitives mark the current page or item with the first, a link whose\n * text is short names itself in full with the second, and a tree keeps the\n * links in its rows out of the tab order with the third.\n */\nexport type LinkComponent = ComponentType<{\n to: string;\n className?: string;\n 'aria-current'?: 'page' | 'true';\n 'aria-label'?: string;\n tabIndex?: number;\n children: ReactNode;\n}>;\n\nexport const DefaultLink: LinkComponent = ({\n to,\n className,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n tabIndex,\n children,\n}) => (\n <a\n href={to}\n className={className}\n aria-current={ariaCurrent}\n aria-label={ariaLabel}\n tabIndex={tabIndex}\n >\n {children}\n </a>\n);\n"],"names":["DefaultLink","to","className","ariaCurrent","ariaLabel","tabIndex","children","jsx"],"mappings":"qHAoBaA,EAA6B,CAAC,CACzC,GAAAC,EACA,UAAAC,EACA,eAAgBC,EAChB,aAAcC,EACd,SAAAC,EACA,SAAAC,CACF,IACEC,EAAAA,IAAC,IAAA,CACC,KAAMN,EACN,UAAAC,EACA,eAAcC,EACd,aAAYC,EACZ,SAAAC,EAEC,SAAAC,CAAA,CACH"}