@overdoser/react-toolkit 0.11.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 +2 -2
- package/CHANGELOG.md +94 -0
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +94 -84
- package/components/Timeline/GanttTimeline.d.ts +10 -0
- package/components/Timeline/GanttTimeline.js +193 -189
- package/components/Timeline/HistoryTimeline.d.ts +10 -0
- package/components/Timeline/HistoryTimeline.js +197 -193
- package/components/Timeline/Timeline.module.scss.js +114 -100
- package/components/Timeline/TimelineShared.d.ts +23 -2
- package/components/Timeline/TimelineShared.js +200 -127
- package/components/Timeline/TraceEventDetails.d.ts +92 -0
- package/components/Timeline/TraceEventDetails.js +181 -0
- package/components/Timeline/TraceTimeline.d.ts +34 -47
- package/components/Timeline/TraceTimeline.js +631 -612
- package/components/Timeline/TraceTimeline.module.scss.js +162 -144
- package/components/Timeline/demoData.d.ts +14 -0
- package/components/Timeline/index.d.ts +6 -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/components/Timeline/useTimeline.d.ts +11 -0
- package/components/Timeline/useTimeline.js +36 -32
- 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 +36 -5
- package/manifest.json +653 -166
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -446,7 +446,7 @@ Compound: `Draggable.Handle` — place inside to restrict the grab area (e.g. a
|
|
|
446
446
|
- `defaultPosition?: { x: number; y: number }` — uncontrolled initial offset. Default `{ x: 0, y: 0 }`.
|
|
447
447
|
- `position?: { x: number; y: number }` — controlled offset; pair with `onDrag` to update it.
|
|
448
448
|
- `axis?: 'both' | 'x' | 'y'` — default `'both'`.
|
|
449
|
-
- `bounds?: 'viewport' | 'parent' | 'none'` — default `'viewport'`. Clamps movement to the viewport / parent element, or unconstrained.
|
|
449
|
+
- `bounds?: 'viewport' | 'parent' | 'none'` — default `'viewport'`. Clamps movement to the viewport / parent element, or unconstrained. Clamping applies during drags and re-applies whenever the element or its bounds resize (content growth, window resize), so a dragged element can never end up stuck outside its bounds.
|
|
450
450
|
- `keyboardStep?: number` — px per arrow-key press on a focused handle. Default `10`.
|
|
451
451
|
- `disabled?: boolean` — default `false`.
|
|
452
452
|
- `onDragStart?(pos)`, `onDrag?(pos)`, `onDragEnd?(pos)` — each receives `{ x, y }`.
|
|
@@ -1286,16 +1286,18 @@ Three event-timeline views sharing one interaction model: wheel-zoom anchored at
|
|
|
1286
1286
|
|
|
1287
1287
|
Theming: `--crk-timeline-1..6` category palette (cycled over services/tags/rows), plus `--crk-timeline-*` chrome tokens (ink, muted, hairline, grid, accent, highlight amber…) defaulting to the design's warm paper palette; `--crk-timeline-font-mono` / `--crk-timeline-font-display` for the data/display fonts.
|
|
1288
1288
|
|
|
1289
|
-
**Summary panel (all three):** `showSummary` (default `false`; `true` on TraceTimeline) adds a dense one-line-per-item panel beside the timeline — every item numbered chronologically from `01`, a contiguous highlight band over the items currently visible in the viewport (auto-follows drag-panning by keeping the band centered in the list; suppressed while the pointer is over the panel so it can scroll independently), and click-to-navigate: the timeline smooth-scrolls (~900ms ease-out deceleration, cancelled by user wheel/grab, instant under `prefers-reduced-motion`) to center the picked item. `summaryPlacement` docks it `'left'` (default; `'bubble'` on TraceTimeline) / `'right'` of the timeline, renders it full-width `'top'` / `'bottom'` (rows flow into responsive columns), `'floating'` — a draggable palette anchored over the timeline, grabbed by its header (viewport-bounded, arrow-key movable when the handle is focused); `summaryDefaultPosition?: { x, y }` sets the floating start offset — or `'bubble'`: a collapsed pill anchored bottom-left of the timeline (heading + count + service-colored glyph) that expands in place into a draggable 262px panel with a "Tinted rows are in the viewport" footer; collapsing always snaps it back to its home corner (the dragged position is deliberately not persisted).
|
|
1289
|
+
**Summary panel (all three):** `showSummary` (default `false`; `true` on TraceTimeline) adds a dense one-line-per-item panel beside the timeline — every item numbered chronologically from `01`, a contiguous highlight band over the items currently visible in the viewport (auto-follows drag-panning by keeping the band centered in the list; suppressed while the pointer is over the panel so it can scroll independently), and click-to-navigate: the timeline smooth-scrolls (~900ms ease-out deceleration, cancelled by user wheel/grab, instant under `prefers-reduced-motion`) to center the picked item. `summaryPlacement` docks it `'left'` (default; `'bubble'` on TraceTimeline) / `'right'` of the timeline, renders it full-width `'top'` / `'bottom'` (rows flow into responsive columns), `'floating'` — a draggable palette anchored over the timeline, grabbed by its header (viewport-bounded, arrow-key movable when the handle is focused); `summaryDefaultPosition?: { x, y }` sets the floating start offset — or `'bubble'`: a collapsed pill anchored bottom-left of the timeline (heading + count + service-colored glyph) that expands in place into a draggable 262px panel with a "Tinted rows are in the viewport" footer; collapsing always snaps it back to its home corner (the dragged position is deliberately not persisted). The expanded panel's header has a dock toggle: docked, the panel becomes a full-height column flush left of the timeline card and the card shrinks to make room (nothing is overlaid, so sticky labels stay visible; no longer draggable). The visible divider strip between panel and card is a drag handle — drag (or arrow-key when focused) to resize summary vs timeline. Undocking floats the panel again, and dockedness — unlike the drag offset — survives collapse/re-expand.
|
|
1290
1290
|
|
|
1291
1291
|
**Customization layers (all three):** (1) `--crk-timeline-*` tokens for colors/fonts; (2) `classes` for per-element class overrides; (3) **render-prop slots to inject custom components** — `renderChip`/`renderCard`/`renderBar`+`renderRowLabel` replace an item's inner content (positioning/geometry stays component-owned), `renderTooltip(item, ctx)` replaces tooltip content (return `null` to suppress it for that item), `renderDetails(item, { close, … })` replaces the side-panel content (the sticky panel shell is kept; call `close()` from your own ✕). Each slot receives a context object (`*ItemContext`: resolved `color`, live flag, `durationMs`, index/number where relevant).
|
|
1292
1292
|
|
|
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.
|
|
@@ -1307,17 +1309,20 @@ Props:
|
|
|
1307
1309
|
- `compactRows?: boolean` — default `false`.
|
|
1308
1310
|
- `showGridlines?: boolean` — default `true`.
|
|
1309
1311
|
- `showControls?: boolean` — default `true` (zoom −/%/+/Fit).
|
|
1312
|
+
- `wheelZoom?: 'ctrl' | 'free' | 'none'` — default `'ctrl'`: zooms only while Ctrl/Cmd is held (plain scrolling passes through to the page; trackpad pinch still zooms — browsers report it as a ctrlKey wheel). `'free'` zooms on any scroll; `'none'` disables wheel zoom entirely (toolbar buttons still work).
|
|
1310
1313
|
- `showLegend?: boolean` — default `true`.
|
|
1311
1314
|
- `showSummary?: boolean` — default `true`. Summary panel (see above); picking a row also selects the event.
|
|
1312
1315
|
- `summaryPlacement?: 'bubble' | 'left' | 'right' | 'top' | 'bottom' | 'floating'` — default `'bubble'`; `summaryDefaultPosition?: { x, y }` for floating.
|
|
1313
1316
|
- `showDock?: boolean` — default `true`. Dock rail + drawers (see above).
|
|
1314
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.
|
|
1315
1320
|
- `maxHeight?: number | string` — default `'80vh'` (caps the scrollable canvas).
|
|
1316
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.
|
|
1317
1322
|
- `selectedEventId?: string | null`, `defaultSelectedEventId?`, `onEventSelect?: (ev | null) => void`
|
|
1318
1323
|
- `renderChip?: (ev, ctx: TraceTimelineItemContext) => ReactNode` — replace the chip's inner content (chip box width is still estimated from the default text).
|
|
1319
1324
|
- `renderTooltip?: (ev, ctx) => ReactNode` — replace tooltip content; return `null` to suppress.
|
|
1320
|
-
- `renderDetails?: (ev, { close, pending }) => ReactNode` — replace the
|
|
1325
|
+
- `renderDetails?: (ev, { close, pending }) => ReactNode` — replace the detail panel content entirely (the drawer shell is kept).
|
|
1321
1326
|
- `classes?: Partial<TraceTimelineClasses>` where `TraceTimelineClasses = { root, toolbar, legend, card, scroller, axis, bar, chip, summary, search, drawer, log, rail, tooltip, footnote }`
|
|
1322
1327
|
|
|
1323
1328
|
Example:
|
|
@@ -1330,6 +1335,30 @@ Example:
|
|
|
1330
1335
|
/>
|
|
1331
1336
|
```
|
|
1332
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
|
+
|
|
1333
1362
|
#### HistoryTimeline
|
|
1334
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).
|
|
1335
1364
|
|
|
@@ -1344,6 +1373,7 @@ Props:
|
|
|
1344
1373
|
- `showSearch?: boolean` — default `true`; `renderSearch?: ({ value, setValue }) => ReactNode` replaces the built-in box.
|
|
1345
1374
|
- `tagColors?: Record<string, string>` — overrides; known tags map to the palette, unknown tags cycle it.
|
|
1346
1375
|
- `showControls?: boolean` — default `true` (orientation + spacing toggles + zoom).
|
|
1376
|
+
- `wheelZoom?: 'ctrl' | 'free' | 'none'` — default `'ctrl'`: zooms only while Ctrl/Cmd is held (plain scrolling passes through to the page; trackpad pinch still zooms — browsers report it as a ctrlKey wheel). `'free'` zooms on any scroll; `'none'` disables wheel zoom entirely (toolbar buttons still work).
|
|
1347
1377
|
- `showLegend?: boolean` — default `true` (tag bullets).
|
|
1348
1378
|
- `showSummary?: boolean` — default `false`. Summary panel (see above); numbering matches the card numbers.
|
|
1349
1379
|
- `summaryPlacement?: 'left' | 'right' | 'top' | 'bottom' | 'floating' | 'bubble'` — default `'left'`; `summaryDefaultPosition?: { x, y }` for floating.
|
|
@@ -1376,6 +1406,7 @@ Props:
|
|
|
1376
1406
|
- `compactRows?: boolean` — default `false` (42px rows instead of 54px).
|
|
1377
1407
|
- `showGridlines?: boolean` — default `true`.
|
|
1378
1408
|
- `showControls?: boolean` — default `true`.
|
|
1409
|
+
- `wheelZoom?: 'ctrl' | 'free' | 'none'` — default `'ctrl'`: zooms only while Ctrl/Cmd is held (plain scrolling passes through to the page; trackpad pinch still zooms — browsers report it as a ctrlKey wheel). `'free'` zooms on any scroll; `'none'` disables wheel zoom entirely (toolbar buttons still work).
|
|
1379
1410
|
- `showSummary?: boolean` — default `false`. Summary panel (see above; heading "Tasks").
|
|
1380
1411
|
- `summaryPlacement?: 'left' | 'right' | 'top' | 'bottom' | 'floating' | 'bubble'` — default `'left'`; `summaryDefaultPosition?: { x, y }` for floating.
|
|
1381
1412
|
- `maxHeight?: number | string` — default `'74vh'`.
|