npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@exodus/datapoints-react

v3.4.0

Published

Headless React components for provenance-backed datapoint reports: unstyled, data-attribute driven, built on the @exodus/datapoints contract

Readme

@exodus/datapoints-react

Headless React components for provenance-backed datapoint reports. Renders the @exodus/datapoints report payload — a title, prose with value pills and a verify list with per-datapoint audit panels — with zero styles. Every visual state is exposed as a data-* attribute, so any design system styles it with plain CSS.

Install

npm install @exodus/datapoints-react

React 19 is a peer dependency. @exodus/datapoints (the payload contract) comes along as a regular dependency.

Rendering a report

import { DataReport } from '@exodus/datapoints-react';

function Report({ payload, sourceText }: { payload: unknown; sourceText?: string }) {
  return (
    <DataReport.Root payload={payload} text={sourceText}>
      <DataReport.Title />
      <DataReport.Summary />
      <DataReport.Prose />
      <DataReport.VerifySummary />
      <DataReport.Table />
    </DataReport.Root>
  );
}

payload is validated with the contract's reportPayloadSchema; an invalid payload renders nothing and calls onInvalid. text is the placeholder source ({{dp:id}} / {{lit:text}}) — when provided, DataReport.Prose renders it with clickable value pills (onPillClick on the root receives the datapoint id). When the prop is absent, the root falls back to the payload's own optional text field, so a persisted payload that carries its source renders prose and charts without the caller threading the text through.

DataReport.Title renders the payload's title as <h2 data-report-title> and DataReport.Summary its summary as <p data-report-summary>. Both hold the same placeholders as text, so they render value pills (and **bold** / *italic*), and each renders nothing when its field is absent.

DataReport.VerifySummary renders <span data-verify-summary> with one [data-verify-count] per count. human-reviewed ("3 human-reviewed") counts curated datapoints and is always shown, even at zero. human-approved ("1 human-approved") counts custom datapoints approved in a report review, ai-reviewed ("1 AI-reviewed") the rest of the custom ones, and stale ("1 stale") the expired ones; these three show only when non-zero. The counts cover every datapoint in the payload, inputs included, using each datapoint's own tier, and the stale count follows the clock.

DataReport.Prose renders a markdown subset so a report can be structured: paragraphs (blank-line separated, soft breaks kept), bullet lists (- / * ), GFM tables (header, |---| separator, rows), **bold** and *italic*. A value pill works anywhere text does, including inside a table cell. Out of scope on purpose: column alignment colons are accepted but not carried through, pipes cannot be escaped, and anything else renders as plain text. The root is a <div data-report-prose> (previously a <p>; a breaking change for consumers selecting on the tag); paragraphs are <p data-prose-paragraph>, lists <ul data-prose-list>, tables <table data-prose-table>.

Refresh now and freshness

DataReport.Source takes an optional automation slug. With it, DataReport.RefreshButton renders a <button data-report-refresh> (aria-busy and disabled while running) that posts to ../bridge/api/automations/<slug>/run, waits for the run, then re-fetches src. A failure renders <span data-report-refresh-error role="alert"> and keeps the current report. Without the slug the button renders nothing. With the slug, a src that returns 404 (no run has written it yet) starts the automation once on load. onRefreshError receives a failed run, including that first one, since nothing renders until a report exists. The route is Bridge's, reached through the workspace's shared URL, so it only works for the workspace owner. DataReport.Freshness renders <p data-report-freshness> ("As of Nov 18, 2026 · fetched Nov 19, 9:05 AM") from the payload. useDataReportSource also returns refetch(), a ResultAsync that re-fetches on demand.

Charts

A report puts series datapoints (value is an ordered list of { label, value } points) on a chart with a fenced block the gateway has already validated:

```chart
kind: line
title: Monthly MTU
series:
  - {{dp:custom_mtu_monthly_1a2b3c4d}}
```

DataReport.Prose lifts the block out of the prose and renders it with Chart (or StatTiles for kind: stat), looking each id up in the payload. Points align by index and the first series supplies the category labels. A block that fails to parse renders as plain prose rather than disappearing. A series id the payload lacks, or that resolves to a scalar datapoint, is not drawn: the <figure> carries data-missing with the space-separated ids and the legend keeps an entry per missing id marked data-missing (no swatch, no data-series-index), the same hook [data-value-pill][data-missing] offers. Outside a chart, a series placeholder renders its formatted summary as an ordinary pill; the audit panel for a series row draws its points in the Points tab.

Kinds and options

| Block | Rendering | | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | kind: line | one [data-series-line] path and [data-point] markers per series, overlaid | | kind: bar | one rect[data-point] per point per series, grouped per category from a zero baseline, with text[data-bar-value] labels (see below) | | kind: area | line plus a path[data-area] polygon closed along the baseline | | kind: stat | StatTiles: a [data-stat-grid] of [data-stat-tile] KPI tiles instead of an svg | | stacked: true | bars share one slot and areas nest; each series is offset by the cumulative total of the series listed before it, and the domain covers the stacked totals | | orientation: horizontal | bars grow rightward from the zero baseline, categories run down the y axis, value ticks along the x axis | | layout: multiples | one [data-chart-panel] per series in a [data-chart-panels] wrapper, each with its own svg, domain and unit; a [data-panel-title] replaces the legend | | target: {{dp:id}} | a [data-target] reference line at the scalar value (it extends the domain), with the formatted value as an end label and a [data-legend-target] entry |

Bar charts label their values with <text data-bar-value> (the value formatted with the series unit) when they draw 12 or fewer visible bars (categories × side-by-side series; a stack counts as one); above that no label renders and hover shows the values. A vertical bar's label sits above it (below for negatives), a horizontal bar's past its end. A stacked segment's label sits inside the segment and is dropped when the segment is too small for it, and each stack gets its net total past its end as <g data-bar-totals> > <text data-bar-value data-bar-total data-label>. Labeled charts pad the value domain so labels stay inside the plot; the axis ticks keep the unpadded domain.

Figure attributes mirror the spec: data-chart-kind, data-chart-layout, data-chart-stacked and data-chart-orientation are present when set.

Chart and StatTiles are also exported on their own:

import { Chart, StatTiles } from '@exodus/datapoints-react';

<Chart
  spec={{ kind: 'bar', title: 'Revenue', stacked: true, series: [revenue.id, cost.id] }}
  series={[
    { id: revenue.id, unit: revenue.unit, points: revenue.value },
    { id: cost.id, unit: cost.unit, points: cost.value },
  ]}
  target={{ id: goal.id, value: goal.value, formatted: goal.formatted }}
  onLegendClick={(id) => openAudit(id)}
/>;

<StatTiles
  title="Headline"
  entries={[{ id: mtu.id, datapoint: mtu }]}
  onTileClick={(id) => openAudit(id)}
/>;

The SVG is hand-drawn with no dependencies and no colors or sizes of its own: it carries a viewBox (640×240) and scales to whatever width the consumer gives it. Inside a [data-chart-fit] ancestor whose size the consumer sets, the plot widens its viewBox to the container's aspect (never below 640) so it fills both dimensions without stretching. The [data-chart-fit] opt-in is resolved when the plot mounts; adding or removing the attribute later has no effect until the chart remounts. Each series' stroke/fill is var(--chart-series-N, currentColor) (N from 1), so a consumer sets up to eight series colors once:

[data-chart] {
  --chart-series-1: var(--accent);
  --chart-series-2: teal;
}
[data-chart] svg {
  width: 100%;
  height: auto;
}
[data-chart-kind='line'] [data-series-line],
[data-chart-kind='area'] [data-series-line] {
  stroke-width: 2;
}
[data-chart-kind='area'] [data-area] {
  fill-opacity: 0.18;
}
[data-target] line {
  stroke: gray;
  stroke-dasharray: 4 3;
}
[data-chart-panels] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
[data-stat-grid] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}
[data-sparkline] {
  width: 6rem;
  height: 2rem;
  color: var(--chart-series-1);
}
[data-axis] text {
  font-size: 10px;
  fill: gray;
}

Vocabulary: <figure data-chart data-chart-kind> wraps <figcaption data-chart-title>, a <div data-plot> holding the <svg role="img"> (labelled by the title or the series ids) and, while a point is hovered, the tooltip, and <ul data-chart-legend>. Inside the svg: <g data-axis="y"> and <g data-axis="x"> hold [data-tick] entries; value ticks carry data-value, a [data-gridline] and the value formatted with the series unit, category labels carry data-label and are thinned to at most twelve on the x axis. Which axis carries values follows the orientation. Each series is <g data-series data-series-index data-datapoint-id> with a [data-series-line] path on line and area charts, a [data-area] polygon on area charts, and one [data-point data-label data-value] marker or bar per point, each with a <title> ("label · formatted value"; a stacked shape reports its own value, not the running total). <g data-target data-value data-datapoint-id> holds the reference line and its <text> label. Legend entries are <button data-legend-item data-datapoint-id data-series-index> with a [data-legend-swatch] and the datapoint id without its hash (data-missing in place of the index and swatch, or data-legend-target for the target); clicking one calls the root's onPillClick, so the same audit flow opens for a chart as for a pill.

Interaction

Charts answer the cursor and the keyboard without a dependency, and expose every state as data attributes so the consumer decides what it looks like:

  • A transparent <rect data-hover-overlay> covers the plot. Moving or pressing a pointer over it snaps to the nearest point (line and area by point spacing, bars by slot; horizontal bars read the row from y). The <svg> and, for a single plot, the figure carry data-hover-index; each [data-chart-panel] of a multiples chart hovers on its own.
  • While hovered the svg draws <line data-crosshair> through the point (vertical, or horizontal for horizontal bars) and every marker or bar at that index gets data-hovered.
  • A <div data-tooltip role="status" aria-live="polite"> follows the svg inside [data-plot], referenced by the svg's aria-describedby. It holds [data-tooltip-label] (the point label) and one <div data-tooltip-row data-series-index data-datapoint-id> per series with a [data-legend-swatch], [data-tooltip-name] (the id without its hash) and [data-tooltip-value] (the point formatted with the series unit); a target adds a row with data-tooltip-target. The tooltip's only inline style is two custom properties, --tooltip-x and --tooltip-y, the anchor as fractions of the svg box (the point x and the plot top; the plot middle and the row y for horizontal bars), so CSS positions it relative to [data-plot].
  • The svg is focusable (tabindex="0"): ArrowLeft/ArrowRight step the index, Home/End jump, Escape clears, and losing focus clears. Pointer leave clears.
  • Hovering or focusing a legend entry sets data-highlight-series on the figure and data-dimmed on every other [data-series]; leaving or blurring clears it. Clicking still calls onPillClick.

Stat tiles have no hover state; the sparkline is decoration for the value.

[data-plot] {
  position: relative;
}
[data-hover-overlay] {
  cursor: crosshair;
}
[data-crosshair] {
  stroke: gray;
  stroke-dasharray: 2 2;
}
circle[data-point][data-hovered] {
  r: 5;
}
[data-series][data-dimmed] {
  opacity: 0.3;
  transition: opacity 150ms;
}
[data-tooltip] {
  position: absolute;
  top: calc(var(--tooltip-y) * 100%);
  left: clamp(6rem, var(--tooltip-x) * 100%, calc(100% - 6rem));
  transform: translateX(-50%);
  pointer-events: none;
}

Stat tiles: <div data-chart data-chart-kind="stat" data-stat-grid> holds an optional [data-chart-title] and one <article data-stat-tile data-datapoint-id> per entry wrapping a <button data-stat-open> with [data-stat-label] (the datapoint description, else its id without the hash) and [data-stat-value] (a scalar's formatted, or a series' last value formatted with its unit). A series tile adds <svg data-sparkline> (a [data-series-line] path and a [data-sparkline-last] marker, no axes) and [data-stat-span] with the first and last labels. A missing id renders the tile with data-missing and no value. Tiles never derive numbers the payload does not carry.

Verify list

DataReport.Table renders <ul data-report-list>. Datapoints referenced by a placeholder in the title, summary or text come first, in order of first reference; the rest are formula inputs, in payload order, each marked data-role="input". A report with no source text at all keeps payload order and marks nothing as an input.

Before the first input sits one <li data-inputs-heading> holding the label "Formula inputs" and a button[data-help] whose accessible name and data-tip carry INPUTS_HELP, a short explanation of why those rows appear. It is absent when every row is referenced. Select rows with li[data-datapoint-id] to skip it.

Each datapoint is an <li data-datapoint-id data-tier data-kind> (plus data-custom, data-stale, data-expanded and data-role when they apply) holding a <button aria-expanded aria-controls> toggle and, after it, the detail region. The toggle starts with a [data-row-caret] glyph (› collapsed, ⌄ expanded), then one <span data-column> per column. The datapoint cell has a ReviewMark (an inline SVG, shield for human-reviewed, warning triangle for ai-reviewed, with the explanation in its title, styled through [data-review-mark][data-tier]) followed by <span data-datapoint-name>. The value cell shows formatted, or a sparkline and the latest value for a series. The source cell is <span data-datapoint-source data-source-kind>: query with the source id, formula with Formula, or constant with Constant. The retrieved cell is <span data-retrieved> with the relative time, Stale · <relative> once the freshness window has passed, or Never expires for constants; its title holds the absolute time.

The detail region is a <div data-audit-row data-datapoint-id> whose id is unique per rendered row and matches the toggle's aria-controls. It holds DataReport.AuditPanel, a <div data-audit-content> with these parts in order:

  1. <p data-about>: the custom question, else the description.
  2. <div data-chips>: a [data-chip="freshness"] with data-state fresh ("Fresh · 4:02 PM, valid 5m" plus a <span data-meter> whose --used custom property is the used share of the window, 0–1), expired ("Expired 1 minute ago · 4:02 PM, valid 5m"), constant ("Constant value, never expires") or unbounded ("Retrieved 4:02 PM"); a [data-chip="period"] for a custom period; and one [data-chip="as-of"][data-query-id] per dated provenance entry ("Data as of Sep 1, 2026").
  3. <div data-ai-notice role="note"> for ai-reviewed datapoints.
  4. <code data-formula> for derived values: each input is a <button data-formula-input data-datapoint-id> that calls the root's onPillClick, and every operator, parenthesis or number is a [data-formula-op].
  5. <div data-audit-tabs> when there is a query or a series value: a role="tablist" of button[role="tab"][data-tab] (Query with the source id and Points with the point count, each in a [data-tab-count]), a <button data-copy> and a role="tabpanel" [data-tab-panel]. Copy writes the query text, or label,value CSV on Points (labels starting with =, +, -, @ or a tab get a leading '), to the clipboard and then sets data-copied for 1.6 seconds, so a CSS animation on [data-copy][data-copied] shows the flash.
    • The Query pane is <pre data-query data-language> with one [data-line="<n>"] per line and one [data-token="<prism types>"] per token (tokenized by prism-react-renderer, no theme). Before highlighting, a per-language formatter lays the query out for reading (SQL via sql-formatter, with the Spark dialect for databricks and ClickHouse for clickhouse; word case is never changed). Text the formatter cannot parse, and languages with no formatter, render as stored. Copy always copies the stored text. Queries over 7 lines are clamped (data-clamped) behind a <button data-clamp-toggle aria-expanded> ("Show all N lines" / "Show less").
    • The Points pane is <div data-points> with a [data-zero-line] (--y), a <div role="group" aria-label="Series points" data-point-bars> holding one <button data-point data-label data-value> bar per point (--x, --width, --top, --height, all 0–1 fractions of the pane, and data-mark with high, low and last), at most six [data-point-labels] [data-point-label] (--x; YYYY-MM labels as short month names) and a [data-readout] with [data-readout-label], [data-readout-value], [data-readout-change] ("▲ 5.0%") and the [data-readout-high] / [data-readout-low] points. Hovering or focusing a bar shows it in the readout and marks it data-active; otherwise the last point is shown.

Collapsed regions stay mounted so they can animate. That means the audit content (query, formula) is always present in the rendered HTML; hidden and inert are presentation, not access control, so do not rely on the collapsed state to keep audit detail out of the DOM. Detail regions carry [data-collapsible], get hidden + inert while collapsed and data-expanded while open, and aria-controls always resolves. The collapsible's only child is an unstyled <div> wrapping the audit content, so a consumer can clip it without fighting the content's padding or border. Unstyled, hidden keeps them out of the way; to animate, override [hidden] and transition the wrapper:

[data-audit-row][hidden] {
  display: block;
}
[data-collapsible] {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 200ms;
}
[data-collapsible] > * {
  overflow: hidden;
  min-height: 0;
}
[data-collapsible][data-expanded] {
  grid-template-rows: 1fr;
}

onExpandedChange(expandedIds, changed) receives { datapointId, expanded } for the row that toggled, so a consumer can scroll the right region into view.

Styling

Everything is addressable through data attributes:

[data-report-list] li[data-tier='ai-reviewed'] {
  /* caution tint */
}
[data-report-list] li[data-stale] [data-retrieved] {
  color: orange;
}
[data-value-pill] {
  font-variant-numeric: tabular-nums;
}
li[data-expanded] {
  background: color-mix(in srgb, currentColor 6%, transparent);
}

These attributes are the stable styling surface, so consumers such as @ai/ui's chat.css can lay out a report without reaching into its markup:

| Attribute | Element | | ---------------------- | ------------------------------ | | data-report-prose | the prose container | | data-prose-paragraph | each prose paragraph | | data-chart | each chart figure | | data-chart-title | the chart caption, when titled | | data-plot | the box around a chart's SVG |

Staleness is computed client-side on a live interval from each datapoint's retrievedAt and freshness; a value past its freshness window gets data-stale.

Columns

<DataReport.Table
  columns={[
    { key: 'datapoint' },
    { key: 'value', render: (datapoint) => <strong>{datapoint.formatted}</strong> },
    { key: 'custom', id: 'unit', render: (datapoint) => datapoint.unit },
  ]}
/>

Built-in columns: datapoint, value, source, retrieved (that order is the default). A built-in column's render overrides its default cell; custom columns add new ones. The list has no header row, so columns carry no header. Cells render inside the row's toggle <button>, so a renderer must return non-interactive phrasing content (no links, buttons or inputs); the button's accessible name is its cells' text.

Reference

| Export | Purpose | | ------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | DataReport.Root | Validation, context, expansion state (expandedIds/onExpandedChange for controlled mode) | | DataReport.Title / .Summary | The payload's title and summary with value pills | | DataReport.Prose | Placeholder text with value pills | | DataReport.VerifySummary | Human-reviewed, AI-reviewed and stale counts | | DataReport.Table / .Row / .AuditPanel | The verify list and its audit detail | | Chart | Headless SVG line/bar/area chart over series datapoints (ChartProps, ChartSeries, ChartTarget) | | StatTiles | Headless KPI tiles for scalar and series datapoints (StatTilesProps, StatEntry) | | ReviewMark, REVIEW_MARK_TITLES | Tier icon with tooltip text, for custom cells | | QueryPane | Highlighted, numbered, clamped query; isVerbatim skips formatting | | useRelativeTime | Live relative/absolute time + staleness for custom cells | | DEFAULT_COLUMNS, ColumnConfig | Column configuration |