expressive-charts 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -1
- package/README.md +10 -10
- package/dist/define-DeZLs1h7.js +95 -0
- package/dist/define-DeZLs1h7.js.map +1 -0
- package/dist/drawing-Dz_IvJPB.d.cts +208 -0
- package/dist/drawing-Dz_IvJPB.d.ts +208 -0
- package/dist/effect-CdH5449m.d.ts +232 -0
- package/dist/effect-uYC8Vs6_.d.cts +232 -0
- package/dist/expressive-charts.css +8 -1
- package/dist/expressive-charts.css.d.cts +1 -0
- package/dist/expressive-charts.css.d.ts +1 -0
- package/dist/expressive-charts.global.js +50 -47
- package/dist/expressive-charts.global.js.map +1 -1
- package/dist/icons/sport.cjs +211 -152
- package/dist/icons/sport.cjs.map +1 -1
- package/dist/icons/sport.d.cts +5 -7
- package/dist/icons/sport.d.ts +5 -7
- package/dist/icons/sport.js +122 -71
- package/dist/icons/sport.js.map +1 -1
- package/dist/index.cjs +12647 -9513
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +929 -859
- package/dist/index.d.ts +929 -859
- package/dist/index.js +10452 -7822
- package/dist/index.js.map +1 -1
- package/dist/path-data-DnEckjY8.js +123 -0
- package/dist/path-data-DnEckjY8.js.map +1 -0
- package/dist/testing.cjs +2034 -1222
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +137 -141
- package/dist/testing.d.ts +137 -141
- package/dist/testing.js +696 -501
- package/dist/testing.js.map +1 -1
- package/dist/transition-DSRt2DH3.js +2053 -0
- package/dist/transition-DSRt2DH3.js.map +1 -0
- package/package.json +18 -6
- package/dist/chunk-CVXP2L2J.js +0 -1182
- package/dist/chunk-CVXP2L2J.js.map +0 -1
- package/dist/chunk-N5IF2RO2.js +0 -66
- package/dist/chunk-N5IF2RO2.js.map +0 -1
- package/dist/chunk-V5IUTXRW.js +0 -571
- package/dist/chunk-V5IUTXRW.js.map +0 -1
- package/dist/drawing-DWZIXIeR.d.cts +0 -194
- package/dist/drawing-DWZIXIeR.d.ts +0 -194
- package/dist/effect-CZUckY0l.d.ts +0 -245
- package/dist/effect-CcGdU41j.d.cts +0 -245
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/geometry/segment.ts","../src/core/geometry/path-data.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/describe/index.ts","../src/core/geometry/matrix.ts","../src/core/geometry/samples.ts"],"sourcesContent":["// Path segments: straight lines and circular arcs, with exact lengths.\n//\n// Angles are screen angles: radians, 0 along +x, increasing clockwise on screen (y points down).\n// That is the convention of Math.atan2 in chart pixels, and of the walk's `angle(t)`.\n\nimport type { Point, Rect } from \"../contracts/geometry\";\n\nexport const TAU = 2 * Math.PI;\n\nexport interface LineSegment {\n readonly kind: \"line\";\n readonly from: Point;\n readonly to: Point;\n readonly length: number;\n /** Direction from `from` to `to`, or the fallback given to `line()` when they coincide. */\n readonly angle: number;\n}\n\nexport interface ArcSegment {\n readonly kind: \"arc\";\n readonly center: Point;\n readonly radius: number;\n /** Screen angle of the first point. */\n readonly start: number;\n /** Signed: positive is clockwise on screen. */\n readonly sweep: number;\n /** Exact: radius × |sweep|. */\n readonly length: number;\n}\n\nexport type PathSegment = LineSegment | ArcSegment;\n\n/** A straight segment. `fallbackAngle` is its direction if `from` and `to` coincide. */\nexport function line(from: Point, to: Point, fallbackAngle = 0): LineSegment {\n const dx = to.x - from.x;\n const dy = to.y - from.y;\n const length = Math.hypot(dx, dy);\n return { kind: \"line\", from, to, length, angle: length > 0 ? Math.atan2(dy, dx) : normalizeAngle(fallbackAngle) };\n}\n\n/** A circular arc from screen angle `start`, turning `sweep` radians (positive = clockwise on screen). */\nexport function arc(center: Point, radius: number, start: number, sweep: number): ArcSegment {\n return { kind: \"arc\", center, radius, start, sweep, length: radius * Math.abs(sweep) };\n}\n\n/** The point a fraction `u` (0–1) of the way along the segment, by distance. Exact at both ends of a line. */\nexport function pointOn(segment: PathSegment, u: number): Point {\n if (segment.kind === \"line\") {\n const { from, to } = segment;\n return { x: from.x * (1 - u) + to.x * u, y: from.y * (1 - u) + to.y * u };\n }\n return polar(segment.center, segment.radius, segment.start + segment.sweep * u);\n}\n\n/** Direction of travel at fraction `u`, in (-PI, PI]. */\nexport function angleOn(segment: PathSegment, u: number): number {\n if (segment.kind === \"line\") return segment.angle;\n const quarter = segment.sweep < 0 ? -Math.PI / 2 : Math.PI / 2;\n return normalizeAngle(segment.start + segment.sweep * u + quarter);\n}\n\nexport function polar(center: Point, radius: number, angle: number): Point {\n return { x: center.x + radius * Math.cos(angle), y: center.y + radius * Math.sin(angle) };\n}\n\n/** The same angle in (-PI, PI]. */\nexport function normalizeAngle(angle: number): number {\n return angle - TAU * Math.ceil((angle - Math.PI) / TAU);\n}\n\n/** The points that bound a segment: its ends, plus an arc's extremes in x and y. */\nexport function extremes(segment: PathSegment): Point[] {\n if (segment.kind === \"line\") return [segment.from, segment.to];\n const points = [pointOn(segment, 0), pointOn(segment, 1)];\n for (let k = 0; k < 4; k++) {\n const angle = (k * Math.PI) / 2;\n if (sweeps(segment, angle)) points.push(polar(segment.center, segment.radius, angle));\n }\n return points;\n}\n\nexport function boundsOf(points: readonly Point[]): Rect {\n let minX = Infinity;\n let minY = Infinity;\n let maxX = -Infinity;\n let maxY = -Infinity;\n for (const { x, y } of points) {\n if (x < minX) minX = x;\n if (x > maxX) maxX = x;\n if (y < minY) minY = y;\n if (y > maxY) maxY = y;\n }\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n/** True if the arc passes through screen angle `angle`. */\nfunction sweeps(segment: ArcSegment, angle: number): boolean {\n const extent = Math.abs(segment.sweep);\n if (extent >= TAU) return true;\n const turned = segment.sweep >= 0 ? angle - segment.start : segment.start - angle;\n return ((turned % TAU) + TAU) % TAU <= extent;\n}\n","// SVG path data for segments: M, L, A and Z only, with numbers rounded to 0.001 px.\n\nimport type { Point } from \"../contracts/geometry\";\nimport { pointOn, polar, type PathSegment } from \"./segment\";\n\n/** A coordinate for path data: rounded to 0.001, with no \"-0\". */\nexport function formatNumber(value: number): string {\n const rounded = Math.round(value * 1000) / 1000;\n return rounded === 0 ? \"0\" : String(rounded);\n}\n\nexport function moveTo(point: Point): string {\n return `M${formatNumber(point.x)},${formatNumber(point.y)}`;\n}\n\n/**\n * Commands that draw a segment from fraction `u0` to `u1` of its length, assuming the pen is already\n * at the `u0` point. Arcs are split into pieces of at most half a turn, so the large-arc flag is\n * always 0 and a full circle still draws.\n */\nexport function drawTo(segment: PathSegment, u0 = 0, u1 = 1): string {\n if (segment.kind === \"line\") {\n const p = u1 === 1 ? segment.to : pointOn(segment, u1);\n return `L${formatNumber(p.x)},${formatNumber(p.y)}`;\n }\n const from = segment.start + segment.sweep * u0;\n const turn = segment.sweep * (u1 - u0);\n const pieces = Math.max(1, Math.ceil(Math.abs(turn) / Math.PI - 1e-9));\n const r = formatNumber(segment.radius);\n const clockwise = turn >= 0 ? 1 : 0;\n let d = \"\";\n for (let i = 1; i <= pieces; i++) {\n const p = polar(segment.center, segment.radius, from + (turn * i) / pieces);\n d += `A${r},${r} 0 0 ${clockwise} ${formatNumber(p.x)},${formatNumber(p.y)}`;\n }\n return d;\n}\n\n/**\n * Path data for a run of connected segments. Zero-length segments draw nothing. A closed run ends\n * with Z, which also replaces a final straight segment back to the start.\n */\nexport function pathData(segments: readonly PathSegment[], closed = false): string {\n const first = segments[0];\n if (!first) return \"\";\n let count = segments.length;\n if (closed) {\n while (count > 0 && segments[count - 1]!.length <= 0) count--;\n if (count > 0 && segments[count - 1]!.kind === \"line\") count--;\n }\n let d = moveTo(pointOn(first, 0));\n for (let i = 0; i < count; i++) {\n const segment = segments[i]!;\n if (segment.length > 0) d += drawTo(segment);\n }\n return closed ? `${d}Z` : d;\n}\n","// A walk: connected segments parameterised by distance, so t = 0.5 is halfway along on screen.\n\nimport type { Point } from \"../contracts/geometry\";\nimport { drawTo, moveTo, pathData } from \"./path-data\";\nimport { angleOn, pointOn, type PathSegment } from \"./segment\";\n\nexport interface Walk {\n readonly segments: readonly PathSegment[];\n readonly length: number;\n readonly start: Point;\n readonly end: Point;\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 /** Path data from t0 to t1, in either order. Just a move when they're equal. */\n slice(t0: number, t1: number): string;\n /** Path data for the whole walk. */\n readonly d: string;\n}\n\nconst clamp01 = (t: number): number => (t > 0 ? (t < 1 ? t : 1) : 0);\n\n/** The segments must connect: each starts where the one before ends. */\nexport function createWalk(segments: readonly PathSegment[]): 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 return {\n segments,\n length,\n start,\n end,\n point,\n angle(t) {\n const { index, u } = locate(clamp01(t) * length);\n return angleOn(segments[index]!, u);\n },\n slice(t0, t1) {\n const from = clamp01(Math.min(t0, t1));\n const to = clamp01(Math.max(t0, t1));\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 d: pathData(segments)\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 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(createWalk);\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/** An open outline: the stroke along a walk. */\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 segments?: readonly MarkGeometry[];\n}\n\nexport function assemble({ key, series, walk, thickness, outline, bounds, center, pivot, labelBounds, 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 thickness,\n outline,\n bounds,\n center,\n pivot,\n ...(labelBounds === undefined ? {} : { labelBounds }),\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`, 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): 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, `labelBounds[${i}].x`, x);\n finite(builder, `labelBounds[${i}].y`, y);\n size(builder, `labelBounds[${i}].width`, width);\n size(builder, `labelBounds[${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}\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 });\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}\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\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; 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, 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.\n\nimport type { MarkGeometry, Point, Rect } from \"../../contracts/geometry\";\nimport { openOutline } from \"../outline\";\nimport { boundsOf, line, type LineSegment } from \"../segment\";\nimport { createWalk } 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 /** 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}\n\n/** The walk is the line itself, first point to last. Its outline is open: the stroke. */\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\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);\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 });\n}\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}\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 });\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\";\n\nexport const describe = {\n bar: describeBar,\n arc: describeArc,\n line: describeLine,\n point: describePoint\n};\n\nexport type { ArcSpec } from \"./arc\";\nexport type { BarSegmentSpec, BarSpec, Baseline } from \"./bar\";\nexport type { LineSpec } from \"./line\";\nexport type { PointSpec } from \"./point\";\n","// Transform helpers for effect authors: matrix and offset are public (docs/effects-guide.md).\n\nimport type { Matrix } from \"../contracts/drawing\";\nimport type { Point } from \"../contracts/geometry\";\n\nfunction translate(x: number, y: number): Matrix {\n return [1, 0, 0, 1, x, y];\n}\n\n/** Positive radians turn clockwise on screen, like SVG's rotate(). */\nfunction rotate(radians: number, about?: Point): Matrix {\n const cos = Math.cos(radians);\n const sin = Math.sin(radians);\n return around([cos, sin, -sin, cos, 0, 0], about);\n}\n\nfunction scale(sx: number, sy: number = sx, about?: Point): Matrix {\n return around([sx, 0, 0, sy, 0, 0], about);\n}\n\n/** Composes like an SVG transform list: multiply(a, b) applies b first, then a. No arguments gives the identity. */\nfunction multiply(...matrices: Matrix[]): Matrix {\n let result: Matrix = [1, 0, 0, 1, 0, 0];\n for (const m of matrices) result = product(result, m);\n return result;\n}\n\n/** Where the transform takes a point. */\nfunction apply(m: Matrix, point: Point): Point {\n const [a, b, c, d, e, f] = m;\n return { x: a * point.x + c * point.y + e, y: b * point.x + d * point.y + f };\n}\n\nfunction product(l: Matrix, r: Matrix): Matrix {\n const [a1, b1, c1, d1, e1, f1] = l;\n const [a2, b2, c2, d2, e2, f2] = r;\n return [\n a1 * a2 + c1 * b2,\n b1 * a2 + d1 * b2,\n a1 * c2 + c1 * d2,\n b1 * c2 + d1 * d2,\n a1 * e2 + c1 * f2 + e1,\n b1 * e2 + d1 * f2 + f1\n ];\n}\n\n/** A linear transform (no translation) moved so it keeps `about` fixed. */\nfunction around(m: Matrix, about: Point | undefined): Matrix {\n if (!about) return m;\n const [a, b, c, d] = m;\n return [a, b, c, d, about.x - a * about.x - c * about.y, about.y - b * about.x - d * about.y];\n}\n\n/** Builds and applies 2D transforms in SVG order, for `mark.set({ transform })` and `IconHandle.place()`. */\nexport const matrix = { translate, rotate, scale, multiply, apply };\n\n// Internal: iconFromSvg and the adapter read SVG transforms with these.\n\n/** The inverse transform. A singular matrix (it squashes everything onto a line) throws a RangeError. */\nexport function invert(m: Matrix): Matrix {\n const [a, b, c, d, e, f] = m;\n const det = a * d - b * c;\n if (!Number.isFinite(det) || Math.abs(det) < 1e-12) throw new RangeError(\"This transform can't be inverted: it has no area.\");\n return [d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det];\n}\n\n/** An SVG transform list, as in the transform attribute. An unknown or malformed function is skipped. */\nexport function parseTransform(source: string): Matrix {\n const parts: Matrix[] = [];\n for (const [, name, rawArgs = \"\"] of source.matchAll(/(matrix|translate|scale|rotate|skewX|skewY)\\s*\\(([^)]*)\\)/g)) {\n const args = rawArgs.trim().split(/[\\s,]+/).filter(Boolean).map(Number);\n if (!args.every(Number.isFinite)) continue;\n const [a = 0, b, c, d = 0, e = 0, f = 0] = args;\n const radians = (degrees: number): number => (degrees * Math.PI) / 180;\n switch (name) {\n case \"matrix\":\n if (args.length === 6) parts.push([a, b!, c!, d, e, f]);\n break;\n case \"translate\":\n parts.push(translate(a, b ?? 0));\n break;\n case \"scale\":\n parts.push(scale(a, b ?? a));\n break;\n case \"rotate\":\n parts.push(rotate(radians(a), b !== undefined && c !== undefined ? { x: b, y: c } : undefined));\n break;\n case \"skewX\":\n parts.push([1, 0, Math.tan(radians(a)), 1, 0, 0]);\n break;\n case \"skewY\":\n parts.push([1, Math.tan(radians(a)), 0, 1, 0, 0]);\n break;\n }\n }\n return multiply(...parts);\n}\n\n/** A point `distance` px from `point` in direction `angle` (screen radians). */\nexport function offset(point: Point, angle: number, distance: number): Point {\n return { x: point.x + distance * Math.cos(angle), y: point.y + distance * Math.sin(angle) };\n}\n","// samplesAlong: data points placed on a mark's walk, as data effects' samples. A page gives a host's\n// line its values this way: the points that drew it, projected onto the walk that describes it.\n// It reads only the MarkGeometry contract (path and length), so it works on any mark.\n\nimport type { Sample } from \"../contracts/data\";\nimport type { MarkGeometry, Point } from \"../contracts/geometry\";\n\n/** A data point in the mark's coordinates, with its value and, optionally, the x value behind it. */\nexport interface SamplePoint {\n readonly x: number;\n readonly y: number;\n readonly value: number;\n readonly at?: string | number | Date;\n}\n\n/** The grid that finds each point's nearest stretch of the walk: a point every px, up to this many. */\nconst MAX_GRID = 4096;\n/**\n * Golden-section steps that narrow a stretch of 2 grid steps down: to about 1e-12 px for a point on\n * the walk, and to well under 1e-6 px for one off it, where the nearest point is a flat minimum.\n */\nconst REFINE = 48;\nconst GOLDEN = (Math.sqrt(5) - 1) / 2;\n\n/**\n * Projects each point onto the nearest point of the mark's walk and returns the samples in `t` order\n * (points at the same `t` keep their order). A point on the walk, such as a vertex of the polyline it\n * drew, lands exactly where it is. Throws a RangeError on a point whose x, y or value isn't finite.\n */\nexport function samplesAlong(mark: MarkGeometry, points: readonly SamplePoint[]): Sample[] {\n if (typeof mark !== \"object\" || mark === null || typeof mark.path !== \"function\" || !Number.isFinite(mark.length)) {\n throw new TypeError(\"samplesAlong needs a MarkGeometry, as describe builds it.\");\n }\n if (!Array.isArray(points)) throw new TypeError(\"samplesAlong needs an array of points { x, y, value, at? }.\");\n points.forEach((p, i) => {\n for (const field of [\"x\", \"y\", \"value\"] as const) {\n const value: unknown = (p as Partial<SamplePoint> | null)?.[field];\n if (typeof value !== \"number\" || !Number.isFinite(value)) throw new RangeError(`samplesAlong: points[${i}].${field} must be a finite number, got ${String(value)}.`);\n }\n });\n\n const n = mark.length > 0 ? Math.min(MAX_GRID, Math.ceil(mark.length) + 1) : 1;\n const grid = Array.from({ length: n }, (_, i): Point => mark.path(n === 1 ? 0 : i / (n - 1)));\n return points\n .map((p, index) => ({ index, sample: { t: nearest(mark, grid, p), value: p.value, ...(p.at === undefined ? {} : { at: p.at }) } }))\n .sort((a, b) => a.sample.t - b.sample.t || a.index - b.index)\n .map(({ sample }) => sample);\n}\n\n/** The t of the walk's nearest point to `p`: the nearest grid point, then a golden-section search on the stretch either side of it. */\nfunction nearest(mark: MarkGeometry, grid: readonly Point[], p: Point): number {\n const n = grid.length;\n if (n === 1) return 0;\n let best = 0;\n let bestDistance = Infinity;\n grid.forEach((q, i) => {\n const d = squared(q, p);\n if (d < bestDistance) {\n best = i;\n bestDistance = d;\n }\n });\n const f = (t: number): number => squared(mark.path(t), p);\n let lo = Math.max(0, best - 1) / (n - 1);\n let hi = Math.min(n - 1, best + 1) / (n - 1);\n let a = hi - GOLDEN * (hi - lo);\n let b = lo + GOLDEN * (hi - lo);\n let fa = f(a);\n let fb = f(b);\n for (let step = 0; step < REFINE; step++) {\n if (fa <= fb) {\n hi = b;\n b = a;\n fb = fa;\n a = hi - GOLDEN * (hi - lo);\n fa = f(a);\n } else {\n lo = a;\n a = b;\n fa = fb;\n b = lo + GOLDEN * (hi - lo);\n fb = f(b);\n }\n }\n const t = (lo + hi) / 2;\n // The grid point itself unless the search found somewhere nearer, so a point at either end lands\n // on exactly 0 or 1, and a stretch that isn't one dip can't make it worse.\n const found = f(t) < bestDistance ? t : best / (n - 1);\n return found > 0 ? (found < 1 ? found : 1) : 0;\n}\n\nfunction squared(a: Point, b: Point): number {\n return (a.x - b.x) ** 2 + (a.y - b.y) ** 2;\n}\n"],"mappings":";AAOO,IAAM,MAAM,IAAI,KAAK;AA0BrB,SAAS,KAAK,MAAa,IAAW,gBAAgB,GAAgB;AAC3E,QAAM,KAAK,GAAG,IAAI,KAAK;AACvB,QAAM,KAAK,GAAG,IAAI,KAAK;AACvB,QAAM,SAAS,KAAK,MAAM,IAAI,EAAE;AAChC,SAAO,EAAE,MAAM,QAAQ,MAAM,IAAI,QAAQ,OAAO,SAAS,IAAI,KAAK,MAAM,IAAI,EAAE,IAAI,eAAe,aAAa,EAAE;AAClH;AAGO,SAAS,IAAI,QAAe,QAAgB,OAAe,OAA2B;AAC3F,SAAO,EAAE,MAAM,OAAO,QAAQ,QAAQ,OAAO,OAAO,QAAQ,SAAS,KAAK,IAAI,KAAK,EAAE;AACvF;AAGO,SAAS,QAAQ,SAAsB,GAAkB;AAC9D,MAAI,QAAQ,SAAS,QAAQ;AAC3B,UAAM,EAAE,MAAM,GAAG,IAAI;AACrB,WAAO,EAAE,GAAG,KAAK,KAAK,IAAI,KAAK,GAAG,IAAI,GAAG,GAAG,KAAK,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE;AAAA,EAC1E;AACA,SAAO,MAAM,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,QAAQ,CAAC;AAChF;AAGO,SAAS,QAAQ,SAAsB,GAAmB;AAC/D,MAAI,QAAQ,SAAS,OAAQ,QAAO,QAAQ;AAC5C,QAAM,UAAU,QAAQ,QAAQ,IAAI,CAAC,KAAK,KAAK,IAAI,KAAK,KAAK;AAC7D,SAAO,eAAe,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,OAAO;AACnE;AAEO,SAAS,MAAM,QAAe,QAAgB,OAAsB;AACzE,SAAO,EA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AAS,QAAQ,GAAU,GAAkB;AAC3C,UAAQ,EAAE,IAAI,EAAE,MAAM,KAAK,EAAE,IAAI,EAAE,MAAM;AAC3C;","names":["first","t"]}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
interface Point {
|
|
2
|
-
readonly x: number;
|
|
3
|
-
readonly y: number;
|
|
4
|
-
}
|
|
5
|
-
interface Rect {
|
|
6
|
-
readonly x: number;
|
|
7
|
-
readonly y: number;
|
|
8
|
-
readonly width: number;
|
|
9
|
-
readonly height: number;
|
|
10
|
-
}
|
|
11
|
-
interface Outline {
|
|
12
|
-
/** SVG path data in the mark's coordinate space. */
|
|
13
|
-
readonly d: string;
|
|
14
|
-
/** True for areas (bars, slices, markers), false for strokes (lines). */
|
|
15
|
-
readonly closed: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Closed outlines: n points (n a multiple of 4), walking clockwise on screen from the start-left
|
|
18
|
-
* corner, n/4 per side in the order left, end, right, start, evenly spaced along each side. The
|
|
19
|
-
* corners are at indices 0, n/4, n/2 and 3n/4. Open outlines: n points along the stroke, from
|
|
20
|
-
* start to end inclusive. Morph depends on this.
|
|
21
|
-
*/
|
|
22
|
-
sample(n: number): readonly Point[];
|
|
23
|
-
}
|
|
24
|
-
interface MarkGeometry {
|
|
25
|
-
/** Stable identity across updates. Segments are keyed "<mark key>/<series>". */
|
|
26
|
-
readonly key: string;
|
|
27
|
-
/** The series this mark or segment belongs to, if any ("goals", "xg"). */
|
|
28
|
-
readonly series?: string;
|
|
29
|
-
/** Equals path(0). */
|
|
30
|
-
readonly start: Point;
|
|
31
|
-
/** Equals path(1). */
|
|
32
|
-
readonly end: Point;
|
|
33
|
-
/** Length of the walk in px; 0 for marks with no direction (a scatter dot). */
|
|
34
|
-
readonly length: number;
|
|
35
|
-
/** t in [0, 1], proportional to distance along the walk. Values outside are clamped. */
|
|
36
|
-
path(t: number): Point;
|
|
37
|
-
/** Direction of travel in radians, in (-PI, PI]; the mark's "up" side is angle - PI/2. */
|
|
38
|
-
angle(t: number): number;
|
|
39
|
-
/** SVG path data for the part of the walk between t0 and t1, in either order. */
|
|
40
|
-
slice(t0: number, t1: number): string;
|
|
41
|
-
/** Px across the walk: bar height, ring width, stroke width, marker diameter. */
|
|
42
|
-
readonly thickness: number;
|
|
43
|
-
readonly outline: Outline;
|
|
44
|
-
readonly bounds: Rect;
|
|
45
|
-
/** Visual centre: tooltips, focus rings, labels. */
|
|
46
|
-
readonly center: Point;
|
|
47
|
-
/** Where the mark is attached to the chart: a bar's baseline, a donut's centre. */
|
|
48
|
-
readonly pivot: Point;
|
|
49
|
-
/**
|
|
50
|
-
* The boxes of the text the chart draws for this mark, so an effect's text can keep clear of
|
|
51
|
-
* them: a bar's category and value labels, a slice's label outside the ring, a line's end label.
|
|
52
|
-
* Unset when nothing says where they are (segments, points, and marks the library didn't draw).
|
|
53
|
-
*/
|
|
54
|
-
readonly labelBounds?: readonly Rect[];
|
|
55
|
-
/** Ordered parts, from the baseline (goals, then assists). Every bar has at least one. */
|
|
56
|
-
readonly segments?: readonly MarkGeometry[];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** One path of an icon, drawn in order (the first is at the bottom). */
|
|
60
|
-
interface IconShape {
|
|
61
|
-
/** Path data in icon units. */
|
|
62
|
-
readonly d: string;
|
|
63
|
-
/** Unset draws no fill (unlike SVG, where it's black). */
|
|
64
|
-
readonly fill?: Color;
|
|
65
|
-
/** Unset draws no stroke. */
|
|
66
|
-
readonly stroke?: Color;
|
|
67
|
-
/** Stroke width in icon units, so it scales with the icon. Default 1. */
|
|
68
|
-
readonly width?: number;
|
|
69
|
-
/** Default "butt". */
|
|
70
|
-
readonly linecap?: "butt" | "round";
|
|
71
|
-
/** Default "miter". */
|
|
72
|
-
readonly linejoin?: "miter" | "round";
|
|
73
|
-
/** Path data, in icon units, that clips this shape (the ball's panel pattern). */
|
|
74
|
-
readonly clip?: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Build one with defineIcon() or iconFromSvg(), which fill the defaults and check it. Icon units
|
|
78
|
-
* are px at the icon's natural size: `layer.icon(icon, { size })` scales it by size / icon.size
|
|
79
|
-
* about its anchor before `place()`.
|
|
80
|
-
*/
|
|
81
|
-
interface Icon {
|
|
82
|
-
readonly name: string;
|
|
83
|
-
/** Drawn facing +x, with its up side towards −y, in icon units. */
|
|
84
|
-
readonly shapes: readonly IconShape[];
|
|
85
|
-
/** Icon-space bounds. */
|
|
86
|
-
readonly box: Rect;
|
|
87
|
-
/** The natural length along the walk, in px (and icon units). */
|
|
88
|
-
readonly size: number;
|
|
89
|
-
/** The icon-space point that sits on the walk. */
|
|
90
|
-
readonly anchor: Point;
|
|
91
|
-
/** What it spins or tilts around. */
|
|
92
|
-
readonly pivot: Point;
|
|
93
|
-
/** Extent along +x from the anchor, which travel keeps inside the mark. */
|
|
94
|
-
readonly footprint: readonly [behind: number, ahead: number];
|
|
95
|
-
/** The gait travel uses unless it's given one. */
|
|
96
|
-
readonly gait?: "roll" | "step" | "slide";
|
|
97
|
-
/** Rolling radius; default box height / 2. */
|
|
98
|
-
readonly radius?: number;
|
|
99
|
-
/** Mirror instead of turning upside down (a boot keeps its sole down). */
|
|
100
|
-
readonly upright?: boolean;
|
|
101
|
-
}
|
|
102
|
-
/** Resolves icon names; the composition root fills it from the icon registry. */
|
|
103
|
-
interface IconSource {
|
|
104
|
-
get(name: string): Icon | undefined;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* A theme token or any CSS colour. Tokens: "text", "text-muted", "surface", "grid", "axis", "focus",
|
|
109
|
-
* "negative", "series-N" and "series-N-strong" (palette slots 1–8), and "mark" / "mark-strong", the
|
|
110
|
-
* colours of the mark a run belongs to (its first segment's, for a stack).
|
|
111
|
-
*/
|
|
112
|
-
type Color = string;
|
|
113
|
-
/**
|
|
114
|
-
* A 2D affine transform in SVG order: x' = a·x + c·y + e, y' = b·x + d·y + f.
|
|
115
|
-
* Build one with the `matrix` helpers.
|
|
116
|
-
*/
|
|
117
|
-
type Matrix = readonly [a: number, b: number, c: number, d: number, e: number, f: number];
|
|
118
|
-
interface Paint {
|
|
119
|
-
readonly fill?: Color;
|
|
120
|
-
readonly stroke?: Color;
|
|
121
|
-
readonly width?: number;
|
|
122
|
-
readonly opacity?: number;
|
|
123
|
-
readonly linecap?: "butt" | "round";
|
|
124
|
-
}
|
|
125
|
-
interface MarkStyle {
|
|
126
|
-
/** In chart space. Moves the mark's body; its labels and pointer target stay put. */
|
|
127
|
-
readonly transform?: Matrix;
|
|
128
|
-
readonly opacity?: number;
|
|
129
|
-
/** 0–1 toward the series' strong colour. */
|
|
130
|
-
readonly emphasis?: number;
|
|
131
|
-
/**
|
|
132
|
-
* A stroke along the outline, behind the mark. `width` is the stroke width, so half of it shows
|
|
133
|
-
* outside the mark (the prototype's flash peaks at 8). Default colour: the mark's own.
|
|
134
|
-
*/
|
|
135
|
-
readonly halo?: {
|
|
136
|
-
readonly width: number;
|
|
137
|
-
readonly opacity: number;
|
|
138
|
-
readonly color?: Color;
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
/** Restyles the mark itself. The runner resets it when the run is cleared. */
|
|
142
|
-
interface MarkHandle {
|
|
143
|
-
/** Changes only the fields given, so parallel effects don't undo each other. A field given as undefined goes back to its default. */
|
|
144
|
-
set(style: MarkStyle): void;
|
|
145
|
-
/** Back to the mark's own style. */
|
|
146
|
-
reset(): void;
|
|
147
|
-
}
|
|
148
|
-
interface IconHandle {
|
|
149
|
-
/** Moves the icon: a transform from icon space into chart space. The icon is hidden until first placed. */
|
|
150
|
-
place(transform: Matrix): void;
|
|
151
|
-
remove(): void;
|
|
152
|
-
}
|
|
153
|
-
interface PathHandle {
|
|
154
|
-
/** Replaces the path data; paint fields given are merged into the current paint. */
|
|
155
|
-
update(d: string, paint?: Partial<Paint>): void;
|
|
156
|
-
remove(): void;
|
|
157
|
-
}
|
|
158
|
-
/** Effects that label a change ("+2") need text, drawn in theme text colours by default. */
|
|
159
|
-
interface TextStyle {
|
|
160
|
-
/** The anchor point, on the text's baseline. */
|
|
161
|
-
readonly at: Point;
|
|
162
|
-
readonly anchor?: "start" | "middle" | "end";
|
|
163
|
-
/** Default "text". Series colours are allowed only for swatches, never for words. */
|
|
164
|
-
readonly color?: Color;
|
|
165
|
-
readonly opacity?: number;
|
|
166
|
-
}
|
|
167
|
-
interface TextHandle {
|
|
168
|
-
/** Style fields given are merged into the current style; content is replaced if given. */
|
|
169
|
-
update(style: Partial<TextStyle>, content?: string): void;
|
|
170
|
-
remove(): void;
|
|
171
|
-
}
|
|
172
|
-
/** One run's own overlay group, above the marks, in chart coordinates. The runner empties it when the run is cleared. */
|
|
173
|
-
interface Layer {
|
|
174
|
-
/**
|
|
175
|
-
* Draws an icon, hidden until its first `place()`.
|
|
176
|
-
*
|
|
177
|
-
* Size rule: with `size`, the icon is scaled by `size / icon.size` about its anchor, in icon space,
|
|
178
|
-
* before the `place()` transform. So effects build the transform as if the icon were its natural
|
|
179
|
-
* size, and the anchor still lands where the transform puts it. Icon-space lengths (footprint,
|
|
180
|
-
* radius, the pivot's offset from the anchor) scale by the same factor. A negative size throws.
|
|
181
|
-
*
|
|
182
|
-
* Each shape is one path, in order (the first at the bottom). An unset `fill` or `stroke` draws
|
|
183
|
-
* none; `width` is in icon units (default 1), so it scales with the icon. `clip` is path data in
|
|
184
|
-
* icon space.
|
|
185
|
-
*/
|
|
186
|
-
icon(icon: Icon, options?: {
|
|
187
|
-
readonly size?: number;
|
|
188
|
-
}): IconHandle;
|
|
189
|
-
/** Draws an overlay path, unfilled unless `paint.fill` is given. */
|
|
190
|
-
path(d: string, paint: Paint): PathHandle;
|
|
191
|
-
text(content: string, style: TextStyle): TextHandle;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export type { Color as C, Icon as I, Layer as L, MarkGeometry as M, Outline as O, Point as P, Rect as R, TextHandle as T, Matrix as a, IconHandle as b, IconShape as c, IconSource as d, MarkHandle as e, MarkStyle as f, Paint as g, PathHandle as h, TextStyle as i };
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
interface Point {
|
|
2
|
-
readonly x: number;
|
|
3
|
-
readonly y: number;
|
|
4
|
-
}
|
|
5
|
-
interface Rect {
|
|
6
|
-
readonly x: number;
|
|
7
|
-
readonly y: number;
|
|
8
|
-
readonly width: number;
|
|
9
|
-
readonly height: number;
|
|
10
|
-
}
|
|
11
|
-
interface Outline {
|
|
12
|
-
/** SVG path data in the mark's coordinate space. */
|
|
13
|
-
readonly d: string;
|
|
14
|
-
/** True for areas (bars, slices, markers), false for strokes (lines). */
|
|
15
|
-
readonly closed: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Closed outlines: n points (n a multiple of 4), walking clockwise on screen from the start-left
|
|
18
|
-
* corner, n/4 per side in the order left, end, right, start, evenly spaced along each side. The
|
|
19
|
-
* corners are at indices 0, n/4, n/2 and 3n/4. Open outlines: n points along the stroke, from
|
|
20
|
-
* start to end inclusive. Morph depends on this.
|
|
21
|
-
*/
|
|
22
|
-
sample(n: number): readonly Point[];
|
|
23
|
-
}
|
|
24
|
-
interface MarkGeometry {
|
|
25
|
-
/** Stable identity across updates. Segments are keyed "<mark key>/<series>". */
|
|
26
|
-
readonly key: string;
|
|
27
|
-
/** The series this mark or segment belongs to, if any ("goals", "xg"). */
|
|
28
|
-
readonly series?: string;
|
|
29
|
-
/** Equals path(0). */
|
|
30
|
-
readonly start: Point;
|
|
31
|
-
/** Equals path(1). */
|
|
32
|
-
readonly end: Point;
|
|
33
|
-
/** Length of the walk in px; 0 for marks with no direction (a scatter dot). */
|
|
34
|
-
readonly length: number;
|
|
35
|
-
/** t in [0, 1], proportional to distance along the walk. Values outside are clamped. */
|
|
36
|
-
path(t: number): Point;
|
|
37
|
-
/** Direction of travel in radians, in (-PI, PI]; the mark's "up" side is angle - PI/2. */
|
|
38
|
-
angle(t: number): number;
|
|
39
|
-
/** SVG path data for the part of the walk between t0 and t1, in either order. */
|
|
40
|
-
slice(t0: number, t1: number): string;
|
|
41
|
-
/** Px across the walk: bar height, ring width, stroke width, marker diameter. */
|
|
42
|
-
readonly thickness: number;
|
|
43
|
-
readonly outline: Outline;
|
|
44
|
-
readonly bounds: Rect;
|
|
45
|
-
/** Visual centre: tooltips, focus rings, labels. */
|
|
46
|
-
readonly center: Point;
|
|
47
|
-
/** Where the mark is attached to the chart: a bar's baseline, a donut's centre. */
|
|
48
|
-
readonly pivot: Point;
|
|
49
|
-
/**
|
|
50
|
-
* The boxes of the text the chart draws for this mark, so an effect's text can keep clear of
|
|
51
|
-
* them: a bar's category and value labels, a slice's label outside the ring, a line's end label.
|
|
52
|
-
* Unset when nothing says where they are (segments, points, and marks the library didn't draw).
|
|
53
|
-
*/
|
|
54
|
-
readonly labelBounds?: readonly Rect[];
|
|
55
|
-
/** Ordered parts, from the baseline (goals, then assists). Every bar has at least one. */
|
|
56
|
-
readonly segments?: readonly MarkGeometry[];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** One path of an icon, drawn in order (the first is at the bottom). */
|
|
60
|
-
interface IconShape {
|
|
61
|
-
/** Path data in icon units. */
|
|
62
|
-
readonly d: string;
|
|
63
|
-
/** Unset draws no fill (unlike SVG, where it's black). */
|
|
64
|
-
readonly fill?: Color;
|
|
65
|
-
/** Unset draws no stroke. */
|
|
66
|
-
readonly stroke?: Color;
|
|
67
|
-
/** Stroke width in icon units, so it scales with the icon. Default 1. */
|
|
68
|
-
readonly width?: number;
|
|
69
|
-
/** Default "butt". */
|
|
70
|
-
readonly linecap?: "butt" | "round";
|
|
71
|
-
/** Default "miter". */
|
|
72
|
-
readonly linejoin?: "miter" | "round";
|
|
73
|
-
/** Path data, in icon units, that clips this shape (the ball's panel pattern). */
|
|
74
|
-
readonly clip?: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Build one with defineIcon() or iconFromSvg(), which fill the defaults and check it. Icon units
|
|
78
|
-
* are px at the icon's natural size: `layer.icon(icon, { size })` scales it by size / icon.size
|
|
79
|
-
* about its anchor before `place()`.
|
|
80
|
-
*/
|
|
81
|
-
interface Icon {
|
|
82
|
-
readonly name: string;
|
|
83
|
-
/** Drawn facing +x, with its up side towards −y, in icon units. */
|
|
84
|
-
readonly shapes: readonly IconShape[];
|
|
85
|
-
/** Icon-space bounds. */
|
|
86
|
-
readonly box: Rect;
|
|
87
|
-
/** The natural length along the walk, in px (and icon units). */
|
|
88
|
-
readonly size: number;
|
|
89
|
-
/** The icon-space point that sits on the walk. */
|
|
90
|
-
readonly anchor: Point;
|
|
91
|
-
/** What it spins or tilts around. */
|
|
92
|
-
readonly pivot: Point;
|
|
93
|
-
/** Extent along +x from the anchor, which travel keeps inside the mark. */
|
|
94
|
-
readonly footprint: readonly [behind: number, ahead: number];
|
|
95
|
-
/** The gait travel uses unless it's given one. */
|
|
96
|
-
readonly gait?: "roll" | "step" | "slide";
|
|
97
|
-
/** Rolling radius; default box height / 2. */
|
|
98
|
-
readonly radius?: number;
|
|
99
|
-
/** Mirror instead of turning upside down (a boot keeps its sole down). */
|
|
100
|
-
readonly upright?: boolean;
|
|
101
|
-
}
|
|
102
|
-
/** Resolves icon names; the composition root fills it from the icon registry. */
|
|
103
|
-
interface IconSource {
|
|
104
|
-
get(name: string): Icon | undefined;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* A theme token or any CSS colour. Tokens: "text", "text-muted", "surface", "grid", "axis", "focus",
|
|
109
|
-
* "negative", "series-N" and "series-N-strong" (palette slots 1–8), and "mark" / "mark-strong", the
|
|
110
|
-
* colours of the mark a run belongs to (its first segment's, for a stack).
|
|
111
|
-
*/
|
|
112
|
-
type Color = string;
|
|
113
|
-
/**
|
|
114
|
-
* A 2D affine transform in SVG order: x' = a·x + c·y + e, y' = b·x + d·y + f.
|
|
115
|
-
* Build one with the `matrix` helpers.
|
|
116
|
-
*/
|
|
117
|
-
type Matrix = readonly [a: number, b: number, c: number, d: number, e: number, f: number];
|
|
118
|
-
interface Paint {
|
|
119
|
-
readonly fill?: Color;
|
|
120
|
-
readonly stroke?: Color;
|
|
121
|
-
readonly width?: number;
|
|
122
|
-
readonly opacity?: number;
|
|
123
|
-
readonly linecap?: "butt" | "round";
|
|
124
|
-
}
|
|
125
|
-
interface MarkStyle {
|
|
126
|
-
/** In chart space. Moves the mark's body; its labels and pointer target stay put. */
|
|
127
|
-
readonly transform?: Matrix;
|
|
128
|
-
readonly opacity?: number;
|
|
129
|
-
/** 0–1 toward the series' strong colour. */
|
|
130
|
-
readonly emphasis?: number;
|
|
131
|
-
/**
|
|
132
|
-
* A stroke along the outline, behind the mark. `width` is the stroke width, so half of it shows
|
|
133
|
-
* outside the mark (the prototype's flash peaks at 8). Default colour: the mark's own.
|
|
134
|
-
*/
|
|
135
|
-
readonly halo?: {
|
|
136
|
-
readonly width: number;
|
|
137
|
-
readonly opacity: number;
|
|
138
|
-
readonly color?: Color;
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
/** Restyles the mark itself. The runner resets it when the run is cleared. */
|
|
142
|
-
interface MarkHandle {
|
|
143
|
-
/** Changes only the fields given, so parallel effects don't undo each other. A field given as undefined goes back to its default. */
|
|
144
|
-
set(style: MarkStyle): void;
|
|
145
|
-
/** Back to the mark's own style. */
|
|
146
|
-
reset(): void;
|
|
147
|
-
}
|
|
148
|
-
interface IconHandle {
|
|
149
|
-
/** Moves the icon: a transform from icon space into chart space. The icon is hidden until first placed. */
|
|
150
|
-
place(transform: Matrix): void;
|
|
151
|
-
remove(): void;
|
|
152
|
-
}
|
|
153
|
-
interface PathHandle {
|
|
154
|
-
/** Replaces the path data; paint fields given are merged into the current paint. */
|
|
155
|
-
update(d: string, paint?: Partial<Paint>): void;
|
|
156
|
-
remove(): void;
|
|
157
|
-
}
|
|
158
|
-
/** Effects that label a change ("+2") need text, drawn in theme text colours by default. */
|
|
159
|
-
interface TextStyle {
|
|
160
|
-
/** The anchor point, on the text's baseline. */
|
|
161
|
-
readonly at: Point;
|
|
162
|
-
readonly anchor?: "start" | "middle" | "end";
|
|
163
|
-
/** Default "text". Series colours are allowed only for swatches, never for words. */
|
|
164
|
-
readonly color?: Color;
|
|
165
|
-
readonly opacity?: number;
|
|
166
|
-
}
|
|
167
|
-
interface TextHandle {
|
|
168
|
-
/** Style fields given are merged into the current style; content is replaced if given. */
|
|
169
|
-
update(style: Partial<TextStyle>, content?: string): void;
|
|
170
|
-
remove(): void;
|
|
171
|
-
}
|
|
172
|
-
/** One run's own overlay group, above the marks, in chart coordinates. The runner empties it when the run is cleared. */
|
|
173
|
-
interface Layer {
|
|
174
|
-
/**
|
|
175
|
-
* Draws an icon, hidden until its first `place()`.
|
|
176
|
-
*
|
|
177
|
-
* Size rule: with `size`, the icon is scaled by `size / icon.size` about its anchor, in icon space,
|
|
178
|
-
* before the `place()` transform. So effects build the transform as if the icon were its natural
|
|
179
|
-
* size, and the anchor still lands where the transform puts it. Icon-space lengths (footprint,
|
|
180
|
-
* radius, the pivot's offset from the anchor) scale by the same factor. A negative size throws.
|
|
181
|
-
*
|
|
182
|
-
* Each shape is one path, in order (the first at the bottom). An unset `fill` or `stroke` draws
|
|
183
|
-
* none; `width` is in icon units (default 1), so it scales with the icon. `clip` is path data in
|
|
184
|
-
* icon space.
|
|
185
|
-
*/
|
|
186
|
-
icon(icon: Icon, options?: {
|
|
187
|
-
readonly size?: number;
|
|
188
|
-
}): IconHandle;
|
|
189
|
-
/** Draws an overlay path, unfilled unless `paint.fill` is given. */
|
|
190
|
-
path(d: string, paint: Paint): PathHandle;
|
|
191
|
-
text(content: string, style: TextStyle): TextHandle;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export type { Color as C, Icon as I, Layer as L, MarkGeometry as M, Outline as O, Point as P, Rect as R, TextHandle as T, Matrix as a, IconHandle as b, IconShape as c, IconSource as d, MarkHandle as e, MarkStyle as f, Paint as g, PathHandle as h, TextStyle as i };
|