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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition-romki_A6.js","names":["show","NO_ICONS","INERT","motion","pageMotion","motion","pageMotion"],"sources":["../src/core/report.ts","../src/core/clock.ts","../src/core/easing.ts","../src/core/motion.ts","../src/core/tween.ts","../src/core/geometry/walk.ts","../src/core/geometry/outline.ts","../src/core/geometry/describe/mark.ts","../src/core/geometry/describe/arc.ts","../src/core/geometry/describe/bar.ts","../src/core/geometry/describe/line.ts","../src/core/geometry/describe/point.ts","../src/core/geometry/flatten.ts","../src/core/geometry/path.ts","../src/core/geometry/describe/shape.ts","../src/core/geometry/describe/index.ts","../src/core/registry.ts","../src/core/merge.ts","../src/core/text-box.ts","../src/core/runner.ts","../src/core/transition.ts"],"sourcesContent":["/**\n * Surface an error without interrupting the caller, so one failing frame\n * callback or listener can't stop the others. Uses the platform's\n * `reportError` (shows up as an uncaught error) where it exists.\n */\nexport function report(error: unknown): void {\n const platform = (globalThis as { reportError?: (error: unknown) => void }).reportError;\n if (typeof platform === \"function\") platform(error);\n else console.error(error);\n}\n","import { report } from \"./report\";\n\n/** Where frames come from. The default uses requestAnimationFrame, or a 16 ms timer outside the browser. */\nexport interface FrameSource {\n now(): number;\n /** Ask for one callback on the next frame. Returns a function that cancels it. */\n request(callback: (now: number) => void): () => void;\n}\n\nexport interface Clock {\n now(): number;\n /** Call `callback` on every frame until the returned function is called. */\n onFrame(callback: (now: number) => void): () => void;\n}\n\n/** A clock that only moves when told to. For tests. */\nexport interface ManualClock extends Clock {\n /** Move time forward by `ms` and run one frame at the new time. */\n advance(ms: number): void;\n /** True when nothing is waiting for a frame. */\n readonly idle: boolean;\n}\n\n/**\n * One shared frame loop. It requests a frame only while something is\n * subscribed, so an idle page costs nothing.\n */\nexport function createClock(source: FrameSource = browserFrames()): Clock {\n const callbacks = new Set<(now: number) => void>();\n let cancelFrame: (() => void) | undefined;\n\n const schedule = (): void => {\n if (!cancelFrame && callbacks.size > 0) cancelFrame = source.request(tick);\n };\n\n const tick = (now: number): void => {\n cancelFrame = undefined;\n // Copy so callbacks can subscribe or unsubscribe while we iterate.\n for (const callback of [...callbacks]) {\n if (!callbacks.has(callback)) continue;\n try {\n callback(now);\n } catch (error) {\n report(error);\n }\n }\n schedule();\n };\n\n return {\n now: () => source.now(),\n onFrame(callback) {\n // Wrap so the same function can be subscribed twice and unsubscribed independently.\n const entry = (now: number): void => callback(now);\n callbacks.add(entry);\n schedule();\n return () => {\n if (!callbacks.delete(entry)) return;\n if (callbacks.size === 0 && cancelFrame) {\n cancelFrame();\n cancelFrame = undefined;\n }\n };\n }\n };\n}\n\nexport function manualClock(start = 0): ManualClock {\n let time = start;\n let pending: ((now: number) => void) | undefined;\n\n const clock = createClock({\n now: () => time,\n request(callback) {\n pending = callback;\n return () => {\n if (pending === callback) pending = undefined;\n };\n }\n });\n\n return {\n now: clock.now,\n onFrame: clock.onFrame,\n get idle() {\n return pending === undefined;\n },\n advance(ms) {\n if (!(ms >= 0)) throw new RangeError(`manualClock.advance needs a non-negative number of ms, got ${ms}`);\n time += ms;\n const callback = pending;\n pending = undefined;\n callback?.(time);\n }\n };\n}\n\n// Looks up browser APIs when a frame is requested, never at import time, so Node can import the library.\nfunction browserFrames(): FrameSource {\n const now = (): number => (typeof performance !== \"undefined\" ? performance.now() : Date.now());\n return {\n now,\n request(callback) {\n if (typeof requestAnimationFrame === \"function\") {\n const id = requestAnimationFrame(callback);\n return () => cancelAnimationFrame(id);\n }\n const id = setTimeout(() => callback(now()), 16);\n return () => clearTimeout(id);\n }\n };\n}\n\n/** The page-wide clock every tween uses unless given another. */\nexport const defaultClock: Clock = /* @__PURE__ */ createClock();\n","/** Maps linear progress (0–1) to eased progress. Any function of this shape works. */\nexport type Easing = (t: number) => number;\n\n/** For playback, where speed should stay constant. */\nexport const linear: Easing = (t) => t;\n\n/** For data transitions: starts and ends gently. */\nexport const easeInOutCubic: Easing = (t) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2);\n\n/** For travel, and for animations retargeted mid-flight: starts at speed, settles gently. */\nexport const easeOutCubic: Easing = (t) => 1 - Math.pow(1 - t, 3);\n\n/**\n * The linear progress at which easeInOutCubic reaches s: its inverse. Internal. A run that starts part\n * way, from shapes already at s, takes the rest of a full run's time from here, as morph and a chart\n * switch do.\n */\nexport function unease(s: number): number {\n return s < 0.5 ? Math.cbrt(s / 4) : 1 - Math.cbrt(2 * (1 - s)) / 2;\n}\n","import { report } from \"./report\";\n\nexport type MotionMode = \"presentation\" | \"analysis\" | \"off\";\n\n/** What a duration is for. Each kind scales differently by mode. */\nexport type Timing = \"feedback\" | \"transition\" | \"effect\" | \"playback\" | \"stagger\";\n\n/** Base ms × factor, clamped to [min(base, min), max]. A floor never makes an animation longer than its base. */\nexport interface ScalingRule {\n readonly factor: number;\n readonly min?: number;\n readonly max?: number;\n}\n\ntype ScaledMode = Exclude<MotionMode, \"off\">;\n\nexport type ScalingTable = { readonly [M in ScaledMode]: { readonly [T in Timing]: ScalingRule } };\nexport type ScalingOverrides = { readonly [M in ScaledMode]?: { readonly [T in Timing]?: ScalingRule } };\n\n/** Starting values from the prototype; tuned in the demos. Off is always 0. */\nexport const defaultScaling: ScalingTable = {\n presentation: {\n feedback: { factor: 1 },\n transition: { factor: 1 },\n effect: { factor: 1 },\n playback: { factor: 1 },\n stagger: { factor: 1 }\n },\n analysis: {\n feedback: { factor: 1 },\n transition: { factor: 0.35, max: 200 },\n effect: { factor: 0.35, min: 140, max: 300 },\n playback: { factor: 0.3 },\n // Analysis has no staging, so marks don't wait for each other.\n stagger: { factor: 0 }\n }\n};\n\n/** What charts and effects need from the motion system. */\nexport interface MotionView {\n /** The effective mode, after the reduced-motion rule. */\n readonly mode: MotionMode;\n /** True only in presentation: split data changes into stages. */\n readonly staged: boolean;\n /** Scale a base duration (ms) for the current mode. 0 means \"jump to the end\". */\n duration(base: number, timing?: Timing): number;\n}\n\nexport interface Motion extends MotionView {\n /** The mode the page author asked for. */\n readonly requested: MotionMode;\n /** The mode the viewer picked in an on-page control, if any. */\n readonly viewerChoice: MotionMode | undefined;\n /** Live value of `prefers-reduced-motion: reduce`. */\n readonly prefersReduced: boolean;\n /** The author's default. Never overrides reduced motion. */\n setMode(mode: MotionMode): void;\n /** The viewer's explicit choice from an on-page control. Overrides reduced motion. */\n chooseMode(mode: MotionMode): void;\n /** Forget the viewer's choice and follow the author's mode and the device setting again. */\n clearChoice(): void;\n /** Called whenever the mode, the viewer's choice or the device setting changes. */\n subscribe(listener: () => void): () => void;\n}\n\n/** A live reduced-motion preference. */\nexport interface ReducedMotionSource {\n readonly matches: boolean;\n subscribe(listener: () => void): () => void;\n}\n\nexport interface MotionOptions {\n /** The author's mode. Default \"presentation\". */\n readonly mode?: MotionMode;\n readonly scaling?: ScalingOverrides;\n /** Default: the `prefers-reduced-motion` media query. */\n readonly reducedMotion?: ReducedMotionSource;\n}\n\nconst MODES: readonly MotionMode[] = [\"presentation\", \"analysis\", \"off\"];\n/** Every timing, for checking options. Internal: not exported from core's index. */\nexport const TIMINGS: readonly Timing[] = [\"feedback\", \"transition\", \"effect\", \"playback\", \"stagger\"];\n\nexport function createMotion(options: MotionOptions = {}): Motion {\n let requested = checkMode(options.mode ?? \"presentation\");\n let viewerChoice: MotionMode | undefined;\n const scaling = mergeScaling(options.scaling);\n const reduced = options.reducedMotion ?? mediaReducedMotion();\n const listeners = new Set<() => void>();\n let stopWatching: (() => void) | undefined;\n\n const effective = (): MotionMode => viewerChoice ?? (reduced.matches ? \"off\" : requested);\n\n const notify = (): void => {\n for (const listener of [...listeners]) {\n if (!listeners.has(listener)) continue;\n try {\n listener();\n } catch (error) {\n report(error);\n }\n }\n };\n\n return {\n get mode() {\n return effective();\n },\n get staged() {\n return effective() === \"presentation\";\n },\n get requested() {\n return requested;\n },\n get viewerChoice() {\n return viewerChoice;\n },\n get prefersReduced() {\n return reduced.matches;\n },\n duration(base, timing = \"transition\") {\n const mode = effective();\n return mode === \"off\" ? 0 : scaleDuration(base, scaling[mode][timing]);\n },\n setMode(mode) {\n checkMode(mode);\n if (mode === requested) return;\n requested = mode;\n notify();\n },\n chooseMode(mode) {\n checkMode(mode);\n if (mode === viewerChoice) return;\n viewerChoice = mode;\n notify();\n },\n clearChoice() {\n if (viewerChoice === undefined) return;\n viewerChoice = undefined;\n notify();\n },\n subscribe(listener) {\n const entry = (): void => listener();\n listeners.add(entry);\n // Only watch the media query while someone is listening.\n stopWatching ??= reduced.subscribe(notify);\n return () => {\n if (!listeners.delete(entry) || listeners.size > 0) return;\n stopWatching?.();\n stopWatching = undefined;\n };\n }\n };\n}\n\nexport function scaleDuration(base: number, rule: ScalingRule): number {\n if (!(base > 0)) return 0;\n const floor = Math.min(base, rule.min ?? 0);\n const ceiling = rule.max ?? Infinity;\n return Math.min(Math.max(base * rule.factor, floor), ceiling);\n}\n\n/** Reads `prefers-reduced-motion` lazily: nothing touches the DOM until `matches` is read or someone subscribes. */\nexport function mediaReducedMotion(query = \"(prefers-reduced-motion: reduce)\"): ReducedMotionSource {\n let list: MediaQueryList | null | undefined;\n const lookup = (): MediaQueryList | null => {\n if (list === undefined) {\n try {\n list = typeof matchMedia === \"function\" ? matchMedia(query) : null;\n } catch {\n list = null;\n }\n }\n return list;\n };\n\n return {\n get matches() {\n return lookup()?.matches ?? false;\n },\n subscribe(listener) {\n const media = lookup();\n if (!media) return () => {};\n const onChange = (): void => listener();\n if (typeof media.addEventListener === \"function\") {\n media.addEventListener(\"change\", onChange);\n return () => media.removeEventListener(\"change\", onChange);\n }\n // Safari before 14.\n media.addListener(onChange);\n return () => media.removeListener(onChange);\n }\n };\n}\n\nfunction checkMode(mode: MotionMode): MotionMode {\n if (!MODES.includes(mode)) {\n throw new TypeError(`Unknown motion mode \"${String(mode)}\". Use one of: ${MODES.join(\", \")}.`);\n }\n return mode;\n}\n\nfunction mergeScaling(overrides: ScalingOverrides = {}): ScalingTable {\n const merge = (mode: ScaledMode): Record<Timing, ScalingRule> => {\n const table: Record<Timing, ScalingRule> = { ...defaultScaling[mode] };\n for (const timing of TIMINGS) {\n const rule = overrides[mode]?.[timing];\n if (rule) table[timing] = rule;\n }\n return table;\n };\n return { presentation: merge(\"presentation\"), analysis: merge(\"analysis\") };\n}\n\n/** The page-wide motion every chart follows unless given its own. */\nexport const motion: Motion = /* @__PURE__ */ createMotion();\n","import { defaultClock, type Clock } from \"./clock\";\nimport { easeInOutCubic, type Easing } from \"./easing\";\nimport { motion, type MotionView, type Timing } from \"./motion\";\n\n/** The clock and motion settings an animation runs against. */\nexport interface MotionEnv {\n readonly clock: Clock;\n readonly motion: MotionView;\n}\n\nexport interface TweenOptions {\n /** Base duration in ms, scaled by the motion mode. */\n readonly duration: number;\n /** Default \"transition\". */\n readonly timing?: Timing;\n /** Default easeInOutCubic. */\n readonly ease?: Easing;\n /** Base delay in ms before progress starts, scaled like the duration. */\n readonly delay?: number;\n /** Called with eased progress: once with ease(0) at the start, then every frame, then with ease(1) at the end. */\n readonly update: (progress: number) => void;\n readonly signal?: AbortSignal;\n}\n\nexport type TweenResult = \"done\" | \"cancelled\";\n\nexport interface Tween {\n /** Resolves when the tween ends. Never rejects. */\n readonly finished: Promise<TweenResult>;\n readonly state: \"running\" | TweenResult;\n /** Stop where it is. */\n cancel(): void;\n /** Jump to the end now. */\n finish(): void;\n}\n\n/**\n * Animate progress from 0 to 1. If the motion mode scales the duration to 0,\n * `update(ease(1))` runs synchronously, before `tween` returns. If the mode\n * turns off while the tween runs, it jumps to the end on the next frame.\n */\nexport function tween(options: TweenOptions, env: Partial<MotionEnv> = {}): Tween {\n const clock = env.clock ?? defaultClock;\n const view = env.motion ?? motion;\n const timing = options.timing ?? \"transition\";\n const ease = options.ease ?? easeInOutCubic;\n const duration = view.duration(options.duration, timing);\n const delay = options.delay ? view.duration(options.delay, timing) : 0;\n const { update, signal } = options;\n const start = clock.now();\n\n let state: Tween[\"state\"] = \"running\";\n let unsubscribe: (() => void) | undefined;\n let resolve!: (result: TweenResult) => void;\n const finished = new Promise<TweenResult>((r) => {\n resolve = r;\n });\n\n const settle = (result: TweenResult): void => {\n state = result;\n unsubscribe?.();\n unsubscribe = undefined;\n signal?.removeEventListener(\"abort\", cancel);\n resolve(result);\n };\n\n function cancel(): void {\n if (state === \"running\") settle(\"cancelled\");\n }\n\n // True while the final update runs, so an update that calls finish() can't recurse.\n let finishing = false;\n\n function finish(): void {\n if (state !== \"running\" || finishing) return;\n finishing = true;\n step(1);\n // `update` may have cancelled the tween itself.\n if (state === \"running\") settle(\"done\");\n }\n\n // Runs `update` and cancels the tween if it throws: a broken callback is reported once instead of\n // every frame, and `finished` never says \"done\" when the last update failed.\n function step(progress: number): void {\n try {\n update(ease(progress));\n } catch (error) {\n cancel();\n throw error;\n }\n }\n\n const onFrame = (now: number): void => {\n // The effective mode can turn off mid-flight (the device switches to reduced motion, or the\n // viewer picks Off). Every animation then jumps to its end state.\n if (view.mode === \"off\") {\n finish();\n return;\n }\n const elapsed = now - start - delay;\n if (elapsed >= duration) finish();\n else if (elapsed > 0) step(elapsed / duration);\n };\n\n const handle: Tween = {\n finished,\n get state() {\n return state;\n },\n cancel,\n finish\n };\n\n if (signal?.aborted) {\n settle(\"cancelled\");\n return handle;\n }\n signal?.addEventListener(\"abort\", cancel, { once: true });\n\n if (duration <= 0 && delay <= 0) {\n finish();\n return handle;\n }\n step(0);\n if (state === \"running\") unsubscribe = clock.onFrame(onFrame);\n return handle;\n}\n","// A walk: connected segments parameterised by distance, so t = 0.5 is halfway along on screen. It can\n// have gaps, stretches with no data that its path data leaves out.\n\nimport type { Point } from \"../contracts/geometry\";\nimport { drawTo, moveTo, pathData } from \"./path-data\";\nimport { angleOn, pointOn, type PathSegment } from \"./segment\";\n\n/** Stretches of a walk with no data, as [from, to] values of t: in order, apart, each with 0 ≤ from < to ≤ 1. */\nexport type Gaps = readonly (readonly [from: number, to: number])[];\n\nexport interface Walk {\n readonly segments: readonly PathSegment[];\n readonly length: number;\n readonly start: Point;\n readonly end: Point;\n /** The stretches slice() and d leave out; empty when there are none. */\n readonly gaps: Gaps;\n /** t in [0, 1], proportional to distance. Values outside are clamped. */\n point(t: number): Point;\n /** Direction of travel in (-PI, PI]. At a joint, the segment ahead wins, except at t = 1. */\n angle(t: number): number;\n /**\n * Path data from t0 to t1, in either order. Just a move when they're equal. It leaves out the gaps:\n * each part between them starts with its own move, and a part with no length isn't written.\n */\n slice(t0: number, t1: number): string;\n /** Path data for the whole walk, less its gaps. */\n readonly d: string;\n}\n\nconst clamp01 = (t: number): number => (t > 0 ? (t < 1 ? t : 1) : 0);\nconst NONE: Gaps = /* @__PURE__ */ Object.freeze([]);\n\n/** The segments must connect: each starts where the one before ends. The gaps are taken as given. */\nexport function createWalk(segments: readonly PathSegment[], gaps: Gaps = NONE): Walk {\n const first = segments[0];\n const last = segments[segments.length - 1];\n if (!first || !last) throw new RangeError(\"A walk needs at least one segment.\");\n\n // cumulative[i] is the distance to the start of segment i.\n const cumulative = [0];\n for (const segment of segments) cumulative.push(cumulative[cumulative.length - 1]! + segment.length);\n const length = cumulative[segments.length]!;\n const start = pointOn(first, 0);\n const end = pointOn(last, 1);\n\n // The segment at distance d, and the fraction along it. Zero-length segments are never picked\n // unless the whole walk has zero length.\n const locate = (d: number): { readonly index: number; readonly u: number } => {\n if (!(length > 0)) return { index: 0, u: 0 };\n if (d >= length) {\n let index = segments.length - 1;\n while (index > 0 && !(segments[index]!.length > 0)) index--;\n return { index, u: 1 };\n }\n // The first segment that ends beyond d.\n let lo = 0;\n let hi = segments.length - 1;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (cumulative[mid + 1]! > d) hi = mid;\n else lo = mid + 1;\n }\n return { index: lo, u: Math.min(1, (d - cumulative[lo]!) / segments[lo]!.length) };\n };\n\n const point = (t: number): Point => {\n const at = clamp01(t);\n if (at === 0) return start;\n if (at === 1) return end;\n const { index, u } = locate(at * length);\n return pointOn(segments[index]!, u);\n };\n\n /** Path data from t `from` to `to` (from ≤ to, both in [0, 1]), gaps and all. */\n const draw = (from: number, to: number): string => {\n let d = moveTo(point(from));\n const a = from * length;\n const b = to * length;\n if (!(b > a)) return d;\n const first = locate(a);\n for (let i = first.index; i < segments.length && cumulative[i]! < b; i++) {\n const segment = segments[i]!;\n if (!(segment.length > 0)) continue;\n const u0 = i === first.index ? first.u : 0;\n const u1 = cumulative[i + 1]! > b ? Math.min(1, (b - cumulative[i]!) / segment.length) : 1;\n if (u1 > u0) d += drawTo(segment, u0, u1);\n }\n return d;\n };\n\n const slice = (t0: number, t1: number): string => {\n const from = clamp01(Math.min(t0, t1));\n const to = clamp01(Math.max(t0, t1));\n if (gaps.length === 0) return draw(from, to);\n // The parts between the gaps, each drawn from its own move. All in a gap: a move where it starts.\n let d = \"\";\n let at = from;\n for (const [a, b] of gaps) {\n if (a >= to) break;\n if (a > at) d += draw(at, a);\n if (b > at) at = b;\n }\n if (to > at) d += draw(at, to);\n return d === \"\" ? moveTo(point(from)) : d;\n };\n\n return {\n segments,\n length,\n start,\n end,\n gaps,\n point,\n angle(t) {\n const { index, u } = locate(clamp01(t) * length);\n return angleOn(segments[index]!, u);\n },\n slice,\n d: gaps.length === 0 ? pathData(segments) : slice(0, 1)\n };\n}\n","// Outlines with canonical sampling, so morph can match corners and winding between any two marks.\n\nimport type { Outline, Point } from \"../contracts/geometry\";\nimport { pathData } from \"./path-data\";\nimport { arc, line, pointOn, TAU, type PathSegment } from \"./segment\";\nimport { createWalk, type Walk } from \"./walk\";\n\n/** The four sides of a closed outline, in order. Each must start where the one before ends. */\nexport type Sides = readonly [\n left: readonly PathSegment[],\n end: readonly PathSegment[],\n right: readonly PathSegment[],\n start: readonly PathSegment[]\n];\n\n/**\n * A closed outline from its sides: left (the up side, walked in the direction of travel), end,\n * right (walked back) and start. That order runs clockwise on screen from the start-left corner.\n */\nexport function closedOutline(sides: Sides): Outline {\n const walks = sides.map((side) => createWalk(side));\n return {\n d: pathData(sides.flat(), true),\n closed: true,\n sample(n) {\n checkCount(n, 4);\n const perSide = n / 4;\n const points: Point[] = [];\n for (const walk of walks) {\n for (let j = 0; j < perSide; j++) points.push(walk.point(j / perSide));\n }\n return points;\n }\n };\n}\n\n/**\n * A closed outline round loops of connected segments, each a subpath, holes too. It's sampled round\n * the longest loop, clockwise on screen from its upper left (the point with the least x + y, the\n * higher of two), in four quarters of equal length, so a circle samples as a point's outline does.\n * Its path data starts there too: the longest loop first, from that point. If the longest runs\n * anticlockwise, every loop is written the other way round, which fills the same.\n */\nexport function loopOutline(loops: readonly (readonly PathSegment[])[]): Outline {\n const lengths = loops.map((loop) => loop.reduce((sum, segment) => sum + segment.length, 0));\n let longest = 0;\n lengths.forEach((length, i) => {\n if (length > lengths[longest]!) longest = i;\n });\n const turn = area(loops[longest]!) < 0;\n const clockwise = loops.map((loop) => (turn ? reversed(loop) : loop));\n const ring = fromUpperLeft(clockwise[longest]!);\n const walk = createWalk(ring);\n return {\n d: [ring, ...clockwise.filter((_, i) => i !== longest)].map((loop) => pathData(loop, true)).join(\"\"),\n closed: true,\n sample(n) {\n checkCount(n, 4);\n const perSide = n / 4;\n const points: Point[] = [];\n // Each quarter from its own corner, so the corners are the same points whatever n is.\n for (let side = 0; side < 4; side++) {\n for (let j = 0; j < perSide; j++) points.push(walk.point(side / 4 + j / perSide / 4));\n }\n return points;\n }\n };\n}\n\n/** The loop's signed area: more than 0 when it runs clockwise on screen. */\nfunction area(loop: readonly PathSegment[]): number {\n let sum = 0;\n for (const segment of loop) {\n if (segment.kind === \"line\") {\n sum += segment.from.x * segment.to.y - segment.to.x * segment.from.y;\n continue;\n }\n const { center, radius, start, sweep } = segment;\n const end = start + sweep;\n sum += radius * (center.x * (Math.sin(end) - Math.sin(start)) - center.y * (Math.cos(end) - Math.cos(start))) + radius * radius * sweep;\n }\n return sum / 2;\n}\n\n/** The loop walked the other way. */\nfunction reversed(loop: readonly PathSegment[]): PathSegment[] {\n return loop.map((segment) => (segment.kind === \"line\" ? line(segment.to, segment.from) : arc(segment.center, segment.radius, segment.start + segment.sweep, -segment.sweep))).reverse();\n}\n\n/** The loop from its upper left: the least x + y, at a segment's start or inside an arc, and of two, the higher. */\nfunction fromUpperLeft(loop: readonly PathSegment[]): PathSegment[] {\n let index = 0;\n let u = 0;\n let key = Infinity;\n let top = Infinity;\n const consider = (point: Point, i: number, at: number): void => {\n const k = point.x + point.y;\n if (k < key - 1e-9 || (k <= key + 1e-9 && point.y < top)) [index, u, key, top] = [i, at, k, point.y];\n };\n loop.forEach((segment, i) => {\n consider(pointOn(segment, 0), i, 0);\n if (segment.kind === \"arc\") {\n // On a circle, x + y is least at the upper left, 3π/4 anticlockwise from +x.\n const turned = segment.sweep >= 0 ? UPPER_LEFT - segment.start : segment.start - UPPER_LEFT;\n const at = (((turned % TAU) + TAU) % TAU) / Math.abs(segment.sweep);\n if (at < 1) consider(pointOn(segment, at), i, at);\n }\n });\n const [before, after] = split(loop[index]!, u);\n return [after, ...loop.slice(index + 1), ...loop.slice(0, index), before].filter((segment) => segment.length > 0);\n}\n\n/** A segment in two, at fraction u of its length. */\nfunction split(segment: PathSegment, u: number): [PathSegment, PathSegment] {\n if (segment.kind === \"line\") {\n const at = pointOn(segment, u);\n return [line(segment.from, at), line(at, segment.to)];\n }\n const { center, radius, start, sweep } = segment;\n return [arc(center, radius, start, sweep * u), arc(center, radius, start + sweep * u, sweep * (1 - u))];\n}\n\nconst UPPER_LEFT = (-3 * Math.PI) / 4;\n\n/** An open outline: the stroke along a walk, less its gaps. Its samples run along the whole walk, gaps and all. */\nexport function openOutline(walk: Walk): Outline {\n return {\n d: walk.d,\n closed: false,\n sample(n) {\n checkCount(n, 1);\n if (n === 1) return [walk.start];\n const points: Point[] = [];\n for (let j = 0; j < n; j++) points.push(walk.point(j / (n - 1)));\n return points;\n }\n };\n}\n\nfunction checkCount(n: number, multiple: number): void {\n if (!Number.isInteger(n) || n < 0 || n % multiple !== 0) {\n const what = multiple === 1 ? \"a whole number ≥ 0\" : `a whole multiple of ${multiple}`;\n throw new RangeError(`outline.sample(n): n must be ${what}, got ${n}.`);\n }\n}\n","// Shared by the builders: assembling a MarkGeometry from a walk and a body, and checking input.\n\nimport type { MarkGeometry, Outline, Point, Rect } from \"../../contracts/geometry\";\nimport type { Walk } from \"../walk\";\n\nexport interface MarkParts {\n readonly key: string;\n readonly series?: string | undefined;\n readonly walk: Walk;\n readonly thickness: number;\n readonly outline: Outline;\n readonly bounds: Rect;\n readonly center: Point;\n readonly pivot: Point;\n readonly labelBounds?: readonly Rect[] | undefined;\n readonly nearbyLabels?: readonly Rect[] | undefined;\n readonly segments?: readonly MarkGeometry[];\n}\n\nexport function assemble({ key, series, walk, thickness, outline, bounds, center, pivot, labelBounds, nearbyLabels, segments }: MarkParts): MarkGeometry {\n return {\n key,\n ...(series === undefined ? {} : { series }),\n start: walk.start,\n end: walk.end,\n length: walk.length,\n path: (t) => walk.point(t),\n angle: (t) => walk.angle(t),\n slice: (t0, t1) => walk.slice(t0, t1),\n ...(walk.gaps.length === 0 ? {} : { gaps: walk.gaps }),\n thickness,\n outline,\n bounds,\n center,\n pivot,\n ...(labelBounds === undefined ? {} : { labelBounds }),\n ...(nearbyLabels === undefined ? {} : { nearbyLabels }),\n ...(segments === undefined ? {} : { segments })\n };\n}\n\n/** Throws a RangeError naming the builder and field unless `value` is a finite number. */\nexport function finite(builder: string, field: string, value: number): number {\n if (!Number.isFinite(value)) throw new RangeError(`describe.${builder}: ${field} must be a finite number, got ${value}.`);\n return value;\n}\n\n/** A spec's `labelBounds`, or another list of boxes (`nearbyLabels`), checked: each box's numbers finite, its sizes ≥ 0. Charts give them every frame, so a good box costs four comparisons. */\nexport function labelBoxes(builder: string, boxes: readonly Rect[] | undefined, field = \"labelBounds\"): readonly Rect[] | undefined {\n if (!boxes) return boxes;\n for (let i = 0; i < boxes.length; i++) {\n const { x, y, width, height } = boxes[i]!;\n if (Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(width) && width >= 0 && Number.isFinite(height) && height >= 0) continue;\n finite(builder, `${field}[${i}].x`, x);\n finite(builder, `${field}[${i}].y`, y);\n size(builder, `${field}[${i}].width`, width);\n size(builder, `${field}[${i}].height`, height);\n }\n return boxes;\n}\n\n/** Throws a RangeError unless `value` is a finite number ≥ 0. */\nexport function size(builder: string, field: string, value: number): number {\n if (!(Number.isFinite(value) && value >= 0)) {\n throw new RangeError(`describe.${builder}: ${field} must be a finite number ≥ 0, got ${value}.`);\n }\n return value;\n}\n","// describe.arc: donut and pie slices, in d3.pie()'s angle convention.\n\nimport type { MarkGeometry, Rect } from \"../../contracts/geometry\";\nimport { closedOutline } from \"../outline\";\nimport { arc, boundsOf, extremes, line, polar, TAU } from \"../segment\";\nimport { createWalk } from \"../walk\";\nimport { assemble, finite, labelBoxes, size } from \"./mark\";\n\nexport interface ArcSpec {\n readonly key: string;\n readonly series?: string;\n /** The donut's centre. */\n readonly cx: number;\n readonly cy: number;\n /** Radii in px; 0 inner makes a pie slice. They're swapped if inner > outer, as d3.arc() does. */\n readonly inner: number;\n readonly outer: number;\n /** Radians, 0 at 12 o'clock, clockwise: the d3.pie() convention. end < start walks anticlockwise. */\n readonly start: number;\n readonly end: number;\n /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n /** The boxes of other marks' text near it, in the same px: passed through as `nearbyLabels`. */\n readonly nearbyLabels?: readonly Rect[];\n}\n\n/**\n * The walk runs along the mid-radius arc from the start angle to the end angle, so for a slice\n * walked clockwise \"up\" is outward. The angle of travel equals the d3 angle (normalised).\n */\nexport function describeArc(spec: ArcSpec): MarkGeometry {\n const { key, series } = spec;\n const center = { x: finite(\"arc\", \"cx\", spec.cx), y: finite(\"arc\", \"cy\", spec.cy) };\n const r0 = Math.min(size(\"arc\", \"inner\", spec.inner), size(\"arc\", \"outer\", spec.outer));\n const r1 = Math.max(spec.inner, spec.outer);\n finite(\"arc\", \"start\", spec.start);\n finite(\"arc\", \"end\", spec.end);\n // More than a full turn draws the same ring, as with d3.arc().\n const sweep = Math.max(-TAU, Math.min(TAU, spec.end - spec.start));\n // d3 measures from 12 o'clock; screen angles from 3 o'clock.\n const from = spec.start - Math.PI / 2;\n const to = from + sweep;\n\n // The up side is outward when walking clockwise, inward when walking anticlockwise.\n const [left, right] = sweep >= 0 ? [r1, r0] : [r0, r1];\n const sides = [\n [arc(center, left, from, sweep)],\n [line(polar(center, left, to), polar(center, right, to), to + (left > right ? Math.PI : 0))],\n [arc(center, right, to, -sweep)],\n [line(polar(center, right, from), polar(center, left, from), from + (left > right ? 0 : Math.PI))]\n ] as const;\n\n const walk = createWalk([arc(center, (r0 + r1) / 2, from, sweep)]);\n return assemble({\n key,\n series,\n walk,\n thickness: r1 - r0,\n outline: closedOutline(sides),\n bounds: boundsOf(sides.flat().flatMap(extremes)),\n center: walk.point(0.5),\n pivot: center,\n labelBounds: labelBoxes(\"arc\", spec.labelBounds),\n nearbyLabels: labelBoxes(\"arc\", spec.nearbyLabels, \"nearbyLabels\")\n });\n}\n","// describe.bar: horizontal bars and vertical columns, plain or stacked, with an optional rounded tip.\n\nimport type { MarkGeometry, Point, Rect } from \"../../contracts/geometry\";\nimport { closedOutline } from \"../outline\";\nimport { arc, boundsOf, line } from \"../segment\";\nimport { createWalk } from \"../walk\";\nimport { assemble, finite, labelBoxes, size } from \"./mark\";\n\n/** The edge a bar grows from. */\nexport type Baseline = \"left\" | \"right\" | \"top\" | \"bottom\";\n\nexport interface BarSegmentSpec {\n readonly series: string;\n /** Px along the walk, gap included. */\n readonly size: number;\n}\n\nexport interface BarSpec {\n readonly key: string;\n readonly series?: string;\n /** The whole bar's rectangle, in chart px. */\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n readonly baseline: Baseline;\n /** Corner radius at the tip. The baseline end stays square. Default 0. */\n readonly radius?: number;\n /**\n * Ordered parts, from the baseline. Default: one segment named after `series`, covering the bar.\n * Sizes normally add up to the bar's length; anything past the tip is cut off.\n */\n readonly segments?: readonly BarSegmentSpec[];\n /**\n * Px left empty between segments (the prototype uses 2). It comes out of the start of the later\n * segment, so every segment still ends at its value, and it shrinks to fit when what comes\n * before is shorter. Default 0.\n */\n readonly gap?: number;\n /** The boxes of the text drawn for the bar, its segments having none, in the same px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n /** The boxes of other marks' text near the bar, its segments having none, in the same px: passed through as `nearbyLabels`. */\n readonly nearbyLabels?: readonly Rect[];\n}\n\nconst ANGLE: Readonly<Record<Baseline, number>> = { left: 0, right: Math.PI, top: Math.PI / 2, bottom: -Math.PI / 2 };\n\n/**\n * The walk runs along the centre line from the middle of the baseline edge to the middle of the\n * tip. A plain bar has one segment, so `travel(…, { along: \"goals\" })` works stacked or not.\n */\nexport function describeBar(spec: BarSpec): MarkGeometry {\n const { key, series, baseline, x, y, width, height } = spec;\n if (!Object.prototype.hasOwnProperty.call(ANGLE, baseline)) {\n throw new RangeError(`describe.bar: baseline must be left, right, top or bottom, got ${String(baseline)}.`);\n }\n finite(\"bar\", \"x\", x);\n finite(\"bar\", \"y\", y);\n size(\"bar\", \"width\", width);\n size(\"bar\", \"height\", height);\n const radius = size(\"bar\", \"radius\", spec.radius ?? 0);\n const gap = size(\"bar\", \"gap\", spec.gap ?? 0);\n const labelBounds = labelBoxes(\"bar\", spec.labelBounds);\n const nearbyLabels = labelBoxes(\"bar\", spec.nearbyLabels, \"nearbyLabels\");\n\n const horizontal = baseline === \"left\" || baseline === \"right\";\n const length = horizontal ? width : height;\n const thickness = horizontal ? height : width;\n const T = thickness;\n const angle = ANGLE[baseline];\n const at = frame(spec);\n\n // The bar or segment covering [p0, p1] along the walk. The tip is rounded by up to `tip` px.\n const part = (\n p0: number,\n p1: number,\n tip: number,\n rest: { key: string; series: string | undefined; bounds?: Rect; labelBounds?: readonly Rect[] | undefined; nearbyLabels?: readonly Rect[] | undefined; segments?: readonly MarkGeometry[] }\n ): MarkGeometry => {\n const rr = Math.max(0, Math.min(tip, p1 - p0, T / 2));\n const outline = closedOutline([\n [line(at(p0, 0), at(p1 - rr, 0), angle)],\n rr > 0\n ? [\n arc(at(p1 - rr, rr), rr, angle - Math.PI / 2, Math.PI / 2),\n line(at(p1, rr), at(p1, T - rr), angle + Math.PI / 2),\n arc(at(p1 - rr, T - rr), rr, angle, Math.PI / 2)\n ]\n : [line(at(p1, 0), at(p1, T), angle + Math.PI / 2)],\n [line(at(p1 - rr, T), at(p0, T), angle + Math.PI)],\n [line(at(p0, T), at(p0, 0), angle - Math.PI / 2)]\n ]);\n const walk = createWalk([line(at(p0, T / 2), at(p1, T / 2), angle)]);\n return assemble({\n ...rest,\n walk,\n thickness,\n outline,\n bounds: rest.bounds ?? boundsOf([at(p0, 0), at(p1, T)]),\n center: at((p0 + p1) / 2, T / 2),\n pivot: walk.start\n });\n };\n\n const specs: readonly { readonly series?: string | undefined; readonly size: number }[] = spec.segments ?? [{ series, size: length }];\n const seen = new Set<string>();\n let cursor = 0;\n const spans = specs.map((segment, index) => {\n size(\"bar\", `segments[${index}].size`, segment.size);\n if (segment.series !== undefined) {\n if (seen.has(segment.series)) throw new Error(`describe.bar: series \"${segment.series}\" appears twice in the segments of \"${key}\".`);\n seen.add(segment.series);\n }\n const from = Math.min(cursor, length);\n cursor += segment.size;\n const to = Math.min(cursor, length);\n return { segment, index, p0: Math.min(from + Math.min(gap, from), to), p1: to };\n });\n\n const segments = spans.map(({ segment, index, p0, p1 }) =>\n // The rounding fades in as a segment nears the tip, so a growing stack never pops.\n part(p0, p1, radius - (length - p1), {\n key: segment.series === undefined ? `${key}/${index}` : `${key}/${segment.series}`,\n series: segment.series\n })\n );\n // The whole bar keeps the exact rectangle it was given.\n return part(0, length, radius, { key, series, bounds: { x, y, width, height }, labelBounds, nearbyLabels, segments });\n}\n\n/** Chart px at distance p along the walk and s across it, measured from the left (up) edge. */\nfunction frame({ x, y, width: w, height: h, baseline }: BarSpec): (p: number, s: number) => Point {\n switch (baseline) {\n case \"left\":\n return (p, s) => ({ x: x + p, y: y + s });\n case \"right\":\n return (p, s) => ({ x: x + w - p, y: y + h - s });\n case \"top\":\n return (p, s) => ({ x: x + w - s, y: y + p });\n case \"bottom\":\n return (p, s) => ({ x: x + s, y: y + h - p });\n }\n}\n","// describe.line: a straight-segment polyline, as d3.line() draws with its default curve, with gaps\n// where a run of points ends and the next begins.\n\nimport type { MarkGeometry, Point, Rect } from \"../../contracts/geometry\";\nimport { openOutline } from \"../outline\";\nimport { boundsOf, line, type LineSegment } from \"../segment\";\nimport { createWalk, type Gaps } from \"../walk\";\nimport { assemble, finite, labelBoxes, size } from \"./mark\";\n\nexport interface LineSpec {\n readonly key: string;\n readonly series?: string;\n /** At least one point, in chart px. */\n readonly points: readonly Point[];\n /**\n * The indices of the points that start a new run, so there's a gap from `points[i - 1]` to\n * `points[i]`: each a whole number from 1 to the last index, in order, with no repeats. A line\n * drawn with d3's `.defined()` is described by its defined points and where they break. Default none.\n */\n readonly breaks?: readonly number[];\n /** Stroke width in px. Default 1, SVG's default. */\n readonly width?: number;\n /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n /** The boxes of other marks' text near it, in the same px: passed through as `nearbyLabels`. */\n readonly nearbyLabels?: readonly Rect[];\n}\n\n/**\n * The walk is the line itself, first point to last, running straight across each break. Its outline\n * is open: the stroke, with the breaks left out. A break between two points in the same place leaves\n * no gap, since there's nothing between them to leave out.\n */\nexport function describeLine(spec: LineSpec): MarkGeometry {\n const { key, series, points } = spec;\n const width = size(\"line\", \"width\", spec.width ?? 1);\n const first = points[0];\n if (!first) throw new RangeError(`describe.line: \"${key}\" needs at least one point.`);\n points.forEach((p, i) => {\n finite(\"line\", `points[${i}].x`, p.x);\n finite(\"line\", `points[${i}].y`, p.y);\n });\n const breaks = checkBreaks(spec.breaks, points.length);\n\n const segments: LineSegment[] = [];\n for (let i = 1; i < points.length; i++) {\n // A repeated point keeps the direction so far.\n segments.push(line(points[i - 1]!, points[i]!, segments[segments.length - 1]?.angle ?? 0));\n }\n if (segments.length === 0) segments.push(line(first, first));\n\n const walk = createWalk(segments, gapsAt(breaks, segments));\n const box = boundsOf(points);\n const pad = width / 2;\n return assemble({\n key,\n series,\n walk,\n thickness: width,\n outline: openOutline(walk),\n bounds: { x: box.x - pad, y: box.y - pad, width: box.width + width, height: box.height + width },\n center: walk.point(0.5),\n pivot: first,\n labelBounds: labelBoxes(\"line\", spec.labelBounds),\n nearbyLabels: labelBoxes(\"line\", spec.nearbyLabels, \"nearbyLabels\")\n });\n}\n\n/** The walk's gaps, in t: from the point before each break to the point at it, where they're apart. */\nfunction gapsAt(breaks: readonly number[], segments: readonly LineSegment[]): Gaps {\n // The distance to each point, summed as createWalk sums it, so the last point is at t = 1 exactly.\n const along = [0];\n for (const segment of segments) along.push(along[along.length - 1]! + segment.length);\n const length = along[along.length - 1]!;\n return breaks.filter((i) => along[i]! > along[i - 1]!).map((i) => [along[i - 1]! / length, along[i]! / length]);\n}\n\n/** `breaks`, checked: whole numbers from 1 to the last index, in order, with no repeats. */\nfunction checkBreaks(breaks: readonly number[] | undefined, count: number): readonly number[] {\n if (breaks === undefined) return [];\n if (!Array.isArray(breaks)) throw new RangeError(`describe.line: breaks must be an array of point indices, got ${show(breaks)}.`);\n let after = 0;\n breaks.forEach((index: unknown, i) => {\n if (!(Number.isInteger(index) && (index as number) > after && (index as number) < count)) {\n throw new RangeError(`describe.line: breaks[${i}] must be a whole number more than ${after} and less than ${count}, the number of points, got ${show(index)}.`);\n }\n after = index as number;\n });\n return breaks;\n}\n\nconst show = (value: unknown): string => (typeof value === \"string\" ? JSON.stringify(value) : String(value));\n","// describe.point: a dot with no direction (a scatter point or a marker).\n\nimport type { MarkGeometry, Rect } from \"../../contracts/geometry\";\nimport { closedOutline } from \"../outline\";\nimport { arc, line } from \"../segment\";\nimport { createWalk } from \"../walk\";\nimport { assemble, finite, labelBoxes, size } from \"./mark\";\n\nexport interface PointSpec {\n readonly key: string;\n readonly series?: string;\n readonly x: number;\n readonly y: number;\n /** Radius in px. */\n readonly r: number;\n /** The boxes of the text drawn for the mark, in the same px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n /** The boxes of other marks' text near it, in the same px: passed through as `nearbyLabels`. */\n readonly nearbyLabels?: readonly Rect[];\n}\n\n/**\n * Length 0, with start = end = centre, so travel does nothing while wiggle, pulse and flash still\n * work. Faces +x: the outline's sides are the quarter circles top, right, bottom and left.\n */\nexport function describePoint(spec: PointSpec): MarkGeometry {\n const { key, series } = spec;\n const center = { x: finite(\"point\", \"x\", spec.x), y: finite(\"point\", \"y\", spec.y) };\n const r = size(\"point\", \"r\", spec.r);\n const quarter = Math.PI / 2;\n return assemble({\n key,\n series,\n walk: createWalk([line(center, center)]),\n thickness: 2 * r,\n outline: closedOutline([\n [arc(center, r, (-3 * quarter) / 2, quarter)],\n [arc(center, r, -quarter / 2, quarter)],\n [arc(center, r, quarter / 2, quarter)],\n [arc(center, r, (3 * quarter) / 2, quarter)]\n ]),\n bounds: { x: center.x - r, y: center.y - r, width: 2 * r, height: 2 * r },\n center,\n pivot: center,\n labelBounds: labelBoxes(\"point\", spec.labelBounds),\n nearbyLabels: labelBoxes(\"point\", spec.nearbyLabels, \"nearbyLabels\")\n });\n}\n","// Path commands as walk segments: straight pieces and circular arcs. Béziers and arcs that aren't\n// circular become straight pieces within 0.1 px of the curve, so any path data can be walked.\n\nimport type { Point } from \"../contracts/geometry\";\nimport type { PathCommand } from \"./path\";\nimport { arc, line, TAU, type PathSegment } from \"./segment\";\n\n/** px: the most a straight piece strays from the curve it stands for. */\nexport const FLAT = 0.1;\n/** Pieces one curve can become, so a curve millions of px across can't make millions of them. */\nconst MAX_PIECES = 10_000;\n\n/**\n * One subpath: where it starts and ends, as written, its segments in order (none with no length),\n * and whether it ends with Z, which ends it where it started.\n */\nexport interface Subpath {\n readonly start: Point;\n readonly end: Point;\n readonly segments: readonly PathSegment[];\n readonly closed: boolean;\n}\n\n/**\n * The subpaths of absolute path commands, as `parsePath` gives them. A new subpath starts at each\n * move, and at a command after a Z, from where the Z closed. A move with nothing after it before the\n * next move, or the end, draws nothing and is left out.\n */\nexport function flattenPath(commands: readonly PathCommand[]): Subpath[] {\n const subpaths: Subpath[] = [];\n let start: Point | undefined;\n let pen: Point = { x: 0, y: 0 };\n let segments: PathSegment[] = [];\n let open = false;\n const finish = (closed: boolean): void => {\n if (open) subpaths.push({ start: start!, end: pen, segments, closed });\n segments = [];\n open = false;\n };\n const to = (point: Point): void => {\n if (!open) {\n start = pen;\n open = true;\n }\n pen = point;\n };\n // A piece with no length draws nothing. One that isn't finite is kept, for describe.shape to find.\n const push = (segment: PathSegment): void => {\n if (segment.length !== 0) segments.push(segment);\n };\n const straight = (a: Point, b: Point): void => push(line(a, b));\n const through = (points: readonly Point[]): void => {\n for (let k = 1; k < points.length; k++) straight(points[k - 1]!, points[k]!);\n };\n\n for (let i = 0; i < commands.length; i++) {\n const command = commands[i]!;\n const from = pen;\n switch (command.op) {\n case \"M\":\n finish(false);\n pen = command.to;\n // A move followed by a drawing command starts a subpath there.\n if (commands[i + 1] && commands[i + 1]!.op !== \"M\") {\n start = pen;\n open = true;\n }\n break;\n case \"Z\":\n to(start ?? pen);\n straight(from, pen);\n finish(true);\n break;\n case \"L\":\n to(command.to);\n straight(from, pen);\n break;\n case \"C\":\n to(command.to);\n through(bezier(from, command.c1, command.c2, command.to));\n break;\n case \"Q\":\n to(command.to);\n through(bezier(from, command.c, command.to));\n break;\n case \"A\":\n to(command.to);\n for (const segment of arcSegments(from, command)) push(segment);\n break;\n }\n }\n finish(false);\n return subpaths;\n}\n\n/**\n * The points of a quadratic or cubic Bézier at equal steps of its parameter, ends included, enough\n * that the straight pieces between them stay within FLAT of it. Between steps h apart, a piece strays\n * at most h²/8 times the curve's largest second derivative, which is 2|P0 − 2P1 + P2| for a quadratic\n * and 6 times the larger of |P0 − 2P1 + P2| and |P1 − 2P2 + P3| for a cubic.\n */\nfunction bezier(...p: Point[]): Point[] {\n const cubic = p.length === 4;\n const n = cubic ? cubicPieces(p[0]!, p[1]!, p[2]!, p[3]!) : pieces(1, 2 * bend(p[0]!, p[1]!, p[2]!));\n const points = [p[0]!];\n for (let k = 1; k < n; k++) {\n const t = k / n;\n const s = 1 - t;\n const [a, b, c, d] = cubic ? [s * s * s, 3 * s * s * t, 3 * s * t * t, t * t * t] : [s * s, 2 * s * t, t * t, 0];\n points.push({\n x: a * p[0]!.x + b * p[1]!.x + c * p[2]!.x + (cubic ? d * p[3]!.x : 0),\n y: a * p[0]!.y + b * p[1]!.y + c * p[2]!.y + (cubic ? d * p[3]!.y : 0)\n });\n }\n points.push(p[p.length - 1]!);\n return points;\n}\n\n/**\n * How many equal steps of its parameter a cubic Bézier takes for the straight pieces between them to\n * stay within FLAT of it: at least 1, as bezier() flattens it. Internal: the line chart's curve\n * flattens its pieces by it too (src/charts/curve.ts).\n */\nexport function cubicPieces(p0: Point, p1: Point, p2: Point, p3: Point): number {\n return pieces(1, 6 * Math.max(bend(p0, p1, p2), bend(p1, p2, p3)));\n}\n\n/** |a − 2b + c|: how far b is from halfway between a and c, twice over. */\nfunction bend(a: Point, b: Point, c: Point): number {\n return Math.hypot(a.x - 2 * b.x + c.x, a.y - 2 * b.y + c.y);\n}\n\n/** Pieces for a parameter that runs `span`, with the curve's second derivative at most `second`: see bezier(). */\nfunction pieces(span: number, second: number): number {\n const n = Math.ceil(span * Math.sqrt(second / (8 * FLAT)));\n return Number.isFinite(n) ? Math.min(MAX_PIECES, Math.max(1, n)) : MAX_PIECES;\n}\n\n/** Radii this close, relative to the larger, are equal: a circle moved through a matrix comes out so. */\nconst ROUND = 1e-9;\n\n/**\n * An SVG arc from `from` (SVG 1.1, F.6.5 and F.6.6): no segment when its ends are the same point, a\n * straight piece when a radius is 0, one circular arc when its radii are equal, and otherwise\n * straight pieces within FLAT of the ellipse.\n */\nfunction arcSegments(from: Point, command: Extract<PathCommand, { op: \"A\" }>): PathSegment[] {\n const { to, large, sweep } = command;\n if (from.x === to.x && from.y === to.y) return [];\n let { rx, ry } = command;\n if (!(rx > 0 && ry > 0)) return [line(from, to)];\n const circle = Math.abs(rx - ry) <= ROUND * Math.max(rx, ry);\n const phi = circle ? 0 : (command.rotation * Math.PI) / 180;\n const cos = Math.cos(phi);\n const sin = Math.sin(phi);\n // The start, relative to the chord's middle, in the ellipse's own axes.\n const hx = (from.x - to.x) / 2;\n const hy = (from.y - to.y) / 2;\n const x1 = cos * hx + sin * hy;\n const y1 = -sin * hx + cos * hy;\n // Radii too small to reach are scaled up until they just do.\n const reach = (x1 * x1) / (rx * rx) + (y1 * y1) / (ry * ry);\n if (reach > 1) {\n rx *= Math.sqrt(reach);\n ry *= Math.sqrt(reach);\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n const spread = rx2 * y1 * y1 + ry2 * x1 * x1;\n const k = (large !== sweep ? 1 : -1) * Math.sqrt(Math.max(0, (rx2 * ry2 - spread) / spread));\n const cx1 = (k * rx * y1) / ry;\n const cy1 = (-k * ry * x1) / rx;\n const center = { x: cos * cx1 - sin * cy1 + (from.x + to.x) / 2, y: sin * cx1 + cos * cy1 + (from.y + to.y) / 2 };\n const theta = Math.atan2((y1 - cy1) / ry, (x1 - cx1) / rx);\n let turn = Math.atan2((-y1 - cy1) / ry, (-x1 - cx1) / rx) - theta;\n // Positive turns clockwise on screen, as SVG's sweep flag 1 does with y down.\n if (sweep && turn < 0) turn += TAU;\n else if (!sweep && turn > 0) turn -= TAU;\n\n if (circle) return [arc(center, rx, theta, turn)];\n const n = pieces(Math.abs(turn), Math.max(rx, ry));\n const at = (angle: number): Point => {\n const ex = rx * Math.cos(angle);\n const ey = ry * Math.sin(angle);\n return { x: center.x + cos * ex - sin * ey, y: center.y + sin * ex + cos * ey };\n };\n const segments: PathSegment[] = [];\n let previous = from;\n for (let j = 1; j <= n; j++) {\n const next = j === n ? to : at(theta + (turn * j) / n);\n segments.push(line(previous, next));\n previous = next;\n }\n return segments;\n}\n","// Any SVG path data: read it, move it through a transform, and write it back out, and the outline of\n// any shape element as path commands. iconFromSvg reads icons' markup with it, expressive() reads the\n// circles and shapes other libraries draw, and a chart switch moves marks' outlines between\n// coordinate spaces. What's written is built from numbers only, so nothing from the input passes through.\n\nimport type { Matrix } from \"../contracts/drawing\";\nimport type { Point } from \"../contracts/geometry\";\nimport { formatNumber } from \"./path-data\";\n\n/** Absolute commands only: H and V become L, S becomes C, T becomes Q. */\nexport type PathCommand =\n | { readonly op: \"M\" | \"L\" | \"Z\"; readonly to: Point }\n | { readonly op: \"C\"; readonly c1: Point; readonly c2: Point; readonly to: Point }\n | { readonly op: \"Q\"; readonly c: Point; readonly to: Point }\n | {\n readonly op: \"A\";\n readonly rx: number;\n readonly ry: number;\n /** Degrees, as in path data. */\n readonly rotation: number;\n readonly large: boolean;\n readonly sweep: boolean;\n readonly to: Point;\n };\n\nconst ARITY: Readonly<Record<string, number>> = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7 };\n/** Separators, then a command letter or a number. Reading stops at anything else. */\nconst TOKEN = /[\\s,]*([A-Za-z]|[+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?)/y;\nconst LETTER = /^[A-Za-z]$/;\n\n/** Reads path data as SVG does: up to the first error, which ends the path. */\nexport function parsePath(d: string): PathCommand[] {\n const tokens: string[] = [];\n TOKEN.lastIndex = 0;\n for (let match = TOKEN.exec(d); match; match = TOKEN.exec(d)) tokens.push(match[1]!);\n const out: PathCommand[] = [];\n let pen: Point = { x: 0, y: 0 };\n let start = pen;\n /** The last command's second control point, which S and T reflect. */\n let control: Point | undefined;\n let command = \"\";\n let i = 0;\n\n while (i < tokens.length) {\n if (LETTER.test(tokens[i]!)) command = tokens[i++]!;\n else if (command === \"\" || command === \"Z\" || command === \"z\") break; // numbers with no command\n const upper = command.toUpperCase();\n if (upper === \"Z\") {\n out.push({ op: \"Z\", to: start });\n pen = start;\n control = undefined;\n continue;\n }\n const arity = ARITY[upper];\n if (arity === undefined) break;\n const args: number[] = [];\n let flagError = false;\n while (args.length < arity && i < tokens.length && !LETTER.test(tokens[i]!)) {\n const token = tokens[i]!;\n // An arc's flags are one character each, and can run into each other and into the next\n // number: \"a1 1 0 0110 10\", \"A5 5 0 01.5 .5\". Anything but 0 or 1 there is an error.\n if (upper === \"A\" && (args.length === 3 || args.length === 4)) {\n const flag = token[0];\n if (flag !== \"0\" && flag !== \"1\") {\n flagError = true;\n break;\n }\n args.push(Number(flag));\n if (token.length > 1) tokens[i] = token.slice(1);\n else i++;\n continue;\n }\n args.push(Number(token));\n i++;\n }\n if (flagError || args.length < arity || !args.every(Number.isFinite)) break;\n\n const relative = command !== upper;\n const at = (x: number, y: number): Point => (relative ? { x: pen.x + x, y: pen.y + y } : { x, y });\n const [a = 0, b = 0, c = 0, e = 0, f = 0, g = 0, h = 0] = args;\n let next: Point | undefined;\n switch (upper) {\n case \"M\":\n pen = start = at(a, b);\n out.push({ op: \"M\", to: pen });\n // Further pairs after a move are lines.\n command = relative ? \"l\" : \"L\";\n break;\n case \"L\":\n out.push({ op: \"L\", to: (pen = at(a, b)) });\n break;\n case \"H\":\n out.push({ op: \"L\", to: (pen = { x: relative ? pen.x + a : a, y: pen.y }) });\n break;\n case \"V\":\n out.push({ op: \"L\", to: (pen = { x: pen.x, y: relative ? pen.y + a : a }) });\n break;\n case \"C\":\n case \"S\": {\n const smooth = upper === \"S\";\n const c1 = smooth ? (control && lastIs(out, \"C\") ? reflect(control, pen) : pen) : at(a, b);\n next = smooth ? at(a, b) : at(c, e);\n out.push({ op: \"C\", c1, c2: next, to: (pen = smooth ? at(c, e) : at(f, g)) });\n break;\n }\n case \"Q\":\n case \"T\": {\n const smooth = upper === \"T\";\n next = smooth ? (control && lastIs(out, \"Q\") ? reflect(control, pen) : pen) : at(a, b);\n out.push({ op: \"Q\", c: next, to: (pen = smooth ? at(a, b) : at(c, e)) });\n break;\n }\n case \"A\":\n out.push({ op: \"A\", rx: Math.abs(a), ry: Math.abs(b), rotation: c, large: e !== 0, sweep: f !== 0, to: (pen = at(g, h)) });\n break;\n }\n control = next;\n }\n return out;\n}\n\nconst lastIs = (commands: readonly PathCommand[], op: PathCommand[\"op\"]): boolean => commands[commands.length - 1]?.op === op;\nconst reflect = (control: Point, about: Point): Point => ({ x: 2 * about.x - control.x, y: 2 * about.y - control.y });\n\n/** A shape element's attribute by name, as written: an element's getAttribute, or a map's get. */\nexport type ShapeAttribute = (name: string) => string | null | undefined;\n\n/**\n * A shape element's outline as path commands, in its own coordinates: `<path>`, `<circle>`,\n * `<ellipse>`, `<line>`, `<polyline>`, `<polygon>` or `<rect>`, from its attributes. A shape SVG\n * wouldn't draw (a radius of 0, a polyline of one point) has none, and so does any other tag.\n */\nexport function shapeOutline(tag: string, attribute: ShapeAttribute): PathCommand[] {\n const num = (name: string): number => {\n const value = Number.parseFloat(attribute(name) ?? \"\");\n return Number.isFinite(value) ? value : 0;\n };\n switch (tag) {\n case \"path\":\n return parsePath(attribute(\"d\") ?? \"\");\n case \"circle\":\n return ellipse(num(\"cx\"), num(\"cy\"), num(\"r\"), num(\"r\"));\n case \"ellipse\":\n return ellipse(num(\"cx\"), num(\"cy\"), num(\"rx\"), num(\"ry\"));\n case \"line\":\n return [\n { op: \"M\", to: { x: num(\"x1\"), y: num(\"y1\") } },\n { op: \"L\", to: { x: num(\"x2\"), y: num(\"y2\") } }\n ];\n case \"polyline\":\n case \"polygon\": {\n const values = (attribute(\"points\") ?? \"\").trim().split(/[\\s,]+/).filter(Boolean).map(Number);\n const points: Point[] = [];\n for (let i = 0; i + 1 < values.length && Number.isFinite(values[i]) && Number.isFinite(values[i + 1]); i += 2) {\n points.push({ x: values[i]!, y: values[i + 1]! });\n }\n if (points.length < 2) return [];\n const lines = points.map((to, i): PathCommand => ({ op: i === 0 ? \"M\" : \"L\", to }));\n // A polyline is a polygon left open: no closing segment, and filled as any open path is.\n return tag === \"polygon\" ? [...lines, { op: \"Z\", to: points[0]! }] : lines;\n }\n case \"rect\":\n return rect(num(\"x\"), num(\"y\"), num(\"width\"), num(\"height\"), attribute);\n default:\n return [];\n }\n}\n\nfunction ellipse(cx: number, cy: number, rx: number, ry: number): PathCommand[] {\n if (!(rx > 0 && ry > 0)) return [];\n const arc = (x: number): PathCommand => ({ op: \"A\", rx, ry, rotation: 0, large: false, sweep: true, to: { x, y: cy } });\n return [{ op: \"M\", to: { x: cx + rx, y: cy } }, arc(cx - rx), arc(cx + rx), { op: \"Z\", to: { x: cx + rx, y: cy } }];\n}\n\nfunction rect(x: number, y: number, w: number, h: number, attribute: ShapeAttribute): PathCommand[] {\n if (!(w > 0 && h > 0)) return [];\n const corner = (name: string): number | undefined => {\n const value = Number.parseFloat(attribute(name) ?? \"\");\n return value >= 0 ? value : undefined;\n };\n // A missing rx or ry takes the other's value, and both are capped at half the side.\n const rx = Math.min(corner(\"rx\") ?? corner(\"ry\") ?? 0, w / 2);\n const ry = Math.min(corner(\"ry\") ?? corner(\"rx\") ?? 0, h / 2);\n const line = (px: number, py: number): PathCommand => ({ op: \"L\", to: { x: px, y: py } });\n if (!(rx > 0 && ry > 0)) return [{ op: \"M\", to: { x, y } }, line(x + w, y), line(x + w, y + h), line(x, y + h), { op: \"Z\", to: { x, y } }];\n const arc = (px: number, py: number): PathCommand => ({ op: \"A\", rx, ry, rotation: 0, large: false, sweep: true, to: { x: px, y: py } });\n return [\n { op: \"M\", to: { x: x + rx, y } },\n line(x + w - rx, y),\n arc(x + w, y + ry),\n line(x + w, y + h - ry),\n arc(x + w - rx, y + h),\n line(x + rx, y + h),\n arc(x, y + h - ry),\n line(x, y + ry),\n arc(x + rx, y),\n { op: \"Z\", to: { x: x + rx, y } }\n ];\n}\n\n/** Moves path commands through an affine transform. Arcs stay arcs: their ellipse is transformed too. */\nexport function transformPath(commands: readonly PathCommand[], m: Matrix): PathCommand[] {\n const p = (point: Point): Point => ({ x: m[0] * point.x + m[2] * point.y + m[4], y: m[1] * point.x + m[3] * point.y + m[5] });\n const mirrored = m[0] * m[3] - m[1] * m[2] < 0;\n return commands.map((command): PathCommand => {\n switch (command.op) {\n case \"M\":\n case \"L\":\n case \"Z\":\n return { op: command.op, to: p(command.to) };\n case \"C\":\n return { op: \"C\", c1: p(command.c1), c2: p(command.c2), to: p(command.to) };\n case \"Q\":\n return { op: \"Q\", c: p(command.c), to: p(command.to) };\n case \"A\":\n return { ...command, ...transformEllipse(command, m), sweep: mirrored !== command.sweep, to: p(command.to) };\n }\n });\n}\n\n/**\n * The arc's ellipse after the linear part of `m`. With E = M · R(rotation) · diag(rx, ry), the new\n * radii are E's singular values (the square roots of the eigenvalues of E·Eᵀ) and the new rotation\n * is the direction of the larger one's eigenvector.\n */\nfunction transformEllipse({ rx, ry, rotation }: { rx: number; ry: number; rotation: number }, m: Matrix): { rx: number; ry: number; rotation: number } {\n const r = (rotation * Math.PI) / 180;\n const cos = Math.cos(r);\n const sin = Math.sin(r);\n const e11 = (m[0] * cos + m[2] * sin) * rx;\n const e12 = (m[2] * cos - m[0] * sin) * ry;\n const e21 = (m[1] * cos + m[3] * sin) * rx;\n const e22 = (m[3] * cos - m[1] * sin) * ry;\n // E·Eᵀ = [[a, b], [b, c]].\n const a = e11 * e11 + e12 * e12;\n const b = e11 * e21 + e12 * e22;\n const c = e21 * e21 + e22 * e22;\n const mean = (a + c) / 2;\n const spread = Math.hypot((a - c) / 2, b);\n const major = mean + spread;\n const angle = Math.abs(b) < 1e-12 ? (a >= c ? 0 : Math.PI / 2) : Math.atan2(major - a, b);\n return { rx: Math.sqrt(major), ry: Math.sqrt(Math.max(0, mean - spread)), rotation: (angle * 180) / Math.PI };\n}\n\n/** Absolute path data with numbers rounded to 0.001 px. */\nexport function formatPath(commands: readonly PathCommand[]): string {\n const n = formatNumber;\n const pt = (point: Point): string => `${n(point.x)},${n(point.y)}`;\n return commands\n .map((command) => {\n switch (command.op) {\n case \"M\":\n case \"L\":\n return `${command.op}${pt(command.to)}`;\n case \"C\":\n return `C${pt(command.c1)} ${pt(command.c2)} ${pt(command.to)}`;\n case \"Q\":\n return `Q${pt(command.c)} ${pt(command.to)}`;\n case \"A\":\n return `A${n(command.rx)},${n(command.ry)} ${n(command.rotation)} ${command.large ? 1 : 0} ${command.sweep ? 1 : 0} ${pt(command.to)}`;\n case \"Z\":\n return \"Z\";\n }\n })\n .join(\"\");\n}\n","// describe.shape: any SVG path data, as an element with that `d` draws it. An open shape is a line,\n// with a gap at each later move; a closed one is an area with no direction, like a point.\n\nimport type { Matrix } from \"../../contracts/drawing\";\nimport type { MarkGeometry, Point, Rect } from \"../../contracts/geometry\";\nimport { flattenPath, type Subpath } from \"../flatten\";\nimport { loopOutline, openOutline } from \"../outline\";\nimport { parsePath, transformPath } from \"../path\";\nimport { boundsOf, extremes, line, type PathSegment } from \"../segment\";\nimport { createWalk, type Gaps } from \"../walk\";\nimport { assemble, labelBoxes } from \"./mark\";\n\nexport interface ShapeSpec {\n readonly key: string;\n readonly series?: string;\n /**\n * SVG path data in the shape's own px, read as SVG reads it, up to its first error. A shape is\n * closed when every subpath ends with Z, or where it started, and otherwise open, a line.\n */\n readonly d: string;\n /** Moves the shape into the marks' px, as an element's transform does, arcs too. Default none. */\n readonly matrix?: Matrix;\n /** An open shape's stroke width in px, more than 0. Default 1, SVG's default. */\n readonly width?: number;\n /** The boxes of the text drawn for the mark, in the marks' px: passed through as `labelBounds`. */\n readonly labelBounds?: readonly Rect[];\n /** The boxes of other marks' text near it, in the marks' px: passed through as `nearbyLabels`. */\n readonly nearbyLabels?: readonly Rect[];\n}\n\n/**\n * Path data, flattened: straight pieces and circular arcs stay as they are, and Béziers and other\n * arcs become straight pieces within 0.1 px of the curve.\n * - An open shape is a line. Its walk runs along the path from its first point, and each later move\n * starts a new run after a gap. Its outline is the stroke, less the gaps, and its thickness,\n * bounds, centre and pivot are as `describe.line`'s.\n * - A closed shape has no direction: its walk is its bounds' centre, with length 0. Its outline's\n * `d` is the whole path, holes too, and `sample(n)` goes round its longest subpath, clockwise in\n * four quarters of equal length from its upper left. Its thickness is the smaller of its width and\n * height.\n * A subpath that ends where it started is closed too, as d3.arc() draws a full ring's outer edge.\n * A path whose subpaths are all closed but have no length, as d3 draws a value alone, is open: a line\n * with nothing to stroke.\n */\nexport function describeShape(spec: ShapeSpec): MarkGeometry {\n const { key, series, d } = spec;\n const width = spec.width ?? 1;\n if (!(Number.isFinite(width) && width > 0)) throw new RangeError(`describe.shape: width must be a finite number more than 0, got ${width}.`);\n const m = checkMatrix(spec.matrix);\n if (typeof d !== \"string\") throw new RangeError(`describe.shape: d must be path data, a string, got ${show(d)}.`);\n const commands = parsePath(d);\n const subpaths = commands[0]?.op === \"M\" ? flattenPath(m ? transformPath(commands, m) : commands) : [];\n if (subpaths.length === 0) throw new RangeError(`describe.shape: d must start with a move and draw something after it, got ${show(d)}.`);\n\n const points: Point[] = [];\n let length = 0;\n for (const subpath of subpaths) {\n points.push(subpath.start);\n for (const segment of subpath.segments) {\n for (const point of extremes(segment)) points.push(point);\n length += segment.length;\n }\n }\n const box = boundsOf(points);\n if (![box.x, box.y, box.width, box.height, length].every(Number.isFinite)) {\n throw new RangeError(`describe.shape: d must stay finite${m ? \" once moved by matrix\" : \"\"}, got ${show(d)}.`);\n }\n const labelBounds = labelBoxes(\"shape\", spec.labelBounds);\n const nearbyLabels = labelBoxes(\"shape\", spec.nearbyLabels, \"nearbyLabels\");\n\n if (subpaths.every(closes) && length > 0) {\n const center = { x: box.x + box.width / 2, y: box.y + box.height / 2 };\n return assemble({\n key,\n series,\n walk: createWalk([line(center, center)]),\n thickness: Math.min(box.width, box.height),\n // A subpath with no length encloses nothing.\n outline: loopOutline(subpaths.map((subpath) => subpath.segments).filter((segments) => segments.length > 0)),\n bounds: box,\n center,\n pivot: center,\n labelBounds,\n nearbyLabels\n });\n }\n\n const { segments, gaps } = joined(subpaths);\n const walk = createWalk(segments, gaps);\n const pad = width / 2;\n return assemble({\n key,\n series,\n walk,\n thickness: width,\n outline: openOutline(walk),\n bounds: { x: box.x - pad, y: box.y - pad, width: box.width + width, height: box.height + width },\n center: walk.point(0.5),\n pivot: walk.start,\n labelBounds,\n nearbyLabels\n });\n}\n\n/** Whether a subpath ends with Z, or back where it started. */\nconst closes = ({ closed, start, end }: Subpath): boolean => closed || (start.x === end.x && start.y === end.y);\n\n/** The subpaths as one walk: a straight piece across from each to the next, which is a gap where they're apart. */\nfunction joined(subpaths: readonly Subpath[]): { segments: PathSegment[]; gaps: Gaps } {\n const segments: PathSegment[] = [];\n const across: number[] = [];\n let pen: Point | undefined;\n for (const subpath of subpaths) {\n if (pen && (pen.x !== subpath.start.x || pen.y !== subpath.start.y)) {\n across.push(segments.length);\n segments.push(line(pen, subpath.start));\n }\n for (const segment of subpath.segments) segments.push(segment);\n pen = subpath.end;\n }\n if (segments.length === 0) segments.push(line(subpaths[0]!.start, subpaths[0]!.start));\n // The distance to each segment, summed as createWalk sums it, so the walk's end is at t = 1 exactly.\n const along = [0];\n for (const segment of segments) along.push(along[along.length - 1]! + segment.length);\n const length = along[along.length - 1]!;\n return { segments, gaps: across.map((i) => [along[i]! / length, along[i + 1]! / length]) };\n}\n\n/** `matrix`, checked: six finite numbers. */\nfunction checkMatrix(m: Matrix | undefined): Matrix | undefined {\n if (m === undefined) return m;\n if (!(Array.isArray(m) && m.length === 6 && m.every(Number.isFinite))) {\n throw new RangeError(`describe.shape: matrix must be six finite numbers [a, b, c, d, e, f], got ${show(m)}.`);\n }\n return m;\n}\n\n/** A value for a message: strings quoted, and cut short past 40 characters. */\nfunction show(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(show).join(\", \")}]`;\n if (typeof value !== \"string\") return String(value);\n return JSON.stringify(value.length > 40 ? `${value.slice(0, 40)}…` : value);\n}\n","// The public geometry builders. Reference charts and adapters share these, so a bar is described\n// the same way whoever drew it.\n\nimport { describeArc } from \"./arc\";\nimport { describeBar } from \"./bar\";\nimport { describeLine } from \"./line\";\nimport { describePoint } from \"./point\";\nimport { describeShape } from \"./shape\";\n\nexport const describe: {\n bar: typeof describeBar;\n arc: typeof describeArc;\n line: typeof describeLine;\n point: typeof describePoint;\n shape: typeof describeShape;\n} = {\n bar: describeBar,\n arc: describeArc,\n line: describeLine,\n point: describePoint,\n shape: describeShape\n};\n\nexport type { ArcSpec } from \"./arc\";\nexport type { BarSegmentSpec, BarSpec, Baseline } from \"./bar\";\nexport type { LineSpec } from \"./line\";\nexport type { PointSpec } from \"./point\";\nexport type { ShapeSpec } from \"./shape\";\n","// Named things charts look up: presets (name → effect factory) and icons. The composition root\n// (src/index.ts) owns the page-wide registries and hands them to charts, so a chart never knows\n// what a name means.\n\nimport type { AnyMarkEffect, MarkEffect } from \"./contracts/effect\";\nimport type { EffectSlot, EffectSlots } from \"./contracts/slots\";\nimport type { SlotEffects } from \"./runner\";\n\nexport interface Registry<T> {\n /** The entry registered under `name`, if any. A Registry<Icon> is an IconSource. */\n get(name: string): T | undefined;\n /** Like get(), but an unknown name throws a RangeError that lists what is registered. */\n resolve(name: string): T;\n /** A later registration under the same name replaces the earlier one. */\n register(name: string, value: T): void;\n /** Registered names, in the order they were first registered. */\n names(): string[];\n}\n\nexport interface RegistryOptions<T> {\n /** What the entries are, for error messages: \"preset\", \"icon\". */\n readonly kind: string;\n readonly entries?: Readonly<Record<string, T>>;\n /** Appended to the unknown-name error, for example how to register one. */\n readonly hint?: string;\n}\n\nexport function createRegistry<T>(options: RegistryOptions<T>): Registry<T> {\n const { kind, hint } = options;\n const entries = new Map<string, T>();\n\n const registry: Registry<T> = {\n get: (name) => entries.get(name),\n resolve(name) {\n const value = entries.get(name);\n if (value !== undefined) return value;\n const known = entries.size > 0 ? [...entries.keys()].join(\", \") : \"none\";\n throw new RangeError(`Unknown ${kind} \"${String(name)}\". Registered ${kind}s: ${known}.${hint ? ` ${hint}` : \"\"}`);\n },\n register(name, value) {\n if (typeof name !== \"string\" || name === \"\") throw new TypeError(`A ${kind} needs a non-empty string name, got ${JSON.stringify(name)}.`);\n if (value === undefined) throw new TypeError(`Registering ${kind} \"${name}\" needs a value.`);\n entries.set(name, value);\n },\n names: () => [...entries.keys()]\n };\n for (const [name, value] of Object.entries(options.entries ?? {})) registry.register(name, value);\n return registry;\n}\n\n/** Makes a fresh effect for a preset name. Presets work on any rows, so they return MarkEffect. */\nexport type PresetFactory = () => MarkEffect;\n\nexport const EFFECT_SLOTS: readonly EffectSlot[] = [\"hover\", \"enter\", \"update\", \"exit\", \"decorate\"];\n\n/**\n * Turns a chart's `on` option into the effects its runner plays: preset names go through `presets`,\n * effects pass through. Charts call it when they're created, so an unknown preset name, a slot that\n * doesn't exist or a transition effect in a mark slot throws there instead of drawing nothing.\n */\nexport function resolveEffects<D>(on: EffectSlots<D> | undefined, presets: Pick<Registry<PresetFactory>, \"resolve\">): SlotEffects<D> {\n const effects: { [S in EffectSlot]?: MarkEffect<D> } = {};\n for (const slot of Object.keys(on ?? {})) {\n if (!(EFFECT_SLOTS as readonly string[]).includes(slot)) {\n throw new TypeError(`on.${slot} isn't an effect slot. Use one of: ${EFFECT_SLOTS.join(\", \")}.`);\n }\n }\n for (const slot of EFFECT_SLOTS) {\n const option = on?.[slot];\n if (option === undefined) continue;\n if (typeof option === \"string\") {\n const effect: unknown = presets.resolve(option)();\n if (!isMarkEffect(effect)) throw new TypeError(`Preset \"${option}\" for on.${slot} didn't return a mark effect; it returned ${describeValue(effect)}.`);\n effects[slot] = effect;\n } else {\n if (!isMarkEffect(option)) throw new TypeError(`on.${slot} needs a mark effect (kind \"geometry\" or \"data\") or a preset name, got ${describeValue(option)}.`);\n effects[slot] = option;\n }\n }\n return effects;\n}\n\n/** True for a geometry or data effect with run, end and clear. Combinators check their parts with it too. */\nexport function isMarkEffect(value: unknown): value is AnyMarkEffect {\n if (typeof value !== \"object\" || value === null) return false;\n const effect = value as Partial<Record<\"kind\" | \"run\" | \"end\" | \"clear\", unknown>>;\n return (\n (effect.kind === \"geometry\" || effect.kind === \"data\") &&\n typeof effect.run === \"function\" &&\n typeof effect.end === \"function\" &&\n typeof effect.clear === \"function\"\n );\n}\n\n/** What a value that isn't a mark effect is, for error messages. */\nexport function describeValue(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 === \"transition\") return \"a transition effect, which runs between two charts rather than on one mark\";\n if (kind === \"geometry\" || kind === \"data\") return `a ${kind} 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 * The merge behind `mark.set()` and the handles' `update()`: fields given replace the current ones,\n * and a field given as undefined is removed, so it goes back to its default.\n */\nexport function mergeFields<T extends object>(current: T, next: Partial<T> | undefined): T {\n const result: Record<string, unknown> = { ...(current as Record<string, unknown>) };\n for (const [field, value] of Object.entries(next ?? {})) {\n if (value === undefined) delete result[field];\n else result[field] = value;\n }\n return result as T;\n}\n","// The box a piece of text covers, from its width: the charts' labels (src/charts/render/text.ts) and\n// effects' text (EffectContext.texts) are boxed the same way. Internal.\n\nimport type { TextStyle } from \"./contracts/drawing\";\nimport type { Point, Rect } from \"./contracts/geometry\";\n\n/** The overlay's text size, in px: the theme's `.ec-overlay .ec-text`. */\nexport const TEXT_SIZE = 12.5;\n\n/** An estimate of the average glyph width, in em, where there's no layout to measure text in. */\nexport const AVERAGE_WIDTH = 0.6;\n\n/**\n * How far text reaches, as shares of its size: above its baseline (an accented capital's top), below\n * it (a descender's foot), and past its measured width at either side (a W's lean, an f's hook). So a\n * box holds the text's getBBox() in Chrome with Segoe UI, Arial, Georgia, Verdana and Consolas; a\n * Times New Roman \"ff\" reaches 0.8 px past it.\n */\nconst ASCENT = 1.05;\nconst DESCENT = 0.25;\nconst SIDE = 0.16;\n\n/** The box text `width` px wide covers at `size` px, its baseline's anchor point at `at`, anchored by `anchor` (default \"start\"). */\nexport function boxAround(at: Point, anchor: TextStyle[\"anchor\"], width: number, size: number): Rect {\n const start = anchor === \"end\" ? at.x - width : anchor === \"middle\" ? at.x - width / 2 : at.x;\n return { x: start - SIDE * size, y: at.y - ASCENT * size, width: width + 2 * SIDE * size, height: (ASCENT + DESCENT) * size };\n}\n\n/** The box `content` takes drawn with `style` in the overlay, estimated from its length: where a surface can't measure text. */\nexport function estimatedBox(content: string, style: TextStyle): Rect {\n return boxAround(style.at, style.anchor, content.length * TEXT_SIZE * AVERAGE_WIDTH, TEXT_SIZE);\n}\n","// The effect runner: connects a chart's mark events to its effects and owns every run's lifecycle,\n// so effects stay small and stateless. Each chart or adapter creates one. Internal: charts and\n// adapters use it; it isn't part of the public API. See docs/architecture.md#runner.\n\nimport { defaultClock, type Clock } from \"./clock\";\nimport type { MarkData } from \"./contracts/data\";\nimport type { Layer, MarkHandle, MarkStyle, TextStyle } from \"./contracts/drawing\";\nimport type { AnyMarkEffect, EffectContext, MarkEffect, TextSpace } from \"./contracts/effect\";\nimport type { MarkGeometry, Rect } from \"./contracts/geometry\";\nimport type { IconSource } from \"./contracts/icon\";\nimport type { EffectSlot } from \"./contracts/slots\";\nimport { mergeFields } from \"./merge\";\nimport { motion as pageMotion, type Motion, type MotionView } from \"./motion\";\nimport { report } from \"./report\";\nimport { estimatedBox } from \"./text-box\";\nimport { tween } from \"./tween\";\n\ntype Batch = { readonly index: number; readonly count: number };\n\n// ── One run's context ────────────────────────────────────────────────────────\n\nexport interface RunScopeOptions {\n readonly clock: Clock;\n readonly motion: MotionView;\n readonly icons: IconSource;\n readonly layer: Layer & { clear(): void };\n readonly mark: MarkHandle;\n readonly batch: Batch;\n readonly previous?: MarkGeometry | undefined;\n /** The run's view of where effects' text sits. The caller lets go of its box when it's cleared. */\n readonly texts?: TextSpace;\n}\n\n/** An EffectContext plus the controls the runner keeps for itself. testContext() is built on it too. */\nexport interface RunScope {\n readonly context: EffectContext;\n abort(): void;\n /** Calls the run's onChange listeners. */\n change(mark: MarkGeometry, data?: MarkData): void;\n /** The runner's cleanup after effect.clear(ctx): abort, empty the layer, reset the mark, drop onChange listeners. */\n clear(): void;\n}\n\nexport function runScope(options: RunScopeOptions): RunScope {\n const { clock, motion, layer, mark } = options;\n const controller = new AbortController();\n let listeners: ((mark: MarkGeometry, data?: MarkData) => void)[] = [];\n\n const context: EffectContext = {\n signal: controller.signal,\n motion,\n mark,\n layer,\n icons: options.icons,\n batch: options.batch,\n ...(options.previous ? { previous: options.previous } : {}),\n ...(options.texts ? { texts: options.texts } : {}),\n tween(tweenOptions) {\n const own = tweenOptions.signal;\n const running = tween({ ...tweenOptions, signal: own ?? controller.signal }, { clock, motion });\n // An effect's own signal doesn't stop the run's signal from cancelling it too.\n if (own && own !== controller.signal) {\n if (controller.signal.aborted) running.cancel();\n else controller.signal.addEventListener(\"abort\", () => running.cancel(), { once: true });\n }\n return running;\n },\n onChange(listener) {\n listeners.push(listener);\n }\n };\n\n return {\n context,\n abort() {\n controller.abort();\n },\n change(geometry, data) {\n for (const listener of [...listeners]) listener(geometry, data);\n },\n clear() {\n controller.abort();\n layer.clear();\n mark.reset();\n listeners = [];\n }\n };\n}\n\n// ── The runner ───────────────────────────────────────────────────────────────\n\n/** The effects a runner plays, at most one per slot, with preset names already resolved (resolveEffects). */\nexport type SlotEffects<D = unknown> = { readonly [S in EffectSlot]?: MarkEffect<D> };\n\n/** A mark as the runner sees it. Chart events (MarkEvent) fit as they are. */\nexport interface RunInput<D = unknown> {\n readonly mark: MarkGeometry;\n readonly data: MarkData<D>;\n}\n\nexport interface UpdateInput<D = unknown> extends RunInput<D> {\n /** The geometry before this update. Default: the last geometry the runner saw for the key. */\n readonly from?: MarkGeometry;\n}\n\n/** One run's overlay group. */\nexport interface SurfaceGroup extends Layer {\n /**\n * Removes everything drawn in the group. Called once, when the run is cleared; nothing is drawn in\n * the group after that, so it can remove itself. Handles from a cleared group must ignore calls.\n */\n clear(): void;\n}\n\n/** What the runner draws on: a chart's or adapter's renderer (SVG today) implements it. */\nexport interface RunnerSurface {\n /**\n * A new, empty overlay group for one run, above the marks, in chart coordinates. Asked for on the\n * run's first draw, which can come late (a decoration that draws on its first change). Stack groups\n * by `order`, the run's start order, lower below higher, not by when they were asked for.\n */\n group(key: string, slot: EffectSlot, order: number): SurfaceGroup;\n /** The mark's own style handle. The runner merges every live run's style into it. */\n mark(key: string): MarkHandle;\n /**\n * The box `content` takes drawn with `style` in a run's group, for `EffectContext.texts`: measured\n * as the chart measures its own text. Default: estimated from its length.\n */\n box?(content: string, style: TextStyle): Rect;\n}\n\nexport interface RunnerOptions<D = unknown> {\n readonly effects: SlotEffects<D>;\n readonly surface: RunnerSurface;\n /** Default: the page-wide motion. The runner subscribes, so turning motion off mid-run jumps to end states. */\n readonly motion?: MotionView & Pick<Motion, \"subscribe\">;\n /** Default: the page-wide clock. */\n readonly clock?: Clock;\n /** Default: no icons. */\n readonly icons?: IconSource;\n}\n\n/**\n * Charts call these as things happen; the runner starts, clears and replays runs. A run is one\n * effect playing on one mark for one slot. Every method takes marks by key, as given in their\n * geometry, and is a no-op after destroy().\n */\nexport interface Runner<D = unknown> {\n /** Marks appeared: starts `decorate` (it stays until the mark exits), then `enter`. */\n enter(marks: readonly RunInput<D>[]): void;\n /**\n * An update started, as its transition starts (docs/architecture.md#events-and-effect-slots says\n * what counts as one). First it ends the `update` runs of the marks not in `marks`, as a re-trigger\n * would, so what the last update explained goes with it. Then it runs `update` on `marks`, the marks\n * whose values changed, with the geometry on screen and the values before: the data each key last\n * rested at, not values part way through a change.\n */\n update(marks: readonly UpdateInput<D>[]): void;\n /**\n * Marks are leaving: clears their other runs and runs `exit`. Resolves when every exit run has\n * finished, been cleared by a re-enter, or the runner is destroyed; then the chart removes them.\n */\n exit(marks: readonly RunInput<D>[]): Promise<void>;\n /** Pointer or focus arrived: runs `hover`. While a transition is in flight it waits until settle(). */\n hover(marks: readonly RunInput<D>[]): void;\n /** Pointer or focus left these marks (default: every hovered mark): clears their hover runs. */\n leave(keys?: readonly string[]): void;\n /**\n * A mark's geometry (or data) changed on screen: every frame of a transition, a resize, a line\n * reveal. Its runs hear it in start order. Charts tell marks in the order they give them to enter()\n * and update(), so text placed again goes past the text before it; text that another mark's text\n * moved past after it was placed is placed again once the chart is done (a microtask).\n */\n change(mark: MarkGeometry, data?: MarkData<D>): void;\n /** A data transition starts: clears hover runs, and holds new hovers until settle(). */\n interrupt(): void;\n /** The last transition settled: replays hover on the marks still hovered or focused. */\n settle(): void;\n /**\n * New effects, as a chart's update({ on }) gives them. A slot whose effect is the same object keeps\n * its runs. A changed slot's runs are cleared and the new effect starts where they were: `decorate`\n * on every mark in `marks`, and `hover` on the marks still hovered (from settle() while a transition\n * is in flight). `enter`, `update` and `exit` draw the new effect's end state on the marks whose runs\n * they replace, in their place, so nothing enters again, an update keeps showing what it explains,\n * and an exit still ends. A slot left empty clears its runs.\n *\n * `marks` are the marks staying through the chart's update, as they're heading, in visual order:\n * the marks entering start theirs with enter(). Their geometry and data start the new runs but\n * aren't taken as the marks' own, so an update() that follows still gets the values before it.\n */\n swap(effects: SlotEffects<D>, marks: readonly RunInput<D>[]): void;\n /** Clears every run and stops following the motion mode. */\n destroy(): void;\n}\n\ninterface Entry<D> {\n readonly key: string;\n /** The latest geometry and data seen for the key. */\n mark: MarkGeometry;\n data: MarkData<D>;\n /**\n * The data the key last rested at: its last enter() or update() (where it was heading), a change()\n * outside a transition (a resize, a line's reveal), or settle(). An update run's `previous` values,\n * so an update that replaces one still moving counts from the values the last one gave.\n */\n resting: MarkData<D>;\n readonly runs: Map<EffectSlot, Run<D>>;\n /** The merged style last written to the mark's handle. */\n applied: MarkStyle;\n handle: MarkHandle | undefined;\n /** Resolves the exit() promise while the mark is leaving. */\n exiting: (() => void) | undefined;\n}\n\ninterface Run<D> {\n readonly entry: Entry<D>;\n readonly slot: EffectSlot;\n /**\n * Start order: when two runs set the same style field the later one wins, and later runs' overlay\n * groups stack above. A run replaced by end() when the mode turns off keeps its order.\n */\n readonly order: number;\n readonly effect: AnyMarkEffect;\n readonly data: MarkData<D>;\n readonly batch: Batch;\n readonly previous: MarkGeometry | undefined;\n readonly scope: RunScope;\n /** This run's own style fields. */\n style: MarkStyle;\n /** \"ended\": run() resolved or end() drew; the run stays live (layer, style, onChange) until cleared. */\n state: \"running\" | \"ended\" | \"cleared\";\n /** Called once, when the run finishes or is cleared (exit() waits on it). */\n done: (() => void) | undefined;\n}\n\ninterface StartOptions {\n readonly previous?: MarkGeometry | undefined;\n readonly done?: (() => void) | undefined;\n /** Default: the next start order. */\n readonly order?: number | undefined;\n /** Draws the effect's end state, whatever the motion mode. */\n readonly end?: boolean;\n /** The geometry to start on. Default: the latest the runner saw for the key. */\n readonly mark?: MarkGeometry;\n}\n\n/** A run's text, as it holds it through `texts`. */\ninterface Held {\n box: Rect | undefined;\n /** When the run last held a box, and when its box last moved, counted in holds. */\n placed: number;\n moved: number;\n}\n\nconst SLOTS: readonly EffectSlot[] = [\"decorate\", \"enter\", \"update\", \"exit\", \"hover\"];\n\nconst byOrder = <D>(a: Run<D>, b: Run<D>): number => a.order - b.order;\nconst sameBox = (a: Rect | undefined, b: Rect | undefined): boolean =>\n a === b || (a !== undefined && b !== undefined && a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height);\n\nconst NO_ICONS: IconSource = { get: () => undefined };\n/** Handed out for draws after a run is cleared, so an effect that ignores its signal draws nothing. */\nconst INERT = { place() {}, update() {}, remove() {} };\n\nexport function createRunner<D = unknown>(options: RunnerOptions<D>): Runner<D> {\n const { surface } = options;\n let effects = options.effects;\n const motion = options.motion ?? pageMotion;\n const clock = options.clock ?? defaultClock;\n const icons = options.icons ?? NO_ICONS;\n const entries = new Map<string, Entry<D>>();\n /** Hovered or focused keys, in the order they arrived. */\n const hovered = new Set<string>();\n let transitioning = false;\n let destroyed = false;\n let order = 0;\n const box = (content: string, style: TextStyle): Rect => (surface.box ? surface.box(content, style) : estimatedBox(content, style));\n /**\n * Every run's text, as `texts` holds it. A run that let go stays until the next flush, so the runs\n * after it that were placed against it are placed again.\n */\n const texts = new Map<Run<D>, Held>();\n let holds = 0;\n let flushing = false;\n\n // The effective mode can turn off mid-run (the device asks for reduced motion, or the viewer picks\n // Off). Runs still going are replaced by end() on a fresh context, so they never finish half-drawn.\n const unsubscribe = motion.subscribe(() => {\n if (motion.mode === \"off\") endRunning();\n });\n\n function track(input: RunInput<D>): Entry<D> {\n const key = input.mark.key;\n const entry = entries.get(key);\n if (entry) {\n entry.mark = input.mark;\n entry.data = input.data;\n return entry;\n }\n const created: Entry<D> = { key, mark: input.mark, data: input.data, resting: input.data, runs: new Map(), applied: {}, handle: undefined, exiting: undefined };\n entries.set(key, created);\n return created;\n }\n\n /** Starts `slot`'s effect on the entry, clearing the slot's current run first. */\n function start(entry: Entry<D>, slot: EffectSlot, data: MarkData<D>, batch: Batch, more: StartOptions = {}): void {\n const { previous, done } = more;\n const effect = effects[slot] as AnyMarkEffect | undefined;\n if (!effect) {\n done?.();\n return;\n }\n const current = entry.runs.get(slot);\n if (current) clearRun(current);\n\n const run: Run<D> = {\n entry,\n slot,\n order: more.order ?? ++order,\n effect,\n data,\n batch,\n previous,\n style: {},\n state: \"running\",\n done,\n scope: runScope({\n clock,\n motion,\n icons,\n batch,\n previous,\n layer: runLayer(entry.key, slot, () => run.order, () => run.state !== \"cleared\"),\n mark: runMark(() => run),\n texts: {\n box,\n held: () => [...texts].flatMap(([other, held]) => (held.box && other.order < run.order ? [held.box] : [])),\n hold(next) {\n if (run.state !== \"cleared\") hold(run, next);\n }\n }\n })\n };\n entry.runs.set(slot, run);\n\n const mark = more.mark ?? entry.mark;\n const ctx = run.scope.context;\n try {\n if (more.end || motion.mode === \"off\") {\n if (effect.kind === \"data\") effect.end(mark, data, ctx);\n else effect.end(mark, ctx);\n finish(run);\n } else {\n const running = effect.kind === \"data\" ? effect.run(mark, data, ctx) : effect.run(mark, ctx);\n Promise.resolve(running).then(\n () => finish(run),\n (error: unknown) => fail(run, error)\n );\n }\n } catch (error) {\n fail(run, error);\n }\n }\n\n function finish(run: Run<D>): void {\n if (run.state !== \"running\") return;\n run.state = \"ended\";\n release(run);\n }\n\n function fail(run: Run<D>, error: unknown): void {\n const { signal } = run.scope.context;\n // A run that rejects because it was aborted isn't broken.\n if (signal.aborted && (error === signal.reason || (error as { name?: unknown } | null)?.name === \"AbortError\")) return;\n report(error);\n clearRun(run);\n }\n\n function release(run: Run<D>): void {\n const done = run.done;\n run.done = undefined;\n done?.();\n }\n\n /** Abort, effect.clear(ctx), then the runner's own cleanup: so it happens even if the effect forgets. */\n function clearRun(run: Run<D>): void {\n if (run.state === \"cleared\") return;\n run.state = \"cleared\";\n const { entry } = run;\n if (entry.runs.get(run.slot) === run) entry.runs.delete(run.slot);\n run.scope.abort();\n try {\n run.effect.clear(run.scope.context);\n } catch (error) {\n report(error);\n }\n run.scope.clear();\n hold(run, undefined);\n release(run);\n }\n\n /** Tells the run its mark moved, with its latest data; a run that throws is reported and cleared. */\n function tell(run: Run<D>, mark: MarkGeometry): void {\n try {\n // An update run keeps the previous values it was given, as when it's replaced by end().\n run.scope.change(mark, latestData(run.entry, run));\n } catch (error) {\n report(error);\n clearRun(run);\n }\n }\n\n /** The run's text is at `next` now. When it moved, the runs after it placed before it moved are placed again, once the chart has told every mark it's moving. */\n function hold(run: Run<D>, next: Rect | undefined): void {\n let held = texts.get(run);\n if (!held) {\n if (!next) return;\n texts.set(run, (held = { box: undefined, placed: 0, moved: 0 }));\n }\n held.placed = ++holds;\n if (sameBox(held.box, next)) return;\n held.box = next;\n held.moved = holds;\n if (flushing) return;\n flushing = true;\n queueMicrotask(flush);\n }\n\n /**\n * Places text again where text held before it moved after it was placed: each such run hears\n * onChange, in start order, so it goes past the text before it as that is now. The chart tells marks\n * in its order, which runs on several slots, or on a mark that didn't move, needn't keep.\n */\n function flush(): void {\n let moved = 0;\n for (const [run, held] of [...texts].sort(([a], [b]) => byOrder(a, b))) {\n if (held.box && held.placed < moved) tell(run, run.entry.mark);\n if (!held.box) texts.delete(run);\n moved = Math.max(moved, held.moved);\n }\n flushing = false;\n }\n\n /** A run's overlay group, created on its first draw. Draws after the run is cleared do nothing. */\n function runLayer(key: string, slot: EffectSlot, order: () => number, live: () => boolean): Layer & { clear(): void } {\n let group: SurfaceGroup | undefined;\n const target = (): Layer | undefined => (live() ? (group ??= surface.group(key, slot, order())) : undefined);\n return {\n icon: (icon, iconOptions) => target()?.icon(icon, iconOptions) ?? INERT,\n path: (d, paint) => target()?.path(d, paint) ?? INERT,\n text: (content, style) => target()?.text(content, style) ?? INERT,\n clear() {\n const drawn = group;\n group = undefined;\n drawn?.clear();\n }\n };\n }\n\n /** A run's view of the mark's style: its own fields, merged with the other live runs' into the real handle. */\n function runMark(own: () => Run<D>): MarkHandle {\n return {\n set(style) {\n const run = own();\n if (run.state === \"cleared\") return;\n run.style = mergeFields(run.style, style);\n applyStyle(run.entry);\n },\n reset() {\n const run = own();\n if (Object.keys(run.style).length === 0) return;\n run.style = {};\n applyStyle(run.entry);\n }\n };\n }\n\n /** Writes what changed in the merged style of the entry's live runs (later runs win a field). */\n function applyStyle(entry: Entry<D>): void {\n const runs = [...entry.runs.values()].sort((a, b) => a.order - b.order);\n const next: Record<string, unknown> = Object.assign({}, ...runs.map((run) => run.style));\n const applied = entry.applied as Record<string, unknown>;\n entry.applied = next as MarkStyle;\n if (Object.keys(next).length === 0) {\n if (Object.keys(applied).length > 0) handle(entry).reset();\n return;\n }\n const changes: Record<string, unknown> = {};\n let changed = false;\n for (const field of new Set([...Object.keys(applied), ...Object.keys(next)])) {\n if (applied[field] === next[field]) continue;\n // A field no run sets any more is given as undefined, which resets it.\n changes[field] = next[field];\n changed = true;\n }\n if (changed) handle(entry).set(changes as MarkStyle);\n }\n\n function handle(entry: Entry<D>): MarkHandle {\n return (entry.handle ??= surface.mark(entry.key));\n }\n\n /** Clears every run on the entry and drops it; resolves its exit() promise if it was leaving. */\n function forget(entry: Entry<D>): void {\n if (entries.get(entry.key) === entry) entries.delete(entry.key);\n hovered.delete(entry.key);\n const exited = entry.exiting;\n entry.exiting = undefined;\n for (const run of [...entry.runs.values()]) clearRun(run);\n entry.handle = undefined;\n exited?.();\n }\n\n /** Stops a pending exit (a re-enter, or exit() again) without forgetting the mark. */\n function cancelExit(entry: Entry<D>): void {\n const exited = entry.exiting;\n if (!exited) return;\n entry.exiting = undefined;\n const run = entry.runs.get(\"exit\");\n if (run) clearRun(run);\n exited();\n }\n\n function endRunning(): void {\n for (const entry of [...entries.values()]) {\n for (const run of [...entry.runs.values()]) {\n if (run.state !== \"running\" || entry.runs.get(run.slot) !== run) continue;\n // The replacement takes the run's place: its order (style precedence and stacking) and the\n // exit() promise waiting on it.\n const done = run.done;\n run.done = undefined;\n start(entry, run.slot, latestData(entry, run), run.batch, { previous: run.previous, done, order: run.order });\n }\n }\n }\n\n /** Clears the slot's run on each entry, and returns each order, to start the slot's next run in its place. */\n function clearSlot(slot: EffectSlot): Map<Entry<D>, number> {\n const orders = new Map<Entry<D>, number>();\n for (const entry of [...entries.values()]) {\n const run = entry.runs.get(slot);\n if (!run) continue;\n orders.set(entry, run.order);\n clearRun(run);\n }\n return orders;\n }\n\n /** The entry's latest data, keeping the previous values the run was given. */\n function latestData(entry: Entry<D>, run: Run<D>): MarkData<D> {\n const previous = run.data.previous;\n return previous && !entry.data.previous ? withPrevious(entry.data, previous) : entry.data;\n }\n\n return {\n enter(marks) {\n if (destroyed) return;\n marks.forEach((input, index) => {\n const entry = track(input);\n entry.resting = input.data;\n cancelExit(entry);\n const batch = { index, count: marks.length };\n start(entry, \"decorate\", input.data, batch);\n start(entry, \"enter\", input.data, batch);\n });\n },\n\n update(marks) {\n if (destroyed) return;\n // What the last update explained goes with it, on the marks this one leaves alone: a flash\n // still playing stops, and a delta that stayed is cleared, as a re-trigger clears them.\n const changing = new Set(marks.map((input) => input.mark.key));\n for (const entry of [...entries.values()]) {\n const run = entry.runs.get(\"update\");\n if (run && !changing.has(entry.key)) clearRun(run);\n }\n marks.forEach((input, index) => {\n const known = entries.get(input.mark.key);\n const previous = input.from ?? known?.mark;\n const data = known && !input.data.previous ? withPrevious(input.data, known.resting) : input.data;\n const entry = track(input);\n entry.resting = input.data;\n start(entry, \"update\", data, { index, count: marks.length }, { previous });\n });\n },\n\n exit(marks) {\n if (destroyed) return Promise.resolve();\n const exits = marks.map((input, index) => {\n const entry = track(input);\n cancelExit(entry);\n hovered.delete(entry.key);\n for (const run of [...entry.runs.values()]) clearRun(run);\n return new Promise<void>((resolve) => {\n entry.exiting = resolve;\n if (!effects.exit) {\n forget(entry);\n return;\n }\n start(entry, \"exit\", input.data, { index, count: marks.length }, {\n done: () => {\n if (entry.exiting && entries.get(entry.key) === entry) forget(entry);\n }\n });\n });\n });\n return Promise.all(exits).then(() => undefined);\n },\n\n hover(marks) {\n if (destroyed) return;\n marks.forEach((input, index) => {\n const entry = track(input);\n if (entry.exiting) return;\n hovered.add(entry.key);\n if (!transitioning) start(entry, \"hover\", input.data, { index, count: marks.length });\n });\n },\n\n leave(keys = [...hovered]) {\n for (const key of keys) {\n hovered.delete(key);\n const run = entries.get(key)?.runs.get(\"hover\");\n if (run) clearRun(run);\n }\n },\n\n change(mark, data) {\n const entry = entries.get(mark.key);\n if (!entry) return;\n entry.mark = mark;\n if (data) {\n entry.data = data;\n // Outside a transition the values aren't on their way anywhere: a resize, a line's reveal.\n if (!transitioning) entry.resting = data;\n }\n // In start order, as they started, so text placed again goes past the text before it, as that is now.\n for (const run of [...entry.runs.values()].sort(byOrder)) if (run.state !== \"cleared\") tell(run, mark);\n },\n\n interrupt() {\n if (destroyed) return;\n transitioning = true;\n for (const entry of [...entries.values()]) {\n const run = entry.runs.get(\"hover\");\n if (run) clearRun(run);\n }\n },\n\n settle() {\n if (!transitioning) return;\n transitioning = false;\n // Landed: each mark rests at the data its last frame gave.\n for (const entry of entries.values()) if (!entry.exiting) entry.resting = entry.data;\n const keys = [...hovered];\n keys.forEach((key, index) => {\n const entry = entries.get(key);\n if (entry) start(entry, \"hover\", entry.data, { index, count: keys.length });\n });\n },\n\n swap(next, marks) {\n if (destroyed) return;\n const changed = SLOTS.filter((slot) => next[slot] !== effects[slot]);\n effects = next;\n for (const slot of changed) {\n if (slot === \"decorate\") {\n const orders = clearSlot(slot);\n marks.forEach((input, index) => {\n const entry = entries.get(input.mark.key) ?? track(input);\n if (!entry.exiting) start(entry, slot, input.data, { index, count: marks.length }, { mark: input.mark, order: orders.get(entry) });\n });\n } else if (slot === \"hover\") {\n clearSlot(slot);\n // Mid-transition, settle() replays them with the new effect.\n if (transitioning) continue;\n const keys = [...hovered];\n keys.forEach((key, index) => {\n const entry = entries.get(key);\n if (entry) start(entry, slot, entry.data, { index, count: keys.length });\n });\n } else {\n for (const entry of [...entries.values()]) {\n const run = entry.runs.get(slot);\n if (!run) continue;\n // The new run takes the old one's place: its order, and the exit() promise waiting on it.\n const done = run.done;\n run.done = undefined;\n const data = latestData(entry, run);\n clearRun(run);\n start(entry, slot, data, run.batch, { previous: run.previous, done, order: run.order, end: true });\n }\n }\n }\n },\n\n destroy() {\n if (destroyed) return;\n destroyed = true;\n transitioning = false;\n unsubscribe();\n for (const entry of [...entries.values()]) forget(entry);\n hovered.clear();\n }\n };\n}\n\nfunction withPrevious<D>(data: MarkData<D>, previous: MarkData<D>): MarkData<D> {\n return { datum: data.datum, samples: data.samples, related: (series) => data.related(series), previous };\n}\n","// The transition player: plays a TransitionEffect on pairs of marks, one run per pair, with the\n// runner's rules, so transition effects stay small and stateless too. Internal: chartSwitch uses it;\n// it isn't part of the public API. Each pair's context is the runner's run scope plus `start`.\n\nimport { defaultClock, type Clock } from \"./clock\";\nimport type { Layer, MarkHandle } from \"./contracts/drawing\";\nimport type { TransitionContext, TransitionEffect } from \"./contracts/effect\";\nimport type { MarkGeometry } from \"./contracts/geometry\";\nimport type { IconSource } from \"./contracts/icon\";\nimport { motion as pageMotion, type Motion, type MotionView } from \"./motion\";\nimport { report } from \"./report\";\nimport { runScope, type RunScope, type SurfaceGroup } from \"./runner\";\n\n/** One mark in two views: where it is now and where it goes. Pairs are matched by key, so both have the same one. */\nexport interface TransitionPair {\n readonly from: MarkGeometry;\n readonly to: MarkGeometry;\n}\n\n/** What the player draws on: an overlay above both views. */\nexport interface TransitionSurface {\n /**\n * A new, empty group for one pair's run, in overlay coordinates. Asked for on the run's first draw,\n * for the pair's key (`to.key`), so \"mark\" is that key's colour. Stack groups by `order`, the pair's\n * place in the list, lower below higher.\n */\n group(key: string, order: number): SurfaceGroup;\n}\n\nexport interface TransitionOptions {\n readonly effect: TransitionEffect;\n readonly surface: TransitionSurface;\n /** Where every pair's run begins, from 0 to 1 (`TransitionContext.start`). Default 0. */\n readonly start?: number;\n /** Default: the page-wide motion. The player subscribes, so turning motion off mid-run jumps to end states. */\n readonly motion?: MotionView & Pick<Motion, \"subscribe\">;\n /** Default: the page-wide clock. */\n readonly clock?: Clock;\n /** Default: no icons. */\n readonly icons?: IconSource;\n}\n\n/** A transition playing on its pairs. */\nexport interface Transition {\n /**\n * Resolves once every pair's run has finished or been cleared. A finished run's end state stays\n * drawn until clear(). Never rejects.\n */\n readonly finished: Promise<void>;\n /** Aborts every run, calls the effect's clear() and empties each group. Later calls do nothing. */\n clear(): void;\n}\n\ninterface Run {\n readonly pair: TransitionPair;\n readonly index: number;\n readonly scope: RunScope;\n readonly context: TransitionContext;\n /** \"ended\": run() resolved or end() drew; the drawing stays until cleared. */\n state: \"running\" | \"ended\" | \"cleared\";\n /** Called once, when the run finishes or is cleared. A run replaced by end() hands it on. */\n done: (() => void) | undefined;\n}\n\nconst NO_ICONS: IconSource = { get: () => undefined };\n/** Both views' marks are hidden while a transition plays, so a run's mark handle does nothing. */\nconst NO_MARK: MarkHandle = { set() {}, reset() {} };\n/** Handed out for draws after a run is cleared, so an effect that ignores its signal draws nothing. */\nconst INERT = { place() {}, update() {}, remove() {} };\n\n/**\n * Plays `effect` from each pair's `from` to its `to`, every run on a context of its own: `signal`,\n * `motion`, `tween()`, a `layer` group, `icons`, `batch` (the pair's place among the pairs) and\n * `start`. Its `mark` does nothing and `onChange` never fires: a resize lands the transition instead.\n *\n * With motion off, `end()` draws on the context instead of `run()`, and motion turning off mid-run\n * replaces each run still going with `end()` on a fresh context. An effect that throws (or whose run\n * rejects) on one pair is reported and that pair is cleared; the others carry on.\n */\nexport function playTransition(pairs: readonly TransitionPair[], options: TransitionOptions): Transition {\n const { effect, surface } = options;\n if (!isTransitionEffect(effect)) throw new TypeError(`playTransition needs a transition effect (kind \"transition\" with run, end and clear), got ${describeEffect(effect)}.`);\n const start = options.start ?? 0;\n if (!(typeof start === \"number\" && start >= 0 && start <= 1)) throw new RangeError(`playTransition: start must be a number from 0 to 1, got ${String(start)}.`);\n const motion = options.motion ?? pageMotion;\n const clock = options.clock ?? defaultClock;\n const icons = options.icons ?? NO_ICONS;\n const count = pairs.length;\n const runs: Run[] = [];\n let cleared = false;\n let waiting = count;\n let resolve!: () => void;\n const finished = new Promise<void>((r) => {\n resolve = r;\n });\n\n // Runs still going when the effective mode turns off are replaced by end(), as the runner does.\n let unsubscribe: (() => void) | undefined = count > 0 ? motion.subscribe(() => {\n if (motion.mode === \"off\") endRunning();\n }) : undefined;\n\n const settled = (): void => {\n if (--waiting > 0) return;\n unsubscribe?.();\n unsubscribe = undefined;\n resolve();\n };\n\n function begin(pair: TransitionPair, index: number, done: (() => void) | undefined): void {\n const scope: RunScope = runScope({\n clock,\n motion,\n icons,\n batch: { index, count },\n layer: pairLayer(pair.to.key, index, () => run.state !== \"cleared\"),\n mark: NO_MARK\n });\n const run: Run = { pair, index, scope, context: { ...scope.context, start }, state: \"running\", done };\n runs[index] = run;\n\n const { from, to } = pair;\n try {\n if (motion.mode === \"off\") {\n effect.end(from, to, run.context);\n finish(run);\n } else {\n Promise.resolve(effect.run(from, to, run.context)).then(\n () => finish(run),\n (error: unknown) => fail(run, error)\n );\n }\n } catch (error) {\n fail(run, error);\n }\n }\n\n function finish(run: Run): void {\n if (run.state !== \"running\") return;\n run.state = \"ended\";\n release(run);\n }\n\n function fail(run: Run, error: unknown): void {\n const { signal } = run.context;\n // A run that rejects because it was aborted isn't broken.\n if (signal.aborted && (error === signal.reason || (error as { name?: unknown } | null)?.name === \"AbortError\")) return;\n report(error);\n clearRun(run);\n }\n\n function release(run: Run): void {\n const done = run.done;\n run.done = undefined;\n done?.();\n }\n\n /** Abort, effect.clear(ctx), then the player's own cleanup: so it happens even if the effect forgets. */\n function clearRun(run: Run): void {\n if (run.state === \"cleared\") return;\n run.state = \"cleared\";\n run.scope.abort();\n try {\n effect.clear(run.context);\n } catch (error) {\n report(error);\n }\n run.scope.clear();\n release(run);\n }\n\n function endRunning(): void {\n for (const run of [...runs]) {\n if (run.state !== \"running\") continue;\n // The replacement takes the run's place: its group's order and the wait on it.\n const done = run.done;\n run.done = undefined;\n clearRun(run);\n begin(run.pair, run.index, done);\n }\n }\n\n /** A run's overlay group, made on its first draw. Draws after the run is cleared do nothing. */\n function pairLayer(key: string, order: number, live: () => boolean): Layer & { clear(): void } {\n let group: SurfaceGroup | undefined;\n const target = (): Layer | undefined => (live() ? (group ??= surface.group(key, order)) : undefined);\n return {\n icon: (icon, iconOptions) => target()?.icon(icon, iconOptions) ?? INERT,\n path: (d, paint) => target()?.path(d, paint) ?? INERT,\n text: (content, style) => target()?.text(content, style) ?? INERT,\n clear() {\n const drawn = group;\n group = undefined;\n drawn?.clear();\n }\n };\n }\n\n pairs.forEach((pair, index) => begin(pair, index, settled));\n if (count === 0) resolve();\n\n return {\n finished,\n clear() {\n if (cleared) return;\n cleared = true;\n for (const run of [...runs]) clearRun(run);\n }\n };\n}\n\n/** True for a transition effect with run, end and clear. */\nexport function isTransitionEffect(value: unknown): value is TransitionEffect {\n if (typeof value !== \"object\" || value === null) return false;\n const effect = value as Partial<Record<\"kind\" | \"run\" | \"end\" | \"clear\", unknown>>;\n return effect.kind === \"transition\" && typeof effect.run === \"function\" && typeof effect.end === \"function\" && typeof effect.clear === \"function\";\n}\n\nfunction describeEffect(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: put it in a chart's \\`on\\` option`;\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"],"mappings":";;AAKA,SAAgB,OAAO,OAAsB;CAC3C,MAAM,WAAY,WAA0D;CAC5E,IAAI,OAAO,aAAa,YAAY,SAAS,KAAK;MAC7C,QAAQ,MAAM,KAAK;AAC1B;;ACkBA,SAAgB,YAAY,SAAsB,cAAc,GAAU;CACxE,MAAM,4BAAY,IAAI,IAA2B;CACjD,IAAI;CAEJ,MAAM,iBAAuB;EAC3B,IAAI,CAAC,eAAe,UAAU,OAAO,GAAG,cAAc,OAAO,QAAQ,IAAI;CAC3E;CAEA,MAAM,QAAQ,QAAsB;EAClC,cAAc,KAAA;EAEd,KAAK,MAAM,YAAY,CAAC,GAAG,SAAS,GAAG;GACrC,IAAI,CAAC,UAAU,IAAI,QAAQ,GAAG;GAC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S,eAAe,OAAwB;CAC9C,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,UAAU,OAAO,SAAS,OAAO;CACzF,MAAM,OAAQ,MAA6B;CAC3C,IAAI,SAAS,cAAc,SAAS,QAAQ,OAAO,KAAK,KAAK;CAC7D,IAAI,SAAS,cAAc,OAAO;CAClC,OAAO,SAAS,KAAA,IAAY,2BAA2B,qBAAqB,KAAK,UAAU,IAAI;AACjG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expressive-charts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Composable motion and expressive effects for interactive web charts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Deaversbp",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"d3-selection": "3.0.0",
|
|
110
110
|
"d3-shape": "3.2.0",
|
|
111
111
|
"jsdom": "^29.1.1",
|
|
112
|
-
"tsdown": "0.23.
|
|
112
|
+
"tsdown": "0.23.4",
|
|
113
113
|
"typescript": "7.0.2",
|
|
114
114
|
"typescript-5.4": "npm:typescript@5.4.5",
|
|
115
115
|
"typescript-6": "npm:typescript@6.0.3",
|