@flanksource/clicky-ui 0.3.84 → 0.3.86

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 (219) hide show
  1. package/dist/components/Combobox.cjs +8 -6
  2. package/dist/components/Combobox.cjs.map +1 -1
  3. package/dist/components/Combobox.d.ts.map +1 -1
  4. package/dist/components/Combobox.js +8 -6
  5. package/dist/components/Combobox.js.map +1 -1
  6. package/dist/components/ComboboxMenu.cjs +7 -4
  7. package/dist/components/ComboboxMenu.cjs.map +1 -1
  8. package/dist/components/ComboboxMenu.d.ts +3 -2
  9. package/dist/components/ComboboxMenu.d.ts.map +1 -1
  10. package/dist/components/ComboboxMenu.js +7 -4
  11. package/dist/components/ComboboxMenu.js.map +1 -1
  12. package/dist/components/FilterBar.cjs +64 -47
  13. package/dist/components/FilterBar.cjs.map +1 -1
  14. package/dist/components/FilterBar.d.ts +20 -2
  15. package/dist/components/FilterBar.d.ts.map +1 -1
  16. package/dist/components/FilterBar.js +63 -46
  17. package/dist/components/FilterBar.js.map +1 -1
  18. package/dist/components/TimeRange.cjs +156 -128
  19. package/dist/components/TimeRange.cjs.map +1 -1
  20. package/dist/components/TimeRange.d.ts +8 -1
  21. package/dist/components/TimeRange.d.ts.map +1 -1
  22. package/dist/components/TimeRange.js +156 -128
  23. package/dist/components/TimeRange.js.map +1 -1
  24. package/dist/components/combobox-types.d.ts +5 -0
  25. package/dist/components/combobox-types.d.ts.map +1 -1
  26. package/dist/components/filter-bar-context.cjs.map +1 -1
  27. package/dist/components/filter-bar-context.d.ts +2 -0
  28. package/dist/components/filter-bar-context.d.ts.map +1 -1
  29. package/dist/components/filter-bar-context.js.map +1 -1
  30. package/dist/components/filter-bar-field-utils.cjs +18 -4
  31. package/dist/components/filter-bar-field-utils.cjs.map +1 -1
  32. package/dist/components/filter-bar-field-utils.d.ts +3 -2
  33. package/dist/components/filter-bar-field-utils.d.ts.map +1 -1
  34. package/dist/components/filter-bar-field-utils.js +19 -5
  35. package/dist/components/filter-bar-field-utils.js.map +1 -1
  36. package/dist/components/filter-bar-menu.cjs +189 -0
  37. package/dist/components/filter-bar-menu.cjs.map +1 -0
  38. package/dist/components/filter-bar-menu.d.ts +25 -0
  39. package/dist/components/filter-bar-menu.d.ts.map +1 -0
  40. package/dist/components/filter-bar-menu.js +189 -0
  41. package/dist/components/filter-bar-menu.js.map +1 -0
  42. package/dist/components/filter-bar-multi.cjs +1 -1
  43. package/dist/components/filter-bar-multi.cjs.map +1 -1
  44. package/dist/components/filter-bar-multi.js +2 -2
  45. package/dist/components/filter-bar-multi.js.map +1 -1
  46. package/dist/components/filter-bar-popup.cjs +37 -0
  47. package/dist/components/filter-bar-popup.cjs.map +1 -0
  48. package/dist/components/filter-bar-popup.d.ts +32 -0
  49. package/dist/components/filter-bar-popup.d.ts.map +1 -0
  50. package/dist/components/filter-bar-popup.js +37 -0
  51. package/dist/components/filter-bar-popup.js.map +1 -0
  52. package/dist/components/filter-bar-tree.cjs +1 -1
  53. package/dist/components/filter-bar-tree.cjs.map +1 -1
  54. package/dist/components/filter-bar-tree.js +2 -2
  55. package/dist/components/filter-bar-tree.js.map +1 -1
  56. package/dist/components/json-schema-form-table-array.cjs +5 -3
  57. package/dist/components/json-schema-form-table-array.cjs.map +1 -1
  58. package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
  59. package/dist/components/json-schema-form-table-array.js +5 -3
  60. package/dist/components/json-schema-form-table-array.js.map +1 -1
  61. package/dist/components.cjs +1 -1
  62. package/dist/components.js +1 -1
  63. package/dist/connections/ConnectionPicker.cjs +6 -2
  64. package/dist/connections/ConnectionPicker.cjs.map +1 -1
  65. package/dist/connections/ConnectionPicker.d.ts.map +1 -1
  66. package/dist/connections/ConnectionPicker.js +6 -2
  67. package/dist/connections/ConnectionPicker.js.map +1 -1
  68. package/dist/connections/CreateConnectionDialog.cjs +8 -21
  69. package/dist/connections/CreateConnectionDialog.cjs.map +1 -1
  70. package/dist/connections/CreateConnectionDialog.d.ts +2 -1
  71. package/dist/connections/CreateConnectionDialog.d.ts.map +1 -1
  72. package/dist/connections/CreateConnectionDialog.js +8 -21
  73. package/dist/connections/CreateConnectionDialog.js.map +1 -1
  74. package/dist/data/ExpandableMarkdown.cjs +59 -0
  75. package/dist/data/ExpandableMarkdown.cjs.map +1 -0
  76. package/dist/data/ExpandableMarkdown.d.ts +17 -0
  77. package/dist/data/ExpandableMarkdown.d.ts.map +1 -0
  78. package/dist/data/ExpandableMarkdown.js +59 -0
  79. package/dist/data/ExpandableMarkdown.js.map +1 -0
  80. package/dist/data/MultiGaugeBar.cjs +49 -21
  81. package/dist/data/MultiGaugeBar.cjs.map +1 -1
  82. package/dist/data/MultiGaugeBar.d.ts +5 -2
  83. package/dist/data/MultiGaugeBar.d.ts.map +1 -1
  84. package/dist/data/MultiGaugeBar.js +49 -21
  85. package/dist/data/MultiGaugeBar.js.map +1 -1
  86. package/dist/data/flow-node/BoxNode.cjs +45 -0
  87. package/dist/data/flow-node/BoxNode.cjs.map +1 -0
  88. package/dist/data/flow-node/BoxNode.d.ts +28 -0
  89. package/dist/data/flow-node/BoxNode.d.ts.map +1 -0
  90. package/dist/data/flow-node/BoxNode.js +45 -0
  91. package/dist/data/flow-node/BoxNode.js.map +1 -0
  92. package/dist/data/flow-node/FlowMetrics.cjs +208 -0
  93. package/dist/data/flow-node/FlowMetrics.cjs.map +1 -0
  94. package/dist/data/flow-node/FlowMetrics.d.ts +60 -0
  95. package/dist/data/flow-node/FlowMetrics.d.ts.map +1 -0
  96. package/dist/data/flow-node/FlowMetrics.js +206 -0
  97. package/dist/data/flow-node/FlowMetrics.js.map +1 -0
  98. package/dist/data/flow-node/WorkloadNode.cjs +63 -0
  99. package/dist/data/flow-node/WorkloadNode.cjs.map +1 -0
  100. package/dist/data/flow-node/WorkloadNode.d.ts +42 -0
  101. package/dist/data/flow-node/WorkloadNode.d.ts.map +1 -0
  102. package/dist/data/flow-node/WorkloadNode.js +63 -0
  103. package/dist/data/flow-node/WorkloadNode.js.map +1 -0
  104. package/dist/data/flow-node/index.d.ts +5 -0
  105. package/dist/data/flow-node/index.d.ts.map +1 -0
  106. package/dist/data/flow-node/latency.cjs +37 -0
  107. package/dist/data/flow-node/latency.cjs.map +1 -0
  108. package/dist/data/flow-node/latency.d.ts +13 -0
  109. package/dist/data/flow-node/latency.d.ts.map +1 -0
  110. package/dist/data/flow-node/latency.js +35 -0
  111. package/dist/data/flow-node/latency.js.map +1 -0
  112. package/dist/data/traces/index.d.ts +1 -0
  113. package/dist/data/traces/index.d.ts.map +1 -1
  114. package/dist/data/traces/otel/OtelTraceDetail.cjs +4 -7
  115. package/dist/data/traces/otel/OtelTraceDetail.cjs.map +1 -1
  116. package/dist/data/traces/otel/OtelTraceDetail.js +4 -7
  117. package/dist/data/traces/otel/OtelTraceDetail.js.map +1 -1
  118. package/dist/data/traces/otel/OtelTraceSearch.cjs +90 -56
  119. package/dist/data/traces/otel/OtelTraceSearch.cjs.map +1 -1
  120. package/dist/data/traces/otel/OtelTraceSearch.d.ts.map +1 -1
  121. package/dist/data/traces/otel/OtelTraceSearch.js +91 -57
  122. package/dist/data/traces/otel/OtelTraceSearch.js.map +1 -1
  123. package/dist/data/traces/otel/QueryBar.cjs +83 -10
  124. package/dist/data/traces/otel/QueryBar.cjs.map +1 -1
  125. package/dist/data/traces/otel/QueryBar.d.ts.map +1 -1
  126. package/dist/data/traces/otel/QueryBar.js +83 -10
  127. package/dist/data/traces/otel/QueryBar.js.map +1 -1
  128. package/dist/data/traces/otel/TraceResults.cjs +81 -13
  129. package/dist/data/traces/otel/TraceResults.cjs.map +1 -1
  130. package/dist/data/traces/otel/TraceResults.d.ts +11 -3
  131. package/dist/data/traces/otel/TraceResults.d.ts.map +1 -1
  132. package/dist/data/traces/otel/TraceResults.js +81 -13
  133. package/dist/data/traces/otel/TraceResults.js.map +1 -1
  134. package/dist/data/traces/otel/api.cjs.map +1 -1
  135. package/dist/data/traces/otel/api.d.ts +14 -0
  136. package/dist/data/traces/otel/api.d.ts.map +1 -1
  137. package/dist/data/traces/otel/api.js.map +1 -1
  138. package/dist/data/traces/otel/query.cjs +2 -2
  139. package/dist/data/traces/otel/query.cjs.map +1 -1
  140. package/dist/data/traces/otel/query.d.ts +1 -1
  141. package/dist/data/traces/otel/query.d.ts.map +1 -1
  142. package/dist/data/traces/otel/query.js +2 -2
  143. package/dist/data/traces/otel/query.js.map +1 -1
  144. package/dist/data/version-info.cjs +3 -3
  145. package/dist/data/version-info.cjs.map +1 -1
  146. package/dist/data/version-info.js +3 -3
  147. package/dist/data/version-info.js.map +1 -1
  148. package/dist/data/workload-panel/MemoryStack.cjs +38 -1
  149. package/dist/data/workload-panel/MemoryStack.cjs.map +1 -1
  150. package/dist/data/workload-panel/MemoryStack.d.ts.map +1 -1
  151. package/dist/data/workload-panel/MemoryStack.js +38 -1
  152. package/dist/data/workload-panel/MemoryStack.js.map +1 -1
  153. package/dist/data.cjs +18 -1
  154. package/dist/data.d.ts +2 -0
  155. package/dist/data.d.ts.map +1 -1
  156. package/dist/data.js +8 -2
  157. package/dist/file-findings/AnnotatedCode.cjs +18 -2
  158. package/dist/file-findings/AnnotatedCode.cjs.map +1 -1
  159. package/dist/file-findings/AnnotatedCode.d.ts +2 -0
  160. package/dist/file-findings/AnnotatedCode.d.ts.map +1 -1
  161. package/dist/file-findings/AnnotatedCode.js +18 -2
  162. package/dist/file-findings/AnnotatedCode.js.map +1 -1
  163. package/dist/file-findings/FileFindingsView.cjs.map +1 -1
  164. package/dist/file-findings/FileFindingsView.d.ts +2 -0
  165. package/dist/file-findings/FileFindingsView.d.ts.map +1 -1
  166. package/dist/file-findings/FileFindingsView.js.map +1 -1
  167. package/dist/file-findings/file-review/FileReview.cjs +2 -1
  168. package/dist/file-findings/file-review/FileReview.cjs.map +1 -1
  169. package/dist/file-findings/file-review/FileReview.d.ts +3 -1
  170. package/dist/file-findings/file-review/FileReview.d.ts.map +1 -1
  171. package/dist/file-findings/file-review/FileReview.js +2 -1
  172. package/dist/file-findings/file-review/FileReview.js.map +1 -1
  173. package/dist/index.cjs +18 -1
  174. package/dist/index.js +8 -2
  175. package/dist/profiles/editor/profileEditor.cjs +29 -30
  176. package/dist/profiles/editor/profileEditor.cjs.map +1 -1
  177. package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
  178. package/dist/profiles/editor/profileEditor.js +29 -30
  179. package/dist/profiles/editor/profileEditor.js.map +1 -1
  180. package/dist/profiles/editor/profileEditorPreview.cjs +44 -43
  181. package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
  182. package/dist/profiles/editor/profileEditorPreview.d.ts +10 -5
  183. package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
  184. package/dist/profiles/editor/profileEditorPreview.js +44 -43
  185. package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
  186. package/dist/profiles/editor/profileMappingPreview.cjs +153 -48
  187. package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
  188. package/dist/profiles/editor/profileMappingPreview.d.ts +16 -2
  189. package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
  190. package/dist/profiles/editor/profileMappingPreview.js +155 -50
  191. package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
  192. package/dist/profiles/editor/sampleError.cjs +29 -0
  193. package/dist/profiles/editor/sampleError.cjs.map +1 -0
  194. package/dist/profiles/editor/sampleError.d.ts +16 -0
  195. package/dist/profiles/editor/sampleError.d.ts.map +1 -0
  196. package/dist/profiles/editor/sampleError.js +27 -0
  197. package/dist/profiles/editor/sampleError.js.map +1 -0
  198. package/dist/profiles/query/profileSampleResult.cjs.map +1 -1
  199. package/dist/profiles/query/profileSampleResult.d.ts +2 -0
  200. package/dist/profiles/query/profileSampleResult.d.ts.map +1 -1
  201. package/dist/profiles/query/profileSampleResult.js.map +1 -1
  202. package/dist/profiles/wizard/profileWizardQueryStep.cjs +1 -0
  203. package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
  204. package/dist/profiles/wizard/profileWizardQueryStep.d.ts +2 -0
  205. package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
  206. package/dist/profiles/wizard/profileWizardQueryStep.js +1 -0
  207. package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
  208. package/dist/react-grab/core/index.js +1 -1
  209. package/dist/react-grab/{core-BERtFDWh.js → core-BK5CU6Lb.js} +2 -2
  210. package/dist/react-grab/index.js +1 -1
  211. package/dist/react-grab/{renderer-KT3FY3K2.js → renderer-DcHrsQ8k.js} +1 -1
  212. package/dist/rpc/apiClient.cjs +12 -15
  213. package/dist/rpc/apiClient.cjs.map +1 -1
  214. package/dist/rpc/apiClient.js +12 -15
  215. package/dist/rpc/apiClient.js.map +1 -1
  216. package/dist/runtime/barrels.json +6481 -6441
  217. package/dist/runtime/importmap.json +2198 -2190
  218. package/dist/styles.css +1 -1
  219. package/package.json +1 -1
@@ -0,0 +1,206 @@
1
+ import { cn } from "../../lib/utils.js";
2
+ import { UiArrowDown } from "../../icons/components/UiArrowDown.js";
3
+ import { UiArrowUp } from "../../icons/components/UiArrowUp.js";
4
+ import { UiPulse } from "../../icons/components/UiPulse.js";
5
+ import { UiSkull } from "../../icons/components/UiSkull.js";
6
+ import { UiStack } from "../../icons/components/UiStack.js";
7
+ import { UiTimer } from "../../icons/components/UiTimer.js";
8
+ import { UiWarningCircle } from "../../icons/components/UiWarningCircle.js";
9
+ import { formatMs, latencyScaleMax } from "./latency.js";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ // src/data/flow-node/FlowMetrics.tsx
12
+ var ICON_CLASS = "h-2.5 w-2.5 shrink-0";
13
+ /** A metric's name in muted lowercase, before its value. */
14
+ function MetricLabel({ children }) {
15
+ return /* @__PURE__ */ jsx("span", {
16
+ className: "text-muted-foreground",
17
+ "data-red-label": true,
18
+ children
19
+ });
20
+ }
21
+ var DIRECTION_ICON = {
22
+ consume: UiArrowDown,
23
+ produce: UiArrowUp
24
+ };
25
+ var linearPct = (ms, scaleMax) => `${Math.min(ms / scaleMax, 1) * 100}%`;
26
+ /**
27
+ * Duration: the average, then a bar from 0 to the smallest of 100ms, 1s, 10s, 1m, 10m, 1h, 8h, 1d that holds the
28
+ * average, filled linearly to it, with ticks at p95 (foreground) and max (muted). A tick past the end pins to it and is
29
+ * marked `data-latency-overflow`. Its min-width of 100% wraps it onto its own line in a wrapping row.
30
+ */
31
+ function LatencyBar({ latency }) {
32
+ const { avg, p95, max } = latency;
33
+ if (!(avg <= p95 && p95 <= max)) throw new Error(`LatencyBar needs avg <= p95 <= max (got ${avg}, ${p95}, ${max})`);
34
+ const scaleMax = latencyScaleMax(avg);
35
+ const ticks = [{
36
+ key: "p95",
37
+ ms: p95,
38
+ className: "bg-foreground"
39
+ }, {
40
+ key: "max",
41
+ ms: max,
42
+ className: "bg-muted-foreground"
43
+ }];
44
+ return /* @__PURE__ */ jsxs("span", {
45
+ className: "inline-flex items-center gap-1",
46
+ style: { minWidth: "100%" },
47
+ "data-latency": true,
48
+ title: `avg ${formatMs(avg)} · p95 ${formatMs(p95)} · max ${formatMs(max)} (scale 0–${formatMs(scaleMax)})`,
49
+ children: [
50
+ /* @__PURE__ */ jsx(UiTimer, {
51
+ className: cn(ICON_CLASS, "text-muted-foreground"),
52
+ "aria-label": "duration"
53
+ }),
54
+ /* @__PURE__ */ jsx("span", { children: formatMs(avg) }),
55
+ /* @__PURE__ */ jsxs("span", {
56
+ className: "relative h-1.5 min-w-12 flex-1 rounded-full bg-muted",
57
+ children: [/* @__PURE__ */ jsx("span", {
58
+ className: "absolute inset-y-0 left-0 rounded-full bg-muted-foreground/60",
59
+ style: { width: linearPct(avg, scaleMax) },
60
+ "data-latency-fill": true
61
+ }), ticks.map(({ key, ms, className }) => /* @__PURE__ */ jsx("span", {
62
+ className: cn("absolute -inset-y-0.5 w-px", className),
63
+ style: { left: linearPct(ms, scaleMax) },
64
+ "data-latency-tick": key,
65
+ "data-latency-overflow": ms > scaleMax || void 0
66
+ }, key))]
67
+ }),
68
+ /* @__PURE__ */ jsx("span", {
69
+ className: "font-mono text-[8px] text-muted-foreground",
70
+ "data-latency-scale-max": true,
71
+ children: formatMs(scaleMax)
72
+ })
73
+ ]
74
+ });
75
+ }
76
+ /**
77
+ * A RED row: requests, error rate and duration (when measured), each led by an icon. A `direction` arrow replaces the pulse icon and
78
+ * the label; otherwise a `label` sits above the values. A breached error rate turns red; the errors metric is hidden
79
+ * when both the rate and the error codes are empty.
80
+ */
81
+ function RedLine({ metrics }) {
82
+ const { requests, per = "/min", duration, direction, label, labelled = false } = metrics;
83
+ const RequestsIcon = direction ? DIRECTION_ICON[direction] : UiPulse;
84
+ const requestsLabel = direction ? `${label ?? direction} rate` : "requests";
85
+ return /* @__PURE__ */ jsxs("div", {
86
+ className: "flex flex-col leading-tight",
87
+ "data-red-line": true,
88
+ children: [!direction && label && /* @__PURE__ */ jsx("span", {
89
+ className: "truncate font-mono text-[8px] text-muted-foreground",
90
+ children: label
91
+ }), /* @__PURE__ */ jsxs("span", {
92
+ className: "flex flex-wrap items-center gap-x-1.5 gap-y-0.5 whitespace-nowrap text-[9.5px] tabular-nums",
93
+ children: [
94
+ /* @__PURE__ */ jsxs("span", {
95
+ className: "inline-flex items-center gap-0.5",
96
+ title: requestsLabel,
97
+ "data-red": "requests",
98
+ children: [
99
+ /* @__PURE__ */ jsx(RequestsIcon, {
100
+ className: cn(ICON_CLASS, "text-muted-foreground"),
101
+ "aria-label": requestsLabel
102
+ }),
103
+ labelled && /* @__PURE__ */ jsx(MetricLabel, { children: "req" }),
104
+ requests.toLocaleString("en-US"),
105
+ per
106
+ ]
107
+ }),
108
+ /* @__PURE__ */ jsx(RedErrors, { metrics }),
109
+ duration && /* @__PURE__ */ jsx(LatencyBar, { latency: duration })
110
+ ]
111
+ })]
112
+ });
113
+ }
114
+ function RedErrors({ metrics }) {
115
+ const { errorRate, errorBreach = false, errorCodes = [], labelled = false } = metrics;
116
+ if (!Number.isFinite(errorRate) || errorRate < 0) throw new Error(`RedLine errorRate must be a percentage >= 0, got ${errorRate}`);
117
+ if (errorRate === 0 && errorCodes.length === 0) return null;
118
+ return /* @__PURE__ */ jsxs("span", {
119
+ className: cn("inline-flex items-center gap-0.5", errorBreach && "text-destructive"),
120
+ title: "error rate",
121
+ "data-red": "errors",
122
+ "data-breach": errorBreach || void 0,
123
+ children: [
124
+ /* @__PURE__ */ jsx(UiWarningCircle, {
125
+ className: cn(ICON_CLASS, errorBreach ? "text-destructive" : "text-muted-foreground"),
126
+ "aria-label": "error rate"
127
+ }),
128
+ labelled && /* @__PURE__ */ jsx(MetricLabel, { children: "errors" }),
129
+ errorRate !== 0 && `${errorRate.toFixed(1)}%`,
130
+ errorCodes.map(({ status, count }) => /* @__PURE__ */ jsxs("span", {
131
+ className: "font-mono",
132
+ title: `${count} × ${status}`,
133
+ "data-red-error-code": status,
134
+ children: [status, /* @__PURE__ */ jsxs("span", {
135
+ className: "text-muted-foreground",
136
+ children: ["×", count]
137
+ })]
138
+ }, status))
139
+ ]
140
+ });
141
+ }
142
+ var QUEUE_FIELDS = [
143
+ {
144
+ key: "size",
145
+ title: "depth",
146
+ Icon: UiStack,
147
+ rate: false,
148
+ labelled: false
149
+ },
150
+ {
151
+ key: "enqueued",
152
+ title: "enqueued",
153
+ Icon: UiArrowUp,
154
+ rate: true,
155
+ labelled: true
156
+ },
157
+ {
158
+ key: "dequeued",
159
+ title: "dequeued",
160
+ Icon: UiArrowDown,
161
+ rate: true,
162
+ labelled: true
163
+ },
164
+ {
165
+ key: "dlq",
166
+ title: "dead letter",
167
+ Icon: UiSkull,
168
+ rate: false,
169
+ labelled: false
170
+ }
171
+ ];
172
+ /**
173
+ * A queue row: depth (a stack), enqueued (up), dequeued (down) and dead letters (a skull, red with its count: a dead
174
+ * letter is always a breach). Missing or zero counters are not drawn; renders nothing when all are empty.
175
+ */
176
+ function QueueStats({ counts }) {
177
+ const per = counts.per ?? "/min";
178
+ const shown = QUEUE_FIELDS.map((field) => ({
179
+ ...field,
180
+ value: counts[field.key] ?? 0
181
+ })).filter(({ value }) => value !== 0);
182
+ if (shown.length === 0) return null;
183
+ return /* @__PURE__ */ jsx("span", {
184
+ className: "flex flex-wrap gap-x-2 gap-y-0.5 whitespace-nowrap text-[9.5px] tabular-nums",
185
+ "data-queue-stats": true,
186
+ children: shown.map(({ key, title, Icon, rate, labelled, value }) => {
187
+ const text = `${value.toLocaleString("en-US")}${rate ? per : ""}`;
188
+ return /* @__PURE__ */ jsxs("span", {
189
+ className: cn("inline-flex items-center gap-0.5", key === "dlq" && "text-destructive"),
190
+ "data-queue-stat": key,
191
+ title: `${title} ${text}`,
192
+ children: [
193
+ /* @__PURE__ */ jsx(Icon, {
194
+ className: cn(ICON_CLASS, key === "dlq" ? "text-destructive" : "text-muted-foreground"),
195
+ "aria-label": title
196
+ }),
197
+ counts.labelled && labelled && /* @__PURE__ */ jsx(MetricLabel, { children: title }),
198
+ text
199
+ ]
200
+ }, key);
201
+ })
202
+ });
203
+ }
204
+ export { LatencyBar, QueueStats, RedLine };
205
+
206
+ //# sourceMappingURL=FlowMetrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowMetrics.js","names":[],"sources":["../../../src/data/flow-node/FlowMetrics.tsx"],"sourcesContent":["import { cn } from \"../../lib/utils\";\nimport { UiArrowDown, UiArrowUp, UiPulse, UiSkull, UiStack, UiTimer, UiWarningCircle } from \"../../icons\";\nimport { formatMs, latencyScaleMax, type Latency } from \"./latency\";\n\n/** Rate, Errors and Duration for one role a workload plays in a flow. */\nexport interface RedMetrics {\n /** Requests per `per`. */\n requests: number;\n /** Rate unit after the request count; defaults to \"/min\". */\n per?: string;\n /** Error rate in percent; a zero rate is not drawn. */\n errorRate: number;\n /** Marks the error rate as breaching its budget: it turns red, icon included. */\n errorBreach?: boolean;\n /** Omitted when the role has no measured duration: the row then draws requests and errors only. */\n duration?: Latency;\n /** The flow direction this role handles: its arrow (↓ consume, ↑ produce) leads the rate instead of the pulse icon. */\n direction?: \"consume\" | \"produce\";\n /** Names the role. Shown above the values, or as the rate's tooltip when `direction` is set. */\n label?: string;\n /** The errors by status code (e.g. HTTP 401 ×2), drawn in the errors metric after the rate. */\n errorCodes?: ReadonlyArray<{ status: string; count: number }>;\n /** Names requests and errors in muted lowercase (\"req\", \"errors\") before their values. */\n labelled?: boolean;\n}\n\n/** Broker counters for one queue. Enqueued and dequeued are rates per `per`; size and dlq are message counts. */\nexport interface QueueCounts {\n size?: number;\n enqueued?: number;\n dequeued?: number;\n dlq?: number;\n /** Rate unit after enqueued and dequeued; defaults to \"/min\". */\n per?: string;\n /** Names enqueued and dequeued in muted lowercase before their values. */\n labelled?: boolean;\n}\n\nconst ICON_CLASS = \"h-2.5 w-2.5 shrink-0\";\n\n/** A metric's name in muted lowercase, before its value. */\nfunction MetricLabel({ children }: { children: string }) {\n return <span className=\"text-muted-foreground\" data-red-label>{children}</span>;\n}\nconst DIRECTION_ICON = { consume: UiArrowDown, produce: UiArrowUp } as const;\n\nconst linearPct = (ms: number, scaleMax: number) => `${Math.min(ms / scaleMax, 1) * 100}%`;\n\n/**\n * Duration: the average, then a bar from 0 to the smallest of 100ms, 1s, 10s, 1m, 10m, 1h, 8h, 1d that holds the\n * average, filled linearly to it, with ticks at p95 (foreground) and max (muted). A tick past the end pins to it and is\n * marked `data-latency-overflow`. Its min-width of 100% wraps it onto its own line in a wrapping row.\n */\nexport function LatencyBar({ latency }: { latency: Latency }) {\n const { avg, p95, max } = latency;\n if (!(avg <= p95 && p95 <= max)) throw new Error(`LatencyBar needs avg <= p95 <= max (got ${avg}, ${p95}, ${max})`);\n const scaleMax = latencyScaleMax(avg);\n const ticks = [{ key: \"p95\", ms: p95, className: \"bg-foreground\" }, { key: \"max\", ms: max, className: \"bg-muted-foreground\" }] as const;\n return (\n <span className=\"inline-flex items-center gap-1\" style={{ minWidth: \"100%\" }} data-latency\n title={`avg ${formatMs(avg)} · p95 ${formatMs(p95)} · max ${formatMs(max)} (scale 0–${formatMs(scaleMax)})`}>\n <UiTimer className={cn(ICON_CLASS, \"text-muted-foreground\")} aria-label=\"duration\" />\n <span>{formatMs(avg)}</span>\n <span className=\"relative h-1.5 min-w-12 flex-1 rounded-full bg-muted\">\n <span className=\"absolute inset-y-0 left-0 rounded-full bg-muted-foreground/60\" style={{ width: linearPct(avg, scaleMax) }} data-latency-fill />\n {ticks.map(({ key, ms, className }) => (\n <span key={key} className={cn(\"absolute -inset-y-0.5 w-px\", className)} style={{ left: linearPct(ms, scaleMax) }}\n data-latency-tick={key} data-latency-overflow={ms > scaleMax || undefined} />\n ))}\n </span>\n <span className=\"font-mono text-[8px] text-muted-foreground\" data-latency-scale-max>{formatMs(scaleMax)}</span>\n </span>\n );\n}\n\n/**\n * A RED row: requests, error rate and duration (when measured), each led by an icon. A `direction` arrow replaces the pulse icon and\n * the label; otherwise a `label` sits above the values. A breached error rate turns red; the errors metric is hidden\n * when both the rate and the error codes are empty.\n */\nexport function RedLine({ metrics }: { metrics: RedMetrics }) {\n const { requests, per = \"/min\", duration, direction, label, labelled = false } = metrics;\n const RequestsIcon = direction ? DIRECTION_ICON[direction] : UiPulse;\n const requestsLabel = direction ? `${label ?? direction} rate` : \"requests\";\n return (\n <div className=\"flex flex-col leading-tight\" data-red-line>\n {!direction && label && <span className=\"truncate font-mono text-[8px] text-muted-foreground\">{label}</span>}\n <span className=\"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 whitespace-nowrap text-[9.5px] tabular-nums\">\n <span className=\"inline-flex items-center gap-0.5\" title={requestsLabel} data-red=\"requests\">\n <RequestsIcon className={cn(ICON_CLASS, \"text-muted-foreground\")} aria-label={requestsLabel} />\n {labelled && <MetricLabel>req</MetricLabel>}\n {requests.toLocaleString(\"en-US\")}{per}\n </span>\n <RedErrors metrics={metrics} />\n {duration && <LatencyBar latency={duration} />}\n </span>\n </div>\n );\n}\n\nfunction RedErrors({ metrics }: { metrics: RedMetrics }) {\n const { errorRate, errorBreach = false, errorCodes = [], labelled = false } = metrics;\n if (!Number.isFinite(errorRate) || errorRate < 0) throw new Error(`RedLine errorRate must be a percentage >= 0, got ${errorRate}`);\n if (errorRate === 0 && errorCodes.length === 0) return null;\n return (\n <span className={cn(\"inline-flex items-center gap-0.5\", errorBreach && \"text-destructive\")} title=\"error rate\" data-red=\"errors\" data-breach={errorBreach || undefined}>\n <UiWarningCircle className={cn(ICON_CLASS, errorBreach ? \"text-destructive\" : \"text-muted-foreground\")} aria-label=\"error rate\" />\n {labelled && <MetricLabel>errors</MetricLabel>}\n {errorRate !== 0 && `${errorRate.toFixed(1)}%`}\n {errorCodes.map(({ status, count }) => (\n <span key={status} className=\"font-mono\" title={`${count} × ${status}`} data-red-error-code={status}>{status}<span className=\"text-muted-foreground\">×{count}</span></span>\n ))}\n </span>\n );\n}\n\nconst QUEUE_FIELDS = [\n { key: \"size\", title: \"depth\", Icon: UiStack, rate: false, labelled: false },\n { key: \"enqueued\", title: \"enqueued\", Icon: UiArrowUp, rate: true, labelled: true },\n { key: \"dequeued\", title: \"dequeued\", Icon: UiArrowDown, rate: true, labelled: true },\n { key: \"dlq\", title: \"dead letter\", Icon: UiSkull, rate: false, labelled: false },\n] as const;\n\n/**\n * A queue row: depth (a stack), enqueued (up), dequeued (down) and dead letters (a skull, red with its count: a dead\n * letter is always a breach). Missing or zero counters are not drawn; renders nothing when all are empty.\n */\nexport function QueueStats({ counts }: { counts: QueueCounts }) {\n const per = counts.per ?? \"/min\";\n const shown = QUEUE_FIELDS.map((field) => ({ ...field, value: counts[field.key] ?? 0 })).filter(({ value }) => value !== 0);\n if (shown.length === 0) return null;\n return (\n <span className=\"flex flex-wrap gap-x-2 gap-y-0.5 whitespace-nowrap text-[9.5px] tabular-nums\" data-queue-stats>\n {shown.map(({ key, title, Icon, rate, labelled, value }) => {\n const text = `${value.toLocaleString(\"en-US\")}${rate ? per : \"\"}`;\n return (\n <span key={key} className={cn(\"inline-flex items-center gap-0.5\", key === \"dlq\" && \"text-destructive\")} data-queue-stat={key} title={`${title} ${text}`}>\n <Icon className={cn(ICON_CLASS, key === \"dlq\" ? \"text-destructive\" : \"text-muted-foreground\")} aria-label={title} />\n {counts.labelled && labelled && <MetricLabel>{title}</MetricLabel>}\n {text}\n </span>\n );\n })}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;AAsCA,IAAM,aAAa;;AAGnB,SAAS,YAAY,EAAE,YAAkC;CACvD,OAAO,oBAAC,QAAD;EAAM,WAAU;EAAwB,kBAAA;EAAgB;CAAe,CAAA;AAChF;AACA,IAAM,iBAAiB;CAAE,SAAS;CAAa,SAAS;AAAU;AAElE,IAAM,aAAa,IAAY,aAAqB,GAAG,KAAK,IAAI,KAAK,UAAU,CAAC,IAAI,IAAI;;;;;;AAOxF,SAAgB,WAAW,EAAE,WAAiC;CAC5D,MAAM,EAAE,KAAK,KAAK,QAAQ;CAC1B,IAAI,EAAE,OAAO,OAAO,OAAO,MAAM,MAAM,IAAI,MAAM,2CAA2C,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;CAClH,MAAM,WAAW,gBAAgB,GAAG;CACpC,MAAM,QAAQ,CAAC;EAAE,KAAK;EAAO,IAAI;EAAK,WAAW;CAAgB,GAAG;EAAE,KAAK;EAAO,IAAI;EAAK,WAAW;CAAsB,CAAC;CAC7H,OACE,qBAAC,QAAD;EAAM,WAAU;EAAiC,OAAO,EAAE,UAAU,OAAO;EAAG,gBAAA;EAC5E,OAAO,OAAO,SAAS,GAAG,EAAE,SAAS,SAAS,GAAG,EAAE,SAAS,SAAS,GAAG,EAAE,YAAY,SAAS,QAAQ,EAAE;EAD3G,UAAA;GAEE,oBAAC,SAAD;IAAS,WAAW,GAAG,YAAY,uBAAuB;IAAG,cAAW;GAAY,CAAA;GACpF,oBAAC,QAAD,EAAA,UAAO,SAAS,GAAG,EAAQ,CAAA;GAC3B,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,QAAD;KAAM,WAAU;KAAgE,OAAO,EAAE,OAAO,UAAU,KAAK,QAAQ,EAA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;EAAM,WAAU;EAA+E,oBAAA;EAC5F,UAAA,MAAM,KAAK,EAAE,KAAK,OAAO,MAAM,MAAM,UAAU,YAAY;GAC1D,MAAM,OAAO,GAAG,MAAM,eAAe,OAAO,IAAI,OAAO,MAAM;GAC7D,OACE,qBAAC,QAAD;IAAgB,WAAW,GAAG,oCAAoC,QAAQ,SAAS,kBAAkB;IAAG,mBAAiB;IAAK,OAAO,GAAG,MAAM,GAAG;IAAjJ,UAAA;KACE,oBAAC,MAAD;MAAM,WAAW,GAAG,YAAY,QAAQ,QAAQ,qBAAqB,uBAAuB;MAAG,cAAY;KAAQ,CAAA;KAClH,OAAO,YAAY,YAAY,oBAAC,aAAD,EAAA,UAAc,MAAmB,CAAA;KAChE;IACG;GAJK,GAAA,GAIL;EAEV,CAAC;CACG,CAAA;AAEV"}
@@ -0,0 +1,63 @@
1
+ const require_utils = require("../../lib/utils.cjs");
2
+ const require_BoxNode = require("./BoxNode.cjs");
3
+ const require_FlowMetrics = require("./FlowMetrics.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ // src/data/flow-node/WorkloadNode.tsx
6
+ function WorkloadBox({ part, join, color }) {
7
+ const { id, name, subtitle, icon, dashed, metrics, body } = part;
8
+ const hasMetrics = metrics?.queue != null || metrics?.red != null || body != null;
9
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BoxNode.BoxNode, {
10
+ className: "w-full",
11
+ title: name,
12
+ ...id !== void 0 ? { id } : {},
13
+ ...subtitle !== void 0 ? { subtitle } : {},
14
+ ...icon !== void 0 ? { icon } : {},
15
+ ...color !== void 0 ? { style: { borderLeftColor: color } } : {},
16
+ ...dashed !== void 0 ? { dashed } : {},
17
+ ...join !== void 0 ? { join } : {},
18
+ children: hasMetrics ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
19
+ metrics?.queue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FlowMetrics.QueueStats, { counts: metrics.queue }),
20
+ metrics?.red && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FlowMetrics.RedLine, { metrics: metrics.red }),
21
+ body
22
+ ] }) : null
23
+ });
24
+ }
25
+ /**
26
+ * A workload as a diagram box: its icon, name, colour stripe and metrics, with its parts (`children`) joined
27
+ * underneath as boxes of their own, so each part can carry its own metrics and arrows.
28
+ */
29
+ function WorkloadNode({ workload, hangChildren = false, className, style }) {
30
+ const parts = workload.children ?? [];
31
+ const names = /* @__PURE__ */ new Map();
32
+ const childBoxes = parts.map((part, index) => {
33
+ const nameCount = part.id === void 0 ? (names.get(part.name) ?? 0) + 1 : 0;
34
+ if (nameCount) names.set(part.name, nameCount);
35
+ const key = part.id === void 0 ? JSON.stringify([
36
+ "name",
37
+ part.name,
38
+ nameCount
39
+ ]) : JSON.stringify(["id", part.id]);
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkloadBox, {
41
+ part,
42
+ join: index === parts.length - 1 ? "top" : "both",
43
+ color: part.color ?? workload.color
44
+ }, key);
45
+ });
46
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
47
+ className: require_utils.cn("relative flex flex-col", className),
48
+ style,
49
+ "data-workload-node": "",
50
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(WorkloadBox, {
51
+ part: workload,
52
+ join: parts.length > 0 ? "bottom" : void 0,
53
+ color: workload.color
54
+ }), parts.length > 0 && (hangChildren ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
55
+ className: "absolute left-0 top-full flex w-full flex-col",
56
+ "data-workload-node-hang": "",
57
+ children: childBoxes
58
+ }) : childBoxes)]
59
+ });
60
+ }
61
+ exports.WorkloadNode = WorkloadNode;
62
+
63
+ //# sourceMappingURL=WorkloadNode.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkloadNode.cjs","names":["BoxNode","_Fragment","QueueStats","RedLine","cn"],"sources":["../../../src/data/flow-node/WorkloadNode.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { BoxNode, type BoxNodeJoin } from \"./BoxNode\";\nimport { QueueStats, RedLine, type QueueCounts, type RedMetrics } from \"./FlowMetrics\";\n\n/** What a workload box shows under its title: queue counters, then RED metrics. */\nexport interface WorkloadNodeMetrics {\n queue?: QueueCounts;\n red?: RedMetrics;\n}\n\n/** One box of a workload: the workload itself, or one of its parts (an endpoint, a port, a listener). */\nexport interface WorkloadNodePart {\n /** The box element's id, for arrows that attach by id. */\n id?: string;\n name: string;\n subtitle?: string;\n /** A product logo or kind icon, sized by the caller. */\n icon?: ReactNode;\n /** The left stripe's colour; a part without one takes its workload's, so the stripe runs unbroken down the stack. */\n color?: string;\n dashed?: boolean;\n metrics?: WorkloadNodeMetrics;\n /** Rows of the box's own, drawn after its metrics: what the queue and RED rows do not cover. */\n body?: ReactNode;\n}\n\nexport interface WorkloadNodeWorkload extends WorkloadNodePart {\n /** Parts drawn as boxes joined under the workload, each behind a dashed divider. */\n children?: ReadonlyArray<WorkloadNodePart>;\n}\n\nexport interface WorkloadNodeProps {\n workload: WorkloadNodeWorkload;\n /**\n * Hang the children below the workload's box, out of the layout flow, so the node's layout box is the workload's\n * box alone: a diagram can then centre a row of workloads on one line whether or not they have children.\n */\n hangChildren?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\nfunction WorkloadBox({ part, join, color }: { part: WorkloadNodePart; join: BoxNodeJoin | undefined; color: string | undefined }) {\n const { id, name, subtitle, icon, dashed, metrics, body } = part;\n const hasMetrics = metrics?.queue != null || metrics?.red != null || body != null;\n return (\n <BoxNode\n className=\"w-full\"\n title={name}\n {...(id !== undefined ? { id } : {})}\n {...(subtitle !== undefined ? { subtitle } : {})}\n {...(icon !== undefined ? { icon } : {})}\n {...(color !== undefined ? { style: { borderLeftColor: color } } : {})}\n {...(dashed !== undefined ? { dashed } : {})}\n {...(join !== undefined ? { join } : {})}\n >\n {hasMetrics ? (\n <>\n {metrics?.queue && <QueueStats counts={metrics.queue} />}\n {metrics?.red && <RedLine metrics={metrics.red} />}\n {body}\n </>\n ) : null}\n </BoxNode>\n );\n}\n\n/**\n * A workload as a diagram box: its icon, name, colour stripe and metrics, with its parts (`children`) joined\n * underneath as boxes of their own, so each part can carry its own metrics and arrows.\n */\nexport function WorkloadNode({ workload, hangChildren = false, className, style }: WorkloadNodeProps) {\n const parts = workload.children ?? [];\n const names = new Map<string, number>();\n const childBoxes = parts.map((part, index) => {\n const nameCount = part.id === undefined ? (names.get(part.name) ?? 0) + 1 : 0;\n if (nameCount) names.set(part.name, nameCount);\n const key = part.id === undefined ? JSON.stringify([\"name\", part.name, nameCount]) : JSON.stringify([\"id\", part.id]);\n return <WorkloadBox key={key} part={part} join={index === parts.length - 1 ? \"top\" : \"both\"} color={part.color ?? workload.color} />;\n });\n return (\n <div className={cn(\"relative flex flex-col\", className)} style={style} data-workload-node=\"\">\n <WorkloadBox part={workload} join={parts.length > 0 ? \"bottom\" : undefined} color={workload.color} />\n {parts.length > 0 && (hangChildren\n ? <div className=\"absolute left-0 top-full flex w-full flex-col\" data-workload-node-hang=\"\">{childBoxes}</div>\n : childBoxes)}\n </div>\n );\n}\n"],"mappings":";;;;;AA2CA,SAAS,YAAY,EAAE,MAAM,MAAM,SAA+F;CAChI,MAAM,EAAE,IAAI,MAAM,UAAU,MAAM,QAAQ,SAAS,SAAS;CAC5D,MAAM,aAAa,SAAS,SAAS,QAAQ,SAAS,OAAO,QAAQ,QAAQ;CAC7E,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,gBAAAA,SAAD;EACE,WAAU;EACV,OAAO;EACP,GAAK,OAAO,KAAA,IAAY,EAAE,GAAG,IAAI,CAAC;EAClC,GAAK,aAAa,KAAA,IAAY,EAAE,SAAS,IAAI,CAAC;EAC9C,GAAK,SAAS,KAAA,IAAY,EAAE,KAAK,IAAI,CAAC;EACtC,GAAK,UAAU,KAAA,IAAY,EAAE,OAAO,EAAE,iBAAiB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GAAa,MAAM;GAAU,MAAM,MAAM,SAAS,IAAI,WAAW,KAAA;GAAW,OAAO,SAAS;EAAQ,CAAA,GACnG,MAAM,SAAS,MAAM,eAClB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;GAAgD,2BAAwB;GAAI,UAAA;EAAgB,CAAA,IAC3G,WACD;;AAET"}
@@ -0,0 +1,42 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { QueueCounts, RedMetrics } from './FlowMetrics.js';
3
+ /** What a workload box shows under its title: queue counters, then RED metrics. */
4
+ export interface WorkloadNodeMetrics {
5
+ queue?: QueueCounts;
6
+ red?: RedMetrics;
7
+ }
8
+ /** One box of a workload: the workload itself, or one of its parts (an endpoint, a port, a listener). */
9
+ export interface WorkloadNodePart {
10
+ /** The box element's id, for arrows that attach by id. */
11
+ id?: string;
12
+ name: string;
13
+ subtitle?: string;
14
+ /** A product logo or kind icon, sized by the caller. */
15
+ icon?: ReactNode;
16
+ /** The left stripe's colour; a part without one takes its workload's, so the stripe runs unbroken down the stack. */
17
+ color?: string;
18
+ dashed?: boolean;
19
+ metrics?: WorkloadNodeMetrics;
20
+ /** Rows of the box's own, drawn after its metrics: what the queue and RED rows do not cover. */
21
+ body?: ReactNode;
22
+ }
23
+ export interface WorkloadNodeWorkload extends WorkloadNodePart {
24
+ /** Parts drawn as boxes joined under the workload, each behind a dashed divider. */
25
+ children?: ReadonlyArray<WorkloadNodePart>;
26
+ }
27
+ export interface WorkloadNodeProps {
28
+ workload: WorkloadNodeWorkload;
29
+ /**
30
+ * Hang the children below the workload's box, out of the layout flow, so the node's layout box is the workload's
31
+ * box alone: a diagram can then centre a row of workloads on one line whether or not they have children.
32
+ */
33
+ hangChildren?: boolean;
34
+ className?: string;
35
+ style?: CSSProperties;
36
+ }
37
+ /**
38
+ * A workload as a diagram box: its icon, name, colour stripe and metrics, with its parts (`children`) joined
39
+ * underneath as boxes of their own, so each part can carry its own metrics and arrows.
40
+ */
41
+ export declare function WorkloadNode({ workload, hangChildren, className, style }: WorkloadNodeProps): import("react").JSX.Element;
42
+ //# sourceMappingURL=WorkloadNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkloadNode.d.ts","sourceRoot":"","sources":["../../../src/data/flow-node/WorkloadNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,EAAuB,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvF,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAED,yGAAyG;AACzG,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qHAAqH;IACrH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,gGAAgG;IAChG,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,oFAAoF;IACpF,QAAQ,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AA2BD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,YAAoB,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,iBAAiB,+BAiBnG"}
@@ -0,0 +1,63 @@
1
+ import { cn } from "../../lib/utils.js";
2
+ import { BoxNode } from "./BoxNode.js";
3
+ import { QueueStats, RedLine } from "./FlowMetrics.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/data/flow-node/WorkloadNode.tsx
6
+ function WorkloadBox({ part, join, color }) {
7
+ const { id, name, subtitle, icon, dashed, metrics, body } = part;
8
+ const hasMetrics = metrics?.queue != null || metrics?.red != null || body != null;
9
+ return /* @__PURE__ */ jsx(BoxNode, {
10
+ className: "w-full",
11
+ title: name,
12
+ ...id !== void 0 ? { id } : {},
13
+ ...subtitle !== void 0 ? { subtitle } : {},
14
+ ...icon !== void 0 ? { icon } : {},
15
+ ...color !== void 0 ? { style: { borderLeftColor: color } } : {},
16
+ ...dashed !== void 0 ? { dashed } : {},
17
+ ...join !== void 0 ? { join } : {},
18
+ children: hasMetrics ? /* @__PURE__ */ jsxs(Fragment, { children: [
19
+ metrics?.queue && /* @__PURE__ */ jsx(QueueStats, { counts: metrics.queue }),
20
+ metrics?.red && /* @__PURE__ */ jsx(RedLine, { metrics: metrics.red }),
21
+ body
22
+ ] }) : null
23
+ });
24
+ }
25
+ /**
26
+ * A workload as a diagram box: its icon, name, colour stripe and metrics, with its parts (`children`) joined
27
+ * underneath as boxes of their own, so each part can carry its own metrics and arrows.
28
+ */
29
+ function WorkloadNode({ workload, hangChildren = false, className, style }) {
30
+ const parts = workload.children ?? [];
31
+ const names = /* @__PURE__ */ new Map();
32
+ const childBoxes = parts.map((part, index) => {
33
+ const nameCount = part.id === void 0 ? (names.get(part.name) ?? 0) + 1 : 0;
34
+ if (nameCount) names.set(part.name, nameCount);
35
+ const key = part.id === void 0 ? JSON.stringify([
36
+ "name",
37
+ part.name,
38
+ nameCount
39
+ ]) : JSON.stringify(["id", part.id]);
40
+ return /* @__PURE__ */ jsx(WorkloadBox, {
41
+ part,
42
+ join: index === parts.length - 1 ? "top" : "both",
43
+ color: part.color ?? workload.color
44
+ }, key);
45
+ });
46
+ return /* @__PURE__ */ jsxs("div", {
47
+ className: cn("relative flex flex-col", className),
48
+ style,
49
+ "data-workload-node": "",
50
+ children: [/* @__PURE__ */ jsx(WorkloadBox, {
51
+ part: workload,
52
+ join: parts.length > 0 ? "bottom" : void 0,
53
+ color: workload.color
54
+ }), parts.length > 0 && (hangChildren ? /* @__PURE__ */ jsx("div", {
55
+ className: "absolute left-0 top-full flex w-full flex-col",
56
+ "data-workload-node-hang": "",
57
+ children: childBoxes
58
+ }) : childBoxes)]
59
+ });
60
+ }
61
+ export { WorkloadNode };
62
+
63
+ //# sourceMappingURL=WorkloadNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkloadNode.js","names":["_Fragment"],"sources":["../../../src/data/flow-node/WorkloadNode.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { BoxNode, type BoxNodeJoin } from \"./BoxNode\";\nimport { QueueStats, RedLine, type QueueCounts, type RedMetrics } from \"./FlowMetrics\";\n\n/** What a workload box shows under its title: queue counters, then RED metrics. */\nexport interface WorkloadNodeMetrics {\n queue?: QueueCounts;\n red?: RedMetrics;\n}\n\n/** One box of a workload: the workload itself, or one of its parts (an endpoint, a port, a listener). */\nexport interface WorkloadNodePart {\n /** The box element's id, for arrows that attach by id. */\n id?: string;\n name: string;\n subtitle?: string;\n /** A product logo or kind icon, sized by the caller. */\n icon?: ReactNode;\n /** The left stripe's colour; a part without one takes its workload's, so the stripe runs unbroken down the stack. */\n color?: string;\n dashed?: boolean;\n metrics?: WorkloadNodeMetrics;\n /** Rows of the box's own, drawn after its metrics: what the queue and RED rows do not cover. */\n body?: ReactNode;\n}\n\nexport interface WorkloadNodeWorkload extends WorkloadNodePart {\n /** Parts drawn as boxes joined under the workload, each behind a dashed divider. */\n children?: ReadonlyArray<WorkloadNodePart>;\n}\n\nexport interface WorkloadNodeProps {\n workload: WorkloadNodeWorkload;\n /**\n * Hang the children below the workload's box, out of the layout flow, so the node's layout box is the workload's\n * box alone: a diagram can then centre a row of workloads on one line whether or not they have children.\n */\n hangChildren?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\nfunction WorkloadBox({ part, join, color }: { part: WorkloadNodePart; join: BoxNodeJoin | undefined; color: string | undefined }) {\n const { id, name, subtitle, icon, dashed, metrics, body } = part;\n const hasMetrics = metrics?.queue != null || metrics?.red != null || body != null;\n return (\n <BoxNode\n className=\"w-full\"\n title={name}\n {...(id !== undefined ? { id } : {})}\n {...(subtitle !== undefined ? { subtitle } : {})}\n {...(icon !== undefined ? { icon } : {})}\n {...(color !== undefined ? { style: { borderLeftColor: color } } : {})}\n {...(dashed !== undefined ? { dashed } : {})}\n {...(join !== undefined ? { join } : {})}\n >\n {hasMetrics ? (\n <>\n {metrics?.queue && <QueueStats counts={metrics.queue} />}\n {metrics?.red && <RedLine metrics={metrics.red} />}\n {body}\n </>\n ) : null}\n </BoxNode>\n );\n}\n\n/**\n * A workload as a diagram box: its icon, name, colour stripe and metrics, with its parts (`children`) joined\n * underneath as boxes of their own, so each part can carry its own metrics and arrows.\n */\nexport function WorkloadNode({ workload, hangChildren = false, className, style }: WorkloadNodeProps) {\n const parts = workload.children ?? [];\n const names = new Map<string, number>();\n const childBoxes = parts.map((part, index) => {\n const nameCount = part.id === undefined ? (names.get(part.name) ?? 0) + 1 : 0;\n if (nameCount) names.set(part.name, nameCount);\n const key = part.id === undefined ? JSON.stringify([\"name\", part.name, nameCount]) : JSON.stringify([\"id\", part.id]);\n return <WorkloadBox key={key} part={part} join={index === parts.length - 1 ? \"top\" : \"both\"} color={part.color ?? workload.color} />;\n });\n return (\n <div className={cn(\"relative flex flex-col\", className)} style={style} data-workload-node=\"\">\n <WorkloadBox part={workload} join={parts.length > 0 ? \"bottom\" : undefined} color={workload.color} />\n {parts.length > 0 && (hangChildren\n ? <div className=\"absolute left-0 top-full fl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GAAC;GAAQ,KAAK;GAAM;EAAS,CAAC,IAAI,KAAK,UAAU,CAAC,MAAM,KAAK,EAAE,CAAC;EACnH,OAAO,oBAAC,aAAD;GAA6B;GAAM,MAAM,UAAU,MAAM,SAAS,IAAI,QAAQ;GAAQ,OAAO,KAAK,SAAS,SAAS;EAAQ,GAA1G,GAA0G;CACrI,CAAC;CACD,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,0BAA0B,SAAS;EAAU;EAAO,sBAAmB;EAA1F,UAAA,CACE,oBAAC,aAAD;GAAa,MAAM;GAAU,MAAM,MAAM,SAAS,IAAI,WAAW,KAAA;GAAW,OAAO,SAAS;EAAQ,CAAA,GACnG,MAAM,SAAS,MAAM,eAClB,oBAAC,OAAD;GAAK,WAAU;GAAgD,2BAAwB;GAAI,UAAA;EAAgB,CAAA,IAC3G,WACD;;AAET"}
@@ -0,0 +1,5 @@
1
+ export { BoxNode, type BoxNodeJoin, type BoxNodeProps } from './BoxNode.js';
2
+ export { WorkloadNode, type WorkloadNodeMetrics, type WorkloadNodePart, type WorkloadNodeProps, type WorkloadNodeWorkload, } from './WorkloadNode.js';
3
+ export { LatencyBar, QueueStats, RedLine, type QueueCounts, type RedMetrics } from './FlowMetrics.js';
4
+ export { formatMs, latencyScaleMax, LATENCY_SCALE_MAXES, type Latency } from './latency.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/flow-node/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,37 @@
1
+ // src/data/flow-node/latency.ts
2
+ var SECOND = 1e3;
3
+ var MINUTE = 60 * SECOND;
4
+ var HOUR = 60 * MINUTE;
5
+ var DAY = 24 * HOUR;
6
+ /** Logarithmic ladder of latency bar ends: a bar ends at the smallest step that holds its average. */
7
+ var LATENCY_SCALE_MAXES = [
8
+ 100,
9
+ SECOND,
10
+ 10 * SECOND,
11
+ MINUTE,
12
+ 10 * MINUTE,
13
+ HOUR,
14
+ 8 * HOUR,
15
+ DAY
16
+ ];
17
+ /** A duration in its largest whole unit, to at most one decimal: 210ms, 1.9s, 2.5m, 8h, 1d. */
18
+ function formatMs(ms) {
19
+ const unit = [
20
+ [DAY, "d"],
21
+ [HOUR, "h"],
22
+ [MINUTE, "m"],
23
+ [SECOND, "s"]
24
+ ].find(([size]) => ms >= size);
25
+ return unit ? `${Number((ms / unit[0]).toFixed(1))}${unit[1]}` : `${ms}ms`;
26
+ }
27
+ /** The smallest scale step that holds `ms`; throws past the largest step (1d). */
28
+ function latencyScaleMax(ms) {
29
+ const scaleMax = LATENCY_SCALE_MAXES.find((step) => ms <= step);
30
+ if (scaleMax === void 0) throw new Error(`latency ${ms}ms exceeds the largest scale step (${formatMs(DAY)})`);
31
+ return scaleMax;
32
+ }
33
+ exports.LATENCY_SCALE_MAXES = LATENCY_SCALE_MAXES;
34
+ exports.formatMs = formatMs;
35
+ exports.latencyScaleMax = latencyScaleMax;
36
+
37
+ //# sourceMappingURL=latency.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latency.cjs","names":[],"sources":["../../../src/data/flow-node/latency.ts"],"sourcesContent":["/** Request latency in milliseconds. */\nexport interface Latency {\n avg: number;\n p95: number;\n max: number;\n}\n\nconst SECOND = 1000;\nconst MINUTE = 60 * SECOND;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\n\n/** Logarithmic ladder of latency bar ends: a bar ends at the smallest step that holds its average. */\nexport const LATENCY_SCALE_MAXES = [100, SECOND, 10 * SECOND, MINUTE, 10 * MINUTE, HOUR, 8 * HOUR, DAY] as const;\n\n/** A duration in its largest whole unit, to at most one decimal: 210ms, 1.9s, 2.5m, 8h, 1d. */\nexport function formatMs(ms: number): string {\n const units = [[DAY, \"d\"], [HOUR, \"h\"], [MINUTE, \"m\"], [SECOND, \"s\"]] as const;\n const unit = units.find(([size]) => ms >= size);\n return unit ? `${Number((ms / unit[0]).toFixed(1))}${unit[1]}` : `${ms}ms`;\n}\n\n/** The smallest scale step that holds `ms`; throws past the largest step (1d). */\nexport function latencyScaleMax(ms: number): number {\n const scaleMax = LATENCY_SCALE_MAXES.find((step) => ms <= step);\n if (scaleMax === undefined) throw new Error(`latency ${ms}ms exceeds the largest scale step (${formatMs(DAY)})`);\n return scaleMax;\n}\n"],"mappings":";AAOA,IAAM,SAAS;AACf,IAAM,SAAS,KAAK;AACpB,IAAM,OAAO,KAAK;AAClB,IAAM,MAAM,KAAK;;AAGjB,IAAa,sBAAsB;CAAC;CAAK;CAAQ,KAAK;CAAQ;CAAQ,KAAK;CAAQ;CAAM,IAAI;CAAM;AAAG;;AAGtG,SAAgB,SAAS,IAAoB;CAE3C,MAAM,OAAO;EADE,CAAC,KAAK,GAAG;EAAG,CAAC,MAAM,GAAG;EAAG,CAAC,QAAQ,GAAG;EAAG,CAAC,QAAQ,GAAG;CACtD,CAAA,CAAM,MAAM,CAAC,UAAU,MAAM,IAAI;CAC9C,OAAO,OAAO,GAAG,QAAQ,KAAK,KAAK,GAAA,CAAI,QAAQ,CAAC,CAAC,IAAI,KAAK,OAAO,GAAG,GAAG;AACzE;;AAGA,SAAgB,gBAAgB,IAAoB;CAClD,MAAM,WAAW,oBAAoB,MAAM,SAAS,MAAM,IAAI;CAC9D,IAAI,aAAa,KAAA,GAAW,MAAM,IAAI,MAAM,WAAW,GAAG,qCAAqC,SAAS,GAAG,EAAE,EAAE;CAC/G,OAAO;AACT"}
@@ -0,0 +1,13 @@
1
+ /** Request latency in milliseconds. */
2
+ export interface Latency {
3
+ avg: number;
4
+ p95: number;
5
+ max: number;
6
+ }
7
+ /** Logarithmic ladder of latency bar ends: a bar ends at the smallest step that holds its average. */
8
+ export declare const LATENCY_SCALE_MAXES: readonly [100, 1000, number, number, number, number, number, number];
9
+ /** A duration in its largest whole unit, to at most one decimal: 210ms, 1.9s, 2.5m, 8h, 1d. */
10
+ export declare function formatMs(ms: number): string;
11
+ /** The smallest scale step that holds `ms`; throws past the largest step (1d). */
12
+ export declare function latencyScaleMax(ms: number): number;
13
+ //# sourceMappingURL=latency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latency.d.ts","sourceRoot":"","sources":["../../../src/data/flow-node/latency.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAOD,sGAAsG;AACtG,eAAO,MAAM,mBAAmB,sEAAgF,CAAC;AAEjH,+FAA+F;AAC/F,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAI3C;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAIlD"}
@@ -0,0 +1,35 @@
1
+ // src/data/flow-node/latency.ts
2
+ var SECOND = 1e3;
3
+ var MINUTE = 60 * SECOND;
4
+ var HOUR = 60 * MINUTE;
5
+ var DAY = 24 * HOUR;
6
+ /** Logarithmic ladder of latency bar ends: a bar ends at the smallest step that holds its average. */
7
+ var LATENCY_SCALE_MAXES = [
8
+ 100,
9
+ SECOND,
10
+ 10 * SECOND,
11
+ MINUTE,
12
+ 10 * MINUTE,
13
+ HOUR,
14
+ 8 * HOUR,
15
+ DAY
16
+ ];
17
+ /** A duration in its largest whole unit, to at most one decimal: 210ms, 1.9s, 2.5m, 8h, 1d. */
18
+ function formatMs(ms) {
19
+ const unit = [
20
+ [DAY, "d"],
21
+ [HOUR, "h"],
22
+ [MINUTE, "m"],
23
+ [SECOND, "s"]
24
+ ].find(([size]) => ms >= size);
25
+ return unit ? `${Number((ms / unit[0]).toFixed(1))}${unit[1]}` : `${ms}ms`;
26
+ }
27
+ /** The smallest scale step that holds `ms`; throws past the largest step (1d). */
28
+ function latencyScaleMax(ms) {
29
+ const scaleMax = LATENCY_SCALE_MAXES.find((step) => ms <= step);
30
+ if (scaleMax === void 0) throw new Error(`latency ${ms}ms exceeds the largest scale step (${formatMs(DAY)})`);
31
+ return scaleMax;
32
+ }
33
+ export { LATENCY_SCALE_MAXES, formatMs, latencyScaleMax };
34
+
35
+ //# sourceMappingURL=latency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latency.js","names":[],"sources":["../../../src/data/flow-node/latency.ts"],"sourcesContent":["/** Request latency in milliseconds. */\nexport interface Latency {\n avg: number;\n p95: number;\n max: number;\n}\n\nconst SECOND = 1000;\nconst MINUTE = 60 * SECOND;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\n\n/** Logarithmic ladder of latency bar ends: a bar ends at the smallest step that holds its average. */\nexport const LATENCY_SCALE_MAXES = [100, SECOND, 10 * SECOND, MINUTE, 10 * MINUTE, HOUR, 8 * HOUR, DAY] as const;\n\n/** A duration in its largest whole unit, to at most one decimal: 210ms, 1.9s, 2.5m, 8h, 1d. */\nexport function formatMs(ms: number): string {\n const units = [[DAY, \"d\"], [HOUR, \"h\"], [MINUTE, \"m\"], [SECOND, \"s\"]] as const;\n const unit = units.find(([size]) => ms >= size);\n return unit ? `${Number((ms / unit[0]).toFixed(1))}${unit[1]}` : `${ms}ms`;\n}\n\n/** The smallest scale step that holds `ms`; throws past the largest step (1d). */\nexport function latencyScaleMax(ms: number): number {\n const scaleMax = LATENCY_SCALE_MAXES.find((step) => ms <= step);\n if (scaleMax === undefined) throw new Error(`latency ${ms}ms exceeds the largest scale step (${formatMs(DAY)})`);\n return scaleMax;\n}\n"],"mappings":";AAOA,IAAM,SAAS;AACf,IAAM,SAAS,KAAK;AACpB,IAAM,OAAO,KAAK;AAClB,IAAM,MAAM,KAAK;;AAGjB,IAAa,sBAAsB;CAAC;CAAK;CAAQ,KAAK;CAAQ;CAAQ,KAAK;CAAQ;CAAM,IAAI;CAAM;AAAG;;AAGtG,SAAgB,SAAS,IAAoB;CAE3C,MAAM,OAAO;EADE,CAAC,KAAK,GAAG;EAAG,CAAC,MAAM,GAAG;EAAG,CAAC,QAAQ,GAAG;EAAG,CAAC,QAAQ,GAAG;CACtD,CAAA,CAAM,MAAM,CAAC,UAAU,MAAM,IAAI;CAC9C,OAAO,OAAO,GAAG,QAAQ,KAAK,KAAK,GAAA,CAAI,QAAQ,CAAC,CAAC,IAAI,KAAK,OAAO,GAAG,GAAG;AACzE;;AAGA,SAAgB,gBAAgB,IAAoB;CAClD,MAAM,WAAW,oBAAoB,MAAM,SAAS,MAAM,IAAI;CAC9D,IAAI,aAAa,KAAA,GAAW,MAAM,IAAI,MAAM,WAAW,GAAG,qCAAqC,SAAS,GAAG,EAAE,EAAE;CAC/G,OAAO;AACT"}
@@ -30,6 +30,7 @@ export { OtelTraceTable, type OtelTraceTableProps, type OtelOpenTrace } from './
30
30
  export { profileSpans } from './otel/profile-spans.js';
31
31
  export { profileListingSort, profileTraceListing } from './otel/profile-listing.js';
32
32
  export { searchParams as otelSearchParams, readSearchValues as readOtelSearchValues } from './otel/api.js';
33
+ export { browserHref as otelBrowserHref, readBrowserLocation as readOtelBrowserLocation } from './otel/browser-state.js';
33
34
  export { durationOf as otelDurationOf } from './otel/query.js';
34
35
  export type { Span as OtelSpan, Summary as OtelSummary, SearchForm as OtelSearchForm } from './otel/api.js';
35
36
  export type { Trace as OtelTrace, SearchValues as OtelSearchValues, SearchResult as OtelSearchResult, Source as OtelSource } from './otel/api.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/traces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,KAAK,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAA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AAE,mBAAmB,IAAI,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,IAAI,IAAI,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AACzG,YAAY,EAAE,KAAK,IAAI,SAAS,EAAE,YAAY,IAAI,gBAAgB,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC"}
@@ -754,17 +754,13 @@ function SpanDetail({ index, span, host, onSelect }) {
754
754
  }),
755
755
  c === "llm" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SpanCards.LlmCard, { span }),
756
756
  c === "db" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SpanCards.DbCard, { span }),
757
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpanProperties, {
758
- span,
759
- attributesOpen: c === "other"
760
- }, span.spanId)
757
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SpanProperties, { span }, span.spanId)
761
758
  ]
762
759
  });
763
760
  }
764
761
  var SPAN_VALUE_ACTIONS = [require_properties_copy.copyPropertyAction()];
765
- /** One properties table whose section rows (attributes, resource, OTLP metadata) expand in place. */
766
- function SpanProperties({ span, attributesOpen }) {
767
- const [open, setOpen] = (0, react.useState)(() => new Set(attributesOpen ? ["Attributes"] : []));
762
+ /** One properties table whose section rows (attributes, resource, OTLP metadata) start expanded and collapse in place. */
763
+ function SpanProperties({ span }) {
768
764
  const sections = [
769
765
  {
770
766
  title: "Attributes",
@@ -779,6 +775,7 @@ function SpanProperties({ span, attributesOpen }) {
779
775
  values: span.otlp
780
776
  }] : []
781
777
  ];
778
+ const [open, setOpen] = (0, react.useState)(() => new Set(sections.map((section) => section.title)));
782
779
  const toggle = (title) => setOpen((previous) => {
783
780
  const next = new Set(previous);
784
781
  if (!next.delete(title)) next.add(title);