@open-tomato/charts 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +283 -2
- package/dist/engine/BarChart/BarChart.d.ts +4 -0
- package/dist/engine/BarChart/BarChart.option.d.ts +4 -0
- package/dist/engine/BarChart/index.d.ts +2 -0
- package/dist/engine/BoxPlot/BoxPlot.d.ts +4 -0
- package/dist/engine/BoxPlot/BoxPlot.option.d.ts +4 -0
- package/dist/engine/BoxPlot/index.d.ts +2 -0
- package/dist/engine/Bullet/Bullet.d.ts +4 -0
- package/dist/engine/Bullet/Bullet.option.d.ts +4 -0
- package/dist/engine/Bullet/index.d.ts +2 -0
- package/dist/engine/Donut/Donut.d.ts +4 -0
- package/dist/engine/Donut/Donut.option.d.ts +4 -0
- package/dist/engine/Donut/index.d.ts +2 -0
- package/dist/engine/Gauge/Gauge.d.ts +4 -0
- package/dist/engine/Gauge/Gauge.option.d.ts +4 -0
- package/dist/engine/Gauge/index.d.ts +2 -0
- package/dist/engine/HeatmapGrid/HeatmapGrid.d.ts +4 -0
- package/dist/engine/HeatmapGrid/HeatmapGrid.option.d.ts +4 -0
- package/dist/engine/HeatmapGrid/index.d.ts +2 -0
- package/dist/engine/Histogram/Histogram.d.ts +4 -0
- package/dist/engine/Histogram/Histogram.option.d.ts +4 -0
- package/dist/engine/Histogram/index.d.ts +2 -0
- package/dist/engine/LineChart/LineChart.d.ts +19 -0
- package/dist/engine/LineChart/LineChart.option.d.ts +4 -0
- package/dist/engine/LineChart/index.d.ts +2 -0
- package/dist/engine/NetworkGraph/NetworkGraph.d.ts +4 -0
- package/dist/engine/NetworkGraph/NetworkGraph.option.d.ts +8 -0
- package/dist/engine/NetworkGraph/index.d.ts +2 -0
- package/dist/engine/Nightingale/Nightingale.d.ts +4 -0
- package/dist/engine/Nightingale/Nightingale.option.d.ts +4 -0
- package/dist/engine/Nightingale/index.d.ts +2 -0
- package/dist/engine/Radar/Radar.d.ts +4 -0
- package/dist/engine/Radar/Radar.option.d.ts +4 -0
- package/dist/engine/Radar/index.d.ts +2 -0
- package/dist/engine/Sankey/Sankey.d.ts +4 -0
- package/dist/engine/Sankey/Sankey.option.d.ts +6 -0
- package/dist/engine/Sankey/index.d.ts +2 -0
- package/dist/engine/ScatterChart/ScatterChart.d.ts +4 -0
- package/dist/engine/ScatterChart/ScatterChart.option.d.ts +6 -0
- package/dist/engine/ScatterChart/index.d.ts +2 -0
- package/dist/engine/Sunburst/Sunburst.d.ts +4 -0
- package/dist/engine/Sunburst/Sunburst.option.d.ts +19 -0
- package/dist/engine/Sunburst/index.d.ts +2 -0
- package/dist/engine/Treemap/Treemap.d.ts +4 -0
- package/dist/engine/Treemap/Treemap.option.d.ts +4 -0
- package/dist/engine/Treemap/index.d.ts +2 -0
- package/dist/engine/chrome.d.ts +90 -0
- package/dist/engine/core.d.ts +58 -0
- package/dist/engine/echartsEngine.d.ts +3 -0
- package/dist/engine/fixtures.d.ts +61 -0
- package/dist/engine/headless/headless.d.ts +86 -0
- package/dist/engine/headless/index.d.ts +10 -0
- package/dist/engine/headless/index.js +142 -0
- package/dist/engine/index.d.ts +1 -0
- package/dist/engine/shared.d.ts +59 -0
- package/dist/engine/shared.variants.d.ts +40 -0
- package/dist/index-4bxmxw89.js +1786 -0
- package/dist/index-85mb21rn.js +69 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +618 -0
- package/dist/lib/cn.d.ts +7 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/seam/ChartEngineProvider.d.ts +12 -0
- package/dist/seam/FormatProvider.d.ts +25 -0
- package/dist/seam/format.d.ts +171 -0
- package/dist/seam/format.schema.d.ts +14 -0
- package/dist/seam/height.d.ts +15 -0
- package/dist/seam/index.d.ts +12 -0
- package/dist/seam/tones.d.ts +49 -0
- package/dist/seam/types.d.ts +322 -0
- package/dist/seam/useResolvedTokens.d.ts +7 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +30 -0
- package/dist/theme/tokens.d.ts +40 -0
- package/package.json +82 -4
package/README.md
CHANGED
|
@@ -1,3 +1,284 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @open-tomato/charts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React 19 charting for the `@open-tomato` scope: a chart-engine seam with
|
|
4
|
+
ECharts 6 behind it, the names of the theme tokens it reads, formatters,
|
|
5
|
+
and a headless engine subpath that draws a chart to SVG with no React and
|
|
6
|
+
no DOM. Other projects consume it on its own; `@open-tomato/atlas-ui`
|
|
7
|
+
builds Atlas's cards on it. The consuming app brings the token values;
|
|
8
|
+
`@open-tomato/atlas-demo` is the reference consumer.
|
|
9
|
+
|
|
10
|
+
## Layout
|
|
11
|
+
|
|
12
|
+
Each layer is a folder under `src/` with a barrel `index.ts`, and
|
|
13
|
+
`src/index.ts` is the root barrel.
|
|
14
|
+
|
|
15
|
+
| Folder | Holds |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `seam/` | the `ChartPrimitives` types, tones, formatters and the format spec, the engine and format providers |
|
|
18
|
+
| `engine/` | ECharts 6 over `echarts/core`; the only folder importing `echarts` |
|
|
19
|
+
| `engine/headless/` | the `./engine` subpath: option builders and `renderToSvg` |
|
|
20
|
+
| `theme/` | the token names; no values |
|
|
21
|
+
| `lib/` | `cn` |
|
|
22
|
+
|
|
23
|
+
The engine splits along React. `engine/core.ts` holds the `echarts/core`
|
|
24
|
+
registration of every series and component, the `ChartOption` type and
|
|
25
|
+
the colour bridge, and imports no React. `engine/shared.tsx` is the React
|
|
26
|
+
adapter: it adds the canvas renderer, `useBuiltOption` and the `EChart`
|
|
27
|
+
root. Each primitive gets its own folder, named after it:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
src/engine/LineChart/
|
|
31
|
+
index.ts the primitive's barrel
|
|
32
|
+
LineChart.tsx the React component: the option over the live tokens, drawn by EChart
|
|
33
|
+
LineChart.option.ts buildOption(props, tokens): pure, no React, no DOM
|
|
34
|
+
LineChart.stories.tsx one story per variant value
|
|
35
|
+
LineChart.test.ts tests of buildOption
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The primitives draw with the shared chart-root and tooltip variants in
|
|
39
|
+
`engine/shared.variants.ts`, so a primitive folder has no variants file of
|
|
40
|
+
its own.
|
|
41
|
+
|
|
42
|
+
## The headless engine
|
|
43
|
+
|
|
44
|
+
`@open-tomato/charts/engine` (`src/engine/headless/`) draws with no React
|
|
45
|
+
and no DOM, for a CLI, a server or a report. It exports every primitive's
|
|
46
|
+
`buildOption` as `build<Primitive>Option(props, tokens)`, `OPTION_BUILDERS`
|
|
47
|
+
by primitive name, the `ResolvedTokens` type, `tokensFrom`,
|
|
48
|
+
`renderToSvg`, and the format spec with its schemas (`formatterFor`,
|
|
49
|
+
`valueFormatSchema` and the rest of `seam/format.ts` and
|
|
50
|
+
`seam/format.schema.ts`), so a report writes values as a chart does:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { renderToSvg, tokensFrom } from '@open-tomato/charts/engine';
|
|
54
|
+
|
|
55
|
+
const tokens = tokensFrom(values); // every token name, without `--color-`, to a colour
|
|
56
|
+
const svg = renderToSvg('LineChart', { ariaLabel: 'Tokens per day', series }, tokens, { width: 480, height: 260 });
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
A headless caller has no CSS variables to read, so it passes a value for
|
|
60
|
+
every token. `renderToSvg` uses ECharts' server-side mode
|
|
61
|
+
(`echarts.init(null, null, { renderer: 'svg', ssr: true, width, height })`,
|
|
62
|
+
`setOption`, `renderToSVGString()`, `dispose()`) over the same
|
|
63
|
+
`echarts/core` registration the React adapter uses, with animation off.
|
|
64
|
+
The same input gives the same string: ECharts numbers ids and classes from
|
|
65
|
+
counters that grow with every instance, so the renderer renumbers them and
|
|
66
|
+
prefixes them with a hash of the drawing, or with `idPrefix` when given.
|
|
67
|
+
Text is measured on a canvas when the process has a page and estimated
|
|
68
|
+
when it has none, so a drawing made under a DOM and one made without can
|
|
69
|
+
differ by a pixel in label room.
|
|
70
|
+
|
|
71
|
+
## Chart height
|
|
72
|
+
|
|
73
|
+
Every primitive takes `height` (`ChartHeight`, `number | 'fill'`). A
|
|
74
|
+
number is the plot height in px, 220 (`DEFAULT_CHART_HEIGHT`) when
|
|
75
|
+
absent; the width always follows the container. `'fill'` gives the chart
|
|
76
|
+
root `height: 100%`, so the chart takes the full height of its container
|
|
77
|
+
and its resize observer follows the container from then on. The
|
|
78
|
+
container needs a height of its own: a sized box, or a flex or grid cell
|
|
79
|
+
that is stretched. A maximised card's box is the case it was made for.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<div className="h-[80vmin]">
|
|
83
|
+
<BarChart ariaLabel="Minutes by agent" categories={categories} series={series} height="fill" />
|
|
84
|
+
</div>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Two builders read the height as a number. Sunburst sizes its radial
|
|
88
|
+
labels from the measured height when it fills, and from 220px until it is
|
|
89
|
+
measured. Bullet cannot know a filling height, so ECharts centres its
|
|
90
|
+
track and text. `renderToSvg` takes an explicit size, so a headless
|
|
91
|
+
`'fill'` fills the drawing. `Engine/BarChart`'s `Fill` story draws one.
|
|
92
|
+
|
|
93
|
+
## Formatting values
|
|
94
|
+
|
|
95
|
+
Every primitive takes `valueFormat`, a `(value: number) => string`. A
|
|
96
|
+
`ValueFormat` is the same choice as data, which a spec or a data point can
|
|
97
|
+
carry: `raw`, `number`, `compact`, `percent` (`signed` for "+12%"),
|
|
98
|
+
`money` (`compact` for "$1.2K"), `unit`, `duration` ("1.5 h"), `elapsed`
|
|
99
|
+
("1h 3m 10s"), `date`, `relative` ("2 days ago", against the context's
|
|
100
|
+
`now` or the clock) or `custom`. `formatterFor(format, context)` turns one into the
|
|
101
|
+
function, over a `FormatContext` of locale, currency and custom formatters
|
|
102
|
+
(defaults `en-GB`, `USD`, `UTC`). A `custom` format names a formatter the
|
|
103
|
+
context registers by id, and an id the context lacks throws when the
|
|
104
|
+
formatter is built.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
<FormatProvider context={{ locale: 'de-DE', currency: 'EUR' }}>
|
|
108
|
+
<Chart />
|
|
109
|
+
</FormatProvider>
|
|
110
|
+
|
|
111
|
+
// inside Chart
|
|
112
|
+
const valueFormat = useFormatter({ kind: 'money', digits: 0 });
|
|
113
|
+
return <LineChart ariaLabel="Spend per day" series={series} valueFormat={valueFormat} />;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- `compact` is `formatCompact` as it was: "1K" and "1.2M", with a capital
|
|
117
|
+
K in every locale, so a chart with no format and one with `compact`
|
|
118
|
+
read the same.
|
|
119
|
+
- `formatMeasured({ value, unit, format }, context, specFormat)` writes a
|
|
120
|
+
value that carries its own unit or format. The point's format wins over
|
|
121
|
+
the spec's, and the context fills what both leave out. A `unit` follows
|
|
122
|
+
a bare number (`raw`, `number`, `compact`); the other kinds write their
|
|
123
|
+
own unit and drop it.
|
|
124
|
+
- `formatElapsed(seconds)` writes a count of seconds as "1h 3m 10s", zero
|
|
125
|
+
units left out; `formatRelative(value, now, locale)` climbs a ladder
|
|
126
|
+
from a clock time on the same UTC day through "6 hours ago",
|
|
127
|
+
"yesterday", "last week" and "2 months ago", mirrored for the future.
|
|
128
|
+
- Dates are UTC everywhere: `formatDay`, `formatWeek`, `formatDate` and
|
|
129
|
+
the `date` kind read UTC, and every option sets ECharts' `useUTC`, so a
|
|
130
|
+
time-axis tick sits at midnight UTC where its label names the day.
|
|
131
|
+
- A weekly `xFormat` goes with `xStep: 'week'` on `LineChart`: the axis
|
|
132
|
+
starts on the Monday of its first point and its labels sit on the
|
|
133
|
+
Mondays of the span (`axisLabel.customValues`), because the time
|
|
134
|
+
scale's own interval ignores a forced `interval` and lands "w/c" labels
|
|
135
|
+
on days that start no week.
|
|
136
|
+
- `valueFormatSchema` and `formatContextSchema` (zod v4) validate a format
|
|
137
|
+
and a context that arrive as data. A context's `customFormatters` are
|
|
138
|
+
functions, so they validate in code only.
|
|
139
|
+
|
|
140
|
+
The `Engine/Formats` stories draw one series under each kind.
|
|
141
|
+
|
|
142
|
+
## Styles are CVA variants
|
|
143
|
+
|
|
144
|
+
- Every class a component paints lives in a `*.variants.ts` file, as `cva`
|
|
145
|
+
calls: `engine/shared.variants.ts` for the chart root and the tooltip,
|
|
146
|
+
and `chartTone` in `seam/tones.ts` for a tone's colour. The file exports
|
|
147
|
+
the variant props type, and the component's props extend it.
|
|
148
|
+
- A passthrough `className` prop is for layout context only (margin,
|
|
149
|
+
alignment, grid placement), never colour or size. It merges last:
|
|
150
|
+
`cn(chartRootVariants({ cursor }), className)`. `cn` (`src/lib/cn.ts`)
|
|
151
|
+
is clsx plus tailwind-merge, so the later class wins a conflict.
|
|
152
|
+
- No inline `style`, and no class string written on an element. The lint
|
|
153
|
+
rule `ot/cva-only-classname` (in `@open-tomato/rafa-eslint-config/react`)
|
|
154
|
+
allows a `className` value only as a variants call, a `cn(...)` over
|
|
155
|
+
variants calls and the passthrough, or the passthrough alone. Stories and
|
|
156
|
+
tests are exempt.
|
|
157
|
+
- The repo compiles with `isolatedDeclarations`, so an exported `cva` call
|
|
158
|
+
carries an explicit function type, as `chartRootVariants` does.
|
|
159
|
+
|
|
160
|
+
## Theming
|
|
161
|
+
|
|
162
|
+
The package ships token names only: `src/theme/` lists every CSS custom
|
|
163
|
+
property it reads (`--color-series-1` to `-8`, the four status colours,
|
|
164
|
+
surface, plane, ink, ink-2, muted, grid, baseline, ring, the `seq-100` to
|
|
165
|
+
`seq-700` ramp, `diverge-mid`, the six pole colours, `delta-up`). Each is a
|
|
166
|
+
Tailwind v4 colour token, so `--color-series-1` is also `bg-series-1`.
|
|
167
|
+
|
|
168
|
+
The consuming app defines every name: light values in its Tailwind
|
|
169
|
+
`@theme` block, the dark re-step under `:root[data-theme="dark"]`, and
|
|
170
|
+
`@custom-variant dark` on that attribute. Dark mode is
|
|
171
|
+
`data-theme="dark"` on `<html>`. The demo's `src/styles.css` is the
|
|
172
|
+
reference set, and the demo's test holds it to the names listed here. The
|
|
173
|
+
app's stylesheet adds `@source` for this package's files so Tailwind
|
|
174
|
+
generates the classes the components use. Canvas cannot read CSS
|
|
175
|
+
variables, so the React engine reads the tokens from the computed style
|
|
176
|
+
(`useResolvedTokens`) and re-reads them on a theme flip.
|
|
177
|
+
|
|
178
|
+
## Stories
|
|
179
|
+
|
|
180
|
+
Storybook 10 on `@storybook/react-vite`. Vite is Storybook's own builder
|
|
181
|
+
and appears nowhere else: the package builds with `bun build` and the demo
|
|
182
|
+
serves with `Bun.serve`. `.storybook/preview.ts` imports the demo's
|
|
183
|
+
`styles.css`, which Tailwind compiles there, so no story imports tokens.
|
|
184
|
+
Its `theme` toolbar global sets `data-theme` on the document.
|
|
185
|
+
|
|
186
|
+
- A story sits beside its component as `{C}.stories.tsx`.
|
|
187
|
+
- The header is `import type { Meta, StoryObj } from '@storybook/react-vite'`,
|
|
188
|
+
and the meta ends in `satisfies Meta<typeof C>`.
|
|
189
|
+
- `title` is `Engine/<Name>`; `tags: ['autodocs']`;
|
|
190
|
+
`parameters.layout` is `'padded'`.
|
|
191
|
+
- One story per variant value.
|
|
192
|
+
- Stories are deterministic: fixed data (`engine/fixtures.ts`), fixed
|
|
193
|
+
reference dates, an explicit `locale: 'en-US'`, no `Date.now()`,
|
|
194
|
+
animations off.
|
|
195
|
+
- A story carries no assertion and never imports vitest. A `play()`
|
|
196
|
+
imports only from `storybook/test`.
|
|
197
|
+
|
|
198
|
+
Stories are type-checked by `tsconfig.stories.json` with
|
|
199
|
+
`isolatedDeclarations` off: a `satisfies` meta cannot carry the
|
|
200
|
+
annotation the flag asks for, and stories never ship.
|
|
201
|
+
|
|
202
|
+
## Tests
|
|
203
|
+
|
|
204
|
+
`bun test`, never vitest. `bunfig.toml` preloads `test/happy-dom.ts`,
|
|
205
|
+
which registers happy-dom's globals and cleans up Testing Library after
|
|
206
|
+
each test. Component tests use `@testing-library/react`.
|
|
207
|
+
|
|
208
|
+
- Pure parts first: formatters, tones, the token bridge, the chrome.
|
|
209
|
+
`src/lib/cn.test.ts` is the example.
|
|
210
|
+
- happy-dom has no canvas, so a primitive is tested through its pure
|
|
211
|
+
option builder (props in, ECharts option out), never by drawing. The
|
|
212
|
+
picture is the visual suite's job.
|
|
213
|
+
- The headless engine is tested by drawing: a line chart and a radar to
|
|
214
|
+
SVG, the same string twice, a bundle of the entry with no React import,
|
|
215
|
+
and a drawing in a child process with no DOM.
|
|
216
|
+
- The root's `bun test` skips this package (the root `bunfig.toml`'s
|
|
217
|
+
`pathIgnorePatterns`), so run its tests from this folder.
|
|
218
|
+
|
|
219
|
+
## Visual regression
|
|
220
|
+
|
|
221
|
+
A native Playwright suite (`visual/`) over the built Storybook: every
|
|
222
|
+
story in light and in dark, picked with the `theme` global and checked on
|
|
223
|
+
`data-theme` before the shot; Chromium, animations disabled, fonts
|
|
224
|
+
settled, a 0.1% pixel budget. `@storybook/test-runner` with
|
|
225
|
+
`jest-image-snapshot` was not used: it runs Jest, which the repo does not
|
|
226
|
+
use, and plain Playwright's `toHaveScreenshot` needs no second runner.
|
|
227
|
+
|
|
228
|
+
Baselines are per machine and untracked, in
|
|
229
|
+
`visual/__image_snapshots__/` (gitignored with `visual/__diff_output__/`).
|
|
230
|
+
A machine only ever compares against baselines it wrote:
|
|
231
|
+
`bun run test:visual:update` writes them, `bun run test:visual` compares.
|
|
232
|
+
CI runs no visual gate yet, because baselines have no durable store there.
|
|
233
|
+
The suite's file is `stories.visual.ts`, never `.spec.ts`, so `bun test`
|
|
234
|
+
never picks it up. Playwright is pinned to an exact version, since a new
|
|
235
|
+
Chromium moves pixels. The suite serves on port 6016; `@open-tomato/atlas-ui`'s
|
|
236
|
+
serves on 6017, so the two can run at once.
|
|
237
|
+
|
|
238
|
+
## Gate order
|
|
239
|
+
|
|
240
|
+
Run from this folder, in this order:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
bun run check-types # tsc --build, then tsconfig.stories.json
|
|
244
|
+
bun test
|
|
245
|
+
bun run lint
|
|
246
|
+
bun run build # dist/: bun build (ESM, browser) + tsc declarations
|
|
247
|
+
bun run build:storybook # storybook-static/
|
|
248
|
+
bun run check:stories # every story, light and dark, no console or page error
|
|
249
|
+
bun run test:visual # local only, against this machine's baselines
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
CI's `atlas` job in `.github/workflows/verify.yml` runs all but the last
|
|
253
|
+
on `ubuntu-latest`, as one matrix leg per package.
|
|
254
|
+
|
|
255
|
+
## Publish shape
|
|
256
|
+
|
|
257
|
+
- `type: module`, `sideEffects: false`, ESM only. The package ships no
|
|
258
|
+
CSS: the app's stylesheet compiles the classes.
|
|
259
|
+
- `exports`: `.` (the seam, the React engine, `cn` and the theme),
|
|
260
|
+
`./theme`, `./engine` (the headless engine), each with `types` before
|
|
261
|
+
`import`, and `./package.json`.
|
|
262
|
+
- `files`: `dist` and this README. `bun run build` writes `dist/` from
|
|
263
|
+
`src/index.ts`, `src/theme/index.ts` and `src/engine/headless/index.ts`
|
|
264
|
+
with shared chunks, every package external, then the declarations with
|
|
265
|
+
`tsc -p tsconfig.build.json`.
|
|
266
|
+
- An entry barrel re-exports with `export *` only. With
|
|
267
|
+
`sideEffects: false`, bun 1.3 drops an entry module's own named
|
|
268
|
+
re-exports from the bundle, so `engine/headless/index.ts` is
|
|
269
|
+
`export * from './headless.js'` and `headless.ts` holds the list.
|
|
270
|
+
- `publishConfig` names npmjs for the registry and for the
|
|
271
|
+
`@open-tomato` scope, and `access: public`.
|
|
272
|
+
- Peer: `react` ^19. Dependencies: `echarts`, `class-variance-authority`,
|
|
273
|
+
`clsx`, `tailwind-merge` and `zod`, all from the public npm registry. No
|
|
274
|
+
dependency on a private workspace member: the graph check refuses one
|
|
275
|
+
for a publishable member.
|
|
276
|
+
|
|
277
|
+
## Privacy
|
|
278
|
+
|
|
279
|
+
This package is public. No tracked file under `addons/atlas/` names a
|
|
280
|
+
host, a home path, an IP, a LAN name, a private registry, a self-hosted
|
|
281
|
+
runner or a private repository. `privacy.sweep.test.ts`, which lives here
|
|
282
|
+
once for all of `addons/atlas/`, enforces it: it holds sha256 hashes of
|
|
283
|
+
the banned lowercase terms, so the terms never appear in it, and its
|
|
284
|
+
header gives the one-line command that prints the hash of a new term.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BarChartProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: BarChartProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BoxPlotProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: BoxPlotProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BulletProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: BulletProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DonutProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: DonutProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GaugeProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: GaugeProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HeatmapGridProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: HeatmapGridProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HistogramProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: HistogramProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LineChartProps } from '../../seam/types.js';
|
|
2
|
+
import type { ChartOption } from '../core.js';
|
|
3
|
+
import type { ECharts } from 'echarts/core';
|
|
4
|
+
import { type ReactElement } from 'react';
|
|
5
|
+
/** The zoom window as axis values (epoch ms); null when the whole range shows. */
|
|
6
|
+
export type ZoomWindow = {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
} | null;
|
|
10
|
+
/** The live data-zoom window, read back from the instance. */
|
|
11
|
+
export declare function readZoomWindow(instance: Pick<ECharts, 'getOption'>): ZoomWindow;
|
|
12
|
+
/**
|
|
13
|
+
* Pins the live zoom window into a rebuilt option, so a legend toggle or a
|
|
14
|
+
* theme flip never moves it. The window is read from the instance when the
|
|
15
|
+
* option is set, not while rendering; the whole range leaves the option as is.
|
|
16
|
+
*/
|
|
17
|
+
export declare function carryZoom(option: ChartOption, instance: Pick<ECharts, 'getOption'>): ChartOption;
|
|
18
|
+
/** The LineChart drawn with ECharts. */
|
|
19
|
+
export declare function LineChart(props: LineChartProps): ReactElement;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LineChartProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: LineChartProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NetworkGraphProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** What the option reads; narrower than the component's props so a parent's new object does not restart the force layout. */
|
|
4
|
+
export type NetworkOptionProps = Pick<NetworkGraphProps, 'nodes' | 'links' | 'groupTones' | 'onNodeClick' | 'animate'>;
|
|
5
|
+
/** The id an ECharts graph event names, from its node data. */
|
|
6
|
+
export declare function nodeIdOf(data: unknown): string | undefined;
|
|
7
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
8
|
+
export declare function buildOption(props: NetworkOptionProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NightingaleProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: NightingaleProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RadarProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: RadarProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SankeyProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** What the option reads; narrower than the component's props so a parent's new object does not redraw the layout. */
|
|
4
|
+
export type SankeyOptionProps = Pick<SankeyProps, 'nodes' | 'links' | 'groupTones' | 'groupOrder' | 'valueFormat' | 'animate'>;
|
|
5
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
6
|
+
export declare function buildOption(props: SankeyOptionProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ScatterChartProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
export declare const DOTS_SERIES = "points";
|
|
4
|
+
export declare const HIT_SERIES = "points-hit";
|
|
5
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
6
|
+
export declare function buildOption(props: ScatterChartProps, tokens: ResolvedTokens): ChartOption;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SunburstNode, SunburstProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/**
|
|
4
|
+
* The opening, in degrees, under which an arc of a ring carries no label
|
|
5
|
+
* (the tooltip still names it): the arc at the ring's inner edge must be as
|
|
6
|
+
* wide as the label is tall. A ring's inner edge is `inner` of the view
|
|
7
|
+
* radius, so the threshold falls as the chart grows: the slice that reads
|
|
8
|
+
* as a bare wedge in a card gets its label in the maximised view.
|
|
9
|
+
*/
|
|
10
|
+
export declare function labelMinAngle(inner: number, viewRadius: number): number;
|
|
11
|
+
/** The ids from the root to every node, so a click can report its path. */
|
|
12
|
+
export declare function pathsById(nodes: readonly SunburstNode[], above?: readonly string[]): Map<string, string[]>;
|
|
13
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
14
|
+
/**
|
|
15
|
+
* `width` is the canvas width in px, which sizes the radial labels; 0 until
|
|
16
|
+
* it is measured. `measuredHeight` is the canvas height in px, read only for
|
|
17
|
+
* `height: 'fill'`; 0 until measured, when the default height stands in.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildOption(props: SunburstProps, tokens: ResolvedTokens, width?: number, measuredHeight?: number): ChartOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TreemapProps } from '../../seam/types.js';
|
|
2
|
+
import { type ChartOption, type ResolvedTokens } from '../core.js';
|
|
3
|
+
/** The ECharts option for the props over the resolved tokens; pure, so it is tested without a canvas. */
|
|
4
|
+
export declare function buildOption(props: TreemapProps, tokens: ResolvedTokens): ChartOption;
|