expressive-charts 0.9.0 → 0.11.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/dist/index.d.cts CHANGED
@@ -1,285 +1,5 @@
1
- import { A as scaleDuration, B as manualClock, C as ScalingRule, D as defaultScaling, E as createMotion, F as Clock, I as FrameSource, L as ManualClock, M as easeInOutCubic, N as easeOutCubic, O as mediaReducedMotion, P as linear, R as createClock, S as ScalingOverrides, T as Timing, _ as Motion, a as GeometryEffect, b as MotionView, c as TransitionContext, d as Sample, f as MotionEnv, g as tween, h as TweenResult, i as EffectContext, j as Easing, k as motion, l as TransitionEffect, m as TweenOptions, n as Combined, o as MarkEffect, p as Tween, r as DataEffect, s as TextSpace, t as AnyMarkEffect, u as MarkData, v as MotionMode, w as ScalingTable, x as ReducedMotionSource, y as MotionOptions, z as defaultClock } from "./effect-DYCLY_6e.cjs";
2
- import { _ as Rect, a as MarkStyle, c as PathHandle, d as Icon, f as IconShape, g as Point, h as Outline, i as MarkHandle, l as TextHandle, m as MarkGeometry, n as IconHandle, o as Matrix, p as IconSource, r as Layer, s as Paint, t as Color, u as TextStyle } from "./drawing-OmQV-0BB.cjs";
3
- /** Builds a function that blends `from` into `to` as t goes from 0 to 1. */
4
- type Interpolator<T> = (from: T, to: T) => (t: number) => T;
5
- /** Exact at both ends, so a finished animation lands on its target. */
6
- export declare const interpolateNumber: Interpolator<number>;
7
- export declare const interpolatePoint: Interpolator<Point>;
8
- /**
9
- * Blends every key. A key missing on one side counts as 0 there, so a series
10
- * that appears grows from 0, and one that disappears shrinks to 0 and is gone at t = 1.
11
- */
12
- export declare function interpolateRecord<K extends string>(a: Readonly<Record<K, number>>, b: Readonly<Record<K, number>>): (t: number) => Record<K, number>;
13
- interface AnimateOptions {
14
- /** Base duration in ms, scaled by the motion mode. */
15
- readonly duration: number;
16
- /** Default "transition". */
17
- readonly timing?: Timing;
18
- /** Default easeInOutCubic, or easeOutCubic when this interrupts a moving value and starts at once (no delay). */
19
- readonly ease?: Easing;
20
- readonly delay?: number;
21
- readonly signal?: AbortSignal;
22
- }
23
- interface AnimatedOptions<T> extends Partial<MotionEnv> {
24
- /** Called whenever the value changes, including every animation frame. */
25
- readonly onChange?: (value: T) => void;
26
- }
27
- /** A value that can be retargeted mid-flight. */
28
- interface Animated<T> {
29
- /** The current value, in between while animating. */
30
- readonly value: T;
31
- /** Where the value is heading (equal to `value` when at rest). */
32
- readonly target: T;
33
- readonly animating: boolean;
34
- /** Animate from the current value, cancelling any animation already running. */
35
- to(target: T, options: AnimateOptions): Promise<TweenResult>;
36
- /** Jump to a value, cancelling any running animation. */
37
- set(value: T): void;
38
- /** Stop where it is; the current value becomes the target. */
39
- stop(): void;
40
- }
41
- export declare function animated<T>(initial: T, interpolate: Interpolator<T>, options?: AnimatedOptions<T>): Animated<T>;
42
- interface PlaybackOptions extends Partial<MotionEnv> {
43
- /** Where a play starts again once it's at the end. */
44
- readonly from: number;
45
- /** Where a play ends. The playback starts here, at rest, as a chart shows all its data until something reveals less. */
46
- readonly to: number;
47
- /** Base ms for a play from `from` to `to`, scaled by `timing`. A play from part way takes its share, so the speed stays the same. */
48
- readonly duration: number;
49
- /** How a play moves. Default linear: constant speed. Seeks ease on their own. */
50
- readonly ease?: Easing;
51
- /** Default "playback": ×1 in Presentation, ×0.3 in Analysis, a jump in Off. */
52
- readonly timing?: Timing;
53
- /** Draws a position. Called whenever the position changes: every frame of a play or a seek, and every jump. */
54
- readonly onFrame: (position: number) => void;
55
- }
56
- /** What `subscribe` hears. Frames go to `onFrame` instead. */
57
- type PlaybackEvent = "play" | "pause" | "end" | "seek";
58
- interface SeekOptions {
59
- /** Default true: move over 350 ms base transition timing (at most 200 ms in Analysis, a jump in Off). false jumps. */
60
- readonly animate?: boolean;
61
- }
62
- interface Playback {
63
- /** Plays on from where it is to `to`, or from `from` when it's at the end. Does nothing while playing. */
64
- play(): void;
65
- /** Stops a play where it is. Does nothing unless it's playing, so a seek on its way still lands. */
66
- pause(): void;
67
- /** Pauses, and moves to `x`, clamped to the range. A seek while it's moving starts from where it is. */
68
- seek(x: number, options?: SeekOptions): void;
69
- /** Where it is now, in between while it moves. */
70
- readonly position: number;
71
- /** True from `play()` until a pause, a seek or the end. */
72
- readonly playing: boolean;
73
- /** Hears play, pause, the end and seeks, not every frame. Returns a function that stops listening. */
74
- subscribe(listener: (event: PlaybackEvent) => void): () => void;
75
- /** Pauses it, if it's playing, and stops it for good: later calls do nothing. */
76
- destroy(): void;
77
- }
78
- /**
79
- * A playback through `from`…`to`. `play()` moves the position at constant speed (with the default
80
- * `linear`), over `duration` scaled by the motion mode, and `onFrame` draws each position. With motion
81
- * off, a play jumps to the end, and motion turning off mid-play jumps there too, as tweens do. Nothing
82
- * plays by itself. Uses the page-wide motion and clock unless given its own.
83
- */
84
- export declare function playback(options: PlaybackOptions): Playback;
85
- /** The events effects attach to. */
86
- type EffectSlot = "hover" | "enter" | "update" | "exit" | "decorate";
87
- /**
88
- * A registered preset's name. The built-in names autocomplete; custom names (registerPreset) are
89
- * allowed too, so a misspelled name isn't a type error: the chart throws when it's created.
90
- */
91
- type PresetName = "wiggle" | "pulse" | "flash" | (string & {});
92
- type EffectOption<D> = MarkEffect<D> | PresetName;
93
- /**
94
- * The `on` option of charts and adapters. Use it as `EffectSlots<NoInfer<D>>`, so a generic data
95
- * effect such as threshold() can't widen the chart's row type to unknown.
96
- */
97
- interface EffectSlots<D> {
98
- /** On pointer hover or keyboard focus; cleared on leave, replayed after a data transition. */
99
- readonly hover?: EffectOption<D>;
100
- /** When a mark appears. */
101
- readonly enter?: EffectOption<D>;
102
- /** When a mark's values change (not on a re-sort alone). */
103
- readonly update?: EffectOption<D>;
104
- /** Before a mark is removed; removal waits for it. */
105
- readonly exit?: EffectOption<D>;
106
- /** From enter until exit, following every geometry change. */
107
- readonly decorate?: EffectOption<D>;
108
- }
109
- interface ArcSpec {
110
- readonly key: string;
111
- readonly series?: string;
112
- /** The donut's centre. */
113
- readonly cx: number;
114
- readonly cy: number;
115
- /** Radii in px; 0 inner makes a pie slice. They're swapped if inner > outer, as d3.arc() does. */
116
- readonly inner: number;
117
- readonly outer: number;
118
- /** Radians, 0 at 12 o'clock, clockwise: the d3.pie() convention. end < start walks anticlockwise. */
119
- readonly start: number;
120
- readonly end: number;
121
- /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
122
- readonly labelBounds?: readonly Rect[];
123
- /** The boxes of other marks' text near it, in the same px: passed through as `nearbyLabels`. */
124
- readonly nearbyLabels?: readonly Rect[];
125
- }
126
- /**
127
- * The walk runs along the mid-radius arc from the start angle to the end angle, so for a slice
128
- * walked clockwise "up" is outward. The angle of travel equals the d3 angle (normalised).
129
- */
130
- declare function describeArc(spec: ArcSpec): MarkGeometry;
131
- /** The edge a bar grows from. */
132
- type Baseline = "left" | "right" | "top" | "bottom";
133
- interface BarSegmentSpec {
134
- readonly series: string;
135
- /** Px along the walk, gap included. */
136
- readonly size: number;
137
- }
138
- interface BarSpec {
139
- readonly key: string;
140
- readonly series?: string;
141
- /** The whole bar's rectangle, in chart px. */
142
- readonly x: number;
143
- readonly y: number;
144
- readonly width: number;
145
- readonly height: number;
146
- readonly baseline: Baseline;
147
- /** Corner radius at the tip. The baseline end stays square. Default 0. */
148
- readonly radius?: number;
149
- /**
150
- * Ordered parts, from the baseline. Default: one segment named after `series`, covering the bar.
151
- * Sizes normally add up to the bar's length; anything past the tip is cut off.
152
- */
153
- readonly segments?: readonly BarSegmentSpec[];
154
- /**
155
- * Px left empty between segments (the prototype uses 2). It comes out of the start of the later
156
- * segment, so every segment still ends at its value, and it shrinks to fit when what comes
157
- * before is shorter. Default 0.
158
- */
159
- readonly gap?: number;
160
- /** The boxes of the text drawn for the bar, its segments having none, in the same px: passed through as `labelBounds`. */
161
- readonly labelBounds?: readonly Rect[];
162
- /** The boxes of other marks' text near the bar, its segments having none, in the same px: passed through as `nearbyLabels`. */
163
- readonly nearbyLabels?: readonly Rect[];
164
- }
165
- /**
166
- * The walk runs along the centre line from the middle of the baseline edge to the middle of the
167
- * tip. A plain bar has one segment, so `travel(…, { along: "goals" })` works stacked or not.
168
- */
169
- declare function describeBar(spec: BarSpec): MarkGeometry;
170
- interface LineSpec {
171
- readonly key: string;
172
- readonly series?: string;
173
- /** At least one point, in chart px. */
174
- readonly points: readonly Point[];
175
- /**
176
- * The indices of the points that start a new run, so there's a gap from `points[i - 1]` to
177
- * `points[i]`: each a whole number from 1 to the last index, in order, with no repeats. A line
178
- * drawn with d3's `.defined()` is described by its defined points and where they break. Default none.
179
- */
180
- readonly breaks?: readonly number[];
181
- /** Stroke width in px. Default 1, SVG's default. */
182
- readonly width?: number;
183
- /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
184
- readonly labelBounds?: readonly Rect[];
185
- /** The boxes of other marks' text near it, in the same px: passed through as `nearbyLabels`. */
186
- readonly nearbyLabels?: readonly Rect[];
187
- }
188
- /**
189
- * The walk is the line itself, first point to last, running straight across each break. Its outline
190
- * is open: the stroke, with the breaks left out. A break between two points in the same place leaves
191
- * no gap, since there's nothing between them to leave out.
192
- */
193
- declare function describeLine(spec: LineSpec): MarkGeometry;
194
- interface PointSpec {
195
- readonly key: string;
196
- readonly series?: string;
197
- readonly x: number;
198
- readonly y: number;
199
- /** Radius in px. */
200
- readonly r: number;
201
- /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
202
- readonly labelBounds?: readonly Rect[];
203
- /** The boxes of other marks' text near it, in the same px: passed through as `nearbyLabels`. */
204
- readonly nearbyLabels?: readonly Rect[];
205
- }
206
- /**
207
- * Length 0, with start = end = centre, so travel does nothing while wiggle, pulse and flash still
208
- * work. Faces +x: the outline's sides are the quarter circles top, right, bottom and left.
209
- */
210
- declare function describePoint(spec: PointSpec): MarkGeometry;
211
- interface ShapeSpec {
212
- readonly key: string;
213
- readonly series?: string;
214
- /**
215
- * SVG path data in the shape's own px, read as SVG reads it, up to its first error. A shape is
216
- * closed when every subpath ends with Z, or where it started, and otherwise open, a line.
217
- */
218
- readonly d: string;
219
- /** Moves the shape into the marks' px, as an element's transform does, arcs too. Default none. */
220
- readonly matrix?: Matrix;
221
- /** An open shape's stroke width in px, more than 0. Default 1, SVG's default. */
222
- readonly width?: number;
223
- /** The boxes of the text drawn for the mark, in the marks' px: passed through as `labelBounds`. */
224
- readonly labelBounds?: readonly Rect[];
225
- /** The boxes of other marks' text near it, in the marks' px: passed through as `nearbyLabels`. */
226
- readonly nearbyLabels?: readonly Rect[];
227
- }
228
- /**
229
- * Path data, flattened: straight pieces and circular arcs stay as they are, and Béziers and other
230
- * arcs become straight pieces within 0.1 px of the curve.
231
- * - An open shape is a line. Its walk runs along the path from its first point, and each later move
232
- * starts a new run after a gap. Its outline is the stroke, less the gaps, and its thickness,
233
- * bounds, centre and pivot are as `describe.line`'s.
234
- * - A closed shape has no direction: its walk is its bounds' centre, with length 0. Its outline's
235
- * `d` is the whole path, holes too, and `sample(n)` goes round its longest subpath, clockwise in
236
- * four quarters of equal length from its upper left. Its thickness is the smaller of its width and
237
- * height.
238
- * A subpath that ends where it started is closed too, as d3.arc() draws a full ring's outer edge.
239
- * A path whose subpaths are all closed but have no length, as d3 draws a value alone, is open: a line
240
- * with nothing to stroke.
241
- */
242
- declare function describeShape(spec: ShapeSpec): MarkGeometry;
243
- export declare const describe: {
244
- bar: typeof describeBar;
245
- arc: typeof describeArc;
246
- line: typeof describeLine;
247
- point: typeof describePoint;
248
- shape: typeof describeShape;
249
- };
250
- declare function translate(x: number, y: number): Matrix;
251
- /** Positive radians turn clockwise on screen, like SVG's rotate(). */
252
- declare function rotate(radians: number, about?: Point): Matrix;
253
- declare function scale(sx: number, sy?: number, about?: Point): Matrix;
254
- /** Composes like an SVG transform list: multiply(a, b) applies b first, then a. No arguments gives the identity. */
255
- declare function multiply(...matrices: Matrix[]): Matrix;
256
- /** Where the transform takes a point. */
257
- declare function apply(m: Matrix, point: Point): Point;
258
- /** Builds and applies 2D transforms in SVG order, for `mark.set({ transform })` and `IconHandle.place()`. */
259
- export declare const matrix: {
260
- translate: typeof translate;
261
- rotate: typeof rotate;
262
- scale: typeof scale;
263
- multiply: typeof multiply;
264
- apply: typeof apply;
265
- };
266
- /** A point `distance` px from `point` in direction `angle` (screen radians). */
267
- export declare function offset(point: Point, angle: number, distance: number): Point;
268
- /** A data point in the mark's coordinates, with its value and, optionally, the x value behind it. */
269
- interface SamplePoint {
270
- readonly x: number;
271
- readonly y: number;
272
- readonly value: number;
273
- readonly at?: string | number | Date;
274
- }
275
- /**
276
- * Projects each point onto the nearest point of the mark's walk and returns the samples in `t` order
277
- * (points at the same `t` keep their order). A point on the walk, such as a vertex of the polyline it
278
- * drew, lands exactly where it is. Where the mark has gaps, the first sample past each gap's middle
279
- * has `gapBefore`, so a data effect doesn't join it to the one before. Throws a RangeError on a point
280
- * whose x, y or value isn't finite.
281
- */
282
- export declare function samplesAlong(mark: MarkGeometry, points: readonly SamplePoint[]): Sample[];
1
+ import { $ as interpolateRecord, A as MarkStyle, At as createClock, B as Sample, C as TextSpace, Ct as Easing, D as IconHandle, Dt as Clock, E as Color, Et as linear, F as TextStyle, G as playback, H as PlaybackEvent, I as Icon, J as AnimatedOptions, K as AnimateOptions, L as IconShape, M as Paint, Mt as manualClock, N as PathHandle, O as Layer, Ot as FrameSource, P as TextHandle, Q as interpolatePoint, R as IconSource, S as MarkEffect, St as scaleDuration, T as TransitionEffect, Tt as easeOutCubic, U as PlaybackOptions, V as Playback, W as SeekOptions, X as animated, Y as Interpolator, Z as interpolateNumber, _ as AnyMarkEffect, _t as Timing, a as describe, at as Tween, b as EffectContext, bt as mediaReducedMotion, c as LineSpec, ct as tween, d as Baseline, dt as MotionOptions, et as MarkGeometry, f as ArcSpec, ft as MotionView, g as PresetName, gt as ScalingTable, h as EffectSlots, ht as ScalingRule, i as offset, it as MotionEnv, j as Matrix, jt as defaultClock, k as MarkHandle, kt as ManualClock, l as BarSegmentSpec, lt as Motion, m as EffectSlot, mt as ScalingOverrides, n as samplesAlong, nt as Point, o as ShapeSpec, ot as TweenOptions, p as EffectOption, pt as ReducedMotionSource, q as Animated, r as matrix, rt as Rect, s as PointSpec, st as TweenResult, t as SamplePoint, tt as Outline, u as BarSpec, ut as MotionMode, v as Combined, vt as createMotion, w as TransitionContext, wt as easeInOutCubic, x as GeometryEffect, xt as motion, y as DataEffect, yt as defaultScaling, z as MarkData } from "./index-CmnxlWkB.cjs";
2
+ import "./runner-C87v9F_y.cjs";
283
3
  interface ColorAssignment {
284
4
  /** The palette slot (1–8) for a key: its pinned slot, or the next free one the first time it's seen. Never reassigned. */
285
5
  slot(key: string): number;
@@ -918,8 +638,19 @@ interface ChartSwitchView {
918
638
  */
919
639
  keyOf?(element: Element): string | undefined;
920
640
  /**
921
- * Hides (true) or shows again (false) the marks and labels the switch draws in its overlay, while
922
- * a switch plays: called as `element` takes `ec-morphing`, and as it loses it or the switch is
641
+ * The parts of the chart that can stay put through a switch: an axis, a grid, a tick, each an
642
+ * element in `element` with a key of its own, read as each switch starts, before morphing(true). A
643
+ * guide stays on screen at full strength, where it is, while the switch plays, when the other view
644
+ * has a guide with its key drawn the same: the same markup in the same computed paint, with any ids
645
+ * left out, at the same place within 0.5 px and at the same scale and turn. The old view's is drawn
646
+ * until half way and the new view's from there, so one drawn the same doesn't change. Every other
647
+ * guide fades with its view. The switch draws each one as a copy in its overlay, so the view hides
648
+ * them while it plays, as it hides its marks. Without it, a view has none.
649
+ */
650
+ guides?(): readonly ChartSwitchGuide[];
651
+ /**
652
+ * Hides (true) or shows again (false) the marks, labels and guides the switch draws in its overlay,
653
+ * while a switch plays: called as `element` takes `ec-morphing`, and as it loses it or the switch is
923
654
  * destroyed mid-way. A host chart's marks don't have the class that hides a chart's. Without it,
924
655
  * the class hides them.
925
656
  */
@@ -944,6 +675,13 @@ interface ChartSwitchPaint {
944
675
  /** The width of the ring in `--ec-surface` the chart draws round the mark's filled shape, or round its end dot when it has one: 2 round a line chart's point and end dot. Unset: none. */
945
676
  readonly ring?: number;
946
677
  }
678
+ /** A part of a view's chart that stays put through a switch when the next view draws it the same: an axis, a grid, a tick. */
679
+ interface ChartSwitchGuide {
680
+ /** The element, in the view's `<svg>`: drawn as it is, with everything in it. */
681
+ readonly element: Element;
682
+ /** Its own key: it pairs with the other view's guide with this key, never with a mark or a label. */
683
+ readonly key: string;
684
+ }
947
685
  /**
948
686
  * Draws one view's chart in `container` and returns it. `colors` is the switch's assignment: pass it
949
687
  * to the chart as its `colors`, so a key has the same colour in every view and in the overlay.
@@ -973,8 +711,18 @@ interface ChartSwitchOptions<T extends ChartSwitchViews> {
973
711
  /** A polite live region that says the new view's label (its chart's `label`) after each switch. Default false. */
974
712
  readonly announce?: boolean;
975
713
  }
714
+ /** How show() switches. */
715
+ interface ChartSwitchShowOptions<T extends ChartSwitchViews> {
716
+ /**
717
+ * A view to stage the jump through. In Presentation (`motion.staged`), the switch plays from the
718
+ * view on show to `via`, then from `via` to the view, each a full switch, and lands once: focus
719
+ * follows its key into the view, and the view alone is announced. In Analysis and Off, and when
720
+ * `via` is the view on show or the view itself, it switches straight there. Rejects for an unknown view.
721
+ */
722
+ readonly via?: ChartSwitchViewName<T>;
723
+ }
976
724
  interface ChartSwitch<T extends ChartSwitchViews> {
977
- /** The view shown, or the one a switch is heading for. */
725
+ /** The view shown, or the one a switch is heading for: a staged jump's view from its start. */
978
726
  readonly current: ChartSwitchViewName<T>;
979
727
  /**
980
728
  * Switches to `view`: each mark morphs into the mark with its key, by the motion mode. Resolves
@@ -982,8 +730,15 @@ interface ChartSwitch<T extends ChartSwitchViews> {
982
730
  * a switch is leaving reverses it from where the shapes are; one to a third view lands the switch
983
731
  * first. With motion off, the switch has landed when show() returns. Rejects for an unknown view.
984
732
  * One a `leave` listener calls as the old view's hover ends runs once the switch has begun.
985
- */
986
- show(view: ChartSwitchViewName<T>): Promise<void>;
733
+ *
734
+ * With `via`, in Presentation, the jump is staged through that view, and `current` is `view` from
735
+ * the start. A show() for `view` plays on. One in the first leg drops the leg still to come and acts
736
+ * on the one playing, as on any switch: back to the view it began in, it reverses; to `via`, it plays
737
+ * on and stops there; to another view, it lands on `via` and switches on from there, by that show()'s
738
+ * own `via`. The second leg is a switch from `via` to `view`, as any other. Motion turning off, or a
739
+ * resize, lands the jump on `view` at once.
740
+ */
741
+ show(view: ChartSwitchViewName<T>, options?: ChartSwitchShowOptions<T>): Promise<void>;
987
742
  /** The chart a view's function returned: for update(), on() and the rest. */
988
743
  chart<K extends ChartSwitchViewName<T>>(view: K): ReturnType<T[K]>;
989
744
  /**
@@ -1011,6 +766,13 @@ interface HostLabel {
1011
766
  /** "category": the mark's name (a slice's outside label, a column's name). "value": its value. */
1012
767
  readonly role: "category" | "value";
1013
768
  }
769
+ /** A part of the host's drawing that a chart switch keeps where it is when the next view draws it the same: an axis, a grid, a tick. */
770
+ interface HostGuide {
771
+ /** An element in the host's `<svg>`, drawn as it is, with everything in it. */
772
+ readonly element: Element;
773
+ /** Its own key: it pairs with the next view's guide with this key, never with a mark or a label. */
774
+ readonly key: string;
775
+ }
1014
776
  interface HostViewOptions {
1015
777
  /**
1016
778
  * The host's labels, each a `<text>` in its `<svg>` with its mark's key and its role, read as each
@@ -1020,15 +782,28 @@ interface HostViewOptions {
1020
782
  * Default: none.
1021
783
  */
1022
784
  readonly labels?: () => Iterable<HostLabel>;
785
+ /**
786
+ * The host's guides (an axis, a grid, a tick), each an element in its `<svg>` with a key of its
787
+ * own, read as each switch starts. One whose key the next view's guides have too stays on screen at
788
+ * full strength, where it is, while the switch plays, when the two are drawn the same; every other
789
+ * fades with its view. One that isn't in the `<svg>`, or has no key, is left out, and so is
790
+ * everything if it throws (reported). Default: none.
791
+ */
792
+ readonly guides?: () => Iterable<HostGuide>;
1023
793
  }
1024
- /** An attachment as a chart switch's view: the attachment's own methods, with the view's. */
794
+ /**
795
+ * An attachment, or several on one `<svg>`, as a chart switch's view: the attachment's own methods, or
796
+ * each of theirs, with the view's.
797
+ */
1025
798
  interface HostView<D> extends Attachment<D>, ChartSwitchView {
1026
- /** The host's root `<svg>`. Its `aria-label` is what a switch's `announce` says. */
799
+ /** The host's root `<svg>`, which its attachments share. Its `aria-label` is what a switch's `announce` says. */
1027
800
  readonly element: SVGSVGElement;
1028
- /** The marks' nearest common ancestor, whose space marks() and labels() are in. */
801
+ /** The marks' nearest common ancestor, whose space marks() and labels() are in: every attachment's marks'. */
1029
802
  readonly space: Element;
1030
803
  /** The labels `labels` gives, as a switch draws them: at their anchor, in the host text's computed font and fill. */
1031
804
  labels(): readonly ChartLabel[];
805
+ /** The guides `guides` gives: each the host's own element, with its key. */
806
+ guides(): readonly ChartSwitchGuide[];
1032
807
  /** The host's colour for the mark, its fill or its stroke on a line, as its first part draws it. */
1033
808
  paintOf(key: string): ChartSwitchPaint | undefined;
1034
809
  keyOf(element: Element): string | undefined;
@@ -1043,6 +818,15 @@ interface HostView<D> extends Attachment<D>, ChartSwitchView {
1043
818
  * anything else, or on an attachment with no marks yet, which has no `<svg>`.
1044
819
  */
1045
820
  export declare function hostView<D>(attachment: Attachment<D>, options?: HostViewOptions): HostView<D>;
821
+ /**
822
+ * Makes several attachments on one `<svg>` one view for chartSwitch, as a chart drawn with several
823
+ * (a dumbbell's dots and its connectors) is one chart: its marks are all of theirs, and each mark's
824
+ * focus, tab stop, colour and hiding go to the attachment it's from. Its rows are theirs, as a union.
825
+ * Throws a TypeError, naming it, on anything but attachments with marks, on two in different `<svg>`s,
826
+ * and on a key two of them give a mark: key each one's marks apart (`first@Okafor`). An array of one
827
+ * makes that attachment's view.
828
+ */
829
+ export declare function hostView<A extends Attachment<unknown>>(attachments: readonly A[], options?: HostViewOptions): HostView<RowsOf<A>>;
1046
830
  /**
1047
831
  * What fromVegaView() uses of a Vega View: its renderer, its scenegraph and the element it renders
1048
832
  * into. The scenegraph is read as `{ root }` (what Vega returns) or as the root mark itself (what
@@ -1411,6 +1195,14 @@ interface MorphOptions {
1411
1195
  * where that place is outside it or near its edge. Where it would leave the shape on the way, it
1412
1196
  * closes sooner, as soon as a sixteenth of the way. Each is written the other way round from the
1413
1197
  * outside, so it stays a hole under either fill rule.
1198
+ * - **Two bands across the same x's** (closed outlines whose longest loop, with no arc, splits at its
1199
+ * leftmost and rightmost points into an upper run and a lower run, each going one way across x in
1200
+ * two straight pieces or more, as d3.area() draws an area; the two bands' leftmost x's within
1201
+ * 0.01 px, and their rightmost) pair by x: upper run with upper and lower with lower, each as two
1202
+ * lines across x pair, by share of its span, with stops at `points` shares and at each vertex of
1203
+ * either run. So two areas over the same weeks keep each week's x on every frame, corners pair with
1204
+ * corners, and the edges at each end join the runs as they move. `align` doesn't turn them. Holes
1205
+ * morph as above. A rectangle's top and base are a piece each, so bars aren't bands.
1414
1206
  * - **Two lines that each run one way across x** (every vertex's x more than the one before, or
1415
1207
  * every one less, the same way for both) pair by x: the point a share of the way across one
1416
1208
  * line's x span moves to the point that share across the other's. They're sampled at `points`
@@ -1541,7 +1333,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
1541
1333
  * has the same rules. For a CSP that allows no inline styles at all.
1542
1334
  */
1543
1335
  export declare function configure(options: StyleOptions): void;
1544
- export declare const VERSION = "0.9.0";
1336
+ export declare const VERSION = "0.11.0";
1545
1337
  /**
1546
1338
  * A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
1547
1339
  * category; `stack` stacks numeric fields; `on` attaches effects by slot.
@@ -1562,8 +1354,9 @@ export declare function lineChart<D>(target: string | Element, options: LineChar
1562
1354
  /**
1563
1355
  * Views of the same data in `target` (an element or a selector), one shown at a time: `show(view)`
1564
1356
  * turns each mark into the mark with its key in the other view with `transition`, morph() by default,
1565
- * while the labels move and swap their text. Each view's function draws its chart in the container
1566
- * it's given; pass it the `colors` it's given too, so a key keeps its colour from view to view.
1357
+ * while the labels move and swap their text, and `show(view, { via })` stages a jump through a third
1358
+ * view in Presentation. Each view's function draws its chart in the container it's given; pass it the
1359
+ * `colors` it's given too, so a key keeps its colour from view to view.
1567
1360
  */
1568
1361
  export declare function chartSwitch<T extends ChartSwitchViews>(target: string | Element, options: ChartSwitchOptions<T>): ChartSwitch<T>;
1569
1362
  /**
@@ -1586,5 +1379,4 @@ export declare function fromVegaView<D = Record<string, unknown>>(view: VegaView
1586
1379
  * page-wide `motion`. `persist: "key"` saves the choice in localStorage.
1587
1380
  */
1588
1381
  export declare function motionSwitch(target: string | Element, motion?: Motion, options?: MotionSwitchOptions): MotionSwitch;
1589
- export { type Accessor, type AnimateOptions, type Animated, type AnimatedOptions, type AnyMarkEffect, type ArcSpec, type Attachment, type BarChart, type BarChartOptions, type BarSegmentSpec, type BarSpec, type Baseline, type Chart, type ChartChange, type ChartLabel, type ChartOptions, type ChartSwitch, type ChartSwitchOptions, type ChartSwitchPaint, type ChartSwitchView, type ChartSwitchViewFactory, type ChartSwitchViewName, type ChartSwitchViews, type Clock, type Color, type ColorAssignment, type Combined, type DataEffect, type DataEffectSpec, type DeltaOptions, type DonutChart, type DonutChartOptions, type DrawInOptions, type Easing, type EffectContext, type EffectOption, type EffectSlot, type EffectSlots, type ExpressiveOptions, type FlashOptions, type FrameSource, type Gait, type GaitName, type GaitPose, type GaitState, type GeometryEffect, type GeometryEffectSpec, type HostLabel, type HostMark, type HostView, type HostViewOptions, type Icon, type IconHandle, type IconShape, type IconSource, type IconSpec, type Interpolator, type KeyOfType, type LabelOptions, type Layer, type LegendEntry, type LegendOptions, type LineChart, type LineChartOptions, type LineSpec, type Link, type LinkOptions, type LinkSource, type ManualClock, type MarkData, type MarkEffect, type MarkEvent, type MarkEvents, type MarkGeometry, type MarkHandle, type MarkSource, type MarkStyle, type MarkSummary, type Matrix, type MorphAlign, type MorphOptions, type Motion, type MotionEnv, type MotionMode, type MotionOptions, type MotionSwitch, type MotionSwitchOptions, type MotionView, type NumericKey, type Outline, type Paint, type PathHandle, type PlayButton, type PlayButtonOptions, type Playback, type PlaybackEvent, type PlaybackOptions, type Point, type PointSpec, type PresetName, type PulseOptions, type Rect, type ReducedMotionSource, type Sample, type SamplePoint, type ScalingOverrides, type ScalingRule, type ScalingTable, type SeekOptions, type ShapeSpec, type SliceSummary, type StaggerOptions, type StepOptions, type StyleOptions, type SvgIconSpec, type TableColumn, type TableOptions, type TextHandle, type TextSpace, type TextStyle, type ThresholdOptions, type Timing, type TraceOptions, type TransitionContext, type TransitionEffect, type TravelOptions, type Tween, type TweenOptions, type TweenResult, type VegaAttachment, type VegaItem, type VegaMark, type VegaOptions, type VegaSample, type VegaViewLike, type WiggleOptions, createClock, createMotion, defaultClock, defaultScaling, easeInOutCubic, easeOutCubic, linear, manualClock, mediaReducedMotion, motion, scaleDuration, tween };
1590
- //# sourceMappingURL=index.d.cts.map
1382
+ export { type Accessor, type AnimateOptions, type Animated, type AnimatedOptions, type AnyMarkEffect, type ArcSpec, type Attachment, type BarChart, type BarChartOptions, type BarSegmentSpec, type BarSpec, type Baseline, type Chart, type ChartChange, type ChartLabel, type ChartOptions, type ChartSwitch, type ChartSwitchGuide, type ChartSwitchOptions, type ChartSwitchPaint, type ChartSwitchShowOptions, type ChartSwitchView, type ChartSwitchViewFactory, type ChartSwitchViewName, type ChartSwitchViews, type Clock, type Color, type ColorAssignment, type Combined, type DataEffect, type DataEffectSpec, type DeltaOptions, type DonutChart, type DonutChartOptions, type DrawInOptions, type Easing, type EffectContext, type EffectOption, type EffectSlot, type EffectSlots, type ExpressiveOptions, type FlashOptions, type FrameSource, type Gait, type GaitName, type GaitPose, type GaitState, type GeometryEffect, type GeometryEffectSpec, type HostGuide, type HostLabel, type HostMark, type HostView, type HostViewOptions, type Icon, type IconHandle, type IconShape, type IconSource, type IconSpec, type Interpolator, type KeyOfType, type LabelOptions, type Layer, type LegendEntry, type LegendOptions, type LineChart, type LineChartOptions, type LineSpec, type Link, type LinkOptions, type LinkSource, type ManualClock, type MarkData, type MarkEffect, type MarkEvent, type MarkEvents, type MarkGeometry, type MarkHandle, type MarkSource, type MarkStyle, type MarkSummary, type Matrix, type MorphAlign, type MorphOptions, type Motion, type MotionEnv, type MotionMode, type MotionOptions, type MotionSwitch, type MotionSwitchOptions, type MotionView, type NumericKey, type Outline, type Paint, type PathHandle, type PlayButton, type PlayButtonOptions, type Playback, type PlaybackEvent, type PlaybackOptions, type Point, type PointSpec, type PresetName, type PulseOptions, type Rect, type ReducedMotionSource, type Sample, type SamplePoint, type ScalingOverrides, type ScalingRule, type ScalingTable, type SeekOptions, type ShapeSpec, type SliceSummary, type StaggerOptions, type StepOptions, type StyleOptions, type SvgIconSpec, type TableColumn, type TableOptions, type TextHandle, type TextSpace, type TextStyle, type ThresholdOptions, type Timing, type TraceOptions, type TransitionContext, type TransitionEffect, type TravelOptions, type Tween, type TweenOptions, type TweenResult, type VegaAttachment, type VegaItem, type VegaMark, type VegaOptions, type VegaSample, type VegaViewLike, type WiggleOptions, animated, createClock, createMotion, defaultClock, defaultScaling, describe, easeInOutCubic, easeOutCubic, interpolateNumber, interpolatePoint, interpolateRecord, linear, manualClock, matrix, mediaReducedMotion, motion, offset, playback, samplesAlong, scaleDuration, tween };