@overdoser/react-toolkit 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +41 -0
- package/components/Timeline/TraceEventDetails.d.ts +92 -0
- package/components/Timeline/TraceEventDetails.js +181 -0
- package/components/Timeline/TraceTimeline.d.ts +24 -47
- package/components/Timeline/TraceTimeline.js +516 -553
- package/components/Timeline/TraceTimeline.module.scss.js +164 -150
- package/components/Timeline/demoData.d.ts +14 -0
- package/components/Timeline/index.d.ts +5 -1
- package/components/Timeline/timelineCore.d.ts +3 -2
- package/components/Timeline/timelineCore.js +41 -36
- package/components/Timeline/traceEvent.d.ts +128 -0
- package/components/Timeline/traceEvent.js +64 -0
- package/index.css +1 -1
- package/index.d.ts +2 -2
- package/index.js +61 -55
- package/index.layered.css +1 -1
- package/llms.txt +31 -3
- package/manifest.json +50 -2
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -102,7 +102,7 @@ For exhaustive component reference (every prop, every variant, every signature),
|
|
|
102
102
|
- Axis-based charts share a `config` object: `{ [dataKey]: { label, color } }`. `PieChart` uses `nameKey` + `valueKey` (+ optional `colorKey`) instead. Colors via `var(--crk-chart-1)` … `var(--crk-chart-5)`.
|
|
103
103
|
|
|
104
104
|
- **Need a timeline of events?** Three views, all fully controlled (you pass the pre-filtered event array; items without an `end` render live and keep growing until an update completes them), all with wheel-zoom (Ctrl/Cmd-gated by default; `wheelZoom`: `'ctrl' | 'free' | 'none'`) / drag-pan / Fit, keyword highlighting (built-in toolbar search box by default — `showSearch={false}` to hide, `renderSearch` to inject your own element, or controlled `highlight` + `onHighlightChange` for an external box), tooltips, a click-to-open detail side panel, and an optional `showSummary` panel (dense numbered event list with a live viewport band and click-to-navigate smooth scrolling; `summaryPlacement` docks it left/right/top/bottom, floats it as a draggable palette, or — `'bubble'`, the TraceTimeline default — collapses it into a pill bottom-left of the timeline that expands in place and can dock from its header as a full-height resizable column flush beside the card). Customize via `--crk-timeline-*` tokens, `classes`, or render-prop slots (`renderChip`/`renderCard`/`renderBar`+`renderRowLabel`, `renderTooltip`, `renderDetails`) that inject custom components while the layout algorithms keep owning geometry:
|
|
105
|
-
- Request/response flow across services (one correlated "manifest"/saga/order) on a proportional UTC band → `<TraceTimeline events title services highlight />`. Ships a right-side dock rail by default (`showDock={false}` to remove): one docked drawer at a time — *Event details*
|
|
105
|
+
- Request/response flow across services (one correlated "manifest"/saga/order) on a proportional UTC band → `<TraceTimeline events title services highlight />`. Events don't have to be requests: an entry with no `method`/`status`/headers/bodies is treated as a plain event and the panel adapts — every value is rendered under its own label, and only the sections the event actually has appear (`message`, `payload`, consumer-defined `details: { label, value }[]`, unknown keys under *Other fields*; `level` badges plain events the way `status` badges requests). The details panel is also exported on its own as **`TraceEventDetails`** (`event`, `now`, `highlight`, `showExtraFields`, `hiddenFields`, `onClose`) for use in your own drawer/modal/split view, along with its inference helpers `isRequestEvent` / `badgeOf` / `extraFieldsOf`. `hiddenFields` (on both components) names extra event keys to keep out of *Other fields* and — on the timeline — out of keyword matching, for plumbing values shared by every event. Ships a right-side dock rail by default (`showDock={false}` to remove): one docked drawer at a time — *Event details* or *Full log* (all events vertically with payloads + copy buttons, scroll-synced with timeline clicks both ways); drawers sit flush against the timeline card at full card height, with a draggable divider to resize drawer vs timeline.
|
|
106
106
|
- One subject's life story (order, incident, candidate, deploy) as cards alternating around an axis, horizontal or vertical, equal/log/proportional spacing → `<HistoryTimeline events subjectName defaultSpacing />`.
|
|
107
107
|
- Tasks stacked by start time with duration bars (Gantt) → `<GanttTimeline tasks title onTaskSelect />`.
|
|
108
108
|
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,47 @@ All notable changes to `@overdoser/react-toolkit` are documented here.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.13.0]
|
|
8
|
+
|
|
9
|
+
Trace events no longer have to be HTTP requests, and the event inspector is
|
|
10
|
+
now a component of its own.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Flexible trace events** — `TraceTimelineEvent` gains `kind?: 'request' |
|
|
15
|
+
'event'` (inferred when omitted: `'request'` as soon as any of
|
|
16
|
+
`method`/`url`/`status`/`query`/`reqHeaders`/`reqBody`/`resHeaders`/`resBody`
|
|
17
|
+
is set), `level?: 'debug' | 'info' | 'success' | 'warning' | 'error'` (badge
|
|
18
|
+
in place of a status code), `message?: string`, `payload?: unknown` (the
|
|
19
|
+
generic body for non-request events — pretty-printed with a copy button; an
|
|
20
|
+
event may carry nothing else) and `details?: TraceTimelineField[]`
|
|
21
|
+
(`{ label, value, mono?, copy? }` — ordered custom labeled values, objects
|
|
22
|
+
rendered as copyable JSON blocks). The details drawer and full log render
|
|
23
|
+
only the sections an event actually has — plain events get
|
|
24
|
+
Message/Payload/Details instead of empty Request/Response scaffolding, read
|
|
25
|
+
"ongoing" rather than "pending" while unfinished, and no longer default
|
|
26
|
+
`source` to `client`. Unknown event keys are listed under a new *Other
|
|
27
|
+
fields* section (`showExtraFields={false}` to hide).
|
|
28
|
+
- **`TraceEventDetails`** — the event inspector behind TraceTimeline's details
|
|
29
|
+
drawer, exported standalone for use in your own drawer, modal or split view
|
|
30
|
+
(`event`, `now`, `highlight`, `showExtraFields`, `hiddenFields`, `onClose`,
|
|
31
|
+
`classes`). Ships no shell of its own; every value renders under its own
|
|
32
|
+
label — identity, URL, request id and Started / Ended / Duration each
|
|
33
|
+
stacked on their own row. Its inference helpers are exported too:
|
|
34
|
+
`isRequestEvent`, `badgeOf` (with the `TraceBadgeTone` type) and
|
|
35
|
+
`extraFieldsOf`.
|
|
36
|
+
- **`hiddenFields?: string[]`** on `TraceTimeline` and `TraceEventDetails` —
|
|
37
|
+
named extra keys are kept out of *Other fields* and, on the timeline, out of
|
|
38
|
+
keyword matching; for plumbing values (tenant ids, ingestion timestamps,
|
|
39
|
+
shared correlation ids) that ride along on every event.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- **Every value in the trace details panel is a labeled field** — the previous
|
|
44
|
+
unlabeled URL/request-id/timing lines were replaced by stacked
|
|
45
|
+
label-above-value rows, and the sticky drawer head slimmed down to a
|
|
46
|
+
one-line badge strip (identity and timing scroll with the body).
|
|
47
|
+
|
|
7
48
|
## [0.12.0]
|
|
8
49
|
|
|
9
50
|
The timeline summary and drawers become dockable, flush and resizable, and
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { TraceTimelineEvent, TraceTimelineField } from './traceEvent';
|
|
3
|
+
/** Status/level badge: `201`, `pending`, `ongoing`, `error`… */
|
|
4
|
+
export declare function EventBadge({ event, pending, small, }: {
|
|
5
|
+
event: TraceTimelineEvent;
|
|
6
|
+
pending: boolean;
|
|
7
|
+
small?: boolean;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
/**
|
|
10
|
+
* One labeled value: the label always sits above its value, and fields stack
|
|
11
|
+
* vertically. Non-inline values (objects, arrays) become copyable JSON blocks.
|
|
12
|
+
*/
|
|
13
|
+
export declare function FieldRow({ field, query, className, }: {
|
|
14
|
+
field: TraceTimelineField;
|
|
15
|
+
query?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
/** A JSON payload block: uppercase heading + copy button + pretty-printed body. */
|
|
19
|
+
export declare function PayloadBlock({ label, value, copyLabel, section, }: {
|
|
20
|
+
label: string;
|
|
21
|
+
value: unknown;
|
|
22
|
+
copyLabel: string;
|
|
23
|
+
/** Render the heading as a panel section title instead of a micro-label. */
|
|
24
|
+
section?: boolean;
|
|
25
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export interface TraceEventDetailsClasses {
|
|
27
|
+
root: string;
|
|
28
|
+
head: string;
|
|
29
|
+
body: string;
|
|
30
|
+
section: string;
|
|
31
|
+
field: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TraceEventDetailsProps {
|
|
34
|
+
/** The event to describe. */
|
|
35
|
+
event: TraceTimelineEvent;
|
|
36
|
+
/**
|
|
37
|
+
* "Now" for an unfinished event's running duration, epoch ms — pass a
|
|
38
|
+
* ticking value to keep it live. @default Date.now()
|
|
39
|
+
*/
|
|
40
|
+
now?: number;
|
|
41
|
+
/** Keyword to mark inside field values (same matcher as the timeline). */
|
|
42
|
+
highlight?: string;
|
|
43
|
+
/**
|
|
44
|
+
* List event keys the panel doesn't render itself under an *Other fields*
|
|
45
|
+
* section. @default true
|
|
46
|
+
*/
|
|
47
|
+
showExtraFields?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Extra event keys to leave out of *Other fields* — for plumbing values
|
|
50
|
+
* (tenant ids, ingestion timestamps, …) that ride along on the event but
|
|
51
|
+
* aren't part of its story. Finer-grained than `showExtraFields`, which
|
|
52
|
+
* hides the whole section.
|
|
53
|
+
*/
|
|
54
|
+
hiddenFields?: string[];
|
|
55
|
+
/** Adds a ✕ button to the header row when provided. */
|
|
56
|
+
onClose?: () => void;
|
|
57
|
+
/** Override class names on internal elements. */
|
|
58
|
+
classes?: Partial<TraceEventDetailsClasses>;
|
|
59
|
+
className?: string;
|
|
60
|
+
style?: CSSProperties;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The event inspector used by TraceTimeline's *Event details* drawer, usable
|
|
64
|
+
* on its own in any panel, modal or split view.
|
|
65
|
+
*
|
|
66
|
+
* It adapts to the event instead of assuming an HTTP call: every value is
|
|
67
|
+
* rendered under its own label (identity, URL, request id and **Started /
|
|
68
|
+
* Ended / Duration**, each stacked on its own row), and only the sections the
|
|
69
|
+
* event actually has are shown. A request (`method`/`url`/`status`/headers/
|
|
70
|
+
* bodies present, or `kind: 'request'`) gets Query parameters / Headers /
|
|
71
|
+
* Body under Request and Response — in flight, the Response section becomes
|
|
72
|
+
* "Awaiting response…". A plain event gets its `message`, `payload` and
|
|
73
|
+
* consumer-defined `details` fields instead, badged by `level` rather than a
|
|
74
|
+
* status code. Anything unrecognized lands under *Other fields*.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <TraceEventDetails
|
|
79
|
+
* event={{
|
|
80
|
+
* id: 'evt-1',
|
|
81
|
+
* service: 'Payments',
|
|
82
|
+
* op: 'payment.authorized',
|
|
83
|
+
* level: 'success',
|
|
84
|
+
* message: 'Authorized on the first attempt.',
|
|
85
|
+
* payload: { authCode: '88112', amount: 148.9 },
|
|
86
|
+
* start: Date.now() - 400,
|
|
87
|
+
* end: Date.now(),
|
|
88
|
+
* }}
|
|
89
|
+
* />
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare const TraceEventDetails: import('react').ForwardRefExoticComponent<TraceEventDetailsProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { jsxs as i, jsx as l, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as T, isValidElement as C } from "react";
|
|
3
|
+
import n from "clsx";
|
|
4
|
+
import h from "./Timeline.module.scss.js";
|
|
5
|
+
import a from "./TraceTimeline.module.scss.js";
|
|
6
|
+
import { fmtISO as D, fmtDur as O } from "./timelineCore.js";
|
|
7
|
+
import { HighlightText as I } from "./TimelineShared.js";
|
|
8
|
+
import { isRequestEvent as Q, extraFieldsOf as z, routeOf as M, badgeOf as A, isInline as U, toText as b } from "./traceEvent.js";
|
|
9
|
+
import { CopyButton as E } from "../ActionButton/CopyButton.js";
|
|
10
|
+
function W({
|
|
11
|
+
event: o,
|
|
12
|
+
pending: d,
|
|
13
|
+
small: c
|
|
14
|
+
}) {
|
|
15
|
+
const e = A(o, d);
|
|
16
|
+
return e ? /* @__PURE__ */ l(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
className: n(
|
|
20
|
+
a.statusBadge,
|
|
21
|
+
c && a.badgeSm,
|
|
22
|
+
e.tone === "pending" && a.statusPending,
|
|
23
|
+
e.tone === "warn" && a.statusWarn,
|
|
24
|
+
e.tone === "error" && a.statusError
|
|
25
|
+
),
|
|
26
|
+
children: e.text
|
|
27
|
+
}
|
|
28
|
+
) : null;
|
|
29
|
+
}
|
|
30
|
+
function f({
|
|
31
|
+
field: o,
|
|
32
|
+
query: d,
|
|
33
|
+
className: c
|
|
34
|
+
}) {
|
|
35
|
+
const { label: e, value: r, mono: g = !0, copy: k } = o, p = U(r) || r == null || C(r), v = /* @__PURE__ */ l(
|
|
36
|
+
E,
|
|
37
|
+
{
|
|
38
|
+
size: "sm",
|
|
39
|
+
className: a.payloadCopy,
|
|
40
|
+
value: () => b(r),
|
|
41
|
+
"aria-label": `Copy ${e}`
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
return /* @__PURE__ */ i("div", { className: n(a.field, !p && a.fieldBlock, c), children: [
|
|
45
|
+
k || !p ? /* @__PURE__ */ i("div", { className: a.bodyHead, children: [
|
|
46
|
+
/* @__PURE__ */ l("span", { className: a.fieldLabel, children: e }),
|
|
47
|
+
v
|
|
48
|
+
] }) : /* @__PURE__ */ l("span", { className: a.fieldLabel, children: e }),
|
|
49
|
+
p ? /* @__PURE__ */ l("div", { className: n(a.fieldValue, g && a.fieldMono), children: C(r) ? r : r == null || r === "" ? "—" : /* @__PURE__ */ l(I, { text: String(r), query: d }) }) : /* @__PURE__ */ l("pre", { className: n(h.asideRaw, a.fieldPre), children: b(r) })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
function R({
|
|
53
|
+
label: o,
|
|
54
|
+
value: d,
|
|
55
|
+
copyLabel: c,
|
|
56
|
+
section: e
|
|
57
|
+
}) {
|
|
58
|
+
return /* @__PURE__ */ i(u, { children: [
|
|
59
|
+
/* @__PURE__ */ i("div", { className: a.bodyHead, children: [
|
|
60
|
+
/* @__PURE__ */ l(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: n(e ? a.drawerSection : h.asideSection, a.bodyLabel),
|
|
64
|
+
children: o
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
d != null && /* @__PURE__ */ l(
|
|
68
|
+
E,
|
|
69
|
+
{
|
|
70
|
+
size: "sm",
|
|
71
|
+
className: a.payloadCopy,
|
|
72
|
+
value: () => b(d),
|
|
73
|
+
"aria-label": c
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ l("pre", { className: h.asideRaw, children: d != null ? b(d) : "(empty)" })
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
const H = (o) => Object.entries(o || {}).map(([d, c]) => ({ k: d, v: String(c) })), le = T(
|
|
81
|
+
function(d, c) {
|
|
82
|
+
const {
|
|
83
|
+
event: e,
|
|
84
|
+
now: r = Date.now(),
|
|
85
|
+
highlight: g,
|
|
86
|
+
showExtraFields: k = !0,
|
|
87
|
+
hiddenFields: p,
|
|
88
|
+
onClose: v,
|
|
89
|
+
classes: m,
|
|
90
|
+
className: F,
|
|
91
|
+
style: j
|
|
92
|
+
} = d, y = (g || "").trim(), q = e.end == null, B = Q(e), w = k ? z(e, p) : [], x = !!Object.keys(e.query || {}).length, L = !!Object.keys(e.reqHeaders || {}).length, V = !!Object.keys(e.resHeaders || {}).length, t = [], S = e.reqHeaders && e.reqHeaders["x-request-id"] || e.requestId;
|
|
93
|
+
e.op && t.push({ label: "Operation", value: e.op }), e.url ? t.push({ label: "URL", value: e.url }) : e.label && t.push({ label: "Label", value: e.label }), t.push({ label: "Event id", value: e.id }), S && t.push({ label: "Request id", value: S }), t.push({ label: "Started", value: D(e.start, !0) }), q ? t.push({ label: "Duration", value: O(r - e.start) + " so far" }) : e.end === e.start ? t.push({ label: "Duration", value: "instant" }) : (t.push({ label: "Ended", value: D(e.end, !0) }), t.push({ label: "Duration", value: O(e.end - e.start) }));
|
|
94
|
+
const K = !B && !e.message && !e.details?.length && e.payload == null && !w.length, N = (s) => /* @__PURE__ */ l("div", { className: n(a.drawerSection, m?.section), children: s });
|
|
95
|
+
return /* @__PURE__ */ i("div", { ref: c, className: n(m?.root, F), style: j, children: [
|
|
96
|
+
/* @__PURE__ */ l("div", { className: n(a.drawerHead, m?.head), children: /* @__PURE__ */ i("div", { className: a.drawerHeadRow, children: [
|
|
97
|
+
e.method && /* @__PURE__ */ l("span", { className: a.methodBadge, children: e.method }),
|
|
98
|
+
/* @__PURE__ */ l(W, { event: e, pending: q }),
|
|
99
|
+
/* @__PURE__ */ l("span", { className: a.drawerRoute, children: M(e) }),
|
|
100
|
+
/* @__PURE__ */ l("div", { className: a.drawerSpacer }),
|
|
101
|
+
v && /* @__PURE__ */ l(
|
|
102
|
+
"button",
|
|
103
|
+
{
|
|
104
|
+
type: "button",
|
|
105
|
+
className: h.asideClose,
|
|
106
|
+
"aria-label": "Close details",
|
|
107
|
+
onClick: v,
|
|
108
|
+
children: "✕"
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] }) }),
|
|
112
|
+
/* @__PURE__ */ i("div", { className: n(a.drawerBody, m?.body), children: [
|
|
113
|
+
/* @__PURE__ */ l("div", { className: n(a.fieldList, a.headFields), children: t.map((s) => /* @__PURE__ */ l(f, { field: s, query: y, className: m?.field }, s.label)) }),
|
|
114
|
+
e.message && /* @__PURE__ */ l("div", { className: a.fieldList, children: /* @__PURE__ */ l(
|
|
115
|
+
f,
|
|
116
|
+
{
|
|
117
|
+
field: { label: "Message", value: e.message, mono: !1 },
|
|
118
|
+
query: y,
|
|
119
|
+
className: m?.field
|
|
120
|
+
}
|
|
121
|
+
) }),
|
|
122
|
+
!!e.details?.length && /* @__PURE__ */ i(u, { children: [
|
|
123
|
+
N("Details"),
|
|
124
|
+
/* @__PURE__ */ l("div", { className: a.fieldList, children: e.details.map((s, P) => /* @__PURE__ */ l(f, { field: s, query: y, className: m?.field }, s.label + P)) })
|
|
125
|
+
] }),
|
|
126
|
+
e.payload != null && /* @__PURE__ */ l(R, { section: !0, label: "Payload", value: e.payload, copyLabel: "Copy payload" }),
|
|
127
|
+
B && /* @__PURE__ */ i(u, { children: [
|
|
128
|
+
N("Request"),
|
|
129
|
+
x && /* @__PURE__ */ i(u, { children: [
|
|
130
|
+
/* @__PURE__ */ l("div", { className: h.asideSection, children: "Query parameters" }),
|
|
131
|
+
H(e.query).map((s) => /* @__PURE__ */ i("div", { className: a.kvRow, children: [
|
|
132
|
+
/* @__PURE__ */ l("span", { className: n(a.kvKey, a.kvKeyQuery), children: s.k }),
|
|
133
|
+
/* @__PURE__ */ l("span", { className: a.kvVal, children: s.v })
|
|
134
|
+
] }, s.k))
|
|
135
|
+
] }),
|
|
136
|
+
L && /* @__PURE__ */ i(u, { children: [
|
|
137
|
+
/* @__PURE__ */ l("div", { className: h.asideSection, children: "Headers" }),
|
|
138
|
+
H(e.reqHeaders).map((s) => /* @__PURE__ */ i("div", { className: a.kvRow, children: [
|
|
139
|
+
/* @__PURE__ */ l("span", { className: a.kvKey, children: s.k }),
|
|
140
|
+
/* @__PURE__ */ l("span", { className: a.kvVal, children: s.v })
|
|
141
|
+
] }, s.k))
|
|
142
|
+
] }),
|
|
143
|
+
e.reqBody != null && /* @__PURE__ */ l(R, { label: "Body", value: e.reqBody, copyLabel: "Copy request payload" }),
|
|
144
|
+
!x && !L && e.reqBody == null && /* @__PURE__ */ l("div", { className: a.emptyNote, children: "No request data captured." }),
|
|
145
|
+
N("Response"),
|
|
146
|
+
q ? /* @__PURE__ */ i("div", { className: a.awaiting, children: [
|
|
147
|
+
/* @__PURE__ */ l("span", { className: n(h.pulseDot, a.awaitingDot) }),
|
|
148
|
+
"Awaiting response…"
|
|
149
|
+
] }) : /* @__PURE__ */ i(u, { children: [
|
|
150
|
+
V && /* @__PURE__ */ i(u, { children: [
|
|
151
|
+
/* @__PURE__ */ l("div", { className: h.asideSection, children: "Headers" }),
|
|
152
|
+
H(e.resHeaders).map((s) => /* @__PURE__ */ i("div", { className: a.kvRow, children: [
|
|
153
|
+
/* @__PURE__ */ l("span", { className: a.kvKey, children: s.k }),
|
|
154
|
+
/* @__PURE__ */ l("span", { className: a.kvVal, children: s.v })
|
|
155
|
+
] }, s.k))
|
|
156
|
+
] }),
|
|
157
|
+
/* @__PURE__ */ l(
|
|
158
|
+
R,
|
|
159
|
+
{
|
|
160
|
+
label: "Body",
|
|
161
|
+
value: e.resBody,
|
|
162
|
+
copyLabel: "Copy response payload"
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] })
|
|
166
|
+
] }),
|
|
167
|
+
!!w.length && /* @__PURE__ */ i(u, { children: [
|
|
168
|
+
N("Other fields"),
|
|
169
|
+
/* @__PURE__ */ l("div", { className: a.fieldList, children: w.map((s) => /* @__PURE__ */ l(f, { field: s, query: y, className: m?.field }, s.label)) })
|
|
170
|
+
] }),
|
|
171
|
+
K && /* @__PURE__ */ l("div", { className: a.emptyNote, children: "No further details for this event." })
|
|
172
|
+
] })
|
|
173
|
+
] });
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
export {
|
|
177
|
+
W as EventBadge,
|
|
178
|
+
f as FieldRow,
|
|
179
|
+
R as PayloadBlock,
|
|
180
|
+
le as TraceEventDetails
|
|
181
|
+
};
|
|
@@ -1,48 +1,9 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { TimelineSummaryPlacement } from './TimelineShared';
|
|
3
3
|
import { DraggablePosition } from '../Draggable';
|
|
4
|
+
import { TraceTimelineEvent } from './traceEvent';
|
|
4
5
|
import { TimelineWheelZoom } from './useTimeline';
|
|
5
|
-
|
|
6
|
-
* One request/response (or custom) event on the trace. Only `id`, `service`
|
|
7
|
-
* and `start` are required — everything else enriches the chip, tooltip and
|
|
8
|
-
* detail panel when present. Extra fields are allowed and participate in
|
|
9
|
-
* keyword matching.
|
|
10
|
-
*/
|
|
11
|
-
export interface TraceTimelineEvent {
|
|
12
|
-
/** Stable identifier. */
|
|
13
|
-
id: string;
|
|
14
|
-
/** Target component/service the event belongs to (colors the bar). */
|
|
15
|
-
service: string;
|
|
16
|
-
/** Caller shown as the chip's origin badge. @default 'client' */
|
|
17
|
-
source?: string;
|
|
18
|
-
/** Friendly operation id, bold in the chip (e.g. `create_manifest`). */
|
|
19
|
-
op?: string;
|
|
20
|
-
/** Technical request id (fallback chip label; shown in the detail panel). */
|
|
21
|
-
requestId?: string;
|
|
22
|
-
/** HTTP method for the detail panel badge. */
|
|
23
|
-
method?: string;
|
|
24
|
-
/** Full URL (detail panel + tooltip). */
|
|
25
|
-
url?: string;
|
|
26
|
-
/** Short label for the tooltip. Defaults to `method + path`. */
|
|
27
|
-
label?: string;
|
|
28
|
-
/** Query parameters (detail panel). */
|
|
29
|
-
query?: Record<string, string>;
|
|
30
|
-
/** Request headers (detail panel; `x-request-id` is surfaced). */
|
|
31
|
-
reqHeaders?: Record<string, string>;
|
|
32
|
-
/** Request body, pretty-printed as JSON in the detail panel. */
|
|
33
|
-
reqBody?: unknown;
|
|
34
|
-
/** Response status; `>= 400` renders as an error badge. */
|
|
35
|
-
status?: number;
|
|
36
|
-
/** Response headers (detail panel). */
|
|
37
|
-
resHeaders?: Record<string, string>;
|
|
38
|
-
/** Response body, pretty-printed as JSON in the detail panel. */
|
|
39
|
-
resBody?: unknown;
|
|
40
|
-
/** Start time, epoch ms (UTC display). */
|
|
41
|
-
start: number;
|
|
42
|
-
/** End time, epoch ms. `null`/`undefined` while in flight (bar grows live). */
|
|
43
|
-
end?: number | null;
|
|
44
|
-
[extra: string]: unknown;
|
|
45
|
-
}
|
|
6
|
+
export type { TraceTimelineEvent, TraceTimelineField, TraceTimelineLevel, } from './traceEvent';
|
|
46
7
|
export interface TraceTimelineClasses {
|
|
47
8
|
root: string;
|
|
48
9
|
toolbar: string;
|
|
@@ -149,8 +110,8 @@ export interface TraceTimelineProps {
|
|
|
149
110
|
summaryDefaultPosition?: DraggablePosition;
|
|
150
111
|
/**
|
|
151
112
|
* Sticky icon rail on the far right with two toggles docking a drawer
|
|
152
|
-
* beside the timeline: *Event details* (the
|
|
153
|
-
* empty state until an event is picked) and *Full log* (every event
|
|
113
|
+
* beside the timeline: *Event details* (the `TraceEventDetails` panel, with
|
|
114
|
+
* an empty state until an event is picked) and *Full log* (every event
|
|
154
115
|
* vertically with payloads and copy buttons). One drawer at a time; nothing
|
|
155
116
|
* is docked initially, but clicking an event opens the details drawer.
|
|
156
117
|
* With `false`, the rail and full log disappear and the details panel
|
|
@@ -159,6 +120,19 @@ export interface TraceTimelineProps {
|
|
|
159
120
|
showDock?: boolean;
|
|
160
121
|
/** Drawer docked open initially (uncontrolled). @default null */
|
|
161
122
|
defaultDock?: TraceTimelineDock;
|
|
123
|
+
/**
|
|
124
|
+
* List event keys the panel doesn't render itself (anything outside the
|
|
125
|
+
* documented ones) under an *Other fields* section in the details drawer.
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
showExtraFields?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Extra event keys to hide from the details drawer's *Other fields* section
|
|
131
|
+
* and exclude from keyword matching — for plumbing values (tenant ids,
|
|
132
|
+
* ingestion timestamps, …) that ride along on every event and would
|
|
133
|
+
* otherwise clutter the drawer or light up the whole trace when searched.
|
|
134
|
+
*/
|
|
135
|
+
hiddenFields?: string[];
|
|
162
136
|
/** Max height of the scrollable canvas. @default '80vh' */
|
|
163
137
|
maxHeight?: number | string;
|
|
164
138
|
/**
|
|
@@ -182,7 +156,7 @@ export interface TraceTimelineProps {
|
|
|
182
156
|
renderChip?: (event: TraceTimelineEvent, ctx: TraceTimelineItemContext) => ReactNode;
|
|
183
157
|
/** Replace the tooltip content. Return `null` to suppress it for that event. */
|
|
184
158
|
renderTooltip?: (event: TraceTimelineEvent, ctx: TraceTimelineItemContext) => ReactNode;
|
|
185
|
-
/** Replace the
|
|
159
|
+
/** Replace the detail panel content entirely; the panel shell is kept. */
|
|
186
160
|
renderDetails?: (event: TraceTimelineEvent, api: {
|
|
187
161
|
close: () => void;
|
|
188
162
|
pending: boolean;
|
|
@@ -202,9 +176,12 @@ export interface TraceTimelineProps {
|
|
|
202
176
|
* current-date marker; wheel-zoom, drag-pan, fit-to-width; keyword
|
|
203
177
|
* highlighting; in-flight events render dashed with a "now" line and grow
|
|
204
178
|
* live. A right-side icon rail docks one drawer at a time: *Event details*
|
|
205
|
-
* (
|
|
206
|
-
*
|
|
207
|
-
*
|
|
179
|
+
* (opened by clicking an event) or *Full log* (every event vertically with
|
|
180
|
+
* copy-to-clipboard payloads, kept in sync with timeline clicks both ways).
|
|
181
|
+
* Both adapt to the event: every value is introduced by its own label above
|
|
182
|
+
* it, and only the sections an event actually has are rendered — HTTP calls
|
|
183
|
+
* get Request/Response, plain events get Message/Payload/Details, unknown
|
|
184
|
+
* keys land under *Other fields*. An events-summary bubble sits bottom-left,
|
|
208
185
|
* expanding into a draggable panel that bands the events currently in view
|
|
209
186
|
* and navigates on click.
|
|
210
187
|
*
|