@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/llms.txt
CHANGED
|
@@ -1293,9 +1293,11 @@ Theming: `--crk-timeline-1..6` category palette (cycled over services/tags/rows)
|
|
|
1293
1293
|
#### TraceTimeline
|
|
1294
1294
|
One correlated request/response flow (a "manifest", an order, a saga) as duration bars on a single proportional time band (UTC display). Overlapping bars pack into vertical sub-rows; each event gets a collision-free description chip (`Origin → Target` tinted badges, bold operation id, start ISO) placed by a 3-pass nudging algorithm (never overlaps another chip; slides with an elbow line or accepts a stem crossing rather than hiding). Sticky two-rail UTC axis: cursor timestamp chip, teal `▸ start` chip for the hovered event, tick clock labels, `YYYY-MM-DD` labels only on day changes, and a sticky current-date label. Events whose interval contains the cursor time get a "hot" ring.
|
|
1295
1295
|
|
|
1296
|
-
**Dock rail + drawers (default on):** a sticky 44px icon rail on the far right toggles one docked drawer at a time — *Event details* (
|
|
1296
|
+
**Dock rail + drawers (default on):** a sticky 44px icon rail on the far right toggles one docked drawer at a time — *Event details* (its own uppercase header, an empty state until an event is picked, labeled fields throughout and Copy buttons beside every payload — sections adapt to the event, see below) or *Full log* (420px default: every event vertically — number, method/status (or level) chips, `source → service`, clock, op, path, message, `details` fields, then the payloads it has — PAYLOAD for plain events, REQUEST/RESPONSE for requests — stacked full-width, each with a Copy button that doesn't select the row). Drawers dock into the card row itself, flush against the timeline (full card height, square touching corners — no gap, so the canvas keeps every other pixel); the divider strip between card and drawer is a drag handle to resize drawer vs timeline (arrow keys work when it's focused). Nothing is docked initially; clicking an event opens the details drawer. Timeline↔log stay in sync both ways: clicking a timeline event (or summary row) scrolls an open log to that entry and flashes it; clicking a log entry selects the event and centers the timeline on it (centering waits for the drawer-induced resize to settle). `showDock={false}` removes the rail and full log — the details panel then simply opens/closes with the selection as before. The events-summary bubble (see the summary panel section) is also on by default.
|
|
1297
1297
|
|
|
1298
|
-
`TraceTimelineEvent`: `{ id: string; service: string; source?; op?; requestId?; method?; url?; label?; query?: Record<string,string>; reqHeaders?; reqBody?; status?: number; resHeaders?; resBody?; start: number; end?: number | null }` — only `id`, `service`, `start` required; extra fields allowed (searched by `highlight`). `end` unset = in flight (dashed bar, pulsing dot, "now" line, "Awaiting response…" panel).
|
|
1298
|
+
`TraceTimelineEvent`: `{ id: string; service: string; source?; op?; kind?: 'request' | 'event'; level?: 'debug' | 'info' | 'success' | 'warning' | 'error'; message?: string; payload?: unknown; details?: TraceTimelineField[]; requestId?; method?; url?; label?; query?: Record<string,string>; reqHeaders?; reqBody?; status?: number; resHeaders?; resBody?; start: number; end?: number | null }` — only `id`, `service`, `start` required; extra fields allowed (searched by `highlight`). `end` unset = in flight (dashed bar, pulsing dot, "now" line, "Awaiting response…" panel).
|
|
1299
|
+
|
|
1300
|
+
**Not every event is a request.** `kind` is inferred when omitted — `'request'` as soon as any of `method`/`url`/`status`/`query`/`reqHeaders`/`reqBody`/`resHeaders`/`resBody` is set, `'event'` otherwise — and the details drawer + full log render only the sections an event actually has, never an empty Request/Response scaffold. Plain events use: `message` (one-line description), `payload` (the generic body — the counterpart of `reqBody`/`resBody`, pretty-printed JSON, strings verbatim, with a copy button; an event may carry nothing else), `details?: TraceTimelineField[]` (`{ label, value, mono?, copy? }` — arbitrary labeled values in order: strings/numbers/booleans/React elements inline, objects/arrays as copyable JSON blocks) and `level` (badge in place of the status code: `error`/`warning` tinted, `success` accent, `info`/`debug` muted). `end: null` reads as *ongoing* (not "in flight"), `source` is not defaulted to `client` for plain events (the chip shows the service alone), and unknown keys are listed under an *Other fields* section (`showExtraFields={false}` to hide). Every value in the panel — identity, URL, request id, **Started / Ended / Duration** — is rendered as a labeled field with its label above it, stacked one per row (start and end are never put side by side).
|
|
1299
1301
|
|
|
1300
1302
|
Props:
|
|
1301
1303
|
- `events: TraceTimelineEvent[]` — one correlated set; correlation key is your concern.
|
|
@@ -1313,12 +1315,14 @@ Props:
|
|
|
1313
1315
|
- `summaryPlacement?: 'bubble' | 'left' | 'right' | 'top' | 'bottom' | 'floating'` — default `'bubble'`; `summaryDefaultPosition?: { x, y }` for floating.
|
|
1314
1316
|
- `showDock?: boolean` — default `true`. Dock rail + drawers (see above).
|
|
1315
1317
|
- `defaultDock?: 'details' | 'log' | null` (`TraceTimelineDock`) — drawer docked open initially; default `null`.
|
|
1318
|
+
- `showExtraFields?: boolean` — default `true`. Lists event keys the panel doesn't render itself under *Other fields*.
|
|
1319
|
+
- `hiddenFields?: string[]` — extra event keys to hide from the drawer's *Other fields* and exclude from keyword matching. For plumbing values that ride along on every event (tenant ids, ingestion timestamps, shared correlation ids) and would otherwise clutter the drawer or light up the whole trace when searched.
|
|
1316
1320
|
- `maxHeight?: number | string` — default `'80vh'` (caps the scrollable canvas).
|
|
1317
1321
|
- `minHeight?: number` — default `420`. Minimum event-band height, px (the sticky axis adds its 68px on top): sparse traces stretch to it with the bar band vertically centered; dense traces still grow past it.
|
|
1318
1322
|
- `selectedEventId?: string | null`, `defaultSelectedEventId?`, `onEventSelect?: (ev | null) => void`
|
|
1319
1323
|
- `renderChip?: (ev, ctx: TraceTimelineItemContext) => ReactNode` — replace the chip's inner content (chip box width is still estimated from the default text).
|
|
1320
1324
|
- `renderTooltip?: (ev, ctx) => ReactNode` — replace tooltip content; return `null` to suppress.
|
|
1321
|
-
- `renderDetails?: (ev, { close, pending }) => ReactNode` — replace the
|
|
1325
|
+
- `renderDetails?: (ev, { close, pending }) => ReactNode` — replace the detail panel content entirely (the drawer shell is kept).
|
|
1322
1326
|
- `classes?: Partial<TraceTimelineClasses>` where `TraceTimelineClasses = { root, toolbar, legend, card, scroller, axis, bar, chip, summary, search, drawer, log, rail, tooltip, footnote }`
|
|
1323
1327
|
|
|
1324
1328
|
Example:
|
|
@@ -1331,6 +1335,30 @@ Example:
|
|
|
1331
1335
|
/>
|
|
1332
1336
|
```
|
|
1333
1337
|
|
|
1338
|
+
#### TraceEventDetails
|
|
1339
|
+
Import: `import { TraceEventDetails } from '@overdoser/react-toolkit'`
|
|
1340
|
+
|
|
1341
|
+
The event inspector behind TraceTimeline's *Event details* drawer, exported standalone so the same panel can live in your own drawer, modal or split view. Same adaptive rules as the drawer: every value is rendered under its own label (identity, URL, request id and Started / Ended / Duration, each stacked on its own row), and only the sections the event has appear — Request/Response (query parameters, headers, bodies, "Awaiting response…" while in flight) for request-like events, Message/Payload/Details for plain ones, *Other fields* for unrecognized keys. It ships no shell of its own (no surface, border or scrolling) — wrap it in your own panel.
|
|
1342
|
+
|
|
1343
|
+
Props:
|
|
1344
|
+
- `event: TraceTimelineEvent` — the event to describe (required).
|
|
1345
|
+
- `now?: number` — "now" for an unfinished event's running duration, epoch ms; pass a ticking value to keep it live. Default `Date.now()`.
|
|
1346
|
+
- `highlight?: string` — keyword marked inside field values.
|
|
1347
|
+
- `showExtraFields?: boolean` — default `true`; `false` drops the *Other fields* section.
|
|
1348
|
+
- `hiddenFields?: string[]` — individual extra keys to leave out of *Other fields* (finer-grained than `showExtraFields`).
|
|
1349
|
+
- `onClose?: () => void` — adds a ✕ to the header row (omitted when absent).
|
|
1350
|
+
- `classes?: Partial<TraceEventDetailsClasses>` where `TraceEventDetailsClasses = { root, head, body, section, field }`; plus `className`, `style`. Forwards its ref to the root `div`.
|
|
1351
|
+
|
|
1352
|
+
```tsx
|
|
1353
|
+
<TraceEventDetails
|
|
1354
|
+
event={{ id: 'evt-1', service: 'Payments', op: 'payment.authorized', level: 'success',
|
|
1355
|
+
message: 'Authorized on the first attempt.', payload: { authCode: '88112' },
|
|
1356
|
+
start: t0, end: t1 }}
|
|
1357
|
+
/>
|
|
1358
|
+
```
|
|
1359
|
+
|
|
1360
|
+
The inference helpers behind the panel are exported too, so an app can make the same decisions (an error count in a header, a custom chip) without re-implementing them: `isRequestEvent(ev)` — the request/event decision described above; `badgeOf(ev, pending)` — the status/level badge as `{ text, tone } | null` with `tone: TraceBadgeTone = 'ok' | 'pending' | 'warn' | 'error'`; `extraFieldsOf(ev, hidden?)` — the unknown keys as `TraceTimelineField[]`, minus any `hidden` names.
|
|
1361
|
+
|
|
1334
1362
|
#### HistoryTimeline
|
|
1335
1363
|
The life of one subject as numbered event cards alternating around a central axis — above/below (horizontal) or left/right (vertical) — with collision-free placement: clustered side split, circles stepping outward in 20px levels, straight or Z-shaped leads, and dense bursts condensing into stacked groups. Three spacing modes: `equal` (index-based), `log` (gap-compressed — bursts stay readable next to huge gaps), `proportional` (linear time, real ticks from seconds to centuries). Fit expands the time axis until the card stacks fit the cross axis without scrolling. Tooltips appear only when they add information (truncated detail or ongoing).
|
|
1336
1364
|
|
package/manifest.json
CHANGED
|
@@ -3019,12 +3019,12 @@
|
|
|
3019
3019
|
"import": "import { TraceTimeline } from '@overdoser/react-toolkit'",
|
|
3020
3020
|
"element": "div",
|
|
3021
3021
|
"forwardsRef": true,
|
|
3022
|
-
"behavior": "
|
|
3022
|
+
"behavior": "Trace of one correlated flow on a single proportional UTC time band \u2014 HTTP calls, plain domain events, or both. Overlapping bars pack into sub-rows; description chips are placed collision-free (3-pass nudging). Ctrl/Cmd-wheel zoom (wheelZoom prop: 'ctrl' default | 'free' | 'none'), drag-pan, Fit, keyword highlight, hover tooltip. A right-side icon rail (default on) docks one drawer at a time: Event details (opened by clicking an event, empty state until then; every value rendered under its own label \u2014 Started/Ended/Duration stacked one per row \u2014 and only the sections the event actually has: Message/Payload/Details for plain events, Request/Response for requests, unknown keys under Other fields) or Full log (every event vertically with message, details fields and the payloads it has + copy buttons; kept in sync with timeline clicks both ways \u2014 timeline click scrolls/flashes the log entry, log click selects and centers the timeline). Drawers dock into the card row flush against the timeline (full card height, no gap); the divider strip between card and drawer drags to resize drawer vs timeline. An events-summary bubble (default on) sits bottom-left and expands into a draggable panel, dockable from its header as a full-height column flush beside the card (the timeline shrinks to make room) with the same resizable divider. Fully controlled data: pass the pre-filtered array; the component does no filtering/grouping. Items with an unset end render live (dashed/pulsing) and grow on an internal ticker until an update supplies end.",
|
|
3023
3023
|
"props": {
|
|
3024
3024
|
"events": {
|
|
3025
3025
|
"type": "TraceTimelineEvent[]",
|
|
3026
3026
|
"required": true,
|
|
3027
|
-
"notes": "TraceTimelineEvent = { id, service, start, source?, op?, requestId?, method?, url?, label?, query?, reqHeaders?, reqBody?, status?, resHeaders?, resBody
|
|
3027
|
+
"notes": "TraceTimelineEvent = { id, service, start, end?: number|null, source?, op?, kind?: 'request'|'event', level?: 'debug'|'info'|'success'|'warning'|'error', message?, payload?, details?: { label, value, mono?, copy? }[], requestId?, method?, url?, label?, query?, reqHeaders?, reqBody?, status?, resHeaders?, resBody? }. end unset = in flight (requests) / ongoing (plain events). kind is inferred when omitted: 'request' as soon as any of method/url/status/query/reqHeaders/reqBody/resHeaders/resBody is set, else 'event' \u2014 which drives which detail sections render. payload is the generic body for non-request events (counterpart of reqBody/resBody; an event may carry nothing but payload). details adds arbitrary labeled values (objects render as copyable JSON blocks). Extra keys are allowed, are searched by highlight and are listed under Other fields."
|
|
3028
3028
|
},
|
|
3029
3029
|
"title": {
|
|
3030
3030
|
"type": "ReactNode"
|
|
@@ -3103,6 +3103,15 @@
|
|
|
3103
3103
|
"default": null,
|
|
3104
3104
|
"notes": "Drawer docked open initially (uncontrolled). Type TraceTimelineDock."
|
|
3105
3105
|
},
|
|
3106
|
+
"showExtraFields": {
|
|
3107
|
+
"type": "boolean",
|
|
3108
|
+
"default": true,
|
|
3109
|
+
"notes": "Lists event keys the panel does not render itself under an Other fields section in the details drawer."
|
|
3110
|
+
},
|
|
3111
|
+
"hiddenFields": {
|
|
3112
|
+
"type": "string[]",
|
|
3113
|
+
"notes": "Extra event keys to hide from the drawer's Other fields section and exclude from keyword matching. For plumbing values that ride along on every event (tenant ids, ingestion timestamps, shared correlation ids) and would otherwise clutter the drawer or match every event when searched."
|
|
3114
|
+
},
|
|
3106
3115
|
"maxHeight": {
|
|
3107
3116
|
"type": "number | string",
|
|
3108
3117
|
"default": "80vh",
|
|
@@ -3154,6 +3163,45 @@
|
|
|
3154
3163
|
}
|
|
3155
3164
|
}
|
|
3156
3165
|
},
|
|
3166
|
+
"TraceEventDetails": {
|
|
3167
|
+
"import": "import { TraceEventDetails } from '@overdoser/react-toolkit'",
|
|
3168
|
+
"element": "div",
|
|
3169
|
+
"forwardsRef": true,
|
|
3170
|
+
"behavior": "Standalone event inspector \u2014 the panel behind TraceTimeline's Event details drawer, usable in any drawer/modal/split view. Adapts to the event instead of assuming an HTTP call: every value is rendered under its own label (identity, URL, request id and Started / Ended / Duration, each stacked on its own row) and only the sections the event has are shown \u2014 Request/Response (query parameters, headers, bodies, 'Awaiting response\u2026' while in flight) for request-like events, Message/Payload/Details for plain events, Other fields for unrecognized keys. Ships no shell (no surface/border/scrolling) \u2014 wrap it in your own panel. The inference helpers behind it are exported too: isRequestEvent(ev) (the request/event decision), badgeOf(ev, pending) (the status/level badge as { text, tone: TraceBadgeTone } | null), extraFieldsOf(ev, hidden?) (unknown keys as TraceTimelineField[], minus hidden names).",
|
|
3171
|
+
"props": {
|
|
3172
|
+
"event": {
|
|
3173
|
+
"type": "TraceTimelineEvent",
|
|
3174
|
+
"required": true,
|
|
3175
|
+
"notes": "Same model as TraceTimeline events; see the TraceTimeline entry."
|
|
3176
|
+
},
|
|
3177
|
+
"now": {
|
|
3178
|
+
"type": "number",
|
|
3179
|
+
"default": "Date.now()",
|
|
3180
|
+
"notes": "'Now' for an unfinished event's running duration, epoch ms. Pass a ticking value to keep it live."
|
|
3181
|
+
},
|
|
3182
|
+
"highlight": {
|
|
3183
|
+
"type": "string",
|
|
3184
|
+
"notes": "Keyword marked inside field values."
|
|
3185
|
+
},
|
|
3186
|
+
"showExtraFields": {
|
|
3187
|
+
"type": "boolean",
|
|
3188
|
+
"default": true,
|
|
3189
|
+
"notes": "Lists keys the panel does not render itself under an Other fields section."
|
|
3190
|
+
},
|
|
3191
|
+
"hiddenFields": {
|
|
3192
|
+
"type": "string[]",
|
|
3193
|
+
"notes": "Individual extra keys to leave out of Other fields; finer-grained than showExtraFields."
|
|
3194
|
+
},
|
|
3195
|
+
"onClose": {
|
|
3196
|
+
"type": "() => void",
|
|
3197
|
+
"notes": "Adds a close button to the header row; omitted when absent."
|
|
3198
|
+
},
|
|
3199
|
+
"classes": {
|
|
3200
|
+
"type": "Partial<TraceEventDetailsClasses>",
|
|
3201
|
+
"notes": "{ root, head, body, section, field }"
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
},
|
|
3157
3205
|
"HistoryTimeline": {
|
|
3158
3206
|
"import": "import { HistoryTimeline } from '@overdoser/react-toolkit'",
|
|
3159
3207
|
"element": "div",
|