expressive-charts 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -1
- package/README.md +6 -6
- package/dist/{effect-CMo-2gPf.d.ts → effect-D8W4ZmmG.d.cts} +28 -4
- package/dist/{effect-C786hGyJ.d.cts → effect-DyzluQD1.d.ts} +28 -4
- package/dist/expressive-charts.global.js +10 -10
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/index.cjs +779 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -12
- package/dist/index.d.ts +50 -12
- package/dist/index.js +712 -145
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +36 -2
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +12 -3
- package/dist/testing.d.ts +12 -3
- package/dist/testing.js +20 -3
- package/dist/testing.js.map +1 -1
- package/dist/{transition-Bu1NsQor.js → transition-romki_A6.js} +70 -12
- package/dist/transition-romki_A6.js.map +1 -0
- package/package.json +2 -2
- package/dist/transition-Bu1NsQor.js.map +0 -1
package/dist/testing.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
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-Ypmq-2h6.cjs";
|
|
1
|
+
import { L as ManualClock, S as ScalingOverrides, _ as Motion, a as GeometryEffect, i as EffectContext, l as TransitionEffect, r as DataEffect, s as TextSpace, u as MarkData, v as MotionMode } from "./effect-D8W4ZmmG.cjs";
|
|
2
|
+
import { _ as Rect, 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-Ypmq-2h6.cjs";
|
|
3
3
|
interface CheckEffectOptions<D = unknown> {
|
|
4
4
|
/**
|
|
5
5
|
* The marks to check on: named, or a list such as a chart's `marks()` (each named by its key in the
|
|
@@ -189,15 +189,24 @@ interface TestContextOptions {
|
|
|
189
189
|
readonly count: number;
|
|
190
190
|
};
|
|
191
191
|
readonly previous?: MarkGeometry;
|
|
192
|
+
/** The boxes other effects' text holds, as `texts.held()` gives them: the runs that started before this one. Default none. */
|
|
193
|
+
readonly held?: readonly Rect[];
|
|
192
194
|
}
|
|
193
195
|
interface TestContext extends EffectContext {
|
|
194
196
|
readonly motion: Motion;
|
|
195
197
|
readonly clock: ManualClock;
|
|
196
198
|
readonly layer: RecordingLayer;
|
|
197
199
|
readonly mark: RecordingMark;
|
|
200
|
+
/**
|
|
201
|
+
* Where effects' text sits, as a chart's runner gives it, with text boxes estimated as in jsdom: 0.6
|
|
202
|
+
* em a character. `holding` is the box the run holds now, undefined once it lets go or is cleared.
|
|
203
|
+
*/
|
|
204
|
+
readonly texts: TextSpace & {
|
|
205
|
+
readonly holding: Rect | undefined;
|
|
206
|
+
};
|
|
198
207
|
/** Abort the run, as the runner does on leave or re-trigger. */
|
|
199
208
|
abort(): void;
|
|
200
|
-
/** The runner's cleanup after effect.clear(ctx): abort, empty the layer, reset the mark, drop onChange listeners. */
|
|
209
|
+
/** The runner's cleanup after effect.clear(ctx): abort, empty the layer, reset the mark, drop onChange listeners, let go of its text. */
|
|
201
210
|
clear(): void;
|
|
202
211
|
/** Tell onChange listeners the geometry moved, as the runner does on every frame of a transition. */
|
|
203
212
|
change(mark: MarkGeometry, data?: MarkData): void;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
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-Ypmq-2h6.js";
|
|
1
|
+
import { L as ManualClock, S as ScalingOverrides, _ as Motion, a as GeometryEffect, i as EffectContext, l as TransitionEffect, r as DataEffect, s as TextSpace, u as MarkData, v as MotionMode } from "./effect-DyzluQD1.js";
|
|
2
|
+
import { _ as Rect, 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-Ypmq-2h6.js";
|
|
3
3
|
interface CheckEffectOptions<D = unknown> {
|
|
4
4
|
/**
|
|
5
5
|
* The marks to check on: named, or a list such as a chart's `marks()` (each named by its key in the
|
|
@@ -189,15 +189,24 @@ interface TestContextOptions {
|
|
|
189
189
|
readonly count: number;
|
|
190
190
|
};
|
|
191
191
|
readonly previous?: MarkGeometry;
|
|
192
|
+
/** The boxes other effects' text holds, as `texts.held()` gives them: the runs that started before this one. Default none. */
|
|
193
|
+
readonly held?: readonly Rect[];
|
|
192
194
|
}
|
|
193
195
|
interface TestContext extends EffectContext {
|
|
194
196
|
readonly motion: Motion;
|
|
195
197
|
readonly clock: ManualClock;
|
|
196
198
|
readonly layer: RecordingLayer;
|
|
197
199
|
readonly mark: RecordingMark;
|
|
200
|
+
/**
|
|
201
|
+
* Where effects' text sits, as a chart's runner gives it, with text boxes estimated as in jsdom: 0.6
|
|
202
|
+
* em a character. `holding` is the box the run holds now, undefined once it lets go or is cleared.
|
|
203
|
+
*/
|
|
204
|
+
readonly texts: TextSpace & {
|
|
205
|
+
readonly holding: Rect | undefined;
|
|
206
|
+
};
|
|
198
207
|
/** Abort the run, as the runner does on leave or re-trigger. */
|
|
199
208
|
abort(): void;
|
|
200
|
-
/** The runner's cleanup after effect.clear(ctx): abort, empty the layer, reset the mark, drop onChange listeners. */
|
|
209
|
+
/** The runner's cleanup after effect.clear(ctx): abort, empty the layer, reset the mark, drop onChange listeners, let go of its text. */
|
|
201
210
|
clear(): void;
|
|
202
211
|
/** Tell onChange listeners the geometry moved, as the runner does on every frame of a transition. */
|
|
203
212
|
change(mark: MarkGeometry, data?: MarkData): void;
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as manualClock, c as estimatedBox, f as describeValue, h as describe, i as runScope, j as createMotion, l as mergeFields, p as isMarkEffect, t as isTransitionEffect } from "./transition-romki_A6.js";
|
|
2
2
|
// src/core/testing/recording.ts
|
|
3
3
|
function recordingLayer() {
|
|
4
4
|
const drawn = /* @__PURE__ */ new Map();
|
|
@@ -205,6 +205,18 @@ function testContext(options = {}) {
|
|
|
205
205
|
const layer = recordingLayer();
|
|
206
206
|
const mark = recordingMark();
|
|
207
207
|
const icons = new Map((options.icons ?? []).map((icon) => [icon.name, icon]));
|
|
208
|
+
const held = [...options.held ?? []];
|
|
209
|
+
let holding;
|
|
210
|
+
const texts = {
|
|
211
|
+
box: estimatedBox,
|
|
212
|
+
held: () => held,
|
|
213
|
+
hold(box) {
|
|
214
|
+
holding = box;
|
|
215
|
+
},
|
|
216
|
+
get holding() {
|
|
217
|
+
return holding;
|
|
218
|
+
}
|
|
219
|
+
};
|
|
208
220
|
const scope = runScope({
|
|
209
221
|
clock,
|
|
210
222
|
motion,
|
|
@@ -215,7 +227,8 @@ function testContext(options = {}) {
|
|
|
215
227
|
index: 0,
|
|
216
228
|
count: 1
|
|
217
229
|
},
|
|
218
|
-
previous: options.previous
|
|
230
|
+
previous: options.previous,
|
|
231
|
+
texts
|
|
219
232
|
});
|
|
220
233
|
return {
|
|
221
234
|
...scope.context,
|
|
@@ -223,8 +236,12 @@ function testContext(options = {}) {
|
|
|
223
236
|
clock,
|
|
224
237
|
layer,
|
|
225
238
|
mark,
|
|
239
|
+
texts,
|
|
226
240
|
abort: scope.abort,
|
|
227
|
-
clear
|
|
241
|
+
clear() {
|
|
242
|
+
scope.clear();
|
|
243
|
+
holding = void 0;
|
|
244
|
+
},
|
|
228
245
|
change: scope.change
|
|
229
246
|
};
|
|
230
247
|
}
|
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","names":["merge","build"],"sources":["../src/core/testing/recording.ts","../src/core/testing/context.ts","../src/core/testing/play.ts","../src/testing/fixtures.ts","../src/testing/check.ts"],"sourcesContent":["// In-memory versions of the drawing API, so effects can be tested with no DOM at all.\n\nimport type { IconHandle, Layer, MarkHandle, MarkStyle, Matrix, Paint, PathHandle, TextHandle, TextStyle } from \"../contracts/drawing\";\nimport type { Icon } from \"../contracts/icon\";\nimport type { EffectSlot } from \"../contracts/slots\";\nimport { mergeFields as merge } from \"../merge\";\nimport type { RunnerSurface, SurfaceGroup } from \"../runner\";\n\nexport interface DrawnIcon {\n readonly kind: \"icon\";\n readonly id: number;\n readonly icon: Icon;\n readonly size: number | undefined;\n /** Undefined until first placed, while the icon is hidden. */\n readonly transform: Matrix | undefined;\n}\n\nexport interface DrawnPath {\n readonly kind: \"path\";\n readonly id: number;\n readonly d: string;\n readonly paint: Paint;\n}\n\nexport interface DrawnText {\n readonly kind: \"text\";\n readonly id: number;\n readonly content: string;\n readonly style: TextStyle;\n}\n\nexport type Drawn = DrawnIcon | DrawnPath | DrawnText;\n\n/** Every call made on a layer or its handles, in order. Calls on removed handles are logged and ignored. */\nexport type LayerCall =\n | { readonly op: \"icon\"; readonly id: number; readonly icon: string; readonly size: number | undefined }\n | { readonly op: \"place\"; readonly id: number; readonly transform: Matrix }\n | { readonly op: \"path\"; readonly id: number; readonly d: string; readonly paint: Paint }\n | { readonly op: \"update-path\"; readonly id: number; readonly d: string; readonly paint: Partial<Paint> | undefined }\n | { readonly op: \"text\"; readonly id: number; readonly content: string; readonly style: TextStyle }\n | { readonly op: \"update-text\"; readonly id: number; readonly style: Partial<TextStyle>; readonly content: string | undefined }\n | { readonly op: \"remove\"; readonly id: number }\n | { readonly op: \"clear\" };\n\n/** What's on screen, without ids and with numbers rounded, so a full run can be compared with end(). */\nexport type Picture =\n | { readonly kind: \"icon\"; readonly icon: string; readonly size: number | undefined; readonly transform: readonly number[] | undefined }\n | { readonly kind: \"path\"; readonly d: string; readonly paint: Paint }\n | { readonly kind: \"text\"; readonly content: string; readonly style: TextStyle };\n\nexport interface RecordingLayer extends Layer {\n /** What's drawn now, in creation order (which is also stacking order). */\n readonly drawn: readonly Drawn[];\n readonly calls: readonly LayerCall[];\n /** `drawn` as plain data, numbers rounded to `decimals` (default 3). */\n picture(decimals?: number): Picture[];\n /** Remove everything, as the runner does when a run is cleared. */\n clear(): void;\n}\n\nexport function recordingLayer(): RecordingLayer {\n const drawn = new Map<number, Drawn>();\n const calls: LayerCall[] = [];\n let nextId = 1;\n\n // Replaces a live item; calls on removed handles change nothing.\n const replace = (id: number, next: (current: Drawn) => Drawn): void => {\n const current = drawn.get(id);\n if (current) drawn.set(id, next(current));\n };\n const remove = (id: number): void => {\n calls.push({ op: \"remove\", id });\n drawn.delete(id);\n };\n\n return {\n get drawn() {\n return [...drawn.values()];\n },\n get calls() {\n return calls;\n },\n icon(icon, options) {\n const id = nextId++;\n const size = options?.size;\n calls.push({ op: \"icon\", id, icon: icon.name, size });\n drawn.set(id, { kind: \"icon\", id, icon, size, transform: undefined });\n const handle: IconHandle = {\n place(transform) {\n calls.push({ op: \"place\", id, transform });\n replace(id, (current) => ({ ...current, transform }) as DrawnIcon);\n },\n remove: () => remove(id)\n };\n return handle;\n },\n path(d, paint) {\n const id = nextId++;\n calls.push({ op: \"path\", id, d, paint });\n drawn.set(id, { kind: \"path\", id, d, paint: { ...paint } });\n const handle: PathHandle = {\n update(nextD, nextPaint) {\n calls.push({ op: \"update-path\", id, d: nextD, paint: nextPaint });\n replace(id, (current) => {\n const path = current as DrawnPath;\n return { ...path, d: nextD, paint: merge(path.paint, nextPaint) };\n });\n },\n remove: () => remove(id)\n };\n return handle;\n },\n text(content, style) {\n const id = nextId++;\n calls.push({ op: \"text\", id, content, style });\n drawn.set(id, { kind: \"text\", id, content, style: { ...style } });\n const handle: TextHandle = {\n update(nextStyle, nextContent) {\n calls.push({ op: \"update-text\", id, style: nextStyle, content: nextContent });\n replace(id, (current) => {\n const text = current as DrawnText;\n return { ...text, style: merge(text.style, nextStyle), content: nextContent ?? text.content };\n });\n },\n remove: () => remove(id)\n };\n return handle;\n },\n picture(decimals = 3) {\n const round = rounder(decimals);\n return [...drawn.values()].map((item): Picture => {\n switch (item.kind) {\n case \"icon\":\n return { kind: \"icon\", icon: item.icon.name, size: item.size, transform: item.transform?.map(round) };\n case \"path\":\n return { kind: \"path\", d: item.d, paint: roundFields(item.paint, round) };\n case \"text\":\n return { kind: \"text\", content: item.content, style: { ...roundFields(item.style, round), at: { x: round(item.style.at.x), y: round(item.style.at.y) } } };\n }\n });\n },\n clear() {\n calls.push({ op: \"clear\" });\n drawn.clear();\n }\n };\n}\n\nexport type MarkCall = { readonly op: \"set\"; readonly style: MarkStyle } | { readonly op: \"reset\" };\n\nexport interface RecordingMark extends MarkHandle {\n /** The style now, after every set() and reset(). Empty means the mark's own style. */\n readonly style: MarkStyle;\n readonly calls: readonly MarkCall[];\n}\n\nexport function recordingMark(): RecordingMark {\n let style: MarkStyle = {};\n const calls: MarkCall[] = [];\n return {\n get style() {\n return style;\n },\n get calls() {\n return calls;\n },\n set(next) {\n calls.push({ op: \"set\", style: next });\n style = merge(style, next);\n },\n reset() {\n calls.push({ op: \"reset\" });\n style = {};\n }\n };\n}\n\n/** One overlay group a runner asked for. */\nexport interface RecordedGroup {\n readonly key: string;\n readonly slot: EffectSlot;\n /** The run's start order, which stacks groups. */\n readonly order: number;\n readonly layer: RecordingLayer;\n /** True once the runner cleared it. */\n readonly cleared: boolean;\n}\n\n/** A RunnerSurface in memory: every run's group is a recording layer, every mark a recording mark. */\nexport interface RecordingSurface extends RunnerSurface {\n /** Every group asked for, in order, cleared ones included. */\n readonly groups: readonly RecordedGroup[];\n /** The mark's handle, made on first use. */\n mark(key: string): RecordingMark;\n /** What's drawn now in the groups not yet cleared, optionally for one key, bottom to top (by order), as RecordingLayer.picture() gives it. */\n picture(key?: string): Picture[];\n}\n\nexport function recordingSurface(): RecordingSurface {\n const groups: { key: string; slot: EffectSlot; order: number; layer: RecordingLayer; cleared: boolean }[] = [];\n const marks = new Map<string, RecordingMark>();\n return {\n groups,\n group(key, slot, order) {\n const record = { key, slot, order, layer: recordingLayer(), cleared: false };\n groups.push(record);\n const group: SurfaceGroup = {\n icon: (icon, options) => record.layer.icon(icon, options),\n path: (d, paint) => record.layer.path(d, paint),\n text: (content, style) => record.layer.text(content, style),\n clear() {\n record.cleared = true;\n record.layer.clear();\n }\n };\n return group;\n },\n mark(key) {\n let mark = marks.get(key);\n if (!mark) marks.set(key, (mark = recordingMark()));\n return mark;\n },\n picture(key) {\n return groups\n .filter((group) => !group.cleared && (key === undefined || group.key === key))\n .sort((a, b) => a.order - b.order)\n .flatMap((group) => group.layer.picture());\n }\n };\n}\n\nfunction rounder(decimals: number): (value: number) => number {\n const factor = 10 ** decimals;\n return (value) => {\n const rounded = Math.round(value * factor) / factor;\n return rounded === 0 ? 0 : rounded;\n };\n}\n\nfunction roundFields<T extends object>(fields: T, round: (value: number) => number): T {\n const result: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(fields)) result[field] = typeof value === \"number\" ? round(value) : value;\n return result as T;\n}\n","// An EffectContext for effect tests: a manual clock, its own motion, and recording drawing handles.\n\nimport { manualClock, type ManualClock } from \"../clock\";\nimport type { MarkData } from \"../contracts/data\";\nimport type { EffectContext } from \"../contracts/effect\";\nimport type { MarkGeometry } from \"../contracts/geometry\";\nimport type { Icon } from \"../contracts/icon\";\nimport { createMotion, type Motion, type MotionMode, type ScalingOverrides } from \"../motion\";\nimport { runScope } from \"../runner\";\nimport { recordingLayer, recordingMark, type RecordingLayer, type RecordingMark } from \"./recording\";\n\nexport interface TestContextOptions {\n /** The author's mode. Default \"presentation\". The device never asks for reduced motion here. */\n readonly mode?: MotionMode;\n /** Overrides for the duration scaling, as a page's createMotion({ scaling }) gives. */\n readonly scaling?: ScalingOverrides;\n readonly icons?: readonly Icon[];\n readonly batch?: { readonly index: number; readonly count: number };\n readonly previous?: MarkGeometry;\n}\n\nexport interface TestContext extends EffectContext {\n readonly motion: Motion;\n readonly clock: ManualClock;\n readonly layer: RecordingLayer;\n readonly mark: RecordingMark;\n /** Abort the run, as the runner does on leave or re-trigger. */\n abort(): void;\n /** The runner's cleanup after effect.clear(ctx): abort, empty the layer, reset the mark, drop onChange listeners. */\n clear(): void;\n /** Tell onChange listeners the geometry moved, as the runner does on every frame of a transition. */\n change(mark: MarkGeometry, data?: MarkData): void;\n}\n\nexport function testContext(options: TestContextOptions = {}): TestContext {\n const clock = manualClock();\n const motion = createMotion({\n mode: options.mode ?? \"presentation\",\n ...(options.scaling ? { scaling: options.scaling } : {}),\n reducedMotion: { matches: false, subscribe: () => () => {} }\n });\n const layer = recordingLayer();\n const mark = recordingMark();\n const icons = new Map((options.icons ?? []).map((icon) => [icon.name, icon]));\n // The same run scope the runner gives every run, so clear() here is the runner's cleanup.\n const scope = runScope({\n clock,\n motion,\n layer,\n mark,\n icons: { get: (name) => icons.get(name) },\n batch: options.batch ?? { index: 0, count: 1 },\n previous: options.previous\n });\n\n return {\n ...scope.context,\n motion,\n clock,\n layer,\n mark,\n abort: scope.abort,\n clear: scope.clear,\n change: scope.change\n };\n}\n","// Plays a run to its end on a manual clock, for effect tests.\n\nimport type { ManualClock } from \"../clock\";\n\nexport interface PlayOptions {\n /** Ms per frame. Default 16. */\n readonly frame?: number;\n /** Gives up after this many ms. Default 10 000. */\n readonly limit?: number;\n}\n\n/**\n * Advances the clock a frame at a time until `running` settles, letting promise callbacks run\n * between frames (so a sequence's next part starts on time). Resolves with the ms it advanced; throws\n * if `running` hasn't settled within the limit.\n */\nexport async function play(clock: ManualClock, running: Promise<unknown>, options: PlayOptions = {}): Promise<number> {\n const frame = options.frame ?? 16;\n const limit = options.limit ?? 10_000;\n let settled = false;\n running.then(\n () => (settled = true),\n () => (settled = true)\n );\n let elapsed = 0;\n await flush();\n while (!settled) {\n if (elapsed >= limit) throw new Error(`play: still running after ${limit} ms.`);\n clock.advance(frame);\n elapsed += frame;\n await flush();\n }\n return elapsed;\n}\n\n/** Lets pending promise callbacks run. */\nexport async function flush(): Promise<void> {\n for (let i = 0; i < 20; i++) await Promise.resolve();\n}\n","// The marks checkEffect runs an effect on by default: one of each kind the geometry builders\n// describe, plus the awkward cases (a bar growing the other way, a stack with a gap, a bar shorter\n// than most icons, a line that skips a value, a point whose walk has no length). Each has a moved\n// twin: the same mark somewhere else, as a resize or a transition's next frame leaves it, for the\n// check that effects follow onChange. checkTransition's pairs are made of the same marks.\n\nimport { describe as build, type MarkGeometry } from \"../core\";\n\nexport type FixtureName = \"bar\" | \"negative bar\" | \"column\" | \"stacked\" | \"short bar\" | \"slice\" | \"line\" | \"gapped line\" | \"point\";\n\n/** 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. */\nexport const fixtures: Readonly<Record<FixtureName, MarkGeometry>> = /* @__PURE__ */ makeFixtures(false);\n\n/**\n * Each fixture moved: the same key and series, somewhere else and another size. The bars are a row\n * lower and shorter (the stack's segments in another ratio), the slice turned and the ring smaller,\n * the lines further revealed and rescaled, and the point moved.\n */\nexport const movedFixtures: Readonly<Record<FixtureName, MarkGeometry>> = /* @__PURE__ */ makeFixtures(true);\n\nexport type FixturePairName = \"slice and column\" | \"bar and column\" | \"two slices\" | \"two lines\" | \"two points\";\n\n/**\n * The pairs checkTransition runs a transition effect between by default, each both ways: a slice and\n * a column (a mark that goes round its pivot and one that doesn't), a bar and a column, two slices,\n * two lines and two points. The second of two alike is the first's moved twin.\n */\nexport const fixturePairs: Readonly<Record<FixturePairName, readonly [MarkGeometry, MarkGeometry]>> = /* @__PURE__ */ Object.freeze({\n \"slice and column\": [fixtures.slice, fixtures.column],\n \"bar and column\": [fixtures.bar, fixtures.column],\n \"two slices\": [fixtures.slice, movedFixtures.slice],\n \"two lines\": [fixtures.line, movedFixtures.line],\n \"two points\": [fixtures.point, movedFixtures.point]\n} as const);\n\nfunction makeFixtures(moved: boolean): Readonly<Record<FixtureName, MarkGeometry>> {\n const y = moved ? 30 : 0;\n const bar = (width: number, more: Partial<Parameters<typeof build.bar>[0]> = {}): MarkGeometry =>\n build.bar({ key: \"Okafor\", series: \"goals\", x: 0, y, width, height: 20, baseline: \"left\", ...more });\n const [goals, assists] = moved ? [120, 82] : [160, 62];\n const points = moved\n ? [{ x: 0, y: 90 }, { x: 64, y: 58 }, { x: 128, y: 82 }, { x: 192, y: 26 }, { x: 256, y: 40 }]\n : [{ x: 0, y: 100 }, { x: 80, y: 60 }, { x: 160, y: 90 }, { x: 240, y: 20 }];\n return Object.freeze({\n bar: bar(moved ? 160 : 200, { radius: 4 }),\n \"negative bar\": build.bar({ key: \"n\", series: \"goals\", x: moved ? 30 : 0, y, width: moved ? 90 : 120, height: 20, baseline: \"right\" }),\n column: build.bar({ key: \"c\", series: \"goals\", x: moved ? 30 : 0, y: moved ? 40 : 0, width: 20, height: moved ? 110 : 150, baseline: \"bottom\" }),\n stacked: bar(goals + assists, { series: undefined, gap: 2, segments: [{ series: \"goals\", size: goals }, { series: \"assists\", size: assists }] }),\n \"short bar\": bar(moved ? 4 : 6),\n slice: moved\n ? build.arc({ key: \"Saved\", cx: 140, cy: 130, inner: 60, outer: 100, start: 0.5, end: 2 })\n : build.arc({ key: \"Saved\", cx: 150, cy: 150, inner: 70, outer: 116, start: 0.3, end: 2.4 }),\n line: build.line({ key: \"goals\", series: \"goals\", points, width: 2 }),\n // The line broken after its second point: a run, a gap, and a run.\n \"gapped line\": build.line({ key: \"goals\", series: \"goals\", points, breaks: [2], width: 2 }),\n point: build.point({ key: \"p\", x: moved ? 40 : 10, y: moved ? 25 : 10, r: 3 })\n });\n}\n","// checkEffect and checkTransition: the conformance checks from plan §8 for one effect, on many marks\n// or pairs of marks. They import no test runner: each runs every check on every mark, then throws one\n// Error that lists each failure, so `await checkEffect(effect)` works in Vitest, Jest, node:test or Mocha.\n\nimport type { AnyMarkEffect, DataEffect, GeometryEffect, Icon, MarkData, MarkGeometry, Sample, TransitionContext, TransitionEffect } from \"../core\";\nimport { describeValue, isMarkEffect } from \"../core/registry\";\nimport { flush, play, testContext, type Picture, type TestContext, type TestContextOptions } from \"../core/testing\";\nimport { isTransitionEffect } from \"../core/transition\";\nimport { fixturePairs, fixtures, movedFixtures, type FixtureName } from \"./fixtures\";\n\nexport interface CheckEffectOptions<D = unknown> {\n /**\n * The marks to check on: named, or a list such as a chart's `marks()` (each named by its key in the\n * report). Default: `fixtures`, every kind of mark.\n */\n readonly marks?: Readonly<Record<string, MarkGeometry>> | readonly MarkGeometry[];\n /** The icons the effect looks up by name, through `ctx.icons`. Default: none. */\n readonly icons?: readonly Icon[];\n /**\n * For a data effect, each mark's data. Default: no datum, values from 0 to 1 along the walk (each\n * sample's value is its `t`), and no related series, so an effect that reads its rows or `needs`\n * related series has to pass this. On a mark with gaps, there's a sample at each end of each gap,\n * with `gapBefore` on the one after, as on a line chart's line with a missing value.\n */\n readonly data?: (mark: MarkGeometry) => MarkData<D>;\n /**\n * The same mark moved (a resize, a transition's next frame): another geometry with the same key, for\n * the check that the effect follows `onChange`. Undefined skips that check on the mark. Default:\n * each fixture's moved twin, and nothing for other marks, so a page's own marks pass this or skip it.\n */\n readonly moved?: (mark: MarkGeometry) => MarkGeometry | undefined;\n /** The mark's place among the marks of its event, for effects that read `ctx.batch` (stagger). Default: the only one. */\n readonly batch?: { readonly index: number; readonly count: number };\n /** What the report calls the effect. Default: \"the effect\". */\n readonly name?: string;\n}\n\n/** A data effect typed for its own rows: data(mark) has to give them. */\ntype WithData<D> = CheckEffectOptions<D> & { readonly data: (mark: MarkGeometry) => MarkData<D> };\n\n/**\n * Runs the conformance checks on every mark (`options.marks`, or the fixtures):\n * 1. a full run ends with the same picture and mark style as `end()`;\n * 2. clearing leaves nothing drawn, the mark's own style, and no frames running;\n * 3. an abort mid-run settles the run (it resolves, without more frames) and clears to nothing;\n * 4. with motion off, no frames run and the run draws what `end()` draws;\n * 5. after a full run, and after `end()`, a `change()` to the moved mark (`options.moved`) leaves the\n * picture and mark style `end()` draws on it, so an effect that should stay attached follows `onChange`.\n *\n * Resolves when every check passes. Otherwise it rejects with one Error that lists every failure:\n * the mark, the check and what differed. A data effect typed for its own rows needs `data`, and so\n * does one that `needs` related series.\n */\nexport function checkEffect(effect: GeometryEffect | DataEffect<unknown>, options?: CheckEffectOptions<unknown>): Promise<void>;\nexport function checkEffect<D>(effect: GeometryEffect | DataEffect<D>, options: WithData<D>): Promise<void>;\nexport async function checkEffect(effect: AnyMarkEffect, options: CheckEffectOptions<any> = {}): Promise<void> {\n if (!isMarkEffect(effect)) {\n const hint = isTransitionEffect(effect) ? \"; check it with checkTransition\" : \"\";\n throw new TypeError(`checkEffect needs a mark effect (kind \"geometry\" or \"data\"), got ${describeValue(effect)}${hint}.`);\n }\n const name = options.name ?? \"the effect\";\n const related = effect.kind === \"data\" ? (effect.needs?.related ?? []) : [];\n if (related.length > 0 && !options.data) {\n throw new TypeError(\n `checkEffect: ${name} needs the related series ${related.map((s) => `\"${s}\"`).join(\", \")}, so pass data(mark) with them: the default data has no related series.`\n );\n }\n const marks = named(options.marks ?? fixtures);\n if (marks.length === 0) throw new TypeError(\"checkEffect: there are no marks to check on.\");\n\n const dataOf = (mark: MarkGeometry): MarkData<unknown> | undefined => (effect.kind === \"data\" ? (options.data ?? defaultData)(mark) : undefined);\n const failures: string[] = [];\n for (const [markName, mark] of marks) {\n let data: MarkData<unknown> | undefined;\n try {\n data = dataOf(mark);\n } catch (error) {\n failures.push(`on ${markName}: data(mark) threw ${describeError(error)}`);\n continue;\n }\n let moved: Moved | undefined;\n try {\n moved = movedSubject(effect, (options.moved ?? movedFixture)(mark), dataOf);\n } catch (error) {\n failures.push(`on ${markName}: the moved mark, or its data, threw ${describeError(error)}`);\n }\n const subject: Subject = {\n context: (more = {}) => testContext({ icons: options.icons, batch: options.batch, ...more }),\n run: (ctx) => promised(effect.kind === \"data\" ? effect.run(mark, data!, ctx) : effect.run(mark, ctx)),\n end: (ctx) => (effect.kind === \"data\" ? effect.end(mark, data!, ctx) : effect.end(mark, ctx)),\n clear: (ctx) => effect.clear(ctx),\n moved\n };\n for (const check of CHECKS) {\n const problem = await attempt(check, subject);\n if (problem) failures.push(`on ${markName}, ${check.title}: ${problem}`);\n }\n }\n\n if (failures.length > 0) throw new Error(`checkEffect found ${problems(failures)} with ${name}:\\n${list(failures)}`);\n}\n\nexport interface CheckTransitionOptions {\n /**\n * The pairs to check on, each as [a, b] and run both ways: named, or a list (each named by its\n * marks' keys in the report). Default: `fixturePairs`, a slice and a column, a bar and a column,\n * two slices, two lines and two points.\n */\n readonly pairs?: Readonly<Record<string, readonly [MarkGeometry, MarkGeometry]>> | readonly (readonly [MarkGeometry, MarkGeometry])[];\n /** The icons the effect looks up by name, through `ctx.icons`. Default: none. */\n readonly icons?: readonly Icon[];\n /** What the report calls the effect. Default: \"the effect\". */\n readonly name?: string;\n}\n\n/** Where the retrace check compares a run forward with a run back. */\nconst RETRACE_AT: readonly number[] = [0.25, 0.5, 0.75];\n\n/**\n * Runs the conformance checks for a transition effect on every pair (`options.pairs`, or the fixture\n * pairs), from a to b and from b to a:\n * 1. a full run ends with the same picture as `end()`;\n * 2. clearing leaves nothing drawn and no frames running;\n * 3. an abort mid-run settles the run (it resolves, without more frames) and clears to nothing;\n * 4. with motion off, no frames run and the run draws what `end()` draws;\n * 5. a run from `start: 0.5` ends with the same picture as `end()`;\n * 6. it retraces: at p = 0.25, 0.5 and 0.75, a run from b to a from `start: 1 - p` begins with the\n * picture a run from a to b begins with from `start: p`, the picture a full run draws at p. So a\n * switch back mid-way doesn't jump, and a pairing that depends on which mark is `from` fails.\n *\n * Resolves when every check passes. Otherwise it rejects with one Error that lists every failure:\n * the pair, which way, the check and what differed.\n */\nexport async function checkTransition(effect: TransitionEffect, options: CheckTransitionOptions = {}): Promise<void> {\n if (!isTransitionEffect(effect)) {\n const hint = isMarkEffect(effect) ? \"; check it with checkEffect\" : \"\";\n throw new TypeError(`checkTransition needs a transition effect (kind \"transition\" with run, end and clear), got ${describeTransition(effect)}${hint}.`);\n }\n const name = options.name ?? \"the effect\";\n const pairs = namedPairs(options.pairs ?? fixturePairs);\n if (pairs.length === 0) throw new TypeError(\"checkTransition: there are no pairs to check on.\");\n\n const failures: string[] = [];\n for (const [pairName, [a, b]] of pairs) {\n for (const [way, from, to] of [[\"a to b\", a, b], [\"b to a\", b, a]] as const) {\n for (const check of COMMON) {\n const problem = await attempt(check, transitionSubject(effect, from, to, 0, options.icons));\n if (problem) failures.push(`on ${pairName}, ${way}, ${check.title}: ${problem}`);\n }\n const problem = await attempt(FULL_RUN, transitionSubject(effect, from, to, 0.5, options.icons));\n if (problem) failures.push(`on ${pairName}, ${way}, a run from start: 0.5 should end with the same picture as end(): ${problem}`);\n }\n let problem: string | undefined;\n try {\n problem = await retraces(effect, a, b, options.icons);\n } catch (error) {\n problem = `it threw ${describeError(error)}`;\n }\n if (problem) failures.push(`on ${pairName}, a run back should retrace the run forward: ${problem}`);\n }\n\n if (failures.length > 0) throw new Error(`checkTransition found ${problems(failures)} with ${name}:\\n${list(failures)}`);\n}\n\n/** A test context that is also a transition's, starting at `start`. */\ntype TransitionTestContext = TestContext & TransitionContext;\n\nfunction transitionContext(start: number, options: TestContextOptions): TransitionTestContext {\n return { ...testContext(options), start };\n}\n\n/** One transition effect on one pair, one way, from `start`, as a Subject. Its contexts carry `start`. */\nfunction transitionSubject(effect: TransitionEffect, from: MarkGeometry, to: MarkGeometry, start: number, icons: readonly Icon[] | undefined): Subject {\n return {\n context: (more = {}) => transitionContext(start, { icons, ...more }),\n run: (ctx) => promised(effect.run(from, to, ctx as TransitionTestContext)),\n end: (ctx) => effect.end(from, to, ctx as TransitionTestContext),\n clear: (ctx) => effect.clear(ctx as TransitionTestContext),\n moved: undefined\n };\n}\n\n/** What a run from `start` draws before its first frame, after which it's aborted and cleared. */\nasync function opening(effect: TransitionEffect, from: MarkGeometry, to: MarkGeometry, start: number, icons: readonly Icon[] | undefined): Promise<Picture[]> {\n const ctx = transitionContext(start, { icons });\n const run = track(promised(effect.run(from, to, ctx)));\n await flush();\n const picture = ctx.layer.picture();\n ctx.abort();\n await settle(run);\n effect.clear(ctx);\n ctx.clear();\n if (run.failed) throw run.error;\n return picture;\n}\n\n/** The retrace check (6): what differs between a run back from 1 - p and a run forward from p, or undefined. */\nasync function retraces(effect: TransitionEffect, a: MarkGeometry, b: MarkGeometry, icons: readonly Icon[] | undefined): Promise<string | undefined> {\n for (const p of RETRACE_AT) {\n const forward = await opening(effect, a, b, p, icons);\n const back = await opening(effect, b, a, 1 - p, icons);\n if (same(back, forward)) continue;\n const index = back.findIndex((item, i) => !same(item, forward[i]));\n const what =\n back.length !== forward.length\n ? `${back.length} ${back.length === 1 ? \"item\" : \"items\"} (${show(back)}) where the run from a to b from start: ${p} begins with ${forward.length} (${show(forward)})`\n : `item ${index + 1} unlike the run from a to b from start: ${p}: ${difference(back[index], forward[index])}`;\n return `the run from b to a from start: ${1 - p} begins with ${what}`;\n }\n return undefined;\n}\n\n/** How a drawn item differs from another: its first differing field, and for long text the part where they part. */\nfunction difference(actual: unknown, expected: unknown): string {\n if (typeof actual !== \"object\" || typeof expected !== \"object\" || actual === null || expected === null) return `${show(actual)}, not ${show(expected)}`;\n const a = actual as Record<string, unknown>;\n const b = expected as Record<string, unknown>;\n for (const field of new Set([...Object.keys(a), ...Object.keys(b)])) {\n const x = a[field];\n const y = b[field];\n if (same(x, y)) continue;\n if (typeof x !== \"string\" || typeof y !== \"string\") return `its ${field} is ${show(x)}, not ${show(y)}`;\n let at = 0;\n while (at < x.length && x[at] === y[at]) at++;\n const from = Math.max(0, at - 24);\n const part = (text: string): string => `${from > 0 ? \"…\" : \"\"}${text.slice(from, at + 24)}${at + 24 < text.length ? \"…\" : \"\"}`;\n return `its ${field} parts at character ${at + 1}: ${JSON.stringify(part(x))}, not ${JSON.stringify(part(y))}`;\n }\n return `${show(actual)}, not ${show(expected)}`;\n}\n\nfunction namedPairs(\n pairs: Readonly<Record<string, readonly [MarkGeometry, MarkGeometry]>> | readonly (readonly [MarkGeometry, MarkGeometry])[]\n): [string, readonly [MarkGeometry, MarkGeometry]][] {\n if (!Array.isArray(pairs)) return Object.entries(pairs as Readonly<Record<string, readonly [MarkGeometry, MarkGeometry]>>).map(([name, pair]) => [`the ${name}`, pair]);\n return (pairs as readonly (readonly [MarkGeometry, MarkGeometry])[]).map((pair, i) => {\n const [a, b] = pair;\n const keys = a?.key === b?.key ? `\"${String(a?.key)}\"` : `\"${String(a?.key)}\" and \"${String(b?.key)}\"`;\n return [`pair ${i + 1} (${keys})`, pair];\n });\n}\n\nfunction describeTransition(value: unknown): string {\n if (typeof value !== \"object\" || value === null) return value === null ? \"null\" : typeof value;\n const kind = (value as { kind?: unknown }).kind;\n if (kind === \"geometry\" || kind === \"data\") return `a ${kind} effect, which plays on one mark`;\n if (kind === \"transition\") return \"a transition effect without run(), end() and clear()\";\n return kind === undefined ? \"an object with no kind\" : `an effect of kind ${JSON.stringify(kind)}`;\n}\n\n/** One effect on one mark (or one pair), ready to run on fresh contexts. */\ninterface Subject {\n context(options?: TestContextOptions): TestContext;\n /** Starts a run; throws if run() doesn't return a promise. */\n run(ctx: TestContext): Promise<void>;\n end(ctx: TestContext): void;\n /** The effect's own clear(). */\n clear(ctx: TestContext): void;\n /** The mark moved, for the onChange check; undefined skips it. */\n readonly moved: Moved | undefined;\n}\n\n/** A check's problem on the subject, or undefined; throwing counts as one. */\nasync function attempt(check: Check, subject: Subject): Promise<string | undefined> {\n try {\n return await check.test(subject);\n } catch (error) {\n return `it threw ${describeError(error)}`;\n }\n}\n\n/** run()'s result, which must be a promise. */\nfunction promised(running: unknown): Promise<void> {\n if (typeof (running as Promise<void> | undefined)?.then !== \"function\") throw new TypeError(`run() must return a promise, got ${describeValue(running)}.`);\n return running as Promise<void>;\n}\n\nconst problems = (failures: readonly string[]): string => (failures.length === 1 ? \"1 problem\" : `${failures.length} problems`);\nconst list = (failures: readonly string[]): string => failures.map((failure) => `- ${failure}`).join(\"\\n\");\n\n/** The moved mark, with its data. */\ninterface Moved {\n /** Tells the run's onChange listeners the mark moved, with its data there, as the runner does. */\n change(ctx: TestContext): void;\n /** end() on the moved mark. */\n end(ctx: TestContext): void;\n}\n\n/** The moved twin of a fixture (the same object, whatever it is named); nothing for other marks. */\nfunction movedFixture(mark: MarkGeometry): MarkGeometry | undefined {\n const name = (Object.keys(fixtures) as FixtureName[]).find((fixture) => fixtures[fixture] === mark);\n return name === undefined ? undefined : movedFixtures[name];\n}\n\nfunction movedSubject(effect: AnyMarkEffect, mark: MarkGeometry | undefined, dataOf: (mark: MarkGeometry) => MarkData<unknown> | undefined): Moved | undefined {\n if (mark === undefined) return undefined;\n const data = dataOf(mark);\n return {\n change: (ctx) => ctx.change(mark, data),\n end: (ctx) => (effect.kind === \"data\" ? effect.end(mark, data!, ctx) : effect.end(mark, ctx))\n };\n}\n\ninterface Check {\n readonly title: string;\n /** What went wrong, or undefined. Throwing counts as a failure too. */\n test(subject: Subject): Promise<string | undefined>;\n}\n\nconst FULL_RUN: Check = {\n title: \"a full run should end with the same picture and mark style as end()\",\n async test(subject) {\n const ran = subject.context();\n const run = track(subject.run(ran));\n await play(ran.clock, run.done);\n if (run.failed) return `run() rejected with ${describeError(run.error)}`;\n const ended = subject.context();\n subject.end(ended);\n return compare(ran, ended, \"after the run\");\n }\n};\n\n/** The checks for every kind of effect: checkEffect's first four, which checkTransition runs too. */\nconst COMMON: readonly Check[] = [\n FULL_RUN,\n {\n title: \"clearing should leave nothing behind\",\n async test(subject) {\n const ctx = subject.context();\n const run = track(subject.run(ctx));\n await play(ctx.clock, run.done);\n subject.clear(ctx);\n ctx.clear();\n // Nothing may come back afterwards, from a listener or a tween that outlived the run.\n ctx.clock.advance(48);\n await flush();\n return leftovers(ctx);\n }\n },\n {\n title: \"an abort mid-run should settle the run and clear to nothing\",\n async test(subject) {\n const ctx = subject.context();\n const run = track(subject.run(ctx));\n ctx.clock.advance(16);\n ctx.clock.advance(16);\n ctx.abort();\n await settle(run);\n if (!run.settled) return \"run() was still running after the abort; it should resolve once ctx.signal aborts, without more frames\";\n if (run.failed) return `run() rejected with ${describeError(run.error)} (it should resolve, aborted or not)`;\n subject.clear(ctx);\n ctx.clear();\n return leftovers(ctx);\n }\n },\n {\n title: \"with motion off, no frames should run and the end state should be drawn\",\n async test(subject) {\n const ctx = subject.context({ mode: \"off\" });\n const run = track(subject.run(ctx));\n const framesAtStart = !ctx.clock.idle;\n await settle(run);\n if (!run.settled) return \"run() didn't finish; with motion off ctx.tween() ends at once, so wait only through it, never on a timer\";\n if (run.failed) return `run() rejected with ${describeError(run.error)}`;\n if (framesAtStart || !ctx.clock.idle) return \"it asked for animation frames\";\n const ended = subject.context({ mode: \"off\" });\n subject.end(ended);\n return compare(ctx, ended, \"after the run with motion off\");\n }\n }\n];\n\nconst CHECKS: readonly Check[] = [\n ...COMMON,\n {\n title: \"a change() to the moved mark should leave what end() draws on it\",\n async test(subject) {\n const { moved } = subject;\n if (!moved) return undefined;\n const problems: string[] = [];\n\n const ran = subject.context();\n const run = track(subject.run(ran));\n await play(ran.clock, run.done);\n if (run.failed) return `run() rejected with ${describeError(run.error)}`;\n moved.change(ran);\n if (!(await finish(ran))) return \"it was still animating 10 s after the change()\";\n const ended = subject.context();\n moved.end(ended);\n const afterRun = compare(ran, ended, \"after a full run and a change()\");\n if (afterRun) problems.push(afterRun);\n\n // With motion off the runner draws end() instead of running, and changes still come.\n const still = subject.context({ mode: \"off\" });\n subject.end(still);\n moved.change(still);\n await flush();\n const endedOff = subject.context({ mode: \"off\" });\n moved.end(endedOff);\n const afterEnd = compare(still, endedOff, \"after end() and a change()\");\n if (afterEnd) problems.push(afterEnd);\n return problems.length > 0 ? problems.join(\"; \") : undefined;\n }\n }\n];\n\n/** Runs frames until nothing animates (an effect may ease to the new geometry); false if it's still going after 10 s. */\nasync function finish(ctx: TestContext): Promise<boolean> {\n await flush();\n for (let elapsed = 0; !ctx.clock.idle; elapsed += 16) {\n if (elapsed >= 10_000) return false;\n ctx.clock.advance(16);\n await flush();\n }\n return true;\n}\n\n/**\n * No datum, values 0 to 1 along the walk, no related series. On a mark with gaps, a sample at each\n * end of each gap too, with `gapBefore` on the one after, as a line chart gives a line with a missing\n * value; samples at one `t` (a gap from 0, or gaps either side of a value alone) are one.\n */\nconst defaultData = (mark: MarkGeometry): MarkData<unknown> => {\n const samples: Sample[] = [{ t: 0, value: 0 }];\n const add = (t: number, gapBefore: boolean): void => {\n const last = samples[samples.length - 1]!;\n if (t === last.t) samples[samples.length - 1] = gapBefore ? { ...last, gapBefore } : last;\n else samples.push(gapBefore ? { t, value: t, gapBefore } : { t, value: t });\n };\n for (const [from, to] of mark.gaps ?? []) {\n add(from, false);\n add(to, true);\n }\n add(1, false);\n return { datum: undefined, samples, related: () => undefined };\n};\n\nfunction named(marks: Readonly<Record<string, MarkGeometry>> | readonly MarkGeometry[]): [string, MarkGeometry][] {\n if (!Array.isArray(marks)) return Object.entries(marks as Readonly<Record<string, MarkGeometry>>).map(([name, mark]) => [`the ${name}`, mark]);\n const seen = new Map<string, number>();\n return (marks as readonly MarkGeometry[]).map((mark) => {\n const count = (seen.get(mark.key) ?? 0) + 1;\n seen.set(mark.key, count);\n return [`mark \"${mark.key}\"${count > 1 ? ` (${count})` : \"\"}`, mark];\n });\n}\n\ninterface Tracked {\n /** Resolves when the run settles, either way. */\n readonly done: Promise<void>;\n readonly settled: boolean;\n readonly failed: boolean;\n readonly error: unknown;\n}\n\nfunction track(running: Promise<void>): Tracked {\n const state = { settled: false, failed: false, error: undefined as unknown };\n const done = running.then(\n () => {\n state.settled = true;\n },\n (error: unknown) => {\n Object.assign(state, { settled: true, failed: true, error });\n }\n );\n return Object.assign(state, { done });\n}\n\n/** Lets promise callbacks run, with no frames, until the run settles or plainly won't. */\nasync function settle(run: Tracked): Promise<void> {\n for (let i = 0; i < 10 && !run.settled; i++) await flush();\n}\n\n/** What differs between two contexts' pictures and mark styles, or undefined. */\nfunction compare(actual: TestContext, expected: TestContext, when: string): string | undefined {\n const problems: string[] = [];\n const drawn = actual.layer.picture();\n const wanted = expected.layer.picture();\n if (!same(drawn, wanted)) {\n const index = drawn.findIndex((item, i) => !same(item, wanted[i]));\n problems.push(\n drawn.length !== wanted.length\n ? `${drawn.length} ${drawn.length === 1 ? \"item is\" : \"items are\"} drawn ${when} but end() draws ${wanted.length} (${show(drawn)} vs ${show(wanted)})`\n : `item ${index + 1} drawn ${when} is ${show(drawn[index])} but end() draws ${show(wanted[index])}`\n );\n }\n const style = rounded(actual.mark.style);\n const wantedStyle = rounded(expected.mark.style);\n if (!same(style, wantedStyle)) problems.push(`the mark's style ${when} is ${show(style)} but end() leaves ${show(wantedStyle)}`);\n return problems.length > 0 ? problems.join(\"; \") : undefined;\n}\n\n/** What a cleared context still has: drawings, a mark style, running frames. */\nfunction leftovers(ctx: TestContext): string | undefined {\n const problems: string[] = [];\n if (ctx.layer.drawn.length > 0) problems.push(`${show(ctx.layer.picture())} is still drawn`);\n if (Object.keys(ctx.mark.style).length > 0) problems.push(`the mark's style is still ${show(ctx.mark.style)}`);\n if (!ctx.clock.idle) problems.push(\"animation frames are still running\");\n return problems.length > 0 ? problems.join(\"; \") : undefined;\n}\n\n/** Deep equality for plain data, ignoring key order. */\nfunction same(a: unknown, b: unknown): boolean {\n if (a === b || (Number.isNaN(a) && Number.isNaN(b))) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) return false;\n if (Array.isArray(a) !== Array.isArray(b)) return false;\n const keysA = Object.keys(a).filter((key) => (a as Record<string, unknown>)[key] !== undefined);\n const keysB = Object.keys(b).filter((key) => (b as Record<string, unknown>)[key] !== undefined);\n return keysA.length === keysB.length && keysA.every((key) => same((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key]));\n}\n\n/** Numbers rounded to 0.001, as pictures are, so float noise in a style isn't a difference. */\nfunction rounded(value: unknown): unknown {\n if (typeof value === \"number\") {\n const round = Math.round(value * 1000) / 1000;\n return round === 0 ? 0 : round;\n }\n if (Array.isArray(value)) return value.map(rounded);\n if (typeof value === \"object\" && value !== null) return Object.fromEntries(Object.entries(value).map(([key, field]) => [key, rounded(field)]));\n return value;\n}\n\nconst LONGEST = 240;\n\nfunction show(value: unknown): string {\n const text = JSON.stringify(value) ?? String(value);\n return text.length > LONGEST ? `${text.slice(0, LONGEST - 1)}…` : text;\n}\n\nfunction describeError(error: unknown): string {\n return error instanceof Error ? `${error.name}: ${error.message}` : show(error);\n}\n"],"mappings":";;AA4DA,SAAgB,iBAAiC;CAC/C,MAAM,wBAAQ,IAAI,IAAmB;CACrC,MAAM,QAAqB,CAAC;CAC5B,IAAI,SAAS;CAGb,MAAM,WAAW,IAAY,SAA0C;EACrE,MAAM,UAAU,MAAM,IAAI,EAAE;EAC5B,IAAI,SAAS,MAAM,IAAI,IAAI,KAAK,OAAO,CAAC;CAC1C;CACA,MAAM,UAAU,OAAqB;EACnC,MAAM,KAAK;GAAE,IAAI;GAAU;EAAG,CAAC;EAC/B,MAAM,OAAO,EAAE;CACjB;CAEA,OAAO;EACL,IAAI,QAAQ;GACV,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC;EAC3B;EACA,IAAI,QAAQ;GACV,OAAO;EACT;EACA,KAAK,MAAM,SAAS;GAClB,MAAM,KAAK;GACX,MAAM,OAAO,SAAS;GACtB,MAAM,KAAK;IAAE,IAAI;IAAQ;IAAI,MAAM,KAAK;IAAM;GAAK,CAAC;GACpD,MAAM,IAAI,IAAI;IAAE,MAAM;IAAQ;IAAI;IAAM;IAAM,WAAW,KAAA;GAAU,CAAC;GAQpE,OAAO;IANL,MAAM,WAAW;KACf,MAAM,KAAK;MAAE,IAAI;MAAS;MAAI;KAAU,CAAC;KACzC,QAAQ,KAAK,aAAa;MAAE,GAAG;MAAS;KAAU,EAAe;IACnE;IACA,cAAc,OAAO,EAAE;GAEb;EACd;EACA,KAAK,GAAG,OAAO;GACb,MAAM,KAAK;GACX,MAAM,KAAK;IAAE,IAAI;IAAQ;IAAI;IAAG;GAAM,CAAC;GACvC,MAAM,IAAI,IAAI;IAAE,MAAM;IAAQ;IAAI;IAAG,OAAO,EAAE,GAAG,MAAM;GAAE,CAAC;GAW1D,OA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AAO,UAAU,YAAY,UAAU,MAAM,OAAO,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,QAAQ,KAAK,CAAC,CAAC,CAAC;CAC7I,OAAO;AACT;AAEA,MAAM,UAAU;AAEhB,SAAS,KAAK,OAAwB;CACpC,MAAM,OAAO,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;CAClD,OAAO,KAAK,SAAS,UAAU,GAAG,KAAK,MAAM,GAAG,GAAW,EAAE,KAAK;AACpE;AAEA,SAAS,cAAc,OAAwB;CAC7C,OAAO,iBAAiB,QAAQ,GAAG,MAAM,KAAK,IAAI,MAAM,YAAY,KAAK,KAAK;AAChF"}
|
|
1
|
+
{"version":3,"file":"testing.js","names":["merge","build"],"sources":["../src/core/testing/recording.ts","../src/core/testing/context.ts","../src/core/testing/play.ts","../src/testing/fixtures.ts","../src/testing/check.ts"],"sourcesContent":["// In-memory versions of the drawing API, so effects can be tested with no DOM at all.\n\nimport type { IconHandle, Layer, MarkHandle, MarkStyle, Matrix, Paint, PathHandle, TextHandle, TextStyle } from \"../contracts/drawing\";\nimport type { Icon } from \"../contracts/icon\";\nimport type { EffectSlot } from \"../contracts/slots\";\nimport { mergeFields as merge } from \"../merge\";\nimport type { RunnerSurface, SurfaceGroup } from \"../runner\";\n\nexport interface DrawnIcon {\n readonly kind: \"icon\";\n readonly id: number;\n readonly icon: Icon;\n readonly size: number | undefined;\n /** Undefined until first placed, while the icon is hidden. */\n readonly transform: Matrix | undefined;\n}\n\nexport interface DrawnPath {\n readonly kind: \"path\";\n readonly id: number;\n readonly d: string;\n readonly paint: Paint;\n}\n\nexport interface DrawnText {\n readonly kind: \"text\";\n readonly id: number;\n readonly content: string;\n readonly style: TextStyle;\n}\n\nexport type Drawn = DrawnIcon | DrawnPath | DrawnText;\n\n/** Every call made on a layer or its handles, in order. Calls on removed handles are logged and ignored. */\nexport type LayerCall =\n | { readonly op: \"icon\"; readonly id: number; readonly icon: string; readonly size: number | undefined }\n | { readonly op: \"place\"; readonly id: number; readonly transform: Matrix }\n | { readonly op: \"path\"; readonly id: number; readonly d: string; readonly paint: Paint }\n | { readonly op: \"update-path\"; readonly id: number; readonly d: string; readonly paint: Partial<Paint> | undefined }\n | { readonly op: \"text\"; readonly id: number; readonly content: string; readonly style: TextStyle }\n | { readonly op: \"update-text\"; readonly id: number; readonly style: Partial<TextStyle>; readonly content: string | undefined }\n | { readonly op: \"remove\"; readonly id: number }\n | { readonly op: \"clear\" };\n\n/** What's on screen, without ids and with numbers rounded, so a full run can be compared with end(). */\nexport type Picture =\n | { readonly kind: \"icon\"; readonly icon: string; readonly size: number | undefined; readonly transform: readonly number[] | undefined }\n | { readonly kind: \"path\"; readonly d: string; readonly paint: Paint }\n | { readonly kind: \"text\"; readonly content: string; readonly style: TextStyle };\n\nexport interface RecordingLayer extends Layer {\n /** What's drawn now, in creation order (which is also stacking order). */\n readonly drawn: readonly Drawn[];\n readonly calls: readonly LayerCall[];\n /** `drawn` as plain data, numbers rounded to `decimals` (default 3). */\n picture(decimals?: number): Picture[];\n /** Remove everything, as the runner does when a run is cleared. */\n clear(): void;\n}\n\nexport function recordingLayer(): RecordingLayer {\n const drawn = new Map<number, Drawn>();\n const calls: LayerCall[] = [];\n let nextId = 1;\n\n // Replaces a live item; calls on removed handles change nothing.\n const replace = (id: number, next: (current: Drawn) => Drawn): void => {\n const current = drawn.get(id);\n if (current) drawn.set(id, next(current));\n };\n const remove = (id: number): void => {\n calls.push({ op: \"remove\", id });\n drawn.delete(id);\n };\n\n return {\n get drawn() {\n return [...drawn.values()];\n },\n get calls() {\n return calls;\n },\n icon(icon, options) {\n const id = nextId++;\n const size = options?.size;\n calls.push({ op: \"icon\", id, icon: icon.name, size });\n drawn.set(id, { kind: \"icon\", id, icon, size, transform: undefined });\n const handle: IconHandle = {\n place(transform) {\n calls.push({ op: \"place\", id, transform });\n replace(id, (current) => ({ ...current, transform }) as DrawnIcon);\n },\n remove: () => remove(id)\n };\n return handle;\n },\n path(d, paint) {\n const id = nextId++;\n calls.push({ op: \"path\", id, d, paint });\n drawn.set(id, { kind: \"path\", id, d, paint: { ...paint } });\n const handle: PathHandle = {\n update(nextD, nextPaint) {\n calls.push({ op: \"update-path\", id, d: nextD, paint: nextPaint });\n replace(id, (current) => {\n const path = current as DrawnPath;\n return { ...path, d: nextD, paint: merge(path.paint, nextPaint) };\n });\n },\n remove: () => remove(id)\n };\n return handle;\n },\n text(content, style) {\n const id = nextId++;\n calls.push({ op: \"text\", id, content, style });\n drawn.set(id, { kind: \"text\", id, content, style: { ...style } });\n const handle: TextHandle = {\n update(nextStyle, nextContent) {\n calls.push({ op: \"update-text\", id, style: nextStyle, content: nextContent });\n replace(id, (current) => {\n const text = current as DrawnText;\n return { ...text, style: merge(text.style, nextStyle), content: nextContent ?? text.content };\n });\n },\n remove: () => remove(id)\n };\n return handle;\n },\n picture(decimals = 3) {\n const round = rounder(decimals);\n return [...drawn.values()].map((item): Picture => {\n switch (item.kind) {\n case \"icon\":\n return { kind: \"icon\", icon: item.icon.name, size: item.size, transform: item.transform?.map(round) };\n case \"path\":\n return { kind: \"path\", d: item.d, paint: roundFields(item.paint, round) };\n case \"text\":\n return { kind: \"text\", content: item.content, style: { ...roundFields(item.style, round), at: { x: round(item.style.at.x), y: round(item.style.at.y) } } };\n }\n });\n },\n clear() {\n calls.push({ op: \"clear\" });\n drawn.clear();\n }\n };\n}\n\nexport type MarkCall = { readonly op: \"set\"; readonly style: MarkStyle } | { readonly op: \"reset\" };\n\nexport interface RecordingMark extends MarkHandle {\n /** The style now, after every set() and reset(). Empty means the mark's own style. */\n readonly style: MarkStyle;\n readonly calls: readonly MarkCall[];\n}\n\nexport function recordingMark(): RecordingMark {\n let style: MarkStyle = {};\n const calls: MarkCall[] = [];\n return {\n get style() {\n return style;\n },\n get calls() {\n return calls;\n },\n set(next) {\n calls.push({ op: \"set\", style: next });\n style = merge(style, next);\n },\n reset() {\n calls.push({ op: \"reset\" });\n style = {};\n }\n };\n}\n\n/** One overlay group a runner asked for. */\nexport interface RecordedGroup {\n readonly key: string;\n readonly slot: EffectSlot;\n /** The run's start order, which stacks groups. */\n readonly order: number;\n readonly layer: RecordingLayer;\n /** True once the runner cleared it. */\n readonly cleared: boolean;\n}\n\n/** A RunnerSurface in memory: every run's group is a recording layer, every mark a recording mark. */\nexport interface RecordingSurface extends RunnerSurface {\n /** Every group asked for, in order, cleared ones included. */\n readonly groups: readonly RecordedGroup[];\n /** The mark's handle, made on first use. */\n mark(key: string): RecordingMark;\n /** What's drawn now in the groups not yet cleared, optionally for one key, bottom to top (by order), as RecordingLayer.picture() gives it. */\n picture(key?: string): Picture[];\n}\n\nexport function recordingSurface(): RecordingSurface {\n const groups: { key: string; slot: EffectSlot; order: number; layer: RecordingLayer; cleared: boolean }[] = [];\n const marks = new Map<string, RecordingMark>();\n return {\n groups,\n group(key, slot, order) {\n const record = { key, slot, order, layer: recordingLayer(), cleared: false };\n groups.push(record);\n const group: SurfaceGroup = {\n icon: (icon, options) => record.layer.icon(icon, options),\n path: (d, paint) => record.layer.path(d, paint),\n text: (content, style) => record.layer.text(content, style),\n clear() {\n record.cleared = true;\n record.layer.clear();\n }\n };\n return group;\n },\n mark(key) {\n let mark = marks.get(key);\n if (!mark) marks.set(key, (mark = recordingMark()));\n return mark;\n },\n picture(key) {\n return groups\n .filter((group) => !group.cleared && (key === undefined || group.key === key))\n .sort((a, b) => a.order - b.order)\n .flatMap((group) => group.layer.picture());\n }\n };\n}\n\nfunction rounder(decimals: number): (value: number) => number {\n const factor = 10 ** decimals;\n return (value) => {\n const rounded = Math.round(value * factor) / factor;\n return rounded === 0 ? 0 : rounded;\n };\n}\n\nfunction roundFields<T extends object>(fields: T, round: (value: number) => number): T {\n const result: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(fields)) result[field] = typeof value === \"number\" ? round(value) : value;\n return result as T;\n}\n","// An EffectContext for effect tests: a manual clock, its own motion, and recording drawing handles.\n\nimport { manualClock, type ManualClock } from \"../clock\";\nimport type { MarkData } from \"../contracts/data\";\nimport type { EffectContext, TextSpace } from \"../contracts/effect\";\nimport type { MarkGeometry, Rect } from \"../contracts/geometry\";\nimport type { Icon } from \"../contracts/icon\";\nimport { createMotion, type Motion, type MotionMode, type ScalingOverrides } from \"../motion\";\nimport { runScope } from \"../runner\";\nimport { estimatedBox } from \"../text-box\";\nimport { recordingLayer, recordingMark, type RecordingLayer, type RecordingMark } from \"./recording\";\n\nexport interface TestContextOptions {\n /** The author's mode. Default \"presentation\". The device never asks for reduced motion here. */\n readonly mode?: MotionMode;\n /** Overrides for the duration scaling, as a page's createMotion({ scaling }) gives. */\n readonly scaling?: ScalingOverrides;\n readonly icons?: readonly Icon[];\n readonly batch?: { readonly index: number; readonly count: number };\n readonly previous?: MarkGeometry;\n /** The boxes other effects' text holds, as `texts.held()` gives them: the runs that started before this one. Default none. */\n readonly held?: readonly Rect[];\n}\n\nexport interface TestContext extends EffectContext {\n readonly motion: Motion;\n readonly clock: ManualClock;\n readonly layer: RecordingLayer;\n readonly mark: RecordingMark;\n /**\n * Where effects' text sits, as a chart's runner gives it, with text boxes estimated as in jsdom: 0.6\n * em a character. `holding` is the box the run holds now, undefined once it lets go or is cleared.\n */\n readonly texts: TextSpace & { readonly holding: Rect | undefined };\n /** Abort the run, as the runner does on leave or re-trigger. */\n abort(): void;\n /** The runner's cleanup after effect.clear(ctx): abort, empty the layer, reset the mark, drop onChange listeners, let go of its text. */\n clear(): void;\n /** Tell onChange listeners the geometry moved, as the runner does on every frame of a transition. */\n change(mark: MarkGeometry, data?: MarkData): void;\n}\n\nexport function testContext(options: TestContextOptions = {}): TestContext {\n const clock = manualClock();\n const motion = createMotion({\n mode: options.mode ?? \"presentation\",\n ...(options.scaling ? { scaling: options.scaling } : {}),\n reducedMotion: { matches: false, subscribe: () => () => {} }\n });\n const layer = recordingLayer();\n const mark = recordingMark();\n const icons = new Map((options.icons ?? []).map((icon) => [icon.name, icon]));\n const held = [...(options.held ?? [])];\n let holding: Rect | undefined;\n const texts = {\n box: estimatedBox,\n held: () => held,\n hold(box: Rect | undefined) {\n holding = box;\n },\n get holding() {\n return holding;\n }\n };\n // The same run scope the runner gives every run, so clear() here is the runner's cleanup.\n const scope = runScope({\n clock,\n motion,\n layer,\n mark,\n icons: { get: (name) => icons.get(name) },\n batch: options.batch ?? { index: 0, count: 1 },\n previous: options.previous,\n texts\n });\n\n return {\n ...scope.context,\n motion,\n clock,\n layer,\n mark,\n texts,\n abort: scope.abort,\n clear() {\n scope.clear();\n holding = undefined;\n },\n change: scope.change\n };\n}\n","// Plays a run to its end on a manual clock, for effect tests.\n\nimport type { ManualClock } from \"../clock\";\n\nexport interface PlayOptions {\n /** Ms per frame. Default 16. */\n readonly frame?: number;\n /** Gives up after this many ms. Default 10 000. */\n readonly limit?: number;\n}\n\n/**\n * Advances the clock a frame at a time until `running` settles, letting promise callbacks run\n * between frames (so a sequence's next part starts on time). Resolves with the ms it advanced; throws\n * if `running` hasn't settled within the limit.\n */\nexport async function play(clock: ManualClock, running: Promise<unknown>, options: PlayOptions = {}): Promise<number> {\n const frame = options.frame ?? 16;\n const limit = options.limit ?? 10_000;\n let settled = false;\n running.then(\n () => (settled = true),\n () => (settled = true)\n );\n let elapsed = 0;\n await flush();\n while (!settled) {\n if (elapsed >= limit) throw new Error(`play: still running after ${limit} ms.`);\n clock.advance(frame);\n elapsed += frame;\n await flush();\n }\n return elapsed;\n}\n\n/** Lets pending promise callbacks run. */\nexport async function flush(): Promise<void> {\n for (let i = 0; i < 20; i++) await Promise.resolve();\n}\n","// The marks checkEffect runs an effect on by default: one of each kind the geometry builders\n// describe, plus the awkward cases (a bar growing the other way, a stack with a gap, a bar shorter\n// than most icons, a line that skips a value, a point whose walk has no length). Each has a moved\n// twin: the same mark somewhere else, as a resize or a transition's next frame leaves it, for the\n// check that effects follow onChange. checkTransition's pairs are made of the same marks.\n\nimport { describe as build, type MarkGeometry } from \"../core\";\n\nexport type FixtureName = \"bar\" | \"negative bar\" | \"column\" | \"stacked\" | \"short bar\" | \"slice\" | \"line\" | \"gapped line\" | \"point\";\n\n/** 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. */\nexport const fixtures: Readonly<Record<FixtureName, MarkGeometry>> = /* @__PURE__ */ makeFixtures(false);\n\n/**\n * Each fixture moved: the same key and series, somewhere else and another size. The bars are a row\n * lower and shorter (the stack's segments in another ratio), the slice turned and the ring smaller,\n * the lines further revealed and rescaled, and the point moved.\n */\nexport const movedFixtures: Readonly<Record<FixtureName, MarkGeometry>> = /* @__PURE__ */ makeFixtures(true);\n\nexport type FixturePairName = \"slice and column\" | \"bar and column\" | \"two slices\" | \"two lines\" | \"two points\";\n\n/**\n * The pairs checkTransition runs a transition effect between by default, each both ways: a slice and\n * a column (a mark that goes round its pivot and one that doesn't), a bar and a column, two slices,\n * two lines and two points. The second of two alike is the first's moved twin.\n */\nexport const fixturePairs: Readonly<Record<FixturePairName, readonly [MarkGeometry, MarkGeometry]>> = /* @__PURE__ */ Object.freeze({\n \"slice and column\": [fixtures.slice, fixtures.column],\n \"bar and column\": [fixtures.bar, fixtures.column],\n \"two slices\": [fixtures.slice, movedFixtures.slice],\n \"two lines\": [fixtures.line, movedFixtures.line],\n \"two points\": [fixtures.point, movedFixtures.point]\n} as const);\n\nfunction makeFixtures(moved: boolean): Readonly<Record<FixtureName, MarkGeometry>> {\n const y = moved ? 30 : 0;\n const bar = (width: number, more: Partial<Parameters<typeof build.bar>[0]> = {}): MarkGeometry =>\n build.bar({ key: \"Okafor\", series: \"goals\", x: 0, y, width, height: 20, baseline: \"left\", ...more });\n const [goals, assists] = moved ? [120, 82] : [160, 62];\n const points = moved\n ? [{ x: 0, y: 90 }, { x: 64, y: 58 }, { x: 128, y: 82 }, { x: 192, y: 26 }, { x: 256, y: 40 }]\n : [{ x: 0, y: 100 }, { x: 80, y: 60 }, { x: 160, y: 90 }, { x: 240, y: 20 }];\n return Object.freeze({\n bar: bar(moved ? 160 : 200, { radius: 4 }),\n \"negative bar\": build.bar({ key: \"n\", series: \"goals\", x: moved ? 30 : 0, y, width: moved ? 90 : 120, height: 20, baseline: \"right\" }),\n column: build.bar({ key: \"c\", series: \"goals\", x: moved ? 30 : 0, y: moved ? 40 : 0, width: 20, height: moved ? 110 : 150, baseline: \"bottom\" }),\n stacked: bar(goals + assists, { series: undefined, gap: 2, segments: [{ series: \"goals\", size: goals }, { series: \"assists\", size: assists }] }),\n \"short bar\": bar(moved ? 4 : 6),\n slice: moved\n ? build.arc({ key: \"Saved\", cx: 140, cy: 130, inner: 60, outer: 100, start: 0.5, end: 2 })\n : build.arc({ key: \"Saved\", cx: 150, cy: 150, inner: 70, outer: 116, start: 0.3, end: 2.4 }),\n line: build.line({ key: \"goals\", series: \"goals\", points, width: 2 }),\n // The line broken after its second point: a run, a gap, and a run.\n \"gapped line\": build.line({ key: \"goals\", series: \"goals\", points, breaks: [2], width: 2 }),\n point: build.point({ key: \"p\", x: moved ? 40 : 10, y: moved ? 25 : 10, r: 3 })\n });\n}\n","// checkEffect and checkTransition: the conformance checks from plan §8 for one effect, on many marks\n// or pairs of marks. They import no test runner: each runs every check on every mark, then throws one\n// Error that lists each failure, so `await checkEffect(effect)` works in Vitest, Jest, node:test or Mocha.\n\nimport type { AnyMarkEffect, DataEffect, GeometryEffect, Icon, MarkData, MarkGeometry, Sample, TransitionContext, TransitionEffect } from \"../core\";\nimport { describeValue, isMarkEffect } from \"../core/registry\";\nimport { flush, play, testContext, type Picture, type TestContext, type TestContextOptions } from \"../core/testing\";\nimport { isTransitionEffect } from \"../core/transition\";\nimport { fixturePairs, fixtures, movedFixtures, type FixtureName } from \"./fixtures\";\n\nexport interface CheckEffectOptions<D = unknown> {\n /**\n * The marks to check on: named, or a list such as a chart's `marks()` (each named by its key in the\n * report). Default: `fixtures`, every kind of mark.\n */\n readonly marks?: Readonly<Record<string, MarkGeometry>> | readonly MarkGeometry[];\n /** The icons the effect looks up by name, through `ctx.icons`. Default: none. */\n readonly icons?: readonly Icon[];\n /**\n * For a data effect, each mark's data. Default: no datum, values from 0 to 1 along the walk (each\n * sample's value is its `t`), and no related series, so an effect that reads its rows or `needs`\n * related series has to pass this. On a mark with gaps, there's a sample at each end of each gap,\n * with `gapBefore` on the one after, as on a line chart's line with a missing value.\n */\n readonly data?: (mark: MarkGeometry) => MarkData<D>;\n /**\n * The same mark moved (a resize, a transition's next frame): another geometry with the same key, for\n * the check that the effect follows `onChange`. Undefined skips that check on the mark. Default:\n * each fixture's moved twin, and nothing for other marks, so a page's own marks pass this or skip it.\n */\n readonly moved?: (mark: MarkGeometry) => MarkGeometry | undefined;\n /** The mark's place among the marks of its event, for effects that read `ctx.batch` (stagger). Default: the only one. */\n readonly batch?: { readonly index: number; readonly count: number };\n /** What the report calls the effect. Default: \"the effect\". */\n readonly name?: string;\n}\n\n/** A data effect typed for its own rows: data(mark) has to give them. */\ntype WithData<D> = CheckEffectOptions<D> & { readonly data: (mark: MarkGeometry) => MarkData<D> };\n\n/**\n * Runs the conformance checks on every mark (`options.marks`, or the fixtures):\n * 1. a full run ends with the same picture and mark style as `end()`;\n * 2. clearing leaves nothing drawn, the mark's own style, and no frames running;\n * 3. an abort mid-run settles the run (it resolves, without more frames) and clears to nothing;\n * 4. with motion off, no frames run and the run draws what `end()` draws;\n * 5. after a full run, and after `end()`, a `change()` to the moved mark (`options.moved`) leaves the\n * picture and mark style `end()` draws on it, so an effect that should stay attached follows `onChange`.\n *\n * Resolves when every check passes. Otherwise it rejects with one Error that lists every failure:\n * the mark, the check and what differed. A data effect typed for its own rows needs `data`, and so\n * does one that `needs` related series.\n */\nexport function checkEffect(effect: GeometryEffect | DataEffect<unknown>, options?: CheckEffectOptions<unknown>): Promise<void>;\nexport function checkEffect<D>(effect: GeometryEffect | DataEffect<D>, options: WithData<D>): Promise<void>;\nexport async function checkEffect(effect: AnyMarkEffect, options: CheckEffectOptions<any> = {}): Promise<void> {\n if (!isMarkEffect(effect)) {\n const hint = isTransitionEffect(effect) ? \"; check it with checkTransition\" : \"\";\n throw new TypeError(`checkEffect needs a mark effect (kind \"geometry\" or \"data\"), got ${describeValue(effect)}${hint}.`);\n }\n const name = options.name ?? \"the effect\";\n const related = effect.kind === \"data\" ? (effect.needs?.related ?? []) : [];\n if (related.length > 0 && !options.data) {\n throw new TypeError(\n `checkEffect: ${name} needs the related series ${related.map((s) => `\"${s}\"`).join(\", \")}, so pass data(mark) with them: the default data has no related series.`\n );\n }\n const marks = named(options.marks ?? fixtures);\n if (marks.length === 0) throw new TypeError(\"checkEffect: there are no marks to check on.\");\n\n const dataOf = (mark: MarkGeometry): MarkData<unknown> | undefined => (effect.kind === \"data\" ? (options.data ?? defaultData)(mark) : undefined);\n const failures: string[] = [];\n for (const [markName, mark] of marks) {\n let data: MarkData<unknown> | undefined;\n try {\n data = dataOf(mark);\n } catch (error) {\n failures.push(`on ${markName}: data(mark) threw ${describeError(error)}`);\n continue;\n }\n let moved: Moved | undefined;\n try {\n moved = movedSubject(effect, (options.moved ?? movedFixture)(mark), dataOf);\n } catch (error) {\n failures.push(`on ${markName}: the moved mark, or its data, threw ${describeError(error)}`);\n }\n const subject: Subject = {\n context: (more = {}) => testContext({ icons: options.icons, batch: options.batch, ...more }),\n run: (ctx) => promised(effect.kind === \"data\" ? effect.run(mark, data!, ctx) : effect.run(mark, ctx)),\n end: (ctx) => (effect.kind === \"data\" ? effect.end(mark, data!, ctx) : effect.end(mark, ctx)),\n clear: (ctx) => effect.clear(ctx),\n moved\n };\n for (const check of CHECKS) {\n const problem = await attempt(check, subject);\n if (problem) failures.push(`on ${markName}, ${check.title}: ${problem}`);\n }\n }\n\n if (failures.length > 0) throw new Error(`checkEffect found ${problems(failures)} with ${name}:\\n${list(failures)}`);\n}\n\nexport interface CheckTransitionOptions {\n /**\n * The pairs to check on, each as [a, b] and run both ways: named, or a list (each named by its\n * marks' keys in the report). Default: `fixturePairs`, a slice and a column, a bar and a column,\n * two slices, two lines and two points.\n */\n readonly pairs?: Readonly<Record<string, readonly [MarkGeometry, MarkGeometry]>> | readonly (readonly [MarkGeometry, MarkGeometry])[];\n /** The icons the effect looks up by name, through `ctx.icons`. Default: none. */\n readonly icons?: readonly Icon[];\n /** What the report calls the effect. Default: \"the effect\". */\n readonly name?: string;\n}\n\n/** Where the retrace check compares a run forward with a run back. */\nconst RETRACE_AT: readonly number[] = [0.25, 0.5, 0.75];\n\n/**\n * Runs the conformance checks for a transition effect on every pair (`options.pairs`, or the fixture\n * pairs), from a to b and from b to a:\n * 1. a full run ends with the same picture as `end()`;\n * 2. clearing leaves nothing drawn and no frames running;\n * 3. an abort mid-run settles the run (it resolves, without more frames) and clears to nothing;\n * 4. with motion off, no frames run and the run draws what `end()` draws;\n * 5. a run from `start: 0.5` ends with the same picture as `end()`;\n * 6. it retraces: at p = 0.25, 0.5 and 0.75, a run from b to a from `start: 1 - p` begins with the\n * picture a run from a to b begins with from `start: p`, the picture a full run draws at p. So a\n * switch back mid-way doesn't jump, and a pairing that depends on which mark is `from` fails.\n *\n * Resolves when every check passes. Otherwise it rejects with one Error that lists every failure:\n * the pair, which way, the check and what differed.\n */\nexport async function checkTransition(effect: TransitionEffect, options: CheckTransitionOptions = {}): Promise<void> {\n if (!isTransitionEffect(effect)) {\n const hint = isMarkEffect(effect) ? \"; check it with checkEffect\" : \"\";\n throw new TypeError(`checkTransition needs a transition effect (kind \"transition\" with run, end and clear), got ${describeTransition(effect)}${hint}.`);\n }\n const name = options.name ?? \"the effect\";\n const pairs = namedPairs(options.pairs ?? fixturePairs);\n if (pairs.length === 0) throw new TypeError(\"checkTransition: there are no pairs to check on.\");\n\n const failures: string[] = [];\n for (const [pairName, [a, b]] of pairs) {\n for (const [way, from, to] of [[\"a to b\", a, b], [\"b to a\", b, a]] as const) {\n for (const check of COMMON) {\n const problem = await attempt(check, transitionSubject(effect, from, to, 0, options.icons));\n if (problem) failures.push(`on ${pairName}, ${way}, ${check.title}: ${problem}`);\n }\n const problem = await attempt(FULL_RUN, transitionSubject(effect, from, to, 0.5, options.icons));\n if (problem) failures.push(`on ${pairName}, ${way}, a run from start: 0.5 should end with the same picture as end(): ${problem}`);\n }\n let problem: string | undefined;\n try {\n problem = await retraces(effect, a, b, options.icons);\n } catch (error) {\n problem = `it threw ${describeError(error)}`;\n }\n if (problem) failures.push(`on ${pairName}, a run back should retrace the run forward: ${problem}`);\n }\n\n if (failures.length > 0) throw new Error(`checkTransition found ${problems(failures)} with ${name}:\\n${list(failures)}`);\n}\n\n/** A test context that is also a transition's, starting at `start`. */\ntype TransitionTestContext = TestContext & TransitionContext;\n\nfunction transitionContext(start: number, options: TestContextOptions): TransitionTestContext {\n return { ...testContext(options), start };\n}\n\n/** One transition effect on one pair, one way, from `start`, as a Subject. Its contexts carry `start`. */\nfunction transitionSubject(effect: TransitionEffect, from: MarkGeometry, to: MarkGeometry, start: number, icons: readonly Icon[] | undefined): Subject {\n return {\n context: (more = {}) => transitionContext(start, { icons, ...more }),\n run: (ctx) => promised(effect.run(from, to, ctx as TransitionTestContext)),\n end: (ctx) => effect.end(from, to, ctx as TransitionTestContext),\n clear: (ctx) => effect.clear(ctx as TransitionTestContext),\n moved: undefined\n };\n}\n\n/** What a run from `start` draws before its first frame, after which it's aborted and cleared. */\nasync function opening(effect: TransitionEffect, from: MarkGeometry, to: MarkGeometry, start: number, icons: readonly Icon[] | undefined): Promise<Picture[]> {\n const ctx = transitionContext(start, { icons });\n const run = track(promised(effect.run(from, to, ctx)));\n await flush();\n const picture = ctx.layer.picture();\n ctx.abort();\n await settle(run);\n effect.clear(ctx);\n ctx.clear();\n if (run.failed) throw run.error;\n return picture;\n}\n\n/** The retrace check (6): what differs between a run back from 1 - p and a run forward from p, or undefined. */\nasync function retraces(effect: TransitionEffect, a: MarkGeometry, b: MarkGeometry, icons: readonly Icon[] | undefined): Promise<string | undefined> {\n for (const p of RETRACE_AT) {\n const forward = await opening(effect, a, b, p, icons);\n const back = await opening(effect, b, a, 1 - p, icons);\n if (same(back, forward)) continue;\n const index = back.findIndex((item, i) => !same(item, forward[i]));\n const what =\n back.length !== forward.length\n ? `${back.length} ${back.length === 1 ? \"item\" : \"items\"} (${show(back)}) where the run from a to b from start: ${p} begins with ${forward.length} (${show(forward)})`\n : `item ${index + 1} unlike the run from a to b from start: ${p}: ${difference(back[index], forward[index])}`;\n return `the run from b to a from start: ${1 - p} begins with ${what}`;\n }\n return undefined;\n}\n\n/** How a drawn item differs from another: its first differing field, and for long text the part where they part. */\nfunction difference(actual: unknown, expected: unknown): string {\n if (typeof actual !== \"object\" || typeof expected !== \"object\" || actual === null || expected === null) return `${show(actual)}, not ${show(expected)}`;\n const a = actual as Record<string, unknown>;\n const b = expected as Record<string, unknown>;\n for (const field of new Set([...Object.keys(a), ...Object.keys(b)])) {\n const x = a[field];\n const y = b[field];\n if (same(x, y)) continue;\n if (typeof x !== \"string\" || typeof y !== \"string\") return `its ${field} is ${show(x)}, not ${show(y)}`;\n let at = 0;\n while (at < x.length && x[at] === y[at]) at++;\n const from = Math.max(0, at - 24);\n const part = (text: string): string => `${from > 0 ? \"…\" : \"\"}${text.slice(from, at + 24)}${at + 24 < text.length ? \"…\" : \"\"}`;\n return `its ${field} parts at character ${at + 1}: ${JSON.stringify(part(x))}, not ${JSON.stringify(part(y))}`;\n }\n return `${show(actual)}, not ${show(expected)}`;\n}\n\nfunction namedPairs(\n pairs: Readonly<Record<string, readonly [MarkGeometry, MarkGeometry]>> | readonly (readonly [MarkGeometry, MarkGeometry])[]\n): [string, readonly [MarkGeometry, MarkGeometry]][] {\n if (!Array.isArray(pairs)) return Object.entries(pairs as Readonly<Record<string, readonly [MarkGeometry, MarkGeometry]>>).map(([name, pair]) => [`the ${name}`, pair]);\n return (pairs as readonly (readonly [MarkGeometry, MarkGeometry])[]).map((pair, i) => {\n const [a, b] = pair;\n const keys = a?.key === b?.key ? `\"${String(a?.key)}\"` : `\"${String(a?.key)}\" and \"${String(b?.key)}\"`;\n return [`pair ${i + 1} (${keys})`, pair];\n });\n}\n\nfunction describeTransition(value: unknown): string {\n if (typeof value !== \"object\" || value === null) return value === null ? \"null\" : typeof value;\n const kind = (value as { kind?: unknown }).kind;\n if (kind === \"geometry\" || kind === \"data\") return `a ${kind} effect, which plays on one mark`;\n if (kind === \"transition\") return \"a transition effect without run(), end() and clear()\";\n return kind === undefined ? \"an object with no kind\" : `an effect of kind ${JSON.stringify(kind)}`;\n}\n\n/** One effect on one mark (or one pair), ready to run on fresh contexts. */\ninterface Subject {\n context(options?: TestContextOptions): TestContext;\n /** Starts a run; throws if run() doesn't return a promise. */\n run(ctx: TestContext): Promise<void>;\n end(ctx: TestContext): void;\n /** The effect's own clear(). */\n clear(ctx: TestContext): void;\n /** The mark moved, for the onChange check; undefined skips it. */\n readonly moved: Moved | undefined;\n}\n\n/** A check's problem on the subject, or undefined; throwing counts as one. */\nasync function attempt(check: Check, subject: Subject): Promise<string | undefined> {\n try {\n return await check.test(subject);\n } catch (error) {\n return `it threw ${describeError(error)}`;\n }\n}\n\n/** run()'s result, which must be a promise. */\nfunction promised(running: unknown): Promise<void> {\n if (typeof (running as Promise<void> | undefined)?.then !== \"function\") throw new TypeError(`run() must return a promise, got ${describeValue(running)}.`);\n return running as Promise<void>;\n}\n\nconst problems = (failures: readonly string[]): string => (failures.length === 1 ? \"1 problem\" : `${failures.length} problems`);\nconst list = (failures: readonly string[]): string => failures.map((failure) => `- ${failure}`).join(\"\\n\");\n\n/** The moved mark, with its data. */\ninterface Moved {\n /** Tells the run's onChange listeners the mark moved, with its data there, as the runner does. */\n change(ctx: TestContext): void;\n /** end() on the moved mark. */\n end(ctx: TestContext): void;\n}\n\n/** The moved twin of a fixture (the same object, whatever it is named); nothing for other marks. */\nfunction movedFixture(mark: MarkGeometry): MarkGeometry | undefined {\n const name = (Object.keys(fixtures) as FixtureName[]).find((fixture) => fixtures[fixture] === mark);\n return name === undefined ? undefined : movedFixtures[name];\n}\n\nfunction movedSubject(effect: AnyMarkEffect, mark: MarkGeometry | undefined, dataOf: (mark: MarkGeometry) => MarkData<unknown> | undefined): Moved | undefined {\n if (mark === undefined) return undefined;\n const data = dataOf(mark);\n return {\n change: (ctx) => ctx.change(mark, data),\n end: (ctx) => (effect.kind === \"data\" ? effect.end(mark, data!, ctx) : effect.end(mark, ctx))\n };\n}\n\ninterface Check {\n readonly title: string;\n /** What went wrong, or undefined. Throwing counts as a failure too. */\n test(subject: Subject): Promise<string | undefined>;\n}\n\nconst FULL_RUN: Check = {\n title: \"a full run should end with the same picture and mark style as end()\",\n async test(subject) {\n const ran = subject.context();\n const run = track(subject.run(ran));\n await play(ran.clock, run.done);\n if (run.failed) return `run() rejected with ${describeError(run.error)}`;\n const ended = subject.context();\n subject.end(ended);\n return compare(ran, ended, \"after the run\");\n }\n};\n\n/** The checks for every kind of effect: checkEffect's first four, which checkTransition runs too. */\nconst COMMON: readonly Check[] = [\n FULL_RUN,\n {\n title: \"clearing should leave nothing behind\",\n async test(subject) {\n const ctx = subject.context();\n const run = track(subject.run(ctx));\n await play(ctx.clock, run.done);\n subject.clear(ctx);\n ctx.clear();\n // Nothing may come back afterwards, from a listener or a tween that outlived the run.\n ctx.clock.advance(48);\n await flush();\n return leftovers(ctx);\n }\n },\n {\n title: \"an abort mid-run should settle the run and clear to nothing\",\n async test(subject) {\n const ctx = subject.context();\n const run = track(subject.run(ctx));\n ctx.clock.advance(16);\n ctx.clock.advance(16);\n ctx.abort();\n await settle(run);\n if (!run.settled) return \"run() was still running after the abort; it should resolve once ctx.signal aborts, without more frames\";\n if (run.failed) return `run() rejected with ${describeError(run.error)} (it should resolve, aborted or not)`;\n subject.clear(ctx);\n ctx.clear();\n return leftovers(ctx);\n }\n },\n {\n title: \"with motion off, no frames should run and the end state should be drawn\",\n async test(subject) {\n const ctx = subject.context({ mode: \"off\" });\n const run = track(subject.run(ctx));\n const framesAtStart = !ctx.clock.idle;\n await settle(run);\n if (!run.settled) return \"run() didn't finish; with motion off ctx.tween() ends at once, so wait only through it, never on a timer\";\n if (run.failed) return `run() rejected with ${describeError(run.error)}`;\n if (framesAtStart || !ctx.clock.idle) return \"it asked for animation frames\";\n const ended = subject.context({ mode: \"off\" });\n subject.end(ended);\n return compare(ctx, ended, \"after the run with motion off\");\n }\n }\n];\n\nconst CHECKS: readonly Check[] = [\n ...COMMON,\n {\n title: \"a change() to the moved mark should leave what end() draws on it\",\n async test(subject) {\n const { moved } = subject;\n if (!moved) return undefined;\n const problems: string[] = [];\n\n const ran = subject.context();\n const run = track(subject.run(ran));\n await play(ran.clock, run.done);\n if (run.failed) return `run() rejected with ${describeError(run.error)}`;\n moved.change(ran);\n if (!(await finish(ran))) return \"it was still animating 10 s after the change()\";\n const ended = subject.context();\n moved.end(ended);\n const afterRun = compare(ran, ended, \"after a full run and a change()\");\n if (afterRun) problems.push(afterRun);\n\n // With motion off the runner draws end() instead of running, and changes still come.\n const still = subject.context({ mode: \"off\" });\n subject.end(still);\n moved.change(still);\n await flush();\n const endedOff = subject.context({ mode: \"off\" });\n moved.end(endedOff);\n const afterEnd = compare(still, endedOff, \"after end() and a change()\");\n if (afterEnd) problems.push(afterEnd);\n return problems.length > 0 ? problems.join(\"; \") : undefined;\n }\n }\n];\n\n/** Runs frames until nothing animates (an effect may ease to the new geometry); false if it's still going after 10 s. */\nasync function finish(ctx: TestContext): Promise<boolean> {\n await flush();\n for (let elapsed = 0; !ctx.clock.idle; elapsed += 16) {\n if (elapsed >= 10_000) return false;\n ctx.clock.advance(16);\n await flush();\n }\n return true;\n}\n\n/**\n * No datum, values 0 to 1 along the walk, no related series. On a mark with gaps, a sample at each\n * end of each gap too, with `gapBefore` on the one after, as a line chart gives a line with a missing\n * value; samples at one `t` (a gap from 0, or gaps either side of a value alone) are one.\n */\nconst defaultData = (mark: MarkGeometry): MarkData<unknown> => {\n const samples: Sample[] = [{ t: 0, value: 0 }];\n const add = (t: number, gapBefore: boolean): void => {\n const last = samples[samples.length - 1]!;\n if (t === last.t) samples[samples.length - 1] = gapBefore ? { ...last, gapBefore } : last;\n else samples.push(gapBefore ? { t, value: t, gapBefore } : { t, value: t });\n };\n for (const [from, to] of mark.gaps ?? []) {\n add(from, false);\n add(to, true);\n }\n add(1, false);\n return { datum: undefined, samples, related: () => undefined };\n};\n\nfunction named(marks: Readonly<Record<string, MarkGeometry>> | readonly MarkGeometry[]): [string, MarkGeometry][] {\n if (!Array.isArray(marks)) return Object.entries(marks as Readonly<Record<string, MarkGeometry>>).map(([name, mark]) => [`the ${name}`, mark]);\n const seen = new Map<string, number>();\n return (marks as readonly MarkGeometry[]).map((mark) => {\n const count = (seen.get(mark.key) ?? 0) + 1;\n seen.set(mark.key, count);\n return [`mark \"${mark.key}\"${count > 1 ? ` (${count})` : \"\"}`, mark];\n });\n}\n\ninterface Tracked {\n /** Resolves when the run settles, either way. */\n readonly done: Promise<void>;\n readonly settled: boolean;\n readonly failed: boolean;\n readonly error: unknown;\n}\n\nfunction track(running: Promise<void>): Tracked {\n const state = { settled: false, failed: false, error: undefined as unknown };\n const done = running.then(\n () => {\n state.settled = true;\n },\n (error: unknown) => {\n Object.assign(state, { settled: true, failed: true, error });\n }\n );\n return Object.assign(state, { done });\n}\n\n/** Lets promise callbacks run, with no frames, until the run settles or plainly won't. */\nasync function settle(run: Tracked): Promise<void> {\n for (let i = 0; i < 10 && !run.settled; i++) await flush();\n}\n\n/** What differs between two contexts' pictures and mark styles, or undefined. */\nfunction compare(actual: TestContext, expected: TestContext, when: string): string | undefined {\n const problems: string[] = [];\n const drawn = actual.layer.picture();\n const wanted = expected.layer.picture();\n if (!same(drawn, wanted)) {\n const index = drawn.findIndex((item, i) => !same(item, wanted[i]));\n problems.push(\n drawn.length !== wanted.length\n ? `${drawn.length} ${drawn.length === 1 ? \"item is\" : \"items are\"} drawn ${when} but end() draws ${wanted.length} (${show(drawn)} vs ${show(wanted)})`\n : `item ${index + 1} drawn ${when} is ${show(drawn[index])} but end() draws ${show(wanted[index])}`\n );\n }\n const style = rounded(actual.mark.style);\n const wantedStyle = rounded(expected.mark.style);\n if (!same(style, wantedStyle)) problems.push(`the mark's style ${when} is ${show(style)} but end() leaves ${show(wantedStyle)}`);\n return problems.length > 0 ? problems.join(\"; \") : undefined;\n}\n\n/** What a cleared context still has: drawings, a mark style, running frames. */\nfunction leftovers(ctx: TestContext): string | undefined {\n const problems: string[] = [];\n if (ctx.layer.drawn.length > 0) problems.push(`${show(ctx.layer.picture())} is still drawn`);\n if (Object.keys(ctx.mark.style).length > 0) problems.push(`the mark's style is still ${show(ctx.mark.style)}`);\n if (!ctx.clock.idle) problems.push(\"animation frames are still running\");\n return problems.length > 0 ? problems.join(\"; \") : undefined;\n}\n\n/** Deep equality for plain data, ignoring key order. */\nfunction same(a: unknown, b: unknown): boolean {\n if (a === b || (Number.isNaN(a) && Number.isNaN(b))) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) return false;\n if (Array.isArray(a) !== Array.isArray(b)) return false;\n const keysA = Object.keys(a).filter((key) => (a as Record<string, unknown>)[key] !== undefined);\n const keysB = Object.keys(b).filter((key) => (b as Record<string, unknown>)[key] !== undefined);\n return keysA.length === keysB.length && keysA.every((key) => same((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key]));\n}\n\n/** Numbers rounded to 0.001, as pictures are, so float noise in a style isn't a difference. */\nfunction rounded(value: unknown): unknown {\n if (typeof value === \"number\") {\n const round = Math.round(value * 1000) / 1000;\n return round === 0 ? 0 : round;\n }\n if (Array.isArray(value)) return value.map(rounded);\n if (typeof value === \"object\" && value !== null) return Object.fromEntries(Object.entries(value).map(([key, field]) => [key, rounded(field)]));\n return value;\n}\n\nconst LONGEST = 240;\n\nfunction show(value: unknown): string {\n const text = JSON.stringify(value) ?? String(value);\n return text.length > LONGEST ? `${text.slice(0, LONGEST - 1)}…` : text;\n}\n\nfunction describeError(error: unknown): string {\n return error instanceof Error ? `${error.name}: ${error.message}` : show(error);\n}\n"],"mappings":";;AA4DA,SAAgB,iBAAiC;CAC/C,MAAM,wBAAQ,IAAI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OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,QAAQ,KAAK,CAAC,CAAC,CAAC;CAC7I,OAAO;AACT;AAEA,MAAM,UAAU;AAEhB,SAAS,KAAK,OAAwB;CACpC,MAAM,OAAO,KAAK,UAAU,KAAK,KAAK,OAAO,KAAK;CAClD,OAAO,KAAK,SAAS,UAAU,GAAG,KAAK,MAAM,GAAG,GAAW,EAAE,KAAK;AACpE;AAEA,SAAS,cAAc,OAAwB;CAC7C,OAAO,iBAAiB,QAAQ,GAAG,MAAM,KAAK,IAAI,MAAM,YAAY,KAAK,KAAK;AAChF"}
|
|
@@ -1478,6 +1478,22 @@ function mergeFields(current, next) {
|
|
|
1478
1478
|
else result[field] = value;
|
|
1479
1479
|
return result;
|
|
1480
1480
|
}
|
|
1481
|
+
// src/core/text-box.ts
|
|
1482
|
+
const TEXT_SIZE = 12.5;
|
|
1483
|
+
const AVERAGE_WIDTH = .6;
|
|
1484
|
+
const ASCENT = 1.05;
|
|
1485
|
+
const SIDE = .16;
|
|
1486
|
+
function boxAround(at, anchor, width, size) {
|
|
1487
|
+
return {
|
|
1488
|
+
x: (anchor === "end" ? at.x - width : anchor === "middle" ? at.x - width / 2 : at.x) - SIDE * size,
|
|
1489
|
+
y: at.y - ASCENT * size,
|
|
1490
|
+
width: width + 2 * SIDE * size,
|
|
1491
|
+
height: 1.3 * size
|
|
1492
|
+
};
|
|
1493
|
+
}
|
|
1494
|
+
function estimatedBox(content, style) {
|
|
1495
|
+
return boxAround(style.at, style.anchor, content.length * TEXT_SIZE * AVERAGE_WIDTH, TEXT_SIZE);
|
|
1496
|
+
}
|
|
1481
1497
|
// src/core/runner.ts
|
|
1482
1498
|
function runScope(options) {
|
|
1483
1499
|
const { clock, motion, layer, mark } = options;
|
|
@@ -1492,6 +1508,7 @@ function runScope(options) {
|
|
|
1492
1508
|
icons: options.icons,
|
|
1493
1509
|
batch: options.batch,
|
|
1494
1510
|
...options.previous ? { previous: options.previous } : {},
|
|
1511
|
+
...options.texts ? { texts: options.texts } : {},
|
|
1495
1512
|
tween(tweenOptions) {
|
|
1496
1513
|
const own = tweenOptions.signal;
|
|
1497
1514
|
const running = tween({
|
|
@@ -1532,6 +1549,8 @@ const SLOTS = [
|
|
|
1532
1549
|
"exit",
|
|
1533
1550
|
"hover"
|
|
1534
1551
|
];
|
|
1552
|
+
const byOrder = (a, b) => a.order - b.order;
|
|
1553
|
+
const sameBox = (a, b) => a === b || a !== void 0 && b !== void 0 && a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
1535
1554
|
const NO_ICONS$1 = { get: () => void 0 };
|
|
1536
1555
|
const INERT$1 = {
|
|
1537
1556
|
place() {},
|
|
@@ -1549,6 +1568,10 @@ function createRunner(options) {
|
|
|
1549
1568
|
let transitioning = false;
|
|
1550
1569
|
let destroyed = false;
|
|
1551
1570
|
let order = 0;
|
|
1571
|
+
const box = (content, style) => surface.box ? surface.box(content, style) : estimatedBox(content, style);
|
|
1572
|
+
const texts = /* @__PURE__ */ new Map();
|
|
1573
|
+
let holds = 0;
|
|
1574
|
+
let flushing = false;
|
|
1552
1575
|
const unsubscribe = motion$2.subscribe(() => {
|
|
1553
1576
|
if (motion$2.mode === "off") endRunning();
|
|
1554
1577
|
});
|
|
@@ -1600,7 +1623,14 @@ function createRunner(options) {
|
|
|
1600
1623
|
batch,
|
|
1601
1624
|
previous,
|
|
1602
1625
|
layer: runLayer(entry.key, slot, () => run.order, () => run.state !== "cleared"),
|
|
1603
|
-
mark: runMark(() => run)
|
|
1626
|
+
mark: runMark(() => run),
|
|
1627
|
+
texts: {
|
|
1628
|
+
box,
|
|
1629
|
+
held: () => [...texts].flatMap(([other, held]) => held.box && other.order < run.order ? [held.box] : []),
|
|
1630
|
+
hold(next) {
|
|
1631
|
+
if (run.state !== "cleared") hold(run, next);
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1604
1634
|
})
|
|
1605
1635
|
};
|
|
1606
1636
|
entry.runs.set(slot, run);
|
|
@@ -1647,8 +1677,44 @@ function createRunner(options) {
|
|
|
1647
1677
|
report(error);
|
|
1648
1678
|
}
|
|
1649
1679
|
run.scope.clear();
|
|
1680
|
+
hold(run, void 0);
|
|
1650
1681
|
release(run);
|
|
1651
1682
|
}
|
|
1683
|
+
function tell(run, mark) {
|
|
1684
|
+
try {
|
|
1685
|
+
run.scope.change(mark, latestData(run.entry, run));
|
|
1686
|
+
} catch (error) {
|
|
1687
|
+
report(error);
|
|
1688
|
+
clearRun(run);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
function hold(run, next) {
|
|
1692
|
+
let held = texts.get(run);
|
|
1693
|
+
if (!held) {
|
|
1694
|
+
if (!next) return;
|
|
1695
|
+
texts.set(run, held = {
|
|
1696
|
+
box: void 0,
|
|
1697
|
+
placed: 0,
|
|
1698
|
+
moved: 0
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
held.placed = ++holds;
|
|
1702
|
+
if (sameBox(held.box, next)) return;
|
|
1703
|
+
held.box = next;
|
|
1704
|
+
held.moved = holds;
|
|
1705
|
+
if (flushing) return;
|
|
1706
|
+
flushing = true;
|
|
1707
|
+
queueMicrotask(flush);
|
|
1708
|
+
}
|
|
1709
|
+
function flush() {
|
|
1710
|
+
let moved = 0;
|
|
1711
|
+
for (const [run, held] of [...texts].sort(([a], [b]) => byOrder(a, b))) {
|
|
1712
|
+
if (held.box && held.placed < moved) tell(run, run.entry.mark);
|
|
1713
|
+
if (!held.box) texts.delete(run);
|
|
1714
|
+
moved = Math.max(moved, held.moved);
|
|
1715
|
+
}
|
|
1716
|
+
flushing = false;
|
|
1717
|
+
}
|
|
1652
1718
|
function runLayer(key, slot, order, live) {
|
|
1653
1719
|
let group;
|
|
1654
1720
|
const target = () => live() ? group ?? (group = surface.group(key, slot, order())) : void 0;
|
|
@@ -1827,15 +1893,7 @@ function createRunner(options) {
|
|
|
1827
1893
|
entry.data = data;
|
|
1828
1894
|
if (!transitioning) entry.resting = data;
|
|
1829
1895
|
}
|
|
1830
|
-
for (const run of [...entry.runs.values()])
|
|
1831
|
-
if (run.state === "cleared") continue;
|
|
1832
|
-
try {
|
|
1833
|
-
run.scope.change(mark, latestData(entry, run));
|
|
1834
|
-
} catch (error) {
|
|
1835
|
-
report(error);
|
|
1836
|
-
clearRun(run);
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1896
|
+
for (const run of [...entry.runs.values()].sort(byOrder)) if (run.state !== "cleared") tell(run, mark);
|
|
1839
1897
|
},
|
|
1840
1898
|
interrupt() {
|
|
1841
1899
|
if (destroyed) return;
|
|
@@ -2062,6 +2120,6 @@ function describeEffect(value) {
|
|
|
2062
2120
|
if (kind === "transition") return "a transition effect without run(), end() and clear()";
|
|
2063
2121
|
return kind === void 0 ? "an object with no kind" : `an effect of kind ${JSON.stringify(kind)}`;
|
|
2064
2122
|
}
|
|
2065
|
-
export {
|
|
2123
|
+
export { TIMINGS as A, createClock as B, flattenPath as C, describeArc as D, describeBar as E, scaleDuration as F, manualClock as H, easeInOutCubic as I, easeOutCubic as L, defaultScaling as M, mediaReducedMotion as N, loopOutline as O, motion as P, linear as R, cubicPieces as S, describeLine as T, report as U, defaultClock as V, formatPath as _, AVERAGE_WIDTH as a, transformPath as b, estimatedBox as c, createRegistry as d, describeValue as f, describeShape as g, describe as h, runScope as i, createMotion as j, tween as k, mergeFields as l, resolveEffects as m, playTransition as n, TEXT_SIZE as o, isMarkEffect as p, createRunner as r, boxAround as s, isTransitionEffect as t, EFFECT_SLOTS as u, parsePath as v, describePoint as w, FLAT as x, shapeOutline as y, unease as z };
|
|
2066
2124
|
|
|
2067
|
-
//# sourceMappingURL=transition-
|
|
2125
|
+
//# sourceMappingURL=transition-romki_A6.js.map
|