expressive-charts 0.1.0 → 0.2.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/CHANGELOG.md +18 -0
- package/README.md +10 -9
- package/dist/{chunk-ZIGBM4NY.js → chunk-V5IUTXRW.js} +23 -6
- package/dist/chunk-V5IUTXRW.js.map +1 -0
- package/dist/{drawing-Du6DAgrW.d.cts → drawing-DWZIXIeR.d.cts} +6 -0
- package/dist/{drawing-Du6DAgrW.d.ts → drawing-DWZIXIeR.d.ts} +6 -0
- package/dist/{effect-OcyvtfZi.d.ts → effect-CZUckY0l.d.ts} +1 -1
- package/dist/{effect-dPmXiWlL.d.cts → effect-CcGdU41j.d.cts} +1 -1
- package/dist/expressive-charts.css +5 -5
- package/dist/expressive-charts.global.js +50 -50
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/icons/sport.js +1 -1
- package/dist/index.cjs +819 -359
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -8
- package/dist/index.d.ts +105 -8
- package/dist/index.js +788 -349
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +22 -5
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZIGBM4NY.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -25,6 +25,24 @@ From 0.1.0:
|
|
|
25
25
|
|
|
26
26
|
Everything else can still change in a minor release while the library is 0.x: the motion core (`motion`, `createMotion`, the clocks, `tween`, `animated`, `playback`, and the types the list doesn't name), the charts, the adapters, the built-in effects and the controls. Those changes are listed here too. [docs/effects-guide.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/effects-guide.md) is the guide to the author API.
|
|
27
27
|
|
|
28
|
+
## 0.2.0 (26 October 2026)
|
|
29
|
+
|
|
30
|
+
Built-in effects that explain a change, text that keeps clear of a mark's own labels, and hover linked across charts. Nothing in the effect-author API breaks: its one change, `labelBounds`, is an addition. The other changes are outside the promise, and each says what to write instead, if anything.
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **`trace`**, a built-in effect: a highlighter stroke drawn along a mark's walk, which stays. `trace({ color, width, opacity, duration })` draws in the overlay and leaves the mark itself untouched, so it's safe in any slot. On a stack it runs the whole walk, and on a point it draws nothing. Its end state is the whole stroke. It isn't a preset. The effects guide's `trace` stays as its worked example, a smaller version.
|
|
35
|
+
- **`link(sources, { by, effects })`**: linked hover across charts and attachments. When one source is hovered by the pointer, touch or the keyboard, the others hover their marks with the same linking value: by default a line point's x, else a mark's key, so a column keyed by its matchweek links with the line's x there. `by(event)` gives the value instead, typed by the sources' rows. Linked marks get their chart's emphasis, dimming and hover effect, with `source: "linked"` on their `hover` event, and no tooltip, focus or announcement; `effects: false` keeps them to emphasis and dimming. The newest hover in a link is the one shown, and Escape or `leave()` on the hovered source ends them all. A source can be in one link at a time, and a `chartSwitch` can't be linked yet. With its types, `Link`, `LinkOptions` and `LinkSource`.
|
|
36
|
+
- **`labelBounds` on `MarkGeometry`**, under the 0.x promise: the boxes of the text the chart draws for a mark, so an effect's own text can keep clear of them. Our charts fill it in: a bar's category and value labels, the two lines of a slice's label outside the ring, a line's end label, each where it's drawn in every frame of a change, a reveal and a resize. Segments, points and marks the library didn't draw have none. `describe.bar`, `.arc`, `.line` and `.point` take it in their specs and pass it through, so a page that describes host marks can give it, and `expressive()` keeps it. It's an optional field: code that builds a `MarkGeometry` needs no change, and an effect that ignores it works as before.
|
|
37
|
+
- **`delta` and `label`**, built-in data effects that put text past the end of a mark, clear of its own labels: past a bar's value label, above a column's, past a line's end label, outside a slice's label, and 10 px past the end of a mark with none. `delta({ value, format, color })`, for the `update` slot, says the change since the last update ("+2"), worded in the page's locale with its sign and at most two decimals; with no previous values, or no change, it draws nothing. `label(text, { color })`, usually for `decorate`, says what `text(data, mark)` works out from the mark's data, and is typed by the rows it reads. Both rise 8 px into place and stay, following the mark, so their end state shows the text. The text is in the overlay, which screen readers don't read: say the same in the table or the announcement. With their types, `DeltaOptions` and `LabelOptions`. The effects guide's `delta` stays as its worked example, a smaller version.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- **`travel`'s trip lasts at most 4 s base**, after the gait's pace. A trip along more than 1,440 px (about 1,250 px for a step) is shorter than before: the icon goes faster rather than longer, so with `stagger` in front it still ends within 5 s. Analysis and Off scale it as before. Nothing needs to change in your code; for a long walk at the old speed, carry the icon in an effect of your own (`defineEffect`).
|
|
42
|
+
- **A `hover` event's `source` can be `"linked"`**, for a mark `link()` hovered because a mark in another chart was. Code that switches on `source` exhaustively gets a type error: add a `"linked"` case, or handle it with `"pointer"` where a linked mark should act as a hovered one. Without `link()`, `source` is never `"linked"`.
|
|
43
|
+
- **A mark's effects hear `onChange` when its own labels move**, even when the mark doesn't: a line's end label pushed aside by another's, or a label whose text changed. So do a bar's and a slice's when only their row changed, as a line's already did, so a decoration that reads a field the chart doesn't plot follows it. An effect that redraws on every change does a little more work; nothing needs to change in your code.
|
|
44
|
+
- **Hover dims the other marks' bodies, not their labels**, on the bar and donut charts and in a chart switch. The names and values of the marks that aren't hovered stay at full strength, so they keep 4.5:1 (WCAG 1.4.3); they used to dim with their marks, to 2.0:1 in the light theme. `--ec-dim-opacity` keeps its default, 0.3, and an effect's `opacity` on a dimmed mark still multiplies with it. `expressive()`'s `dim` doesn't change. To dim the labels too, as before, add this to the page's CSS: `.ec-chart.ec-hovering .ec-mark:not(.ec-hot) :is(.ec-label, .ec-value) { opacity: var(--ec-dim-opacity, 0.3); }`.
|
|
45
|
+
|
|
28
46
|
## 0.1.0 (24 October 2026)
|
|
29
47
|
|
|
30
48
|
The first release, published to npm from CI with provenance. Everything in it is new. [docs/api.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md) documents every export.
|
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@ Composable motion and expressive effects for web charts. Hover, update and morph
|
|
|
15
15
|
|
|
16
16
|
Each picture plays once and stops where its effect ends. **[The demo site](https://deaversbp.github.io/expressive-charts/)** has every effect to try, on the library's charts and on D3, Vega-Lite and hand-written ones, with the motion modes and reduced motion.
|
|
17
17
|
|
|
18
|
-
> **Status: 0.
|
|
18
|
+
> **Status: 0.2.0 (October 2026).** The effect-author API is under [the 0.x promise](#the-0x-promise); the charts, adapters, built-in effects and motion core can still change in a minor release. [CHANGELOG.md](https://github.com/Deaversbp/expressive-charts/blob/main/CHANGELOG.md#020-26-october-2026) lists what's new and what changed since 0.1.0.
|
|
19
19
|
|
|
20
|
-
- **Effects first.** The mark effects `travel`, `flash`, `wiggle`, `pulse` and the data
|
|
21
|
-
- **Charts and adapters.** Bar, donut and line charts, a switch that morphs one into another,
|
|
20
|
+
- **Effects first.** The mark effects `travel`, `flash`, `wiggle`, `pulse`, `trace` and the data effects `threshold`, `delta` and `label`, put together with `sequence`, `parallel`, `only` and `stagger`; and the transition effect `morph`, which `chartSwitch` plays to turn each mark of one chart into its mark in the next (a transition can't go into a combinator). An effect reads only a shared description of the mark, so one effect works on every chart, and effects of your own work everywhere the built-in ones do.
|
|
21
|
+
- **Charts and adapters.** Bar, donut and line charts, a switch that morphs one into another, adapters that bring the same effects to SVG marks drawn by other code, and hover linked across them.
|
|
22
22
|
- **Motion that stays readable.** One clock and three modes: Presentation (staged, about a second), Analysis (at most about 200 ms) and Off. The device's reduced-motion setting is followed unless the viewer picks a mode on the page, and every effect has an end state, which is what reduced motion shows.
|
|
23
23
|
- **Accessible.** Keyboard focus, a name for every mark, a data table, announcements and a pause control for anything that plays, checked against WCAG 2.2 AA.
|
|
24
24
|
|
|
@@ -28,13 +28,13 @@ Each picture plays once and stops where its effect ends. **[The demo site](https
|
|
|
28
28
|
npm install expressive-charts
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
It has no runtime dependencies. It's an ES module and CommonJS, each with its own types, and its JavaScript has no side effects, so a bundler keeps only what a page imports: a bar chart is about
|
|
31
|
+
It has no runtime dependencies. It's an ES module and CommonJS, each with its own types, and its JavaScript has no side effects, so a bundler keeps only what a page imports: a bar chart is about 29 KB gzipped, and everything 68 KB.
|
|
32
32
|
|
|
33
33
|
On a page with no bundler, the script-tag bundle defines one global, `ExpressiveCharts`, holding the main entry:
|
|
34
34
|
|
|
35
35
|
```html
|
|
36
36
|
<div id="sales"></div>
|
|
37
|
-
<script src="https://cdn.jsdelivr.net/npm/expressive-charts@0.
|
|
37
|
+
<script src="https://cdn.jsdelivr.net/npm/expressive-charts@0.2/dist/expressive-charts.global.js"></script>
|
|
38
38
|
<script>
|
|
39
39
|
const { barChart } = ExpressiveCharts;
|
|
40
40
|
barChart("#sales", {
|
|
@@ -127,7 +127,8 @@ playButton("#play", season, { labels: { play: "Play season" } });
|
|
|
127
127
|
- **Charts.** [`barChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#barchart) draws bars or columns, plain or stacked; [`donutChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#donutchart) shares of a total; [`lineChart`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#linechart) a line per series, on a number axis or, when `x` gives `Date`s, a time axis in UTC (or `timeZone: "local"`) worded in the page's locale. Each sizes itself to its container, follows the light or dark theme, and has a tooltip, a legend, a data table and keyboard focus. Its handle has `update()`, which animates a change by the motion mode, and `update({ on })` swaps its effects in place; `focus(key)`; `leave()`, which ends its hover; and `labels()`. `table.series` heads a series' column in the data table.
|
|
128
128
|
- **Switching.** [`chartSwitch`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#chartswitch) shows views of the same data one at a time, and turns each mark into its own mark in the next with [`morph()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#morph): a donut becoming columns, and back from wherever it is.
|
|
129
129
|
- **Adapters.** [`expressive()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#expressive) reads keys, rows and geometry from SVG marks drawn by D3, Observable Plot or by hand, and draws on an overlay, leaving the host's styling alone; `watch: true` follows the host's own transitions. Observable Plot binds each rect to its row's index, so pass `datum: (el) => rows[el.__data__]`; Plot draws a new `<svg>` each time, so pass `refresh()` the new one's rects. The Plot accessors are tested against Plot 0.6.17. [`fromVegaView()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#fromvegaview) does the same for a Vega or Vega-Lite View rendered as SVG, and follows its renders.
|
|
130
|
-
- **
|
|
130
|
+
- **Linked hover.** [`link()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#link) links hover across charts and attachments by a value their marks share, such as a column's matchweek and the line's x there: hovering one hovers the others' marks with that value, with their emphasis, dimming and hover effects, as `source: "linked"`. Linked charts show no tooltip and take no focus.
|
|
131
|
+
- **Effects.** [`travel`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#travel) carries an icon along a mark; [`flash`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#flash), [`wiggle`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#wiggle) and [`pulse`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#pulse) draw attention without changing a value; [`trace`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#trace) draws a highlighter stroke along a mark and leaves it there; [`threshold`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#threshold) colours the parts of a mark below or above a reference; [`delta`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#delta) labels a mark's change since the last update ("+2"), and [`label`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#label) any text worked out from its data, past the mark's own labels. Each goes in an effect slot (`hover`, `enter`, `update`, `exit`, `decorate`), as an effect or a preset's name (`"wiggle"`).
|
|
131
132
|
- **Controls.** [`motionSwitch()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#motionswitch) is the viewer's own choice of mode. [`playback()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#playback) plays a value through a range, and [`playButton()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#playbutton) is its Play/Pause button.
|
|
132
133
|
- **The motion core.** [`motion`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#motion), [`tween()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#tween) and [`animated()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#animated), for animations of your own that follow the same modes.
|
|
133
134
|
|
|
@@ -197,7 +198,7 @@ The package lists its CSS under `sideEffects`, so bundlers keep that import. Cha
|
|
|
197
198
|
- **Motion.** Reduced motion jumps every animation to its end state unless the viewer picks a mode on the page, with `motionSwitch()`. Nothing plays by itself, and a playback has its pause control in `playButton()` (WCAG 2.2.2).
|
|
198
199
|
- **Other people's charts.** `expressive()` adds the same keyboard focus with `keyboard: true`, and one name per mark with `markLabel`.
|
|
199
200
|
|
|
200
|
-
The demo pages with the library's charts on them have had a written WCAG 2.2 AA audit ([a11y-audit.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/a11y-audit.md)), and the test suite runs axe's WCAG rules on every demo page in Chromium, Firefox and WebKit, in light and dark, at 320 px wide and under forced colours. Screen-reader scripts for NVDA and Chrome, with their results, are in [a11y-check.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/a11y-check.md#results). Known gaps: the tooltip can't be hovered itself (it can be dismissed with Escape),
|
|
201
|
+
The demo pages with the library's charts on them have had a written WCAG 2.2 AA audit ([a11y-audit.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/a11y-audit.md)), and the test suite runs axe's WCAG rules on every demo page in Chromium, Firefox and WebKit, in light and dark, at 320 px wide and under forced colours. Screen-reader scripts for NVDA and Chrome, with their results, are in [a11y-check.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/a11y-check.md#results). Known gaps: the tooltip can't be hovered itself (it can be dismissed with Escape), and VoiceOver hasn't been run.
|
|
201
202
|
|
|
202
203
|
## Limits
|
|
203
204
|
|
|
@@ -226,7 +227,7 @@ From 0.1.0 the library follows semantic versioning. While it's 0.x, the effect-a
|
|
|
226
227
|
- [Examples](https://github.com/Deaversbp/expressive-charts/tree/main/docs/sketches/examples): pages written against the API, which `npm run typecheck` checks: ball-and-cleat bars, a goals vs xG line with playback, a donut that morphs into columns, D3 charts, effects of your own and presets.
|
|
227
228
|
- [Changelog](https://github.com/Deaversbp/expressive-charts/blob/main/CHANGELOG.md), and [the development log](https://github.com/Deaversbp/expressive-charts/blob/main/docs/plan.md): the plan the library was built to, milestone by milestone, with the reasoning behind each decision.
|
|
228
229
|
- [Accessibility audit](https://github.com/Deaversbp/expressive-charts/blob/main/docs/a11y-audit.md) and [screen-reader scripts](https://github.com/Deaversbp/expressive-charts/blob/main/docs/a11y-check.md).
|
|
229
|
-
- [Demos](https://github.com/Deaversbp/expressive-charts/tree/main/demo), on [the demo site](https://deaversbp.github.io/expressive-charts/), or served by `npm run dev`. `bars.html`, `donut.html`, `line.html` and `morph.html` put the library's charts beside D3, Vega-Lite and hand-written ones, with the same effects on each; `stress.html` is the limits above; and `lab.html` is the single-file prototype the library grew out of.
|
|
230
|
+
- [Demos](https://github.com/Deaversbp/expressive-charts/tree/main/demo), on [the demo site](https://deaversbp.github.io/expressive-charts/), or served by `npm run dev`. `bars.html`, `donut.html`, `line.html` and `morph.html` put the library's charts beside D3, Vega-Lite and hand-written ones, with the same effects on each; `season.html` links three charts by matchweek and labels each change with `delta()` and `label()`; `stress.html` is the limits above; and `lab.html` is the single-file prototype the library grew out of.
|
|
230
231
|
- [Contributing](https://github.com/Deaversbp/expressive-charts/blob/main/CONTRIBUTING.md) and [issues](https://github.com/Deaversbp/expressive-charts/issues).
|
|
231
232
|
|
|
232
233
|
## Development
|
|
@@ -238,7 +239,7 @@ From 0.1.0 the library follows semantic versioning. While it's 0.x, the effect-a
|
|
|
238
239
|
| `npm run size` | Measures the built package and fails when a size is over its budget in `scripts/size-budget.json` (see [CONTRIBUTING.md](https://github.com/Deaversbp/expressive-charts/blob/main/CONTRIBUTING.md#bundle-size)) |
|
|
239
240
|
| `npm run pack-check` | After a build: packs the package, installs it in a new project and checks every entry as ESM and CommonJS, with its types (see [CONTRIBUTING.md](https://github.com/Deaversbp/expressive-charts/blob/main/CONTRIBUTING.md#setup)) |
|
|
240
241
|
| `npm test` | Runs the test suite, which also checks [docs/api.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md) against the exports and type-checks this README's examples |
|
|
241
|
-
| `npm run test:visual:docker` | Runs the screenshot tests of `demo/bars.html`, `donut.html`, `line.html`, `morph.html` and `stress.html` in Chromium, and their DOM checks and the accessibility checks (axe) in Chromium, Firefox and WebKit, in Playwright's Linux image (needs Docker; see [CONTRIBUTING.md](https://github.com/Deaversbp/expressive-charts/blob/main/CONTRIBUTING.md#visual-tests)) |
|
|
242
|
+
| `npm run test:visual:docker` | Runs the screenshot tests of `demo/bars.html`, `donut.html`, `line.html`, `morph.html`, `season.html` and `stress.html` in Chromium, and their DOM checks and the accessibility checks (axe) in Chromium, Firefox and WebKit, in Playwright's Linux image (needs Docker; see [CONTRIBUTING.md](https://github.com/Deaversbp/expressive-charts/blob/main/CONTRIBUTING.md#visual-tests)) |
|
|
242
243
|
| `npm run build:site` | Builds the demo pages into `site/`, which `.github/workflows/pages.yml` publishes as [the demo site](https://deaversbp.github.io/expressive-charts/) |
|
|
243
244
|
| `npm run media` | Captures README's pictures (`docs/media/*.gif`) from the demo pages, frame by frame, in Playwright's Linux image (needs Docker; see [CONTRIBUTING.md](https://github.com/Deaversbp/expressive-charts/blob/main/CONTRIBUTING.md#readmes-pictures-and-the-demo-site)) |
|
|
244
245
|
| `npm run bench` | Measures the stress page's cases in headless Chromium against `npm run dev`, unthrottled and at 4×, about 47 minutes; not in CI |
|
|
@@ -200,7 +200,7 @@ function checkCount(n, multiple) {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
// src/core/geometry/describe/mark.ts
|
|
203
|
-
function assemble({ key, series, walk, thickness, outline, bounds, center, pivot, segments }) {
|
|
203
|
+
function assemble({ key, series, walk, thickness, outline, bounds, center, pivot, labelBounds, segments }) {
|
|
204
204
|
return {
|
|
205
205
|
key,
|
|
206
206
|
...series === void 0 ? {} : { series },
|
|
@@ -215,6 +215,7 @@ function assemble({ key, series, walk, thickness, outline, bounds, center, pivot
|
|
|
215
215
|
bounds,
|
|
216
216
|
center,
|
|
217
217
|
pivot,
|
|
218
|
+
...labelBounds === void 0 ? {} : { labelBounds },
|
|
218
219
|
...segments === void 0 ? {} : { segments }
|
|
219
220
|
};
|
|
220
221
|
}
|
|
@@ -222,6 +223,18 @@ function finite(builder, field, value) {
|
|
|
222
223
|
if (!Number.isFinite(value)) throw new RangeError(`describe.${builder}: ${field} must be a finite number, got ${value}.`);
|
|
223
224
|
return value;
|
|
224
225
|
}
|
|
226
|
+
function labelBoxes(builder, boxes) {
|
|
227
|
+
if (!boxes) return boxes;
|
|
228
|
+
for (let i = 0; i < boxes.length; i++) {
|
|
229
|
+
const { x, y, width, height } = boxes[i];
|
|
230
|
+
if (Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(width) && width >= 0 && Number.isFinite(height) && height >= 0) continue;
|
|
231
|
+
finite(builder, `labelBounds[${i}].x`, x);
|
|
232
|
+
finite(builder, `labelBounds[${i}].y`, y);
|
|
233
|
+
size(builder, `labelBounds[${i}].width`, width);
|
|
234
|
+
size(builder, `labelBounds[${i}].height`, height);
|
|
235
|
+
}
|
|
236
|
+
return boxes;
|
|
237
|
+
}
|
|
225
238
|
function size(builder, field, value) {
|
|
226
239
|
if (!(Number.isFinite(value) && value >= 0)) {
|
|
227
240
|
throw new RangeError(`describe.${builder}: ${field} must be a finite number \u2265 0, got ${value}.`);
|
|
@@ -256,7 +269,8 @@ function describeArc(spec) {
|
|
|
256
269
|
outline: closedOutline(sides),
|
|
257
270
|
bounds: boundsOf(sides.flat().flatMap(extremes)),
|
|
258
271
|
center: walk.point(0.5),
|
|
259
|
-
pivot: center
|
|
272
|
+
pivot: center,
|
|
273
|
+
labelBounds: labelBoxes("arc", spec.labelBounds)
|
|
260
274
|
});
|
|
261
275
|
}
|
|
262
276
|
|
|
@@ -273,6 +287,7 @@ function describeBar(spec) {
|
|
|
273
287
|
size("bar", "height", height);
|
|
274
288
|
const radius = size("bar", "radius", spec.radius ?? 0);
|
|
275
289
|
const gap = size("bar", "gap", spec.gap ?? 0);
|
|
290
|
+
const labelBounds = labelBoxes("bar", spec.labelBounds);
|
|
276
291
|
const horizontal = baseline === "left" || baseline === "right";
|
|
277
292
|
const length = horizontal ? width : height;
|
|
278
293
|
const thickness = horizontal ? height : width;
|
|
@@ -325,7 +340,7 @@ function describeBar(spec) {
|
|
|
325
340
|
})
|
|
326
341
|
)
|
|
327
342
|
);
|
|
328
|
-
return part(0, length, radius, { key, series, bounds: { x, y, width, height }, segments });
|
|
343
|
+
return part(0, length, radius, { key, series, bounds: { x, y, width, height }, labelBounds, segments });
|
|
329
344
|
}
|
|
330
345
|
function frame({ x, y, width: w, height: h, baseline }) {
|
|
331
346
|
switch (baseline) {
|
|
@@ -366,7 +381,8 @@ function describeLine(spec) {
|
|
|
366
381
|
outline: openOutline(walk),
|
|
367
382
|
bounds: { x: box.x - pad, y: box.y - pad, width: box.width + width, height: box.height + width },
|
|
368
383
|
center: walk.point(0.5),
|
|
369
|
-
pivot: first
|
|
384
|
+
pivot: first,
|
|
385
|
+
labelBounds: labelBoxes("line", spec.labelBounds)
|
|
370
386
|
});
|
|
371
387
|
}
|
|
372
388
|
|
|
@@ -389,7 +405,8 @@ function describePoint(spec) {
|
|
|
389
405
|
]),
|
|
390
406
|
bounds: { x: center.x - r, y: center.y - r, width: 2 * r, height: 2 * r },
|
|
391
407
|
center,
|
|
392
|
-
pivot: center
|
|
408
|
+
pivot: center,
|
|
409
|
+
labelBounds: labelBoxes("point", spec.labelBounds)
|
|
393
410
|
});
|
|
394
411
|
}
|
|
395
412
|
|
|
@@ -551,4 +568,4 @@ export {
|
|
|
551
568
|
offset,
|
|
552
569
|
samplesAlong
|
|
553
570
|
};
|
|
554
|
-
//# sourceMappingURL=chunk-
|
|
571
|
+
//# sourceMappingURL=chunk-V5IUTXRW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/geometry/segment.ts","../src/core/geometry/path-data.ts","../src/core/geometry/walk.ts","../src/core/geometry/outline.ts","../src/core/geometry/describe/mark.ts","../src/core/geometry/describe/arc.ts","../src/core/geometry/describe/bar.ts","../src/core/geometry/describe/line.ts","../src/core/geometry/describe/point.ts","../src/core/geometry/describe/index.ts","../src/core/geometry/matrix.ts","../src/core/geometry/samples.ts"],"sourcesContent":["// Path segments: straight lines and circular arcs, with exact lengths.\n//\n// Angles are screen angles: radians, 0 along +x, increasing clockwise on screen (y points down).\n// That is the convention of Math.atan2 in chart pixels, and of the walk's `angle(t)`.\n\nimport type { Point, Rect } from \"../contracts/geometry\";\n\nexport const TAU = 2 * Math.PI;\n\nexport interface LineSegment {\n readonly kind: \"line\";\n readonly from: Point;\n readonly to: Point;\n readonly length: number;\n /** Direction from `from` to `to`, or the fallback given to `line()` when they coincide. */\n readonly angle: number;\n}\n\nexport interface ArcSegment {\n readonly kind: \"arc\";\n readonly center: Point;\n readonly radius: number;\n /** Screen angle of the first point. */\n readonly start: number;\n /** Signed: positive is clockwise on screen. */\n readonly sweep: number;\n /** Exact: radius × |sweep|. */\n readonly length: number;\n}\n\nexport type PathSegment = LineSegment | ArcSegment;\n\n/** A straight segment. `fallbackAngle` is its direction if `from` and `to` coincide. */\nexport function line(from: Point, to: Point, fallbackAngle = 0): LineSegment {\n const dx = to.x - from.x;\n const dy = to.y - from.y;\n const length = Math.hypot(dx, dy);\n return { kind: \"line\", from, to, length, angle: length > 0 ? Math.atan2(dy, dx) : normalizeAngle(fallbackAngle) };\n}\n\n/** A circular arc from screen angle `start`, turning `sweep` radians (positive = clockwise on screen). */\nexport function arc(center: Point, radius: number, start: number, sweep: number): ArcSegment {\n return { kind: \"arc\", center, radius, start, sweep, length: radius * Math.abs(sweep) };\n}\n\n/** The point a fraction `u` (0–1) of the way along the segment, by distance. Exact at both ends of a line. */\nexport function pointOn(segment: PathSegment, u: number): Point {\n if (segment.kind === \"line\") {\n const { from, to } = segment;\n return { x: from.x * (1 - u) + to.x * u, y: from.y * (1 - u) + to.y * u };\n }\n return polar(segment.center, segment.radius, segment.start + segment.sweep * u);\n}\n\n/** Direction of travel at fraction `u`, in (-PI, PI]. */\nexport function angleOn(segment: PathSegment, u: number): number {\n if (segment.kind === \"line\") return segment.angle;\n const quarter = segment.sweep < 0 ? -Math.PI / 2 : Math.PI / 2;\n return normalizeAngle(segment.start + segment.sweep * u + quarter);\n}\n\nexport function polar(center: Point, radius: number, angle: number): Point {\n return { x: center.x + radius * Math.cos(angle), y: center.y + radius * Math.sin(angle) };\n}\n\n/** The same angle in (-PI, PI]. */\nexport function normalizeAngle(angle: number): number {\n return angle - TAU * Math.ceil((angle - Math.PI) / TAU);\n}\n\n/** The points that bound a segment: its ends, plus an arc's extremes in x and y. */\nexport function extremes(segment: PathSegment): Point[] {\n if (segment.kind === \"line\") return [segment.from, segment.to];\n const points = [pointOn(segment, 0), pointOn(segment, 1)];\n for (let k = 0; k < 4; k++) {\n const angle = (k * Math.PI) / 2;\n if (sweeps(segment, angle)) points.push(polar(segment.center, segment.radius, angle));\n }\n return points;\n}\n\nexport function boundsOf(points: readonly Point[]): Rect {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n for (const { x, y } of points) {\n if (x < minX) minX = x;\n if (x > maxX) maxX = x;\n if (y < minY) minY = y;\n if (y > maxY) maxY = y;\n }\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n/** True if the arc passes through screen angle `angle`. */\nfunction sweeps(segment: ArcSegment, angle: number): boolean {\n const extent = Math.abs(segment.sweep);\n if (extent >= TAU) return true;\n const turned = segment.sweep >= 0 ? angle - segment.start : segment.start - angle;\n return ((turned % TAU) + TAU) % TAU <= extent;\n}\n","// SVG path data for segments: M, L, A and Z only, with numbers rounded to 0.001 px.\n\nimport type { Point } from \"../contracts/geometry\";\nimport { pointOn, polar, type PathSegment } from \"./segment\";\n\n/** A coordinate for path data: rounded to 0.001, with no \"-0\". */\nexport function formatNumber(value: number): string {\n const rounded = Math.round(value * 1000) / 1000;\n return rounded === 0 ? \"0\" : String(rounded);\n}\n\nexport function moveTo(point: Point): string {\n return `M${formatNumber(point.x)},${formatNumber(point.y)}`;\n}\n\n/**\n * Commands that draw a segment from fraction `u0` to `u1` of its length, assuming the pen is already\n * at the `u0` point. Arcs are split into pieces of at most half a turn, so the large-arc flag is\n * always 0 and a full circle still draws.\n */\nexport function drawTo(segment: PathSegment, u0 = 0, u1 = 1): string {\n if (segment.kind === \"line\") {\n const p = u1 === 1 ? segment.to : pointOn(segment, u1);\n return `L${formatNumber(p.x)},${formatNumber(p.y)}`;\n }\n const from = segment.start + segment.sweep * u0;\n const turn = segment.sweep * (u1 - u0);\n const pieces = Math.max(1, Math.ceil(Math.abs(turn) / Math.PI - 1e-9));\n const r = formatNumber(segment.radius);\n const clockwise = turn >= 0 ? 1 : 0;\n let d = \"\";\n for (let i = 1; i <= pieces; i++) {\n const p = polar(segment.center, segment.radius, from + (turn * i) / pieces);\n d += `A${r},${r} 0 0 ${clockwise} ${formatNumber(p.x)},${formatNumber(p.y)}`;\n }\n return d;\n}\n\n/**\n * Path data for a run of connected segments. Zero-length segments draw nothing. A closed run ends\n * with Z, which also replaces a final straight segment back to the start.\n */\nexport function pathData(segments: readonly PathSegment[], closed = false): string {\n const first = segments[0];\n if (!first) return \"\";\n let count = segments.length;\n if (closed) {\n while (count > 0 && segments[count - 1]!.length <= 0) count--;\n if (count > 0 && segments[count - 1]!.kind === \"line\") count--;\n }\n let d = moveTo(pointOn(first, 0));\n for (let i = 0; i < count; i++) {\n const segment = segments[i]!;\n if (segment.length > 0) d += drawTo(segment);\n }\n return closed ? `${d}Z` : d;\n}\n","// A walk: connected segments parameterised by distance, so t = 0.5 is halfway along on screen.\n\nimport type { Point } from \"../contracts/geometry\";\nimport { drawTo, moveTo, pathData } from \"./path-data\";\nimport { angleOn, pointOn, type PathSegment } from \"./segment\";\n\nexport interface Walk {\n readonly segments: readonly PathSegment[];\n readonly length: number;\n readonly start: Point;\n readonly end: Point;\n /** t in [0, 1], proportional to distance. Values outside are clamped. */\n point(t: number): Point;\n /** Direction of travel in (-PI, PI]. At a joint, the segment ahead wins, except at t = 1. */\n angle(t: number): number;\n /** Path data from t0 to t1, in either order. Just a move when they're equal. */\n slice(t0: number, t1: number): string;\n /** Path data for the whole walk. */\n readonly d: string;\n}\n\nconst clamp01 = (t: number): number => (t > 0 ? (t < 1 ? t : 1) : 0);\n\n/** The segments must connect: each starts where the one before ends. */\nexport function createWalk(segments: readonly PathSegment[]): Walk {\n const first = segments[0];\n const last = segments[segments.length - 1];\n if (!first || !last) throw new RangeError(\"A walk needs at least one segment.\");\n\n // cumulative[i] is the distance to the start of segment i.\n const cumulative = [0];\n for (const segment of segments) cumulative.push(cumulative[cumulative.length - 1]! + segment.length);\n const length = cumulative[segments.length]!;\n const start = pointOn(first, 0);\n const end = pointOn(last, 1);\n\n // The segment at distance d, and the fraction along it. Zero-length segments are never picked\n // unless the whole walk has zero length.\n const locate = (d: number): { readonly index: number; readonly u: number } => {\n if (!(length > 0)) return { index: 0, u: 0 };\n if (d >= length) {\n let index = segments.length - 1;\n while (index > 0 && !(segments[index]!.length > 0)) index--;\n return { index, u: 1 };\n }\n // The first segment that ends beyond d.\n let lo = 0;\n let hi = segments.length - 1;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (cumulative[mid + 1]! > d) hi = mid;\n else lo = mid + 1;\n }\n return { index: lo, u: Math.min(1, (d - cumulative[lo]!) / segments[lo]!.length) };\n };\n\n const point = (t: number): Point => {\n const at = clamp01(t);\n if (at === 0) return start;\n if (at === 1) return end;\n const { index, u } = locate(at * length);\n return pointOn(segments[index]!, u);\n };\n\n return {\n segments,\n length,\n start,\n end,\n point,\n angle(t) {\n const { index, u } = locate(clamp01(t) * length);\n return angleOn(segments[index]!, u);\n },\n slice(t0, t1) {\n const from = clamp01(Math.min(t0, t1));\n const to = clamp01(Math.max(t0, t1));\n let d = moveTo(point(from));\n const a = from * length;\n const b = to * length;\n if (!(b > a)) return d;\n const first = locate(a);\n for (let i = first.index; i < segments.length && cumulative[i]! < b; i++) {\n const segment = segments[i]!;\n if (!(segment.length > 0)) continue;\n const u0 = i === first.index ? first.u : 0;\n const u1 = cumulative[i + 1]! > b ? Math.min(1, (b - cumulative[i]!) / segment.length) : 1;\n if (u1 > u0) d += drawTo(segment, u0, u1);\n }\n return d;\n },\n d: pathData(segments)\n };\n}\n","// Outlines with canonical sampling, so morph can match corners and winding between any two marks.\n\nimport type { Outline, Point } from \"../contracts/geometry\";\nimport { pathData } from \"./path-data\";\nimport type { PathSegment } from \"./segment\";\nimport { createWalk, type Walk } from \"./walk\";\n\n/** The four sides of a closed outline, in order. Each must start where the one before ends. */\nexport type Sides = readonly [\n left: readonly PathSegment[],\n end: readonly PathSegment[],\n right: readonly PathSegment[],\n start: readonly PathSegment[]\n];\n\n/**\n * A closed outline from its sides: left (the up side, walked in the direction of travel), end,\n * right (walked back) and start. That order runs clockwise on screen from the start-left corner.\n */\nexport function closedOutline(sides: Sides): Outline {\n const walks = sides.map(createWalk);\n return {\n d: pathData(sides.flat(), true),\n closed: true,\n sample(n) {\n checkCount(n, 4);\n const perSide = n / 4;\n const points: Point[] = [];\n for (const walk of walks) {\n for (let j = 0; j < perSide; j++) points.push(walk.point(j / perSide));\n }\n return points;\n }\n };\n}\n\n/** An open outline: the stroke along a walk. */\nexport function openOutline(walk: Walk): Outline {\n return {\n d: walk.d,\n closed: false,\n sample(n) {\n checkCount(n, 1);\n if (n === 1) return [walk.start];\n const points: Point[] = [];\n for (let j = 0; j < n; j++) points.push(walk.point(j / (n - 1)));\n return points;\n }\n };\n}\n\nfunction checkCount(n: number, multiple: number): void {\n if (!Number.isInteger(n) || n < 0 || n % multiple !== 0) {\n const what = multiple === 1 ? \"a whole number ≥ 0\" : `a whole multiple of ${multiple}`;\n throw new RangeError(`outline.sample(n): n must be ${what}, got ${n}.`);\n }\n}\n","// Shared by the builders: assembling a MarkGeometry from a walk and a body, and checking input.\n\nimport type { MarkGeometry, Outline, Point, Rect } from \"../../contracts/geometry\";\nimport type { Walk } from \"../walk\";\n\nexport interface MarkParts {\n readonly key: string;\n readonly series?: string | undefined;\n readonly walk: Walk;\n readonly thickness: number;\n readonly outline: Outline;\n readonly bounds: Rect;\n readonly center: Point;\n readonly pivot: Point;\n readonly labelBounds?: readonly Rect[] | undefined;\n readonly segments?: readonly MarkGeometry[];\n}\n\nexport function assemble({ key, series, walk, thickness, outline, bounds, center, pivot, labelBounds, segments }: MarkParts): MarkGeometry {\n return {\n key,\n ...(series === undefined ? {} : { series }),\n start: walk.start,\n end: walk.end,\n length: walk.length,\n path: (t) => walk.point(t),\n angle: (t) => walk.angle(t),\n slice: (t0, t1) => walk.slice(t0, t1),\n thickness,\n outline,\n bounds,\n center,\n pivot,\n ...(labelBounds === undefined ? {} : { labelBounds }),\n ...(segments === undefined ? {} : { segments })\n };\n}\n\n/** Throws a RangeError naming the builder and field unless `value` is a finite number. */\nexport function finite(builder: string, field: string, value: number): number {\n if (!Number.isFinite(value)) throw new RangeError(`describe.${builder}: ${field} must be a finite number, got ${value}.`);\n return value;\n}\n\n/** A spec's `labelBounds`, checked: each box's numbers finite, its sizes ≥ 0. Charts give them every frame, so a good box costs four comparisons. */\nexport function labelBoxes(builder: string, boxes: readonly Rect[] | undefined): readonly Rect[] | undefined {\n if (!boxes) return boxes;\n for (let i = 0; i < boxes.length; i++) {\n const { x, y, width, height } = boxes[i]!;\n if (Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(width) && width >= 0 && Number.isFinite(height) && height >= 0) continue;\n finite(builder, `labelBounds[${i}].x`, x);\n finite(builder, `labelBounds[${i}].y`, y);\n size(builder, `labelBounds[${i}].width`, width);\n size(builder, `labelBounds[${i}].height`, height);\n }\n return boxes;\n}\n\n/** Throws a RangeError unless `value` is a finite number ≥ 0. */\nexport function size(builder: string, field: string, value: number): number {\n if (!(Number.isFinite(value) && value >= 0)) {\n throw new RangeError(`describe.${builder}: ${field} must be a finite number ≥ 0, got ${value}.`);\n }\n return value;\n}\n","// describe.arc: donut and pie slices, in d3.pie()'s angle convention.\n\nimport type { MarkGeometry, Rect } from \"../../contracts/geometry\";\nimport { closedOutline } from \"../outline\";\nimport { arc, boundsOf, extremes, line, polar, TAU } from \"../segment\";\nimport { createWalk } from \"../walk\";\nimport { assemble, finite, labelBoxes, size } from \"./mark\";\n\nexport interface ArcSpec {\n readonly key: string;\n readonly series?: string;\n /** The donut's centre. */\n readonly cx: number;\n readonly cy: number;\n /** Radii in px; 0 inner makes a pie slice. They're swapped if inner > outer, as d3.arc() does. */\n readonly inner: number;\n readonly outer: number;\n /** Radians, 0 at 12 o'clock, clockwise: the d3.pie() convention. end < start walks anticlockwise. */\n readonly start: number;\n readonly end: number;\n /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n}\n\n/**\n * The walk runs along the mid-radius arc from the start angle to the end angle, so for a slice\n * walked clockwise \"up\" is outward. The angle of travel equals the d3 angle (normalised).\n */\nexport function describeArc(spec: ArcSpec): MarkGeometry {\n const { key, series } = spec;\n const center = { x: finite(\"arc\", \"cx\", spec.cx), y: finite(\"arc\", \"cy\", spec.cy) };\n const r0 = Math.min(size(\"arc\", \"inner\", spec.inner), size(\"arc\", \"outer\", spec.outer));\n const r1 = Math.max(spec.inner, spec.outer);\n finite(\"arc\", \"start\", spec.start);\n finite(\"arc\", \"end\", spec.end);\n // More than a full turn draws the same ring, as with d3.arc().\n const sweep = Math.max(-TAU, Math.min(TAU, spec.end - spec.start));\n // d3 measures from 12 o'clock; screen angles from 3 o'clock.\n const from = spec.start - Math.PI / 2;\n const to = from + sweep;\n\n // The up side is outward when walking clockwise, inward when walking anticlockwise.\n const [left, right] = sweep >= 0 ? [r1, r0] : [r0, r1];\n const sides = [\n [arc(center, left, from, sweep)],\n [line(polar(center, left, to), polar(center, right, to), to + (left > right ? Math.PI : 0))],\n [arc(center, right, to, -sweep)],\n [line(polar(center, right, from), polar(center, left, from), from + (left > right ? 0 : Math.PI))]\n ] as const;\n\n const walk = createWalk([arc(center, (r0 + r1) / 2, from, sweep)]);\n return assemble({\n key,\n series,\n walk,\n thickness: r1 - r0,\n outline: closedOutline(sides),\n bounds: boundsOf(sides.flat().flatMap(extremes)),\n center: walk.point(0.5),\n pivot: center,\n labelBounds: labelBoxes(\"arc\", spec.labelBounds)\n });\n}\n","// describe.bar: horizontal bars and vertical columns, plain or stacked, with an optional rounded tip.\n\nimport type { MarkGeometry, Point, Rect } from \"../../contracts/geometry\";\nimport { closedOutline } from \"../outline\";\nimport { arc, boundsOf, line } from \"../segment\";\nimport { createWalk } from \"../walk\";\nimport { assemble, finite, labelBoxes, size } from \"./mark\";\n\n/** The edge a bar grows from. */\nexport type Baseline = \"left\" | \"right\" | \"top\" | \"bottom\";\n\nexport interface BarSegmentSpec {\n readonly series: string;\n /** Px along the walk, gap included. */\n readonly size: number;\n}\n\nexport interface BarSpec {\n readonly key: string;\n readonly series?: string;\n /** The whole bar's rectangle, in chart px. */\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n readonly baseline: Baseline;\n /** Corner radius at the tip. The baseline end stays square. Default 0. */\n readonly radius?: number;\n /**\n * Ordered parts, from the baseline. Default: one segment named after `series`, covering the bar.\n * Sizes normally add up to the bar's length; anything past the tip is cut off.\n */\n readonly segments?: readonly BarSegmentSpec[];\n /**\n * Px left empty between segments (the prototype uses 2). It comes out of the start of the later\n * segment, so every segment still ends at its value, and it shrinks to fit when what comes\n * before is shorter. Default 0.\n */\n readonly gap?: number;\n /** The boxes of the text drawn for the bar, its segments having none, in the same px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n}\n\nconst ANGLE: Readonly<Record<Baseline, number>> = { left: 0, right: Math.PI, top: Math.PI / 2, bottom: -Math.PI / 2 };\n\n/**\n * The walk runs along the centre line from the middle of the baseline edge to the middle of the\n * tip. A plain bar has one segment, so `travel(…, { along: \"goals\" })` works stacked or not.\n */\nexport function describeBar(spec: BarSpec): MarkGeometry {\n const { key, series, baseline, x, y, width, height } = spec;\n if (!Object.prototype.hasOwnProperty.call(ANGLE, baseline)) {\n throw new RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(baseline)}.`);\n }\n finite(\"bar\", \"x\", x);\n finite(\"bar\", \"y\", y);\n size(\"bar\", \"width\", width);\n size(\"bar\", \"height\", height);\n const radius = size(\"bar\", \"radius\", spec.radius ?? 0);\n const gap = size(\"bar\", \"gap\", spec.gap ?? 0);\n const labelBounds = labelBoxes(\"bar\", spec.labelBounds);\n\n const horizontal = baseline === \"left\" || baseline === \"right\";\n const length = horizontal ? width : height;\n const thickness = horizontal ? height : width;\n const T = thickness;\n const angle = ANGLE[baseline];\n const at = frame(spec);\n\n // The bar or segment covering [p0, p1] along the walk. The tip is rounded by up to `tip` px.\n const part = (\n p0: number,\n p1: number,\n tip: number,\n rest: { key: string; series: string | undefined; bounds?: Rect; labelBounds?: readonly Rect[] | undefined; segments?: readonly MarkGeometry[] }\n ): MarkGeometry => {\n const rr = Math.max(0, Math.min(tip, p1 - p0, T / 2));\n const outline = closedOutline([\n [line(at(p0, 0), at(p1 - rr, 0), angle)],\n rr > 0\n ? [\n arc(at(p1 - rr, rr), rr, angle - Math.PI / 2, Math.PI / 2),\n line(at(p1, rr), at(p1, T - rr), angle + Math.PI / 2),\n arc(at(p1 - rr, T - rr), rr, angle, Math.PI / 2)\n ]\n : [line(at(p1, 0), at(p1, T), angle + Math.PI / 2)],\n [line(at(p1 - rr, T), at(p0, T), angle + Math.PI)],\n [line(at(p0, T), at(p0, 0), angle - Math.PI / 2)]\n ]);\n const walk = createWalk([line(at(p0, T / 2), at(p1, T / 2), angle)]);\n return assemble({\n ...rest,\n walk,\n thickness,\n outline,\n bounds: rest.bounds ?? boundsOf([at(p0, 0), at(p1, T)]),\n center: at((p0 + p1) / 2, T / 2),\n pivot: walk.start\n });\n };\n\n const specs: readonly { readonly series?: string | undefined; readonly size: number }[] = spec.segments ?? [{ series, size: length }];\n const seen = new Set<string>();\n let cursor = 0;\n const spans = specs.map((segment, index) => {\n size(\"bar\", `segments[${index}].size`, segment.size);\n if (segment.series !== undefined) {\n if (seen.has(segment.series)) throw new Error(`describe.bar: series \"${segment.series}\" appears twice in the segments of \"${key}\".`);\n seen.add(segment.series);\n }\n const from = Math.min(cursor, length);\n cursor += segment.size;\n const to = Math.min(cursor, length);\n return { segment, index, p0: Math.min(from + Math.min(gap, from), to), p1: to };\n });\n\n const segments = spans.map(({ segment, index, p0, p1 }) =>\n // The rounding fades in as a segment nears the tip, so a growing stack never pops.\n part(p0, p1, radius - (length - p1), {\n key: segment.series === undefined ? `${key}/${index}` : `${key}/${segment.series}`,\n series: segment.series\n })\n );\n // The whole bar keeps the exact rectangle it was given.\n return part(0, length, radius, { key, series, bounds: { x, y, width, height }, labelBounds, segments });\n}\n\n/** Chart px at distance p along the walk and s across it, measured from the left (up) edge. */\nfunction frame({ x, y, width: w, height: h, baseline }: BarSpec): (p: number, s: number) => Point {\n switch (baseline) {\n case \"left\":\n return (p, s) => ({ x: x + p, y: y + s });\n case \"right\":\n return (p, s) => ({ x: x + w - p, y: y + h - s });\n case \"top\":\n return (p, s) => ({ x: x + w - s, y: y + p });\n case \"bottom\":\n return (p, s) => ({ x: x + s, y: y + h - p });\n }\n}\n","// describe.line: a straight-segment polyline, as d3.line() draws with its default curve.\n\nimport type { MarkGeometry, Point, Rect } from \"../../contracts/geometry\";\nimport { openOutline } from \"../outline\";\nimport { boundsOf, line, type LineSegment } from \"../segment\";\nimport { createWalk } from \"../walk\";\nimport { assemble, finite, labelBoxes, size } from \"./mark\";\n\nexport interface LineSpec {\n readonly key: string;\n readonly series?: string;\n /** At least one point, in chart px. */\n readonly points: readonly Point[];\n /** Stroke width in px. Default 1, SVG's default. */\n readonly width?: number;\n /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n}\n\n/** The walk is the line itself, first point to last. Its outline is open: the stroke. */\nexport function describeLine(spec: LineSpec): MarkGeometry {\n const { key, series, points } = spec;\n const width = size(\"line\", \"width\", spec.width ?? 1);\n const first = points[0];\n if (!first) throw new RangeError(`describe.line: \"${key}\" needs at least one point.`);\n points.forEach((p, i) => {\n finite(\"line\", `points[${i}].x`, p.x);\n finite(\"line\", `points[${i}].y`, p.y);\n });\n\n const segments: LineSegment[] = [];\n for (let i = 1; i < points.length; i++) {\n // A repeated point keeps the direction so far.\n segments.push(line(points[i - 1]!, points[i]!, segments[segments.length - 1]?.angle ?? 0));\n }\n if (segments.length === 0) segments.push(line(first, first));\n\n const walk = createWalk(segments);\n const box = boundsOf(points);\n const pad = width / 2;\n return assemble({\n key,\n series,\n walk,\n thickness: width,\n outline: openOutline(walk),\n bounds: { x: box.x - pad, y: box.y - pad, width: box.width + width, height: box.height + width },\n center: walk.point(0.5),\n pivot: first,\n labelBounds: labelBoxes(\"line\", spec.labelBounds)\n });\n}\n","// describe.point: a dot with no direction (a scatter point or a marker).\n\nimport type { MarkGeometry, Rect } from \"../../contracts/geometry\";\nimport { closedOutline } from \"../outline\";\nimport { arc, line } from \"../segment\";\nimport { createWalk } from \"../walk\";\nimport { assemble, finite, labelBoxes, size } from \"./mark\";\n\nexport interface PointSpec {\n readonly key: string;\n readonly series?: string;\n readonly x: number;\n readonly y: number;\n /** Radius in px. */\n readonly r: number;\n /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n}\n\n/**\n * Length 0, with start = end = centre, so travel does nothing while wiggle, pulse and flash still\n * work. Faces +x: the outline's sides are the quarter circles top, right, bottom and left.\n */\nexport function describePoint(spec: PointSpec): MarkGeometry {\n const { key, series } = spec;\n const center = { x: finite(\"point\", \"x\", spec.x), y: finite(\"point\", \"y\", spec.y) };\n const r = size(\"point\", \"r\", spec.r);\n const quarter = Math.PI / 2;\n return assemble({\n key,\n series,\n walk: createWalk([line(center, center)]),\n thickness: 2 * r,\n outline: closedOutline([\n [arc(center, r, (-3 * quarter) / 2, quarter)],\n [arc(center, r, -quarter / 2, quarter)],\n [arc(center, r, quarter / 2, quarter)],\n [arc(center, r, (3 * quarter) / 2, quarter)]\n ]),\n bounds: { x: center.x - r, y: center.y - r, width: 2 * r, height: 2 * r },\n center,\n pivot: center,\n labelBounds: labelBoxes(\"point\", spec.labelBounds)\n });\n}\n","// The public geometry builders. Reference charts and adapters share these, so a bar is described\n// the same way whoever drew it.\n\nimport { describeArc } from \"./arc\";\nimport { describeBar } from \"./bar\";\nimport { describeLine } from \"./line\";\nimport { describePoint } from \"./point\";\n\nexport const describe = {\n bar: describeBar,\n arc: describeArc,\n line: describeLine,\n point: describePoint\n};\n\nexport type { ArcSpec } from \"./arc\";\nexport type { BarSegmentSpec, BarSpec, Baseline } from \"./bar\";\nexport type { LineSpec } from \"./line\";\nexport type { PointSpec } from \"./point\";\n","// Transform helpers for effect authors: matrix and offset are public (docs/effects-guide.md).\n\nimport type { Matrix } from \"../contracts/drawing\";\nimport type { Point } from \"../contracts/geometry\";\n\nfunction translate(x: number, y: number): Matrix {\n return [1, 0, 0, 1, x, y];\n}\n\n/** Positive radians turn clockwise on screen, like SVG's rotate(). */\nfunction rotate(radians: number, about?: Point): Matrix {\n const cos = Math.cos(radians);\n const sin = Math.sin(radians);\n return around([cos, sin, -sin, cos, 0, 0], about);\n}\n\nfunction scale(sx: number, sy: number = sx, about?: Point): Matrix {\n return around([sx, 0, 0, sy, 0, 0], about);\n}\n\n/** Composes like an SVG transform list: multiply(a, b) applies b first, then a. No arguments gives the identity. */\nfunction multiply(...matrices: Matrix[]): Matrix {\n let result: Matrix = [1, 0, 0, 1, 0, 0];\n for (const m of matrices) result = product(result, m);\n return result;\n}\n\n/** Where the transform takes a point. */\nfunction apply(m: Matrix, point: Point): Point {\n const [a, b, c, d, e, f] = m;\n return { x: a * point.x + c * point.y + e, y: b * point.x + d * point.y + f };\n}\n\nfunction product(l: Matrix, r: Matrix): Matrix {\n const [a1, b1, c1, d1, e1, f1] = l;\n const [a2, b2, c2, d2, e2, f2] = r;\n return [\n a1 * a2 + c1 * b2,\n b1 * a2 + d1 * b2,\n a1 * c2 + c1 * d2,\n b1 * c2 + d1 * d2,\n a1 * e2 + c1 * f2 + e1,\n b1 * e2 + d1 * f2 + f1\n ];\n}\n\n/** A linear transform (no translation) moved so it keeps `about` fixed. */\nfunction around(m: Matrix, about: Point | undefined): Matrix {\n if (!about) return m;\n const [a, b, c, d] = m;\n return [a, b, c, d, about.x - a * about.x - c * about.y, about.y - b * about.x - d * about.y];\n}\n\n/** Builds and applies 2D transforms in SVG order, for `mark.set({ transform })` and `IconHandle.place()`. */\nexport const matrix = { translate, rotate, scale, multiply, apply };\n\n// Internal: iconFromSvg and the adapter read SVG transforms with these.\n\n/** The inverse transform. A singular matrix (it squashes everything onto a line) throws a RangeError. */\nexport function invert(m: Matrix): Matrix {\n const [a, b, c, d, e, f] = m;\n const det = a * d - b * c;\n if (!Number.isFinite(det) || Math.abs(det) < 1e-12) throw new RangeError(\"This transform can't be inverted: it has no area.\");\n return [d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det];\n}\n\n/** An SVG transform list, as in the transform attribute. An unknown or malformed function is skipped. */\nexport function parseTransform(source: string): Matrix {\n const parts: Matrix[] = [];\n for (const [, name, rawArgs = \"\"] of source.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\\s*\\(([^)]*)\\)/g)) {\n const args = rawArgs.trim().split(/[\\s,]+/).filter(Boolean).map(Number);\n if (!args.every(Number.isFinite)) continue;\n const [a = 0, b, c, d = 0, e = 0, f = 0] = args;\n const radians = (degrees: number): number => (degrees * Math.PI) / 180;\n switch (name) {\n case \"matrix\":\n if (args.length === 6) parts.push([a, b!, c!, d, e, f]);\n break;\n case \"translate\":\n parts.push(translate(a, b ?? 0));\n break;\n case \"scale\":\n parts.push(scale(a, b ?? a));\n break;\n case \"rotate\":\n parts.push(rotate(radians(a), b !== undefined && c !== undefined ? { x: b, y: c } : undefined));\n break;\n case \"skewX\":\n parts.push([1, 0, Math.tan(radians(a)), 1, 0, 0]);\n break;\n case \"skewY\":\n parts.push([1, Math.tan(radians(a)), 0, 1, 0, 0]);\n break;\n }\n }\n return multiply(...parts);\n}\n\n/** A point `distance` px from `point` in direction `angle` (screen radians). */\nexport function offset(point: Point, angle: number, distance: number): Point {\n return { x: point.x + distance * Math.cos(angle), y: point.y + distance * Math.sin(angle) };\n}\n","// samplesAlong: data points placed on a mark's walk, as data effects' samples. A page gives a host's\n// line its values this way: the points that drew it, projected onto the walk that describes it.\n// It reads only the MarkGeometry contract (path and length), so it works on any mark.\n\nimport type { Sample } from \"../contracts/data\";\nimport type { MarkGeometry, Point } from \"../contracts/geometry\";\n\n/** A data point in the mark's coordinates, with its value and, optionally, the x value behind it. */\nexport interface SamplePoint {\n readonly x: number;\n readonly y: number;\n readonly value: number;\n readonly at?: string | number | Date;\n}\n\n/** The grid that finds each point's nearest stretch of the walk: a point every px, up to this many. */\nconst MAX_GRID = 4096;\n/**\n * Golden-section steps that narrow a stretch of 2 grid steps down: to about 1e-12 px for a point on\n * the walk, and to well under 1e-6 px for one off it, where the nearest point is a flat minimum.\n */\nconst REFINE = 48;\nconst GOLDEN = (Math.sqrt(5) - 1) / 2;\n\n/**\n * Projects each point onto the nearest point of the mark's walk and returns the samples in `t` order\n * (points at the same `t` keep their order). A point on the walk, such as a vertex of the polyline it\n * drew, lands exactly where it is. Throws a RangeError on a point whose x, y or value isn't finite.\n */\nexport function samplesAlong(mark: MarkGeometry, points: readonly SamplePoint[]): Sample[] {\n if (typeof mark !== \"object\" || mark === null || typeof mark.path !== \"function\" || !Number.isFinite(mark.length)) {\n throw new TypeError(\"samplesAlong needs a MarkGeometry, as describe builds it.\");\n }\n if (!Array.isArray(points)) throw new TypeError(\"samplesAlong needs an array of points { x, y, value, at? }.\");\n points.forEach((p, i) => {\n for (const field of [\"x\", \"y\", \"value\"] as const) {\n const value: unknown = (p as Partial<SamplePoint> | null)?.[field];\n if (typeof value !== \"number\" || !Number.isFinite(value)) throw new RangeError(`samplesAlong: points[${i}].${field} must be a finite number, got ${String(value)}.`);\n }\n });\n\n const n = mark.length > 0 ? Math.min(MAX_GRID, Math.ceil(mark.length) + 1) : 1;\n const grid = Array.from({ length: n }, (_, i): Point => mark.path(n === 1 ? 0 : i / (n - 1)));\n return points\n .map((p, index) => ({ index, sample: { t: nearest(mark, grid, p), value: p.value, ...(p.at === undefined ? {} : { at: p.at }) } }))\n .sort((a, b) => a.sample.t - b.sample.t || a.index - b.index)\n .map(({ sample }) => sample);\n}\n\n/** The t of the walk's nearest point to `p`: the nearest grid point, then a golden-section search on the stretch either side of it. */\nfunction nearest(mark: MarkGeometry, grid: readonly Point[], p: Point): number {\n const n = grid.length;\n if (n === 1) return 0;\n let best = 0;\n let bestDistance = Infinity;\n grid.forEach((q, i) => {\n const d = squared(q, p);\n if (d < bestDistance) {\n best = i;\n bestDistance = d;\n }\n });\n const f = (t: number): number => squared(mark.path(t), p);\n let lo = Math.max(0, best - 1) / (n - 1);\n let hi = Math.min(n - 1, best + 1) / (n - 1);\n let a = hi - GOLDEN * (hi - lo);\n let b = lo + GOLDEN * (hi - lo);\n let fa = f(a);\n let fb = f(b);\n for (let step = 0; step < REFINE; step++) {\n if (fa <= fb) {\n hi = b;\n b = a;\n fb = fa;\n a = hi - GOLDEN * (hi - lo);\n fa = f(a);\n } else {\n lo = a;\n a = b;\n fa = fb;\n b = lo + GOLDEN * (hi - lo);\n fb = f(b);\n }\n }\n const t = (lo + hi) / 2;\n // The grid point itself unless the search found somewhere nearer, so a point at either end lands\n // on exactly 0 or 1, and a stretch that isn't one dip can't make it worse.\n const found = f(t) < bestDistance ? t : best / (n - 1);\n return found > 0 ? (found < 1 ? found : 1) : 0;\n}\n\nfunction squared(a: Point, b: Point): number {\n return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,6 +46,12 @@ interface MarkGeometry {
|
|
|
46
46
|
readonly center: Point;
|
|
47
47
|
/** Where the mark is attached to the chart: a bar's baseline, a donut's centre. */
|
|
48
48
|
readonly pivot: Point;
|
|
49
|
+
/**
|
|
50
|
+
* The boxes of the text the chart draws for this mark, so an effect's text can keep clear of
|
|
51
|
+
* them: a bar's category and value labels, a slice's label outside the ring, a line's end label.
|
|
52
|
+
* Unset when nothing says where they are (segments, points, and marks the library didn't draw).
|
|
53
|
+
*/
|
|
54
|
+
readonly labelBounds?: readonly Rect[];
|
|
49
55
|
/** Ordered parts, from the baseline (goals, then assists). Every bar has at least one. */
|
|
50
56
|
readonly segments?: readonly MarkGeometry[];
|
|
51
57
|
}
|
|
@@ -46,6 +46,12 @@ interface MarkGeometry {
|
|
|
46
46
|
readonly center: Point;
|
|
47
47
|
/** Where the mark is attached to the chart: a bar's baseline, a donut's centre. */
|
|
48
48
|
readonly pivot: Point;
|
|
49
|
+
/**
|
|
50
|
+
* The boxes of the text the chart draws for this mark, so an effect's text can keep clear of
|
|
51
|
+
* them: a bar's category and value labels, a slice's label outside the ring, a line's end label.
|
|
52
|
+
* Unset when nothing says where they are (segments, points, and marks the library didn't draw).
|
|
53
|
+
*/
|
|
54
|
+
readonly labelBounds?: readonly Rect[];
|
|
49
55
|
/** Ordered parts, from the baseline (goals, then assists). Every bar has at least one. */
|
|
50
56
|
readonly segments?: readonly MarkGeometry[];
|
|
51
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MarkGeometry, e as MarkHandle, L as Layer, d as IconSource } from './drawing-
|
|
1
|
+
import { M as MarkGeometry, e as MarkHandle, L as Layer, d as IconSource } from './drawing-DWZIXIeR.js';
|
|
2
2
|
|
|
3
3
|
/** Where frames come from. The default uses requestAnimationFrame, or a 16 ms timer outside the browser. */
|
|
4
4
|
interface FrameSource {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MarkGeometry, e as MarkHandle, L as Layer, d as IconSource } from './drawing-
|
|
1
|
+
import { M as MarkGeometry, e as MarkHandle, L as Layer, d as IconSource } from './drawing-DWZIXIeR.cjs';
|
|
2
2
|
|
|
3
3
|
/** Where frames come from. The default uses requestAnimationFrame, or a 16 ms timer outside the browser. */
|
|
4
4
|
interface FrameSource {
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
:where(.ec-chart .ec-focus) { pointer-events: none; }
|
|
95
95
|
:where(.ec-chart .ec-focus-ring) { fill: none; stroke: var(--ec-focus, #2a78d6); }
|
|
96
96
|
:where(.ec-chart .ec-focus-gap) { fill: var(--ec-surface, #fcfcfb); stroke: var(--ec-surface, #fcfcfb); }
|
|
97
|
-
:where(.ec-chart .ec-
|
|
98
|
-
:where(.ec-chart .ec-segment) { fill: var(--ec-mark); transition: fill var(--ec-hover-duration, 100ms) ease-out; }
|
|
97
|
+
:where(.ec-chart .ec-body > *) { transition: opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
98
|
+
:where(.ec-chart .ec-segment) { fill: var(--ec-mark); transition: fill var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
99
99
|
:where(.ec-chart .ec-hot .ec-segment) { fill: var(--ec-mark-strong); }
|
|
100
|
-
:where(.ec-chart .ec-stroke) { fill: none; stroke: var(--ec-mark); stroke-linejoin: round; transition: stroke var(--ec-hover-duration, 100ms) ease-out; }
|
|
100
|
+
:where(.ec-chart .ec-stroke) { fill: none; stroke: var(--ec-mark); stroke-linejoin: round; transition: stroke var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
101
101
|
:where(.ec-chart .ec-hot .ec-stroke) { stroke: var(--ec-mark-strong); }
|
|
102
102
|
:where(.ec-chart .ec-end) { fill: var(--ec-mark); stroke: var(--ec-surface, #fcfcfb); stroke-width: 2; }
|
|
103
103
|
:where(.ec-chart .ec-dot) { fill: var(--ec-mark); stroke: var(--ec-surface, #fcfcfb); stroke-width: 2; opacity: 0; transition: opacity var(--ec-hover-duration, 100ms) ease-out, fill var(--ec-hover-duration, 100ms) ease-out; }
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
:where(.ec-chart .ec-crosshair) { stroke: var(--ec-axis, #c3c2b7); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
|
|
106
106
|
:where(.ec-chart .ec-column:focus) { outline: none; }
|
|
107
107
|
:where(.ec-chart .ec-lines, .ec-chart .ec-points) { pointer-events: none; }
|
|
108
|
-
:where(.ec-chart .ec-slice) { fill: var(--ec-mark); stroke: var(--ec-surface, #fcfcfb); stroke-width: 2; stroke-linejoin: round; transition: fill var(--ec-hover-duration, 100ms) ease-out; }
|
|
108
|
+
:where(.ec-chart .ec-slice) { fill: var(--ec-mark); stroke: var(--ec-surface, #fcfcfb); stroke-width: 2; stroke-linejoin: round; transition: fill var(--ec-hover-duration, 100ms) ease-out, opacity var(--ec-hover-duration, 100ms) ease-out; }
|
|
109
109
|
:where(.ec-chart .ec-hot .ec-slice) { fill: var(--ec-mark-strong); }
|
|
110
110
|
:where(.ec-chart .ec-center-value) { fill: var(--ec-text, #0b0b0b); font-size: 26px; font-weight: 600; }
|
|
111
111
|
:where(.ec-chart .ec-center-label) { fill: var(--ec-text-muted, #75736d); font-size: 12.5px; }
|
|
112
|
-
:where(.ec-chart.ec-hovering .ec-mark:not(.ec-hot)) { opacity: var(--ec-dim-opacity, 0.3); }
|
|
112
|
+
:where(.ec-chart.ec-hovering .ec-mark:not(.ec-hot) > .ec-body > *) { opacity: var(--ec-dim-opacity, 0.3); }
|
|
113
113
|
:where(.ec-chart.ec-morphing .ec-marks) { visibility: hidden; }
|
|
114
114
|
:where(.ec-switch) { display: grid; grid-template-columns: minmax(0, 1fr); position: relative; }
|
|
115
115
|
:where(.ec-switch-view) { grid-area: 1 / 1; min-width: 0; }
|