@rtkelly-labs/design-system 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/AlertList.js +246 -0
  3. package/dist/components/AlertList.js.map +1 -0
  4. package/dist/components/FilterBar.js +215 -0
  5. package/dist/components/FilterBar.js.map +1 -0
  6. package/dist/components/FreshnessIndicator.js +50 -0
  7. package/dist/components/FreshnessIndicator.js.map +1 -0
  8. package/dist/components/IdChip.js +58 -0
  9. package/dist/components/IdChip.js.map +1 -0
  10. package/dist/components/IncidentTimeline.js +122 -0
  11. package/dist/components/IncidentTimeline.js.map +1 -0
  12. package/dist/components/LatencyHeatmap.js +382 -0
  13. package/dist/components/LatencyHeatmap.js.map +1 -0
  14. package/dist/components/LatencyHistogram.js +282 -0
  15. package/dist/components/LatencyHistogram.js.map +1 -0
  16. package/dist/components/LogViewer.js +393 -0
  17. package/dist/components/LogViewer.js.map +1 -0
  18. package/dist/components/ServiceMap.js +404 -0
  19. package/dist/components/ServiceMap.js.map +1 -0
  20. package/dist/components/SeverityBadge.js +15 -0
  21. package/dist/components/SeverityBadge.js.map +1 -0
  22. package/dist/components/TimeRange.js +89 -0
  23. package/dist/components/TimeRange.js.map +1 -0
  24. package/dist/components/TimeSeriesChart.js +507 -0
  25. package/dist/components/TimeSeriesChart.js.map +1 -0
  26. package/dist/components/TraceViewer.js +159 -0
  27. package/dist/components/TraceViewer.js.map +1 -0
  28. package/dist/components/TraceWaterfall.js +226 -0
  29. package/dist/components/TraceWaterfall.js.map +1 -0
  30. package/dist/components/docs/figures/ChangeSummary.js +5 -5
  31. package/dist/components/docs/figures/ChangeSummary.js.map +1 -1
  32. package/dist/components/docs/figures/FileChangeTree.js +4 -4
  33. package/dist/components/docs/figures/FileChangeTree.js.map +1 -1
  34. package/dist/components/saas/ObservabilityConsole.js +220 -0
  35. package/dist/components/saas/ObservabilityConsole.js.map +1 -0
  36. package/dist/components/saas/observabilityData.js +250 -0
  37. package/dist/components/saas/observabilityData.js.map +1 -0
  38. package/dist/hooks/useMeasuredWidth.js +22 -0
  39. package/dist/hooks/useMeasuredWidth.js.map +1 -0
  40. package/dist/hooks/useTraceClock.js +17 -0
  41. package/dist/hooks/useTraceClock.js.map +1 -0
  42. package/dist/hooks/useTraceReplay.js +75 -0
  43. package/dist/hooks/useTraceReplay.js.map +1 -0
  44. package/dist/index.d.ts +1596 -3
  45. package/dist/index.js +25 -0
  46. package/dist/index.js.map +1 -1
  47. package/dist/lib/filters.js +130 -0
  48. package/dist/lib/filters.js.map +1 -0
  49. package/dist/lib/ids.js +9 -0
  50. package/dist/lib/ids.js.map +1 -0
  51. package/dist/lib/latency.js +228 -0
  52. package/dist/lib/latency.js.map +1 -0
  53. package/dist/lib/logs.js +78 -0
  54. package/dist/lib/logs.js.map +1 -0
  55. package/dist/lib/serviceGraph.js +243 -0
  56. package/dist/lib/serviceGraph.js.map +1 -0
  57. package/dist/lib/severity.js +23 -0
  58. package/dist/lib/severity.js.map +1 -0
  59. package/dist/lib/theme.js +12 -0
  60. package/dist/lib/theme.js.map +1 -1
  61. package/dist/lib/timeRange.js +94 -0
  62. package/dist/lib/timeRange.js.map +1 -0
  63. package/dist/lib/timeSeries.js +285 -0
  64. package/dist/lib/timeSeries.js.map +1 -0
  65. package/dist/lib/trace.js +251 -0
  66. package/dist/lib/trace.js.map +1 -0
  67. package/dist/theme/contrast.js +15 -0
  68. package/dist/theme/contrast.js.map +1 -1
  69. package/dist/theme/levels.js +31 -0
  70. package/dist/theme/levels.js.map +1 -1
  71. package/dist/theme.css +30 -0
  72. package/package.json +1 -1
  73. package/tokens/palette.midnight.tokens.json +50 -0
  74. package/tokens/palette.sketch.tokens.json +50 -0
@@ -0,0 +1,393 @@
1
+ "use client";
2
+
3
+ // src/components/LogViewer.tsx
4
+ import { ChevronDown, ChevronRight } from "lucide-react";
5
+ import { useVirtualizer } from "@tanstack/react-virtual";
6
+ import {
7
+ forwardRef,
8
+ useCallback,
9
+ useEffect,
10
+ useId,
11
+ useLayoutEffect,
12
+ useMemo,
13
+ useRef,
14
+ useState
15
+ } from "react";
16
+ import {
17
+ describeLogEntry,
18
+ highlightLogText,
19
+ inLogRange,
20
+ nearestLogIndex,
21
+ sortLogEntries
22
+ } from "../lib/logs.js";
23
+ import { recipe } from "../lib/recipe.js";
24
+ import { formatTimestamp, normaliseRange } from "../lib/timeRange.js";
25
+ import { SeverityBadge } from "./SeverityBadge.js";
26
+ import { useTimeCursor, useTimeRange } from "./TimeRange.js";
27
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
28
+ var ROW_HEIGHT = 32;
29
+ var HEADER_HEIGHT = 32;
30
+ var VIRTUALIZE_ABOVE = 200;
31
+ var EDGE_SLACK = 4;
32
+ function spacerStyle(height) {
33
+ return { height };
34
+ }
35
+ function scrollBoxStyle(height) {
36
+ return { height };
37
+ }
38
+ var logViewer = recipe({
39
+ slots: {
40
+ root: "relative flex min-w-0 flex-col border-2 border-edge-strong bg-surface-base font-mono text-xs leading-4 text-content-primary",
41
+ scroll: "relative w-full overflow-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-primary",
42
+ header: "sticky top-0 z-10 grid h-8 min-w-[36rem] items-center gap-3 border-b border-edge-default bg-surface-raised px-2 uppercase tracking-wide text-content-muted",
43
+ list: "flex min-w-[36rem] flex-col",
44
+ row: "flex flex-col border-l-2 border-l-transparent",
45
+ summary: "grid h-8 w-full cursor-pointer items-center gap-3 border-b border-edge-subtle px-2 text-left hover:bg-surface-sunken focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-primary",
46
+ toggle: "select-none text-center text-content-muted",
47
+ time: "whitespace-nowrap tabular-nums text-content-secondary",
48
+ severity: "flex",
49
+ service: "truncate text-content-secondary",
50
+ message: "truncate",
51
+ detail: "flex flex-col gap-2 border-b border-edge-subtle bg-surface-sunken px-2 py-2 pl-8",
52
+ full: "whitespace-pre-wrap break-words",
53
+ fields: "grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-1",
54
+ key: "text-content-muted",
55
+ value: "min-w-0 break-all",
56
+ traceButton: "ml-3 cursor-pointer border border-accent-primary px-1.5 text-accent-primary hover:bg-accent-primary hover:text-content-inverse focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary",
57
+ mark: "bg-accent-primary text-content-inverse",
58
+ empty: "px-3 py-8 text-center text-content-muted",
59
+ jump: "absolute bottom-3 right-3 z-20 cursor-pointer border-2 border-edge-strong bg-surface-overlay px-2 py-1 text-content-primary shadow-hard-sm hover:bg-accent-primary hover:text-content-inverse focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary"
60
+ },
61
+ variants: {
62
+ // The service column collapses away when no line names one.
63
+ services: {
64
+ true: { header: "grid-cols-[1rem_19ch_4.5rem_8rem_minmax(0,1fr)]", summary: "grid-cols-[1rem_19ch_4.5rem_8rem_minmax(0,1fr)]" },
65
+ false: { header: "grid-cols-[1rem_19ch_4.5rem_minmax(0,1fr)]", summary: "grid-cols-[1rem_19ch_4.5rem_minmax(0,1fr)]" }
66
+ },
67
+ cursor: { true: { row: "border-l-accent-primary bg-surface-raised" } },
68
+ expanded: { true: { row: "bg-surface-raised" } }
69
+ }
70
+ });
71
+ function Highlighted({ text, query, className }) {
72
+ const parts = highlightLogText(text, query);
73
+ return /* @__PURE__ */ jsx("span", { className, children: parts.map(
74
+ (part, index) => part.match ? /* @__PURE__ */ jsx("mark", { className: logViewer().mark(), children: part.text }, index) : /* @__PURE__ */ jsx("span", { children: part.text }, index)
75
+ ) });
76
+ }
77
+ var LogViewer = forwardRef(function LogViewer2({
78
+ entries,
79
+ order = "asc",
80
+ query,
81
+ severities,
82
+ range: rangeProp,
83
+ followRange = true,
84
+ follow = false,
85
+ onTraceSelect,
86
+ height = 360,
87
+ virtualize,
88
+ showHeader = true,
89
+ announce = false,
90
+ defaultExpanded = [],
91
+ emptyText,
92
+ label = "Log lines",
93
+ className,
94
+ ...props
95
+ }, ref) {
96
+ const uid = useId();
97
+ const shared = useTimeRange();
98
+ const sharedCursor = useTimeCursor();
99
+ const range = normaliseRange(rangeProp) ?? (followRange ? shared?.range ?? null : null);
100
+ const from = range?.from;
101
+ const to = range?.to;
102
+ const rows = useMemo(() => {
103
+ const allowed = severities ? new Set(severities) : null;
104
+ const kept = entries.filter(
105
+ (entry) => (!allowed || allowed.has(entry.severity)) && (from === void 0 || to === void 0 || inLogRange(entry.time, { from, to }))
106
+ );
107
+ return sortLogEntries(kept, order);
108
+ }, [entries, severities, order, from, to]);
109
+ const hasServices = useMemo(() => rows.some((entry) => entry.service), [rows]);
110
+ const latestTime = rows.length ? rows[order === "asc" ? rows.length - 1 : 0].time : null;
111
+ const virtual = virtualize ?? rows.length > VIRTUALIZE_ABOVE;
112
+ const scrollRef = useRef(null);
113
+ const [expanded, setExpanded] = useState(() => new Set(defaultExpanded));
114
+ const virtualizer = useVirtualizer({
115
+ count: virtual ? rows.length : 0,
116
+ estimateSize: () => ROW_HEIGHT,
117
+ overscan: 10,
118
+ getScrollElement: () => scrollRef.current,
119
+ getItemKey: (index) => rows[index]?.id ?? index,
120
+ scrollMargin: showHeader ? HEADER_HEIGHT : 0,
121
+ initialRect: { width: 0, height },
122
+ // An expanded line is taller than the plan; measure it, but never accept 0
123
+ // (no layout yet), or every line would collapse into the viewport at once.
124
+ measureElement: (element, entry) => {
125
+ const measured = entry?.borderBoxSize?.[0]?.blockSize ?? element.getBoundingClientRect().height;
126
+ return measured > 0 ? Math.round(measured) : ROW_HEIGHT;
127
+ }
128
+ });
129
+ const virtualItems = virtual ? virtualizer.getVirtualItems() : [];
130
+ const margin = showHeader ? HEADER_HEIGHT : 0;
131
+ const firstItem = virtualItems[0];
132
+ const lastItem = virtualItems[virtualItems.length - 1];
133
+ const topGap = virtual && firstItem ? firstItem.start - margin : 0;
134
+ const bottomGap = virtual && lastItem ? virtualizer.getTotalSize() - (lastItem.end - margin) : 0;
135
+ const rendered = virtual ? virtualItems.map((item) => item.index) : rows.map((_, index) => index);
136
+ const [pinned, setPinned] = useState(true);
137
+ const pinnedRef = useRef(true);
138
+ const [anchorTime, setAnchorTime] = useState(null);
139
+ const atLatestEdge = (el) => order === "asc" ? el.scrollHeight - el.scrollTop - el.clientHeight <= EDGE_SLACK : el.scrollTop <= EDGE_SLACK;
140
+ const scrollToLatest = useCallback(() => {
141
+ const el = scrollRef.current;
142
+ if (!el) return;
143
+ el.scrollTop = order === "asc" ? el.scrollHeight : 0;
144
+ }, [order]);
145
+ const onScroll = () => {
146
+ const el = scrollRef.current;
147
+ if (!el) return;
148
+ const at = atLatestEdge(el);
149
+ if (at === pinnedRef.current) return;
150
+ pinnedRef.current = at;
151
+ setPinned(at);
152
+ setAnchorTime(at ? null : latestTime);
153
+ };
154
+ useLayoutEffect(() => {
155
+ if (follow && pinnedRef.current) scrollToLatest();
156
+ }, [follow, rows, scrollToLatest, bottomGap]);
157
+ const newCount = useMemo(
158
+ () => anchorTime === null ? 0 : rows.reduce((count, entry) => count + (entry.time > anchorTime ? 1 : 0), 0),
159
+ [rows, anchorTime]
160
+ );
161
+ const jumpToLatest = () => {
162
+ pinnedRef.current = true;
163
+ setPinned(true);
164
+ setAnchorTime(null);
165
+ if (virtual && rows.length) virtualizer.scrollToIndex(order === "asc" ? rows.length - 1 : 0, { align: order === "asc" ? "end" : "start" });
166
+ scrollToLatest();
167
+ };
168
+ const cursorIndex = nearestLogIndex(rows, sharedCursor?.cursor);
169
+ const ownCursor = useRef(null);
170
+ const hover = (entry) => {
171
+ if (!sharedCursor) return;
172
+ ownCursor.current = entry.time;
173
+ sharedCursor.setCursor(entry.time);
174
+ };
175
+ const leave = () => {
176
+ if (sharedCursor && ownCursor.current !== null && sharedCursor.cursor === ownCursor.current) sharedCursor.setCursor(null);
177
+ ownCursor.current = null;
178
+ };
179
+ const [activeId, setActiveId] = useState(null);
180
+ const activeIndex = (() => {
181
+ const found = activeId === null ? -1 : rows.findIndex((entry) => entry.id === activeId);
182
+ if (found !== -1) return found;
183
+ if (!rows.length) return -1;
184
+ return follow ? order === "asc" ? rows.length - 1 : 0 : 0;
185
+ })();
186
+ const rowRefs = useRef(/* @__PURE__ */ new Map());
187
+ const pendingFocus = useRef(null);
188
+ useEffect(() => {
189
+ const id = pendingFocus.current;
190
+ if (!id) return;
191
+ const node = rowRefs.current.get(id);
192
+ if (!node) return;
193
+ pendingFocus.current = null;
194
+ node.focus();
195
+ });
196
+ const moveTo = (index) => {
197
+ const target = rows[Math.max(0, Math.min(rows.length - 1, index))];
198
+ if (!target) return;
199
+ pendingFocus.current = target.id;
200
+ setActiveId(target.id);
201
+ if (virtual) virtualizer.scrollToIndex(rows.indexOf(target), { align: "auto" });
202
+ const node = rowRefs.current.get(target.id);
203
+ if (node) {
204
+ pendingFocus.current = null;
205
+ node.focus();
206
+ } else {
207
+ scrollRef.current?.focus({ preventScroll: true });
208
+ }
209
+ };
210
+ const activeRendered = activeIndex !== -1 && rendered.includes(activeIndex);
211
+ const setOpen = (id, open) => {
212
+ setExpanded((current) => {
213
+ if (current.has(id) === open) return current;
214
+ const next = new Set(current);
215
+ if (open) next.add(id);
216
+ else next.delete(id);
217
+ return next;
218
+ });
219
+ };
220
+ const page = Math.max(1, Math.floor((height - margin) / ROW_HEIGHT) - 1);
221
+ const onRowKeyDown = (event, index, entry) => {
222
+ switch (event.key) {
223
+ case "ArrowDown":
224
+ moveTo(index + 1);
225
+ break;
226
+ case "ArrowUp":
227
+ moveTo(index - 1);
228
+ break;
229
+ case "Home":
230
+ moveTo(0);
231
+ break;
232
+ case "End":
233
+ moveTo(rows.length - 1);
234
+ break;
235
+ case "PageDown":
236
+ moveTo(index + page);
237
+ break;
238
+ case "PageUp":
239
+ moveTo(index - page);
240
+ break;
241
+ case "ArrowRight":
242
+ setOpen(entry.id, true);
243
+ break;
244
+ case "ArrowLeft":
245
+ setOpen(entry.id, false);
246
+ break;
247
+ default:
248
+ return;
249
+ }
250
+ event.preventDefault();
251
+ };
252
+ const styles = logViewer({ services: hasServices });
253
+ const renderRow = (entry, index) => {
254
+ const open = expanded.has(entry.id);
255
+ const detailId = `${uid}-detail-${index}`;
256
+ const stamp = formatTimestamp(entry.time, "millisecond");
257
+ const fields = entry.fields ? Object.entries(entry.fields) : [];
258
+ const marked = index === cursorIndex;
259
+ return (
260
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- hover only mirrors the shared time cursor; focus on the row's button does the same for keyboards
261
+ /* @__PURE__ */ jsxs(
262
+ "div",
263
+ {
264
+ role: "listitem",
265
+ "data-slot": "log-viewer-row",
266
+ "data-index": index,
267
+ "data-severity": entry.severity,
268
+ "data-cursor": marked || void 0,
269
+ "data-expanded": open || void 0,
270
+ "aria-posinset": virtual ? index + 1 : void 0,
271
+ "aria-setsize": virtual ? rows.length : void 0,
272
+ ref: virtual ? virtualizer.measureElement : void 0,
273
+ className: styles.row({ cursor: marked, expanded: open }),
274
+ onMouseEnter: () => hover(entry),
275
+ children: [
276
+ /* @__PURE__ */ jsxs(
277
+ "button",
278
+ {
279
+ type: "button",
280
+ ref: (node) => {
281
+ if (node) rowRefs.current.set(entry.id, node);
282
+ else rowRefs.current.delete(entry.id);
283
+ },
284
+ tabIndex: index === activeIndex ? 0 : -1,
285
+ "aria-expanded": open,
286
+ "aria-controls": open ? detailId : void 0,
287
+ "aria-label": describeLogEntry(entry),
288
+ className: styles.summary(),
289
+ onClick: () => {
290
+ setActiveId(entry.id);
291
+ setOpen(entry.id, !open);
292
+ },
293
+ onFocus: () => {
294
+ setActiveId(entry.id);
295
+ hover(entry);
296
+ },
297
+ onKeyDown: (event) => onRowKeyDown(event, index, entry),
298
+ children: [
299
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: styles.toggle(), children: open ? /* @__PURE__ */ jsx(ChevronDown, { size: 12, className: "inline-block" }) : /* @__PURE__ */ jsx(ChevronRight, { size: 12, className: "inline-block" }) }),
300
+ /* @__PURE__ */ jsx("time", { dateTime: new Date(entry.time).toISOString(), className: styles.time(), children: stamp }),
301
+ /* @__PURE__ */ jsx("span", { className: styles.severity(), children: /* @__PURE__ */ jsx(SeverityBadge, { severity: entry.severity, className: "px-1 py-0 border" }) }),
302
+ hasServices ? /* @__PURE__ */ jsx("span", { className: styles.service(), title: entry.service, children: entry.service ?? "" }) : null,
303
+ /* @__PURE__ */ jsx(Highlighted, { text: entry.message, query, className: styles.message() })
304
+ ]
305
+ }
306
+ ),
307
+ open ? /* @__PURE__ */ jsxs("div", { id: detailId, "data-slot": "log-viewer-detail", className: styles.detail(), children: [
308
+ /* @__PURE__ */ jsx(Highlighted, { text: entry.message, query, className: styles.full() }),
309
+ fields.length || entry.traceId || entry.spanId ? /* @__PURE__ */ jsxs("dl", { className: styles.fields(), children: [
310
+ fields.map(([key, value]) => /* @__PURE__ */ jsxs("div", { className: "contents", children: [
311
+ /* @__PURE__ */ jsx("dt", { className: styles.key(), children: key }),
312
+ /* @__PURE__ */ jsx("dd", { className: styles.value(), children: String(value) })
313
+ ] }, key)),
314
+ entry.traceId ? /* @__PURE__ */ jsxs("div", { className: "contents", children: [
315
+ /* @__PURE__ */ jsx("dt", { className: styles.key(), children: "trace_id" }),
316
+ /* @__PURE__ */ jsxs("dd", { className: styles.value(), children: [
317
+ entry.traceId,
318
+ onTraceSelect ? /* @__PURE__ */ jsx(
319
+ "button",
320
+ {
321
+ type: "button",
322
+ "data-slot": "log-viewer-trace-button",
323
+ className: styles.traceButton(),
324
+ onClick: () => onTraceSelect(entry.traceId, entry),
325
+ children: "View trace"
326
+ }
327
+ ) : null
328
+ ] })
329
+ ] }) : null,
330
+ entry.spanId ? /* @__PURE__ */ jsxs("div", { className: "contents", children: [
331
+ /* @__PURE__ */ jsx("dt", { className: styles.key(), children: "span_id" }),
332
+ /* @__PURE__ */ jsx("dd", { className: styles.value(), children: entry.spanId })
333
+ ] }) : null
334
+ ] }) : null
335
+ ] }) : null
336
+ ]
337
+ },
338
+ entry.id
339
+ )
340
+ );
341
+ };
342
+ const filteredOut = Boolean(query?.trim()) || Boolean(severities);
343
+ const empty = emptyText ?? (filteredOut ? "No log lines match." : "No log lines in this range.");
344
+ return /* @__PURE__ */ jsxs("div", { ref, "data-slot": "log-viewer", "data-follow": follow || void 0, ...props, className: styles.root({ className }), children: [
345
+ /* @__PURE__ */ jsxs(
346
+ "div",
347
+ {
348
+ ref: scrollRef,
349
+ "data-slot": "log-viewer-scroll",
350
+ role: "log",
351
+ "aria-live": announce ? "polite" : "off",
352
+ "aria-label": label,
353
+ tabIndex: activeRendered ? -1 : 0,
354
+ className: styles.scroll(),
355
+ style: scrollBoxStyle(height),
356
+ onScroll,
357
+ onMouseLeave: leave,
358
+ onFocus: (event) => {
359
+ if (event.target === event.currentTarget && activeIndex !== -1 && !pendingFocus.current) moveTo(activeIndex);
360
+ },
361
+ onKeyDown: (event) => {
362
+ if (event.target === event.currentTarget && activeIndex !== -1) onRowKeyDown(event, activeIndex, rows[activeIndex]);
363
+ },
364
+ children: [
365
+ showHeader ? /* @__PURE__ */ jsxs("div", { "aria-hidden": "true", "data-slot": "log-viewer-header", className: styles.header(), children: [
366
+ /* @__PURE__ */ jsx("span", {}),
367
+ /* @__PURE__ */ jsx("span", { children: "Time (UTC)" }),
368
+ /* @__PURE__ */ jsx("span", { children: "Level" }),
369
+ hasServices ? /* @__PURE__ */ jsx("span", { children: "Service" }) : null,
370
+ /* @__PURE__ */ jsx("span", { children: "Message" })
371
+ ] }) : null,
372
+ rows.length === 0 ? /* @__PURE__ */ jsxs("p", { "data-slot": "log-viewer-empty", className: styles.empty(), children: [
373
+ "> ",
374
+ empty
375
+ ] }) : /* @__PURE__ */ jsx("div", { role: "list", className: styles.list(), children: virtual ? /* @__PURE__ */ jsxs(Fragment, { children: [
376
+ topGap > 0 ? /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: spacerStyle(topGap) }) : null,
377
+ virtualItems.map((item) => renderRow(rows[item.index], item.index)),
378
+ bottomGap > 0 ? /* @__PURE__ */ jsx("div", { "aria-hidden": "true", style: spacerStyle(bottomGap) }) : null
379
+ ] }) : rows.map((entry, index) => renderRow(entry, index)) })
380
+ ]
381
+ }
382
+ ),
383
+ follow && !pinned && rows.length ? /* @__PURE__ */ jsxs("button", { type: "button", "data-slot": "log-viewer-jump", className: styles.jump(), onClick: jumpToLatest, children: [
384
+ "Jump to latest",
385
+ newCount ? ` (${newCount} new)` : ""
386
+ ] }) : null
387
+ ] });
388
+ });
389
+ LogViewer.displayName = "LogViewer";
390
+ export {
391
+ LogViewer
392
+ };
393
+ //# sourceMappingURL=LogViewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/LogViewer.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDown, ChevronRight } from 'lucide-react';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport {\n describeLogEntry,\n highlightLogText,\n inLogRange,\n nearestLogIndex,\n sortLogEntries,\n type LogEntry,\n} from '../lib/logs';\nimport { recipe } from '../lib/recipe';\nimport { formatTimestamp, normaliseRange, type TimeRange as TimeWindow } from '../lib/timeRange';\nimport type { LogSeverity } from '../lib/severity';\nimport { SeverityBadge } from './SeverityBadge';\nimport { useTimeCursor, useTimeRange } from './TimeRange';\n\n/** Collapsed row height, in px. Fixed (`h-8`) so a windowed list plans exactly. */\nconst ROW_HEIGHT = 32;\n/** The sticky column header's height (`h-8`); rows begin below it. */\nconst HEADER_HEIGHT = 32;\n/** Above this many lines the list is windowed unless `virtualize` says otherwise. */\nconst VIRTUALIZE_ABOVE = 200;\n/** How close to the latest edge, in px, still counts as \"at the latest line\". */\nconst EDGE_SLACK = 4;\n\n/** Virtualization geometry is runtime arithmetic; hoisted functions (the\n * `ATTACHED_STYLE` convention from CodeBlock, as in DataTable) keep it off the\n * inline-style sites the contract counts. */\nfunction spacerStyle(height: number) {\n return { height };\n}\nfunction scrollBoxStyle(height: number) {\n return { height };\n}\n\nconst logViewer = recipe({\n slots: {\n root: 'relative flex min-w-0 flex-col border-2 border-edge-strong bg-surface-base font-mono text-xs leading-4 text-content-primary',\n scroll: 'relative w-full overflow-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-primary',\n header: 'sticky top-0 z-10 grid h-8 min-w-[36rem] items-center gap-3 border-b border-edge-default bg-surface-raised px-2 uppercase tracking-wide text-content-muted',\n list: 'flex min-w-[36rem] flex-col',\n row: 'flex flex-col border-l-2 border-l-transparent',\n summary: 'grid h-8 w-full cursor-pointer items-center gap-3 border-b border-edge-subtle px-2 text-left hover:bg-surface-sunken focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent-primary',\n toggle: 'select-none text-center text-content-muted',\n time: 'whitespace-nowrap tabular-nums text-content-secondary',\n severity: 'flex',\n service: 'truncate text-content-secondary',\n message: 'truncate',\n detail: 'flex flex-col gap-2 border-b border-edge-subtle bg-surface-sunken px-2 py-2 pl-8',\n full: 'whitespace-pre-wrap break-words',\n fields: 'grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-1',\n key: 'text-content-muted',\n value: 'min-w-0 break-all',\n traceButton: 'ml-3 cursor-pointer border border-accent-primary px-1.5 text-accent-primary hover:bg-accent-primary hover:text-content-inverse focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary',\n mark: 'bg-accent-primary text-content-inverse',\n empty: 'px-3 py-8 text-center text-content-muted',\n jump: 'absolute bottom-3 right-3 z-20 cursor-pointer border-2 border-edge-strong bg-surface-overlay px-2 py-1 text-content-primary shadow-hard-sm hover:bg-accent-primary hover:text-content-inverse focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary',\n },\n variants: {\n // The service column collapses away when no line names one.\n services: {\n true: { header: 'grid-cols-[1rem_19ch_4.5rem_8rem_minmax(0,1fr)]', summary: 'grid-cols-[1rem_19ch_4.5rem_8rem_minmax(0,1fr)]' },\n false: { header: 'grid-cols-[1rem_19ch_4.5rem_minmax(0,1fr)]', summary: 'grid-cols-[1rem_19ch_4.5rem_minmax(0,1fr)]' },\n },\n cursor: { true: { row: 'border-l-accent-primary bg-surface-raised' } },\n expanded: { true: { row: 'bg-surface-raised' } },\n },\n});\n\nfunction Highlighted({ text, query, className }: { text: string; query?: string; className?: string }) {\n const parts = highlightLogText(text, query);\n return (\n <span className={className}>\n {parts.map((part, index) =>\n part.match ? (\n <mark key={index} className={logViewer().mark()}>{part.text}</mark>\n ) : (\n <span key={index}>{part.text}</span>\n ),\n )}\n </span>\n );\n}\n\nexport interface LogViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The log lines, in any order; they are drawn in time order. */\n entries: readonly LogEntry[];\n /** `asc` (default) puts the newest line at the bottom, like a terminal tail; `desc` puts it at the top. */\n order?: 'asc' | 'desc';\n /** Highlight case-insensitive matches of this text in each message. Highlights only — filter with `filterLogEntries`. */\n query?: string;\n /** Show only these severities. Omit to show every line. */\n severities?: readonly LogSeverity[];\n /** Show only lines inside this window. Overrides the shared range. */\n range?: TimeWindow;\n /** Inside a `TimeRangeProvider`, show only lines inside the shared window. Default true. */\n followRange?: boolean;\n /**\n * Tail mode. While the reader is at the latest line, new lines keep it\n * there; once they scroll away, a \"Jump to latest\" button counts what\n * arrived since. Default false.\n */\n follow?: boolean;\n /** Called with the trace id when a line's \"View trace\" button is pressed. The button only renders when this is given. */\n onTraceSelect?: (traceId: string, entry: LogEntry) => void;\n /** Height of the scroll box, in px. Default 360. */\n height?: number;\n /** Window the list to the visible rows. Default: only above 200 lines. */\n virtualize?: boolean;\n /** Draw the column labels above the lines. Default true. */\n showHeader?: boolean;\n /** Announce new lines politely to screen readers. Off by default: a flood announced line by line is hostile. */\n announce?: boolean;\n /** Ids of the lines expanded on mount. */\n defaultExpanded?: readonly string[];\n /** Replaces the empty-state text. */\n emptyText?: ReactNode;\n /** Accessible name for the list. Default `Log lines`. */\n label?: string;\n}\n\n/**\n * A log tail: one monospace line per entry — timestamp, severity, service,\n * message — in time order, each expanding to its fields and trace ids.\n *\n * It follows the page's `TimeRangeProvider` when there is one — only lines in\n * the shared window are shown, hovering a line moves the shared cursor to it,\n * and the line nearest a cursor set elsewhere is marked. Large streams are\n * windowed with `@tanstack/react-virtual` at a fixed row height.\n *\n * The list is one tab stop. Up/Down, Home/End and PageUp/PageDown move\n * through the lines, Enter or Space toggles one, Right expands and Left\n * collapses — hand-rolled, per the one-interaction-library rule.\n */\nexport const LogViewer = forwardRef<HTMLDivElement, LogViewerProps>(function LogViewer(\n {\n entries,\n order = 'asc',\n query,\n severities,\n range: rangeProp,\n followRange = true,\n follow = false,\n onTraceSelect,\n height = 360,\n virtualize,\n showHeader = true,\n announce = false,\n defaultExpanded = [],\n emptyText,\n label = 'Log lines',\n className,\n ...props\n },\n ref,\n) {\n const uid = useId();\n const shared = useTimeRange();\n const sharedCursor = useTimeCursor();\n const range = normaliseRange(rangeProp) ?? (followRange ? shared?.range ?? null : null);\n\n // `range` is a fresh object each render; its endpoints are what matter.\n const from = range?.from;\n const to = range?.to;\n const rows = useMemo(() => {\n const allowed = severities ? new Set(severities) : null;\n const kept = entries.filter(\n (entry) =>\n (!allowed || allowed.has(entry.severity)) &&\n (from === undefined || to === undefined || inLogRange(entry.time, { from, to })),\n );\n return sortLogEntries(kept, order);\n }, [entries, severities, order, from, to]);\n const hasServices = useMemo(() => rows.some((entry) => entry.service), [rows]);\n const latestTime = rows.length ? rows[order === 'asc' ? rows.length - 1 : 0].time : null;\n\n const virtual = virtualize ?? rows.length > VIRTUALIZE_ABOVE;\n const scrollRef = useRef<HTMLDivElement>(null);\n const [expanded, setExpanded] = useState<ReadonlySet<string>>(() => new Set(defaultExpanded));\n\n // eslint-disable-next-line react-hooks/incompatible-library -- the windowing engine DataTable uses; its getters are read during render on purpose\n const virtualizer = useVirtualizer({\n count: virtual ? rows.length : 0,\n estimateSize: () => ROW_HEIGHT,\n overscan: 10,\n getScrollElement: () => scrollRef.current,\n getItemKey: (index) => rows[index]?.id ?? index,\n scrollMargin: showHeader ? HEADER_HEIGHT : 0,\n initialRect: { width: 0, height },\n // An expanded line is taller than the plan; measure it, but never accept 0\n // (no layout yet), or every line would collapse into the viewport at once.\n measureElement: (element, entry) => {\n const measured = entry?.borderBoxSize?.[0]?.blockSize ?? element.getBoundingClientRect().height;\n return measured > 0 ? Math.round(measured) : ROW_HEIGHT;\n },\n });\n const virtualItems = virtual ? virtualizer.getVirtualItems() : [];\n const margin = showHeader ? HEADER_HEIGHT : 0;\n const firstItem = virtualItems[0];\n const lastItem = virtualItems[virtualItems.length - 1];\n const topGap = virtual && firstItem ? firstItem.start - margin : 0;\n const bottomGap = virtual && lastItem ? virtualizer.getTotalSize() - (lastItem.end - margin) : 0;\n const rendered = virtual ? virtualItems.map((item) => item.index) : rows.map((_, index) => index);\n\n // ---- Tail mode -------------------------------------------------------\n const [pinned, setPinned] = useState(true);\n const pinnedRef = useRef(true);\n const [anchorTime, setAnchorTime] = useState<number | null>(null);\n const atLatestEdge = (el: HTMLElement) =>\n order === 'asc' ? el.scrollHeight - el.scrollTop - el.clientHeight <= EDGE_SLACK : el.scrollTop <= EDGE_SLACK;\n const scrollToLatest = useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n el.scrollTop = order === 'asc' ? el.scrollHeight : 0;\n }, [order]);\n const onScroll = () => {\n const el = scrollRef.current;\n if (!el) return;\n const at = atLatestEdge(el);\n if (at === pinnedRef.current) return;\n pinnedRef.current = at;\n setPinned(at);\n setAnchorTime(at ? null : latestTime);\n };\n useLayoutEffect(() => {\n if (follow && pinnedRef.current) scrollToLatest();\n }, [follow, rows, scrollToLatest, bottomGap]);\n const newCount = useMemo(\n () => (anchorTime === null ? 0 : rows.reduce((count, entry) => count + (entry.time > anchorTime ? 1 : 0), 0)),\n [rows, anchorTime],\n );\n const jumpToLatest = () => {\n pinnedRef.current = true;\n setPinned(true);\n setAnchorTime(null);\n if (virtual && rows.length) virtualizer.scrollToIndex(order === 'asc' ? rows.length - 1 : 0, { align: order === 'asc' ? 'end' : 'start' });\n scrollToLatest();\n };\n\n // ---- Shared cursor ---------------------------------------------------\n const cursorIndex = nearestLogIndex(rows, sharedCursor?.cursor);\n const ownCursor = useRef<number | null>(null);\n const hover = (entry: LogEntry) => {\n if (!sharedCursor) return;\n ownCursor.current = entry.time;\n sharedCursor.setCursor(entry.time);\n };\n const leave = () => {\n // Clear only a cursor this list set; one a chart set stays.\n if (sharedCursor && ownCursor.current !== null && sharedCursor.cursor === ownCursor.current) sharedCursor.setCursor(null);\n ownCursor.current = null;\n };\n\n // ---- Roving focus ----------------------------------------------------\n const [activeId, setActiveId] = useState<string | null>(null);\n const activeIndex = (() => {\n const found = activeId === null ? -1 : rows.findIndex((entry) => entry.id === activeId);\n if (found !== -1) return found;\n if (!rows.length) return -1;\n return follow ? (order === 'asc' ? rows.length - 1 : 0) : 0;\n })();\n const rowRefs = useRef(new Map<string, HTMLButtonElement>());\n const pendingFocus = useRef<string | null>(null);\n // After every render: a move to a row the window had not yet drawn lands\n // once the virtualizer draws it.\n useEffect(() => {\n const id = pendingFocus.current;\n if (!id) return;\n const node = rowRefs.current.get(id);\n if (!node) return;\n pendingFocus.current = null;\n node.focus();\n });\n const moveTo = (index: number) => {\n const target = rows[Math.max(0, Math.min(rows.length - 1, index))];\n if (!target) return;\n pendingFocus.current = target.id;\n setActiveId(target.id);\n if (virtual) virtualizer.scrollToIndex(rows.indexOf(target), { align: 'auto' });\n const node = rowRefs.current.get(target.id);\n if (node) {\n pendingFocus.current = null;\n node.focus();\n } else {\n // Not drawn yet: hold focus on the box, which owns the stop until the\n // window reaches the line and the effect above hands it over.\n scrollRef.current?.focus({ preventScroll: true });\n }\n };\n const activeRendered = activeIndex !== -1 && rendered.includes(activeIndex);\n\n const setOpen = (id: string, open: boolean) => {\n setExpanded((current) => {\n if (current.has(id) === open) return current;\n const next = new Set(current);\n if (open) next.add(id);\n else next.delete(id);\n return next;\n });\n };\n\n const page = Math.max(1, Math.floor((height - margin) / ROW_HEIGHT) - 1);\n const onRowKeyDown = (event: KeyboardEvent<HTMLElement>, index: number, entry: LogEntry) => {\n switch (event.key) {\n case 'ArrowDown': moveTo(index + 1); break;\n case 'ArrowUp': moveTo(index - 1); break;\n case 'Home': moveTo(0); break;\n case 'End': moveTo(rows.length - 1); break;\n case 'PageDown': moveTo(index + page); break;\n case 'PageUp': moveTo(index - page); break;\n case 'ArrowRight': setOpen(entry.id, true); break;\n case 'ArrowLeft': setOpen(entry.id, false); break;\n default: return;\n }\n event.preventDefault();\n };\n\n const styles = logViewer({ services: hasServices });\n\n const renderRow = (entry: LogEntry, index: number) => {\n const open = expanded.has(entry.id);\n const detailId = `${uid}-detail-${index}`;\n const stamp = formatTimestamp(entry.time, 'millisecond');\n const fields = entry.fields ? Object.entries(entry.fields) : [];\n const marked = index === cursorIndex;\n return (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- hover only mirrors the shared time cursor; focus on the row's button does the same for keyboards\n <div\n key={entry.id}\n role=\"listitem\"\n data-slot=\"log-viewer-row\"\n data-index={index}\n data-severity={entry.severity}\n data-cursor={marked || undefined}\n data-expanded={open || undefined}\n aria-posinset={virtual ? index + 1 : undefined}\n aria-setsize={virtual ? rows.length : undefined}\n ref={virtual ? virtualizer.measureElement : undefined}\n className={styles.row({ cursor: marked, expanded: open })}\n onMouseEnter={() => hover(entry)}\n >\n <button\n type=\"button\"\n ref={(node) => {\n if (node) rowRefs.current.set(entry.id, node);\n else rowRefs.current.delete(entry.id);\n }}\n tabIndex={index === activeIndex ? 0 : -1}\n aria-expanded={open}\n aria-controls={open ? detailId : undefined}\n aria-label={describeLogEntry(entry)}\n className={styles.summary()}\n onClick={() => {\n setActiveId(entry.id);\n setOpen(entry.id, !open);\n }}\n onFocus={() => {\n setActiveId(entry.id);\n hover(entry);\n }}\n onKeyDown={(event) => onRowKeyDown(event, index, entry)}\n >\n <span aria-hidden=\"true\" className={styles.toggle()}>{open ? <ChevronDown size={12} className=\"inline-block\" /> : <ChevronRight size={12} className=\"inline-block\" />}</span>\n <time dateTime={new Date(entry.time).toISOString()} className={styles.time()}>{stamp}</time>\n <span className={styles.severity()}><SeverityBadge severity={entry.severity} className=\"px-1 py-0 border\" /></span>\n {hasServices ? <span className={styles.service()} title={entry.service}>{entry.service ?? ''}</span> : null}\n <Highlighted text={entry.message} query={query} className={styles.message()} />\n </button>\n {open ? (\n <div id={detailId} data-slot=\"log-viewer-detail\" className={styles.detail()}>\n <Highlighted text={entry.message} query={query} className={styles.full()} />\n {fields.length || entry.traceId || entry.spanId ? (\n <dl className={styles.fields()}>\n {fields.map(([key, value]) => (\n <div key={key} className=\"contents\">\n <dt className={styles.key()}>{key}</dt>\n <dd className={styles.value()}>{String(value)}</dd>\n </div>\n ))}\n {entry.traceId ? (\n <div className=\"contents\">\n <dt className={styles.key()}>trace_id</dt>\n <dd className={styles.value()}>\n {entry.traceId}\n {onTraceSelect ? (\n <button\n type=\"button\"\n data-slot=\"log-viewer-trace-button\"\n className={styles.traceButton()}\n onClick={() => onTraceSelect(entry.traceId as string, entry)}\n >\n View trace\n </button>\n ) : null}\n </dd>\n </div>\n ) : null}\n {entry.spanId ? (\n <div className=\"contents\">\n <dt className={styles.key()}>span_id</dt>\n <dd className={styles.value()}>{entry.spanId}</dd>\n </div>\n ) : null}\n </dl>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n };\n\n const filteredOut = Boolean(query?.trim()) || Boolean(severities);\n const empty = emptyText ?? (filteredOut ? 'No log lines match.' : 'No log lines in this range.');\n\n return (\n <div ref={ref} data-slot=\"log-viewer\" data-follow={follow || undefined} {...props} className={styles.root({ className })}>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- scroll tracks tail mode, mouseleave releases the shared cursor, focus and keys stand in for an active line the window has not drawn */}\n <div\n ref={scrollRef}\n data-slot=\"log-viewer-scroll\"\n role=\"log\"\n aria-live={announce ? 'polite' : 'off'}\n aria-label={label}\n // The list is the one tab stop. When the active line has been windowed\n // away, the box itself takes the stop and hands focus back to it.\n tabIndex={activeRendered ? -1 : 0}\n className={styles.scroll()}\n style={scrollBoxStyle(height)}\n onScroll={onScroll}\n onMouseLeave={leave}\n onFocus={(event) => {\n if (event.target === event.currentTarget && activeIndex !== -1 && !pendingFocus.current) moveTo(activeIndex);\n }}\n onKeyDown={(event) => {\n // While the box holds the stop, it steers as the active line would.\n if (event.target === event.currentTarget && activeIndex !== -1) onRowKeyDown(event, activeIndex, rows[activeIndex]);\n }}\n >\n {showHeader ? (\n <div aria-hidden=\"true\" data-slot=\"log-viewer-header\" className={styles.header()}>\n <span />\n <span>Time (UTC)</span>\n <span>Level</span>\n {hasServices ? <span>Service</span> : null}\n <span>Message</span>\n </div>\n ) : null}\n {rows.length === 0 ? (\n <p data-slot=\"log-viewer-empty\" className={styles.empty()}>&gt; {empty}</p>\n ) : (\n <div role=\"list\" className={styles.list()}>\n {virtual ? (\n <>\n {topGap > 0 ? <div aria-hidden=\"true\" style={spacerStyle(topGap)} /> : null}\n {virtualItems.map((item) => renderRow(rows[item.index], item.index))}\n {bottomGap > 0 ? <div aria-hidden=\"true\" style={spacerStyle(bottomGap)} /> : null}\n </>\n ) : (\n rows.map((entry, index) => renderRow(entry, index))\n )}\n </div>\n )}\n </div>\n {follow && !pinned && rows.length ? (\n <button type=\"button\" data-slot=\"log-viewer-jump\" className={styles.jump()} onClick={jumpToLatest}>\n Jump to latest{newCount ? ` (${newCount} new)` : ''}\n </button>\n ) : null}\n </div>\n );\n});\n\nLogViewer.displayName = 'LogViewer';\n"],"mappings":";;;AAEA,SAAS,aAAa,oBAAoB;AAC1C,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,O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