Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .changeset/portable-chart-barrels.md

This file was deleted.

7 changes: 7 additions & 0 deletions .changeset/universal-chart-barrels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@tanstack/charts': minor
---

Add environment-safe `/universal` and `/types` entry points, including generic
tooltip-extension token contracts for non-DOM hosts, while preserving the
existing browser-oriented root exports.
Comment on lines +5 to +7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Name both token contracts in the changeset.

The changeset mentions tooltip-extension token contracts but does not explicitly mention portal-token contracts. Name both tooltip and portal token contracts so the release note matches the public API.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.changeset/universal-chart-barrels.md around lines 5 - 7, Update the
changeset description to explicitly name both tooltip-extension and portal-token
contracts, while preserving its existing statements about the /universal and
/types entry points and browser-oriented root exports.

26 changes: 15 additions & 11 deletions API-FRICTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3690,22 +3690,26 @@ Each entry records:
platform-neutral, but the root value barrel made bundlers traverse DOM hosts,
adapters, reconciliation, and SVG surfaces. Its type graph also declared
`Element`, `HTMLElement`, and `SVGSVGElement`, so a non-DOM consumer could
not select the portable contracts as one supported entry.
not select the universal contracts as one supported entry.
- Decision: preserve the existing browser-oriented root API and add
`@tanstack/charts/portable` for common authoring/runtime values plus
`@tanstack/charts/types` for portable contracts. DOM surface, renderer, host,
and render-context types now live behind an internal module while retaining
their existing root re-exports. Definition inputs retain DOM-free extension
token contracts while typed tooltip and portal lifecycles remain in the DOM
module. Do not conditionally change the root until a native host can test one
coherent platform contract.
`@tanstack/charts/universal` for common authoring/runtime values plus
`@tanstack/charts/types` for universal contracts. The name describes the
supported cross-runtime surface while the browser-first root remains the
normal web entry. DOM surface, renderer, host, and render-context types now
live behind an internal module while retaining their existing root
re-exports. Definition inputs retain DOM-free extension token contracts while
the generic tooltip and portal token interfaces are exported for host-adapter
authors. Typed DOM tooltip and portal lifecycles remain in the DOM module. Do
not conditionally change the root until a native host can test one coherent
platform contract.
- Verification: root typechecking and 61 focused core tests pass. The packed
package gate resolves both new entries from `dist`, compiles their
declarations, including tooltip definition inputs, with Web Worker rather
than DOM globals. Type regressions reject swapping tooltip and portal tokens.
declarations, including tooltip definition inputs and direct generic-token
imports, with Web Worker rather than DOM globals. Type regressions reject
swapping tooltip and portal tokens.
The packed bundle proof excludes the root, adapters, Canvas, DOM host/text,
browser export, reconciliation, renderer, and SVG surface modules. That full
portable barrel measures 53.95 kB minified and 16.60 kB gzip; granular
universal barrel measures 53.95 kB minified and 16.60 kB gzip; granular
subpaths remain the bundle-sensitive option.

### F-155 — Optional tooltip code burdened every chart consumer
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ require the chart-definition migration above.

### Added

- Added environment-safe `@tanstack/charts/universal` and
`@tanstack/charts/types` entry points for cross-runtime chart definitions,
scene compilation, and extension contracts. The existing `@tanstack/charts`
root remains the browser-oriented entry point.

- Added the optional compact scale package:

```sh
Expand Down
28 changes: 14 additions & 14 deletions benchmarks/comparison/bundle-baseline.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schemaVersion": 3,
"generatedAt": "2026-07-31T19:37:47.858Z",
"generatedAt": "2026-07-31T20:36:32.985Z",
"packageVersions": {
"tanstack": "0.0.2",
"chartjs": "4.5.1",
Expand All @@ -11,7 +11,7 @@
"sources": {
"tanstack": {
"kind": "workspace",
"revision": "b1bba0e6e22fab1099f27afab165d07d283244e9"
"revision": "2be6729b5e73afe553cb17b1c054f04dda00a614"
},
"chartjs": {
"kind": "package",
Expand Down Expand Up @@ -45,10 +45,10 @@
"bundles": {
"tanstack-line-basic": {
"minifiedBytes": 63594,
"gzipBytes": 24325,
"brotliBytes": 21616,
"incrementalGzipBytes": 24325,
"incrementalBrotliBytes": 21616
"gzipBytes": 24326,
"brotliBytes": 21671,
"incrementalGzipBytes": 24326,
"incrementalBrotliBytes": 21671
},
"tanstack-line-interactive": {
"minifiedBytes": 68776,
Expand Down Expand Up @@ -80,17 +80,17 @@
},
"tanstack-bar-advanced": {
"minifiedBytes": 71759,
"gzipBytes": 27019,
"brotliBytes": 23947,
"incrementalGzipBytes": 27019,
"incrementalBrotliBytes": 23947
"gzipBytes": 27018,
"brotliBytes": 23957,
"incrementalGzipBytes": 27018,
"incrementalBrotliBytes": 23957
},
"tanstack-area-basic": {
"minifiedBytes": 63472,
"gzipBytes": 24298,
"brotliBytes": 21643,
"incrementalGzipBytes": 24298,
"incrementalBrotliBytes": 21643
"gzipBytes": 24300,
"brotliBytes": 21642,
"incrementalGzipBytes": 24300,
"incrementalBrotliBytes": 21642
},
"tanstack-area-interactive": {
"minifiedBytes": 68658,
Expand Down
4 changes: 2 additions & 2 deletions docs/comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ evidence without turning untested behavior into a checkmark.

| Library | Package | Measured source |
| -------------------------------------------------------------------------------------- | -------------------- | ------------------- |
| [TanStack Charts](./overview.md) | `@tanstack/charts` | workspace `b1bba0e` |
| [TanStack Charts](./overview.md) | `@tanstack/charts` | workspace `4a8a256` |
| [Chart.js](https://www.chartjs.org/docs/latest/) | `chart.js` | npm `4.5.1` |
| [Apache ECharts](https://echarts.apache.org/handbook/en/best-practices/canvas-vs-svg/) | `echarts` | npm `6.1.0` |
| [Recharts](https://recharts.github.io/en-US/) | `recharts` | npm `3.10.1` |
| [Observable Plot](https://observablehq.com/plot/features/plots) | `@observablehq/plot` | npm `0.6.17` |

The competitor versions are exact package pins, not latest versions inferred
at page render time. The measured TanStack workspace revision is `b1bba0e`.
at page render time. The measured TanStack workspace revision is `4a8a256`.

## Capability matrix

Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ import { mountChart } from '@tanstack/charts/dom'
import { renderChartSvg } from '@tanstack/charts/svg'
```

Use the portable barrel when definitions and scene compilation must not make
Use the universal barrel when definitions and scene compilation must not make
the browser host reachable:

```ts
import {
createChartRuntime,
defineChart,
lineY,
} from '@tanstack/charts/portable'
} from '@tanstack/charts/universal'
import type { ChartDefinition } from '@tanstack/charts/types'
```

Expand Down
6 changes: 3 additions & 3 deletions docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ select the optional Canvas renderer; their `/core` entries require an explicit
## Import map

The root `@tanstack/charts` entry point exports the common grammar, runtime,
scene, SVG renderer, browser host, and their public types. The portable entry
scene, SVG renderer, browser host, and their public types. The universal entry
excludes browser hosts and adapters. Granular subpaths keep optional
capabilities and individual marks independently tree-shakeable.

Expand Down Expand Up @@ -87,7 +87,7 @@ capabilities and individual marks independently tree-shakeable.
| `@tanstack/charts/link` | `link` |
| `@tanstack/charts/mark/scale-values` | `createMarkWithScaleValues` |
| `@tanstack/charts/polar` | `polar`, radial arc/line/area/dot marks, and radial/angle guides |
| `@tanstack/charts/portable` | Common root authoring, runtime, scene, and static SVG values without browser hosts or adapters |
| `@tanstack/charts/universal` | Common root authoring, runtime, scene, and static SVG values without browser hosts or adapters |
| `@tanstack/charts/reconcile` | `reconcileChartSvg` |
| `@tanstack/charts/rect` | `rect`, `cell` |
| `@tanstack/charts/renderer` | `mountChartRenderer` |
Expand All @@ -99,7 +99,7 @@ capabilities and individual marks independently tree-shakeable.
| `@tanstack/charts/svg/resources` | `renderChartSvgWithResources` |
| `@tanstack/charts/text` | `text` |
| `@tanstack/charts/tick` | `tickX`, `tickY` |
| `@tanstack/charts/types` | Portable definition, mark, scene, runtime, focus, and tooltip-model types |
| `@tanstack/charts/types` | Universal definition, mark, scene, runtime, focus, and tooltip-model types |
| `@tanstack/charts/vector` | `vector` |

Import from the narrowest stable entry point when bundle isolation matters.
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,14 @@ See [DOM host](./dom-host.md) and
| `ChartSpatialIndexFactory` | Builds an index from current scene points |
| `ChartExtensionInput` | Generic bare-token or `{ use, ...options }` extension input |
| `ChartTooltipInput` | Tooltip extension token or configured extension options |
| `ChartTooltipExtensionToken` | Environment-neutral contract implemented by host tooltip extensions |
| `ChartTooltipExtension` | Tooltip lifecycle implementation |
| `ChartTooltipExtensionContext` | Container, dismissal, and adapter-body bridge given to a tooltip |
| `ChartTooltipExtensionInstance` | Tooltip update, paint, hide, containment, and destroy lifecycle |
| `ChartTooltipPaintContext` | Focused points, scene, surface, pointer, and pinned state |
| `ChartTooltipOptions` | Native tooltip content, ordering, anchoring, and pinning |
| `ChartTooltipPortalInput` | Portal extension token or configured transport options |
| `ChartTooltipPortalExtensionToken` | Environment-neutral contract implemented by host portal extensions |
| `ChartTooltipPortalExtension` | Tooltip transport lifecycle implementation |
| `ChartTooltipPortalExtensionContext` | Container, tooltip element, and reposition callback given to a portal |
| `ChartTooltipPortalExtensionInstance` | Portal update, position, hide, and destroy lifecycle |
Expand Down
4 changes: 2 additions & 2 deletions packages/charts-core/docs/comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ evidence without turning untested behavior into a checkmark.

| Library | Package | Measured source |
| -------------------------------------------------------------------------------------- | -------------------- | ------------------- |
| [TanStack Charts](./overview.md) | `@tanstack/charts` | workspace `b1bba0e` |
| [TanStack Charts](./overview.md) | `@tanstack/charts` | workspace `4a8a256` |
| [Chart.js](https://www.chartjs.org/docs/latest/) | `chart.js` | npm `4.5.1` |
| [Apache ECharts](https://echarts.apache.org/handbook/en/best-practices/canvas-vs-svg/) | `echarts` | npm `6.1.0` |
| [Recharts](https://recharts.github.io/en-US/) | `recharts` | npm `3.10.1` |
| [Observable Plot](https://observablehq.com/plot/features/plots) | `@observablehq/plot` | npm `0.6.17` |

The competitor versions are exact package pins, not latest versions inferred
at page render time. The measured TanStack workspace revision is `b1bba0e`.
at page render time. The measured TanStack workspace revision is `4a8a256`.
Comment on lines +15 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Regenerate this documentation copy instead of editing it directly.

Update docs/comparison.md, then run pnpm docs:sync to produce packages/charts-core/docs/comparison.md. Direct edits to the generated copy can be overwritten and can cause documentation drift.

As per coding guidelines: do not directly edit packages/charts-core/docs because these copies are generated by pnpm docs:sync.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/charts-core/docs/comparison.md` around lines 15 - 22, Update the
source documentation file corresponding to docs/comparison.md rather than
editing the generated packages/charts-core copy, then run pnpm docs:sync to
regenerate packages/charts-core/docs/comparison.md and preserve the documented
comparison entries.

Source: Coding guidelines


## Capability matrix

Expand Down
4 changes: 2 additions & 2 deletions packages/charts-core/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ import { mountChart } from '@tanstack/charts/dom'
import { renderChartSvg } from '@tanstack/charts/svg'
```

Use the portable barrel when definitions and scene compilation must not make
Use the universal barrel when definitions and scene compilation must not make
the browser host reachable:

```ts
import {
createChartRuntime,
defineChart,
lineY,
} from '@tanstack/charts/portable'
} from '@tanstack/charts/universal'
import type { ChartDefinition } from '@tanstack/charts/types'
```

Expand Down
6 changes: 3 additions & 3 deletions packages/charts-core/docs/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ select the optional Canvas renderer; their `/core` entries require an explicit
## Import map

The root `@tanstack/charts` entry point exports the common grammar, runtime,
scene, SVG renderer, browser host, and their public types. The portable entry
scene, SVG renderer, browser host, and their public types. The universal entry
excludes browser hosts and adapters. Granular subpaths keep optional
capabilities and individual marks independently tree-shakeable.

Expand Down Expand Up @@ -87,7 +87,7 @@ capabilities and individual marks independently tree-shakeable.
| `@tanstack/charts/link` | `link` |
| `@tanstack/charts/mark/scale-values` | `createMarkWithScaleValues` |
| `@tanstack/charts/polar` | `polar`, radial arc/line/area/dot marks, and radial/angle guides |
| `@tanstack/charts/portable` | Common root authoring, runtime, scene, and static SVG values without browser hosts or adapters |
| `@tanstack/charts/universal` | Common root authoring, runtime, scene, and static SVG values without browser hosts or adapters |
| `@tanstack/charts/reconcile` | `reconcileChartSvg` |
| `@tanstack/charts/rect` | `rect`, `cell` |
| `@tanstack/charts/renderer` | `mountChartRenderer` |
Expand All @@ -99,7 +99,7 @@ capabilities and individual marks independently tree-shakeable.
| `@tanstack/charts/svg/resources` | `renderChartSvgWithResources` |
| `@tanstack/charts/text` | `text` |
| `@tanstack/charts/tick` | `tickX`, `tickY` |
| `@tanstack/charts/types` | Portable definition, mark, scene, runtime, focus, and tooltip-model types |
| `@tanstack/charts/types` | Universal definition, mark, scene, runtime, focus, and tooltip-model types |
| `@tanstack/charts/vector` | `vector` |

Import from the narrowest stable entry point when bundle isolation matters.
Expand Down
2 changes: 2 additions & 0 deletions packages/charts-core/docs/reference/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,14 @@ See [DOM host](./dom-host.md) and
| `ChartSpatialIndexFactory` | Builds an index from current scene points |
| `ChartExtensionInput` | Generic bare-token or `{ use, ...options }` extension input |
| `ChartTooltipInput` | Tooltip extension token or configured extension options |
| `ChartTooltipExtensionToken` | Environment-neutral contract implemented by host tooltip extensions |
| `ChartTooltipExtension` | Tooltip lifecycle implementation |
| `ChartTooltipExtensionContext` | Container, dismissal, and adapter-body bridge given to a tooltip |
| `ChartTooltipExtensionInstance` | Tooltip update, paint, hide, containment, and destroy lifecycle |
| `ChartTooltipPaintContext` | Focused points, scene, surface, pointer, and pinned state |
| `ChartTooltipOptions` | Native tooltip content, ordering, anchoring, and pinning |
| `ChartTooltipPortalInput` | Portal extension token or configured transport options |
| `ChartTooltipPortalExtensionToken` | Environment-neutral contract implemented by host portal extensions |
| `ChartTooltipPortalExtension` | Tooltip transport lifecycle implementation |
| `ChartTooltipPortalExtensionContext` | Container, tooltip element, and reposition callback given to a portal |
| `ChartTooltipPortalExtensionInstance` | Portal update, position, hide, and destroy lifecycle |
Expand Down
Loading
Loading