expressive-charts 0.4.0 → 0.5.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 +33 -0
- package/README.md +5 -5
- 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-C786hGyJ.d.cts} +2 -2
- package/dist/{effect-CdH5449m.d.ts → effect-CMo-2gPf.d.ts} +2 -2
- 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 +686 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -5
- package/dist/index.d.ts +45 -5
- package/dist/index.js +659 -105
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +28 -14
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/{transition-DSRt2DH3.js → transition-Bu1NsQor.js} +30 -16
- package/dist/transition-Bu1NsQor.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 Easing, C as ScalingTable, D as mediaReducedMotion, E as defaultScaling, F as FrameSource, I as ManualClock, L as createClock, M as easeOutCubic, N as linear, O as motion, P as Clock, R as defaultClock, S as ScalingRule, T as createMotion, _ as MotionMode, a as GeometryEffect, b as ReducedMotionSource, c as TransitionEffect, d as MotionEnv, f as Tween, g as Motion, h as tween, i as EffectContext, j as easeInOutCubic, k as scaleDuration, l as MarkData, m as TweenResult, n as Combined, o as MarkEffect, p as TweenOptions, r as DataEffect, s as TransitionContext, t as AnyMarkEffect, u as Sample, v as MotionOptions, w as Timing, x as ScalingOverrides, y as MotionView, z as manualClock } 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 Easing, C as ScalingTable, D as mediaReducedMotion, E as defaultScaling, F as FrameSource, I as ManualClock, L as createClock, M as easeOutCubic, N as linear, O as motion, P as Clock, R as defaultClock, S as ScalingRule, T as createMotion, _ as MotionMode, a as GeometryEffect, b as ReducedMotionSource, c as TransitionEffect, d as MotionEnv, f as Tween, g as Motion, h as tween, i as EffectContext, j as easeInOutCubic, k as scaleDuration, l as MarkData, m as TweenResult, n as Combined, o as MarkEffect, p as TweenOptions, r as DataEffect, s as TransitionContext, t as AnyMarkEffect, u as Sample, v as MotionOptions, w as Timing, x as ScalingOverrides, y as MotionView, z as manualClock } from "./effect-C786hGyJ.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,35 @@ 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);
|
|
551
590
|
}
|
|
552
591
|
interface LineChart<D> extends Chart<D, LineChartOptions<D>> {
|
|
553
592
|
/**
|
|
@@ -596,7 +635,8 @@ interface Chart<D, O> {
|
|
|
596
635
|
/**
|
|
597
636
|
* Moves focus to the mark `key` as a key press would, whatever the last input was: the focus ring
|
|
598
637
|
* 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'.
|
|
638
|
+
* of its points'. With `hover: "point"` it's the point's: its own key, or an x's, for its first
|
|
639
|
+
* series' point there. A key that isn't on screen (unknown, leaving, or past a line's reveal) does nothing.
|
|
600
640
|
*/
|
|
601
641
|
focus(key: string): void;
|
|
602
642
|
/**
|
|
@@ -814,7 +854,7 @@ interface VegaItem {
|
|
|
814
854
|
readonly cornerRadius?: number;
|
|
815
855
|
/** False for a line's point Vega leaves out, which breaks the line there. */
|
|
816
856
|
readonly defined?: boolean;
|
|
817
|
-
/** How a line is drawn between its points:
|
|
857
|
+
/** 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
858
|
readonly interpolate?: string;
|
|
819
859
|
}
|
|
820
860
|
/** A value for data effects: alone, or with where it is along x (`at`), which threshold matches series by. */
|
|
@@ -1343,7 +1383,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
|
|
|
1343
1383
|
* has the same rules. For a CSP that allows no inline styles at all.
|
|
1344
1384
|
*/
|
|
1345
1385
|
export declare function configure(options: StyleOptions): void;
|
|
1346
|
-
export declare const VERSION = "0.
|
|
1386
|
+
export declare const VERSION = "0.5.0";
|
|
1347
1387
|
/**
|
|
1348
1388
|
* A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
|
|
1349
1389
|
* category; `stack` stacks numeric fields; `on` attaches effects by slot.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Easing, C as ScalingTable, D as mediaReducedMotion, E as defaultScaling, F as FrameSource, I as ManualClock, L as createClock, M as easeOutCubic, N as linear, O as motion, P as Clock, R as defaultClock, S as ScalingRule, T as createMotion, _ as MotionMode, a as GeometryEffect, b as ReducedMotionSource, c as TransitionEffect, d as MotionEnv, f as Tween, g as Motion, h as tween, i as EffectContext, j as easeInOutCubic, k as scaleDuration, l as MarkData, m as TweenResult, n as Combined, o as MarkEffect, p as TweenOptions, r as DataEffect, s as TransitionContext, t as AnyMarkEffect, u as Sample, v as MotionOptions, w as Timing, x as ScalingOverrides, y as MotionView, z as manualClock } 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 Easing, C as ScalingTable, D as mediaReducedMotion, E as defaultScaling, F as FrameSource, I as ManualClock, L as createClock, M as easeOutCubic, N as linear, O as motion, P as Clock, R as defaultClock, S as ScalingRule, T as createMotion, _ as MotionMode, a as GeometryEffect, b as ReducedMotionSource, c as TransitionEffect, d as MotionEnv, f as Tween, g as Motion, h as tween, i as EffectContext, j as easeInOutCubic, k as scaleDuration, l as MarkData, m as TweenResult, n as Combined, o as MarkEffect, p as TweenOptions, r as DataEffect, s as TransitionContext, t as AnyMarkEffect, u as Sample, v as MotionOptions, w as Timing, x as ScalingOverrides, y as MotionView, z as manualClock } from "./effect-CMo-2gPf.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,35 @@ 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);
|
|
551
590
|
}
|
|
552
591
|
interface LineChart<D> extends Chart<D, LineChartOptions<D>> {
|
|
553
592
|
/**
|
|
@@ -596,7 +635,8 @@ interface Chart<D, O> {
|
|
|
596
635
|
/**
|
|
597
636
|
* Moves focus to the mark `key` as a key press would, whatever the last input was: the focus ring
|
|
598
637
|
* 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'.
|
|
638
|
+
* of its points'. With `hover: "point"` it's the point's: its own key, or an x's, for its first
|
|
639
|
+
* series' point there. A key that isn't on screen (unknown, leaving, or past a line's reveal) does nothing.
|
|
600
640
|
*/
|
|
601
641
|
focus(key: string): void;
|
|
602
642
|
/**
|
|
@@ -814,7 +854,7 @@ interface VegaItem {
|
|
|
814
854
|
readonly cornerRadius?: number;
|
|
815
855
|
/** False for a line's point Vega leaves out, which breaks the line there. */
|
|
816
856
|
readonly defined?: boolean;
|
|
817
|
-
/** How a line is drawn between its points:
|
|
857
|
+
/** 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
858
|
readonly interpolate?: string;
|
|
819
859
|
}
|
|
820
860
|
/** A value for data effects: alone, or with where it is along x (`at`), which threshold matches series by. */
|
|
@@ -1343,7 +1383,7 @@ export declare function registerIcons(icons: readonly Icon[]): void;
|
|
|
1343
1383
|
* has the same rules. For a CSP that allows no inline styles at all.
|
|
1344
1384
|
*/
|
|
1345
1385
|
export declare function configure(options: StyleOptions): void;
|
|
1346
|
-
export declare const VERSION = "0.
|
|
1386
|
+
export declare const VERSION = "0.5.0";
|
|
1347
1387
|
/**
|
|
1348
1388
|
* A bar chart in `target` (an element or a selector). The axis whose values aren't numbers is the
|
|
1349
1389
|
* category; `stack` stacks numeric fields; `on` attaches effects by slot.
|