expressive-charts 0.6.0 → 0.8.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 +46 -0
- package/README.md +8 -8
- 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 +768 -193
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -22
- package/dist/index.d.ts +80 -22
- package/dist/index.js +768 -194
- package/dist/index.js.map +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/package.json +3 -3
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. */
|
|
@@ -531,11 +531,14 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
531
531
|
*/
|
|
532
532
|
readonly x: Accessor<D, number | Date>;
|
|
533
533
|
/**
|
|
534
|
-
* A time axis's zone: "UTC" (the default)
|
|
535
|
-
*
|
|
536
|
-
*
|
|
534
|
+
* A time axis's zone: "UTC" (the default), "local", the viewer's clock, or a zone's name as Intl
|
|
535
|
+
* knows it, such as "Europe/London". Ticks fall on its midnights, months, years, hours and minutes,
|
|
536
|
+
* through summer time, and the names, the tooltip and the table say times in it with no zone's name,
|
|
537
|
+
* but for a time that comes twice where the clocks go back, which adds its short name ("1:30 AM
|
|
538
|
+
* GMT+1", "01:30 BST" in en-GB). A date-only value such as new Date("2026-01-05") is UTC midnight,
|
|
539
|
+
* so in UTC it's 5 January on every machine. A name Intl doesn't know throws a TypeError.
|
|
537
540
|
*/
|
|
538
|
-
readonly timeZone?: "UTC" | "local";
|
|
541
|
+
readonly timeZone?: "UTC" | "local" | (string & {});
|
|
539
542
|
/**
|
|
540
543
|
* Words an x for people instead of the default: in each x's name, the tooltip's title, the table's
|
|
541
544
|
* row headers and the announcements, and as `markLabel`'s `category`. Given the x as the data has it,
|
|
@@ -551,6 +554,12 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
551
554
|
* series is missing there. NaN and the infinities throw.
|
|
552
555
|
*/
|
|
553
556
|
readonly series: readonly KeyOfType<D, number | null | undefined>[];
|
|
557
|
+
/**
|
|
558
|
+
* The word for a missing value: in the table's cell, and after the series' label in the x's name,
|
|
559
|
+
* the tooltip and `markLabel`'s default text ("goals missing"). Default "missing". Anything but a
|
|
560
|
+
* string with a word in it throws a TypeError, and update({ missing }) words them again.
|
|
561
|
+
*/
|
|
562
|
+
readonly missing?: string;
|
|
554
563
|
/**
|
|
555
564
|
* The label at each line's end, in the right margin: by default its value in `format` with its
|
|
556
565
|
* series' label ("52 goals"), counting between values while a change or a reveal plays. `false`
|
|
@@ -590,10 +599,16 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
590
599
|
/**
|
|
591
600
|
* Px the layout keeps clear to the right of the end labels, or of the lines' ends with `labels:
|
|
592
601
|
* 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
|
-
*
|
|
602
|
+
* much narrower, and the end labels stay beside it. Default 0. `{ right, top }` keeps `top` px
|
|
603
|
+
* clear above the plot too, below the chart's top, for text an effect draws above it: a `delta`
|
|
604
|
+
* past a line that ends near the top heading up. The plot is that much shorter. A side that isn't
|
|
605
|
+
* given is 0, so a number is `{ right }`. Anything but a number of px, 0 or more, or an object of
|
|
606
|
+
* them by side, throws a RangeError, and update({ room }) lays the chart out again.
|
|
595
607
|
*/
|
|
596
|
-
readonly room?: number
|
|
608
|
+
readonly room?: number | {
|
|
609
|
+
readonly right?: number;
|
|
610
|
+
readonly top?: number;
|
|
611
|
+
};
|
|
597
612
|
}
|
|
598
613
|
interface LineChart<D> extends Chart<D, LineChartOptions<D>> {
|
|
599
614
|
/**
|
|
@@ -899,7 +914,9 @@ interface LinkOptions<D> {
|
|
|
899
914
|
* A mark's linking value, given the mark and its data as a hover event has them. Default: its last
|
|
900
915
|
* sample's `at` if it has one (a line point's x), else its key (a bar's or a slice's category).
|
|
901
916
|
* Values are compared as strings, a Date by its ISO string, as keys are. Undefined or null links
|
|
902
|
-
* nothing, and so does a throw (reported).
|
|
917
|
+
* nothing, and so does a throw (reported). A line chart's x with every value missing has no point,
|
|
918
|
+
* so it's given a stand-in for one, keyed by the x, with the row and a sample at the x, whose value
|
|
919
|
+
* is NaN.
|
|
903
920
|
*/
|
|
904
921
|
readonly by?: (event: Pick<MarkEvent<D>, "mark" | "data">) => unknown;
|
|
905
922
|
/** Whether linked marks play their chart's hover effect. Default true; false keeps them to emphasis and dimming. */
|
|
@@ -922,9 +939,9 @@ export declare function link<S extends LinkSource<unknown>>(sources: readonly S[
|
|
|
922
939
|
* What a chart switch uses of each view's chart. A reference chart's handle has all of it: its
|
|
923
940
|
* `<svg>` (which takes `ec-morphing` while its marks morph in the switch's overlay), its marks and
|
|
924
941
|
* 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.
|
|
942
|
+
* (paintOf), a line chart's what its focus stops stand for (standsFor), and its tab stop moved
|
|
943
|
+
* without focus (moveTabStop). A reference chart also has on(), which the switch's on() hears, and a
|
|
944
|
+
* hover a link can drive; a view without them isn't heard and isn't linked.
|
|
928
945
|
*/
|
|
929
946
|
interface ChartSwitchView {
|
|
930
947
|
readonly element: SVGSVGElement;
|
|
@@ -944,13 +961,24 @@ interface ChartSwitchView {
|
|
|
944
961
|
* Without it, a stop stands for its own key.
|
|
945
962
|
*/
|
|
946
963
|
standsFor?(key: string): readonly string[];
|
|
964
|
+
/**
|
|
965
|
+
* Moves the chart's tab stop to the stop focus(key) would focus, without focus, so no ring shows
|
|
966
|
+
* and nothing hovers: Tab lands there next. Returns whether it did. After a switch that focus
|
|
967
|
+
* wasn't in, the new view's tab stop goes to the first key the old one's stood for that it takes.
|
|
968
|
+
* Without it, a view keeps its own tab stop.
|
|
969
|
+
*/
|
|
970
|
+
moveTabStop?(key: string): boolean;
|
|
947
971
|
}
|
|
948
972
|
/** How a view's chart paints one of its marks: what a switch draws it in. */
|
|
949
973
|
interface ChartSwitchPaint {
|
|
950
974
|
/** 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
975
|
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. */
|
|
976
|
+
/** 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
977
|
readonly drawn: boolean;
|
|
978
|
+
/** 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. */
|
|
979
|
+
readonly end?: number;
|
|
980
|
+
/** 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. */
|
|
981
|
+
readonly ring?: number;
|
|
954
982
|
}
|
|
955
983
|
/**
|
|
956
984
|
* Draws one view's chart in `container` and returns it. `colors` is the switch's assignment: pass it
|
|
@@ -1200,6 +1228,26 @@ interface TraceOptions {
|
|
|
1200
1228
|
* resize. Its end state is the whole stroke, so reduced motion shows what a full run ends with.
|
|
1201
1229
|
*/
|
|
1202
1230
|
export declare function trace(options?: TraceOptions): GeometryEffect;
|
|
1231
|
+
interface DrawInOptions {
|
|
1232
|
+
/** Base ms to draw the whole walk, before the motion mode scales it, with effect timing. Default 750. */
|
|
1233
|
+
readonly duration?: number;
|
|
1234
|
+
/** The mark's opacity while it draws in, from 0 to 1. Default 0.3, as hover dims the other marks. */
|
|
1235
|
+
readonly faint?: number;
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Draws the mark in along its walk, for `enter`. Its body goes to `faint`, and the overlay draws it
|
|
1239
|
+
* from its start to its end at its own width and colour, with butt caps, eased in and out over
|
|
1240
|
+
* `duration`. Then the mark is back at full strength, with nothing drawn. Its labels stay as they are.
|
|
1241
|
+
*
|
|
1242
|
+
* So a line draws along its stroke, its gaps left out; a bar from its baseline to its tip, a
|
|
1243
|
+
* rectangle at its width; a slice round its mid-radius arc, at its ring's width. A stack draws each
|
|
1244
|
+
* segment in turn, in its own colour (`Paint.part`), each eased in and out over its share of the time,
|
|
1245
|
+
* its share of the length. A walk under 0.5 px (a point, a closed shape) finishes at once.
|
|
1246
|
+
*
|
|
1247
|
+
* It follows `onChange`, drawing again at the same progress, so it keeps to a mark that grows or
|
|
1248
|
+
* moves while it plays. Its end state is the mark as it is, so reduced motion shows it at once.
|
|
1249
|
+
*/
|
|
1250
|
+
export declare function drawIn(options?: DrawInOptions): GeometryEffect;
|
|
1203
1251
|
interface DeltaOptions<D = unknown> {
|
|
1204
1252
|
/** 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
1253
|
readonly value?: (data: MarkData<D>) => number;
|
|
@@ -1268,7 +1316,11 @@ export declare function threshold(options: ThresholdOptions): DataEffect;
|
|
|
1268
1316
|
/** How two closed outlines' sides are matched. */
|
|
1269
1317
|
type MorphAlign = "unroll" | "drop";
|
|
1270
1318
|
interface MorphOptions {
|
|
1271
|
-
/**
|
|
1319
|
+
/**
|
|
1320
|
+
* Points sampled on each outline, a whole multiple of 4 (a quarter on each side of a closed one).
|
|
1321
|
+
* Default 160, the lab's 40 a side. Two lines that pair by x are sampled at this many shares
|
|
1322
|
+
* evenly across, and at each vertex.
|
|
1323
|
+
*/
|
|
1272
1324
|
readonly points?: number;
|
|
1273
1325
|
/**
|
|
1274
1326
|
* How two closed outlines' sides are matched:
|
|
@@ -1297,11 +1349,17 @@ interface MorphOptions {
|
|
|
1297
1349
|
* where that place is outside it or near its edge. Where it would leave the shape on the way, it
|
|
1298
1350
|
* closes sooner, as soon as a sixteenth of the way. Each is written the other way round from the
|
|
1299
1351
|
* outside, so it stays a hole under either fill rule.
|
|
1300
|
-
* - **Two
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
* the
|
|
1352
|
+
* - **Two lines that each run one way across x** (every vertex's x more than the one before, or
|
|
1353
|
+
* every one less, the same way for both) pair by x: the point a share of the way across one
|
|
1354
|
+
* line's x span moves to the point that share across the other's. They're sampled at `points`
|
|
1355
|
+
* shares evenly across, and at each vertex of either line, which is where each gap begins and
|
|
1356
|
+
* ends: so the first and last frames are the lines' own polylines, corners and all, and two lines
|
|
1357
|
+
* missing the same x's have their gaps in the same place.
|
|
1358
|
+
* - **Any other two open outlines** (lines): both strokes are sampled along their length.
|
|
1359
|
+
* - Either way, the stroke's width moves from one thickness to the other. Where either line has
|
|
1360
|
+
* `gaps`, the stroke inside a gap of the old line fades in and inside a gap of the new line fades
|
|
1361
|
+
* out, each piece at an opacity of 1 − ((1 − p) · a + p · b), with p the eased progress and a and
|
|
1362
|
+
* b 1 inside the old and the new line's gap: so nothing is drawn inside a gap both have.
|
|
1305
1363
|
* - **A closed and an open outline** crossfade: the first fades out as the second fades in.
|
|
1306
1364
|
*
|
|
1307
1365
|
* A run from `ctx.start` begins with the shapes there, in their eased progress, and takes the rest
|
|
@@ -1421,7 +1479,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
|
|
|
1421
1479
|
* has the same rules. For a CSP that allows no inline styles at all.
|
|
1422
1480
|
*/
|
|
1423
1481
|
export declare function configure(options: StyleOptions): void;
|
|
1424
|
-
export declare const VERSION = "0.
|
|
1482
|
+
export declare const VERSION = "0.8.0";
|
|
1425
1483
|
/**
|
|
1426
1484
|
* A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
|
|
1427
1485
|
* category; `stack` stacks numeric fields; `on` attaches effects by slot.
|
|
@@ -1466,5 +1524,5 @@ export declare function fromVegaView<D = Record<string, unknown>>(view: VegaView
|
|
|
1466
1524
|
* page-wide `motion`. `persist: "key"` saves the choice in localStorage.
|
|
1467
1525
|
*/
|
|
1468
1526
|
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 };
|
|
1527
|
+
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
1528
|
//# 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. */
|
|
@@ -531,11 +531,14 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
531
531
|
*/
|
|
532
532
|
readonly x: Accessor<D, number | Date>;
|
|
533
533
|
/**
|
|
534
|
-
* A time axis's zone: "UTC" (the default)
|
|
535
|
-
*
|
|
536
|
-
*
|
|
534
|
+
* A time axis's zone: "UTC" (the default), "local", the viewer's clock, or a zone's name as Intl
|
|
535
|
+
* knows it, such as "Europe/London". Ticks fall on its midnights, months, years, hours and minutes,
|
|
536
|
+
* through summer time, and the names, the tooltip and the table say times in it with no zone's name,
|
|
537
|
+
* but for a time that comes twice where the clocks go back, which adds its short name ("1:30 AM
|
|
538
|
+
* GMT+1", "01:30 BST" in en-GB). A date-only value such as new Date("2026-01-05") is UTC midnight,
|
|
539
|
+
* so in UTC it's 5 January on every machine. A name Intl doesn't know throws a TypeError.
|
|
537
540
|
*/
|
|
538
|
-
readonly timeZone?: "UTC" | "local";
|
|
541
|
+
readonly timeZone?: "UTC" | "local" | (string & {});
|
|
539
542
|
/**
|
|
540
543
|
* Words an x for people instead of the default: in each x's name, the tooltip's title, the table's
|
|
541
544
|
* row headers and the announcements, and as `markLabel`'s `category`. Given the x as the data has it,
|
|
@@ -551,6 +554,12 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
551
554
|
* series is missing there. NaN and the infinities throw.
|
|
552
555
|
*/
|
|
553
556
|
readonly series: readonly KeyOfType<D, number | null | undefined>[];
|
|
557
|
+
/**
|
|
558
|
+
* The word for a missing value: in the table's cell, and after the series' label in the x's name,
|
|
559
|
+
* the tooltip and `markLabel`'s default text ("goals missing"). Default "missing". Anything but a
|
|
560
|
+
* string with a word in it throws a TypeError, and update({ missing }) words them again.
|
|
561
|
+
*/
|
|
562
|
+
readonly missing?: string;
|
|
554
563
|
/**
|
|
555
564
|
* The label at each line's end, in the right margin: by default its value in `format` with its
|
|
556
565
|
* series' label ("52 goals"), counting between values while a change or a reveal plays. `false`
|
|
@@ -590,10 +599,16 @@ interface LineChartOptions<D> extends ChartOptions<D> {
|
|
|
590
599
|
/**
|
|
591
600
|
* Px the layout keeps clear to the right of the end labels, or of the lines' ends with `labels:
|
|
592
601
|
* 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
|
-
*
|
|
602
|
+
* much narrower, and the end labels stay beside it. Default 0. `{ right, top }` keeps `top` px
|
|
603
|
+
* clear above the plot too, below the chart's top, for text an effect draws above it: a `delta`
|
|
604
|
+
* past a line that ends near the top heading up. The plot is that much shorter. A side that isn't
|
|
605
|
+
* given is 0, so a number is `{ right }`. Anything but a number of px, 0 or more, or an object of
|
|
606
|
+
* them by side, throws a RangeError, and update({ room }) lays the chart out again.
|
|
595
607
|
*/
|
|
596
|
-
readonly room?: number
|
|
608
|
+
readonly room?: number | {
|
|
609
|
+
readonly right?: number;
|
|
610
|
+
readonly top?: number;
|
|
611
|
+
};
|
|
597
612
|
}
|
|
598
613
|
interface LineChart<D> extends Chart<D, LineChartOptions<D>> {
|
|
599
614
|
/**
|
|
@@ -899,7 +914,9 @@ interface LinkOptions<D> {
|
|
|
899
914
|
* A mark's linking value, given the mark and its data as a hover event has them. Default: its last
|
|
900
915
|
* sample's `at` if it has one (a line point's x), else its key (a bar's or a slice's category).
|
|
901
916
|
* Values are compared as strings, a Date by its ISO string, as keys are. Undefined or null links
|
|
902
|
-
* nothing, and so does a throw (reported).
|
|
917
|
+
* nothing, and so does a throw (reported). A line chart's x with every value missing has no point,
|
|
918
|
+
* so it's given a stand-in for one, keyed by the x, with the row and a sample at the x, whose value
|
|
919
|
+
* is NaN.
|
|
903
920
|
*/
|
|
904
921
|
readonly by?: (event: Pick<MarkEvent<D>, "mark" | "data">) => unknown;
|
|
905
922
|
/** Whether linked marks play their chart's hover effect. Default true; false keeps them to emphasis and dimming. */
|
|
@@ -922,9 +939,9 @@ export declare function link<S extends LinkSource<unknown>>(sources: readonly S[
|
|
|
922
939
|
* What a chart switch uses of each view's chart. A reference chart's handle has all of it: its
|
|
923
940
|
* `<svg>` (which takes `ec-morphing` while its marks morph in the switch's overlay), its marks and
|
|
924
941
|
* 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.
|
|
942
|
+
* (paintOf), a line chart's what its focus stops stand for (standsFor), and its tab stop moved
|
|
943
|
+
* without focus (moveTabStop). A reference chart also has on(), which the switch's on() hears, and a
|
|
944
|
+
* hover a link can drive; a view without them isn't heard and isn't linked.
|
|
928
945
|
*/
|
|
929
946
|
interface ChartSwitchView {
|
|
930
947
|
readonly element: SVGSVGElement;
|
|
@@ -944,13 +961,24 @@ interface ChartSwitchView {
|
|
|
944
961
|
* Without it, a stop stands for its own key.
|
|
945
962
|
*/
|
|
946
963
|
standsFor?(key: string): readonly string[];
|
|
964
|
+
/**
|
|
965
|
+
* Moves the chart's tab stop to the stop focus(key) would focus, without focus, so no ring shows
|
|
966
|
+
* and nothing hovers: Tab lands there next. Returns whether it did. After a switch that focus
|
|
967
|
+
* wasn't in, the new view's tab stop goes to the first key the old one's stood for that it takes.
|
|
968
|
+
* Without it, a view keeps its own tab stop.
|
|
969
|
+
*/
|
|
970
|
+
moveTabStop?(key: string): boolean;
|
|
947
971
|
}
|
|
948
972
|
/** How a view's chart paints one of its marks: what a switch draws it in. */
|
|
949
973
|
interface ChartSwitchPaint {
|
|
950
974
|
/** 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
975
|
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. */
|
|
976
|
+
/** 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
977
|
readonly drawn: boolean;
|
|
978
|
+
/** 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. */
|
|
979
|
+
readonly end?: number;
|
|
980
|
+
/** 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. */
|
|
981
|
+
readonly ring?: number;
|
|
954
982
|
}
|
|
955
983
|
/**
|
|
956
984
|
* Draws one view's chart in `container` and returns it. `colors` is the switch's assignment: pass it
|
|
@@ -1200,6 +1228,26 @@ interface TraceOptions {
|
|
|
1200
1228
|
* resize. Its end state is the whole stroke, so reduced motion shows what a full run ends with.
|
|
1201
1229
|
*/
|
|
1202
1230
|
export declare function trace(options?: TraceOptions): GeometryEffect;
|
|
1231
|
+
interface DrawInOptions {
|
|
1232
|
+
/** Base ms to draw the whole walk, before the motion mode scales it, with effect timing. Default 750. */
|
|
1233
|
+
readonly duration?: number;
|
|
1234
|
+
/** The mark's opacity while it draws in, from 0 to 1. Default 0.3, as hover dims the other marks. */
|
|
1235
|
+
readonly faint?: number;
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Draws the mark in along its walk, for `enter`. Its body goes to `faint`, and the overlay draws it
|
|
1239
|
+
* from its start to its end at its own width and colour, with butt caps, eased in and out over
|
|
1240
|
+
* `duration`. Then the mark is back at full strength, with nothing drawn. Its labels stay as they are.
|
|
1241
|
+
*
|
|
1242
|
+
* So a line draws along its stroke, its gaps left out; a bar from its baseline to its tip, a
|
|
1243
|
+
* rectangle at its width; a slice round its mid-radius arc, at its ring's width. A stack draws each
|
|
1244
|
+
* segment in turn, in its own colour (`Paint.part`), each eased in and out over its share of the time,
|
|
1245
|
+
* its share of the length. A walk under 0.5 px (a point, a closed shape) finishes at once.
|
|
1246
|
+
*
|
|
1247
|
+
* It follows `onChange`, drawing again at the same progress, so it keeps to a mark that grows or
|
|
1248
|
+
* moves while it plays. Its end state is the mark as it is, so reduced motion shows it at once.
|
|
1249
|
+
*/
|
|
1250
|
+
export declare function drawIn(options?: DrawInOptions): GeometryEffect;
|
|
1203
1251
|
interface DeltaOptions<D = unknown> {
|
|
1204
1252
|
/** 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
1253
|
readonly value?: (data: MarkData<D>) => number;
|
|
@@ -1268,7 +1316,11 @@ export declare function threshold(options: ThresholdOptions): DataEffect;
|
|
|
1268
1316
|
/** How two closed outlines' sides are matched. */
|
|
1269
1317
|
type MorphAlign = "unroll" | "drop";
|
|
1270
1318
|
interface MorphOptions {
|
|
1271
|
-
/**
|
|
1319
|
+
/**
|
|
1320
|
+
* Points sampled on each outline, a whole multiple of 4 (a quarter on each side of a closed one).
|
|
1321
|
+
* Default 160, the lab's 40 a side. Two lines that pair by x are sampled at this many shares
|
|
1322
|
+
* evenly across, and at each vertex.
|
|
1323
|
+
*/
|
|
1272
1324
|
readonly points?: number;
|
|
1273
1325
|
/**
|
|
1274
1326
|
* How two closed outlines' sides are matched:
|
|
@@ -1297,11 +1349,17 @@ interface MorphOptions {
|
|
|
1297
1349
|
* where that place is outside it or near its edge. Where it would leave the shape on the way, it
|
|
1298
1350
|
* closes sooner, as soon as a sixteenth of the way. Each is written the other way round from the
|
|
1299
1351
|
* outside, so it stays a hole under either fill rule.
|
|
1300
|
-
* - **Two
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
* the
|
|
1352
|
+
* - **Two lines that each run one way across x** (every vertex's x more than the one before, or
|
|
1353
|
+
* every one less, the same way for both) pair by x: the point a share of the way across one
|
|
1354
|
+
* line's x span moves to the point that share across the other's. They're sampled at `points`
|
|
1355
|
+
* shares evenly across, and at each vertex of either line, which is where each gap begins and
|
|
1356
|
+
* ends: so the first and last frames are the lines' own polylines, corners and all, and two lines
|
|
1357
|
+
* missing the same x's have their gaps in the same place.
|
|
1358
|
+
* - **Any other two open outlines** (lines): both strokes are sampled along their length.
|
|
1359
|
+
* - Either way, the stroke's width moves from one thickness to the other. Where either line has
|
|
1360
|
+
* `gaps`, the stroke inside a gap of the old line fades in and inside a gap of the new line fades
|
|
1361
|
+
* out, each piece at an opacity of 1 − ((1 − p) · a + p · b), with p the eased progress and a and
|
|
1362
|
+
* b 1 inside the old and the new line's gap: so nothing is drawn inside a gap both have.
|
|
1305
1363
|
* - **A closed and an open outline** crossfade: the first fades out as the second fades in.
|
|
1306
1364
|
*
|
|
1307
1365
|
* A run from `ctx.start` begins with the shapes there, in their eased progress, and takes the rest
|
|
@@ -1421,7 +1479,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
|
|
|
1421
1479
|
* has the same rules. For a CSP that allows no inline styles at all.
|
|
1422
1480
|
*/
|
|
1423
1481
|
export declare function configure(options: StyleOptions): void;
|
|
1424
|
-
export declare const VERSION = "0.
|
|
1482
|
+
export declare const VERSION = "0.8.0";
|
|
1425
1483
|
/**
|
|
1426
1484
|
* A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
|
|
1427
1485
|
* category; `stack` stacks numeric fields; `on` attaches effects by slot.
|
|
@@ -1466,5 +1524,5 @@ export declare function fromVegaView<D = Record<string, unknown>>(view: VegaView
|
|
|
1466
1524
|
* page-wide `motion`. `persist: "key"` saves the choice in localStorage.
|
|
1467
1525
|
*/
|
|
1468
1526
|
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 };
|
|
1527
|
+
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
1528
|
//# sourceMappingURL=index.d.ts.map
|