@vielzeug/codex 26.11.22 → 26.11.23
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/data/catalog.json +280 -51
- package/data/llms-full.txt +2358 -15
- package/data/llms.txt +7 -2
- package/data/manifest.json +1 -1
- package/data/packages/atlas.json +70 -0
- package/data/packages/beacon.json +1 -1
- package/data/packages/codex.json +1 -1
- package/data/packages/gesture.json +27 -5
- package/data/packages/ink.json +32 -0
- package/data/packages/palette.json +42 -0
- package/data/packages/prism.json +1 -1
- package/data/packages/stage.json +25 -0
- package/data/packages/wire.json +36 -0
- package/data/refine.json +16 -5
- package/package.json +2 -2
- package/skills/vielzeug/SKILL.md +7 -2
package/data/packages/prism.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apiSource": "// Public API: all exports for @vielzeug/prism\n\nexport type { EasingFn, EasingName } from './animation/easing';\n// Chart factories\nexport { createAreaChart } from './charts/area';\nexport { createBarChart } from './charts/bar';\nexport { createHeatmapChart } from './charts/heatmap';\nexport { createLineChart } from './charts/line';\nexport { createPieChart } from './charts/pie';\nexport { createRadarChart } from './charts/radar';\nexport { createScatterChart } from './charts/scatter';\nexport { createSparkline } from './charts/sparkline';\n// Error classes\nexport { PrismError, PrismRenderError } from './errors';\n// Scale factories\nexport { bandScale } from './scales/band';\nexport { linearScale } from './scales/linear';\nexport { timeScale } from './scales/time';\nexport type { BandScaleConfig, LinearScaleConfig, TimeScaleConfig } from './scales/types';\n// Theme utilities\nexport { resetTheme, seriesColor, setTheme } from './theme';\nexport type {\n AreaChartConfig,\n AreaSeriesConfig,\n AxisConfig,\n AxisPosition,\n BandScale,\n BarChartConfig,\n BarSeriesConfig,\n BarVariant,\n BaseChartConfig,\n ChartA11y,\n ChartDimensions,\n ChartEvent,\n ChartHandle,\n ChartMargin,\n ContinuousDatum,\n CrosshairConfig,\n Datum,\n GridConfig,\n HeatmapCell,\n HeatmapChartConfig,\n HeatmapData,\n HeatmapEvent,\n HorizontalAxisPosition,\n LegendConfig,\n LegendPosition,\n LineChartConfig,\n LineSeriesConfig,\n PieChartConfig,\n PieEvent,\n PieSliceConfig,\n PieVariant,\n PrismEvent,\n PrismTheme,\n RadarAxisConfig,\n RadarAxisValue,\n RadarChartConfig,\n RadarEvent,\n RadarGridConfig,\n RadarSeriesConfig,\n Scale,\n ScatterChartConfig,\n ScatterSeriesConfig,\n Series,\n SeriesValue,\n SparklineConfig,\n SparklineEvent,\n SparklineVariant,\n StackSegment,\n ThemeScope,\n TooltipConfig,\n TransitionConfig,\n TransitionOption,\n VerticalAxisPosition,\n XAxisConfig,\n YAxisConfig,\n} from './types';\n",
|
|
3
3
|
"docs": {
|
|
4
|
-
"index": "---\ntitle: 'Prism: Responsive SVG data visualization'\ndescription: 'Responsive SVG charts with explicit updates: line, bar, area, scatter, pie, radar, heatmap, sparkline'\npackage: prism\ncategory: ui\nkeywords:\n [\n chart,\n svg,\n visualization,\n responsive,\n line-chart,\n bar-chart,\n area-chart,\n scatter-chart,\n pie-chart,\n radar-chart,\n heatmap-chart,\n sparkline,\n accessibility,\n typescript,\n ]\nrelated: [refine, orbit]\nexports: [createLineChart, createBarChart, createPieChart, ChartHandle]\nenvironments: [browser]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"prism\" />\n\n## Why Prism?\n\nPrism renders charts as SVG in a host element and keeps application state outside the chart. You can replace chart data explicitly, respond to container resizing, and style the output with CSS custom properties.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:640px;height:320px';\ndocument.body.append(host);\n\n// Before: replace a hand-drawn SVG each time values change.\nfunction drawLine(values: number[]) {\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n const low = Math.min(...values);\n const span = Math.max(...values) - low || 1;\n const points = values.map((value, index) => {\n const x = (index / Math.max(1, values.length - 1)) * 640;\n const y = 320 - ((value - low) / span) * 320;\n return `${index === 0 ? 'M' : 'L'}${x},${y}`;\n });\n svg.setAttribute('viewBox', '0 0 640 320');\n path.setAttribute('d', points.join(' '));\n path.setAttribute('fill', 'none');\n path.setAttribute('stroke', 'currentColor');\n svg.append(path);\n host.replaceChildren(svg);\n}\ndrawLine([10, 25, 18]);\ndrawLine([10, 25, 18, 32]);\n\n// After: keep the chart instance and replace its series data.\nconst chart = createLineChart(host, {\n a11y: { ariaLabel: 'Revenue by month' },\n series: [\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 25 },\n { key: 3, value: 18 },\n ],\n name: 'Revenue',\n },\n ],\n});\nchart.update([\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 25 },\n { key: 3, value: 18 },\n { key: 4, value: 32 },\n ],\n name: 'Revenue',\n },\n]);\nchart.dispose();\n```\n\n| Feature | Prism | Hand-written SVG |\n| ------------------ | ---------------------------------------------------------------- | -------------------------------------------- |\n| Bundle size | <PackageInfo package=\"prism\" type=\"size\" /> | No chart package |\n| Zero dependencies | <ore-icon name=\"x\" size=\"16\"></ore-icon> (uses Orbit)
|
|
4
|
+
"index": "---\ntitle: 'Prism: Responsive SVG data visualization'\ndescription: 'Responsive SVG charts with explicit updates: line, bar, area, scatter, pie, radar, heatmap, sparkline'\npackage: prism\ncategory: ui\nkeywords:\n [\n chart,\n svg,\n visualization,\n responsive,\n line-chart,\n bar-chart,\n area-chart,\n scatter-chart,\n pie-chart,\n radar-chart,\n heatmap-chart,\n sparkline,\n accessibility,\n typescript,\n ]\nrelated: [refine, orbit]\nexports: [createLineChart, createBarChart, createPieChart, ChartHandle]\nenvironments: [browser]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"prism\" />\n\n## Why Prism?\n\nPrism renders charts as SVG in a host element and keeps application state outside the chart. You can replace chart data explicitly, respond to container resizing, and style the output with CSS custom properties.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:640px;height:320px';\ndocument.body.append(host);\n\n// Before: replace a hand-drawn SVG each time values change.\nfunction drawLine(values: number[]) {\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n const low = Math.min(...values);\n const span = Math.max(...values) - low || 1;\n const points = values.map((value, index) => {\n const x = (index / Math.max(1, values.length - 1)) * 640;\n const y = 320 - ((value - low) / span) * 320;\n return `${index === 0 ? 'M' : 'L'}${x},${y}`;\n });\n svg.setAttribute('viewBox', '0 0 640 320');\n path.setAttribute('d', points.join(' '));\n path.setAttribute('fill', 'none');\n path.setAttribute('stroke', 'currentColor');\n svg.append(path);\n host.replaceChildren(svg);\n}\ndrawLine([10, 25, 18]);\ndrawLine([10, 25, 18, 32]);\n\n// After: keep the chart instance and replace its series data.\nconst chart = createLineChart(host, {\n a11y: { ariaLabel: 'Revenue by month' },\n series: [\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 25 },\n { key: 3, value: 18 },\n ],\n name: 'Revenue',\n },\n ],\n});\nchart.update([\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 25 },\n { key: 3, value: 18 },\n { key: 4, value: 32 },\n ],\n name: 'Revenue',\n },\n]);\nchart.dispose();\n```\n\n| Feature | Prism | Hand-written SVG |\n| ------------------ | ---------------------------------------------------------------- | -------------------------------------------- |\n| Bundle size | <PackageInfo package=\"prism\" type=\"size\" /> | No chart package |\n| Zero dependencies | <ore-icon name=\"x\" size=\"16\"></ore-icon> (uses Orbit, Palette) | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n| Data updates | `ChartHandle.update()` replaces chart data | You implement the update path |\n| Responsive sizing | `ResizeObserver` recalculates the chart layout | You implement the resize behavior |\n| Chart interactions | Built-in pointer and keyboard interactions on supported charts | You implement them |\n| SVG accessibility | Informative charts support an accessible name and keyboard focus | You implement the accessible behavior |\n\n<div class=\"decision-callout\">\n\n**Use Prism when** you need chart factories, responsive SVG output, and an explicit data-update boundary without adopting a charting framework.\n\n**Consider hand-written SVG when** you need a single specialized graphic and prefer to own its scales, resizing, labels, and interactions directly.\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/prism\n```\n\n```sh [npm]\nnpm install @vielzeug/prism\n```\n\n```sh [yarn]\nyarn add @vielzeug/prism\n```\n\n:::\n\n## Quick Start\n\nCreate and size a host element before creating the chart. Import `theme.css` once to load Prism's default styles and CSS custom properties.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\nimport '@vielzeug/prism/theme.css';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:640px;height:320px';\ndocument.body.append(host);\n\nconst chart = createLineChart(host, {\n a11y: { ariaLabel: 'Revenue by month' },\n series: [\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 25 },\n { key: 3, value: 18 },\n ],\n name: 'Revenue',\n },\n ],\n tooltip: true,\n});\n\nchart.update([\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 25 },\n { key: 3, value: 18 },\n { key: 4, value: 32 },\n ],\n name: 'Revenue',\n },\n]);\n\nchart.dispose();\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- **`createLineChart()` / `createAreaChart()`**: plot continuous numeric or date-keyed series\n- **`createBarChart()`**: compare categories with grouped, stacked, or horizontal bars\n- **`createScatterChart()`**: plot independent numeric `(x, y)` points\n- **`createPieChart()`**: render pie, donut, or semi-circle slices\n- **`createRadarChart()`**: compare series across fixed, labelled axes\n- **`createHeatmapChart()`**: render a row/column matrix of colored cells with a continuous or binned ramp\n- **`createSparkline()`**: render compact line, area, bar, or stacked values without axes\n- **`ChartHandle.update(data)`**: replace chart data without handing state ownership to Prism\n- **`ChartHandle.dispose()` / `Symbol.dispose`**: release the SVG, observer, overlays, and chart-owned animation\n- **`ChartHandle.tap()`**: observe resize and disposal events\n- **`setTheme()` / `resetTheme()`**: set supported palette, typography, axis, grid, and tooltip tokens globally or on one element\n- **CSS custom properties**: style the chart palette, marks, axes, labels, tooltip, legend, and motion\n- **Resize observation**: recalculate SVG layout when the host element changes size\n- **Accessible interaction**: labelled interactive charts expose keyboard navigation and polite value announcements; sparklines are pointer-only without value announcements\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Refine](/refine/): web components and theme tokens for building controls and layouts around chart hosts\n- [Orbit](/orbit/): floating-element positioning used internally by Prism's built-in tooltip\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
5
|
"api": "---\ntitle: 'Prism: API Reference'\ndescription: Complete reference for Prism chart factories, scales, themes, types, and errors.\n---\n\n[[toc]]\n\n## API Overview\n\nAll chart factories, scale utilities, theme helpers, and error classes are synchronous. Charts render into an HTML element and return a `ChartHandle`; they do not return a promise.\n\n| Symbol | Purpose | Execution mode | Common gotcha |\n| ---------------------- | ----------------------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------- |\n| `createLineChart()` | Render one or more continuous line series | Sync | `key` values must be numbers or dates |\n| `createAreaChart()` | Render continuous series with filled areas | Sync | Fills use a gradient by default |\n| `createScatterChart()` | Plot independent `(x, y)` points | Sync | `key` is the x-value; the y-domain is fitted to data |\n| `createBarChart()` | Render categorical bars | Sync | Negative values in stacked variants are clamped to zero |\n| `createPieChart()` | Render pie, donut, or semi-circle slices | Sync | `variant` is fixed at creation; `update()` replaces slices |\n| `createRadarChart()` | Compare series across fixed axes | Sync | Requires at least three axes to draw |\n| `createHeatmapChart()` | Render a row/column matrix of colored cells | Sync | Cells whose `row`/`column` match no label are skipped; unknown labels warn in development |\n| `createSparkline()` | Render a compact line, area, bar, or stack | Sync | Has no axes, legend, or keyboard navigation |\n| `linearScale()` | Create a numeric scale | Sync | `nice` defaults to `true`; set `nice: false` to preserve the domain |\n| `timeScale()` | Create a date scale | Sync | `nice` defaults to `true` |\n| `bandScale()` | Create an ordered categorical scale | Sync | Unknown categories map to `0` and warn in development |\n| `setTheme()` | Set Prism CSS custom properties | Sync | Writes inline styles to `document.documentElement` by default |\n| `resetTheme()` | Remove theme overrides set by `setTheme()` | Sync | Only clears the selected target |\n| `seriesColor()` | Resolve a palette CSS value | Sync | Palette positions wrap after eight |\n| `PrismError` | Base class for Prism errors | Sync | Use `instanceof` to catch any Prism error |\n| `PrismRenderError` | Report an invalid chart container or failed chart operation | Sync | Also thrown by `update()` after disposal |\n\n## Package Entry Point\n\n| Import | Purpose |\n| --------------------------- | --------------------------------------------------------------------------------------- |\n| `@vielzeug/prism` | Chart factories, scale and theme functions, error classes, and public types |\n| `@vielzeug/prism/theme.css` | Default chart styles, CSS custom properties, dark-mode values, and reduced-motion rules |\n\n## Chart Factories\n\nEach factory appends an SVG to `container`. A chart with no measurable container size uses a temporary `600 × 300` SVG size and emits a development warning; `ResizeObserver` applies later size changes. Unless `a11y` is informative, the SVG is hidden from the accessibility tree.\n\n### `createLineChart()`\n\n```ts\nfunction createLineChart(container: HTMLElement, config: LineChartConfig): ChartHandle<LineSeriesConfig[]>;\n```\n\nRenders line series and returns a handle whose `update()` argument replaces the complete series array. Axes render by default; the value axis has grid lines by default. Pass `false` to `xAxis` or `yAxis` to suppress that axis.\n\nSeries use linear interpolation by default, omit point markers by default, and use a point radius of 3 when markers are enabled. `yAxis` defaults to `'left'`; crosshair, tooltip, and legend are disabled unless configured.\n\n| Parameter | Type | Description |\n| ----------- | ----------------- | ------------------------------------------------------------- |\n| `container` | `HTMLElement` | Host that receives the chart SVG and optional overlays |\n| `config` | `LineChartConfig` | Series, axes, interaction, accessibility, and motion settings |\n\n**Returns:** `ChartHandle<LineSeriesConfig[]>`.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:640px;height:320px';\ndocument.body.append(host);\n\nconst chart = createLineChart(host, {\n a11y: { ariaLabel: 'Revenue by month' },\n series: [\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 15 },\n ],\n name: 'Revenue',\n },\n ],\n});\nchart.update([\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 15 },\n { key: 3, value: 18 },\n ],\n name: 'Revenue',\n },\n]);\nchart.dispose();\n```\n\n### `createAreaChart()`\n\n```ts\nfunction createAreaChart(container: HTMLElement, config: AreaChartConfig): ChartHandle<AreaSeriesConfig[]>;\n```\n\nRenders continuous area series with a gradient fill by default. `update()` replaces the complete series array.\n\nArea series use linear interpolation by default and show their top line unless `showLine: false` is set. Axes render by default, with grid lines on the value axis.\n\n| Parameter | Type | Description |\n| ----------- | ----------------- | ------------------------------------------------------------- |\n| `container` | `HTMLElement` | Host that receives the chart SVG and optional overlays |\n| `config` | `AreaChartConfig` | Series, axes, interaction, accessibility, and motion settings |\n\n**Returns:** `ChartHandle<AreaSeriesConfig[]>`.\n\n```ts\nimport { createAreaChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:640px;height:320px';\ndocument.body.append(host);\n\nconst chart = createAreaChart(host, {\n a11y: { ariaLabel: 'Visitors over time' },\n series: [\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 18 },\n ],\n name: 'Visitors',\n },\n ],\n});\nchart.dispose();\n```\n\n### `createScatterChart()`\n\n```ts\nfunction createScatterChart(container: HTMLElement, config: ScatterChartConfig): ChartHandle<ScatterSeriesConfig[]>;\n```\n\nPlots each datum independently: `key` is the numeric or date x-value and `value` is the y-value. Points are not joined. `update()` replaces the complete series array.\n\nAxes render by default, with grid lines on the value axis. The value scale is fitted to the observed data rather than forced to include zero. Tooltip, crosshair, and legend are disabled unless configured.\n\n| Parameter | Type | Description |\n| ----------- | -------------------- | ------------------------------------------------------------------------- |\n| `container` | `HTMLElement` | Host that receives the chart SVG and optional overlays |\n| `config` | `ScatterChartConfig` | Independent points, axes, interaction, accessibility, and motion settings |\n\n**Returns:** `ChartHandle<ScatterSeriesConfig[]>`.\n\n```ts\nimport { createScatterChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:640px;height:320px';\ndocument.body.append(host);\n\nconst chart = createScatterChart(host, {\n a11y: { ariaLabel: 'Height against weight' },\n series: [\n {\n data: [\n { key: 160, value: 55 },\n { key: 175, value: 70 },\n ],\n name: 'Cohort A',\n },\n ],\n tooltip: true,\n});\nchart.dispose();\n```\n\nScatter interaction reports the datum and series of the point nearest the pointer in two dimensions, without a `values` array. Keyboard navigation visits points across series in x order. Tooltip `titleFormat` receives the x-value and `valueFormat` the y-value. On mount, points grow from radius zero at their final positions; updates slide existing points and grow new ones.\n\n### `createBarChart()`\n\n```ts\nfunction createBarChart(container: HTMLElement, config: BarChartConfig): ChartHandle<BarSeriesConfig[]>;\n```\n\nRenders grouped, stacked, grouped-horizontal, or stacked-horizontal categories. `update()` replaces the complete series array; the variant is fixed at creation. Axes render by default, with grid lines on the value axis.\n\nThe default variant is `grouped`; tooltip and legend are disabled unless configured.\n\n| Parameter | Type | Description |\n| ----------- | ---------------- | ----------------------------------------------------------------------------- |\n| `container` | `HTMLElement` | Host that receives the chart SVG and optional overlays |\n| `config` | `BarChartConfig` | Series, layout variant, axes, interaction, accessibility, and motion settings |\n\n**Returns:** `ChartHandle<BarSeriesConfig[]>`.\n\n```ts\nimport { createBarChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:640px;height:320px';\ndocument.body.append(host);\n\nconst chart = createBarChart(host, {\n a11y: { ariaLabel: 'Tasks by status' },\n series: [\n {\n data: [\n { key: 'Open', value: 12 },\n { key: 'Done', value: 8 },\n ],\n name: 'Tasks',\n },\n ],\n});\nchart.dispose();\n```\n\nFor stacked variants, negative values are treated as zero and produce a development warning.\n\n### `createPieChart()`\n\n```ts\nfunction createPieChart(container: HTMLElement, config: PieChartConfig): ChartHandle<PieSliceConfig[]>;\n```\n\nRenders pie, donut, or semi-circle slices. The default variant is `pie`; `update()` replaces the slice array. The default inner radius is zero for pies and 55% of the outer radius for donut and semi variants. Pie slices default to no padding or rounded corners; donut and semi slices default to 8px padding and corner radius.\n\n| Parameter | Type | Description |\n| ----------- | ---------------- | ------------------------------------------------------------------ |\n| `container` | `HTMLElement` | Host that receives the chart SVG and optional overlays |\n| `config` | `PieChartConfig` | Slices, shape, geometry, legend, tooltip, and interaction settings |\n\n**Returns:** `ChartHandle<PieSliceConfig[]>`.\n\n```ts\nimport { createPieChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:320px;height:240px';\ndocument.body.append(host);\n\nconst chart = createPieChart(host, {\n a11y: { ariaLabel: 'Orders by channel' },\n data: [\n { label: 'Direct', value: 72 },\n { label: 'Referral', value: 28 },\n ],\n variant: 'donut',\n});\nchart.dispose();\n```\n\n### `createRadarChart()`\n\n```ts\nfunction createRadarChart(container: HTMLElement, config: RadarChartConfig): ChartHandle<RadarSeriesConfig[]>;\n```\n\nRenders one shape per series across the configured axes. `update()` replaces series data but not axes or other configuration. Fewer than three axes warn in development and draw no chart. Tooltip and legend are disabled unless configured.\n\n| Parameter | Type | Description |\n| ----------- | ------------------ | --------------------------------------------------------------------- |\n| `container` | `HTMLElement` | Host that receives the chart SVG and optional overlays |\n| `config` | `RadarChartConfig` | Fixed axes, series, scale, grid, appearance, and interaction settings |\n\n**Returns:** `ChartHandle<RadarSeriesConfig[]>`.\n\n```ts\nimport { createRadarChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:400px;height:320px';\ndocument.body.append(host);\n\nconst chart = createRadarChart(host, {\n a11y: { ariaLabel: 'Hero stats' },\n axes: [\n { key: 'str', label: 'Strength' },\n { key: 'agi', label: 'Agility' },\n { key: 'end', label: 'Endurance' },\n ],\n domain: [0, 10],\n series: [\n {\n data: [\n { key: 'str', value: 8 },\n { key: 'agi', value: 6 },\n { key: 'end', value: 9 },\n ],\n name: 'Adam',\n },\n ],\n});\nchart.dispose();\n```\n\nRadar defaults are a solid fill, linear curves, visible points, a four-level polygon grid with bands, no grid labels, and a first-axis angle of zero degrees. Grid labels render only when all axes share a domain.\n\n### `createHeatmapChart()`\n\n```ts\nfunction createHeatmapChart(container: HTMLElement, config: HeatmapChartConfig): ChartHandle<HeatmapData>;\n```\n\nRenders one colored cell per row/column pair: rows down the left, columns across the top. The color ramp is continuous by default; `bins` turns it into discrete steps and shows a swatch legend. Cells show their formatted value when they are large enough, choosing dark or light text against the fill. `rowSummary` adds a right-hand column of pre-formatted per-row texts (e.g. a win rate the cells alone cannot show). `update()` replaces cells and may replace `rows`, `columns`, `domain`, and `rowSummary`; other configuration is fixed at creation.\n\n| Parameter | Type | Description |\n| ----------- | -------------------- | ---------------------------------------------------------------------- |\n| `container` | `HTMLElement` | Host that receives the chart SVG and optional overlays |\n| `config` | `HeatmapChartConfig` | Rows, columns, cells, ramp, bins, appearance, and interaction settings |\n\n**Returns:** `ChartHandle<HeatmapData>`.\n\n```ts\nimport { createHeatmapChart } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:400px;height:320px';\ndocument.body.append(host);\n\nconst chart = createHeatmapChart(host, {\n a11y: { ariaLabel: 'Win rate by hero and region' },\n cells: [\n { column: 'Forest', row: 'Aria', value: 90 },\n { column: 'Swamp', row: 'Aria', value: 40 },\n { column: 'Forest', row: 'Brom', value: 20 },\n { column: 'Swamp', row: 'Brom', value: 75 },\n ],\n columns: ['Forest', 'Swamp'],\n rows: ['Aria', 'Brom'],\n});\nchart.dispose();\n```\n\nHeatmap defaults are a light-to-deep blue ramp over the data's `[min, max]` domain, a 2 px cell gap, in-cell values, and no legend. Column headers rotate -45° when they do not fit their column. Keyboard: arrows move the active cell, Enter/Space fires `onCellClick`, Escape deactivates; the tooltip (or `.prism-live` without one) describes the active cell.\n\n### `createSparkline()`\n\n```ts\nfunction createSparkline(container: HTMLElement, config: SparklineConfig): ChartHandle<number[] | StackSegment[]>;\n```\n\nRenders compact data without axes, chart margins, or a legend. `update()` replaces the number or stack-segment array. The default variant is `line`; only line and area variants draw the endpoint marker by default.\n\n| Parameter | Type | Description |\n| ----------- | ----------------- | ----------------------------------------------------------------- |\n| `container` | `HTMLElement` | Host that receives the chart SVG |\n| `config` | `SparklineConfig` | Values, variant, appearance, accessibility, and pointer callbacks |\n\n**Returns:** `ChartHandle<number[] | StackSegment[]>`.\n\n```ts\nimport { createSparkline } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:240px;height:48px';\ndocument.body.append(host);\n\nconst chart = createSparkline(host, { data: [2, 5, 3, 8], variant: 'area' });\nchart.update([2, 5, 3, 8, 13]);\nchart.dispose();\n```\n\n`StackSegment[]` is for `variant: 'stack'`. Pointer callbacks are available for numeric line, area, and bar sparklines; sparklines do not support keyboard navigation.\n\n## Scale Factories\n\n### `linearScale()`\n\n```ts\nfunction linearScale(config: LinearScaleConfig): Scale<number>;\n```\n\nMaps a numeric domain to a numeric range. `nice` defaults to `true`; `clamp` defaults to `false` and applies to `map()`, not `invert()`.\n\n| Parameter | Type | Default | Description |\n| --------------- | ------------------ | -------- | --------------------------------------- |\n| `config.domain` | `[number, number]` | Required | Input extent |\n| `config.range` | `[number, number]` | Required | Output extent |\n| `config.clamp` | `boolean` | `false` | Clamp mapped values to the range |\n| `config.nice` | `boolean` | `true` | Expand the domain to rounded boundaries |\n\n**Returns:** `Scale<number>`, with `map`, `invert`, `ticks`, `domain`, and `range`.\n\n```ts\nimport { linearScale } from '@vielzeug/prism';\n\nconst scale = linearScale({ domain: [0, 100], range: [0, 500] });\nscale.map(50); // 250\n```\n\n### `timeScale()`\n\n```ts\nfunction timeScale(config: TimeScaleConfig): Scale<Date>;\n```\n\nMaps date values to a numeric range. `nice` defaults to `true` and rounds the domain to a time interval.\n\n| Parameter | Type | Default | Description |\n| --------------- | ------------------ | -------- | --------------------------------------------- |\n| `config.domain` | `[Date, Date]` | Required | Input date extent |\n| `config.range` | `[number, number]` | Required | Output extent |\n| `config.nice` | `boolean` | `true` | Expand the domain to time-interval boundaries |\n\n**Returns:** `Scale<Date>`, with `map`, `invert`, `ticks`, `domain`, and `range`.\n\n```ts\nimport { timeScale } from '@vielzeug/prism';\n\nconst scale = timeScale({\n domain: [new Date('2026-01-01'), new Date('2026-12-31')],\n range: [0, 500],\n});\nscale.map(new Date('2026-07-02'));\n```\n\n### `bandScale()`\n\n```ts\nfunction bandScale(config: BandScaleConfig): BandScale;\n```\n\nMaps ordered string categories to the start of each band. `padding` defaults to `0.1`; `paddingOuter` defaults to the same value. Mapping an unknown category returns `0` and warns in development.\n\n| Parameter | Type | Default | Description |\n| --------------------- | ------------------ | --------- | --------------------------------- |\n| `config.domain` | `string[]` | Required | Ordered categories |\n| `config.range` | `[number, number]` | Required | Output extent |\n| `config.padding` | `number` | `0.1` | Inner gap as a ratio of bandwidth |\n| `config.paddingOuter` | `number` | `padding` | Outer gap as a ratio of bandwidth |\n\n**Returns:** `BandScale`, with `map`, `ticks`, `bandwidth`, `gap`, `domain`, and `range`.\n\n```ts\nimport { bandScale } from '@vielzeug/prism';\n\nconst scale = bandScale({ domain: ['A', 'B'], range: [0, 200] });\nscale.bandwidth();\n```\n\n## Theme Utilities\n\n`theme.css` supplies the base CSS values and styles. `setTheme()` writes inline custom properties, which take precedence over stylesheet declarations. For other visual controls, set CSS custom properties directly.\n\n### `setTheme()`\n\n```ts\nfunction setTheme(theme: PrismTheme, options?: ThemeScope): void;\n```\n\nSets the provided theme values on `options.scope`, or on `document.documentElement` when omitted. Omitted scalar keys remain unchanged. Providing `colors` replaces all eight palette slots, removing unused slots.\n\n| Parameter | Type | Description |\n| --------------- | ------------- | -------------------------------------------------------------------- |\n| `theme` | `PrismTheme` | Palette and supported axis, grid, text, font, and tooltip properties |\n| `options.scope` | `HTMLElement` | Element that scopes the inline custom properties |\n\n**Returns:** `void`.\n\n```ts\nimport { setTheme } from '@vielzeug/prism';\n\nconst host = document.createElement('div');\ndocument.body.append(host);\nsetTheme({ colors: ['#2563eb', '#16a34a'], textColor: '#111827' }, { scope: host });\n```\n\n### `resetTheme()`\n\n```ts\nfunction resetTheme(options?: ThemeScope): void;\n```\n\nRemoves every custom property managed by `setTheme()` from the given scope or the document root. It does not remove CSS rules or change any other custom properties.\n\n| Parameter | Type | Description |\n| --------- | ------------ | ------------------------------------------------------- |\n| `options` | `ThemeScope` | Optional target; defaults to `document.documentElement` |\n\n**Returns:** `void`.\n\n```ts\nimport { resetTheme, setTheme } from '@vielzeug/prism';\n\nconst scope = document.createElement('div');\nsetTheme({ textColor: '#111827' }, { scope });\nresetTheme({ scope });\n```\n\n### `seriesColor()`\n\n```ts\nfunction seriesColor(index: number, override?: string): string;\n```\n\nReturns `override` when it is provided; otherwise returns a `var(--prism-color-N)` reference. The palette has eight positions and the index wraps around after the eighth.\n\n| Parameter | Type | Description |\n| ---------- | -------- | ------------------------------------------------- |\n| `index` | `number` | Zero-based palette position |\n| `override` | `string` | Optional color returned instead of a CSS variable |\n\n**Returns:** `string`.\n\n```ts\nimport { seriesColor } from '@vielzeug/prism';\n\nseriesColor(0); // 'var(--prism-color-1)'\nseriesColor(1, '#2563eb'); // '#2563eb'\n```\n\n## Chart Handle\n\n`ChartHandle<TData>` is returned by every chart factory. `update()` synchronously rebuilds the chart from its new data; enabled motion may animate the resulting SVG. `dispose()` is idempotent, removes the chart SVG, observers, tooltip and legend, cancels chart-owned animation, aborts `disposalSignal`, and emits one `dispose` tap event. `update()` after disposal throws `PrismRenderError`.\n\n`tap()` observes `resize` and `dispose` events outside the render path. It returns an unsubscribe function; an optional abort signal removes the subscription. Observer-handler exceptions are swallowed so they cannot affect chart behavior. A tap added after disposal returns a no-op unsubscribe function.\n\n`[Symbol.dispose]()` delegates to `dispose()`, allowing explicit resource management where supported.\n\nAll chart handles expose the same lifecycle members; interactive cartesian, pie, radar, and heatmap charts use a `.prism-live` status region when no tooltip is enabled. A tooltip is itself a polite status region. Sparklines have neither a tooltip nor a live value announcer.\n\n| Method or property | Contract |\n| ------------------------ | ----------------------------------------------------------------------- |\n| `el` | The chart's root `SVGSVGElement` |\n| `update(data)` | Replace chart data and render; throws `PrismRenderError` after disposal |\n| `dispose()` | Idempotently release chart-owned DOM, observation, and motion |\n| `disposed` | Whether the handle has been disposed |\n| `disposalSignal` | `AbortSignal` aborted during disposal |\n| `tap(handler, options?)` | Observe resize/dispose events; returns an unsubscribe function |\n| `[Symbol.dispose]()` | Calls `dispose()` |\n\n`PrismEvent` reports a changed SVG content size as `{ type: 'resize', width, height }`; the `dispose` event is emitted once before teardown completes.\n\n## Types\n\nThe following are all types and interfaces exported from `@vielzeug/prism`. Definitions mirror the package entry-point contracts.\n\n### Animation Types\n\n```ts\nexport type EasingFn = (t: number) => number;\nexport type EasingName = 'back-out' | 'ease-in' | 'ease-in-out' | 'ease-out' | 'expo-out' | 'linear';\n\nexport interface TransitionConfig {\n /** Milliseconds per animated lane. Defaults to 300 (420 for a line entrance, 400 for radar). */\n duration?: number;\n easing?: EasingName | ((t: number) => number);\n /** `system` skips animation when reduced motion is preferred. */\n preference?: 'always' | 'never' | 'system';\n /** Per-bar delay on bar charts, per-entering-point delay (x order) on scatter charts, or per-series delay on radar charts. Bar and scatter charts cap the total added delay at about 400 ms. */\n stagger?: number;\n}\n\nexport type TransitionOption = TransitionConfig | boolean;\n```\n\n### Theme Types\n\n```ts\nexport interface PrismTheme {\n axisColor?: string;\n colors?: string[];\n fontFamily?: string;\n gridColor?: string;\n gridOpacity?: number;\n textColor?: string;\n textColorSecondary?: string;\n tooltipBg?: string;\n tooltipBorder?: string;\n tooltipColor?: string;\n}\n\nexport interface ThemeScope {\n readonly scope?: HTMLElement;\n}\n```\n\n`PrismTheme.colors` writes up to eight palette slots. The scalar fields map as follows:\n\n| Field | CSS custom property |\n| -------------------- | ------------------------------ |\n| `axisColor` | `--prism-axis-color` |\n| `fontFamily` | `--prism-font-family` |\n| `gridColor` | `--prism-grid-color` |\n| `gridOpacity` | `--prism-grid-opacity` |\n| `textColor` | `--prism-text-color` |\n| `textColorSecondary` | `--prism-text-color-secondary` |\n| `tooltipBg` | `--prism-tooltip-bg` |\n| `tooltipBorder` | `--prism-tooltip-border` |\n| `tooltipColor` | `--prism-tooltip-color` |\n\n### Core and Data Types\n\n```ts\nexport interface ChartMargin {\n bottom: number;\n left: number;\n right: number;\n top: number;\n}\n\nexport interface ChartDimensions {\n height: number;\n margin: ChartMargin;\n width: number;\n}\n\nexport type PrismEvent =\n | { readonly height: number; readonly type: 'resize'; readonly width: number }\n | { readonly type: 'dispose' };\n\nexport interface ChartHandle<TData = unknown> {\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n readonly el: SVGSVGElement;\n tap(handler: (event: PrismEvent) => void, options?: { readonly signal?: AbortSignal }): () => void;\n update(data: TData): void;\n [Symbol.dispose](): void;\n}\n\nexport type ChartA11y = { readonly decorative: true } | { readonly ariaLabel: string; readonly decorative?: false };\n\nexport interface Datum<TKey extends Date | number | string = Date | number | string> {\n dash?: string;\n key: TKey;\n meta?: Record<string, unknown>;\n opacity?: number;\n value: number;\n}\n\nexport type ContinuousDatum = Datum<Date | number>;\n\nexport interface Series<TDatum extends Datum = Datum> {\n color?: string;\n data: TDatum[];\n id?: string;\n name: string;\n}\n\nexport interface ChartEvent {\n datum: Datum;\n originalEvent: Event;\n series: Series;\n values?: SeriesValue[];\n}\n\nexport interface SeriesValue {\n datum: Datum | undefined;\n series: Series;\n}\n```\n\n`Datum.dash` and `Datum.opacity` affect rendered marks only on the chart types that support them. On bars, `dash` adds a 1px series-color stroke so the dash is visible against the fill. `Series.id` becomes a `data-series-id` attribute on a series group; characters outside `[A-Za-z0-9_-]` are replaced with `-`. When omitted, the id is based on the series index.\n\n| Chart | `dash` | `opacity` |\n| ------------------------------ | ----------------------------------------------------------- | -------------------------------------------- |\n| Bar | Strokes that datum's bar | Applies to that bar |\n| Line | Applies to the segment from this datum to the next | Applies to that segment and its point marker |\n| Area | Applies to the top-line segment from this datum to the next | Applies to that segment |\n| Scatter | Ignored | Applies to that point |\n| Pie, radar, heatmap, sparkline | Ignored | Ignored |\n\nFor line and area charts, the last datum has no following segment, so its `dash` value is ignored. The chart factories group adjacent segments with the same presentation values into path runs.\n\nFor line, area, and bar charts, `ChartEvent.values` lists each series at the active key in series order. Its `datum` is `undefined` when that series has no matching key. `originalEvent` is a pointer event or a keyboard event for keyboard activation. Scatter events identify only the nearest independent point and omit `values`.\n\n### Scale Types\n\n```ts\nexport interface Scale<T> {\n readonly domain: readonly [T, T];\n invert(pixel: number): T;\n map(value: T): number;\n readonly range: readonly [number, number];\n ticks(count?: number): T[];\n}\n\nexport interface BandScale {\n bandwidth(): number;\n readonly domain: readonly string[];\n gap(): number;\n map(value: string): number;\n readonly range: readonly [number, number];\n ticks(count?: number): string[];\n}\n\nexport interface LinearScaleConfig {\n clamp?: boolean;\n domain: [number, number];\n nice?: boolean;\n range: [number, number];\n}\n\nexport interface TimeScaleConfig {\n domain: [Date, Date];\n nice?: boolean;\n range: [number, number];\n}\n\nexport interface BandScaleConfig {\n domain: string[];\n padding?: number;\n paddingOuter?: number;\n range: [number, number];\n}\n```\n\n### Axis and Interaction Types\n\n```ts\nexport type HorizontalAxisPosition = 'bottom' | 'top';\nexport type VerticalAxisPosition = 'left' | 'right';\nexport type AxisPosition = HorizontalAxisPosition | VerticalAxisPosition;\n\nexport interface GridConfig {\n color?: string;\n dash?: string;\n}\n\nexport interface AxisConfig<TPosition extends AxisPosition = AxisPosition> {\n grid?: GridConfig | boolean;\n label?: string;\n position?: TPosition;\n tickCount?: number;\n tickFormat?: (value: Date | number | string) => string;\n tickValues?: ReadonlyArray<Date | number | string>;\n}\n\nexport type XAxisConfig = AxisConfig<HorizontalAxisPosition>;\nexport type YAxisConfig = AxisConfig<VerticalAxisPosition>;\n\nexport interface TooltipConfig {\n offset?: number;\n render?: (datum: Datum, series: Series) => Node | string;\n titleFormat?: (key: Date | number | string) => string;\n valueFormat?: (value: number, datum: Datum, series: Series) => string;\n}\n\nexport interface CrosshairConfig {\n horizontal?: boolean;\n snap?: boolean;\n vertical?: boolean;\n}\n\nexport type LegendPosition = 'bottom' | 'left' | 'right' | 'top';\n\nexport interface LegendConfig {\n position?: LegendPosition;\n}\n```\n\nThe crosshair defaults to a vertical line that snaps to the nearest datum; the horizontal line is hidden by default. With `snap: false`, only the guide follows the pointer—tooltip and callback data still refer to the nearest datum.\n\n`tickValues` renders exactly the given ticks instead of scale-generated ones, and gridlines follow the same list. Values must match the axis's scale kind (numbers on a linear axis, `Date`s on a time axis, category strings on a band axis); an off-scale value warns in development. Without it, ticks come from the scale as before.\n\nNumeric tick labels at a magnitude of 1e5 or above default to compact notation (`123K`, `1.23M`) so long numbers fit the default value-axis margin; pass `tickFormat: String` for raw labels. Supplying a partial `yAxis` (or the value axis of a horizontal bar chart) merges over the default, so `{ tickFormat }` alone keeps the default grid lines.\n\n`titleFormat` and `valueFormat` shape the default comparison tooltip on line, area, and bar charts—the title from the focused key and each row's value—and the same formatting is applied to the tooltip's spoken summary. `render` still replaces the whole tooltip body and takes precedence. Tooltip strings are assigned as text, not parsed as HTML. For a radar chart, `tooltip.render` receives a datum whose `meta` contains the active axis, all series values, and the default announcement text.\n\n### Chart Configuration Types\n\n```ts\nexport interface BaseChartConfig {\n a11y?: ChartA11y;\n legend?: LegendConfig | boolean;\n margin?: Partial<ChartMargin>;\n onClick?: (event: ChartEvent) => void;\n onHover?: (event: ChartEvent | null) => void;\n tooltip?: TooltipConfig | boolean;\n transition?: TransitionOption;\n xAxis?: XAxisConfig | false;\n yAxis?: YAxisConfig | false;\n}\n\nexport interface LineSeriesConfig extends Series<ContinuousDatum> {\n curve?: 'linear' | 'monotone' | 'step';\n pointRadius?: number;\n showPoints?: boolean;\n strokeWidth?: number;\n yAxis?: 'left' | 'right';\n}\n\nexport interface LineChartConfig extends BaseChartConfig {\n crosshair?: CrosshairConfig | boolean;\n rightYAxis?: Omit<YAxisConfig, 'position' | 'grid'>;\n series: LineSeriesConfig[];\n}\n\nexport interface AreaSeriesConfig extends Series<ContinuousDatum> {\n curve?: 'linear' | 'monotone' | 'step';\n fill?: 'gradient' | 'solid';\n fillOpacity?: number;\n showLine?: boolean;\n}\n\nexport interface AreaChartConfig extends BaseChartConfig {\n crosshair?: CrosshairConfig | boolean;\n series: AreaSeriesConfig[];\n}\n\nexport interface ScatterSeriesConfig extends Series<ContinuousDatum> {\n pointRadius?: number;\n}\n\nexport interface ScatterChartConfig extends BaseChartConfig {\n crosshair?: CrosshairConfig | boolean;\n series: ScatterSeriesConfig[];\n}\n\nexport interface BarSeriesConfig extends Series {\n borderRadius?: number;\n}\n\nexport type BarVariant = 'grouped' | 'grouped-horizontal' | 'stacked' | 'stacked-horizontal';\n\nexport interface BarChartConfig extends BaseChartConfig {\n series: BarSeriesConfig[];\n /** Paints each bar's value at its end; stacked variants label the stack total. */\n showValues?: boolean;\n /** Formats the value labels. Defaults to `String`. */\n valueFormat?: (value: number) => string;\n variant?: BarVariant;\n}\n\nexport type PieVariant = 'donut' | 'pie' | 'semi';\n\nexport interface PieSliceConfig {\n color?: string;\n label?: string;\n value: number;\n}\n\nexport interface PieEvent {\n index: number;\n originalEvent: Event;\n slice: PieSliceConfig;\n}\n\nexport interface PieChartConfig extends Omit<BaseChartConfig, 'margin' | 'onClick' | 'onHover' | 'xAxis' | 'yAxis'> {\n cornerRadius?: number;\n data: PieSliceConfig[];\n innerRadius?: number;\n onClick?: (event: PieEvent) => void;\n onHover?: (event: PieEvent | null) => void;\n padPixels?: number;\n variant?: PieVariant;\n}\n\nexport interface RadarAxisConfig {\n format?: (value: number) => string;\n key: string;\n label: string;\n max?: number;\n min?: number;\n}\n\nexport type RadarSeriesConfig = Series<Datum<string>>;\n\nexport interface RadarGridConfig {\n bands?: boolean;\n labels?: boolean;\n levels?: number;\n shape?: 'circle' | 'polygon';\n}\n\nexport interface RadarAxisValue {\n datum: Datum<string> | undefined;\n series: RadarSeriesConfig;\n}\n\nexport interface RadarEvent {\n axis: RadarAxisConfig;\n index: number;\n originalEvent: Event;\n values: RadarAxisValue[];\n}\n\nexport interface RadarChartConfig extends Omit<BaseChartConfig, 'margin' | 'onClick' | 'onHover' | 'xAxis' | 'yAxis'> {\n axes: RadarAxisConfig[];\n curve?: 'linear' | 'rounded';\n domain?: [number, number];\n fill?: 'gradient' | 'none' | 'solid';\n grid?: RadarGridConfig | boolean;\n onClick?: (event: RadarEvent) => void;\n onHover?: (event: RadarEvent | null) => void;\n series: RadarSeriesConfig[];\n showPoints?: boolean;\n showValues?: boolean;\n startAngle?: number;\n}\n\nexport interface HeatmapCell {\n column: string;\n row: string;\n value: number | null;\n}\n\nexport interface HeatmapEvent {\n cell: HeatmapCell | undefined;\n column: string;\n originalEvent: Event;\n row: string;\n}\n\nexport interface HeatmapData {\n cells: HeatmapCell[];\n columns?: string[];\n domain?: [number, number];\n rows?: string[];\n rowSummary?: HeatmapChartConfig['rowSummary'];\n}\n\nexport interface HeatmapChartConfig\n extends Omit<BaseChartConfig, 'legend' | 'onClick' | 'onHover' | 'transition' | 'xAxis' | 'yAxis'> {\n binLabel?: (from: number | null, to: number | null) => string;\n bins?: number[];\n cells: HeatmapCell[];\n colorRange?: string[];\n columns: string[];\n domain?: [number, number];\n emptyColor?: string;\n emptyLabel?: string;\n gap?: number;\n legend?: boolean;\n onCellClick?: (event: HeatmapEvent) => void;\n onCellHover?: (event: HeatmapEvent | null) => void;\n rows: string[];\n rowSummary?: { header?: string; values: (string | null)[] };\n showValues?: boolean;\n valueFormat?: (value: number) => string;\n}\n\nexport type SparklineVariant = 'area' | 'bar' | 'line' | 'stack';\n\nexport interface StackSegment {\n color?: string;\n label?: string;\n value: number;\n}\n\nexport interface SparklineEvent {\n index: number;\n originalEvent: Event;\n value: number;\n}\n\nexport interface SparklineConfig {\n a11y?: ChartA11y;\n color?: string;\n cornerRadius?: number;\n curve?: 'linear' | 'monotone' | 'step';\n data: number[] | StackSegment[];\n fillOpacity?: number;\n onClick?: (event: SparklineEvent) => void;\n onHover?: (event: SparklineEvent | null) => void;\n padPixels?: number;\n showEndPoint?: boolean;\n strokeWidth?: number;\n transition?: TransitionOption;\n variant?: SparklineVariant;\n}\n```\n\n## Errors\n\n### `PrismError`\n\n```ts\nclass PrismError extends Error {\n constructor(message: string, opts?: ErrorOptions);\n}\n```\n\nBase class for Prism-originated errors. Its `name` is set to the concrete error class name, and it supports the standard `ErrorOptions` including `cause`.\n\n### `PrismRenderError`\n\n```ts\nclass PrismRenderError extends PrismError {}\n```\n\nThrown when a chart cannot be rendered because its container is not a DOM element, when initial rendering fails (the original error is available as `cause`), or when `update()` is called after disposal. Empty or malformed chart data may instead produce a development warning or an empty rendering, depending on the chart.\n",
|
|
6
6
|
"usage": "---\ntitle: 'Prism: Usage Guide'\ndescription: Create responsive SVG charts, update their data, handle interaction, and theme @vielzeug/prism.\n---\n\n[[toc]]\n\n## Basic Usage\n\nCreate a host element with non-zero dimensions, then pass it to a chart factory. This example creates the host in JavaScript so the snippet can run as written.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\nimport '@vielzeug/prism/theme.css';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst chart = createLineChart(container, {\n a11y: { ariaLabel: 'Revenue by month' },\n series: [\n {\n name: 'Revenue',\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 16 },\n ],\n },\n ],\n tooltip: true,\n});\n\nchart.dispose();\n```\n\nEach factory appends an SVG to its container and returns a `ChartHandle`. Prism observes the container with `ResizeObserver`; if it has zero dimensions on creation, Prism uses a temporary `600 × 300` size and warns in development. Give the host its layout before creating the chart.\n\n## Updating Data\n\nKeep application state outside Prism and pass the next complete data value to `update()`. The update method replaces chart data synchronously; the default transition may animate the resulting SVG.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nlet series = [{ data: [{ key: 1, value: 10 }], name: 'Live' }];\nconst chart = createLineChart(container, { series });\n\nseries = [\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 20 },\n ],\n name: 'Live',\n },\n];\nchart.update(series);\nchart.dispose();\n```\n\n`update()` accepts the type shown by that factory's handle: a complete series array for line, area, scatter, bar, and radar charts; a slice array for pie charts; a `HeatmapData` object for heatmap charts; and a number or stack-segment array for sparklines. Chart options such as axes, variant, callbacks, and accessibility are set at creation. For example, radar axes and a pie chart's variant do not change through `update()`.\n\n## Line Charts\n\nLine and area series use number or `Date` keys. All series in one chart must use the same key kind. Use `curve` to choose interpolation, and enable markers with `showPoints`.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst chart = createLineChart(container, {\n a11y: { ariaLabel: 'Revenue and expenses' },\n series: [\n {\n curve: 'monotone',\n data: [\n { key: 1, value: 100 },\n { key: 2, value: 150 },\n { key: 3, value: 130 },\n ],\n name: 'Revenue',\n showPoints: true,\n },\n {\n color: '#c2410c',\n data: [\n { key: 1, value: 70 },\n { key: 2, value: 95 },\n { key: 3, value: 110 },\n ],\n name: 'Expenses',\n },\n ],\n tooltip: true,\n xAxis: { label: 'Month' },\n yAxis: { grid: true, label: 'Dollars' },\n});\n\nchart.dispose();\n```\n\n### Independent Value Axes\n\nAssign a line series to the right axis when it uses a different value range. Both axes share the x-scale; `rightYAxis` configures the second axis and cannot configure its position or grid.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst chart = createLineChart(container, {\n a11y: { ariaLabel: 'Health and damage by level' },\n rightYAxis: { label: 'Damage' },\n series: [\n {\n data: [\n { key: 1, value: 30 },\n { key: 2, value: 20 },\n ],\n name: 'Health',\n },\n {\n data: [\n { key: 1, value: 100 },\n { key: 2, value: 300 },\n ],\n name: 'Damage',\n yAxis: 'right',\n },\n ],\n yAxis: { grid: true, label: 'Health' },\n});\n\nchart.dispose();\n```\n\nWhen any series uses the right axis, the primary value axis is placed on the left. Grid lines belong to the primary `yAxis`. The independent numeric scales mean that curve crossings do not imply equal values.\n\n### Time-Based X Axis\n\nUse `Date` values for every key when plotting time. Line and area charts use a time scale whose domain fits the data instead of rounding outward to tick boundaries.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst formatter = new Intl.DateTimeFormat(undefined, { month: 'short', day: 'numeric' });\nconst chart = createLineChart(container, {\n a11y: { ariaLabel: 'Signups over time' },\n series: [\n {\n data: [\n { key: new Date('2026-09-01'), value: 50 },\n { key: new Date('2026-09-08'), value: 80 },\n { key: new Date('2026-09-15'), value: 120 },\n ],\n name: 'Signups',\n },\n ],\n xAxis: { tickFormat: (value) => (value instanceof Date ? formatter.format(value) : String(value)) },\n});\n\nchart.dispose();\n```\n\n`tickFormat` formats axis labels only. Tooltip content and accessibility announcements use the underlying keys and values. To render an exact set of ticks instead of scale-generated ones, pass `tickValues`; gridlines follow the same list. Values must match the axis's scale kind, and an off-scale value warns in development:\n\n```ts\n// Force a tick on the last month, which nice-stepped ticks can skip.\nconst chart = createLineChart(container, {\n series: [\n {\n data: [\n { key: 0, value: 90 },\n { key: 11, value: 128 },\n ],\n name: 'Costs',\n },\n ],\n xAxis: { tickValues: [0, 6, 11] },\n});\n```\n\nNumeric tick labels at a magnitude of `1e5` or above default to compact notation (`123K`, `1.23M`) so long numbers fit the default value-axis margin; pass `tickFormat: String` for raw labels. Supplying a partial value-axis config merges over its default, so `yAxis: { tickFormat }` alone keeps the default grid lines.\n\n## Bar Charts\n\nBar chart keys are string categories. The default `grouped` variant puts series side by side; the horizontal variants put categories on the y-axis and values on the x-axis.\n\n```ts\nimport { createBarChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst chart = createBarChart(container, {\n a11y: { ariaLabel: 'Sales by quarter' },\n series: [\n {\n data: [\n { key: 'Q1', value: 200 },\n { key: 'Q2', value: 350 },\n { key: 'Q3', value: 280 },\n ],\n name: 'Sales',\n },\n ],\n tooltip: true,\n});\n\nchart.dispose();\n```\n\nChoose `grouped`, `stacked`, `grouped-horizontal`, or `stacked-horizontal` in `variant`. Negative values in a stacked chart are clamped to zero and produce a development warning. Bars in stacked variants remain square; `borderRadius` applies to grouped bars.\n\nAxes render by default, with grid lines on the value axis. For horizontal variants, `xAxis` is the value axis and `yAxis` is the category axis. Configure `grid` on the value axis.\n\nSet `showValues: true` to paint each bar's value at its end so the chart reads without hover; `valueFormat` shapes the label text. Stacked variants label the stack total at the top of the stack, and labels that would overflow the plot flip inside the bar with a contrasting fill. The labels are decorative (`aria-hidden`) — the accessible read stays with the chart's data table.\n\n## Area Charts\n\nArea series use a gradient fill by default. Set `fill: 'solid'` for a flat fill, or set `fillOpacity` to override the theme opacity for that series.\n\n```ts\nimport { createAreaChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst chart = createAreaChart(container, {\n a11y: { ariaLabel: 'Visitors over time' },\n crosshair: true,\n series: [\n {\n curve: 'monotone',\n data: [\n { key: 1, value: 12 },\n { key: 2, value: 18 },\n { key: 3, value: 15 },\n ],\n fill: 'solid',\n fillOpacity: 0.2,\n name: 'Visitors',\n showLine: true,\n },\n ],\n});\n\nchart.dispose();\n```\n\n## Scatter Charts\n\nScatter charts treat every datum as an independent point: `key` is the numeric or `Date` x-value and `value` is the y-value. The scales fit the observed values rather than forcing the y-domain to include zero. Set `pointRadius` on a series to change its marker size (default `3`).\n\n```ts\nimport { createScatterChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst chart = createScatterChart(container, {\n a11y: { ariaLabel: 'Height against weight' },\n series: [\n {\n data: [\n { key: 160, value: 55 },\n { key: 175, value: 70 },\n { key: 190, value: 88 },\n ],\n name: 'Cohort A',\n pointRadius: 5,\n },\n ],\n tooltip: true,\n});\n\nchart.dispose();\n```\n\nScatter callbacks identify the nearest point in two dimensions and do not provide cross-series `values`, because points do not share a category key. Keyboard navigation visits every point across series in x order. With a tooltip, `titleFormat` formats the x-value and `valueFormat` the y-value, in both the visible row and the spoken summary.\n\n## Forecast and Emphasis Styling\n\nAdd `dash` or `opacity` to individual `Datum` objects when one part of a series needs distinct styling. These fields do not change interaction, tooltip, or accessibility behavior.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst values = [10, 13, 15, 18];\nconst chart = createLineChart(container, {\n series: [\n {\n data: values.map((value, index) => ({\n key: index + 1,\n value,\n ...(index >= 2 ? { dash: '5 5', opacity: 0.4 } : {}),\n })),\n name: 'Forecast',\n showPoints: true,\n },\n ],\n});\n\nchart.dispose();\n```\n\nFor line and area charts, each datum's `dash` styles the segment from that datum to the next; the final datum has no outgoing segment. Line opacity also fades the datum's marker. Area styling affects the top line, not the fill. Bar opacity and dashes apply to the individual bar; scatter opacity applies to its point and scatter dashes are ignored. Pie, radar, and sparkline ignore these two fields.\n\n## Pie, Donut, and Semi Charts\n\nUse `createPieChart()` for all three shapes. `variant` is fixed when the chart is created; `update()` replaces the slice data.\n\n```ts\nimport { createPieChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:320px;height:240px';\ndocument.body.append(container);\n\nconst chart = createPieChart(container, {\n a11y: { ariaLabel: 'Orders by channel' },\n data: [\n { label: 'Direct', value: 42 },\n { label: 'Organic', value: 28 },\n { label: 'Referral', value: 18 },\n { label: 'Social', value: 12 },\n ],\n legend: true,\n tooltip: true,\n variant: 'donut',\n});\n\nchart.dispose();\n```\n\nThe `pie` default has no inner radius. `donut` and `semi` default to an inner radius of 55% of the outer radius. `innerRadius` overrides that size in pixels. Slice labels are omitted when they do not fit; keep a tooltip or legend when small slices need identifying.\n\n## Radar Charts\n\nDefine at least three axes when creating a radar chart. Series data uses string keys that match `RadarAxisConfig.key`; `update()` replaces series but keeps axes and other configuration fixed.\n\n```ts\nimport { createRadarChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:400px;height:320px';\ndocument.body.append(container);\n\nconst axes = [\n { key: 'strength', label: 'Strength' },\n { key: 'agility', label: 'Agility' },\n { key: 'endurance', label: 'Endurance' },\n];\nconst chart = createRadarChart(container, {\n a11y: { ariaLabel: 'Hero stats' },\n axes,\n domain: [0, 10],\n series: [\n {\n data: [\n { key: 'strength', value: 8 },\n { key: 'agility', value: 6 },\n { key: 'endurance', value: 9 },\n ],\n name: 'Adam',\n },\n ],\n tooltip: true,\n});\n\nchart.dispose();\n```\n\nThe default shared domain starts at zero and uses a nice maximum; set `domain` to compare series on a fixed range. Per-axis `min` and `max` override the chart domain for that axis. Grid rings, bands, curves, fills, vertex dots, and values are configurable; see `RadarChartConfig` and `RadarGridConfig` in the API reference.\n\n## Heatmaps\n\nDefine `rows`, `columns`, and `cells`; each cell names its `row` and `column` labels. A cell with `value: null` (or no matching cell at all) renders in `emptyColor` without in-cell text. `rowSummary` adds a right-hand column of pre-formatted per-row texts (aligned with `rows`, with an optional header) — useful for a per-row rate the cells cannot show. `update()` replaces cells and may replace `rows`, `columns`, `domain`, and `rowSummary`.\n\n```ts\nimport { createHeatmapChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:400px;height:320px';\ndocument.body.append(container);\n\nconst chart = createHeatmapChart(container, {\n a11y: { ariaLabel: 'Win rate by hero and region' },\n bins: [50, 75],\n cells: [\n { column: 'Forest', row: 'Aria', value: 90 },\n { column: 'Swamp', row: 'Aria', value: 40 },\n { column: 'Forest', row: 'Brom', value: 20 },\n { column: 'Swamp', row: 'Brom', value: 75 },\n ],\n columns: ['Forest', 'Swamp'],\n rows: ['Aria', 'Brom'],\n tooltip: true,\n valueFormat: (value) => `${value}%`,\n});\n\nchart.dispose();\n```\n\nWithout `bins` the ramp is continuous over the data's `[min, max]` domain (or an explicit `domain`); with `bins` each value maps to a discrete step and a swatch legend appears. `colorRange` sets the ramp low → high, `valueFormat` shapes in-cell values, tooltip values, and bin labels, and `showValues: false` hides the in-cell text.\n\n## Sparklines\n\nSparklines omit axes, margins, and legends. Choose `line`, `area`, or `bar` for numeric arrays, and `stack` for an array of `StackSegment` objects.\n\n```ts\nimport { createSparkline } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:240px;height:48px';\ndocument.body.append(container);\n\nconst chart = createSparkline(container, {\n a11y: { ariaLabel: 'Weekly orders' },\n data: [10, 14, 12, 18, 22],\n variant: 'area',\n});\n\nchart.update([10, 14, 12, 18, 22, 25]);\nchart.dispose();\n```\n\nFor a stacked sparkline, each segment can set `value`, `color`, and `label`. Sparklines do not offer keyboard navigation, a tooltip, or a live value announcer. Add a visible value or summary when the trend conveys important information.\n\n## Interaction\n\nSet `tooltip: true` to show Prism's default tooltip, or pass a `TooltipConfig` to format its content. `titleFormat` and `valueFormat` shape the default comparison tooltip on line, area, and bar charts—the title from the focused key and each row's value—without rebuilding its markup, and the same formatting is applied to the tooltip's spoken summary. A `render` callback receives the active `Datum` and `Series` and replaces the whole body, taking precedence over the formatters. Returned strings are inserted as text; return a DOM `Node` for structured content.\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst compact = new Intl.NumberFormat(undefined, { notation: 'compact' });\nconst months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\nconst chart = createLineChart(container, {\n series: [{ data: [{ key: 11, value: 128000 }], name: 'EC2' }],\n tooltip: {\n titleFormat: (key) => months[Number(key)] ?? String(key),\n valueFormat: (value) => compact.format(value),\n },\n});\n\nchart.dispose();\n```\n\n`onHover` receives an event while a point, category, slice, or radar axis is active, then `null` when the interaction clears. `onClick` receives the selected event. For line, area, and bar charts, `ChartEvent.values` contains each series' datum at that shared key; a missing datum is `undefined`. Scatter events are `ChartEvent` objects without `values`; pie, radar, and sparkline use their chart-specific event types.\n\n`crosshair` is available on line, area, and scatter charts. By default it shows a vertical guide and snaps the line to the nearest datum. Set `horizontal: true` to add a horizontal guide or `vertical: false` to hide the vertical one. Set `snap: false` to make the guide follow the pointer; tooltip and callback data still come from the nearest datum.\n\n### Keyboard and Announcements\n\nSet `a11y: { ariaLabel }` on an informative chart. Prism gives the SVG `role=\"img\"`, an accessible name, and keyboard focus. Arrow keys move among chart data; `Home` and `End` move to the first and last item where supported; `Enter` or `Space` activates an item when an `onClick` callback is configured; `Escape` clears the active selection. Sparklines do not support keyboard navigation.\n\nWhen `a11y` is omitted, or set to `{ decorative: true }`, the SVG is marked `aria-hidden=\"true\"` and does not enter the keyboard tab order. Only mark charts decorative when their information is available elsewhere. Interactive cartesian, pie, radar, and heatmap charts use the tooltip as a polite live region when enabled; otherwise they announce active values in `.prism-live`. Sparklines have no live value announcements, so provide an equivalent visible value or summary.\n\n## Animation\n\nChart motion is enabled by default, with a 300 ms duration per animated lane (radar uses 400 ms). Pass `transition: false` to render updates synchronously, or pass `true` to state the default explicitly.\n\n```ts\nimport { createBarChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst chart = createBarChart(container, {\n series: [\n {\n data: [\n { key: 'A', value: 4 },\n { key: 'B', value: 7 },\n ],\n name: 'Count',\n },\n ],\n transition: { duration: 500, easing: 'ease-out', preference: 'system' },\n});\n\nchart.dispose();\n```\n\nColumns grow together from their baseline by default over 300 ms. Lines trace their final curve over 420 ms, uncovering point markers along the way without fading or shifting the series. Line data updates retain the default 300 ms geometry transition; an explicit `duration` overrides both timings.\n\n`preference: 'system'` (the default) disables JavaScript motion when the user prefers reduced motion. Use `'always'` to ignore that preference or `'never'` to disable motion. `stagger` sets an optional delay between bars, entering scatter points (in x order), or radar series; bar and scatter charts cap the effective delay so many marks do not add unbounded time. Named easing values are `ease-in`, `ease-in-out`, `ease-out`, `back-out`, `expo-out`, and `linear`; you can also provide an easing function.\n\n## Responsive Layout and Lifecycle\n\nSize the host with CSS. Prism observes its content box and updates the SVG dimensions and chart layout when it changes. Bar, line, and scatter resize redraws apply immediately rather than animating between layout sizes; entrance animations and explicit data-update transitions remain enabled. The legend is rendered as container chrome outside the SVG and included in resize calculations.\n\nCall `dispose()` when the view no longer owns the chart. Disposal is idempotent: it removes the SVG, tooltip, legend, and resize observation, stops in-flight chart motion, and aborts `disposalSignal`. `chart[Symbol.dispose]()` calls the same cleanup method.\n\nUse `tap()` when external code needs resize or dispose notifications rather than observing the chart DOM itself:\n\n```ts\nimport { createLineChart } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nconst chart = createLineChart(container, {\n series: [{ data: [{ key: 1, value: 10 }], name: 'Revenue' }],\n});\nconst stopObserving = chart.tap((event) => {\n if (event.type === 'resize') console.log(event.width, event.height);\n if (event.type === 'dispose') console.log('chart disposed');\n});\n\nstopObserving();\nchart.dispose();\n```\n\n`tap()` returns an unsubscribe function and accepts `{ signal }` for automatic unsubscription. A listener exception is swallowed by the observer so it cannot interrupt chart rendering.\n\n## Theming\n\nImport the stylesheet once to load Prism's structural styles, default tokens, dark-mode rules, and reduced-motion CSS. You can override any CSS custom property on an ancestor of the chart.\n\n```css\n.dashboard-chart {\n --prism-color-1: #2563eb;\n --prism-color-2: #16a34a;\n --prism-grid-color: #94a3b8;\n --prism-line-width: 3;\n --prism-text-color: #172033;\n --prism-tooltip-bg: #111827;\n}\n```\n\n`setTheme()` provides a typed subset of theme properties. A scoped call writes inline values on the provided element; omit `scope` to write them to `document.documentElement`. Inline values override stylesheet tokens until reset.\n\n```ts\nimport { resetTheme, setTheme } from '@vielzeug/prism';\n\nconst container = document.createElement('div');\ncontainer.style.cssText = 'width:640px;height:320px';\ndocument.body.append(container);\n\nsetTheme({ colors: ['#2563eb', '#16a34a'], fontFamily: 'Inter, sans-serif' }, { scope: container });\n// Call resetTheme({ scope: container }) when this scoped theme is no longer needed.\nresetTheme({ scope: container });\n```\n\n### Available Tokens\n\nThe stylesheet defines defaults for the following token groups. Pie-label color and size are read with fallback values by the renderer but are not declared in the base token block. Set a token on the chart container or an ancestor to scope an override.\n\n| Group | CSS custom properties |\n| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Palette and surfaces | `--prism-color-1` through `--prism-color-8`, `--prism-bg`, `--prism-border-radius` |\n| Axes and grid | `--prism-axis-color`, `--prism-axis-width`, `--prism-grid-color`, `--prism-grid-width`, `--prism-grid-dash`, `--prism-grid-opacity` |\n| Text | `--prism-font-family`, `--prism-font-size`, `--prism-font-size-label`, `--prism-font-size-title`, `--prism-font-weight`, `--prism-font-weight-title`, `--prism-text-color`, `--prism-text-color-secondary` |\n| Tooltip | `--prism-tooltip-bg`, `--prism-tooltip-color`, `--prism-tooltip-border`, `--prism-tooltip-radius`, `--prism-tooltip-padding`, `--prism-tooltip-shadow`, `--prism-tooltip-font-size` |\n| Crosshair | `--prism-crosshair-color`, `--prism-crosshair-width`, `--prism-crosshair-dash`, `--prism-crosshair-opacity` |\n| Points | `--prism-point-radius`, `--prism-point-radius-hover`, `--prism-point-stroke-width`, `--prism-point-stroke` |\n| Bars | `--prism-bar-radius`, `--prism-bar-hover-opacity`, `--prism-bar-gap`, `--prism-bar-band-fill`, `--prism-bar-band-opacity`, `--prism-bar-dim-opacity` |\n| Areas and lines | `--prism-area-opacity`, `--prism-area-stroke-width`, `--prism-area-gradient-start`, `--prism-area-gradient-end`, `--prism-line-width`, `--prism-line-width-hover` |\n| Interaction | `--prism-dim-opacity`, `--prism-active-point-radius`, `--prism-point-ring`, `--prism-focus-color` |\n| Sparklines | `--prism-spark-fill-opacity`, `--prism-spark-gradient-start`, `--prism-spark-gradient-end` |\n| Radar | `--prism-radar-grid-color`, `--prism-radar-grid-opacity`, `--prism-radar-band-fill`, `--prism-radar-band-opacity`, `--prism-radar-spoke-color`, `--prism-radar-fill-opacity`, `--prism-radar-stroke-width`, `--prism-radar-point-radius`, `--prism-radar-point-radius-active`, `--prism-radar-label-color`, `--prism-radar-label-size`, `--prism-radar-value-color`, `--prism-radar-value-size`, `--prism-radar-dim-opacity` |\n| Heatmap | `--prism-heatmap-label-color`, `--prism-heatmap-label-size`, `--prism-heatmap-value-size`, `--prism-heatmap-highlight-color` |\n| Motion | `--prism-duration-fast`, `--prism-duration`, `--prism-duration-slow`, `--prism-ease`, `--prism-ease-spring`, `--prism-transition`, `--prism-transition-fast` |\n| Legend and pie labels | `--prism-legend-gap`, `--prism-legend-dot-size`, `--prism-legend-font-size`, `--prism-pie-label-color`, `--prism-pie-label-size` |\n\nThe default palette and structural colors adapt to `prefers-color-scheme: dark`, `html.dark`, or `[data-prism-theme='dark']` on an ancestor. Scoped inline values set with `setTheme()` take precedence in either mode. The stylesheet also provides `prefers-reduced-motion` overrides for CSS transitions.\n\n## Errors and Diagnostics\n\nPrism throws `PrismRenderError` when the container is not a DOM element, when initial rendering fails, or when `update()` is called on a disposed chart. A wrapped initial-render error exposes its cause. Use `PrismError` to catch all Prism-originated errors.\n\nEmpty or malformed data is not always an exception. Depending on the chart, Prism may draw nothing or emit a development-only `console.warn`; examples include an unknown `bandScale` category, negative values in stacked bars, and radar axes with fewer than three entries or duplicate keys. Correct the input rather than relying on a warning for validation.\n\n## Framework Integration\n\nPrism has no React, Vue, or Svelte adapter. In any framework, give Prism a host element after it is mounted, call `update()` when data changes, and call `dispose()` before the host is removed. This plain DOM pattern shows the ownership boundary without depending on a framework-specific lifecycle API:\n\n```ts\nimport { createLineChart, type LineSeriesConfig } from '@vielzeug/prism';\n\nfunction mountChart(host: HTMLElement, series: LineSeriesConfig[]) {\n const chart = createLineChart(host, { a11y: { ariaLabel: 'Revenue' }, series });\n\n return {\n update(next: LineSeriesConfig[]) {\n chart.update(next);\n },\n dispose() {\n chart.dispose();\n },\n };\n}\n\nconst host = document.createElement('div');\nhost.style.cssText = 'width:640px;height:320px';\ndocument.body.append(host);\nconst view = mountChart(host, [{ data: [{ key: 1, value: 10 }], name: 'Revenue' }]);\nview.update([\n {\n data: [\n { key: 1, value: 10 },\n { key: 2, value: 15 },\n ],\n name: 'Revenue',\n },\n]);\nview.dispose();\n```\n\nThe application owns its state and host; Prism owns only the SVG, observer, and optional overlay elements it creates.\n\n## Working with Other Vielzeug Libraries\n\nUse Refine components for dashboard controls and keep Prism in a sized host element. Map Refine theme tokens to Prism CSS custom properties or call `setTheme()` with a scoped element; Prism does not require a Refine adapter. Prism uses Orbit internally to place tooltips, so chart users do not need to create Orbit floating elements for the built-in tooltip.\n\n## Best Practices\n\n- Give the host a non-zero size before creating a chart.\n- Set `a11y.ariaLabel` when a chart communicates information.\n- Use `Date` or number keys consistently across each line or area chart.\n- Pass the complete new data value to `update()`.\n- Keep chart options fixed after creation; recreate the chart to change them.\n- Dispose the handle when its host leaves the owning view.\n- Use `transition: false` for deterministic synchronous rendering.\n- Prefer CSS custom properties for reusable theme overrides.\n",
|
|
7
7
|
"examples": "---\ntitle: 'Prism: Examples'\ndescription: Focused recipes for creating, updating, interacting with, and theming Prism charts.\n---\n\n- [Create a line chart](./examples/line-chart.md)\n- [Plot a time series](./examples/time-series.md)\n- [Plot a scatter chart](./examples/scatter-chart.md)\n- [Compare categories with a bar chart](./examples/bar-chart.md)\n- [Render compact charts](./examples/compact-charts.md)\n- [Compare hero stats with a radar chart](./examples/radar-chart.md)\n- [Show a win-rate matrix with a heatmap](./examples/heatmap-chart.md)\n- [Update chart data](./examples/update-data.md)\n- [Sync a details panel with hover](./examples/hover-details.md)\n- [Render a custom tooltip](./examples/custom-tooltip.md)\n- [Match charts to your design system](./examples/theming.md)\n"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiSource": "// Public root surface of @vielzeug/stage. Every public export goes through this file.\n\nexport { StageConfigError, StageDisposedError, StageError, StageUnsupportedError } from './errors.js';\nexport {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';\n",
|
|
3
|
+
"docs": {
|
|
4
|
+
"index": "---\ntitle: 'Stage: Retained-Mode 2D Canvas Engine'\ndescription: 'Retained-mode 2D canvas stage engine with DPR-aware layers, dirty repaints, and PNG export'\npackage: stage\ncategory: utilities\nkeywords: [canvas, rendering, layers, dpr, offscreencanvas, png-export, 2d]\nexports: [createStage, StageError, StageConfigError, StageDisposedError, StageUnsupportedError]\nrelated: [atlas, gesture, ink]\nenvironments: [browser, worker]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"stage\" />\n\n## Why Stage?\n\nA `requestAnimationFrame` loop that redraws everything every frame falls over once a canvas has more than a handful of layers: backgrounds, tiles, tokens, and overlays all repaint even when one token moved. Stage gives you a retained-mode alternative as a headless engine: every layer owns a cached backing surface, only dirty layers repaint, and the composite is one `drawImage` per layer. It handles DPR scaling, world-space transforms (pair it with `@vielzeug/atlas` cameras), and PNG export — with injectable surfaces and schedulers so the whole thing is unit-testable without a GPU.\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/stage\n```\n\n```sh [npm]\nnpm install @vielzeug/stage\n```\n\n```sh [yarn]\nyarn add @vielzeug/stage\n```\n\n:::\n\n## Quick Start\n\n```ts\nimport { createStage } from '@vielzeug/stage';\n\nconst stage = createStage(canvas, {\n dpr: window.devicePixelRatio,\n height: 600,\n layers: [\n { id: 'grid', paint: (ctx, { visibleRect }) => drawGrid(ctx, visibleRect) },\n { id: 'tokens', paint: (ctx) => drawTokens(ctx) },\n ],\n width: 800,\n});\n\nstage.setTransform([2, 0, 0, 2, 40, 10]); // world→screen; DPR applied on top\ntoken.x += 10;\nstage.invalidate('tokens'); // only the tokens layer repaints\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- **`createStage()`**: layered retained-mode renderer with cached per-layer surfaces\n- **Dirty repaints**: invalidate one layer or all; frames coalesce via an injectable scheduler\n- **DPR-aware transforms**: paint in world units, the stage scales by `dpr × matrix`\n- **`StageController`**: one control type shared by main-thread and worker stages\n- **`toBlob()`**: PNG export of the composited canvas, flushing pending frames, with typed unsupported-capability errors\n- **Injectable surfaces**: `createSurface` factory for tests and `OffscreenCanvas` workers\n- **`@vielzeug/stage/worker`**: worker-rendered stages via a transferred `OffscreenCanvas` and a typed scene channel\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Atlas](/atlas/): cameras, spatial index, and tile grids that feed Stage transforms.\n- [Gesture](/gesture/): pointer drag, pinch, and wheel recognition.\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
|
+
"api": "---\ntitle: 'Stage: API Reference'\ndescription: API reference for the Stage retained-mode 2D canvas engine.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution | Common gotcha |\n| ----------------------- | ------------------------------------------------------- | --------- | ----------------------------------------------------------------- |\n| `createStage()` | Retained-mode layered canvas renderer | Sync | Paint callbacks draw in world units; the stage applies the matrix |\n| `StageController` | Control surface shared by main-thread and worker stages | Type | Both modes are assignable to it; mode extras are not |\n| `StageError` | Base class for all stage errors | Sync | Narrow with `instanceof StageError` |\n| `StageConfigError` | Invalid sizes, duplicate/unknown layer ids | Sync | Thrown at call time, in both modes |\n| `StageDisposedError` | Blob export or worker request after disposal | Sync | Worker blob failures carry a `kind` mapped to this class |\n| `StageUnsupportedError` | Missing browser capability (2D context, blob export) | Sync | No silent degradation to a lesser path |\n\n## Package Entry Point\n\n| Import | Purpose |\n| ------------------------ | ------------------------------------------------- |\n| `@vielzeug/stage` | Stage factory, controller type, and error classes |\n| `@vielzeug/stage/worker` | Worker-rendered stages over `OffscreenCanvas` |\n\nGeometry is not re-declared here: `Point`, `Rect`, `Matrix`, and `FrameScheduler` come from\n[`@vielzeug/atlas`](/atlas/api/), which `@vielzeug/stage` depends on.\n\n---\n\n## Core Types\n\n```ts\nimport type { FrameScheduler, Matrix, Rect, Size } from '@vielzeug/atlas';\n\ntype PaintContext = Readonly<{\n /** World→screen matrix (DPR already applied to the context transform). */\n matrix: Matrix;\n /** Visible world-space rect for culling. */\n visibleRect: Rect;\n /** Device pixel ratio in effect. */\n dpr: number;\n /** Frame timestamp from the scheduler. */\n time: number;\n}>;\n\n/** A backing surface a layer paints into. `OffscreenCanvas` on workers. */\ntype StageSurface = {\n width: number;\n height: number;\n getContext: (type: '2d', attributes?: CanvasRenderingContext2DSettings) => unknown;\n};\ntype CreateSurface = (width: number, height: number) => StageSurface;\n\n/**\n * The control surface both stage modes share. A main-thread `Stage` and a\n * `WorkerStage` are interchangeable wherever only control is needed.\n */\ntype StageController = Readonly<{\n resize: (size: Size, dpr?: number) => void;\n setTransform: (matrix: Matrix) => void;\n invalidate: (layerId?: string) => void;\n toBlob: (options?: { type?: string; quality?: number }) => Promise<Blob>;\n dispose: () => void;\n readonly disposed: boolean;\n readonly disposalSignal: AbortSignal;\n [Symbol.dispose]: () => void;\n}>;\n```\n\n`Size` comes from [`@vielzeug/atlas`](/atlas/api/) as well.\n\n---\n\n## `createStage()`\n\n```ts\nfunction createStage(\n canvas: HTMLCanvasElement | OffscreenCanvas,\n options: StageOptions & Readonly<{ width: number; height: number }>,\n): Stage;\n```\n\nCreates a retained-mode stage: every layer owns a cached backing surface, is repainted only when dirty, and all layers are composited onto `canvas` in order each scheduled frame. The canvas backing store is sized `width × dpr` by `height × dpr`.\n\n| Parameter | Type | Description |\n| ----------------------- | -------------------------------------- | ---------------------------------------------------------------------- |\n| `canvas` | `HTMLCanvasElement \\| OffscreenCanvas` | Canvas the stage composites into (visible or transferred) |\n| `options.width` | `number` | CSS width in pixels; must be positive and finite |\n| `options.height` | `number` | CSS height in pixels; must be positive and finite |\n| `options.dpr` | `number?` | Device pixel ratio; defaults to `1` |\n| `options.layers` | `readonly StageLayerOptions[]` | Layers in paint order, fixed at creation; duplicate ids throw |\n| `options.scheduler` | `FrameScheduler?` | Injectable rAF scheduler for deterministic tests |\n| `options.createSurface` | `CreateSurface?` | Backing-surface factory; defaults to `OffscreenCanvas`/document canvas |\n| `options.background` | `string \\| null?` | Color cleared under the layers; defaults to transparent |\n\n**Returns:** `Stage` handle.\n\n**Example**\n\n```ts\nconst stage = createStage(canvas, {\n width: 800,\n height: 600,\n dpr: window.devicePixelRatio,\n layers: [{ id: 'scene', paint: (ctx, { visibleRect }) => drawScene(ctx, visibleRect) }],\n});\nstage.setTransform([2, 0, 0, 2, 40, 10]); // world→screen, CSS pixels\nstage.invalidate('scene');\n```\n\n### `Stage` members\n\n`Stage` extends `StageController` (`resize`, `setTransform`, `invalidate`, `toBlob`, `dispose`, `disposed`, `disposalSignal`, `[Symbol.dispose]`) and adds:\n\n| Member | Description |\n| -------------------------------------------- | -------------------------------------------------------------------------------------- |\n| `render(time?)` | Runs the pending repaint/composite synchronously; `time` defaults to `scheduler.now()` |\n| `visibleRect` | Visible world-space rect derived from the inverse transform |\n| `matrix`, `width`, `height`, `dpr`, `canvas` | Current configuration |\n\n`toBlob()` flushes a pending frame before rasterizing, so it always exports the current frame. Paint callbacks receive a context whose transform is `dpr × matrix`, so they draw in world units. Clear and reset with `ctx.setTransform(1, 0, 0, 1, 0, 0)` only if you must paint in device pixels.\n\n---\n\n## Worker Subpath (`@vielzeug/stage/worker`)\n\n| Export | Description |\n| ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `createWorkerStage<Scene>(canvas, worker, options)` | Main-thread client: transfers `canvas` to `worker` once, then drives it; a `StageController` plus `ready` and `sendScene(scene: Scene)` |\n| `serveStage<Scene>(scope, setup)` | Worker half: waits for `init`, creates a `createStage` on the transferred `OffscreenCanvas`, and services commands; `setup` returns `{ layers, onScene?, onDispose? }` |\n| `WorkerScope`, `WorkerSelfScope`, `WorkerStage`, `WorkerStageOptions`, `ServeStageSetup`, `StageServer` | Supporting types for both halves |\n\nThe worker owns its layer painters: `serveStage`'s `setup` supplies them, and the main thread never names layers. `onScene(scene, stage)` runs for each forwarded `scene` command and owns repaints — call `stage.invalidate(layerId)` for the layers the payload changed. `server.stage` exposes the created stage whenever you need it.\n\n`Scene` is the application payload type shared by `sendScene` and `onScene`, so neither side casts. Invalid size, DPR, or matrix input throws `StageConfigError` on the main thread, exactly like `createStage`. Worker-side exceptions are surfaced through `reportError`. The message protocol is internal: its version is checked once at the init/ready handshake, and a mismatch rejects `ready` with a `StageError` and disposes the stage.\n\n`createWorkerStage` throws `StageUnsupportedError` when the canvas cannot transfer control (`transferControlToOffscreen` missing). `dispose()` posts a final `dispose` command, rejects in-flight `toBlob()` promises with `StageDisposedError`, aborts `disposalSignal` (terminate the worker from there — the creator owns it), and makes later calls inert.\n\n## Errors\n\n| Class | Thrown when |\n| ----------------------- | ----------------------------------------------------------------- |\n| `StageError` | Base class; catch all stage failures with `instanceof` |\n| `StageConfigError` | Non-positive sizes, non-finite matrices, duplicate/unknown ids |\n| `StageDisposedError` | `toBlob()` after `dispose()`, or worker blob rejected on disposal |\n| `StageUnsupportedError` | No 2D context on a surface, or `canvas.toBlob` missing/failing |\n",
|
|
6
|
+
"usage": "---\ntitle: 'Stage: Usage Guide'\ndescription: 'How to drive a @vielzeug/stage layered canvas: layers, transforms, dirty repaints, and export.'\n---\n\n[[toc]]\n\n## Basic Usage\n\n```ts\nimport { createStage } from '@vielzeug/stage';\n\nconst stage = createStage(canvas, {\n width: canvas.clientWidth,\n height: canvas.clientHeight,\n dpr: window.devicePixelRatio,\n layers: [\n { id: 'grid', paint: (ctx, { visibleRect }) => drawGrid(ctx, visibleRect) },\n { id: 'scene', paint: (ctx, { visibleRect }) => drawScene(ctx, visibleRect) },\n { id: 'overlay', paint: (ctx) => drawSelection(ctx) },\n ],\n});\n```\n\nEach layer paints into its own cached backing surface. The stage composites all surfaces onto the visible canvas in registration order whenever a frame is scheduled. Paint callbacks receive a context already transformed by `dpr × matrix`, so they draw in **world units** and can cull against `frame.visibleRect`.\n\nLayers are fixed when the stage is created — the same in both render modes. Hide a layer by returning early from its paint and invalidating it. The stage sizes the canvas backing store; you own the canvas CSS size (set it via CSS or a `ResizeObserver`).\n\n## Driving the Transform\n\nThe stage takes a world→screen matrix in CSS pixels (it applies DPR itself). Pair it with an `@vielzeug/atlas` camera:\n\n```ts\nimport { createCamera } from '@vielzeug/atlas';\n\nconst camera = createCamera({ maxZoom: 16, minZoom: 0.05 });\ncamera.subscribe(() => stage.setTransform(camera.matrix));\n\ncanvas.addEventListener('wheel', (event) => {\n event.preventDefault();\n camera.zoomAt({ x: event.offsetX, y: event.offsetY }, Math.exp(-event.deltaY * 0.0015));\n});\n```\n\n`setTransform()` invalidates every layer — the cached world-space surfaces are no longer valid at the new transform. Compositing stays cheap (one `drawImage` per layer); only the paint callbacks re-run.\n\n## Dirty Repaints\n\nInvalidate the smallest unit that changed:\n\n```ts\ntoken.x += 10;\nstage.invalidate('tokens'); // only the tokens layer repaints next frame\n```\n\nInvalidations within one frame coalesce into a single scheduled frame. Call `stage.render()` to force a synchronous repaint (useful in tests).\n\n## Resize and DPR Changes\n\n```ts\nnew ResizeObserver(([entry]) => {\n stage.resize({ width: entry.contentRect.width, height: entry.contentRect.height }, window.devicePixelRatio);\n}).observe(canvas.parentElement!);\n```\n\n`resize()` resizes the canvas backing store and invalidates all layers; surfaces are reallocated at the new pixel size.\n\n## Exporting a PNG\n\n```ts\nconst blob = await stage.toBlob();\nawait navigator.clipboard.write([new ClipboardItem({ 'image/png': blob })]);\n```\n\n`toBlob()` flushes any pending repaint before rasterizing, so it always captures the current frame — no manual `render()` first. It throws `StageUnsupportedError` when the canvas cannot produce a blob — the stage never silently degrades.\n\n## Testing with Injected Surfaces\n\nInject a fake surface factory and scheduler to unit-test paint behaviour without a GPU:\n\n```ts\nconst frames = { queued: new Set<(t: number) => void>() };\nconst stage = createStage(fakeCanvas, {\n createSurface: (w, h) => fakeSurface(w, h),\n height: 200,\n scheduler: {\n cancelFrame: (id) => frames.queued.delete(id),\n now: () => 0,\n requestFrame: (cb) => {\n frames.queued.add(cb);\n return frames.queued.size;\n },\n },\n width: 400,\n});\n```\n\nThe default factory uses `OffscreenCanvas` when present, else a canvas from the document; in environments with neither, it throws `StageUnsupportedError`.\n\n## Worker Rendering\n\nThe `@vielzeug/stage/worker` subpath renders the composited canvas inside a Web Worker. The main thread transfers an `OffscreenCanvas` once and then drives the stage over an internal message protocol; painters live worker-side. A `WorkerStage` and a main-thread `Stage` share the `StageController` type, so code that only controls a stage works with either.\n\n```ts\n// main.ts\nimport { createWorkerStage } from '@vielzeug/stage/worker';\n\ntype Scene = Readonly<{ col: number; id: string; row: number; type: 'move' }>;\n\nconst worker = new Worker(new URL('./stage.worker.ts', import.meta.url), { type: 'module' });\nconst stage = createWorkerStage<Scene>(canvas, worker, {\n height: 600,\n width: 800,\n});\n// The creator owns the worker: terminate it when the stage is disposed.\nstage.disposalSignal.addEventListener('abort', () => worker.terminate());\n\nawait stage.ready; // the worker created its stage\nstage.setTransform([1, 0, 0, 1, 0, 0]);\nstage.sendScene({ col: 3, id: 'hero', row: 2, type: 'move' });\nconst blob = await stage.toBlob({ type: 'image/png' }); // correlated round-trip\nstage.dispose(); // also rejects any in-flight blob requests\n```\n\n```ts\n// stage.worker.ts\nimport { serveStage } from '@vielzeug/stage/worker';\n\nserveStage<Scene>(self, () => ({\n layers: [{ id: 'scene', paint: (ctx) => ctx.fillRect(0, 0, 800, 600) }],\n onScene: (scene, stage) => {\n applyMove(scene);\n stage.invalidate('scene'); // the handler owns repaints\n },\n}));\n```\n\nNotes:\n\n- The worker owns its painters. `serveStage`'s `setup` returns the `layers` (and optional `onScene`/`onDispose` hooks); the main thread never names layers.\n- The canvas transfer is **one-shot**: `createWorkerStage` calls `transferControlToOffscreen()` on construction. To go back to main-thread rendering, mount a fresh `<canvas>` element.\n- `toBlob()` sends a `blob` command and resolves with the worker's response; requests are correlated by id and reject with `StageDisposedError` if the client is disposed while one is in flight.\n- `sendScene(scene)` forwards your typed payload to the worker's `onScene(scene, stage)` hook — useful for mirroring model state (e.g. token moves) without shipping painters to the main thread. The handler decides which layers to invalidate; nothing repaints automatically.\n- Invalid size, DPR, or matrix input throws `StageConfigError` on the main thread, exactly like `createStage`.\n- Worker-side exceptions are reported through `reportError`, the same path an uncaught main-thread paint error takes. The protocol version is checked once at the init/ready handshake; a stale cached worker rejects `ready` with a `StageError` and disposes the stage.\n\n## Best Practices\n\n- Keep per-layer paint callbacks cheap and cull with `frame.visibleRect`; the stage caches the result, so cost is paid once per invalidation, not per frame.\n- Put rarely-changing content (tile grids, backgrounds) on lower layers so pointer-driven changes only repaint upper layers.\n- Dispose the stage when the view unmounts: `using stage = createStage(...)` or `stage.dispose()`. Disposal cancels scheduled frames and releases every backing surface.\n- Treat `StageUnsupportedError` as a hard capability gap (feature-detect or surface it to the user); there is deliberately no fallback path.\n- In worker mode, invalidate only the layers a scene message changed — `onScene` runs on every forwarded payload.\n",
|
|
7
|
+
"examples": "---\ntitle: 'Stage: Examples'\ndescription: Practical examples and recipes for @vielzeug/stage.\n---\n\n## Examples\n\n- [Layered Repaints](./examples/layered-repaints.md)\n"
|
|
8
|
+
},
|
|
9
|
+
"examples": [],
|
|
10
|
+
"typeSignatures": {
|
|
11
|
+
"StageConfigError": "export { StageConfigError, StageDisposedError, StageError, StageUnsupportedError } from './errors.js';",
|
|
12
|
+
"StageDisposedError": "export { StageConfigError, StageDisposedError, StageError, StageUnsupportedError } from './errors.js';",
|
|
13
|
+
"StageError": "export { StageConfigError, StageDisposedError, StageError, StageUnsupportedError } from './errors.js';",
|
|
14
|
+
"StageUnsupportedError": "export { StageConfigError, StageDisposedError, StageError, StageUnsupportedError } from './errors.js';",
|
|
15
|
+
"CreateSurface": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';",
|
|
16
|
+
"createStage": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';",
|
|
17
|
+
"PaintContext": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';",
|
|
18
|
+
"Stage": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';",
|
|
19
|
+
"StageController": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';",
|
|
20
|
+
"StageFrameInfo": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';",
|
|
21
|
+
"StageLayerOptions": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';",
|
|
22
|
+
"StageOptions": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';",
|
|
23
|
+
"StageSurface": "export {\n type CreateSurface,\n createStage,\n type PaintContext,\n type Stage,\n type StageController,\n type StageFrameInfo,\n type StageLayerOptions,\n type StageOptions,\n type StageSurface,\n} from './stage.js';"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiSource": "// Public root surface of @vielzeug/wire. Every public export goes through this file.\nexport { type BezierRouteOptions, bezierRoute } from './bezier.js';\nexport { WireConfigError, WireError, WireGraphError } from './errors.js';\nexport { findCyclicGroups, topologicalOrder } from './graph.js';\nexport { type OrthogonalRouteOptions, orthogonalRoute } from './orthogonal.js';\nexport { bezierToSvgPath, polylineToSvgPath } from './path.js';\nexport { portAnchor } from './ports.js';\nexport type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';\n",
|
|
3
|
+
"docs": {
|
|
4
|
+
"index": "---\ntitle: 'Wire: Edge Routing for Node Editors'\ndescription: Deterministic bezier and orthogonal edge routing over obstacles, plus topological ordering and cycle detection for node graphs.\npackage: wire\ncategory: utilities\nkeywords:\n [\n edge-routing,\n node-editor,\n flowchart,\n bezier,\n orthogonal,\n manhattan,\n a-star,\n topological-sort,\n cycles,\n tarjan,\n graph,\n svg,\n path,\n dag,\n ]\nexports: [bezierRoute, orthogonalRoute, topologicalOrder, findCyclicGroups]\nrelated: [atlas]\nenvironments: [browser, node, ssr, deno]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"wire\" />\n\n## Why Wire?\n\nNode editors always rediscover the same hard parts: wires that route _around_ nodes instead of through them, bend counts that change every frame, and ordering or cycle checks that recurse until the stack dies on a big graph. Wire computes all of it as pure functions: cubic bezier geometry anchored to port sides, A\\* Manhattan routes over a padded-obstacle visibility graph with a per-bend penalty, input-order-stable topological sorting, and Tarjan SCC cycle detection — iterative, so 50,000-node chains are fine.\n\n```ts\n// Before\n// Straight lines through nodes, hand-rolled A* with nondeterministic tie\n// breaks, and recursive DFS that stack-overflows on deep graphs.\n\n// After\nimport { bezierRoute, findCyclicGroups, orthogonalRoute, topologicalOrder } from '@vielzeug/wire';\n\nconst curve = bezierRoute({ side: 'right', x: 100, y: 40 }, { side: 'left', x: 320, y: 120 });\n\n// Pass every node bound; the router exempts each port's own node for its exit.\nconst waypoints = orthogonalRoute(fromPort, toPort, { obstacles: nodeBounds });\n// waypoints is null when every route is blocked — render a dashed fallback.\n```\n\n| Feature | Wire | Ad-hoc routing | Graph libraries |\n| ---------------------------- | -------------------------------------------- | -------------- | ------------------ |\n| Bundle size | <PackageInfo package=\"wire\" type=\"size\" /> | n/a | Typically 10–80 kB |\n| External dependencies | <ore-icon name=\"check\" size=\"16\"></ore-icon> | n/a | Varies |\n| Obstacle-avoiding orthogonal | Built in (A\\* + bend penalty) | Rare | Sometimes |\n| Deterministic output | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Rare | Varies |\n| Iterative cycle detection | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Recursive DFS | Varies |\n| Headless: no DOM or renderer | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Varies | Usually coupled |\n\n<div class=\"decision-callout\">\n\n**Use Wire when** you own the node layout and rendering but want production-grade edge geometry and graph ordering as pure functions.\n\n**Consider a graph-drawing library when** you also want automatic layout (dagre-style ranking, force simulation) — Wire routes the edges you place, it does not place the nodes.\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/wire\n```\n\n```sh [npm]\nnpm install @vielzeug/wire\n```\n\n```sh [yarn]\nyarn add @vielzeug/wire\n```\n\n:::\n\n## Quick Start\n\n```ts\nimport { bezierRoute, bezierToSvgPath, findCyclicGroups, orthogonalRoute, topologicalOrder } from '@vielzeug/wire';\n\n// Curved wire from a right-facing port to a left-facing port.\nconst curve = bezierRoute({ side: 'right', x: 100, y: 40 }, { side: 'left', x: 320, y: 120 });\nconst d = bezierToSvgPath(curve); // or draw curve.c1/curve.c2 on a canvas\n\n// Manhattan wire that avoids the node boxes.\nconst points = orthogonalRoute(\n { side: 'right', x: 100, y: 40 },\n { side: 'left', x: 320, y: 120 },\n { obstacles: nodeBounds },\n);\n\n// Execution order and cycles for a validation pass.\nconst order = topologicalOrder(\n ['b', 'a', 'c'],\n [\n { from: 'a', to: 'b' },\n { from: 'b', to: 'c' },\n ],\n);\nconst groups = findCyclicGroups(\n ['a', 'b'],\n [\n { from: 'a', to: 'b' },\n { from: 'b', to: 'a' },\n ],\n); // [['a', 'b']]\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- `bezierRoute()`: cubic bezier geometry with control points anchored to port sides\n- `orthogonalRoute()`: A\\* Manhattan polyline over a visibility graph built from obstacle corners, with a per-bend penalty, owner-obstacle exemption, and deterministic expansion order\n- `bezierToSvgPath()` / `polylineToSvgPath()`: SVG `d` serialization with micro-precision formatting\n- `topologicalOrder()`: Kahn ordering with stable input-order tie breaks; throws `WireGraphError` on cycles\n- `findCyclicGroups()`: iterative Tarjan SCCs — each cyclic group reported once, ordered deterministically\n- `WireError` / `WireGraphError` / `WireConfigError`: typed errors\n- Zero runtime dependencies, no DOM requirement: routes and orders are pure computations\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Atlas](/atlas/): the camera and rect shapes Wire's obstacles reuse.\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
|
+
"api": "---\ntitle: 'Wire: API Reference'\ndescription: API reference for Wire's bezier and orthogonal routing, SVG path serialization, and graph ordering helpers.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution | Common gotcha |\n| --------------------------------------------------------------------- | ------------------------------------------------- | --------- | -------------------------------------------------------------------------- |\n| `bezierRoute()` | Cubic bezier geometry between two ports | Sync | Returns a `CubicBezier`, not a string — serialize with `bezierToSvgPath()` |\n| `orthogonalRoute()` | A\\* Manhattan polyline avoiding padded obstacles | Sync | Returns `null` when blocked; waypoints appear only at bends |\n| `portAnchor()` | World position of a port on a node rect | Sync | `offset` is a 0..1 fraction along the side, not a distance |\n| `bezierToSvgPath()` | SVG `d` string from a `CubicBezier` | Sync | Emits one absolute `M`/`C` pair |\n| `polylineToSvgPath()` | SVG `d` string from a polyline | Sync | Empty input returns `''`, not an error |\n| `topologicalOrder()` | Kahn ordering with input-order tie breaks | Sync | Throws `WireGraphError` on any cycle |\n| `findCyclicGroups()` | Cyclic SCCs via iterative Tarjan | Sync | Reports components (sets), not every elementary cycle |\n| `WireError` | Base class for all wire errors | Sync | Narrow with `instanceof WireError` |\n| `WireGraphError` | Unknown endpoints, duplicate ids, cyclic ordering | Sync | Thrown at call time |\n| `WireConfigError` | Invalid routing options | Sync | Thrown at call time |\n| `Point` / `Rect` / `PortAnchor` / `PortSide` / `CubicBezier` / `Edge` | Structural graph shapes | Sync | All readonly; treat as values |\n\n## Package Entry Point\n\n| Import | Purpose |\n| ---------------- | ---------------------------------------------------------------------------------- |\n| `@vielzeug/wire` | Bezier and orthogonal routing, path serialization, ordering, cycles, types, errors |\n\n---\n\n## Core Types\n\n```ts\ntype Point = Readonly<{ x: number; y: number }>;\ntype Rect = Readonly<{ x: number; y: number; width: number; height: number }>;\ntype PortSide = 'top' | 'right' | 'bottom' | 'left';\ntype PortAnchor = Point & Readonly<{ side: PortSide }>;\ntype CubicBezier = Readonly<{ from: Point; c1: Point; c2: Point; to: Point }>;\ntype Edge = Readonly<{ from: string; to: string }>;\n```\n\nCoordinates are screen convention: `top` is smaller y.\n\n---\n\n## Routing Functions\n\n### `portAnchor()`\n\n```ts\nfunction portAnchor(rect: Rect, side: PortSide, offset?: number): PortAnchor;\n```\n\nPlaces a port on `side` of `rect` and returns its world position together with the side it faces, ready to pass to `bezierRoute()` or `orthogonalRoute()`.\n\n| Parameter | Type | Description |\n| --------- | ---------- | ------------------------------------------------------ |\n| `rect` | `Rect` | Node bounding box the port sits on |\n| `side` | `PortSide` | Node edge the port faces |\n| `offset` | `number` | 0..1 fraction along the side (default 0.5, the middle) |\n\n**Returns:** a `PortAnchor` — the point plus its `side`. Throws `WireConfigError` for an `offset` outside 0..1 or non-finite.\n\n### `bezierRoute()`\n\n```ts\nfunction bezierRoute(from: PortAnchor, to: PortAnchor, options?: BezierRouteOptions): CubicBezier;\n```\n\nBuilds a cubic bezier segment whose control points extend `handleLength` units outward from each port along its side, so the curve leaves and enters ports perpendicular to the node edge.\n\n| Parameter | Type | Description |\n| --------- | -------------------- | ----------------------------------------------- |\n| `from` | `PortAnchor` | Source port with its side |\n| `to` | `PortAnchor` | Target port with its side |\n| `options` | `BezierRouteOptions` | `handleLength` (default 40) control-point reach |\n\n**Returns:** a `CubicBezier` (`from`, `c1`, `c2`, `to`) for canvas or SVG rendering; use `bezierToSvgPath()` for an SVG `d` string. Throws `WireConfigError` for a negative or non-finite `handleLength`.\n\n### `orthogonalRoute()`\n\n```ts\nfunction orthogonalRoute(from: PortAnchor, to: PortAnchor, options?: OrthogonalRouteOptions): Point[] | null;\n```\n\nRoutes an axis-aligned polyline over a visibility graph of obstacle corners and exit-tip rows/columns using A\\*. Cost is length plus `bendPenalty` per bend; expansion order is deterministic. The route runs `stub` units straight out of each port before bending, so wires never peel off a port sideways.\n\nPass every node's raw rect as `obstacles`. The obstacles whose padded interior contains a port are exempted for that port's straight exit segment only — the searched route never enters any padded obstacle interior, including its own nodes.\n\n| Parameter | Type | Description |\n| --------- | ------------------------ | ------------------------------------------------------------------------------------------------- |\n| `from` | `PortAnchor` | Start port; its `side` fixes the direction the route leaves it |\n| `to` | `PortAnchor` | Goal port; its `side` fixes the direction the route enters it |\n| `options` | `OrthogonalRouteOptions` | `obstacles`, `padding` (default 8), `bendPenalty` (default 12), `stub` (default 16, `0` disables) |\n\n**Returns:** waypoints (`from` first, `to` last, bends only) or `null` when a port's exit is blocked by a non-owner obstacle or every route is sealed off. Points exactly on a padded boundary are free: routes may hug obstacle margins.\n\n### `bezierToSvgPath()`\n\n```ts\nfunction bezierToSvgPath(curve: CubicBezier): string;\n```\n\nSerializes as an absolute `M`/`C` command, rounded to six decimals with no `-0` or exponent noise.\n\n### `polylineToSvgPath()`\n\n```ts\nfunction polylineToSvgPath(points: readonly Point[]): string;\n```\n\nSerializes as absolute `M`/`L` commands, rounded to six decimals with no `-0` or exponent noise.\n\n---\n\n## Graph Functions\n\n### `topologicalOrder()`\n\n```ts\nfunction topologicalOrder(nodeIds: readonly string[], edges: readonly Edge[]): string[];\n```\n\nKahn's algorithm with a heap keyed by input index; ready nodes are always consumed in input order. Parallel edges are tolerated. Throws `WireGraphError` on duplicate node ids, edges referencing unknown nodes, or cycles.\n\n### `findCyclicGroups()`\n\n```ts\nfunction findCyclicGroups(nodeIds: readonly string[], edges: readonly Edge[]): string[][];\n```\n\nIterative Tarjan SCCs. Each returned group is an SCC with more than one node, or a single node with a self-loop. A group is a set of mutually reachable nodes, not a path through them. Members are sorted by input position; groups are ordered by their first member. Same validation errors as `topologicalOrder()`.\n\n---\n\n## Errors\n\n| Class | Thrown when |\n| ----------------- | ------------------------------------------------------------------------------------------- |\n| `WireError` | Base class; catch-all via `instanceof WireError` |\n| `WireGraphError` | Unknown edge endpoints, duplicate node ids, cyclic `topologicalOrder()` |\n| `WireConfigError` | Negative or non-finite `handleLength`, `padding`, `stub`, or `bendPenalty`; bad port offset |\n",
|
|
6
|
+
"usage": "---\ntitle: 'Wire: Usage Guide'\ndescription: Route bezier and orthogonal edges around nodes, serialize them as SVG paths, and order or validate node graphs with Wire.\n---\n\n[[toc]]\n\n## Basic Usage\n\nWire is headless: it turns port positions, node bounds, and edge lists into path data and orderings. You own the rendering.\n\n```ts\nimport { bezierRoute, bezierToSvgPath, orthogonalRoute, polylineToSvgPath, topologicalOrder } from '@vielzeug/wire';\n\n// A curved wire from a right-facing port to a left-facing port.\nconst curve = bezierRoute({ side: 'right', x: 100, y: 40 }, { side: 'left', x: 320, y: 120 });\npathElement.setAttribute('d', bezierToSvgPath(curve));\n\n// A Manhattan wire that routes around the node boxes.\nconst points = orthogonalRoute(\n { side: 'right', x: 100, y: 40 },\n { side: 'left', x: 320, y: 120 },\n { obstacles: nodeBounds },\n);\nif (points) pathElement.setAttribute('d', polylineToSvgPath(points));\n```\n\nBoth routers return geometry — a `CubicBezier` and a waypoint array — and the two serializers in `path.ts` turn them into SVG `d` strings. Canvas renderers consume the geometry directly (`ctx.bezierCurveTo(curve.c1.x, ...)`).\n\n## Port Sides\n\nA port is a `Point` plus a required `side` naming the node edge it faces. `portAnchor()` computes that point from a node rect, so you never hand-derive \"right side means `x + width`\":\n\n```ts\nimport { portAnchor } from '@vielzeug/wire';\n\n// Middle of the node's right edge, facing right.\nconst out = portAnchor(nodeBounds, 'right'); // { side: 'right', x, y }\n// Quarter along the top edge.\nconst top = portAnchor(nodeBounds, 'top', 0.25);\n```\n\n`bezierRoute()` extends each control point outward along its port's side, so wires leave and enter nodes perpendicular to the edge:\n\n```ts\n// Bottom port of A into top port of B (top-to-bottom flow).\nbezierRoute({ side: 'bottom', x: 60, y: 100 }, { side: 'top', x: 60, y: 220 });\n```\n\nA free endpoint that is not on a node — the cursor while dragging a wire, say — picks a side explicitly: `{ ...cursor, side: 'left' }`.\n\n## Routing Around Obstacles\n\n`orthogonalRoute()` searches a visibility graph built from the obstacle corners with A\\*, costing path length plus `bendPenalty` per bend — so among equally long routes, the one with fewer bends wins:\n\nPass every node's raw bounding box as `obstacles` — the same list for every edge. `padding` supplies the clearance, so do not inflate the rects yourself:\n\n```ts\nconst points = orthogonalRoute(outPort, inPort, {\n bendPenalty: 12, // cost of one extra bend, in the same units as distance\n obstacles: nodes.map((node) => node.bounds),\n padding: 8, // keep routes this far from obstacle edges\n});\n```\n\nFour contracts matter for editors:\n\n- **Your own nodes are exempted for the exit only.** A port sits on its node's boundary, inside that node's padded obstacle. The router exempts the obstacles that contain a port for that port's straight exit segment; the rest of the route never enters any padded obstacle interior, including its own nodes. No per-edge filtering.\n- **Unreachable returns `null`.** When a port's exit is blocked by another obstacle, or every route around the obstacles is sealed off, you get `null` — never a path through a wall. Show a dashed straight-line fallback while the user drags.\n- **Port sides add stubs.** The route runs `stub` units (default 16) straight out of each port before bending, and straight into the target port, so wires leave and enter ports perpendicular to the node edge. Pass `stub: 0` to opt out; a port inside an obstacle still exits straight far enough to clear it.\n- **Output is deterministic.** The same inputs always produce the same polyline, so edges don't shimmer between frames. The returned polyline carries waypoints only at bends.\n\nRoutes may hug the padded boundary exactly; raise `padding` if you want more clearance.\n\n## Ordering the Graph\n\n`topologicalOrder()` returns node ids in dependency order. Ties break by position in the input array, so the same editor state always produces the same order:\n\n```ts\nconst order = topologicalOrder(\n ['render', 'layout', 'parse'],\n [\n { from: 'parse', to: 'layout' },\n { from: 'layout', to: 'render' },\n ],\n); // ['parse', 'layout', 'render']\n```\n\nA cyclic graph has no topological order and throws `WireGraphError`. For validation UI, use `findCyclicGroups()` instead — it returns each cyclic part once as a strongly connected component:\n\n```ts\nimport { findCyclicGroups } from '@vielzeug/wire';\n\nconst groups = findCyclicGroups(nodeIds, edges);\n// [['a', 'b']] — a two-node loop; a self-loop appears as [['a']].\n```\n\nA group is a _set_ of mutually reachable nodes, not a path through them — display it as `a, b`, not `a → b`. Highlight every node in a returned group; edges inside the group are the ones to flag.\n\n## Best Practices\n\n- Route during drag with cheap settings (or a straight dashed line) and run the full `orthogonalRoute()` on drop; A\\* over a few hundred obstacles is fast, but not free at 60 fps for every edge.\n- Feed only the obstacles near the edge's corridor, not the whole document — cull with an atlas spatial index for large graphs.\n- Treat `topologicalOrder()` as the execution-order oracle for dataflow editors, and `findCyclicGroups()` as the validator that explains _why_ it threw.\n- Round-trip path strings through `polylineToSvgPath()` and `bezierToSvgPath()` rather than assembling `d` strings by hand; they keep precision stable for diffing and serialization.\n",
|
|
7
|
+
"examples": "---\ntitle: 'Wire: Examples'\ndescription: Practical examples and recipes for @vielzeug/wire.\n---\n\n## Examples\n\n- [Edges Around Nodes](./examples/edges-around-nodes.md)\n"
|
|
8
|
+
},
|
|
9
|
+
"examples": [
|
|
10
|
+
{
|
|
11
|
+
"id": "wire-routing",
|
|
12
|
+
"code": "import { bezierRoute, bezierToSvgPath, orthogonalRoute, polylineToSvgPath } from '@vielzeug/wire'\n\n// Three node boxes; edges must route around them.\nconst nodes = [\n { h: 46, w: 96, x: 20, y: 24 },\n { h: 46, w: 96, x: 20, y: 150 },\n { h: 46, w: 96, x: 260, y: 88 },\n]\nconst obstacles = nodes.map((n) => ({ x: n.x, y: n.y, width: n.w, height: n.h }))\n\nconst svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')\nsvg.setAttribute('viewBox', '0 0 380 220')\nsvg.style.cssText = 'width:100%;max-width:520px;background:#0f172a;border-radius:12px'\n\nfor (const n of nodes) {\n const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect')\n rect.setAttribute('x', String(n.x)); rect.setAttribute('y', String(n.y))\n rect.setAttribute('width', String(n.w)); rect.setAttribute('height', String(n.h))\n rect.setAttribute('rx', '8'); rect.setAttribute('fill', '#1e293b')\n rect.setAttribute('stroke', '#475569')\n svg.appendChild(rect)\n}\n\nfunction addPath(d, color, dashed) {\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')\n path.setAttribute('d', d)\n path.setAttribute('fill', 'none')\n path.setAttribute('stroke', color)\n path.setAttribute('stroke-width', '2')\n if (dashed) path.setAttribute('stroke-dasharray', '5 5')\n svg.appendChild(path)\n}\n\n// Curved wire from node 1's right port to node 3's left port.\naddPath(bezierToSvgPath(bezierRoute({ side: 'right', x: 116, y: 47 }, { side: 'left', x: 260, y: 111 })), '#38bdf8')\n\n// Manhattan wire from node 2 to node 3, routed around node 1's column.\n// Every node is an obstacle; the router exempts each port's own node for its exit.\nconst points = orthogonalRoute(\n { side: 'right', x: 116, y: 173 },\n { side: 'left', x: 260, y: 111 },\n { obstacles, padding: 10 },\n)\nif (points) addPath(polylineToSvgPath(points), '#a78bfa')\n\ndocument.body.appendChild(svg)\nconsole.log('orthogonal waypoints:', points ? points.length : 'unreachable')",
|
|
13
|
+
"name": "orthogonalRoute - Edges around nodes"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"typeSignatures": {
|
|
17
|
+
"BezierRouteOptions": "export { type BezierRouteOptions, bezierRoute } from './bezier.js';",
|
|
18
|
+
"bezierRoute": "export { type BezierRouteOptions, bezierRoute } from './bezier.js';",
|
|
19
|
+
"WireConfigError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
|
|
20
|
+
"WireError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
|
|
21
|
+
"WireGraphError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
|
|
22
|
+
"findCyclicGroups": "export { findCyclicGroups, topologicalOrder } from './graph.js';",
|
|
23
|
+
"topologicalOrder": "export { findCyclicGroups, topologicalOrder } from './graph.js';",
|
|
24
|
+
"OrthogonalRouteOptions": "export { type OrthogonalRouteOptions, orthogonalRoute } from './orthogonal.js';",
|
|
25
|
+
"orthogonalRoute": "export { type OrthogonalRouteOptions, orthogonalRoute } from './orthogonal.js';",
|
|
26
|
+
"bezierToSvgPath": "export { bezierToSvgPath, polylineToSvgPath } from './path.js';",
|
|
27
|
+
"polylineToSvgPath": "export { bezierToSvgPath, polylineToSvgPath } from './path.js';",
|
|
28
|
+
"portAnchor": "export { portAnchor } from './ports.js';",
|
|
29
|
+
"CubicBezier": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
30
|
+
"Edge": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
31
|
+
"Point": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
32
|
+
"PortAnchor": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
33
|
+
"PortSide": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
34
|
+
"Rect": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/data/refine.json
CHANGED
|
@@ -7579,7 +7579,7 @@
|
|
|
7579
7579
|
"slots": [
|
|
7580
7580
|
{
|
|
7581
7581
|
"name": "",
|
|
7582
|
-
"description": "Place ore-button elements here"
|
|
7582
|
+
"description": "Place ore-button elements here, each optionally wrapped in an ore-tooltip"
|
|
7583
7583
|
}
|
|
7584
7584
|
],
|
|
7585
7585
|
"cssParts": [
|
|
@@ -7613,7 +7613,7 @@
|
|
|
7613
7613
|
"demos": [
|
|
7614
7614
|
{
|
|
7615
7615
|
"url": "",
|
|
7616
|
-
"description": "```html\n<ore-button-group attached rounded=\"full\">\n <ore-button variant=\"solid\" color=\"primary\">Save</ore-button>\n <ore-button variant=\"solid\" color=\"primary\">Save & Continue</ore-button>\n</ore-button-group>\n<ore-button-group attached value=\"list\" label=\"View mode\" color=\"primary\">\n <ore-button value=\"list\">List</ore-button>\n <ore-button value=\"grid\">Grid</ore-button>\n</ore-button-group>\n<ore-button-group orientation=\"vertical\" size=\"sm\">\n <ore-button>Top</ore-button>\n <ore-button>Middle</ore-button>\n <ore-button>Bottom</ore-button>\n</ore-button-group>\n```"
|
|
7616
|
+
"description": "```html\n<ore-button-group attached rounded=\"full\">\n <ore-button variant=\"solid\" color=\"primary\">Save</ore-button>\n <ore-button variant=\"solid\" color=\"primary\">Save & Continue</ore-button>\n</ore-button-group>\n<ore-button-group attached value=\"list\" label=\"View mode\" color=\"primary\">\n <ore-button value=\"list\">List</ore-button>\n <ore-button value=\"grid\">Grid</ore-button>\n</ore-button-group>\n<ore-button-group value=\"copy\" label=\"Copy format\">\n <ore-tooltip content=\"Copy as text\" placement=\"top\"><ore-button value=\"text\">Text</ore-button></ore-tooltip>\n <ore-tooltip content=\"Copy as HTML\" placement=\"top\"><ore-button value=\"html\">HTML</ore-button></ore-tooltip>\n</ore-button-group>\n<ore-button-group orientation=\"vertical\" size=\"sm\">\n <ore-button>Top</ore-button>\n <ore-button>Middle</ore-button>\n <ore-button>Bottom</ore-button>\n</ore-button-group>\n```"
|
|
7617
7617
|
}
|
|
7618
7618
|
]
|
|
7619
7619
|
},
|
|
@@ -12723,14 +12723,14 @@
|
|
|
12723
12723
|
"text": "'ore-dock'"
|
|
12724
12724
|
},
|
|
12725
12725
|
"default": "'ore-dock'",
|
|
12726
|
-
"description": "The navbar's other twin: a bar of actions that pins to a viewport edge while its container\nscrolls, and settles into the document flow once that container ends.\n\nThree named places and a tool row. `start` and `commit` are the flanks, `center` is the one\nplace allowed to carry a non-action (a clock, a stat block), and the default slot is the row\nof tools between them. A place nothing is assigned to leaves no gap and no flex line: the bar\ncollapses to the places it actually carries.\n\nWide, the bar is a full-width strip flush to its edge, wearing a hairline only while pinned.\nFrom the desktop width (1280 px) up, a claimed `center` sits dead-center because both sides of\nthe row take an equal share. Below the phone width (640 px) the bar becomes a tool row in\nthe iOS toolbar grammar: the flanks stretch equally so the tools rest on the row's true middle\nwhile space permits. Flank content takes priority over centering; crowded zones wrap rather\nthan overlapping or shrinking controls.\nThe bar detaches from the viewport's foot, and `center` lifts out of the row to hover above it.\nBy default, a phone row with one action zone hugs its content: `start` aligns to the leading\nedge, `commit` to the trailing edge, and tools to the middle. A lone `center` stays in the row.\nMultiple action zones and attached tools fill the row. `mobile-layout=\"full\"` always fills it;\n`mobile-layout=\"compact\"` always hugs and centers it. Above the phone width every bar is a\nfull-width strip.\n\nThe bar's surface rides a pseudo-element, never the host: `backdrop-filter` on the host would\nmake it a containing block for `position: fixed` descendants, trapping any panel a slotted\ncontrol opens (a menu, a tooltip) inside the bar's own box.\n\nSizing reaches slotted content through custom properties only (`--dock-tool-flex`,\n`--dock-tool-radius`): a shadow-tree `::slotted()` declaration ranks below any document-tree\nrule on the same property, so a consumer that sets `flex` or `width` on a dock child outranks\nthe bar's own layout. Where a bar must stretch its tools (`attached`), it does so by reading\n`--dock-tool-flex`, so the consumer's lever is the property, not a fight with a declaration.\nEvery such rule is scoped through the zone that owns the slot, because `::slotted()` reaches the\nchildren of every slot the bar renders. The flanks keep their own shape.\n\nThe host reflects which places are filled as `data-start-claimed`, `data-center-claimed`,\n`data-tools-claimed`, and `data-commit-claimed`, plus `data-pinned` while the bar is holding its\nedge. Those exist because no selector can derive them: `:has()` cannot see slotted content and a\n`<slot>` always matches `:empty`. The phone layout needs no reflection: it is a plain media\nquery in the bar's own stylesheet, the same way every other refine breakpoint is written."
|
|
12726
|
+
"description": "The navbar's other twin: a bar of actions that pins to a viewport edge while its container\nscrolls, and settles into the document flow once that container ends.\n\nThree named places and a tool row. `start` and `commit` are the flanks, `center` is the one\nplace allowed to carry a non-action (a clock, a stat block), and the default slot is the row\nof tools between them. A place nothing is assigned to leaves no gap and no flex line: the bar\ncollapses to the places it actually carries.\n\nWide, the bar is a full-width strip flush to its edge, wearing a hairline only while pinned.\nFrom the desktop width (1280 px) up, a claimed `center` sits dead-center because both sides of\nthe row take an equal share. Below the phone width (640 px) the bar becomes a tool row in\nthe iOS toolbar grammar: the flanks stretch equally so the tools rest on the row's true middle\nwhile space permits. Flank content takes priority over centering; crowded zones wrap rather\nthan overlapping or shrinking controls.\nThe bar detaches from the viewport's foot, and `center` lifts out of the row to hover above it.\nBy default, a phone row with one action zone hugs its content: `start` aligns to the leading\nedge, `commit` to the trailing edge, and tools to the middle. A lone `center` stays in the row.\nMultiple action zones and attached tools fill the row. `mobile-layout=\"full\"` always fills it;\n`mobile-layout=\"compact\"` always hugs and centers it. Above the phone width every bar is a\nfull-width strip.\n\nThe bar's surface rides a pseudo-element, never the host: `backdrop-filter` on the host would\nmake it a containing block for `position: fixed` descendants, trapping any panel a slotted\ncontrol opens (a menu, a tooltip) inside the bar's own box.\n\n`floating` replaces the strip with a capsule: the bar detaches from its edge on every width,\nhugs its content, centers itself in the container, and carries its own border and shadow. It is\ndetached at every scroll position, so the pinned hairline never applies. A floating bar is\nanchored to the viewport, which would let it escape a docs preview; the same container heuristic\nthe navbar uses flips it to `position: absolute` (reflected as `data-preview-mode`) whenever its\ncontainer is narrower than the window.\n\nSizing reaches slotted content through custom properties only (`--dock-tool-flex`,\n`--dock-tool-radius`): a shadow-tree `::slotted()` declaration ranks below any document-tree\nrule on the same property, so a consumer that sets `flex` or `width` on a dock child outranks\nthe bar's own layout. Where a bar must stretch its tools (`attached`), it does so by reading\n`--dock-tool-flex`, so the consumer's lever is the property, not a fight with a declaration.\nEvery such rule is scoped through the zone that owns the slot, because `::slotted()` reaches the\nchildren of every slot the bar renders. The flanks keep their own shape.\n\nThe host reflects which places are filled as `data-start-claimed`, `data-center-claimed`,\n`data-tools-claimed`, and `data-commit-claimed`, plus `data-pinned` while the bar is holding its\nedge. Those exist because no selector can derive them: `:has()` cannot see slotted content and a\n`<slot>` always matches `:empty`. The phone layout needs no reflection: it is a plain media\nquery in the bar's own stylesheet, the same way every other refine breakpoint is written."
|
|
12727
12727
|
},
|
|
12728
12728
|
{
|
|
12729
12729
|
"kind": "class",
|
|
12730
12730
|
"name": "OreDockElement",
|
|
12731
12731
|
"tagName": "ore-dock",
|
|
12732
12732
|
"customElement": true,
|
|
12733
|
-
"description": "The navbar's other twin: a bar of actions that pins to a viewport edge while its container\nscrolls, and settles into the document flow once that container ends.\nThree named places and a tool row. `start` and `commit` are the flanks, `center` is the one\nplace allowed to carry a non-action (a clock, a stat block), and the default slot is the row\nof tools between them. A place nothing is assigned to leaves no gap and no flex line: the bar\ncollapses to the places it actually carries.\nWide, the bar is a full-width strip flush to its edge, wearing a hairline only while pinned.\nFrom the desktop width (1280 px) up, a claimed `center` sits dead-center because both sides of\nthe row take an equal share. Below the phone width (640 px) the bar becomes a tool row in\nthe iOS toolbar grammar: the flanks stretch equally so the tools rest on the row's true middle\nwhile space permits. Flank content takes priority over centering; crowded zones wrap rather\nthan overlapping or shrinking controls.\nThe bar detaches from the viewport's foot, and `center` lifts out of the row to hover above it.\nBy default, a phone row with one action zone hugs its content: `start` aligns to the leading\nedge, `commit` to the trailing edge, and tools to the middle. A lone `center` stays in the row.\nMultiple action zones and attached tools fill the row. `mobile-layout=\"full\"` always fills it;\n`mobile-layout=\"compact\"` always hugs and centers it. Above the phone width every bar is a\nfull-width strip.\nThe bar's surface rides a pseudo-element, never the host: `backdrop-filter` on the host would\nmake it a containing block for `position: fixed` descendants, trapping any panel a slotted\ncontrol opens (a menu, a tooltip) inside the bar's own box.\nSizing reaches slotted content through custom properties only (`--dock-tool-flex`,\n`--dock-tool-radius`): a shadow-tree `::slotted()` declaration ranks below any document-tree\nrule on the same property, so a consumer that sets `flex` or `width` on a dock child outranks\nthe bar's own layout. Where a bar must stretch its tools (`attached`), it does so by reading\n`--dock-tool-flex`, so the consumer's lever is the property, not a fight with a declaration.\nEvery such rule is scoped through the zone that owns the slot, because `::slotted()` reaches the\nchildren of every slot the bar renders. The flanks keep their own shape.\nThe host reflects which places are filled as `data-start-claimed`, `data-center-claimed`,\n`data-tools-claimed`, and `data-commit-claimed`, plus `data-pinned` while the bar is holding its\nedge. Those exist because no selector can derive them: `:has()` cannot see slotted content and a\n`<slot>` always matches `:empty`. The phone layout needs no reflection: it is a plain media\nquery in the bar's own stylesheet, the same way every other refine breakpoint is written.",
|
|
12733
|
+
"description": "The navbar's other twin: a bar of actions that pins to a viewport edge while its container\nscrolls, and settles into the document flow once that container ends.\nThree named places and a tool row. `start` and `commit` are the flanks, `center` is the one\nplace allowed to carry a non-action (a clock, a stat block), and the default slot is the row\nof tools between them. A place nothing is assigned to leaves no gap and no flex line: the bar\ncollapses to the places it actually carries.\nWide, the bar is a full-width strip flush to its edge, wearing a hairline only while pinned.\nFrom the desktop width (1280 px) up, a claimed `center` sits dead-center because both sides of\nthe row take an equal share. Below the phone width (640 px) the bar becomes a tool row in\nthe iOS toolbar grammar: the flanks stretch equally so the tools rest on the row's true middle\nwhile space permits. Flank content takes priority over centering; crowded zones wrap rather\nthan overlapping or shrinking controls.\nThe bar detaches from the viewport's foot, and `center` lifts out of the row to hover above it.\nBy default, a phone row with one action zone hugs its content: `start` aligns to the leading\nedge, `commit` to the trailing edge, and tools to the middle. A lone `center` stays in the row.\nMultiple action zones and attached tools fill the row. `mobile-layout=\"full\"` always fills it;\n`mobile-layout=\"compact\"` always hugs and centers it. Above the phone width every bar is a\nfull-width strip.\nThe bar's surface rides a pseudo-element, never the host: `backdrop-filter` on the host would\nmake it a containing block for `position: fixed` descendants, trapping any panel a slotted\ncontrol opens (a menu, a tooltip) inside the bar's own box.\n`floating` replaces the strip with a capsule: the bar detaches from its edge on every width,\nhugs its content, centers itself in the container, and carries its own border and shadow. It is\ndetached at every scroll position, so the pinned hairline never applies. A floating bar is\nanchored to the viewport, which would let it escape a docs preview; the same container heuristic\nthe navbar uses flips it to `position: absolute` (reflected as `data-preview-mode`) whenever its\ncontainer is narrower than the window.\nSizing reaches slotted content through custom properties only (`--dock-tool-flex`,\n`--dock-tool-radius`): a shadow-tree `::slotted()` declaration ranks below any document-tree\nrule on the same property, so a consumer that sets `flex` or `width` on a dock child outranks\nthe bar's own layout. Where a bar must stretch its tools (`attached`), it does so by reading\n`--dock-tool-flex`, so the consumer's lever is the property, not a fight with a declaration.\nEvery such rule is scoped through the zone that owns the slot, because `::slotted()` reaches the\nchildren of every slot the bar renders. The flanks keep their own shape.\nThe host reflects which places are filled as `data-start-claimed`, `data-center-claimed`,\n`data-tools-claimed`, and `data-commit-claimed`, plus `data-pinned` while the bar is holding its\nedge. Those exist because no selector can derive them: `:has()` cannot see slotted content and a\n`<slot>` always matches `:empty`. The phone layout needs no reflection: it is a plain media\nquery in the bar's own stylesheet, the same way every other refine breakpoint is written.",
|
|
12734
12734
|
"summary": "",
|
|
12735
12735
|
"attributes": [
|
|
12736
12736
|
{
|
|
@@ -12747,6 +12747,13 @@
|
|
|
12747
12747
|
},
|
|
12748
12748
|
"description": "Pin to the edge while the container scrolls (default true)"
|
|
12749
12749
|
},
|
|
12750
|
+
{
|
|
12751
|
+
"name": "floating",
|
|
12752
|
+
"type": {
|
|
12753
|
+
"text": "boolean"
|
|
12754
|
+
},
|
|
12755
|
+
"description": "Detach the bar from its edge as a capsule inset from that edge"
|
|
12756
|
+
},
|
|
12750
12757
|
{
|
|
12751
12758
|
"name": "attached",
|
|
12752
12759
|
"type": {
|
|
@@ -12828,7 +12835,11 @@
|
|
|
12828
12835
|
},
|
|
12829
12836
|
{
|
|
12830
12837
|
"name": "--dock-radius",
|
|
12831
|
-
"description": "Bar corner radius, used by the pinned phone pill"
|
|
12838
|
+
"description": "Bar corner radius, used by the pinned phone pill and the floating capsule"
|
|
12839
|
+
},
|
|
12840
|
+
{
|
|
12841
|
+
"name": "--dock-shadow",
|
|
12842
|
+
"description": "Shadow under a `floating` bar"
|
|
12832
12843
|
},
|
|
12833
12844
|
{
|
|
12834
12845
|
"name": "--dock-offset",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vielzeug/codex",
|
|
3
|
-
"version": "26.11.
|
|
3
|
+
"version": "26.11.23",
|
|
4
4
|
"description": "MCP server exposing all Vielzeug docs to AI clients",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^26.6.6",
|
|
55
|
-
"@vielzeug/refine": "26.11.
|
|
55
|
+
"@vielzeug/refine": "26.11.23",
|
|
56
56
|
"typescript": "^6.0.3",
|
|
57
57
|
"vitest": "^5.1.0"
|
|
58
58
|
}
|
package/skills/vielzeug/SKILL.md
CHANGED
|
@@ -11,7 +11,7 @@ Vielzeug is a monorepo of independently published TypeScript packages. "Zero dep
|
|
|
11
11
|
|
|
12
12
|
1. If codex's MCP server is connected, call `check-install` once per project: it compares every declared `@vielzeug/*` dependency with the snapshot. Offline, read `package.json` (`dependencies`, `devDependencies`, `peerDependencies`) and list every `@vielzeug/*` entry, resolving each installed version from `node_modules/@vielzeug/<pkg>/package.json` when present, otherwise from the package-manager lockfile.
|
|
13
13
|
2. Note whether `@vielzeug/refine` is installed. If it is, the **Refine** and **Theme** sections below are mandatory for any UI work.
|
|
14
|
-
3. Read the project's own agent contract (`AGENTS.md`, `.github/copilot-instructions.md`) first: project rules win over this skill.
|
|
14
|
+
3. Read the project's own agent contract (`AGENTS.md`, `.github/copilot-instructions.md`) first: project rules win over this skill. Also load the nearest subtree `AGENTS.md` before editing inside it (index at the end of root `AGENTS.md`).
|
|
15
15
|
|
|
16
16
|
## Discover, don't recall
|
|
17
17
|
|
|
@@ -50,6 +50,7 @@ If a need matches a package below, use that package. Do not reimplement signals,
|
|
|
50
50
|
- `@vielzeug/archive`: Community content publishing for Cloudflare Workers + D1: a hardened Worker core over per-collection payload schemas
|
|
51
51
|
- `@vielzeug/arsenal`: Non-trivial TypeScript utilities: retry, cancellation, cache, safe-path, serialization, prototype-pollution-guarded collections
|
|
52
52
|
- `@vielzeug/assay`: Framework-agnostic DOM testing primitives: scoped queries, event dispatch, async waiting
|
|
53
|
+
- `@vielzeug/atlas`: Spatial math, camera, and indexing primitives for 2D canvases
|
|
53
54
|
- `@vielzeug/bard`: Lifecycle-owned Web Audio mixing: buses with ducking, buffered SFX and sprites, procedural synth, streamed tracks, and crossfading music decks
|
|
54
55
|
- `@vielzeug/beacon`: Guided onboarding and contextual product tours for web applications
|
|
55
56
|
- `@vielzeug/clockwork`: Framework-neutral finite state machines with pure transitions and actors
|
|
@@ -61,9 +62,10 @@ If a need matches a package below, use that package. Do not reimplement signals,
|
|
|
61
62
|
- `@vielzeug/flux`: Minimal push streams with explicit ownership, bounded buffering, and structural bridges
|
|
62
63
|
- `@vielzeug/focus`: Framework-neutral list navigation and focus restoration primitives
|
|
63
64
|
- `@vielzeug/forge`: Typed form state, validation, submission
|
|
64
|
-
- `@vielzeug/gesture`: Framework-neutral
|
|
65
|
+
- `@vielzeug/gesture`: Framework-neutral pointer drag, pan, pinch, and wheel recognition with lifecycle-owned handles
|
|
65
66
|
- `@vielzeug/herald`: Typed synchronous event bus with wildcard subscriptions, one-shot waits, and lifecycle tracing
|
|
66
67
|
- `@vielzeug/illusionist`: Typed, deterministic, locale-aware fake data generator with seeded PRNG
|
|
68
|
+
- `@vielzeug/ink`: Causal stroke stabilization, smoothing, speed-based width profiling, and SVG path output
|
|
67
69
|
- `@vielzeug/keymap`: Headless keyboard shortcut manager with chord sequences
|
|
68
70
|
- `@vielzeug/ledger`: Serialized reversible command history with atomic framework-neutral state and cancellation ownership
|
|
69
71
|
- `@vielzeug/lingua`: Typed i18n with pluralization and lazy locale loading
|
|
@@ -71,6 +73,7 @@ If a need matches a package below, use that package. Do not reimplement signals,
|
|
|
71
73
|
- `@vielzeug/necromancer`: Lifecycle-owned Web Animations API primitives with native access, per-handle groups, and additive FLIP
|
|
72
74
|
- `@vielzeug/orbit`: Floating UI positioning with lifecycle-owned geometry and middleware
|
|
73
75
|
- `@vielzeug/ore`: Functional web-component authoring on top of ripple
|
|
76
|
+
- `@vielzeug/palette`: Color parsing, conversion, mixing, and contrast for design tools
|
|
74
77
|
- `@vielzeug/patchwork`: RFC 6902 JSON Patch: structural diff, immutable apply, and guarded tryApply for sync protocols.
|
|
75
78
|
- `@vielzeug/postmaster`: Typed durable job outbox with leased processing, retries, and dead-letter recovery
|
|
76
79
|
- `@vielzeug/prism`: Responsive SVG charts with explicit updates: line, bar, area, scatter, pie, radar, heatmap, sparkline
|
|
@@ -86,6 +89,7 @@ If a need matches a package below, use that package. Do not reimplement signals,
|
|
|
86
89
|
- `@vielzeug/sigil`: QR code generation and scanning: pure matrix encoder, SVG and canvas renderers, native BarcodeDetector scanning
|
|
87
90
|
- `@vielzeug/sourcerer`: Reactive collection sources with local, page, cursor, and infinite pagination
|
|
88
91
|
- `@vielzeug/spell`: Zero-dependency schema validation with Standard Schema interoperability
|
|
92
|
+
- `@vielzeug/stage`: Retained-mode 2D canvas stage engine with DPR-aware layers, dirty repaints, and PNG export
|
|
89
93
|
- `@vielzeug/tabula`: Typed CSV and TSV: RFC 4180 parser with schema-validated rows, streaming reader, and safe serializer.
|
|
90
94
|
- `@vielzeug/tandem`: Offline-first sync engine with rev baselines, tombstoned deletions, and idle-batched pushes
|
|
91
95
|
- `@vielzeug/tavern`: Table sessions over mesh: host-owned state replication with guest command forwarding
|
|
@@ -93,6 +97,7 @@ If a need matches a package below, use that package. Do not reimplement signals,
|
|
|
93
97
|
- `@vielzeug/vault`: Adapter-free typed storage core with focused browser and SQLite subpaths
|
|
94
98
|
- `@vielzeug/ward`: Ordered authorization rules with immutable policies and typed decisions
|
|
95
99
|
- `@vielzeug/wayfinder`: Client-side router with middleware and guards
|
|
100
|
+
- `@vielzeug/wire`: Edge routing and graph ordering for node editors
|
|
96
101
|
|
|
97
102
|
<!-- GENERATED:skill-packages:END -->
|
|
98
103
|
|