expressive-charts 0.3.0 → 0.4.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 +40 -1
- package/README.md +6 -6
- package/dist/define-DeZLs1h7.js +95 -0
- package/dist/define-DeZLs1h7.js.map +1 -0
- package/dist/drawing-Dz_IvJPB.d.cts +208 -0
- package/dist/drawing-Dz_IvJPB.d.ts +208 -0
- package/dist/effect-CdH5449m.d.ts +232 -0
- package/dist/effect-uYC8Vs6_.d.cts +232 -0
- package/dist/expressive-charts.css +2 -0
- package/dist/expressive-charts.css.d.cts +1 -2
- package/dist/expressive-charts.css.d.ts +1 -2
- package/dist/expressive-charts.global.js +45 -47
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/icons/sport.cjs +211 -156
- package/dist/icons/sport.cjs.map +1 -1
- package/dist/icons/sport.d.cts +5 -7
- package/dist/icons/sport.d.ts +5 -7
- package/dist/icons/sport.js +122 -71
- package/dist/icons/sport.js.map +1 -1
- package/dist/index.cjs +12632 -9979
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +913 -871
- package/dist/index.d.ts +913 -871
- package/dist/index.js +10444 -8232
- package/dist/index.js.map +1 -1
- package/dist/path-data-DnEckjY8.js +123 -0
- package/dist/path-data-DnEckjY8.js.map +1 -0
- package/dist/testing.cjs +2030 -1252
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +135 -139
- package/dist/testing.d.ts +135 -139
- package/dist/testing.js +696 -499
- package/dist/testing.js.map +1 -1
- package/dist/transition-DSRt2DH3.js +2053 -0
- package/dist/transition-DSRt2DH3.js.map +1 -0
- package/package.json +6 -6
- package/dist/chunk-7A7LXXT4.js +0 -70
- package/dist/chunk-7A7LXXT4.js.map +0 -1
- package/dist/chunk-CJUQHEX6.js +0 -618
- package/dist/chunk-CJUQHEX6.js.map +0 -1
- package/dist/chunk-N2BLUETM.js +0 -1194
- package/dist/chunk-N2BLUETM.js.map +0 -1
- package/dist/drawing-CdTgixMY.d.cts +0 -206
- package/dist/drawing-CdTgixMY.d.ts +0 -206
- package/dist/effect-Bu3MHHeg.d.ts +0 -247
- package/dist/effect-D4vmdYP4.d.cts +0 -247
package/dist/testing.d.ts
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { I as ManualClock, _ as MotionMode, a as GeometryEffect, c as TransitionEffect, g as Motion, i as EffectContext, l as MarkData, r as DataEffect, x as ScalingOverrides } from "./effect-CdH5449m.js";
|
|
2
|
+
import { a as MarkStyle, d as Icon, i as MarkHandle, m as MarkGeometry, o as Matrix, r as Layer, s as Paint, u as TextStyle } from "./drawing-Dz_IvJPB.js";
|
|
4
3
|
interface CheckEffectOptions<D = unknown> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The marks to check on: named, or a list such as a chart's `marks()` (each named by its key in the
|
|
6
|
+
* report). Default: `fixtures`, every kind of mark.
|
|
7
|
+
*/
|
|
8
|
+
readonly marks?: Readonly<Record<string, MarkGeometry>> | readonly MarkGeometry[];
|
|
9
|
+
/** The icons the effect looks up by name, through `ctx.icons`. Default: none. */
|
|
10
|
+
readonly icons?: readonly Icon[];
|
|
11
|
+
/**
|
|
12
|
+
* For a data effect, each mark's data. Default: no datum, values from 0 to 1 along the walk (each
|
|
13
|
+
* sample's value is its `t`), and no related series, so an effect that reads its rows or `needs`
|
|
14
|
+
* related series has to pass this. On a mark with gaps, there's a sample at each end of each gap,
|
|
15
|
+
* with `gapBefore` on the one after, as on a line chart's line with a missing value.
|
|
16
|
+
*/
|
|
17
|
+
readonly data?: (mark: MarkGeometry) => MarkData<D>;
|
|
18
|
+
/**
|
|
19
|
+
* The same mark moved (a resize, a transition's next frame): another geometry with the same key, for
|
|
20
|
+
* the check that the effect follows `onChange`. Undefined skips that check on the mark. Default:
|
|
21
|
+
* each fixture's moved twin, and nothing for other marks, so a page's own marks pass this or skip it.
|
|
22
|
+
*/
|
|
23
|
+
readonly moved?: (mark: MarkGeometry) => MarkGeometry | undefined;
|
|
24
|
+
/** The mark's place among the marks of its event, for effects that read `ctx.batch` (stagger). Default: the only one. */
|
|
25
|
+
readonly batch?: {
|
|
26
|
+
readonly index: number;
|
|
27
|
+
readonly count: number;
|
|
28
|
+
};
|
|
29
|
+
/** What the report calls the effect. Default: "the effect". */
|
|
30
|
+
readonly name?: string;
|
|
30
31
|
}
|
|
31
32
|
/** A data effect typed for its own rows: data(mark) has to give them. */
|
|
32
33
|
type WithData<D> = CheckEffectOptions<D> & {
|
|
33
|
-
|
|
34
|
+
readonly data: (mark: MarkGeometry) => MarkData<D>;
|
|
34
35
|
};
|
|
35
36
|
/**
|
|
36
37
|
* Runs the conformance checks on every mark (`options.marks`, or the fixtures):
|
|
@@ -45,19 +46,19 @@ type WithData<D> = CheckEffectOptions<D> & {
|
|
|
45
46
|
* the mark, the check and what differed. A data effect typed for its own rows needs `data`, and so
|
|
46
47
|
* does one that `needs` related series.
|
|
47
48
|
*/
|
|
48
|
-
declare function checkEffect(effect: GeometryEffect | DataEffect<unknown>, options?: CheckEffectOptions<unknown>): Promise<void>;
|
|
49
|
-
declare function checkEffect<D>(effect: GeometryEffect | DataEffect<D>, options: WithData<D>): Promise<void>;
|
|
49
|
+
export declare function checkEffect(effect: GeometryEffect | DataEffect<unknown>, options?: CheckEffectOptions<unknown>): Promise<void>;
|
|
50
|
+
export declare function checkEffect<D>(effect: GeometryEffect | DataEffect<D>, options: WithData<D>): Promise<void>;
|
|
50
51
|
interface CheckTransitionOptions {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
/**
|
|
53
|
+
* The pairs to check on, each as [a, b] and run both ways: named, or a list (each named by its
|
|
54
|
+
* marks' keys in the report). Default: `fixturePairs`, a slice and a column, a bar and a column,
|
|
55
|
+
* two slices, two lines and two points.
|
|
56
|
+
*/
|
|
57
|
+
readonly pairs?: Readonly<Record<string, readonly [MarkGeometry, MarkGeometry]>> | readonly (readonly [MarkGeometry, MarkGeometry])[];
|
|
58
|
+
/** The icons the effect looks up by name, through `ctx.icons`. Default: none. */
|
|
59
|
+
readonly icons?: readonly Icon[];
|
|
60
|
+
/** What the report calls the effect. Default: "the effect". */
|
|
61
|
+
readonly name?: string;
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* Runs the conformance checks for a transition effect on every pair (`options.pairs`, or the fixture
|
|
@@ -74,150 +75,145 @@ interface CheckTransitionOptions {
|
|
|
74
75
|
* Resolves when every check passes. Otherwise it rejects with one Error that lists every failure:
|
|
75
76
|
* the pair, which way, the check and what differed.
|
|
76
77
|
*/
|
|
77
|
-
declare function checkTransition(effect: TransitionEffect, options?: CheckTransitionOptions): Promise<void>;
|
|
78
|
-
|
|
78
|
+
export declare function checkTransition(effect: TransitionEffect, options?: CheckTransitionOptions): Promise<void>;
|
|
79
79
|
type FixtureName = "bar" | "negative bar" | "column" | "stacked" | "short bar" | "slice" | "line" | "gapped line" | "point";
|
|
80
80
|
/** Every kind of mark an effect meets: bars (plain, negative, a column, stacked, too short), a donut slice, a line, a line with a gap, and a point. */
|
|
81
|
-
declare const fixtures: Readonly<Record<FixtureName, MarkGeometry>>;
|
|
81
|
+
export declare const fixtures: Readonly<Record<FixtureName, MarkGeometry>>;
|
|
82
82
|
type FixturePairName = "slice and column" | "bar and column" | "two slices" | "two lines" | "two points";
|
|
83
83
|
/**
|
|
84
84
|
* The pairs checkTransition runs a transition effect between by default, each both ways: a slice and
|
|
85
85
|
* a column (a mark that goes round its pivot and one that doesn't), a bar and a column, two slices,
|
|
86
86
|
* two lines and two points. The second of two alike is the first's moved twin.
|
|
87
87
|
*/
|
|
88
|
-
declare const fixturePairs: Readonly<Record<FixturePairName, readonly [MarkGeometry, MarkGeometry]>>;
|
|
89
|
-
|
|
88
|
+
export declare const fixturePairs: Readonly<Record<FixturePairName, readonly [MarkGeometry, MarkGeometry]>>;
|
|
90
89
|
interface DrawnIcon {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
readonly kind: "icon";
|
|
91
|
+
readonly id: number;
|
|
92
|
+
readonly icon: Icon;
|
|
93
|
+
readonly size: number | undefined;
|
|
94
|
+
/** Undefined until first placed, while the icon is hidden. */
|
|
95
|
+
readonly transform: Matrix | undefined;
|
|
97
96
|
}
|
|
98
97
|
interface DrawnPath {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
readonly kind: "path";
|
|
99
|
+
readonly id: number;
|
|
100
|
+
readonly d: string;
|
|
101
|
+
readonly paint: Paint;
|
|
103
102
|
}
|
|
104
103
|
interface DrawnText {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
readonly kind: "text";
|
|
105
|
+
readonly id: number;
|
|
106
|
+
readonly content: string;
|
|
107
|
+
readonly style: TextStyle;
|
|
109
108
|
}
|
|
110
109
|
type Drawn = DrawnIcon | DrawnPath | DrawnText;
|
|
111
110
|
/** Every call made on a layer or its handles, in order. Calls on removed handles are logged and ignored. */
|
|
112
111
|
type LayerCall = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
readonly op: "icon";
|
|
113
|
+
readonly id: number;
|
|
114
|
+
readonly icon: string;
|
|
115
|
+
readonly size: number | undefined;
|
|
117
116
|
} | {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
readonly op: "place";
|
|
118
|
+
readonly id: number;
|
|
119
|
+
readonly transform: Matrix;
|
|
121
120
|
} | {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
readonly op: "path";
|
|
122
|
+
readonly id: number;
|
|
123
|
+
readonly d: string;
|
|
124
|
+
readonly paint: Paint;
|
|
126
125
|
} | {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
readonly op: "update-path";
|
|
127
|
+
readonly id: number;
|
|
128
|
+
readonly d: string;
|
|
129
|
+
readonly paint: Partial<Paint> | undefined;
|
|
131
130
|
} | {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
readonly op: "text";
|
|
132
|
+
readonly id: number;
|
|
133
|
+
readonly content: string;
|
|
134
|
+
readonly style: TextStyle;
|
|
136
135
|
} | {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
readonly op: "update-text";
|
|
137
|
+
readonly id: number;
|
|
138
|
+
readonly style: Partial<TextStyle>;
|
|
139
|
+
readonly content: string | undefined;
|
|
141
140
|
} | {
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
readonly op: "remove";
|
|
142
|
+
readonly id: number;
|
|
144
143
|
} | {
|
|
145
|
-
|
|
144
|
+
readonly op: "clear";
|
|
146
145
|
};
|
|
147
146
|
/** What's on screen, without ids and with numbers rounded, so a full run can be compared with end(). */
|
|
148
147
|
type Picture = {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
readonly kind: "icon";
|
|
149
|
+
readonly icon: string;
|
|
150
|
+
readonly size: number | undefined;
|
|
151
|
+
readonly transform: readonly number[] | undefined;
|
|
153
152
|
} | {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
readonly kind: "path";
|
|
154
|
+
readonly d: string;
|
|
155
|
+
readonly paint: Paint;
|
|
157
156
|
} | {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
readonly kind: "text";
|
|
158
|
+
readonly content: string;
|
|
159
|
+
readonly style: TextStyle;
|
|
161
160
|
};
|
|
162
161
|
interface RecordingLayer extends Layer {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
162
|
+
/** What's drawn now, in creation order (which is also stacking order). */
|
|
163
|
+
readonly drawn: readonly Drawn[];
|
|
164
|
+
readonly calls: readonly LayerCall[];
|
|
165
|
+
/** `drawn` as plain data, numbers rounded to `decimals` (default 3). */
|
|
166
|
+
picture(decimals?: number): Picture[];
|
|
167
|
+
/** Remove everything, as the runner does when a run is cleared. */
|
|
168
|
+
clear(): void;
|
|
170
169
|
}
|
|
171
170
|
type MarkCall = {
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
readonly op: "set";
|
|
172
|
+
readonly style: MarkStyle;
|
|
174
173
|
} | {
|
|
175
|
-
|
|
174
|
+
readonly op: "reset";
|
|
176
175
|
};
|
|
177
176
|
interface RecordingMark extends MarkHandle {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
/** The style now, after every set() and reset(). Empty means the mark's own style. */
|
|
178
|
+
readonly style: MarkStyle;
|
|
179
|
+
readonly calls: readonly MarkCall[];
|
|
181
180
|
}
|
|
182
|
-
|
|
183
181
|
interface TestContextOptions {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
182
|
+
/** The author's mode. Default "presentation". The device never asks for reduced motion here. */
|
|
183
|
+
readonly mode?: MotionMode;
|
|
184
|
+
/** Overrides for the duration scaling, as a page's createMotion({ scaling }) gives. */
|
|
185
|
+
readonly scaling?: ScalingOverrides;
|
|
186
|
+
readonly icons?: readonly Icon[];
|
|
187
|
+
readonly batch?: {
|
|
188
|
+
readonly index: number;
|
|
189
|
+
readonly count: number;
|
|
190
|
+
};
|
|
191
|
+
readonly previous?: MarkGeometry;
|
|
194
192
|
}
|
|
195
193
|
interface TestContext extends EffectContext {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
194
|
+
readonly motion: Motion;
|
|
195
|
+
readonly clock: ManualClock;
|
|
196
|
+
readonly layer: RecordingLayer;
|
|
197
|
+
readonly mark: RecordingMark;
|
|
198
|
+
/** Abort the run, as the runner does on leave or re-trigger. */
|
|
199
|
+
abort(): void;
|
|
200
|
+
/** The runner's cleanup after effect.clear(ctx): abort, empty the layer, reset the mark, drop onChange listeners. */
|
|
201
|
+
clear(): void;
|
|
202
|
+
/** Tell onChange listeners the geometry moved, as the runner does on every frame of a transition. */
|
|
203
|
+
change(mark: MarkGeometry, data?: MarkData): void;
|
|
206
204
|
}
|
|
207
|
-
declare function testContext(options?: TestContextOptions): TestContext;
|
|
208
|
-
|
|
205
|
+
export declare function testContext(options?: TestContextOptions): TestContext;
|
|
209
206
|
interface PlayOptions {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
207
|
+
/** Ms per frame. Default 16. */
|
|
208
|
+
readonly frame?: number;
|
|
209
|
+
/** Gives up after this many ms. Default 10 000. */
|
|
210
|
+
readonly limit?: number;
|
|
214
211
|
}
|
|
215
212
|
/**
|
|
216
213
|
* Advances the clock a frame at a time until `running` settles, letting promise callbacks run
|
|
217
214
|
* between frames (so a sequence's next part starts on time). Resolves with the ms it advanced; throws
|
|
218
215
|
* if `running` hasn't settled within the limit.
|
|
219
216
|
*/
|
|
220
|
-
declare function play(clock: ManualClock, running: Promise<unknown>, options?: PlayOptions): Promise<number>;
|
|
221
|
-
|
|
222
|
-
export { checkEffect, checkTransition, fixturePairs, fixtures, play, testContext };
|
|
217
|
+
export declare function play(clock: ManualClock, running: Promise<unknown>, options?: PlayOptions): Promise<number>;
|
|
223
218
|
export type { CheckEffectOptions, CheckTransitionOptions, Drawn, DrawnIcon, DrawnPath, DrawnText, FixtureName, FixturePairName, LayerCall, MarkCall, Picture, PlayOptions, RecordingLayer, RecordingMark, TestContext, TestContextOptions };
|
|
219
|
+
//# sourceMappingURL=testing.d.ts.map
|