expressive-charts 0.4.0 → 0.6.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 +65 -1
- package/README.md +7 -7
- package/dist/{drawing-Dz_IvJPB.d.ts → drawing-Ypmq-2h6.d.cts} +7 -1
- package/dist/{drawing-Dz_IvJPB.d.cts → drawing-Ypmq-2h6.d.ts} +7 -1
- package/dist/{effect-uYC8Vs6_.d.cts → effect-D8W4ZmmG.d.cts} +28 -4
- package/dist/{effect-CdH5449m.d.ts → effect-DyzluQD1.d.ts} +28 -4
- package/dist/expressive-charts.css +3 -2
- package/dist/expressive-charts.global.js +13 -12
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/icons/sport.d.cts +1 -1
- package/dist/icons/sport.d.ts +1 -1
- package/dist/index.cjs +1421 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -15
- package/dist/index.d.ts +93 -15
- package/dist/index.js +1326 -205
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +64 -16
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +12 -3
- package/dist/testing.d.ts +12 -3
- package/dist/testing.js +20 -3
- package/dist/testing.js.map +1 -1
- package/dist/{transition-DSRt2DH3.js → transition-romki_A6.js} +98 -26
- package/dist/transition-romki_A6.js.map +1 -0
- package/package.json +2 -2
- package/dist/transition-DSRt2DH3.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
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-
|
|
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-D8W4ZmmG.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-Ypmq-2h6.cjs";
|
|
3
3
|
/** Builds a function that blends `from` into `to` as t goes from 0 to 1. */
|
|
4
4
|
type Interpolator<T> = (from: T, to: T) => (t: number) => T;
|
|
5
5
|
/** Exact at both ends, so a finished animation lands on its target. */
|
|
@@ -120,6 +120,8 @@ interface ArcSpec {
|
|
|
120
120
|
readonly end: number;
|
|
121
121
|
/** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
|
|
122
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[];
|
|
123
125
|
}
|
|
124
126
|
/**
|
|
125
127
|
* The walk runs along the mid-radius arc from the start angle to the end angle, so for a slice
|
|
@@ -157,6 +159,8 @@ interface BarSpec {
|
|
|
157
159
|
readonly gap?: number;
|
|
158
160
|
/** The boxes of the text drawn for the bar, its segments having none, in the same px: passed through as `labelBounds`. */
|
|
159
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[];
|
|
160
164
|
}
|
|
161
165
|
/**
|
|
162
166
|
* The walk runs along the centre line from the middle of the baseline edge to the middle of the
|
|
@@ -178,6 +182,8 @@ interface LineSpec {
|
|
|
178
182
|
readonly width?: number;
|
|
179
183
|
/** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
|
|
180
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[];
|
|
181
187
|
}
|
|
182
188
|
/**
|
|
183
189
|
* The walk is the line itself, first point to last, running straight across each break. Its outline
|
|
@@ -194,6 +200,8 @@ interface PointSpec {
|
|
|
194
200
|
readonly r: number;
|
|
195
201
|
/** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
|
|
196
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[];
|
|
197
205
|
}
|
|
198
206
|
/**
|
|
199
207
|
* Length 0, with start = end = centre, so travel does nothing while wiggle, pulse and flash still
|
|
@@ -214,6 +222,8 @@ interface ShapeSpec {
|
|
|
214
222
|
readonly width?: number;
|
|
215
223
|
/** The boxes of the text drawn for the mark, in the marks' px: passed through as `labelBounds`. */
|
|
216
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[];
|
|
217
227
|
}
|
|
218
228
|
/**
|
|
219
229
|
* Path data, flattened: straight pieces and circular arcs stay as they are, and Béziers and other
|
|
@@ -548,6 +558,42 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
548
558
|
* the chart's `format`; an empty string shows none, and a throw (reported) keeps the default.
|
|
549
559
|
*/
|
|
550
560
|
readonly labels?: false | ((value: number, series: string, format: (value: number) => string) => string);
|
|
561
|
+
/**
|
|
562
|
+
* How each line runs between its values. "linear", the default, is straight from value to value.
|
|
563
|
+
* "monotone" is d3's curveMonotoneX: a smooth curve through every value that's flat between two
|
|
564
|
+
* equal ones and never goes above or below the values either side, so it shows no value the data
|
|
565
|
+
* doesn't have. Each run between gaps is curved on its own, and a run of two values is straight. A
|
|
566
|
+
* curved line's samples are its rows' and one at each bend between them, so `threshold` changes
|
|
567
|
+
* colour where the drawn lines cross. A change of curve plays as a change; anything else throws a
|
|
568
|
+
* TypeError, and update() rejects it.
|
|
569
|
+
*/
|
|
570
|
+
readonly curve?: "linear" | "monotone";
|
|
571
|
+
/**
|
|
572
|
+
* What the pointer, touch and the keys hover. "x", the default: every series' point at the nearest
|
|
573
|
+
* x, with a crosshair, nothing dimmed, and the x's as focus stops. "point": the revealed point nearest
|
|
574
|
+
* the pointer, by distance, anywhere over the plot (of two as near, the series first in `series`),
|
|
575
|
+
* alone. Its line stays at full strength and every other line and point dims, unless `dim` is false;
|
|
576
|
+
* there's no crosshair, and the tooltip sits above the point. The points are the focus stops: Left
|
|
577
|
+
* and Right go along the line, Up and Down to the point above or below. Links still go by x. Anything
|
|
578
|
+
* else throws a TypeError. update({ hover }) changes it at once: a held hover ends, and focus moves
|
|
579
|
+
* to the nearest stop of the new kind.
|
|
580
|
+
*/
|
|
581
|
+
readonly hover?: "x" | "point";
|
|
582
|
+
/**
|
|
583
|
+
* A box beside the hovered or focused x or point, as on every chart. A function is given the row
|
|
584
|
+
* and, with `hover: "point"`, the point's series as a second argument: (d, { series }) => text. With
|
|
585
|
+
* "x" it's given the row alone.
|
|
586
|
+
*/
|
|
587
|
+
readonly tooltip?: boolean | ((d: NoInfer<D>, point?: {
|
|
588
|
+
readonly series: string;
|
|
589
|
+
}) => string);
|
|
590
|
+
/**
|
|
591
|
+
* Px the layout keeps clear to the right of the end labels, or of the lines' ends with `labels:
|
|
592
|
+
* false`, for text an effect draws past them: a `delta` past a line's end label. The plot is that
|
|
593
|
+
* much narrower, and the end labels stay beside it. Default 0. Anything but a number of px, 0 or
|
|
594
|
+
* more, throws a RangeError, and update({ room }) lays the chart out again.
|
|
595
|
+
*/
|
|
596
|
+
readonly room?: number;
|
|
551
597
|
}
|
|
552
598
|
interface LineChart<D> extends Chart<D, LineChartOptions<D>> {
|
|
553
599
|
/**
|
|
@@ -596,7 +642,8 @@ interface Chart<D, O> {
|
|
|
596
642
|
/**
|
|
597
643
|
* Moves focus to the mark `key` as a key press would, whatever the last input was: the focus ring
|
|
598
644
|
* shows and its hover plays. On a line chart it's the x's focus stop: `key` is the x's key, or one
|
|
599
|
-
* of its points'.
|
|
645
|
+
* of its points'. With `hover: "point"` it's the point's: its own key, or an x's, for its first
|
|
646
|
+
* series' point there. A key that isn't on screen (unknown, leaving, or past a line's reveal) does nothing.
|
|
600
647
|
*/
|
|
601
648
|
focus(key: string): void;
|
|
602
649
|
/**
|
|
@@ -657,13 +704,15 @@ interface ExpressiveOptions<D> {
|
|
|
657
704
|
readonly value?: (datum: D, element: Element) => number | string | boolean | null | undefined;
|
|
658
705
|
/**
|
|
659
706
|
* Describes every mark yourself, instead of the adapter reading them. Without it, a `<rect>` is a
|
|
660
|
-
* bar (rects that share a key are its segments
|
|
661
|
-
* that stretches it unevenly or skews it),
|
|
662
|
-
* `<
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
*
|
|
707
|
+
* bar (rects that share a key are its segments; one of its own turned or skewed is a shape), a
|
|
708
|
+
* `<circle>` a point (an ellipse under a transform that stretches it unevenly or skews it), a
|
|
709
|
+
* `<path>` that draws a ring's slice that slice, read with `describe.arc`, and any other `<path>`, a
|
|
710
|
+
* `<line>`, `<polyline>`, `<polygon>` or `<ellipse>` a shape, read with `describe.shape` from its
|
|
711
|
+
* outline, an open one with its stroke width as drawn. Each is read through its transforms, and a
|
|
712
|
+
* shape SVG wouldn't draw (a path with no path data) isn't a mark until it draws something. Any
|
|
713
|
+
* other element (`<text>`, `<g>`, `<use>`, `<image>`) throws, naming its tag. Use this for those,
|
|
714
|
+
* or to say more or other than an element shows: a padded donut's slice as `describe.arc`, which
|
|
715
|
+
* goes round the donut's centre, or a line by its points.
|
|
667
716
|
* Called once per mark, with its first element in document order, in the coordinates of the marks'
|
|
668
717
|
* nearest common ancestor. Build it with `describe` and give it the key passed in.
|
|
669
718
|
*/
|
|
@@ -814,7 +863,7 @@ interface VegaItem {
|
|
|
814
863
|
readonly cornerRadius?: number;
|
|
815
864
|
/** False for a line's point Vega leaves out, which breaks the line there. */
|
|
816
865
|
readonly defined?: boolean;
|
|
817
|
-
/** How a line is drawn between its points:
|
|
866
|
+
/** How a line is drawn between its points: "linear" (or unset) is read from the items, any other curve from the path Vega draws. */
|
|
818
867
|
readonly interpolate?: string;
|
|
819
868
|
}
|
|
820
869
|
/** A value for data effects: alone, or with where it is along x (`at`), which threshold matches series by. */
|
|
@@ -872,7 +921,8 @@ export declare function link<S extends LinkSource<unknown>>(sources: readonly S[
|
|
|
872
921
|
/**
|
|
873
922
|
* What a chart switch uses of each view's chart. A reference chart's handle has all of it: its
|
|
874
923
|
* `<svg>` (which takes `ec-morphing` while its marks morph in the switch's overlay), its marks and
|
|
875
|
-
* labels as drawn, focus by key, leave() to end its hover, and destroy()
|
|
924
|
+
* labels as drawn, focus by key, leave() to end its hover, and destroy(); how it paints each mark
|
|
925
|
+
* (paintOf), and, a line chart's, what its focus stops stand for (standsFor). A reference chart also
|
|
876
926
|
* has on(), which the switch's on() hears, and a hover a link can drive; a view without them isn't
|
|
877
927
|
* heard and isn't linked.
|
|
878
928
|
*/
|
|
@@ -883,6 +933,24 @@ interface ChartSwitchView {
|
|
|
883
933
|
focus(key: string): void;
|
|
884
934
|
leave(): void;
|
|
885
935
|
destroy(): void;
|
|
936
|
+
/**
|
|
937
|
+
* How the chart paints the mark `key`: the name its colour comes from, and whether it's drawn at
|
|
938
|
+
* rest. Without it, or for a key it doesn't know, the switch draws the mark in its key's colour.
|
|
939
|
+
*/
|
|
940
|
+
paintOf?(key: string): ChartSwitchPaint | undefined;
|
|
941
|
+
/**
|
|
942
|
+
* The keys the focus stop `key` stands for, in the order the next view's focus(key) is tried with
|
|
943
|
+
* them: a line chart's x stands for each series' point key there, in series order, then itself.
|
|
944
|
+
* Without it, a stop stands for its own key.
|
|
945
|
+
*/
|
|
946
|
+
standsFor?(key: string): readonly string[];
|
|
947
|
+
}
|
|
948
|
+
/** How a view's chart paints one of its marks: what a switch draws it in. */
|
|
949
|
+
interface ChartSwitchPaint {
|
|
950
|
+
/** The name its colour comes from in the switch's assignment (`colors.slot(color)`): a line's or a point's series, a bar's key or first series, a slice's key. */
|
|
951
|
+
readonly color: string;
|
|
952
|
+
/** Whether the chart draws it at rest. A line chart's points aren't, but for a value alone between gaps; a mark that isn't starts or ends a switch as a dot of no size at its centre. */
|
|
953
|
+
readonly drawn: boolean;
|
|
886
954
|
}
|
|
887
955
|
/**
|
|
888
956
|
* Draws one view's chart in `container` and returns it. `colors` is the switch's assignment: pass it
|
|
@@ -1222,8 +1290,18 @@ interface MorphOptions {
|
|
|
1222
1290
|
* `align: "drop"` the pairing is turned by a quarter, from a mark that goes round its pivot (a
|
|
1223
1291
|
* slice) to one that doesn't (a bar), whichever is `from`: so a switch back retraces the same
|
|
1224
1292
|
* pairing instead of twisting. Between two marks of the same kind, "drop" pairs as "unroll" does.
|
|
1293
|
+
* Holes (the subpaths of an outline's `d` other than the longest) morph too: they pair by area,
|
|
1294
|
+
* largest with largest, each sampled at a quarter of `points` from its upper left. One with no
|
|
1295
|
+
* partner closes by half way, or opens after it, while its centre heads for where it lands in the
|
|
1296
|
+
* other mark: its centre's place in the other's bounds, or the deepest point of its filled area
|
|
1297
|
+
* where that place is outside it or near its edge. Where it would leave the shape on the way, it
|
|
1298
|
+
* closes sooner, as soon as a sixteenth of the way. Each is written the other way round from the
|
|
1299
|
+
* outside, so it stays a hole under either fill rule.
|
|
1225
1300
|
* - **Two open outlines** (lines): both strokes are sampled along their length, and the stroke's
|
|
1226
|
-
* width moves from one thickness to the other.
|
|
1301
|
+
* width moves from one thickness to the other. Where either line has `gaps`, the stroke inside a
|
|
1302
|
+
* gap of the old line fades in and inside a gap of the new line fades out, each piece at an
|
|
1303
|
+
* opacity of 1 − ((1 − p) · a + p · b), with p the eased progress and a and b 1 inside the old and
|
|
1304
|
+
* the new line's gap: so nothing is drawn inside a gap both have.
|
|
1227
1305
|
* - **A closed and an open outline** crossfade: the first fades out as the second fades in.
|
|
1228
1306
|
*
|
|
1229
1307
|
* A run from `ctx.start` begins with the shapes there, in their eased progress, and takes the rest
|
|
@@ -1343,7 +1421,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
|
|
|
1343
1421
|
* has the same rules. For a CSP that allows no inline styles at all.
|
|
1344
1422
|
*/
|
|
1345
1423
|
export declare function configure(options: StyleOptions): void;
|
|
1346
|
-
export declare const VERSION = "0.
|
|
1424
|
+
export declare const VERSION = "0.6.0";
|
|
1347
1425
|
/**
|
|
1348
1426
|
* A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
|
|
1349
1427
|
* category; `stack` stacks numeric fields; `on` attaches effects by slot.
|
|
@@ -1388,5 +1466,5 @@ export declare function fromVegaView<D = Record<string, unknown>>(view: VegaView
|
|
|
1388
1466
|
* page-wide `motion`. `persist: "key"` saves the choice in localStorage.
|
|
1389
1467
|
*/
|
|
1390
1468
|
export declare function motionSwitch(target: string | Element, motion?: Motion, options?: MotionSwitchOptions): MotionSwitch;
|
|
1391
|
-
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 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 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 HostMark, 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 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 };
|
|
1469
|
+
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 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 HostMark, 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 };
|
|
1392
1470
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
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-
|
|
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-DyzluQD1.js";
|
|
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-Ypmq-2h6.js";
|
|
3
3
|
/** Builds a function that blends `from` into `to` as t goes from 0 to 1. */
|
|
4
4
|
type Interpolator<T> = (from: T, to: T) => (t: number) => T;
|
|
5
5
|
/** Exact at both ends, so a finished animation lands on its target. */
|
|
@@ -120,6 +120,8 @@ interface ArcSpec {
|
|
|
120
120
|
readonly end: number;
|
|
121
121
|
/** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
|
|
122
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[];
|
|
123
125
|
}
|
|
124
126
|
/**
|
|
125
127
|
* The walk runs along the mid-radius arc from the start angle to the end angle, so for a slice
|
|
@@ -157,6 +159,8 @@ interface BarSpec {
|
|
|
157
159
|
readonly gap?: number;
|
|
158
160
|
/** The boxes of the text drawn for the bar, its segments having none, in the same px: passed through as `labelBounds`. */
|
|
159
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[];
|
|
160
164
|
}
|
|
161
165
|
/**
|
|
162
166
|
* The walk runs along the centre line from the middle of the baseline edge to the middle of the
|
|
@@ -178,6 +182,8 @@ interface LineSpec {
|
|
|
178
182
|
readonly width?: number;
|
|
179
183
|
/** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
|
|
180
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[];
|
|
181
187
|
}
|
|
182
188
|
/**
|
|
183
189
|
* The walk is the line itself, first point to last, running straight across each break. Its outline
|
|
@@ -194,6 +200,8 @@ interface PointSpec {
|
|
|
194
200
|
readonly r: number;
|
|
195
201
|
/** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */
|
|
196
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[];
|
|
197
205
|
}
|
|
198
206
|
/**
|
|
199
207
|
* Length 0, with start = end = centre, so travel does nothing while wiggle, pulse and flash still
|
|
@@ -214,6 +222,8 @@ interface ShapeSpec {
|
|
|
214
222
|
readonly width?: number;
|
|
215
223
|
/** The boxes of the text drawn for the mark, in the marks' px: passed through as `labelBounds`. */
|
|
216
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[];
|
|
217
227
|
}
|
|
218
228
|
/**
|
|
219
229
|
* Path data, flattened: straight pieces and circular arcs stay as they are, and Béziers and other
|
|
@@ -548,6 +558,42 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
548
558
|
* the chart's `format`; an empty string shows none, and a throw (reported) keeps the default.
|
|
549
559
|
*/
|
|
550
560
|
readonly labels?: false | ((value: number, series: string, format: (value: number) => string) => string);
|
|
561
|
+
/**
|
|
562
|
+
* How each line runs between its values. "linear", the default, is straight from value to value.
|
|
563
|
+
* "monotone" is d3's curveMonotoneX: a smooth curve through every value that's flat between two
|
|
564
|
+
* equal ones and never goes above or below the values either side, so it shows no value the data
|
|
565
|
+
* doesn't have. Each run between gaps is curved on its own, and a run of two values is straight. A
|
|
566
|
+
* curved line's samples are its rows' and one at each bend between them, so `threshold` changes
|
|
567
|
+
* colour where the drawn lines cross. A change of curve plays as a change; anything else throws a
|
|
568
|
+
* TypeError, and update() rejects it.
|
|
569
|
+
*/
|
|
570
|
+
readonly curve?: "linear" | "monotone";
|
|
571
|
+
/**
|
|
572
|
+
* What the pointer, touch and the keys hover. "x", the default: every series' point at the nearest
|
|
573
|
+
* x, with a crosshair, nothing dimmed, and the x's as focus stops. "point": the revealed point nearest
|
|
574
|
+
* the pointer, by distance, anywhere over the plot (of two as near, the series first in `series`),
|
|
575
|
+
* alone. Its line stays at full strength and every other line and point dims, unless `dim` is false;
|
|
576
|
+
* there's no crosshair, and the tooltip sits above the point. The points are the focus stops: Left
|
|
577
|
+
* and Right go along the line, Up and Down to the point above or below. Links still go by x. Anything
|
|
578
|
+
* else throws a TypeError. update({ hover }) changes it at once: a held hover ends, and focus moves
|
|
579
|
+
* to the nearest stop of the new kind.
|
|
580
|
+
*/
|
|
581
|
+
readonly hover?: "x" | "point";
|
|
582
|
+
/**
|
|
583
|
+
* A box beside the hovered or focused x or point, as on every chart. A function is given the row
|
|
584
|
+
* and, with `hover: "point"`, the point's series as a second argument: (d, { series }) => text. With
|
|
585
|
+
* "x" it's given the row alone.
|
|
586
|
+
*/
|
|
587
|
+
readonly tooltip?: boolean | ((d: NoInfer<D>, point?: {
|
|
588
|
+
readonly series: string;
|
|
589
|
+
}) => string);
|
|
590
|
+
/**
|
|
591
|
+
* Px the layout keeps clear to the right of the end labels, or of the lines' ends with `labels:
|
|
592
|
+
* false`, for text an effect draws past them: a `delta` past a line's end label. The plot is that
|
|
593
|
+
* much narrower, and the end labels stay beside it. Default 0. Anything but a number of px, 0 or
|
|
594
|
+
* more, throws a RangeError, and update({ room }) lays the chart out again.
|
|
595
|
+
*/
|
|
596
|
+
readonly room?: number;
|
|
551
597
|
}
|
|
552
598
|
interface LineChart<D> extends Chart<D, LineChartOptions<D>> {
|
|
553
599
|
/**
|
|
@@ -596,7 +642,8 @@ interface Chart<D, O> {
|
|
|
596
642
|
/**
|
|
597
643
|
* Moves focus to the mark `key` as a key press would, whatever the last input was: the focus ring
|
|
598
644
|
* shows and its hover plays. On a line chart it's the x's focus stop: `key` is the x's key, or one
|
|
599
|
-
* of its points'.
|
|
645
|
+
* of its points'. With `hover: "point"` it's the point's: its own key, or an x's, for its first
|
|
646
|
+
* series' point there. A key that isn't on screen (unknown, leaving, or past a line's reveal) does nothing.
|
|
600
647
|
*/
|
|
601
648
|
focus(key: string): void;
|
|
602
649
|
/**
|
|
@@ -657,13 +704,15 @@ interface ExpressiveOptions<D> {
|
|
|
657
704
|
readonly value?: (datum: D, element: Element) => number | string | boolean | null | undefined;
|
|
658
705
|
/**
|
|
659
706
|
* Describes every mark yourself, instead of the adapter reading them. Without it, a `<rect>` is a
|
|
660
|
-
* bar (rects that share a key are its segments
|
|
661
|
-
* that stretches it unevenly or skews it),
|
|
662
|
-
* `<
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
*
|
|
707
|
+
* bar (rects that share a key are its segments; one of its own turned or skewed is a shape), a
|
|
708
|
+
* `<circle>` a point (an ellipse under a transform that stretches it unevenly or skews it), a
|
|
709
|
+
* `<path>` that draws a ring's slice that slice, read with `describe.arc`, and any other `<path>`, a
|
|
710
|
+
* `<line>`, `<polyline>`, `<polygon>` or `<ellipse>` a shape, read with `describe.shape` from its
|
|
711
|
+
* outline, an open one with its stroke width as drawn. Each is read through its transforms, and a
|
|
712
|
+
* shape SVG wouldn't draw (a path with no path data) isn't a mark until it draws something. Any
|
|
713
|
+
* other element (`<text>`, `<g>`, `<use>`, `<image>`) throws, naming its tag. Use this for those,
|
|
714
|
+
* or to say more or other than an element shows: a padded donut's slice as `describe.arc`, which
|
|
715
|
+
* goes round the donut's centre, or a line by its points.
|
|
667
716
|
* Called once per mark, with its first element in document order, in the coordinates of the marks'
|
|
668
717
|
* nearest common ancestor. Build it with `describe` and give it the key passed in.
|
|
669
718
|
*/
|
|
@@ -814,7 +863,7 @@ interface VegaItem {
|
|
|
814
863
|
readonly cornerRadius?: number;
|
|
815
864
|
/** False for a line's point Vega leaves out, which breaks the line there. */
|
|
816
865
|
readonly defined?: boolean;
|
|
817
|
-
/** How a line is drawn between its points:
|
|
866
|
+
/** How a line is drawn between its points: "linear" (or unset) is read from the items, any other curve from the path Vega draws. */
|
|
818
867
|
readonly interpolate?: string;
|
|
819
868
|
}
|
|
820
869
|
/** A value for data effects: alone, or with where it is along x (`at`), which threshold matches series by. */
|
|
@@ -872,7 +921,8 @@ export declare function link<S extends LinkSource<unknown>>(sources: readonly S[
|
|
|
872
921
|
/**
|
|
873
922
|
* What a chart switch uses of each view's chart. A reference chart's handle has all of it: its
|
|
874
923
|
* `<svg>` (which takes `ec-morphing` while its marks morph in the switch's overlay), its marks and
|
|
875
|
-
* labels as drawn, focus by key, leave() to end its hover, and destroy()
|
|
924
|
+
* labels as drawn, focus by key, leave() to end its hover, and destroy(); how it paints each mark
|
|
925
|
+
* (paintOf), and, a line chart's, what its focus stops stand for (standsFor). A reference chart also
|
|
876
926
|
* has on(), which the switch's on() hears, and a hover a link can drive; a view without them isn't
|
|
877
927
|
* heard and isn't linked.
|
|
878
928
|
*/
|
|
@@ -883,6 +933,24 @@ interface ChartSwitchView {
|
|
|
883
933
|
focus(key: string): void;
|
|
884
934
|
leave(): void;
|
|
885
935
|
destroy(): void;
|
|
936
|
+
/**
|
|
937
|
+
* How the chart paints the mark `key`: the name its colour comes from, and whether it's drawn at
|
|
938
|
+
* rest. Without it, or for a key it doesn't know, the switch draws the mark in its key's colour.
|
|
939
|
+
*/
|
|
940
|
+
paintOf?(key: string): ChartSwitchPaint | undefined;
|
|
941
|
+
/**
|
|
942
|
+
* The keys the focus stop `key` stands for, in the order the next view's focus(key) is tried with
|
|
943
|
+
* them: a line chart's x stands for each series' point key there, in series order, then itself.
|
|
944
|
+
* Without it, a stop stands for its own key.
|
|
945
|
+
*/
|
|
946
|
+
standsFor?(key: string): readonly string[];
|
|
947
|
+
}
|
|
948
|
+
/** How a view's chart paints one of its marks: what a switch draws it in. */
|
|
949
|
+
interface ChartSwitchPaint {
|
|
950
|
+
/** The name its colour comes from in the switch's assignment (`colors.slot(color)`): a line's or a point's series, a bar's key or first series, a slice's key. */
|
|
951
|
+
readonly color: string;
|
|
952
|
+
/** Whether the chart draws it at rest. A line chart's points aren't, but for a value alone between gaps; a mark that isn't starts or ends a switch as a dot of no size at its centre. */
|
|
953
|
+
readonly drawn: boolean;
|
|
886
954
|
}
|
|
887
955
|
/**
|
|
888
956
|
* Draws one view's chart in `container` and returns it. `colors` is the switch's assignment: pass it
|
|
@@ -1222,8 +1290,18 @@ interface MorphOptions {
|
|
|
1222
1290
|
* `align: "drop"` the pairing is turned by a quarter, from a mark that goes round its pivot (a
|
|
1223
1291
|
* slice) to one that doesn't (a bar), whichever is `from`: so a switch back retraces the same
|
|
1224
1292
|
* pairing instead of twisting. Between two marks of the same kind, "drop" pairs as "unroll" does.
|
|
1293
|
+
* Holes (the subpaths of an outline's `d` other than the longest) morph too: they pair by area,
|
|
1294
|
+
* largest with largest, each sampled at a quarter of `points` from its upper left. One with no
|
|
1295
|
+
* partner closes by half way, or opens after it, while its centre heads for where it lands in the
|
|
1296
|
+
* other mark: its centre's place in the other's bounds, or the deepest point of its filled area
|
|
1297
|
+
* where that place is outside it or near its edge. Where it would leave the shape on the way, it
|
|
1298
|
+
* closes sooner, as soon as a sixteenth of the way. Each is written the other way round from the
|
|
1299
|
+
* outside, so it stays a hole under either fill rule.
|
|
1225
1300
|
* - **Two open outlines** (lines): both strokes are sampled along their length, and the stroke's
|
|
1226
|
-
* width moves from one thickness to the other.
|
|
1301
|
+
* width moves from one thickness to the other. Where either line has `gaps`, the stroke inside a
|
|
1302
|
+
* gap of the old line fades in and inside a gap of the new line fades out, each piece at an
|
|
1303
|
+
* opacity of 1 − ((1 − p) · a + p · b), with p the eased progress and a and b 1 inside the old and
|
|
1304
|
+
* the new line's gap: so nothing is drawn inside a gap both have.
|
|
1227
1305
|
* - **A closed and an open outline** crossfade: the first fades out as the second fades in.
|
|
1228
1306
|
*
|
|
1229
1307
|
* A run from `ctx.start` begins with the shapes there, in their eased progress, and takes the rest
|
|
@@ -1343,7 +1421,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
|
|
|
1343
1421
|
* has the same rules. For a CSP that allows no inline styles at all.
|
|
1344
1422
|
*/
|
|
1345
1423
|
export declare function configure(options: StyleOptions): void;
|
|
1346
|
-
export declare const VERSION = "0.
|
|
1424
|
+
export declare const VERSION = "0.6.0";
|
|
1347
1425
|
/**
|
|
1348
1426
|
* A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
|
|
1349
1427
|
* category; `stack` stacks numeric fields; `on` attaches effects by slot.
|
|
@@ -1388,5 +1466,5 @@ export declare function fromVegaView<D = Record<string, unknown>>(view: VegaView
|
|
|
1388
1466
|
* page-wide `motion`. `persist: "key"` saves the choice in localStorage.
|
|
1389
1467
|
*/
|
|
1390
1468
|
export declare function motionSwitch(target: string | Element, motion?: Motion, options?: MotionSwitchOptions): MotionSwitch;
|
|
1391
|
-
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 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 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 HostMark, 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 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 };
|
|
1469
|
+
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 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 HostMark, 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 };
|
|
1392
1470
|
//# sourceMappingURL=index.d.ts.map
|