expressive-charts 0.6.0 → 0.7.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 +23 -0
- package/README.md +6 -6
- package/dist/{drawing-Ypmq-2h6.d.ts → drawing-OmQV-0BB.d.cts} +8 -2
- package/dist/{drawing-Ypmq-2h6.d.cts → drawing-OmQV-0BB.d.ts} +8 -2
- package/dist/{effect-D8W4ZmmG.d.cts → effect-DYCLY_6e.d.cts} +2 -2
- package/dist/{effect-DyzluQD1.d.ts → effect-HCWnmB72.d.ts} +2 -2
- package/dist/expressive-charts.global.js +10 -10
- 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 +476 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -17
- package/dist/index.d.ts +64 -17
- package/dist/index.js +476 -110
- package/dist/index.js.map +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +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-
|
|
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-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
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. */
|
|
@@ -590,10 +590,16 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
590
590
|
/**
|
|
591
591
|
* Px the layout keeps clear to the right of the end labels, or of the lines' ends with `labels:
|
|
592
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.
|
|
594
|
-
*
|
|
593
|
+
* much narrower, and the end labels stay beside it. Default 0. `{ right, top }` keeps `top` px
|
|
594
|
+
* clear above the plot too, below the chart's top, for text an effect draws above it: a `delta`
|
|
595
|
+
* past a line that ends near the top heading up. The plot is that much shorter. A side that isn't
|
|
596
|
+
* given is 0, so a number is `{ right }`. Anything but a number of px, 0 or more, or an object of
|
|
597
|
+
* them by side, throws a RangeError, and update({ room }) lays the chart out again.
|
|
595
598
|
*/
|
|
596
|
-
readonly room?: number
|
|
599
|
+
readonly room?: number | {
|
|
600
|
+
readonly right?: number;
|
|
601
|
+
readonly top?: number;
|
|
602
|
+
};
|
|
597
603
|
}
|
|
598
604
|
interface LineChart<D> extends Chart<D, LineChartOptions<D>> {
|
|
599
605
|
/**
|
|
@@ -922,9 +928,9 @@ export declare function link<S extends LinkSource<unknown>>(sources: readonly S[
|
|
|
922
928
|
* What a chart switch uses of each view's chart. A reference chart's handle has all of it: its
|
|
923
929
|
* `<svg>` (which takes `ec-morphing` while its marks morph in the switch's overlay), its marks and
|
|
924
930
|
* labels as drawn, focus by key, leave() to end its hover, and destroy(); how it paints each mark
|
|
925
|
-
* (paintOf),
|
|
926
|
-
* has on(), which the switch's on() hears, and a
|
|
927
|
-
* heard and isn't linked.
|
|
931
|
+
* (paintOf), a line chart's what its focus stops stand for (standsFor), and its tab stop moved
|
|
932
|
+
* without focus (moveTabStop). A reference chart also has on(), which the switch's on() hears, and a
|
|
933
|
+
* hover a link can drive; a view without them isn't heard and isn't linked.
|
|
928
934
|
*/
|
|
929
935
|
interface ChartSwitchView {
|
|
930
936
|
readonly element: SVGSVGElement;
|
|
@@ -944,13 +950,24 @@ interface ChartSwitchView {
|
|
|
944
950
|
* Without it, a stop stands for its own key.
|
|
945
951
|
*/
|
|
946
952
|
standsFor?(key: string): readonly string[];
|
|
953
|
+
/**
|
|
954
|
+
* Moves the chart's tab stop to the stop focus(key) would focus, without focus, so no ring shows
|
|
955
|
+
* and nothing hovers: Tab lands there next. Returns whether it did. After a switch that focus
|
|
956
|
+
* wasn't in, the new view's tab stop goes to the first key the old one's stood for that it takes.
|
|
957
|
+
* Without it, a view keeps its own tab stop.
|
|
958
|
+
*/
|
|
959
|
+
moveTabStop?(key: string): boolean;
|
|
947
960
|
}
|
|
948
961
|
/** How a view's chart paints one of its marks: what a switch draws it in. */
|
|
949
962
|
interface ChartSwitchPaint {
|
|
950
963
|
/** 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
964
|
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. */
|
|
965
|
+
/** 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, with no end dot or ring. */
|
|
953
966
|
readonly drawn: boolean;
|
|
967
|
+
/** The radius of the dot the chart draws at the end of the mark's walk, in its `<svg>`'s units: a line chart's line has one of 4.5. Unset: no dot. */
|
|
968
|
+
readonly end?: number;
|
|
969
|
+
/** 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. */
|
|
970
|
+
readonly ring?: number;
|
|
954
971
|
}
|
|
955
972
|
/**
|
|
956
973
|
* Draws one view's chart in `container` and returns it. `colors` is the switch's assignment: pass it
|
|
@@ -1200,6 +1217,26 @@ interface TraceOptions {
|
|
|
1200
1217
|
* resize. Its end state is the whole stroke, so reduced motion shows what a full run ends with.
|
|
1201
1218
|
*/
|
|
1202
1219
|
export declare function trace(options?: TraceOptions): GeometryEffect;
|
|
1220
|
+
interface DrawInOptions {
|
|
1221
|
+
/** Base ms to draw the whole walk, before the motion mode scales it, with effect timing. Default 750. */
|
|
1222
|
+
readonly duration?: number;
|
|
1223
|
+
/** The mark's opacity while it draws in, from 0 to 1. Default 0.3, as hover dims the other marks. */
|
|
1224
|
+
readonly faint?: number;
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Draws the mark in along its walk, for `enter`. Its body goes to `faint`, and the overlay draws it
|
|
1228
|
+
* from its start to its end at its own width and colour, with butt caps, eased in and out over
|
|
1229
|
+
* `duration`. Then the mark is back at full strength, with nothing drawn. Its labels stay as they are.
|
|
1230
|
+
*
|
|
1231
|
+
* So a line draws along its stroke, its gaps left out; a bar from its baseline to its tip, a
|
|
1232
|
+
* rectangle at its width; a slice round its mid-radius arc, at its ring's width. A stack draws each
|
|
1233
|
+
* segment in turn, in its own colour (`Paint.part`), each eased in and out over its share of the time,
|
|
1234
|
+
* its share of the length. A walk under 0.5 px (a point, a closed shape) finishes at once.
|
|
1235
|
+
*
|
|
1236
|
+
* It follows `onChange`, drawing again at the same progress, so it keeps to a mark that grows or
|
|
1237
|
+
* moves while it plays. Its end state is the mark as it is, so reduced motion shows it at once.
|
|
1238
|
+
*/
|
|
1239
|
+
export declare function drawIn(options?: DrawInOptions): GeometryEffect;
|
|
1203
1240
|
interface DeltaOptions<D = unknown> {
|
|
1204
1241
|
/** The mark's value. Default: its last sample's, so a bar's total, a line's value at its revealed end, a slice's share. */
|
|
1205
1242
|
readonly value?: (data: MarkData<D>) => number;
|
|
@@ -1268,7 +1305,11 @@ export declare function threshold(options: ThresholdOptions): DataEffect;
|
|
|
1268
1305
|
/** How two closed outlines' sides are matched. */
|
|
1269
1306
|
type MorphAlign = "unroll" | "drop";
|
|
1270
1307
|
interface MorphOptions {
|
|
1271
|
-
/**
|
|
1308
|
+
/**
|
|
1309
|
+
* Points sampled on each outline, a whole multiple of 4 (a quarter on each side of a closed one).
|
|
1310
|
+
* Default 160, the lab's 40 a side. Two lines that pair by x are sampled at this many shares
|
|
1311
|
+
* evenly across, and at each vertex.
|
|
1312
|
+
*/
|
|
1272
1313
|
readonly points?: number;
|
|
1273
1314
|
/**
|
|
1274
1315
|
* How two closed outlines' sides are matched:
|
|
@@ -1297,11 +1338,17 @@ interface MorphOptions {
|
|
|
1297
1338
|
* where that place is outside it or near its edge. Where it would leave the shape on the way, it
|
|
1298
1339
|
* closes sooner, as soon as a sixteenth of the way. Each is written the other way round from the
|
|
1299
1340
|
* outside, so it stays a hole under either fill rule.
|
|
1300
|
-
* - **Two
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
* the
|
|
1341
|
+
* - **Two lines that each run one way across x** (every vertex's x more than the one before, or
|
|
1342
|
+
* every one less, the same way for both) pair by x: the point a share of the way across one
|
|
1343
|
+
* line's x span moves to the point that share across the other's. They're sampled at `points`
|
|
1344
|
+
* shares evenly across, and at each vertex of either line, which is where each gap begins and
|
|
1345
|
+
* ends: so the first and last frames are the lines' own polylines, corners and all, and two lines
|
|
1346
|
+
* missing the same x's have their gaps in the same place.
|
|
1347
|
+
* - **Any other two open outlines** (lines): both strokes are sampled along their length.
|
|
1348
|
+
* - Either way, the stroke's width moves from one thickness to the other. Where either line has
|
|
1349
|
+
* `gaps`, the stroke inside a gap of the old line fades in and inside a gap of the new line fades
|
|
1350
|
+
* out, each piece at an opacity of 1 − ((1 − p) · a + p · b), with p the eased progress and a and
|
|
1351
|
+
* b 1 inside the old and the new line's gap: so nothing is drawn inside a gap both have.
|
|
1305
1352
|
* - **A closed and an open outline** crossfade: the first fades out as the second fades in.
|
|
1306
1353
|
*
|
|
1307
1354
|
* A run from `ctx.start` begins with the shapes there, in their eased progress, and takes the rest
|
|
@@ -1421,7 +1468,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
|
|
|
1421
1468
|
* has the same rules. For a CSP that allows no inline styles at all.
|
|
1422
1469
|
*/
|
|
1423
1470
|
export declare function configure(options: StyleOptions): void;
|
|
1424
|
-
export declare const VERSION = "0.
|
|
1471
|
+
export declare const VERSION = "0.7.0";
|
|
1425
1472
|
/**
|
|
1426
1473
|
* A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
|
|
1427
1474
|
* category; `stack` stacks numeric fields; `on` attaches effects by slot.
|
|
@@ -1466,5 +1513,5 @@ export declare function fromVegaView<D = Record<string, unknown>>(view: VegaView
|
|
|
1466
1513
|
* page-wide `motion`. `persist: "key"` saves the choice in localStorage.
|
|
1467
1514
|
*/
|
|
1468
1515
|
export declare function motionSwitch(target: string | Element, motion?: Motion, options?: MotionSwitchOptions): MotionSwitch;
|
|
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 };
|
|
1516
|
+
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 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 };
|
|
1470
1517
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +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-
|
|
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-HCWnmB72.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-OmQV-0BB.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. */
|
|
@@ -590,10 +590,16 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
590
590
|
/**
|
|
591
591
|
* Px the layout keeps clear to the right of the end labels, or of the lines' ends with `labels:
|
|
592
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.
|
|
594
|
-
*
|
|
593
|
+
* much narrower, and the end labels stay beside it. Default 0. `{ right, top }` keeps `top` px
|
|
594
|
+
* clear above the plot too, below the chart's top, for text an effect draws above it: a `delta`
|
|
595
|
+
* past a line that ends near the top heading up. The plot is that much shorter. A side that isn't
|
|
596
|
+
* given is 0, so a number is `{ right }`. Anything but a number of px, 0 or more, or an object of
|
|
597
|
+
* them by side, throws a RangeError, and update({ room }) lays the chart out again.
|
|
595
598
|
*/
|
|
596
|
-
readonly room?: number
|
|
599
|
+
readonly room?: number | {
|
|
600
|
+
readonly right?: number;
|
|
601
|
+
readonly top?: number;
|
|
602
|
+
};
|
|
597
603
|
}
|
|
598
604
|
interface LineChart<D> extends Chart<D, LineChartOptions<D>> {
|
|
599
605
|
/**
|
|
@@ -922,9 +928,9 @@ export declare function link<S extends LinkSource<unknown>>(sources: readonly S[
|
|
|
922
928
|
* What a chart switch uses of each view's chart. A reference chart's handle has all of it: its
|
|
923
929
|
* `<svg>` (which takes `ec-morphing` while its marks morph in the switch's overlay), its marks and
|
|
924
930
|
* labels as drawn, focus by key, leave() to end its hover, and destroy(); how it paints each mark
|
|
925
|
-
* (paintOf),
|
|
926
|
-
* has on(), which the switch's on() hears, and a
|
|
927
|
-
* heard and isn't linked.
|
|
931
|
+
* (paintOf), a line chart's what its focus stops stand for (standsFor), and its tab stop moved
|
|
932
|
+
* without focus (moveTabStop). A reference chart also has on(), which the switch's on() hears, and a
|
|
933
|
+
* hover a link can drive; a view without them isn't heard and isn't linked.
|
|
928
934
|
*/
|
|
929
935
|
interface ChartSwitchView {
|
|
930
936
|
readonly element: SVGSVGElement;
|
|
@@ -944,13 +950,24 @@ interface ChartSwitchView {
|
|
|
944
950
|
* Without it, a stop stands for its own key.
|
|
945
951
|
*/
|
|
946
952
|
standsFor?(key: string): readonly string[];
|
|
953
|
+
/**
|
|
954
|
+
* Moves the chart's tab stop to the stop focus(key) would focus, without focus, so no ring shows
|
|
955
|
+
* and nothing hovers: Tab lands there next. Returns whether it did. After a switch that focus
|
|
956
|
+
* wasn't in, the new view's tab stop goes to the first key the old one's stood for that it takes.
|
|
957
|
+
* Without it, a view keeps its own tab stop.
|
|
958
|
+
*/
|
|
959
|
+
moveTabStop?(key: string): boolean;
|
|
947
960
|
}
|
|
948
961
|
/** How a view's chart paints one of its marks: what a switch draws it in. */
|
|
949
962
|
interface ChartSwitchPaint {
|
|
950
963
|
/** 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
964
|
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. */
|
|
965
|
+
/** 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, with no end dot or ring. */
|
|
953
966
|
readonly drawn: boolean;
|
|
967
|
+
/** The radius of the dot the chart draws at the end of the mark's walk, in its `<svg>`'s units: a line chart's line has one of 4.5. Unset: no dot. */
|
|
968
|
+
readonly end?: number;
|
|
969
|
+
/** 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. */
|
|
970
|
+
readonly ring?: number;
|
|
954
971
|
}
|
|
955
972
|
/**
|
|
956
973
|
* Draws one view's chart in `container` and returns it. `colors` is the switch's assignment: pass it
|
|
@@ -1200,6 +1217,26 @@ interface TraceOptions {
|
|
|
1200
1217
|
* resize. Its end state is the whole stroke, so reduced motion shows what a full run ends with.
|
|
1201
1218
|
*/
|
|
1202
1219
|
export declare function trace(options?: TraceOptions): GeometryEffect;
|
|
1220
|
+
interface DrawInOptions {
|
|
1221
|
+
/** Base ms to draw the whole walk, before the motion mode scales it, with effect timing. Default 750. */
|
|
1222
|
+
readonly duration?: number;
|
|
1223
|
+
/** The mark's opacity while it draws in, from 0 to 1. Default 0.3, as hover dims the other marks. */
|
|
1224
|
+
readonly faint?: number;
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Draws the mark in along its walk, for `enter`. Its body goes to `faint`, and the overlay draws it
|
|
1228
|
+
* from its start to its end at its own width and colour, with butt caps, eased in and out over
|
|
1229
|
+
* `duration`. Then the mark is back at full strength, with nothing drawn. Its labels stay as they are.
|
|
1230
|
+
*
|
|
1231
|
+
* So a line draws along its stroke, its gaps left out; a bar from its baseline to its tip, a
|
|
1232
|
+
* rectangle at its width; a slice round its mid-radius arc, at its ring's width. A stack draws each
|
|
1233
|
+
* segment in turn, in its own colour (`Paint.part`), each eased in and out over its share of the time,
|
|
1234
|
+
* its share of the length. A walk under 0.5 px (a point, a closed shape) finishes at once.
|
|
1235
|
+
*
|
|
1236
|
+
* It follows `onChange`, drawing again at the same progress, so it keeps to a mark that grows or
|
|
1237
|
+
* moves while it plays. Its end state is the mark as it is, so reduced motion shows it at once.
|
|
1238
|
+
*/
|
|
1239
|
+
export declare function drawIn(options?: DrawInOptions): GeometryEffect;
|
|
1203
1240
|
interface DeltaOptions<D = unknown> {
|
|
1204
1241
|
/** The mark's value. Default: its last sample's, so a bar's total, a line's value at its revealed end, a slice's share. */
|
|
1205
1242
|
readonly value?: (data: MarkData<D>) => number;
|
|
@@ -1268,7 +1305,11 @@ export declare function threshold(options: ThresholdOptions): DataEffect;
|
|
|
1268
1305
|
/** How two closed outlines' sides are matched. */
|
|
1269
1306
|
type MorphAlign = "unroll" | "drop";
|
|
1270
1307
|
interface MorphOptions {
|
|
1271
|
-
/**
|
|
1308
|
+
/**
|
|
1309
|
+
* Points sampled on each outline, a whole multiple of 4 (a quarter on each side of a closed one).
|
|
1310
|
+
* Default 160, the lab's 40 a side. Two lines that pair by x are sampled at this many shares
|
|
1311
|
+
* evenly across, and at each vertex.
|
|
1312
|
+
*/
|
|
1272
1313
|
readonly points?: number;
|
|
1273
1314
|
/**
|
|
1274
1315
|
* How two closed outlines' sides are matched:
|
|
@@ -1297,11 +1338,17 @@ interface MorphOptions {
|
|
|
1297
1338
|
* where that place is outside it or near its edge. Where it would leave the shape on the way, it
|
|
1298
1339
|
* closes sooner, as soon as a sixteenth of the way. Each is written the other way round from the
|
|
1299
1340
|
* outside, so it stays a hole under either fill rule.
|
|
1300
|
-
* - **Two
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
* the
|
|
1341
|
+
* - **Two lines that each run one way across x** (every vertex's x more than the one before, or
|
|
1342
|
+
* every one less, the same way for both) pair by x: the point a share of the way across one
|
|
1343
|
+
* line's x span moves to the point that share across the other's. They're sampled at `points`
|
|
1344
|
+
* shares evenly across, and at each vertex of either line, which is where each gap begins and
|
|
1345
|
+
* ends: so the first and last frames are the lines' own polylines, corners and all, and two lines
|
|
1346
|
+
* missing the same x's have their gaps in the same place.
|
|
1347
|
+
* - **Any other two open outlines** (lines): both strokes are sampled along their length.
|
|
1348
|
+
* - Either way, the stroke's width moves from one thickness to the other. Where either line has
|
|
1349
|
+
* `gaps`, the stroke inside a gap of the old line fades in and inside a gap of the new line fades
|
|
1350
|
+
* out, each piece at an opacity of 1 − ((1 − p) · a + p · b), with p the eased progress and a and
|
|
1351
|
+
* b 1 inside the old and the new line's gap: so nothing is drawn inside a gap both have.
|
|
1305
1352
|
* - **A closed and an open outline** crossfade: the first fades out as the second fades in.
|
|
1306
1353
|
*
|
|
1307
1354
|
* A run from `ctx.start` begins with the shapes there, in their eased progress, and takes the rest
|
|
@@ -1421,7 +1468,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
|
|
|
1421
1468
|
* has the same rules. For a CSP that allows no inline styles at all.
|
|
1422
1469
|
*/
|
|
1423
1470
|
export declare function configure(options: StyleOptions): void;
|
|
1424
|
-
export declare const VERSION = "0.
|
|
1471
|
+
export declare const VERSION = "0.7.0";
|
|
1425
1472
|
/**
|
|
1426
1473
|
* A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
|
|
1427
1474
|
* category; `stack` stacks numeric fields; `on` attaches effects by slot.
|
|
@@ -1466,5 +1513,5 @@ export declare function fromVegaView<D = Record<string, unknown>>(view: VegaView
|
|
|
1466
1513
|
* page-wide `motion`. `persist: "key"` saves the choice in localStorage.
|
|
1467
1514
|
*/
|
|
1468
1515
|
export declare function motionSwitch(target: string | Element, motion?: Motion, options?: MotionSwitchOptions): MotionSwitch;
|
|
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 };
|
|
1516
|
+
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 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 };
|
|
1470
1517
|
//# sourceMappingURL=index.d.ts.map
|