expressive-charts 0.12.0 → 0.13.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 +58 -1
- package/README.md +26 -25
- package/dist/{define-DeZLs1h7.js → define-ClDM4DNz.js} +13 -5
- package/dist/define-ClDM4DNz.js.map +1 -0
- package/dist/{drawing-OmQV-0BB.d.ts → drawing-qGmuUkoL.d.ts} +4 -3
- package/dist/{effect-HCWnmB72.d.ts → effect-GgFkjYSV.d.ts} +1 -1
- package/dist/expressive-charts.global.js +10 -10
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/icons/sport.cjs +12 -4
- package/dist/icons/sport.cjs.map +1 -1
- package/dist/icons/sport.d.cts +1 -1
- package/dist/icons/sport.d.ts +1 -1
- package/dist/icons/sport.js +1 -1
- package/dist/{index-CmnxlWkB.d.cts → index-DLdz-1iE.d.cts} +4 -3
- package/dist/index.cjs +182 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +53 -11
- package/dist/index.d.ts +53 -11
- package/dist/index.js +171 -61
- package/dist/index.js.map +1 -1
- package/dist/runner-DZP831pq.d.cts +1 -0
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/{transition-BFd3ktZY.js → transition-BxWp6BVX.js} +2 -2
- package/dist/{transition-BFd3ktZY.js.map → transition-BxWp6BVX.js.map} +1 -1
- package/package.json +3 -3
- package/dist/define-DeZLs1h7.js.map +0 -1
- package/dist/runner-C87v9F_y.d.cts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -25,7 +25,64 @@ 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
|
-
|
|
28
|
+
### What 1.0 will promise
|
|
29
|
+
|
|
30
|
+
From 1.0 the whole package follows semantic versioning, not the effect-author API alone. A breaking change to anything promised below comes only in a major release, with a migration note, and a deprecated name is taken out only in a major release. 0.13.0 is the last 0.x: 1.0 takes out what 0.13.0 deprecates and changes nothing else.
|
|
31
|
+
|
|
32
|
+
**Promised:**
|
|
33
|
+
|
|
34
|
+
- **Every name the package exports,** from its three entries, `expressive-charts`, `expressive-charts/icons/sport` and `expressive-charts/testing`, and the stylesheet's entry, `expressive-charts/style.css`. That's the motion core, the charts, the adapters, the built-in effects, the icons and the controls, as well as the effect-author API. The low-level motion names are among them: `createClock`, `defaultClock`, `scaleDuration`, `defaultScaling`, `mediaReducedMotion` and `interpolateRecord`.
|
|
35
|
+
- **Their types:** what each takes and gives back, and every type the entries export.
|
|
36
|
+
- **What [docs/api.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md) says each does.** An option's default value is part of that where api.md states it: a `dim` that defaults to true, a `table` that's there unless it's turned off.
|
|
37
|
+
- **The `--ec-*` custom properties** in [api.md's table](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#expressive-chartsstylecss): their names, and what each colours.
|
|
38
|
+
|
|
39
|
+
**Not promised,** so any release may change them:
|
|
40
|
+
|
|
41
|
+
- the `ec-*` class names, and the elements a chart, an adapter or a control builds;
|
|
42
|
+
- the exact pixels of anything drawn;
|
|
43
|
+
- default durations and easings, and the numbers in the scaling table;
|
|
44
|
+
- the words of a default name, tooltip or announcement;
|
|
45
|
+
- the files the published package is split into, and their sizes;
|
|
46
|
+
- anything api.md doesn't state.
|
|
47
|
+
|
|
48
|
+
A page that needs one of these to stay as it is sets it itself: a duration or a scaling in its own options, its own words in `markLabel`, `tooltip` or a control's `labels`, and its own CSS on the custom properties, not on a class name.
|
|
49
|
+
|
|
50
|
+
Additions can come in any minor release: a new export, a new optional field or option.
|
|
51
|
+
|
|
52
|
+
## 0.13.0 (18 November 2026)
|
|
53
|
+
|
|
54
|
+
The last 0.x release: the API shaped for 1.0. Two changes can break a page or an effect, and one form is deprecated; they come first below, each with what to write instead. `expressive()`'s `geometry` takes `(datum, element, key)`: swap its first two arguments. `IconShape.linecap` and `Paint.linecap` gain `"square"`, and `IconShape.linejoin` gains `"bevel"`, a breaking change to the effect-author API for code that reads them and handles every case: add a case for each. And `motionSwitch(target, motion, options)` is deprecated: write `motionSwitch(target, { motion, ...options })`. The old form works in 0.13.0 as it did. 1.0 takes it out and changes nothing else; [what 1.0 will promise](#what-10-will-promise) is above. The rest needs nothing written instead: two built-in effects, `outline()` and `wait()`; `labelBounds` on `expressive()` and `fromVegaView()`; a refresh that keeps a hover's effects; `iconFromSvg` keeping square caps and bevel joins; and, in Safari, a chart's text laid out with a viewer's letter and word spacing. The demo site gains a page of examples on the library's own charts: revenue against its target, a measurement against its control, and traffic by source.
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
|
|
58
|
+
- **`expressive()`'s `geometry` takes `(datum, element, key)`.** It took `(element, datum, key)`, and was the adapter's only callback with the element first: `key`, `segment`, `value` and `markLabel` take the row first.
|
|
59
|
+
- **What to write instead:** swap the first two arguments. `geometry: (element, d, key) => …` becomes `geometry: (d, element, key) => …`. A `geometry` that reads only its key needs no change.
|
|
60
|
+
- **In TypeScript** the old order is a type error on that line.
|
|
61
|
+
- **In JavaScript** nothing warns before the page runs. The function is handed the row where it expects the element, so it throws, or returns something that isn't the mark. Either way `expressive()` throws a `TypeError` that says "Since 0.13.0 geometry is called with (datum, element, key), not (element, datum, key)." A function that threw has its own message after that, and its error as the `cause`. The adapter can't tell the old order before the function runs, so the same sentence follows any error a `geometry` throws.
|
|
62
|
+
- `fromVegaView()` has no `geometry`, so nothing changes there. The adapters are outside the 0.x promise.
|
|
63
|
+
- **`IconShape.linecap` and `Paint.linecap` gain `"square"`, and `IconShape.linejoin` gains `"bevel"`.** This is a breaking change to the effect-author API, for code that reads these fields and handles every case: a `Layer` of your own, a renderer, a `switch` over `linecap`. Code that only writes them is untouched: the defaults are still butt and miter, and every icon and path drawn before draws byte for byte as it did.
|
|
64
|
+
- **What to write instead:** add a case for each new value where your code reads them. On a canvas, `lineCap = "square"` and `lineJoin = "bevel"`; in SVG, `stroke-linecap="square"` and `stroke-linejoin="bevel"`. Where a `switch` ends in a `never` check, TypeScript reports the missing case; where it has a default, the new values fall to it.
|
|
65
|
+
- `Paint` gains no `linejoin`: an overlay path's joins stay round. `defineIcon` takes the new values, and still throws a `RangeError` for any other.
|
|
66
|
+
- **An attachment's `refresh()` keeps a hover's effects.** A hovered or focused mark whose values the refresh leaves alone keeps its hover effects as they are, following its new geometry: after a resize, an icon that travelled its mark stays at its end, where it used to travel again, and one part way goes on from there. A mark whose values changed still plays its hover again, once its update's effects have started. This is `expressive()`'s and `fromVegaView()`'s `refresh()`, and `fromVegaView()`'s own after a Vega render; the charts are untouched. There's nothing to write instead. The adapters are outside the 0.x promise.
|
|
67
|
+
|
|
68
|
+
### Deprecated
|
|
69
|
+
|
|
70
|
+
- **`motionSwitch(target, motion, options?)`,** the form with the motion as its second argument. It works in 0.13.0 as it did and builds the same control. It's marked `@deprecated` in the types, and nothing is logged when it runs. 1.0 takes it out.
|
|
71
|
+
- **What to write instead:** `motionSwitch(target, { motion, ...options })`, or `motionSwitch(target, options)` where the motion was `undefined`.
|
|
72
|
+
- The two forms are told apart by the second argument: a `Motion` (it has `chooseMode`), or anything with a third argument after it, is the old form. One call changes: `motionSwitch(target, {})` threw a `TypeError`, since `{}` isn't a `Motion`, and is now a switch with no options.
|
|
73
|
+
- The controls are outside the 0.x promise; the deprecation follows its rule all the same.
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
- **`motionSwitch(target, options?)`, with `motion` among its options.** [`MotionSwitchOptions`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#motionswitchoptions) gains `motion`, the motion the switch shows and sets, default the page-wide one. So a page that wants `persist` alone writes `motionSwitch("#motion", { persist: "site:motion" })`, with no `undefined` to step over. `motionSwitch(target)` is as it was.
|
|
78
|
+
- **`outline()`, with `OutlineOptions`:** a built-in effect that strokes a mark's outline in the overlay, at once, in the text colour at 2 px, or in its `color` at its `width`. It's for a hover on a closed shape, a map's region or a treemap's tile, where `travel` and `trace` have no direction to follow. There's no tween, so every motion mode shows the same picture, and the stroke goes on leave. Not a preset.
|
|
79
|
+
- **`wait(ms)`:** a built-in effect that draws nothing for a base duration, so the next part of a sequence starts later: `sequence(wait(750), flash())`. Its time is scaled by the motion mode as `drawIn`'s is, and with Off or reduced motion it takes none. Not a preset.
|
|
80
|
+
- **`labelBounds` on `expressive()` and `fromVegaView()`:** `(datum, element) => Rect[]`, the boxes of the host's own text for a mark, in the marks' px. They become the mark's `labelBounds`, so `label` and `delta` keep clear of the host's text, with no need to describe the whole mark with `geometry`. A stack's boxes are given once, and a mark described with `geometry` says its own.
|
|
81
|
+
|
|
82
|
+
### Fixed
|
|
83
|
+
|
|
84
|
+
- **`iconFromSvg` keeps square caps and bevel joins.** It dropped `stroke-linecap="square"` and `stroke-linejoin="bevel"`, so an icon from a set that draws with them had butt caps and miter joins. Now it keeps them, from an attribute or `style`, inherited from groups as SVG inherits them, and the SVG layer draws them. An icon that has neither reads as it did, and the core icons and the sport pack are unchanged. SVG's `arcs` and `miter-clip` joins still aren't kept.
|
|
85
|
+
- **In Safari, a chart lays its text out with a viewer's letter and word spacing.** WebKit's `getComputedTextLength()`, which the charts and the adapters measure text with, leaves letter and word spacing out, so with WCAG 1.4.12's spacing a chart's margins, its thinned names and its effects' text were placed for narrower text than was drawn. Now the measure finds out, once a document and by measuring, whether the browser's length leaves spacing out, and where it does, adds the text's computed `letter-spacing` between its characters and its `word-spacing` a space. In Chrome, Edge and Firefox, whose lengths count spacing already, nothing changes.
|
|
29
86
|
|
|
30
87
|
## 0.12.0 (16 November 2026)
|
|
31
88
|
|
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@ 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.13.0 (November 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#0130-18-november-2026) lists what's new and what changed since 0.12.0.
|
|
19
19
|
|
|
20
|
-
- **Effects first.** The mark effects `travel`, `flash`, `wiggle`, `pulse`, `trace`, `drawIn` and the data effects `threshold`, `delta` and `label`, put together with `sequence`, `parallel`, `only` and `stagger
|
|
20
|
+
- **Effects first.** The mark effects `travel`, `flash`, `wiggle`, `pulse`, `trace`, `drawIn`, `outline` and the data effects `threshold`, `delta` and `label`, put together with `sequence`, `parallel`, `only` and `stagger`, with `wait` to hold a part back; 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
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.
|
|
@@ -28,20 +28,20 @@ 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 32 KB gzipped, and everything
|
|
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 32 KB gzipped, and everything 93 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
|
-
<div id="
|
|
37
|
-
<script src="https://cdn.jsdelivr.net/npm/expressive-charts@0.
|
|
36
|
+
<div id="traffic"></div>
|
|
37
|
+
<script src="https://cdn.jsdelivr.net/npm/expressive-charts@0.13/dist/expressive-charts.global.js"></script>
|
|
38
38
|
<script>
|
|
39
39
|
const { barChart } = ExpressiveCharts;
|
|
40
|
-
barChart("#
|
|
41
|
-
label: "
|
|
42
|
-
data: [{
|
|
43
|
-
y: "
|
|
44
|
-
x: "
|
|
40
|
+
barChart("#traffic", {
|
|
41
|
+
label: "Sessions by source",
|
|
42
|
+
data: [{ source: "Search", sessions: 18400 }, { source: "Direct", sessions: 9200 }],
|
|
43
|
+
y: "source",
|
|
44
|
+
x: "sessions",
|
|
45
45
|
on: { hover: "wiggle" }
|
|
46
46
|
});
|
|
47
47
|
</script>
|
|
@@ -83,23 +83,22 @@ barChart("#goals", {
|
|
|
83
83
|
});
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
The same story on bars you already draw with D3:
|
|
86
|
+
The same kind of story on bars you already draw with D3, here a lab's water samples, passed and failed, by site, with core icons:
|
|
87
87
|
|
|
88
88
|
```js
|
|
89
|
-
import { expressive, sequence, travel } from "expressive-charts";
|
|
90
|
-
import { cleat, soccerBall } from "expressive-charts/icons/sport";
|
|
89
|
+
import { expressive, icons, sequence, travel } from "expressive-charts";
|
|
91
90
|
|
|
92
|
-
//
|
|
91
|
+
// rects: your D3 selection of the stacked <rect>s. d3.stack() keeps a series' key on its <g>, so copy it onto each point:
|
|
93
92
|
// .data((series) => series.map((d) => Object.assign(d, { key: series.key }))).
|
|
94
|
-
const fx = expressive(
|
|
95
|
-
key: (d) => d.data.
|
|
93
|
+
const fx = expressive(rects, {
|
|
94
|
+
key: (d) => d.data.site, // a site's rects are one bar...
|
|
96
95
|
segment: (d) => d.key, // ...and its series are the bar's segments
|
|
97
96
|
value: (d) => d[1] - d[0], // what each rect shows, so a resize isn't an update
|
|
98
97
|
keyboard: true, // one tab stop; the arrow keys move between bars
|
|
99
|
-
markLabel: (d) => `${d.data.
|
|
100
|
-
on: { hover: sequence(travel(
|
|
98
|
+
markLabel: (d) => `${d.data.site}: ${d.data.passed} samples passed, ${d.data.failed} failed`,
|
|
99
|
+
on: { hover: sequence(travel(icons.arrow, { along: "passed" }), travel(icons.chevron, { along: "failed" })) }
|
|
101
100
|
});
|
|
102
|
-
fx.refresh(
|
|
101
|
+
fx.refresh(rects); // after your chart redraws
|
|
103
102
|
```
|
|
104
103
|
|
|
105
104
|
A line that turns red where goals fall below expected goals, with a ball riding its tip, and a season played with a pause control:
|
|
@@ -128,7 +127,7 @@ playButton("#play", season, { labels: { play: "Play season" } });
|
|
|
128
127
|
- **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, a line chart's points growing into columns keyed as they are, or one line chart's lines becoming another's, and back from wherever it is. Each mark keeps its view's colour, a line its end dot and a point its ring, and focus follows the x, or the tab stop does when focus is on a toggle. In Presentation, `show(view, { via })` stages a jump through a third view, as side-by-side columns stack before they become shares, and announces only where it lands. Its `on()`, `marks()` and `leave()` are the view on show's, and it can be linked like a chart. [`hostView()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#hostview) makes an attachment a view, so a D3 pie morphs into D3 columns, or into ours: the host's marks morph in its own colours, the labels the page names move and swap, the guides it names (an axis, a grid, a tick) stay where they are when the next view draws them the same, its other parts fade, and with `keyboard: true` focus follows by key. `hostView([a, b, c])` makes one view of several attachments on one `<svg>`, keyed apart, so a dumbbell drawn as each half's dots and the lines between them switches as one chart, and their link goes on.
|
|
129
128
|
- **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, with only a key: rects as bars, circles as points, a pie's or a donut's paths as slices, clockwise from 12 o'clock, and other paths, lines, polylines, polygons, ellipses and turned rects as shapes, through their transforms, a non-scaling stroke at its width on screen. It draws on an overlay, leaving the host's styling alone; `watch: true` follows the host's own transitions. A curve, or a line drawn with d3's `.defined()`, is read from its own path data, with its gaps, and no effect draws inside them; `geometry` describes anything else, or a mark as you'd rather have it. Observable Plot binds each rect or dot 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 marks. The Plot accessors are tested against Plot 0.6.19. [`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; a line breaks where Vega-Lite leaves out a missing value, and a curve is read from the path Vega draws. Both change their effects in place with `update({ on })`, as a chart does, and `leave()` ends their hover.
|
|
130
129
|
- **Linked hover.** [`link()`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#link) links hover across charts, chart switches 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. A line chart's x with every value missing links by its x, and a link's hover there shows the line's crosshair.
|
|
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; [`drawIn`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#drawin) draws a mark in along its walk as it enters, a stack part by part in its colours; [`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 and clear of other effects' text. Each goes in an effect slot (`hover`, `enter`, `update`, `exit`, `decorate`), as an effect or a preset's name (`"wiggle"`).
|
|
130
|
+
- **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; [`drawIn`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#drawin) draws a mark in along its walk as it enters, a stack part by part in its colours; [`outline`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#outline) strokes a mark's outline at once, for a hover on a closed shape such as a map's region; [`wait`](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md#wait) draws nothing for a while, so the next part of a sequence starts later; [`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 and clear of other effects' text. Each goes in an effect slot (`hover`, `enter`, `update`, `exit`, `decorate`), as an effect or a preset's name (`"wiggle"`).
|
|
132
131
|
- **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.
|
|
133
132
|
- **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.
|
|
134
133
|
|
|
@@ -192,7 +191,7 @@ The package lists its CSS under `sideEffects`, so bundlers keep that import. Cha
|
|
|
192
191
|
|
|
193
192
|
## Accessibility
|
|
194
193
|
|
|
195
|
-
- **Names.** Each chart is a `role="group"` named by its `label`, and each mark one image named by what it shows: "Okafor: 16 goals, 4 assists", or a slice's "
|
|
194
|
+
- **Names.** Each chart is a `role="group"` named by its `label`, and each mark one image named by what it shows: "Okafor: 16 goals, 4 assists", or a slice's "Search: 18,400 sessions, 45%". `markLabel` words the names ("1 goal") and `markDescription` adds what they don't say.
|
|
196
195
|
- **Keyboard.** A chart is one tab stop: the arrow keys move between its marks, Page Up and Page Down by a page (a month on a line's time axis), Home and End go to the ends, and focus shows a ring and plays the same effects as hover. Escape ends a hover, and so does `leave()`.
|
|
197
196
|
- **Fallbacks.** A data table after every chart, which every screen reader can read, and with `announce: true` a polite live region that says what each update changed.
|
|
198
197
|
- **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).
|
|
@@ -217,17 +216,19 @@ The first draw of 1,000 static bars takes about 90 ms, and of 10,000 about a sec
|
|
|
217
216
|
|
|
218
217
|
## The 0.x promise
|
|
219
218
|
|
|
220
|
-
From 0.1.0 the library follows semantic versioning. While it's 0.x, the effect-author API (`defineEffect`, `defineDataEffect`, `describe`, `matrix`, `offset`, the effect contracts and `expressive-charts/testing`) breaks only in a minor release, with a migration note, and a deprecated name keeps working for one minor release. The charts, adapters, built-in effects, controls and motion core can still change in a minor release, and [CHANGELOG.md](https://github.com/Deaversbp/expressive-charts/blob/main/CHANGELOG.md#the-0x-promise) lists every change. [docs/api.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md) marks each promised name.
|
|
219
|
+
From 0.1.0 the library follows semantic versioning. While it's 0.x, the effect-author API (`defineEffect`, `defineDataEffect`, `describe`, `matrix`, `offset`, the effect contracts and `expressive-charts/testing`) breaks only in a minor release, with a migration note, and a deprecated name keeps working for one minor release. The charts, adapters, built-in effects, controls and motion core can still change in a minor release, and [CHANGELOG.md](https://github.com/Deaversbp/expressive-charts/blob/main/CHANGELOG.md#the-0x-promise) lists every change. [docs/api.md](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md) marks each promised name.
|
|
220
|
+
|
|
221
|
+
From 1.0 the whole package will follow semantic versioning: every name it exports, their types, what docs/api.md says each does, and the `--ec-*` custom properties. It won't promise the `ec-*` class names, the elements a chart builds, exact pixels, default durations or the words of a default announcement. [What 1.0 will promise](https://github.com/Deaversbp/expressive-charts/blob/main/CHANGELOG.md#what-10-will-promise) has the list.
|
|
221
222
|
|
|
222
223
|
## Links
|
|
223
224
|
|
|
224
225
|
- [API reference](https://github.com/Deaversbp/expressive-charts/blob/main/docs/api.md): every export of every entry.
|
|
225
226
|
- [Architecture](https://github.com/Deaversbp/expressive-charts/blob/main/docs/architecture.md): how the layers fit together, and how each part behaves.
|
|
226
227
|
- [Writing effects](https://github.com/Deaversbp/expressive-charts/blob/main/docs/effects-guide.md): the guide for effect authors.
|
|
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
|
|
228
|
+
- [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 stacked bars of water samples, a D3 pie of sessions and a D3 line of seedling heights, effects of your own and presets.
|
|
228
229
|
- [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.
|
|
229
230
|
- [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).
|
|
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()`; `shapes.html` and `charts.html` attach the effects to circles, curves and areas, and to a waterfall, a dumbbell, a radar, a butterfly, a bullet chart and a funnel, drawn with D3 and Observable Plot; `layouts.html` switches D3 charts between layouts with `hostView()` and `morph()`: bars side by side, stacked and at 100%, areas stacked and at 100%, a radar into bars, a treemap into bars, which also drills into a position (the other positions' tiles fade, then its own grow to fill the chart), and the charts page's dumbbell, three attachments as one view, into bars, with the axes both layouts draw the same kept on screen; `map.html` draws a world map with `d3-geo`, the countries a squad comes from shaded, the one hovered outlined and the rest dimmed, and an arrow travelling each signing's route; `stress.html` is the limits above; and `lab.html` is the single-file prototype the library grew out of.
|
|
231
|
+
- [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()`; `shapes.html` and `charts.html` attach the effects to circles, curves and areas, and to a waterfall, a dumbbell, a radar, a butterfly, a bullet chart and a funnel, drawn with D3 and Observable Plot; `layouts.html` switches D3 charts between layouts with `hostView()` and `morph()`: bars side by side, stacked and at 100%, areas stacked and at 100%, a radar into bars, a treemap into bars, which also drills into a position (the other positions' tiles fade, then its own grow to fill the chart), and the charts page's dumbbell, three attachments as one view, into bars, with the axes both layouts draw the same kept on screen; `map.html` draws a world map with `d3-geo`, the countries a squad comes from shaded, the one hovered outlined and the rest dimmed, and an arrow travelling each signing's route; `examples.html` has the library's own charts on business, research and web data: revenue by region against its target, seedling height under drought against a control, and sessions by source on a donut that switches to bars; `stress.html` is the limits above; and `lab.html` is the single-file prototype the library grew out of.
|
|
231
232
|
- [Contributing](https://github.com/Deaversbp/expressive-charts/blob/main/CONTRIBUTING.md) and [issues](https://github.com/Deaversbp/expressive-charts/issues).
|
|
232
233
|
|
|
233
234
|
## Development
|
|
@@ -239,7 +240,7 @@ From 0.1.0 the library follows semantic versioning. While it's 0.x, the effect-a
|
|
|
239
240
|
| `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)) |
|
|
240
241
|
| `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)) |
|
|
241
242
|
| `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 |
|
|
242
|
-
| `npm run test:visual:docker` | Runs the screenshot tests of `demo/bars.html`, `donut.html`, `line.html`, `morph.html`, `season.html`, `shapes.html`, `charts.html`, `layouts.html`, `map.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)) |
|
|
243
|
+
| `npm run test:visual:docker` | Runs the screenshot tests of `demo/bars.html`, `donut.html`, `line.html`, `morph.html`, `season.html`, `shapes.html`, `charts.html`, `layouts.html`, `map.html`, `examples.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)) |
|
|
243
244
|
| `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/) |
|
|
244
245
|
| `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)) |
|
|
245
246
|
| `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 |
|
|
@@ -4,8 +4,16 @@ const GAITS = [
|
|
|
4
4
|
"step",
|
|
5
5
|
"slide"
|
|
6
6
|
];
|
|
7
|
-
const LINECAPS = [
|
|
8
|
-
|
|
7
|
+
const LINECAPS = [
|
|
8
|
+
"butt",
|
|
9
|
+
"round",
|
|
10
|
+
"square"
|
|
11
|
+
];
|
|
12
|
+
const LINEJOINS = [
|
|
13
|
+
"miter",
|
|
14
|
+
"round",
|
|
15
|
+
"bevel"
|
|
16
|
+
];
|
|
9
17
|
const FILL_RULES = ["nonzero", "evenodd"];
|
|
10
18
|
const PATH_DATA = /^\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\-\s]*$/;
|
|
11
19
|
function defineIcon(spec) {
|
|
@@ -63,8 +71,8 @@ function checkShape(shape, field, fail, finite) {
|
|
|
63
71
|
if (value !== void 0 && (typeof value !== "string" || value === "")) fail(`${field}.${paint}`, `must be a colour, got ${String(value)}`);
|
|
64
72
|
}
|
|
65
73
|
if (shape.width !== void 0 && finite(`${field}.width`, shape.width) < 0) fail(`${field}.width`, `can't be negative, got ${shape.width}`);
|
|
66
|
-
if (shape.linecap !== void 0 && !LINECAPS.includes(shape.linecap)) fail(`${field}.linecap`, `must be butt or
|
|
67
|
-
if (shape.linejoin !== void 0 && !LINEJOINS.includes(shape.linejoin)) fail(`${field}.linejoin`, `must be miter or
|
|
74
|
+
if (shape.linecap !== void 0 && !LINECAPS.includes(shape.linecap)) fail(`${field}.linecap`, `must be butt, round or square, got ${String(shape.linecap)}`);
|
|
75
|
+
if (shape.linejoin !== void 0 && !LINEJOINS.includes(shape.linejoin)) fail(`${field}.linejoin`, `must be miter, round or bevel, got ${String(shape.linejoin)}`);
|
|
68
76
|
if (shape.fillRule !== void 0 && !FILL_RULES.includes(shape.fillRule)) fail(`${field}.fillRule`, `must be nonzero or evenodd, got ${String(shape.fillRule)}`);
|
|
69
77
|
for (const key of [
|
|
70
78
|
"opacity",
|
|
@@ -92,4 +100,4 @@ function checkShape(shape, field, fail, finite) {
|
|
|
92
100
|
const freeze = (value) => Object.freeze(value);
|
|
93
101
|
export { defineIcon as t };
|
|
94
102
|
|
|
95
|
-
//# sourceMappingURL=define-
|
|
103
|
+
//# sourceMappingURL=define-ClDM4DNz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-ClDM4DNz.js","names":[],"sources":["../src/icons/define.ts"],"sourcesContent":["// defineIcon: fills an icon's defaults and checks every field, so effects can rely on all of them.\n\nimport type { Icon, IconShape, Point, Rect } from \"../core\";\n\n/** What defineIcon takes: an Icon whose pivot, footprint and size are optional. */\nexport type IconSpec = Omit<Icon, \"footprint\" | \"pivot\" | \"size\"> & Partial<Pick<Icon, \"footprint\" | \"pivot\" | \"size\">>;\n\nconst GAITS: readonly string[] = [\"roll\", \"step\", \"slide\"];\nconst LINECAPS: readonly string[] = [\"butt\", \"round\", \"square\"];\nconst LINEJOINS: readonly string[] = [\"miter\", \"round\", \"bevel\"];\nconst FILL_RULES: readonly string[] = [\"nonzero\", \"evenodd\"];\n/** Path data: commands, numbers, separators. Anything else (markup, url(), quotes) is a mistake. */\nconst PATH_DATA = /^\\s*[Mm][MmLlHhVvCcSsQqTtAaZz0-9eE.,+\\-\\s]*$/;\n\n/**\n * Makes an icon from its parts. Shapes are drawn facing +x, up towards −y, in px at the icon's\n * natural size. Defaults: `pivot` is the anchor, `footprint` reaches from the anchor to the box's\n * edges, `size` is the box's width and `radius` half its height. Bad input throws a RangeError\n * naming the field. The icon and its parts are frozen, since one icon is shared by every run.\n */\nexport function defineIcon(spec: IconSpec): Icon {\n const name = spec?.name;\n if (typeof name !== \"string\" || name === \"\") throw new TypeError(`defineIcon needs a non-empty string name, got ${JSON.stringify(name)}.`);\n const fail = (field: string, problem: string): never => {\n throw new RangeError(`defineIcon: \"${name}\" ${field} ${problem}.`);\n };\n const finite = (field: string, value: unknown): number =>\n typeof value === \"number\" && Number.isFinite(value) ? value : fail(field, `must be a finite number, got ${String(value)}`);\n const positive = (field: string, value: unknown): number => (finite(field, value) > 0 ? (value as number) : fail(field, `must be more than 0, got ${String(value)}`));\n const point = (field: string, value: Point | undefined): Point =>\n value && typeof value === \"object\" ? freeze({ x: finite(`${field}.x`, value.x), y: finite(`${field}.y`, value.y) }) : fail(field, \"must be a point { x, y }\");\n\n if (!Array.isArray(spec.shapes) || spec.shapes.length === 0) fail(\"shapes\", \"must be a non-empty array\");\n const shapes = spec.shapes.map((shape, i) => checkShape(shape, `shapes[${i}]`, fail, finite));\n\n const b = spec.box;\n if (!b || typeof b !== \"object\") fail(\"box\", \"must be a rectangle { x, y, width, height }\");\n const box: Rect = freeze({ x: finite(\"box.x\", b.x), y: finite(\"box.y\", b.y), width: positive(\"box.width\", b.width), height: positive(\"box.height\", b.height) });\n\n const anchor = point(\"anchor\", spec.anchor);\n const pivot = spec.pivot === undefined ? anchor : point(\"pivot\", spec.pivot);\n const footprint = spec.footprint ?? [Math.max(0, anchor.x - box.x), Math.max(0, box.x + box.width - anchor.x)];\n if (!Array.isArray(footprint) || footprint.length !== 2) fail(\"footprint\", \"must be [behind, ahead]\");\n footprint.forEach((reach, i) => {\n if (finite(`footprint[${i}]`, reach) < 0) fail(`footprint[${i}]`, `can't be negative, got ${reach}`);\n });\n const size = spec.size === undefined ? box.width : positive(\"size\", spec.size);\n const radius = spec.radius === undefined ? box.height / 2 : positive(\"radius\", spec.radius);\n if (spec.gait !== undefined && !GAITS.includes(spec.gait)) fail(\"gait\", `must be roll, step or slide, got ${String(spec.gait)}`);\n if (spec.upright !== undefined && typeof spec.upright !== \"boolean\") fail(\"upright\", `must be true or false, got ${String(spec.upright)}`);\n\n return freeze({\n name,\n shapes: freeze(shapes),\n box,\n size,\n anchor,\n pivot,\n footprint: freeze([footprint[0], footprint[1]] as const),\n ...(spec.gait !== undefined ? { gait: spec.gait } : {}),\n radius,\n ...(spec.upright !== undefined ? { upright: spec.upright } : {})\n });\n}\n\nfunction checkShape(\n shape: IconShape,\n field: string,\n fail: (field: string, problem: string) => never,\n finite: (field: string, value: unknown) => number\n): IconShape {\n if (!shape || typeof shape !== \"object\") fail(field, \"must be a shape { d, fill?, stroke?, … }\");\n if (typeof shape.d !== \"string\" || !PATH_DATA.test(shape.d)) fail(`${field}.d`, \"must be path data starting with a move\");\n if (shape.clip !== undefined && (typeof shape.clip !== \"string\" || !PATH_DATA.test(shape.clip))) fail(`${field}.clip`, \"must be path data starting with a move\");\n for (const paint of [\"fill\", \"stroke\"] as const) {\n const value = shape[paint];\n if (value !== undefined && (typeof value !== \"string\" || value === \"\")) fail(`${field}.${paint}`, `must be a colour, got ${String(value)}`);\n }\n if (shape.width !== undefined && finite(`${field}.width`, shape.width) < 0) fail(`${field}.width`, `can't be negative, got ${shape.width}`);\n if (shape.linecap !== undefined && !LINECAPS.includes(shape.linecap)) fail(`${field}.linecap`, `must be butt, round or square, got ${String(shape.linecap)}`);\n if (shape.linejoin !== undefined && !LINEJOINS.includes(shape.linejoin)) fail(`${field}.linejoin`, `must be miter, round or bevel, got ${String(shape.linejoin)}`);\n if (shape.fillRule !== undefined && !FILL_RULES.includes(shape.fillRule)) fail(`${field}.fillRule`, `must be nonzero or evenodd, got ${String(shape.fillRule)}`);\n for (const key of [\"opacity\", \"fillOpacity\", \"strokeOpacity\"] as const) {\n const opacity = shape[key] === undefined ? 1 : finite(`${field}.${key}`, shape[key]);\n if (opacity < 0 || opacity > 1) fail(`${field}.${key}`, `must be from 0 to 1, got ${opacity}`);\n }\n const copy: { -readonly [K in keyof IconShape]: IconShape[K] } = { d: shape.d };\n for (const key of [\"fill\", \"stroke\", \"width\", \"linecap\", \"linejoin\", \"clip\", \"fillRule\", \"opacity\", \"fillOpacity\", \"strokeOpacity\"] as const) {\n if (shape[key] !== undefined) (copy as Record<string, unknown>)[key] = shape[key];\n }\n return freeze(copy);\n}\n\nconst freeze = <T>(value: T): T => Object.freeze(value);\n"],"mappings":";AAOA,MAAM,QAA2B;CAAC;CAAQ;CAAQ;AAAO;AACzD,MAAM,WAA8B;CAAC;CAAQ;CAAS;AAAQ;AAC9D,MAAM,YAA+B;CAAC;CAAS;CAAS;AAAO;AAC/D,MAAM,aAAgC,CAAC,WAAW,SAAS;AAE3D,MAAM,YAAY;AAQlB,SAAgB,WAAW,MAAsB;CAC/C,MAAM,OAAO,MAAM;CACnB,IAAI,OAAO,SAAS,YAAY,SAAS,IAAI,MAAM,IAAI,UAAU,iDAAiD,KAAK,UAAU,IAAI,EAAE,EAAE;CACzI,MAAM,QAAQ,OAAe,YAA2B;EACtD,MAAM,IAAI,WAAW,gBAAgB,KAAK,IAAI,MAAM,GAAG,QAAQ,EA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|
|
81
81
|
readonly width?: number;
|
|
82
82
|
/** Default "butt". */
|
|
83
|
-
readonly linecap?: "butt" | "round";
|
|
83
|
+
readonly linecap?: "butt" | "round" | "square";
|
|
84
84
|
/** Default "miter". */
|
|
85
|
-
readonly linejoin?: "miter" | "round";
|
|
85
|
+
readonly linejoin?: "miter" | "round" | "bevel";
|
|
86
86
|
/** Path data, in icon units, that clips this shape (the ball's panel pattern). */
|
|
87
87
|
readonly clip?: string;
|
|
88
88
|
/** Default "nonzero". "evenodd" leaves a hole where the path's parts overlap, as solid icon sets draw them. */
|
|
@@ -141,7 +141,8 @@ interface Paint {
|
|
|
141
141
|
readonly stroke?: Color;
|
|
142
142
|
readonly width?: number;
|
|
143
143
|
readonly opacity?: number;
|
|
144
|
-
|
|
144
|
+
/** Default "butt". A path's joins are always round. */
|
|
145
|
+
readonly linecap?: "butt" | "round" | "square";
|
|
145
146
|
/**
|
|
146
147
|
* The key of one of the mark's segments (`segment.key`). In this paint, "mark" and "mark-strong"
|
|
147
148
|
* are that segment's colours. Unset, or a key the mark hasn't, they're the mark's own, as without it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as Rect, i as MarkHandle, m as MarkGeometry, p as IconSource, r as Layer, u as TextStyle } from "./drawing-
|
|
1
|
+
import { _ as Rect, i as MarkHandle, m as MarkGeometry, p as IconSource, r as Layer, u as TextStyle } from "./drawing-qGmuUkoL.js";
|
|
2
2
|
/** Where frames come from. The default uses requestAnimationFrame, or a 16 ms timer outside the browser. */
|
|
3
3
|
interface FrameSource {
|
|
4
4
|
now(): number;
|