@thomasfosterau/charts 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +591 -2
- package/dist/core-BVbfW7N6.mjs +936 -0
- package/dist/core-BVbfW7N6.mjs.map +1 -0
- package/dist/core.d.mts +2 -0
- package/dist/core.mjs +1 -0
- package/dist/index-B32E5tbG.d.mts +405 -0
- package/dist/index-M0KOYMo4.d.mts +200 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -0
- package/dist/prosemirror.d.mts +106 -0
- package/dist/prosemirror.mjs +245 -0
- package/dist/prosemirror.mjs.map +1 -0
- package/dist/spec-FF2Tds2a.mjs +351 -0
- package/dist/spec-FF2Tds2a.mjs.map +1 -0
- package/dist/svelte/Chart.svelte +73 -0
- package/dist/svelte/Chart.svelte.d.ts +37 -0
- package/dist/svelte/ChartAxes.svelte +39 -0
- package/dist/svelte/ChartAxes.svelte.d.ts +11 -0
- package/dist/svelte/ChartMarks.svelte +74 -0
- package/dist/svelte/ChartMarks.svelte.d.ts +9 -0
- package/dist/svelte/index.d.ts +9 -0
- package/dist/svelte/index.js +9 -0
- package/dist/vega.d.mts +97 -0
- package/dist/vega.mjs +82 -0
- package/dist/vega.mjs.map +1 -0
- package/package.json +90 -3
- package/schema/chart-spec.v1.json +393 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-BVbfW7N6.mjs","names":["asCategory","d3Line","d3Area"],"sources":["../src/core/accessor.ts","../src/core/geometry/position.ts","../src/core/geometry/series.ts","../src/core/geometry/line.ts","../src/core/geometry/area.ts","../src/core/geometry/bar.ts","../src/core/scale.ts","../src/core/geometry/point.ts","../src/core/geometry/tree.ts","../src/core/layout.ts","../src/core/ticks.ts","../src/core/context.ts","../src/core/resolve.ts"],"sourcesContent":["import type { Channel, Datum, DatumValue } from '../spec/index.ts';\n\n/**\n * A typed field value reconstructed from a datum according to the channel's\n * declared encoding type. `null` means \"missing\": the datum is skipped by\n * geometry builders.\n */\nexport type FieldValue = number | Date | string | null;\n\n/**\n * Creates a typed accessor for an encoding channel.\n *\n * Values are reconstructed from the channel's **declared** type — never by\n * sniffing the runtime shape of the JSON value (the cross-platform invariant\n * every interpreter must follow):\n *\n * - `quantitative` → finite number\n * - `temporal` → Date, parsed from ISO 8601 strings or epoch milliseconds\n * - `ordinal` / `nominal` → category string (numbers/booleans are stringified)\n *\n * Missing fields and nulls yield `null`. Values that contradict the declared\n * type throw: a declared type is a contract, and violating it is a data error\n * the caller must surface, not hide.\n */\nexport function makeAccessor(channel: Channel): (datum: Datum) => FieldValue {\n switch (channel.type) {\n case 'quantitative':\n return (datum) => toQuantitative(datum[channel.field], channel.field);\n case 'temporal':\n return (datum) => toTemporal(datum[channel.field], channel.field);\n case 'ordinal':\n case 'nominal':\n return (datum) => toCategory(datum[channel.field]);\n }\n}\n\nfunction toQuantitative(value: DatumValue | undefined, field: string): number | null {\n if (value === null || value === undefined) return null;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n throw new TypeError(\n `Field \"${field}\" is declared quantitative but datum value ${JSON.stringify(value)} is not a finite number`,\n );\n}\n\nfunction toTemporal(value: DatumValue | undefined, field: string): Date | null {\n if (value === null || value === undefined) return null;\n if (typeof value === 'number' || typeof value === 'string') {\n const date = new Date(value);\n if (!Number.isNaN(date.getTime())) return date;\n }\n throw new TypeError(\n `Field \"${field}\" is declared temporal but datum value ${JSON.stringify(value)} is not a parseable date (expected ISO 8601 string or epoch milliseconds)`,\n );\n}\n\nfunction toCategory(value: DatumValue | undefined): string | null {\n if (value === null || value === undefined) return null;\n return typeof value === 'string' ? value : String(value);\n}\n","import type { FieldValue } from '../accessor.ts';\nimport type { PositionalScale } from '../scale.ts';\n\n/**\n * Maps a typed field value to a plot pixel position.\n *\n * Band scales position at the band centre; other scales map directly.\n * Returns undefined for missing values or values outside a categorical domain.\n */\nexport function positionOf(scale: PositionalScale, value: FieldValue): number | undefined {\n if (value === null) return undefined;\n switch (scale.kind) {\n case 'linear':\n return typeof value === 'number' ? scale.d3(value) : undefined;\n case 'utc':\n return value instanceof Date ? scale.d3(value) : undefined;\n case 'band': {\n const start = scale.d3(asCategory(value));\n return start === undefined ? undefined : start + scale.d3.bandwidth() / 2;\n }\n case 'point':\n return scale.d3(asCategory(value));\n }\n}\n\n/**\n * The pixel position of the zero baseline for a y scale, clamped to the plot.\n * Non-linear y scales (temporal/categorical) baseline at the bottom of the range.\n */\nexport function baselineOf(scale: PositionalScale): number {\n const range = scale.resolved.range as ReadonlyArray<number>;\n const lo = Math.min(...range);\n const hi = Math.max(...range);\n if (scale.kind === 'linear') {\n return Math.min(Math.max(scale.d3(0), lo), hi);\n }\n return hi;\n}\n\nfunction asCategory(value: NonNullable<FieldValue>): string {\n return typeof value === 'string' ? value : String(value);\n}\n","import type { Channel, Datum } from '../../spec/index.ts';\nimport { makeAccessor } from '../accessor.ts';\nimport type { DataRows, ResolvedScale } from '../types.ts';\n\n/** A group of data rows sharing a colour-channel category. */\nexport interface SeriesGroup {\n readonly key: string | null;\n readonly color: string | undefined;\n readonly rows: DataRows;\n}\n\n/**\n * Splits data rows into series by the colour channel, preserving data order.\n * Without a colour channel, returns a single unsplit series.\n */\nexport function splitSeries(\n data: DataRows,\n colorChannel: Channel | undefined,\n colorScale: ResolvedScale | undefined,\n): SeriesGroup[] {\n if (!colorChannel || !colorScale) {\n return [{ key: null, color: undefined, rows: data }];\n }\n\n const accessor = makeAccessor(colorChannel);\n const groups = new Map<string, Datum[]>();\n for (const datum of data) {\n const value = accessor(datum);\n if (value === null) continue;\n const key = typeof value === 'string' ? value : String(value);\n const group = groups.get(key);\n if (group) {\n group.push(datum);\n } else {\n groups.set(key, [datum]);\n }\n }\n\n return [...groups.entries()].map(([key, rows]) => ({\n key,\n color: colorOf(colorScale, key),\n rows,\n }));\n}\n\n/** Resolves a colour for a single datum, or undefined without a colour encoding. */\nexport function colorOfDatum(\n datum: Datum,\n colorChannel: Channel | undefined,\n colorScale: ResolvedScale | undefined,\n): string | undefined {\n if (!colorChannel || !colorScale) return undefined;\n const value = makeAccessor(colorChannel)(datum);\n if (value === null) return undefined;\n return colorOf(colorScale, value);\n}\n\nfunction colorOf(scale: ResolvedScale, value: number | string | Date): string | undefined {\n const result = scale.apply(value);\n return typeof result === 'string' ? result : undefined;\n}\n","import type { Channel } from '../../spec/index.ts';\nimport { line as d3Line } from 'd3-shape';\nimport { makeAccessor } from '../accessor.ts';\nimport type { PositionalScale } from '../scale.ts';\nimport type { DataRows, ResolvedScale } from '../types.ts';\nimport { positionOf } from './position.ts';\nimport { splitSeries } from './series.ts';\nimport type { LineGeometry, Series, SeriesPoint } from './types.ts';\n\n/** Builds line chart geometry: one series per colour category, each with points and an SVG path. */\nexport function buildLineGeometry(args: {\n readonly data: DataRows;\n readonly x: Channel;\n readonly y: Channel;\n readonly xScale: PositionalScale;\n readonly yScale: PositionalScale;\n readonly color?: Channel | undefined;\n readonly colorScale?: ResolvedScale | undefined;\n}): LineGeometry {\n return {\n mark: 'line',\n series: buildSeries(args),\n };\n}\n\n/** Shared series-of-points construction for line and area marks. */\nexport function buildSeries(args: {\n readonly data: DataRows;\n readonly x: Channel;\n readonly y: Channel;\n readonly xScale: PositionalScale;\n readonly yScale: PositionalScale;\n readonly color?: Channel | undefined;\n readonly colorScale?: ResolvedScale | undefined;\n readonly pathOf?: ((points: ReadonlyArray<SeriesPoint>) => string) | undefined;\n}): Series[] {\n const xAccessor = makeAccessor(args.x);\n const yAccessor = makeAccessor(args.y);\n const pathOf = args.pathOf ?? linePathOf;\n\n return splitSeries(args.data, args.color, args.colorScale).map((group) => {\n const points: SeriesPoint[] = [];\n for (const datum of group.rows) {\n const px = positionOf(args.xScale, xAccessor(datum));\n const py = positionOf(args.yScale, yAccessor(datum));\n // Skip rows with missing or unmappable values on either positional channel.\n if (px === undefined || py === undefined) continue;\n points.push({ x: px, y: py, datum });\n }\n return {\n key: group.key,\n color: group.color,\n points,\n path: points.length > 0 ? pathOf(points) : '',\n };\n });\n}\n\nfunction linePathOf(points: ReadonlyArray<SeriesPoint>): string {\n const generator = d3Line<SeriesPoint>()\n .x((point) => point.x)\n .y((point) => point.y);\n return generator([...points]) ?? '';\n}\n","import type { Channel } from '../../spec/index.ts';\nimport { area as d3Area } from 'd3-shape';\nimport type { PositionalScale } from '../scale.ts';\nimport type { DataRows, ResolvedScale } from '../types.ts';\nimport { buildSeries } from './line.ts';\nimport { baselineOf } from './position.ts';\nimport type { AreaGeometry, SeriesPoint } from './types.ts';\n\n/**\n * Builds area chart geometry: like a line, but each series path is closed\n * down to the zero baseline (or the bottom of the plot when zero is not in\n * the y domain).\n */\nexport function buildAreaGeometry(args: {\n readonly data: DataRows;\n readonly x: Channel;\n readonly y: Channel;\n readonly xScale: PositionalScale;\n readonly yScale: PositionalScale;\n readonly color?: Channel | undefined;\n readonly colorScale?: ResolvedScale | undefined;\n}): AreaGeometry {\n const baseline = baselineOf(args.yScale);\n\n return {\n mark: 'area',\n series: buildSeries({\n ...args,\n pathOf: (points) => areaPathOf(points, baseline),\n }),\n };\n}\n\nfunction areaPathOf(points: ReadonlyArray<SeriesPoint>, baseline: number): string {\n const generator = d3Area<SeriesPoint>()\n .x((point) => point.x)\n .y1((point) => point.y)\n .y0(baseline);\n return generator([...points]) ?? '';\n}\n","import type { Channel } from '../../spec/index.ts';\nimport { makeAccessor } from '../accessor.ts';\nimport type { PositionalScale } from '../scale.ts';\nimport type { DataRows, ResolvedScale } from '../types.ts';\nimport { baselineOf, positionOf } from './position.ts';\nimport { colorOfDatum } from './series.ts';\nimport type { BarGeometry, BarRect } from './types.ts';\n\n/** What {@link buildBarGeometry} takes. */\ninterface BarArgs {\n readonly data: DataRows;\n readonly x: Channel;\n readonly y: Channel;\n readonly xScale: PositionalScale;\n readonly yScale: PositionalScale;\n readonly color?: Channel | undefined;\n readonly colorScale?: ResolvedScale | undefined;\n /** Spec 1.1: the end of a range on x; each bar spans `x` to `x2`. */\n readonly x2?: Channel | undefined;\n /** Spec 1.1: the end of a range on y; each bar spans `y` to `y2`. */\n readonly y2?: Channel | undefined;\n}\n\n/**\n * Builds bar chart geometry. Bars grow from the zero baseline, so negative\n * values produce bars below it. Band x-scales give bars their bandwidth;\n * continuous x-scales get a derived width. With a range channel (`x2` or\n * `y2`, spec 1.1) each bar spans from its start to its end instead: a\n * horizontal range bar (a Gantt row) for `x2`, a vertical one for `y2`.\n */\nexport function buildBarGeometry(args: BarArgs): BarGeometry {\n if (args.x2 !== undefined) return buildRangeBars(args, 'x', args.x2);\n if (args.y2 !== undefined) return buildRangeBars(args, 'y', args.y2);\n const xAccessor = makeAccessor(args.x);\n const yAccessor = makeAccessor(args.y);\n const baseline = baselineOf(args.yScale);\n const barWidth = barWidthOf(args.xScale, args.data.length);\n\n const bars: BarRect[] = [];\n for (const datum of args.data) {\n const xCenter = positionOf(args.xScale, xAccessor(datum));\n const yPosition = positionOf(args.yScale, yAccessor(datum));\n if (xCenter === undefined || yPosition === undefined) continue;\n\n bars.push({\n x: xCenter - barWidth / 2,\n y: Math.min(yPosition, baseline),\n width: barWidth,\n height: Math.abs(yPosition - baseline),\n color: colorOfDatum(datum, args.color, args.colorScale),\n datum,\n });\n }\n\n return { mark: 'bar', bars };\n}\n\n/**\n * Range bars along `axis`: each spans the start channel's position to the\n * end channel's. An end before its start is normalised (the rect runs\n * between the two whichever comes first), so a reversed row still draws.\n * The other axis is the band each bar sits in.\n */\nfunction buildRangeBars(args: BarArgs, axis: 'x' | 'y', end: Channel): BarGeometry {\n const along = axis === 'x' ? args.xScale : args.yScale;\n const across = axis === 'x' ? args.yScale : args.xScale;\n const startAccessor = makeAccessor(axis === 'x' ? args.x : args.y);\n const endAccessor = makeAccessor(end);\n const bandAccessor = makeAccessor(axis === 'x' ? args.y : args.x);\n const thickness = barWidthOf(across, args.data.length);\n\n const bars: BarRect[] = [];\n for (const datum of args.data) {\n const from = positionOf(along, startAccessor(datum));\n const to = positionOf(along, endAccessor(datum));\n const centre = positionOf(across, bandAccessor(datum));\n if (from === undefined || to === undefined || centre === undefined) continue;\n const low = Math.min(from, to);\n const length = Math.abs(to - from);\n const color = colorOfDatum(datum, args.color, args.colorScale);\n bars.push(\n axis === 'x'\n ? { x: low, y: centre - thickness / 2, width: length, height: thickness, color, datum }\n : { x: centre - thickness / 2, y: low, width: thickness, height: length, color, datum },\n );\n }\n return { mark: 'bar', bars };\n}\n\nfunction barWidthOf(xScale: PositionalScale, count: number): number {\n if (xScale.kind === 'band') {\n return xScale.d3.bandwidth();\n }\n // Continuous x-scale: divide the range across the data with padding.\n const range = xScale.resolved.range as ReadonlyArray<number>;\n const extent = Math.abs(Math.max(...range) - Math.min(...range));\n return count > 0 ? Math.max(1, (extent / count) * 0.8) : 1;\n}\n","import type { Channel, Mark, ScaleHint } from '../spec/index.ts';\nimport {\n scaleBand,\n scaleLinear,\n scaleOrdinal,\n scalePoint,\n scaleSqrt,\n scaleUtc,\n type ScaleBand,\n type ScaleLinear,\n type ScalePoint,\n type ScaleTime,\n} from 'd3-scale';\nimport { makeAccessor, type FieldValue } from './accessor.ts';\nimport type { DataRows, DomainValue, ResolvedScale } from './types.ts';\n\n/**\n * Default categorical palette (Tableau 10). Interpreters may override; the\n * core resolves concrete colours so geometry is directly drawable.\n */\nexport const CATEGORICAL_PALETTE: ReadonlyArray<string> = [\n '#4e79a7',\n '#f28e2c',\n '#e15759',\n '#76b7b4',\n '#59a14f',\n '#edc949',\n '#af7aa1',\n '#ff9da7',\n '#9c755f',\n '#bab0ab',\n];\n\n/** Default radius range (pixels) for the size channel on point marks. */\nexport const DEFAULT_RADIUS_RANGE: readonly [number, number] = [3, 12];\n\n/** Default point radius when no size encoding is present. */\nexport const DEFAULT_POINT_RADIUS = 4;\n\n/**\n * A positional scale bundle: the serialisable ResolvedScale plus the\n * underlying d3 scale, which tick computation and the geometry builders read.\n */\nexport type PositionalScale =\n | {\n readonly kind: 'linear';\n readonly resolved: ResolvedScale;\n readonly d3: ScaleLinear<number, number>;\n }\n | {\n readonly kind: 'utc';\n readonly resolved: ResolvedScale;\n readonly d3: ScaleTime<number, number>;\n }\n | { readonly kind: 'band'; readonly resolved: ResolvedScale; readonly d3: ScaleBand<string> }\n | { readonly kind: 'point'; readonly resolved: ResolvedScale; readonly d3: ScalePoint<string> };\n\n/**\n * Resolves a positional (x or y) scale from a channel's declared type.\n *\n * - `quantitative` → linear\n * - `temporal` → UTC time (UTC for cross-platform determinism)\n * - `ordinal`/`nominal` → band for bar marks (bars need bandwidth),\n * point for line/point/area marks (single positions)\n */\nexport function resolvePositionalScale(\n channel: Channel,\n mark: Mark,\n pixelRange: readonly [number, number],\n data: DataRows,\n hint?: ScaleHint,\n rangeEnd?: Channel,\n): PositionalScale {\n switch (channel.type) {\n case 'quantitative':\n return resolveLinear(channel, mark, pixelRange, data, hint, rangeEnd);\n case 'temporal':\n return resolveUtc(channel, pixelRange, data, hint, rangeEnd);\n case 'ordinal':\n case 'nominal':\n return resolveCategorical(channel, mark, pixelRange, data, hint);\n }\n}\n\nfunction resolveLinear(\n channel: Channel,\n mark: Mark,\n pixelRange: readonly [number, number],\n data: DataRows,\n hint?: ScaleHint,\n rangeEnd?: Channel,\n): PositionalScale {\n let domain: [number, number];\n\n const hintDomain = numericHintDomain(hint);\n if (hintDomain) {\n domain = hintDomain;\n } else {\n const values = valuesOf(data, channel, rangeEnd).filter(\n (value): value is number => typeof value === 'number',\n );\n domain = values.length > 0 ? [Math.min(...values), Math.max(...values)] : [0, 1];\n }\n\n // Bars are drawn from a zero baseline, so their quantitative axis must\n // include zero; a range bar has its own start, so it does not. Otherwise\n // zero is opt-in via the spec hint.\n const includeZero = hint?.zero ?? (mark === 'bar' && rangeEnd === undefined);\n if (includeZero) {\n domain = [Math.min(domain[0], 0), Math.max(domain[1], 0)];\n }\n\n // Degenerate domain (single distinct value): pad so the scale is usable.\n if (domain[0] === domain[1]) {\n domain = [domain[0] - 1, domain[1] + 1];\n }\n\n let d3Scale = scaleLinear().domain(domain).range(pixelRange);\n if (hint?.nice) {\n d3Scale = d3Scale.nice();\n }\n\n const finalDomain = d3Scale.domain() as [number, number];\n return {\n kind: 'linear',\n d3: d3Scale,\n resolved: {\n kind: 'linear',\n domain: finalDomain,\n range: [...pixelRange],\n apply: (value) => (typeof value === 'number' ? d3Scale(value) : undefined),\n bandwidth: 0,\n },\n };\n}\n\nfunction resolveUtc(\n channel: Channel,\n pixelRange: readonly [number, number],\n data: DataRows,\n hint?: ScaleHint,\n rangeEnd?: Channel,\n): PositionalScale {\n let domain: [Date, Date];\n\n const hintDomain = temporalHintDomain(hint);\n if (hintDomain) {\n domain = hintDomain;\n } else {\n const times = valuesOf(data, channel, rangeEnd)\n .filter((value): value is Date => value instanceof Date)\n .map((value) => value.getTime());\n domain =\n times.length > 0\n ? [new Date(Math.min(...times)), new Date(Math.max(...times))]\n : [new Date(Date.UTC(2000, 0, 1)), new Date(Date.UTC(2000, 0, 2))];\n }\n\n // Degenerate domain: pad by one day either side.\n if (domain[0].getTime() === domain[1].getTime()) {\n const dayMs = 24 * 60 * 60 * 1000;\n domain = [new Date(domain[0].getTime() - dayMs), new Date(domain[1].getTime() + dayMs)];\n }\n\n let d3Scale = scaleUtc().domain(domain).range(pixelRange);\n if (hint?.nice) {\n d3Scale = d3Scale.nice();\n }\n\n const finalDomain = d3Scale.domain() as [Date, Date];\n return {\n kind: 'utc',\n d3: d3Scale,\n resolved: {\n kind: 'utc',\n domain: finalDomain,\n range: [...pixelRange],\n apply: (value) => (value instanceof Date ? d3Scale(value) : undefined),\n bandwidth: 0,\n },\n };\n}\n\n/** Every value of `channel` and, for a range, of its end channel `rangeEnd`. */\nfunction valuesOf(data: DataRows, channel: Channel, rangeEnd?: Channel): FieldValue[] {\n const accessors =\n rangeEnd === undefined\n ? [makeAccessor(channel)]\n : [makeAccessor(channel), makeAccessor(rangeEnd)];\n return data.flatMap((datum) => accessors.map((accessor) => accessor(datum)));\n}\n\nfunction resolveCategorical(\n channel: Channel,\n mark: Mark,\n pixelRange: readonly [number, number],\n data: DataRows,\n hint?: ScaleHint,\n): PositionalScale {\n const domain = categoricalDomain(channel, data, hint);\n\n if (mark === 'bar') {\n const d3Scale = scaleBand<string>().domain(domain).range(pixelRange).padding(0.1);\n return {\n kind: 'band',\n d3: d3Scale,\n resolved: {\n kind: 'band',\n domain,\n range: [...pixelRange],\n apply: (value) => d3Scale(asCategory(value)),\n bandwidth: d3Scale.bandwidth(),\n },\n };\n }\n\n const d3Scale = scalePoint<string>().domain(domain).range(pixelRange).padding(0.5);\n return {\n kind: 'point',\n d3: d3Scale,\n resolved: {\n kind: 'point',\n domain,\n range: [...pixelRange],\n apply: (value) => d3Scale(asCategory(value)),\n bandwidth: 0,\n },\n };\n}\n\n/**\n * Resolves the colour scale for a colour channel.\n *\n * - `ordinal`/`nominal` → categorical palette\n * - `quantitative`/`temporal` → normalised [0, 1] linear scale; interpreters\n * map the normalised value onto their own gradient\n */\nexport function resolveColorScale(channel: Channel, data: DataRows): ResolvedScale {\n if (channel.type === 'ordinal' || channel.type === 'nominal') {\n const domain = categoricalDomain(channel, data);\n const d3Scale = scaleOrdinal<string, string>()\n .domain(domain)\n .range(CATEGORICAL_PALETTE.slice(0, Math.max(domain.length, 1)));\n return {\n kind: 'ordinal',\n domain,\n range: domain.map((category) => d3Scale(category)),\n apply: (value) => d3Scale(asCategory(value)),\n bandwidth: 0,\n };\n }\n\n const accessor = makeAccessor(channel);\n const values: number[] = [];\n for (const datum of data) {\n const value = accessor(datum);\n if (typeof value === 'number') values.push(value);\n else if (value instanceof Date) values.push(value.getTime());\n }\n const domain: [number, number] =\n values.length > 0 ? [Math.min(...values), Math.max(...values)] : [0, 1];\n const d3Scale = scaleLinear().domain(domain).range([0, 1]);\n return {\n kind: 'linear',\n domain,\n range: [0, 1],\n apply: (value) => {\n if (typeof value === 'number') return d3Scale(value);\n if (value instanceof Date) return d3Scale(value.getTime());\n return undefined;\n },\n bandwidth: 0,\n };\n}\n\n/**\n * Resolves the size scale for point marks: quantitative values map onto a\n * radius range with square-root scaling so symbol *area* is proportional to\n * the value.\n */\nexport function resolveSizeScale(channel: Channel, data: DataRows): ResolvedScale {\n const accessor = makeAccessor(channel);\n const values: number[] = [];\n for (const datum of data) {\n const value = accessor(datum);\n if (typeof value === 'number') values.push(value);\n }\n const domain: [number, number] =\n values.length > 0 ? [Math.min(...values), Math.max(...values)] : [0, 1];\n const d3Scale = scaleSqrt().domain(domain).range(DEFAULT_RADIUS_RANGE);\n return {\n kind: 'linear',\n domain,\n range: [...DEFAULT_RADIUS_RANGE],\n apply: (value) => (typeof value === 'number' ? d3Scale(value) : undefined),\n bandwidth: 0,\n };\n}\n\nfunction numericHintDomain(hint?: ScaleHint): [number, number] | undefined {\n if (!hint?.domain || hint.domain.length < 2) return undefined;\n const [min, max] = [hint.domain[0], hint.domain[hint.domain.length - 1]];\n if (typeof min === 'number' && typeof max === 'number') return [min, max];\n return undefined;\n}\n\nfunction temporalHintDomain(hint?: ScaleHint): [Date, Date] | undefined {\n if (!hint?.domain || hint.domain.length < 2) return undefined;\n const min = new Date(hint.domain[0] as string | number);\n const max = new Date(hint.domain[hint.domain.length - 1] as string | number);\n if (!Number.isNaN(min.getTime()) && !Number.isNaN(max.getTime())) return [min, max];\n return undefined;\n}\n\nfunction categoricalDomain(channel: Channel, data: DataRows, hint?: ScaleHint): string[] {\n if (hint?.domain && hint.domain.length > 0) {\n return hint.domain.map((value) => String(value));\n }\n const accessor = makeAccessor(channel);\n const seen = new Set<string>();\n const domain: string[] = [];\n for (const datum of data) {\n const value = accessor(datum);\n if (typeof value === 'string' && !seen.has(value)) {\n seen.add(value);\n domain.push(value);\n }\n }\n return domain;\n}\n\nfunction asCategory(value: DomainValue): string {\n return typeof value === 'string' ? value : String(value);\n}\n","import type { Channel } from '../../spec/index.ts';\nimport { makeAccessor } from '../accessor.ts';\nimport { DEFAULT_POINT_RADIUS, type PositionalScale } from '../scale.ts';\nimport type { DataRows, ResolvedScale } from '../types.ts';\nimport { positionOf } from './position.ts';\nimport { colorOfDatum } from './series.ts';\nimport type { PointCircle, PointGeometry } from './types.ts';\n\n/** Builds scatter/point chart geometry: one circle per datum. */\nexport function buildPointGeometry(args: {\n readonly data: DataRows;\n readonly x: Channel;\n readonly y: Channel;\n readonly xScale: PositionalScale;\n readonly yScale: PositionalScale;\n readonly color?: Channel | undefined;\n readonly colorScale?: ResolvedScale | undefined;\n readonly size?: Channel | undefined;\n readonly sizeScale?: ResolvedScale | undefined;\n}): PointGeometry {\n const xAccessor = makeAccessor(args.x);\n const yAccessor = makeAccessor(args.y);\n const sizeAccessor = args.size ? makeAccessor(args.size) : undefined;\n\n const points: PointCircle[] = [];\n for (const datum of args.data) {\n const cx = positionOf(args.xScale, xAccessor(datum));\n const cy = positionOf(args.yScale, yAccessor(datum));\n if (cx === undefined || cy === undefined) continue;\n\n points.push({\n cx,\n cy,\n r: radiusOf(datum, sizeAccessor, args.sizeScale),\n color: colorOfDatum(datum, args.color, args.colorScale),\n datum,\n });\n }\n\n return { mark: 'point', points };\n}\n\nfunction radiusOf(\n datum: Parameters<ReturnType<typeof makeAccessor>>[0],\n sizeAccessor: ReturnType<typeof makeAccessor> | undefined,\n sizeScale: ResolvedScale | undefined,\n): number {\n if (!sizeAccessor || !sizeScale) return DEFAULT_POINT_RADIUS;\n const value = sizeAccessor(datum);\n if (value === null) return DEFAULT_POINT_RADIUS;\n const radius = sizeScale.apply(value);\n return typeof radius === 'number' ? radius : DEFAULT_POINT_RADIUS;\n}\n","import type { Channel, Datum, TreeOptions } from '../../spec/index.ts';\nimport { makeAccessor, type FieldValue } from '../accessor.ts';\nimport type { Box, DataRows, ResolvedScale } from '../types.ts';\nimport { colorOfDatum } from './series.ts';\nimport type { TreeGeometry, TreeLink, TreeNodeBox, TreeOutlineNode } from './types.ts';\n\n/**\n * The inline style every interpreter puts on a tree's nested-list text\n * alternative: in the accessibility tree, out of sight (the classic\n * visually-hidden pattern, inline because these interpreters ship no CSS).\n */\nexport const VISUALLY_HIDDEN_STYLE =\n 'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0';\n\n/** The text of one outline entry: its label, then its colour category in words. */\nexport function outlineText(node: {\n readonly label: string;\n readonly category: string | undefined;\n}): string {\n return node.category === undefined ? node.label : `${node.label}, ${node.category}`;\n}\n\n/** Height of a node box, in pixels. */\nconst NODE_HEIGHT = 28;\n/** The width of one label character, estimated (the pure path has no text measurer). */\nconst CHAR_WIDTH = 7;\n/** Horizontal padding inside a node box. */\nconst NODE_PADDING = 16;\n/** The narrowest a node box gets. */\nconst MIN_NODE_WIDTH = 24;\n\n/** One row of the hierarchy, after validation. */\ninterface TreeRow {\n readonly id: string;\n readonly label: string;\n readonly datum: Datum;\n readonly children: TreeRow[];\n}\n\n/** A node placed in unit layout coordinates: `slot` along the breadth, `depth` along the depth. */\ninterface Placed {\n readonly row: TreeRow;\n readonly slot: number;\n readonly depth: number;\n readonly parent: Placed | undefined;\n}\n\n/** How a channel's value names a node: dates as ISO strings, everything else as text. */\nfunction keyOf(value: FieldValue): string | null {\n if (value === null) return null;\n return value instanceof Date ? value.toISOString() : String(value);\n}\n\n/**\n * Turns rows into a forest, checking the row-level rules `parseSpec` cannot:\n * ids are present and unique, every parent is an id, and there are no\n * cycles. Each error names the offending row (1-based), and is thrown, so\n * `resolveChart` shows it in place of the chart.\n */\nfunction buildForest(\n data: DataRows,\n id: Channel,\n parent: Channel,\n label: Channel | undefined,\n): TreeRow[] {\n const idOf = makeAccessor(id);\n const parentOf = makeAccessor(parent);\n const labelOf = label === undefined ? undefined : makeAccessor(label);\n\n const byId = new Map<string, TreeRow>();\n const parents = new Map<string, string | null>();\n data.forEach((datum, index) => {\n const key = keyOf(idOf(datum));\n if (key === null) throw new Error(`Tree row ${index + 1}: missing id`);\n if (byId.has(key)) throw new Error(`Tree row ${index + 1}: duplicate id \"${key}\"`);\n byId.set(key, { id: key, label: keyOf(labelOf?.(datum) ?? null) ?? key, datum, children: [] });\n parents.set(key, keyOf(parentOf(datum)));\n });\n\n const roots: TreeRow[] = [];\n data.forEach((datum, index) => {\n const key = keyOf(idOf(datum)) ?? '';\n const row = byId.get(key);\n const parentKey = parents.get(key) ?? null;\n if (row === undefined) return;\n if (parentKey === null) {\n roots.push(row);\n return;\n }\n const parentRow = byId.get(parentKey);\n if (parentRow === undefined)\n throw new Error(`Tree row ${index + 1}: parent \"${parentKey}\" is not an id`);\n parentRow.children.push(row);\n });\n\n // Every row must hang from a root; one that does not sits on a cycle.\n const reached = new Set<string>();\n const visit = (row: TreeRow): void => {\n reached.add(row.id);\n row.children.forEach(visit);\n };\n roots.forEach(visit);\n const stranded = data.findIndex((datum) => !reached.has(keyOf(idOf(datum)) ?? ''));\n if (stranded !== -1) throw new Error(`Tree row ${stranded + 1}: its parents form a cycle`);\n return roots;\n}\n\n/**\n * Places the forest in unit coordinates: leaves take consecutive breadth\n * slots in depth-first order, and every parent sits centred over its first\n * and last child. Linear in the number of rows, never overlapping (siblings'\n * subtrees occupy disjoint slot ranges), and a forest's roots stand side by\n * side as if under one invisible root.\n */\nfunction place(roots: readonly TreeRow[]): {\n readonly nodes: Placed[];\n readonly leaves: number;\n readonly depth: number;\n} {\n const nodes: Placed[] = [];\n let nextLeaf = 0;\n let maxDepth = 0;\n const walk = (row: TreeRow, depth: number, parent: Placed | undefined): Placed => {\n maxDepth = Math.max(maxDepth, depth);\n // A placeholder parent link for the children; the slot is fixed after them.\n const index = nodes.length;\n nodes.push({ row, slot: 0, depth, parent });\n if (row.children.length === 0) {\n const leaf = { row, slot: nextLeaf, depth, parent };\n nextLeaf += 1;\n nodes[index] = leaf;\n return leaf;\n }\n const self: { row: TreeRow; slot: number; depth: number; parent: Placed | undefined } = {\n row,\n slot: 0,\n depth,\n parent,\n };\n nodes[index] = self;\n const placed = row.children.map((child) => walk(child, depth + 1, self));\n self.slot = ((placed[0]?.slot ?? 0) + (placed.at(-1)?.slot ?? 0)) / 2;\n return self;\n };\n roots.forEach((root) => walk(root, 0, undefined));\n return { nodes, leaves: Math.max(nextLeaf, 1), depth: maxDepth };\n}\n\n/** The nested depth-first structure of the forest: the interpreters' text alternative. */\nfunction outlineOf(rows: readonly TreeRow[], color: Channel | undefined): TreeOutlineNode[] {\n const categoryOf = color === undefined ? undefined : makeAccessor(color);\n return rows.map((row) => ({\n id: row.id,\n label: row.label,\n category: keyOf(categoryOf?.(row.datum) ?? null) ?? undefined,\n children: outlineOf(row.children, color),\n }));\n}\n\n/** An SVG path from a parent's edge to a child's, along the depth axis. */\nfunction linkPath(from: TreeNodeBox, to: TreeNodeBox, vertical: boolean, curved: boolean): string {\n if (vertical) {\n const x1 = from.x + from.width / 2;\n const y1 = from.y + from.height;\n const x2 = to.x + to.width / 2;\n const y2 = to.y;\n const mid = (y1 + y2) / 2;\n return curved\n ? `M${x1},${y1}C${x1},${mid} ${x2},${mid} ${x2},${y2}`\n : `M${x1},${y1}V${mid}H${x2}V${y2}`;\n }\n const x1 = from.x + from.width;\n const y1 = from.y + from.height / 2;\n const x2 = to.x;\n const y2 = to.y + to.height / 2;\n const mid = (x1 + x2) / 2;\n return curved\n ? `M${x1},${y1}C${mid},${y1} ${mid},${y2} ${x2},${y2}`\n : `M${x1},${y1}H${mid}V${y2}H${x2}`;\n}\n\n/** The plot's measurements along the breadth and depth axes. */\ninterface Frame {\n readonly vertical: boolean;\n /** The deepest node's depth. */\n readonly depth: number;\n /** The plot's extent along the depth axis, in pixels. */\n readonly length: number;\n /** One leaf slot along the breadth axis, in pixels. */\n readonly slotSize: number;\n}\n\n/** A placed node's box in plot pixels: sized from its label, centred in its slot, at its depth's level. */\nfunction boxOf(node: Placed, frame: Frame, color: string | undefined): TreeNodeBox {\n const { vertical, depth, length, slotSize } = frame;\n const levelSize = depth === 0 ? 0 : length / depth;\n const estimate = node.row.label.length * CHAR_WIDTH + NODE_PADDING;\n const width = vertical\n ? Math.max(Math.min(estimate, slotSize - 4), MIN_NODE_WIDTH)\n : Math.max(Math.min(estimate, Math.max(levelSize - 16, MIN_NODE_WIDTH)), MIN_NODE_WIDTH);\n const height = vertical ? NODE_HEIGHT : Math.min(NODE_HEIGHT, slotSize - 4);\n const centreBreadth = (node.slot + 0.5) * slotSize;\n const depthStart =\n depth === 0 ? 0 : (node.depth / depth) * (length - (vertical ? height : width));\n return {\n id: node.row.id,\n label: node.row.label,\n depth: node.depth,\n x: vertical ? centreBreadth - width / 2 : depthStart,\n y: vertical ? depthStart : centreBreadth - height / 2,\n width,\n height,\n color,\n datum: node.row.datum,\n };\n}\n\n/** One link per non-root node, from its parent's box to its own. */\nfunction linksOf(\n nodes: readonly Placed[],\n boxes: ReadonlyMap<Placed, TreeNodeBox>,\n vertical: boolean,\n curved: boolean,\n): TreeLink[] {\n return nodes.flatMap((node) => {\n const box = boxes.get(node);\n const parentBox = node.parent === undefined ? undefined : boxes.get(node.parent);\n return box === undefined || parentBox === undefined\n ? []\n : [{ from: parentBox.id, to: box.id, path: linkPath(parentBox, box, vertical, curved) }];\n });\n}\n\n/**\n * Builds a `tree` mark's geometry (spec 1.1): node boxes, the links between\n * them and the nested outline the interpreters render as the accessible\n * text alternative. Pure and DOM-free; label widths are estimated from\n * character counts, as the pure path's tick layout does.\n *\n * @throws {Error} on a duplicate or missing id, an unknown parent, or a cycle; the message names the row.\n */\nexport function buildTreeGeometry(args: {\n readonly data: DataRows;\n readonly plot: Box;\n readonly id: Channel;\n readonly parent: Channel;\n readonly label?: Channel | undefined;\n readonly color?: Channel | undefined;\n readonly colorScale?: ResolvedScale | undefined;\n readonly options?: TreeOptions | undefined;\n}): TreeGeometry {\n const roots = buildForest(args.data, args.id, args.parent, args.label);\n const { nodes, leaves, depth } = place(roots);\n const vertical = args.options?.orientation !== 'horizontal';\n const curved = args.options?.linkStyle === 'curved';\n\n const breadth = vertical ? args.plot.width : args.plot.height;\n const length = vertical ? args.plot.height : args.plot.width;\n const frame: Frame = { vertical, depth, length, slotSize: breadth / leaves };\n\n const boxes = new Map<Placed, TreeNodeBox>(\n nodes.map((node) => [\n node,\n boxOf(node, frame, colorOfDatum(node.row.datum, args.color, args.colorScale)),\n ]),\n );\n const links = linksOf(nodes, boxes, vertical, curved);\n\n return {\n mark: 'tree',\n nodes: nodes\n .map((node) => boxes.get(node))\n .filter((box): box is TreeNodeBox => box !== undefined),\n links,\n outline: outlineOf(roots, args.color),\n };\n}\n","import type { Box, Dimensions, Margins } from './types.ts';\n\n/** Default margins, leaving room for axis ticks and labels. */\nexport const DEFAULT_MARGINS: Margins = {\n top: 20,\n right: 20,\n bottom: 40,\n left: 48,\n};\n\n/**\n * Computes chart dimensions from an outer box and optional margin overrides.\n *\n * Missing margins take their {@link DEFAULT_MARGINS} value. The plot area\n * never goes negative: its width and height are clamped at zero, while the\n * margins are kept as given.\n */\nexport function computeDimensions(outer: Box, margins?: Partial<Margins>): Dimensions {\n const resolved: Margins = { ...DEFAULT_MARGINS, ...margins };\n const plot: Box = {\n width: Math.max(0, outer.width - resolved.left - resolved.right),\n height: Math.max(0, outer.height - resolved.top - resolved.bottom),\n };\n return { outer, margins: resolved, plot };\n}\n","import type { PositionalScale } from './scale.ts';\nimport type { Tick } from './types.ts';\n\n/** Default tick count for continuous scales. */\nexport const DEFAULT_TICK_COUNT = 5;\n\n/**\n * Computes axis ticks for a positional scale.\n *\n * - Continuous scales (linear, UTC) use d3's tick generation and formatting.\n * UTC formatting is deterministic across machines and time zones.\n * - Categorical scales (band, point) emit one tick per category, centred on\n * the band.\n */\nexport function computeTicks(scale: PositionalScale, count: number = DEFAULT_TICK_COUNT): Tick[] {\n switch (scale.kind) {\n case 'linear': {\n const format = scale.d3.tickFormat(count);\n return scale.d3.ticks(count).map((value) => ({\n value,\n position: scale.d3(value),\n label: format(value),\n }));\n }\n case 'utc': {\n const format = scale.d3.tickFormat(count);\n return scale.d3.ticks(count).map((value) => ({\n value,\n position: scale.d3(value),\n label: format(value),\n }));\n }\n case 'band': {\n const bandwidth = scale.d3.bandwidth();\n return scale.d3.domain().map((value) => ({\n value,\n position: (scale.d3(value) ?? 0) + bandwidth / 2,\n label: value,\n }));\n }\n case 'point': {\n return scale.d3.domain().map((value) => ({\n value,\n position: scale.d3(value) ?? 0,\n label: value,\n }));\n }\n }\n}\n","import { isInlineData, type ChartSpec } from '../spec/index.ts';\nimport { buildAreaGeometry } from './geometry/area.ts';\nimport { buildBarGeometry } from './geometry/bar.ts';\nimport { buildLineGeometry } from './geometry/line.ts';\nimport { buildPointGeometry } from './geometry/point.ts';\nimport { buildTreeGeometry } from './geometry/tree.ts';\nimport type { Geometry } from './geometry/types.ts';\nimport { computeDimensions } from './layout.ts';\nimport {\n resolveColorScale,\n resolvePositionalScale,\n resolveSizeScale,\n type PositionalScale,\n} from './scale.ts';\nimport { computeTicks } from './ticks.ts';\nimport type {\n Box,\n ChartContext,\n ChartScales,\n ChartTicks,\n ComputeContextOptions,\n DataRows,\n ResolvedScale,\n} from './types.ts';\n\n/**\n * The Layer 2 entry point: turns (spec, measured box, resolved data) into\n * everything an interpreter needs to draw — dimensions, scales, geometry,\n * and ticks.\n *\n * Pure and synchronous: no DOM, no reactivity, no rendering, no data\n * fetching. When the spec's data is a reference (`data.ref`), the host must\n * resolve it and pass the rows; this function never fetches.\n *\n * @param spec - A parsed portable chart spec.\n * @param box - The measured outer pixel box available to the chart.\n * @param data - Resolved data rows. Optional when the spec carries inline values.\n * @param options - Layout options (margins).\n *\n * @throws {Error} when no data rows are available (spec has a ref and no rows were passed).\n * @throws {TypeError} when a datum value contradicts its channel's declared type.\n */\nexport function computeContext(\n spec: ChartSpec,\n box: Box,\n data?: DataRows,\n options?: ComputeContextOptions,\n): ChartContext {\n const rows = resolveRows(spec, data);\n const dimensions = computeDimensions(box, options?.margins);\n\n // Positional scales: x → [0, plot width], y → [plot height, 0] (y inverted:\n // larger values sit higher on screen).\n const xPositional = spec.encoding.x\n ? resolvePositionalScale(\n spec.encoding.x,\n spec.mark,\n [0, dimensions.plot.width],\n rows,\n spec.scales?.x,\n spec.encoding.x2,\n )\n : undefined;\n const yPositional = spec.encoding.y\n ? resolvePositionalScale(\n spec.encoding.y,\n spec.mark,\n [dimensions.plot.height, 0],\n rows,\n spec.scales?.y,\n spec.encoding.y2,\n )\n : undefined;\n\n const colorScale = spec.encoding.color ? resolveColorScale(spec.encoding.color, rows) : undefined;\n const sizeScale = spec.encoding.size ? resolveSizeScale(spec.encoding.size, rows) : undefined;\n\n return {\n dimensions,\n scales: buildScales(xPositional, yPositional, colorScale, sizeScale),\n geometry:\n spec.mark === 'tree'\n ? buildTreeMark(spec, rows, dimensions.plot, colorScale)\n : buildGeometry(spec, rows, xPositional, yPositional, colorScale, sizeScale),\n ticks: buildTicks(xPositional, yPositional),\n };\n}\n\nfunction resolveRows(spec: ChartSpec, data?: DataRows): DataRows {\n if (data) return data;\n if (isInlineData(spec.data)) return spec.data.values;\n throw new Error(\n `Chart data is a ${spec.data.ref.kind} reference (\"${spec.data.ref.id}\"); the host must resolve it and pass rows to computeContext`,\n );\n}\n\nfunction buildScales(\n x: PositionalScale | undefined,\n y: PositionalScale | undefined,\n color: ResolvedScale | undefined,\n size: ResolvedScale | undefined,\n): ChartScales {\n return {\n ...(x ? { x: x.resolved } : {}),\n ...(y ? { y: y.resolved } : {}),\n ...(color ? { color } : {}),\n ...(size ? { size } : {}),\n };\n}\n\nfunction buildTicks(x: PositionalScale | undefined, y: PositionalScale | undefined): ChartTicks {\n return {\n ...(x ? { x: computeTicks(x) } : {}),\n ...(y ? { y: computeTicks(y) } : {}),\n };\n}\n\n/** A `tree` mark's geometry; `parseSpec` has guaranteed its `id` and `parent` channels. */\nfunction buildTreeMark(\n spec: ChartSpec,\n rows: DataRows,\n plot: ChartContext['dimensions']['plot'],\n colorScale: ResolvedScale | undefined,\n): Geometry {\n const { id, parent, label, color } = spec.encoding;\n if (id === undefined || parent === undefined)\n return { mark: 'tree', nodes: [], links: [], outline: [] };\n return buildTreeGeometry({\n data: rows,\n plot,\n id,\n parent,\n label,\n color,\n colorScale,\n options: spec.tree,\n });\n}\n\nfunction buildGeometry(\n spec: ChartSpec,\n rows: DataRows,\n xScale: PositionalScale | undefined,\n yScale: PositionalScale | undefined,\n colorScale: ResolvedScale | undefined,\n sizeScale: ResolvedScale | undefined,\n): Geometry {\n // Both positional encodings are required to produce geometry; without them\n // the chart renders as an empty plot (see the capability matrix).\n if (!spec.encoding.x || !spec.encoding.y || !xScale || !yScale) {\n return emptyGeometry(spec.mark);\n }\n\n const args = {\n data: rows,\n x: spec.encoding.x,\n y: spec.encoding.y,\n xScale,\n yScale,\n color: spec.encoding.color,\n colorScale,\n };\n\n switch (spec.mark) {\n case 'line':\n return buildLineGeometry(args);\n case 'area':\n return buildAreaGeometry(args);\n case 'bar':\n return buildBarGeometry({ ...args, x2: spec.encoding.x2, y2: spec.encoding.y2 });\n case 'point':\n return buildPointGeometry({ ...args, size: spec.encoding.size, sizeScale });\n case 'tree':\n return emptyGeometry('tree');\n }\n}\n\nfunction emptyGeometry(mark: ChartSpec['mark']): Geometry {\n switch (mark) {\n case 'line':\n return { mark: 'line', series: [] };\n case 'area':\n return { mark: 'area', series: [] };\n case 'bar':\n return { mark: 'bar', bars: [] };\n case 'point':\n return { mark: 'point', points: [] };\n case 'tree':\n return { mark: 'tree', nodes: [], links: [], outline: [] };\n }\n}\n","import { isDataRef, validateSpec, type ChartSpec } from '../spec/index.ts';\nimport { computeContext } from './context.ts';\nimport type { Box, ChartContext, ComputeContextOptions, DataRows } from './types.ts';\n\n/**\n * The result of {@link resolveChart}: a validated spec and its geometry, or\n * the message an interpreter shows in place of the chart.\n */\nexport type ResolvedChart =\n | { readonly kind: 'ready'; readonly spec: ChartSpec; readonly context: ChartContext }\n | { readonly kind: 'error'; readonly message: string };\n\n/**\n * Validates a spec and computes its geometry, turning every failure into a\n * message rather than a throw: an invalid spec, a data reference with no\n * resolved rows, or an error from {@link computeContext}. The bundled Svelte\n * `Chart` component is this function plus SVG.\n */\nexport function resolveChart(\n spec: unknown,\n box: Box,\n data?: DataRows,\n options?: ComputeContextOptions,\n): ResolvedChart {\n const validation = validateSpec(spec);\n if (!validation.ok) {\n return { kind: 'error', message: `Invalid chart spec: ${validation.errors[0] ?? ''}` };\n }\n if (isDataRef(validation.value.data) && !data) {\n return {\n kind: 'error',\n message: 'Chart data is stored externally; pass resolved rows via the data prop',\n };\n }\n try {\n return {\n kind: 'ready',\n spec: validation.value,\n context: computeContext(validation.value, box, data, options),\n };\n } catch (error) {\n return {\n kind: 'error',\n message: error instanceof Error ? error.message : 'Failed to compute chart',\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,aAAa,SAAgD;CAC3E,QAAQ,QAAQ,MAAhB;EACE,KAAK,gBACH,QAAQ,UAAU,eAAe,MAAM,QAAQ,QAAQ,QAAQ,KAAK;EACtE,KAAK,YACH,QAAQ,UAAU,WAAW,MAAM,QAAQ,QAAQ,QAAQ,KAAK;EAClE,KAAK;EACL,KAAK,WACH,QAAQ,UAAU,WAAW,MAAM,QAAQ,MAAM;CACrD;AACF;AAEA,SAAS,eAAe,OAA+B,OAA8B;CACnF,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAClD,IAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,GAAG,OAAO;CAChE,MAAM,IAAI,UACR,UAAU,MAAM,6CAA6C,KAAK,UAAU,KAAK,EAAE,wBACrF;AACF;AAEA,SAAS,WAAW,OAA+B,OAA4B;CAC7E,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO;CAClD,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAAU;EAC1D,MAAM,OAAO,IAAI,KAAK,KAAK;EAC3B,IAAI,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,GAAG,OAAO;CAC5C;CACA,MAAM,IAAI,UACR,UAAU,MAAM,yCAAyC,KAAK,UAAU,KAAK,EAAE,0EACjF;AACF;AAEA,SAAS,WAAW,OAA8C;CAChE,IAAI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,OAAO,mBAAmB;GAAE,GAAG;GAAM,MAAM,KAAK,SAAS;GAAM;EAAU,CAAC;EAC5E,KAAK,QACH,OAAO,cAAc,MAAM;CAC/B;AACF;AAEA,SAAS,cAAc,MAAmC;CACxD,QAAQ,MAAR;EACE,KAAK,QACH,OAAO;GAAE,MAAM;GAAQ,QAAQ,CAAC;EAAE;EACpC,KAAK,QACH,OAAO;GAAE,MAAM;GAAQ,QAAQ,CAAC;EAAE;EACpC,KAAK,OACH,OAAO;GAAE,MAAM;GAAO,MAAM,CAAC;EAAE;EACjC,KAAK,SACH,OAAO;GAAE,MAAM;GAAS,QAAQ,CAAC;EAAE;EACrC,KAAK,QACH,OAAO;GAAE,MAAM;GAAQ,OAAO,CAAC;GAAG,OAAO,CAAC;GAAG,SAAS,CAAC;EAAE;CAC7D;AACF;;;;;;;;AC5KA,SAAgB,aACd,MACA,KACA,MACA,SACe;CACf,MAAM,aAAa,aAAa,IAAI;CACpC,IAAI,CAAC,WAAW,IACd,OAAO;EAAE,MAAM;EAAS,SAAS,uBAAuB,WAAW,OAAO,MAAM;CAAK;CAEvF,IAAI,UAAU,WAAW,MAAM,IAAI,KAAK,CAAC,MACvC,OAAO;EACL,MAAM;EACN,SAAS;CACX;CAEF,IAAI;EACF,OAAO;GACL,MAAM;GACN,MAAM,WAAW;GACjB,SAAS,eAAe,WAAW,OAAO,KAAK,MAAM,OAAO;EAC9D;CACF,SAAS,OAAO;EACd,OAAO;GACL,MAAM;GACN,SAAS,iBAAiB,QAAQ,MAAM,UAAU;EACpD;CACF;AACF"}
|
package/dist/core.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as Dimensions, B as LineGeometry, C as computeContext, D as ChartTicks, E as ChartScales, F as Tick, G as TreeGeometry, H as PointGeometry, I as AreaGeometry, J as TreeOutlineNode, K as TreeLink, L as BarGeometry, M as Margins, N as ResolvedScale, O as ComputeContextOptions, P as ScaleKind, R as BarRect, S as resolveChart, T as ChartContext, U as Series, V as PointCircle, W as SeriesPoint, _ as FieldValue, a as buildBarGeometry, b as computeDimensions, c as DEFAULT_TICK_COUNT, d as DEFAULT_POINT_RADIUS, f as DEFAULT_RADIUS_RANGE, g as resolveSizeScale, h as resolvePositionalScale, i as buildPointGeometry, j as DomainValue, k as DataRows, l as computeTicks, m as resolveColorScale, n as buildTreeGeometry, o as buildAreaGeometry, p as PositionalScale, q as TreeNodeBox, r as outlineText, s as buildLineGeometry, t as VISUALLY_HIDDEN_STYLE, u as CATEGORICAL_PALETTE, v as makeAccessor, w as Box, x as ResolvedChart, y as DEFAULT_MARGINS, z as Geometry } from "./index-B32E5tbG.mjs";
|
|
2
|
+
export { type AreaGeometry, type BarGeometry, type BarRect, type Box, CATEGORICAL_PALETTE, type ChartContext, type ChartScales, type ChartTicks, type ComputeContextOptions, DEFAULT_MARGINS, DEFAULT_POINT_RADIUS, DEFAULT_RADIUS_RANGE, DEFAULT_TICK_COUNT, type DataRows, type Dimensions, type DomainValue, type FieldValue, type Geometry, type LineGeometry, type Margins, type PointCircle, type PointGeometry, type PositionalScale, type ResolvedChart, type ResolvedScale, type ScaleKind, type Series, type SeriesPoint, type Tick, type TreeGeometry, type TreeLink, type TreeNodeBox, type TreeOutlineNode, VISUALLY_HIDDEN_STYLE, buildAreaGeometry, buildBarGeometry, buildLineGeometry, buildPointGeometry, buildTreeGeometry, computeContext, computeDimensions, computeTicks, makeAccessor, outlineText, resolveChart, resolveColorScale, resolvePositionalScale, resolveSizeScale };
|
package/dist/core.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { d as CATEGORICAL_PALETTE, a as DEFAULT_MARGINS, f as DEFAULT_POINT_RADIUS, p as DEFAULT_RADIUS_RANGE, r as DEFAULT_TICK_COUNT, s as VISUALLY_HIDDEN_STYLE, v as buildAreaGeometry, _ as buildBarGeometry, y as buildLineGeometry, u as buildPointGeometry, c as buildTreeGeometry, n as computeContext, o as computeDimensions, i as computeTicks, b as makeAccessor, l as outlineText, t as resolveChart, m as resolveColorScale, h as resolvePositionalScale, g as resolveSizeScale } from "./core-BVbfW7N6.mjs";
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { S as ScaleHint, T as TreeOptions, b as Mark, c as Channel, l as ChartSpec, m as Datum } from "./index-M0KOYMo4.mjs";
|
|
2
|
+
import { ScaleBand, ScaleLinear, ScalePoint, ScaleTime } from "d3-scale";
|
|
3
|
+
/** A positioned point on a line or area outline, in plot pixels. */
|
|
4
|
+
interface SeriesPoint {
|
|
5
|
+
readonly x: number;
|
|
6
|
+
readonly y: number;
|
|
7
|
+
readonly datum: Datum;
|
|
8
|
+
}
|
|
9
|
+
/** One series of a line or area chart (split by the colour channel if present). */
|
|
10
|
+
interface Series {
|
|
11
|
+
/** The colour-channel category this series represents, or null for the single unsplit series. */
|
|
12
|
+
readonly key: string | null;
|
|
13
|
+
/** Resolved series colour, or undefined when no colour encoding is present. */
|
|
14
|
+
readonly color: string | undefined;
|
|
15
|
+
readonly points: ReadonlyArray<SeriesPoint>;
|
|
16
|
+
/** SVG path data ("d" attribute) for the series. Empty string when there are no points. */
|
|
17
|
+
readonly path: string;
|
|
18
|
+
}
|
|
19
|
+
/** Geometry for a line chart. */
|
|
20
|
+
interface LineGeometry {
|
|
21
|
+
readonly mark: 'line';
|
|
22
|
+
readonly series: ReadonlyArray<Series>;
|
|
23
|
+
}
|
|
24
|
+
/** Geometry for an area chart. Paths are closed down to the zero baseline. */
|
|
25
|
+
interface AreaGeometry {
|
|
26
|
+
readonly mark: 'area';
|
|
27
|
+
readonly series: ReadonlyArray<Series>;
|
|
28
|
+
}
|
|
29
|
+
/** A single bar, in plot pixels. */
|
|
30
|
+
interface BarRect {
|
|
31
|
+
readonly x: number;
|
|
32
|
+
readonly y: number;
|
|
33
|
+
readonly width: number;
|
|
34
|
+
readonly height: number;
|
|
35
|
+
/** Resolved bar colour, or undefined when no colour encoding is present. */
|
|
36
|
+
readonly color: string | undefined;
|
|
37
|
+
readonly datum: Datum;
|
|
38
|
+
}
|
|
39
|
+
/** Geometry for a bar chart. */
|
|
40
|
+
interface BarGeometry {
|
|
41
|
+
readonly mark: 'bar';
|
|
42
|
+
readonly bars: ReadonlyArray<BarRect>;
|
|
43
|
+
}
|
|
44
|
+
/** A single point symbol, in plot pixels. */
|
|
45
|
+
interface PointCircle {
|
|
46
|
+
readonly cx: number;
|
|
47
|
+
readonly cy: number;
|
|
48
|
+
readonly r: number;
|
|
49
|
+
/** Resolved point colour, or undefined when no colour encoding is present. */
|
|
50
|
+
readonly color: string | undefined;
|
|
51
|
+
readonly datum: Datum;
|
|
52
|
+
}
|
|
53
|
+
/** Geometry for a scatter/point chart. */
|
|
54
|
+
interface PointGeometry {
|
|
55
|
+
readonly mark: 'point';
|
|
56
|
+
readonly points: ReadonlyArray<PointCircle>;
|
|
57
|
+
}
|
|
58
|
+
/** A node of a `tree` mark (spec 1.1), as a box in plot pixels, in depth-first order. */
|
|
59
|
+
interface TreeNodeBox {
|
|
60
|
+
/** The row's id. */
|
|
61
|
+
readonly id: string;
|
|
62
|
+
/** The text drawn in the box (the label channel, else the id). */
|
|
63
|
+
readonly label: string;
|
|
64
|
+
/** Depth from the root, 0 for a root. */
|
|
65
|
+
readonly depth: number;
|
|
66
|
+
readonly x: number;
|
|
67
|
+
readonly y: number;
|
|
68
|
+
readonly width: number;
|
|
69
|
+
readonly height: number;
|
|
70
|
+
/** Resolved node colour, or undefined when no colour encoding is present. */
|
|
71
|
+
readonly color: string | undefined;
|
|
72
|
+
readonly datum: Datum;
|
|
73
|
+
}
|
|
74
|
+
/** A link from a parent node to a child, as SVG path data in plot pixels. */
|
|
75
|
+
interface TreeLink {
|
|
76
|
+
readonly from: string;
|
|
77
|
+
readonly to: string;
|
|
78
|
+
readonly path: string;
|
|
79
|
+
}
|
|
80
|
+
/** One entry of a tree's outline: the nested, depth-first text alternative. */
|
|
81
|
+
interface TreeOutlineNode {
|
|
82
|
+
readonly id: string;
|
|
83
|
+
readonly label: string;
|
|
84
|
+
/** The colour-channel category named in words, so colour is never the only carrier. */
|
|
85
|
+
readonly category: string | undefined;
|
|
86
|
+
readonly children: ReadonlyArray<TreeOutlineNode>;
|
|
87
|
+
}
|
|
88
|
+
/** Geometry for a `tree` mark (spec 1.1). */
|
|
89
|
+
interface TreeGeometry {
|
|
90
|
+
readonly mark: 'tree';
|
|
91
|
+
/** Node boxes, in depth-first order. */
|
|
92
|
+
readonly nodes: ReadonlyArray<TreeNodeBox>;
|
|
93
|
+
/** One link per non-root node. */
|
|
94
|
+
readonly links: ReadonlyArray<TreeLink>;
|
|
95
|
+
/** The hierarchy as nested entries, for a nested-list text alternative. */
|
|
96
|
+
readonly outline: ReadonlyArray<TreeOutlineNode>;
|
|
97
|
+
}
|
|
98
|
+
/** Chart geometry, discriminated by mark. */
|
|
99
|
+
type Geometry = LineGeometry | BarGeometry | PointGeometry | AreaGeometry | TreeGeometry;
|
|
100
|
+
/** A measured box: the outer pixel dimensions available to the chart. */
|
|
101
|
+
interface Box {
|
|
102
|
+
readonly width: number;
|
|
103
|
+
readonly height: number;
|
|
104
|
+
}
|
|
105
|
+
/** Margins between the outer box and the plot area, in pixels. */
|
|
106
|
+
interface Margins {
|
|
107
|
+
readonly top: number;
|
|
108
|
+
readonly right: number;
|
|
109
|
+
readonly bottom: number;
|
|
110
|
+
readonly left: number;
|
|
111
|
+
}
|
|
112
|
+
/** Resolved chart dimensions. */
|
|
113
|
+
interface Dimensions {
|
|
114
|
+
readonly outer: Box;
|
|
115
|
+
readonly margins: Margins;
|
|
116
|
+
/** The inner plot area (outer minus margins). All geometry is in plot coordinates. */
|
|
117
|
+
readonly plot: Box;
|
|
118
|
+
}
|
|
119
|
+
/** A value in a scale's domain. */
|
|
120
|
+
type DomainValue = number | string | Date;
|
|
121
|
+
/**
|
|
122
|
+
* The kind of a resolved scale.
|
|
123
|
+
*
|
|
124
|
+
* - `linear` — continuous, for quantitative encodings
|
|
125
|
+
* - `utc` — continuous time (UTC for cross-platform determinism), for temporal encodings
|
|
126
|
+
* - `band` — categorical with bandwidth, for ordinal/nominal encodings on bar marks
|
|
127
|
+
* - `point` — categorical positions, for ordinal/nominal encodings on line/point/area marks
|
|
128
|
+
* - `ordinal` — discrete mapping (e.g. category → colour)
|
|
129
|
+
*/
|
|
130
|
+
type ScaleKind = 'linear' | 'utc' | 'band' | 'point' | 'ordinal';
|
|
131
|
+
/**
|
|
132
|
+
* A resolved scale: a callable mapping plus its serialisable description.
|
|
133
|
+
*
|
|
134
|
+
* `kind`, `domain`, and `range` fully describe the scale, so interpreters
|
|
135
|
+
* that cannot consume the closure (or future native ports reading a
|
|
136
|
+
* serialised context) can reconstruct the mapping.
|
|
137
|
+
*/
|
|
138
|
+
interface ResolvedScale {
|
|
139
|
+
readonly kind: ScaleKind;
|
|
140
|
+
readonly domain: ReadonlyArray<DomainValue>;
|
|
141
|
+
readonly range: ReadonlyArray<number> | ReadonlyArray<string>;
|
|
142
|
+
/** Applies the scale. Returns undefined when the value is not mappable. */
|
|
143
|
+
readonly apply: (value: DomainValue) => number | string | undefined;
|
|
144
|
+
/** Band width in pixels. Zero for non-band scales. */
|
|
145
|
+
readonly bandwidth: number;
|
|
146
|
+
}
|
|
147
|
+
/** The resolved scales for a chart, keyed by channel. */
|
|
148
|
+
interface ChartScales {
|
|
149
|
+
readonly x?: ResolvedScale | undefined;
|
|
150
|
+
readonly y?: ResolvedScale | undefined;
|
|
151
|
+
readonly color?: ResolvedScale | undefined;
|
|
152
|
+
readonly size?: ResolvedScale | undefined;
|
|
153
|
+
}
|
|
154
|
+
/** An axis tick. */
|
|
155
|
+
interface Tick {
|
|
156
|
+
readonly value: DomainValue;
|
|
157
|
+
/** Position along the axis, in plot pixels. */
|
|
158
|
+
readonly position: number;
|
|
159
|
+
readonly label: string;
|
|
160
|
+
}
|
|
161
|
+
/** Axis ticks, keyed by positional channel. */
|
|
162
|
+
interface ChartTicks {
|
|
163
|
+
readonly x?: ReadonlyArray<Tick> | undefined;
|
|
164
|
+
readonly y?: ReadonlyArray<Tick> | undefined;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Everything an interpreter needs to draw a chart: dimensions, scales,
|
|
168
|
+
* geometry, and ticks. Produced by `computeContext`; pure data plus
|
|
169
|
+
* scale closures, no DOM and no rendering.
|
|
170
|
+
*/
|
|
171
|
+
interface ChartContext {
|
|
172
|
+
readonly dimensions: Dimensions;
|
|
173
|
+
readonly scales: ChartScales;
|
|
174
|
+
readonly geometry: Geometry;
|
|
175
|
+
readonly ticks: ChartTicks;
|
|
176
|
+
}
|
|
177
|
+
/** Options for `computeContext`. */
|
|
178
|
+
interface ComputeContextOptions {
|
|
179
|
+
/** Margin overrides. Defaults: top 20, right 20, bottom 40, left 48. */
|
|
180
|
+
readonly margins?: Partial<Margins> | undefined;
|
|
181
|
+
}
|
|
182
|
+
/** Resolved data rows: what the host passes after resolving any data ref. */
|
|
183
|
+
type DataRows = ReadonlyArray<Datum>;
|
|
184
|
+
/**
|
|
185
|
+
* The Layer 2 entry point: turns (spec, measured box, resolved data) into
|
|
186
|
+
* everything an interpreter needs to draw — dimensions, scales, geometry,
|
|
187
|
+
* and ticks.
|
|
188
|
+
*
|
|
189
|
+
* Pure and synchronous: no DOM, no reactivity, no rendering, no data
|
|
190
|
+
* fetching. When the spec's data is a reference (`data.ref`), the host must
|
|
191
|
+
* resolve it and pass the rows; this function never fetches.
|
|
192
|
+
*
|
|
193
|
+
* @param spec - A parsed portable chart spec.
|
|
194
|
+
* @param box - The measured outer pixel box available to the chart.
|
|
195
|
+
* @param data - Resolved data rows. Optional when the spec carries inline values.
|
|
196
|
+
* @param options - Layout options (margins).
|
|
197
|
+
*
|
|
198
|
+
* @throws {Error} when no data rows are available (spec has a ref and no rows were passed).
|
|
199
|
+
* @throws {TypeError} when a datum value contradicts its channel's declared type.
|
|
200
|
+
*/
|
|
201
|
+
declare function computeContext(spec: ChartSpec, box: Box, data?: DataRows, options?: ComputeContextOptions): ChartContext;
|
|
202
|
+
/**
|
|
203
|
+
* The result of {@link resolveChart}: a validated spec and its geometry, or
|
|
204
|
+
* the message an interpreter shows in place of the chart.
|
|
205
|
+
*/
|
|
206
|
+
type ResolvedChart = {
|
|
207
|
+
readonly kind: 'ready';
|
|
208
|
+
readonly spec: ChartSpec;
|
|
209
|
+
readonly context: ChartContext;
|
|
210
|
+
} | {
|
|
211
|
+
readonly kind: 'error';
|
|
212
|
+
readonly message: string;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Validates a spec and computes its geometry, turning every failure into a
|
|
216
|
+
* message rather than a throw: an invalid spec, a data reference with no
|
|
217
|
+
* resolved rows, or an error from {@link computeContext}. The bundled Svelte
|
|
218
|
+
* `Chart` component is this function plus SVG.
|
|
219
|
+
*/
|
|
220
|
+
declare function resolveChart(spec: unknown, box: Box, data?: DataRows, options?: ComputeContextOptions): ResolvedChart;
|
|
221
|
+
/** Default margins, leaving room for axis ticks and labels. */
|
|
222
|
+
declare const DEFAULT_MARGINS: Margins;
|
|
223
|
+
/**
|
|
224
|
+
* Computes chart dimensions from an outer box and optional margin overrides.
|
|
225
|
+
*
|
|
226
|
+
* Missing margins take their {@link DEFAULT_MARGINS} value. The plot area
|
|
227
|
+
* never goes negative: its width and height are clamped at zero, while the
|
|
228
|
+
* margins are kept as given.
|
|
229
|
+
*/
|
|
230
|
+
declare function computeDimensions(outer: Box, margins?: Partial<Margins>): Dimensions;
|
|
231
|
+
/**
|
|
232
|
+
* A typed field value reconstructed from a datum according to the channel's
|
|
233
|
+
* declared encoding type. `null` means "missing": the datum is skipped by
|
|
234
|
+
* geometry builders.
|
|
235
|
+
*/
|
|
236
|
+
type FieldValue = number | Date | string | null;
|
|
237
|
+
/**
|
|
238
|
+
* Creates a typed accessor for an encoding channel.
|
|
239
|
+
*
|
|
240
|
+
* Values are reconstructed from the channel's **declared** type — never by
|
|
241
|
+
* sniffing the runtime shape of the JSON value (the cross-platform invariant
|
|
242
|
+
* every interpreter must follow):
|
|
243
|
+
*
|
|
244
|
+
* - `quantitative` → finite number
|
|
245
|
+
* - `temporal` → Date, parsed from ISO 8601 strings or epoch milliseconds
|
|
246
|
+
* - `ordinal` / `nominal` → category string (numbers/booleans are stringified)
|
|
247
|
+
*
|
|
248
|
+
* Missing fields and nulls yield `null`. Values that contradict the declared
|
|
249
|
+
* type throw: a declared type is a contract, and violating it is a data error
|
|
250
|
+
* the caller must surface, not hide.
|
|
251
|
+
*/
|
|
252
|
+
declare function makeAccessor(channel: Channel): (datum: Datum) => FieldValue;
|
|
253
|
+
/**
|
|
254
|
+
* Default categorical palette (Tableau 10). Interpreters may override; the
|
|
255
|
+
* core resolves concrete colours so geometry is directly drawable.
|
|
256
|
+
*/
|
|
257
|
+
declare const CATEGORICAL_PALETTE: ReadonlyArray<string>;
|
|
258
|
+
/** Default radius range (pixels) for the size channel on point marks. */
|
|
259
|
+
declare const DEFAULT_RADIUS_RANGE: readonly [number, number];
|
|
260
|
+
/** Default point radius when no size encoding is present. */
|
|
261
|
+
declare const DEFAULT_POINT_RADIUS = 4;
|
|
262
|
+
/**
|
|
263
|
+
* A positional scale bundle: the serialisable ResolvedScale plus the
|
|
264
|
+
* underlying d3 scale, which tick computation and the geometry builders read.
|
|
265
|
+
*/
|
|
266
|
+
type PositionalScale = {
|
|
267
|
+
readonly kind: 'linear';
|
|
268
|
+
readonly resolved: ResolvedScale;
|
|
269
|
+
readonly d3: ScaleLinear<number, number>;
|
|
270
|
+
} | {
|
|
271
|
+
readonly kind: 'utc';
|
|
272
|
+
readonly resolved: ResolvedScale;
|
|
273
|
+
readonly d3: ScaleTime<number, number>;
|
|
274
|
+
} | {
|
|
275
|
+
readonly kind: 'band';
|
|
276
|
+
readonly resolved: ResolvedScale;
|
|
277
|
+
readonly d3: ScaleBand<string>;
|
|
278
|
+
} | {
|
|
279
|
+
readonly kind: 'point';
|
|
280
|
+
readonly resolved: ResolvedScale;
|
|
281
|
+
readonly d3: ScalePoint<string>;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Resolves a positional (x or y) scale from a channel's declared type.
|
|
285
|
+
*
|
|
286
|
+
* - `quantitative` → linear
|
|
287
|
+
* - `temporal` → UTC time (UTC for cross-platform determinism)
|
|
288
|
+
* - `ordinal`/`nominal` → band for bar marks (bars need bandwidth),
|
|
289
|
+
* point for line/point/area marks (single positions)
|
|
290
|
+
*/
|
|
291
|
+
declare function resolvePositionalScale(channel: Channel, mark: Mark, pixelRange: readonly [number, number], data: DataRows, hint?: ScaleHint, rangeEnd?: Channel): PositionalScale;
|
|
292
|
+
/**
|
|
293
|
+
* Resolves the colour scale for a colour channel.
|
|
294
|
+
*
|
|
295
|
+
* - `ordinal`/`nominal` → categorical palette
|
|
296
|
+
* - `quantitative`/`temporal` → normalised [0, 1] linear scale; interpreters
|
|
297
|
+
* map the normalised value onto their own gradient
|
|
298
|
+
*/
|
|
299
|
+
declare function resolveColorScale(channel: Channel, data: DataRows): ResolvedScale;
|
|
300
|
+
/**
|
|
301
|
+
* Resolves the size scale for point marks: quantitative values map onto a
|
|
302
|
+
* radius range with square-root scaling so symbol *area* is proportional to
|
|
303
|
+
* the value.
|
|
304
|
+
*/
|
|
305
|
+
declare function resolveSizeScale(channel: Channel, data: DataRows): ResolvedScale;
|
|
306
|
+
/** Default tick count for continuous scales. */
|
|
307
|
+
declare const DEFAULT_TICK_COUNT = 5;
|
|
308
|
+
/**
|
|
309
|
+
* Computes axis ticks for a positional scale.
|
|
310
|
+
*
|
|
311
|
+
* - Continuous scales (linear, UTC) use d3's tick generation and formatting.
|
|
312
|
+
* UTC formatting is deterministic across machines and time zones.
|
|
313
|
+
* - Categorical scales (band, point) emit one tick per category, centred on
|
|
314
|
+
* the band.
|
|
315
|
+
*/
|
|
316
|
+
declare function computeTicks(scale: PositionalScale, count?: number): Tick[];
|
|
317
|
+
/** Builds line chart geometry: one series per colour category, each with points and an SVG path. */
|
|
318
|
+
declare function buildLineGeometry(args: {
|
|
319
|
+
readonly data: DataRows;
|
|
320
|
+
readonly x: Channel;
|
|
321
|
+
readonly y: Channel;
|
|
322
|
+
readonly xScale: PositionalScale;
|
|
323
|
+
readonly yScale: PositionalScale;
|
|
324
|
+
readonly color?: Channel | undefined;
|
|
325
|
+
readonly colorScale?: ResolvedScale | undefined;
|
|
326
|
+
}): LineGeometry;
|
|
327
|
+
/**
|
|
328
|
+
* Builds area chart geometry: like a line, but each series path is closed
|
|
329
|
+
* down to the zero baseline (or the bottom of the plot when zero is not in
|
|
330
|
+
* the y domain).
|
|
331
|
+
*/
|
|
332
|
+
declare function buildAreaGeometry(args: {
|
|
333
|
+
readonly data: DataRows;
|
|
334
|
+
readonly x: Channel;
|
|
335
|
+
readonly y: Channel;
|
|
336
|
+
readonly xScale: PositionalScale;
|
|
337
|
+
readonly yScale: PositionalScale;
|
|
338
|
+
readonly color?: Channel | undefined;
|
|
339
|
+
readonly colorScale?: ResolvedScale | undefined;
|
|
340
|
+
}): AreaGeometry;
|
|
341
|
+
/** What {@link buildBarGeometry} takes. */
|
|
342
|
+
interface BarArgs {
|
|
343
|
+
readonly data: DataRows;
|
|
344
|
+
readonly x: Channel;
|
|
345
|
+
readonly y: Channel;
|
|
346
|
+
readonly xScale: PositionalScale;
|
|
347
|
+
readonly yScale: PositionalScale;
|
|
348
|
+
readonly color?: Channel | undefined;
|
|
349
|
+
readonly colorScale?: ResolvedScale | undefined;
|
|
350
|
+
/** Spec 1.1: the end of a range on x; each bar spans `x` to `x2`. */
|
|
351
|
+
readonly x2?: Channel | undefined;
|
|
352
|
+
/** Spec 1.1: the end of a range on y; each bar spans `y` to `y2`. */
|
|
353
|
+
readonly y2?: Channel | undefined;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Builds bar chart geometry. Bars grow from the zero baseline, so negative
|
|
357
|
+
* values produce bars below it. Band x-scales give bars their bandwidth;
|
|
358
|
+
* continuous x-scales get a derived width. With a range channel (`x2` or
|
|
359
|
+
* `y2`, spec 1.1) each bar spans from its start to its end instead: a
|
|
360
|
+
* horizontal range bar (a Gantt row) for `x2`, a vertical one for `y2`.
|
|
361
|
+
*/
|
|
362
|
+
declare function buildBarGeometry(args: BarArgs): BarGeometry;
|
|
363
|
+
/** Builds scatter/point chart geometry: one circle per datum. */
|
|
364
|
+
declare function buildPointGeometry(args: {
|
|
365
|
+
readonly data: DataRows;
|
|
366
|
+
readonly x: Channel;
|
|
367
|
+
readonly y: Channel;
|
|
368
|
+
readonly xScale: PositionalScale;
|
|
369
|
+
readonly yScale: PositionalScale;
|
|
370
|
+
readonly color?: Channel | undefined;
|
|
371
|
+
readonly colorScale?: ResolvedScale | undefined;
|
|
372
|
+
readonly size?: Channel | undefined;
|
|
373
|
+
readonly sizeScale?: ResolvedScale | undefined;
|
|
374
|
+
}): PointGeometry;
|
|
375
|
+
/**
|
|
376
|
+
* The inline style every interpreter puts on a tree's nested-list text
|
|
377
|
+
* alternative: in the accessibility tree, out of sight (the classic
|
|
378
|
+
* visually-hidden pattern, inline because these interpreters ship no CSS).
|
|
379
|
+
*/
|
|
380
|
+
declare const VISUALLY_HIDDEN_STYLE = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";
|
|
381
|
+
/** The text of one outline entry: its label, then its colour category in words. */
|
|
382
|
+
declare function outlineText(node: {
|
|
383
|
+
readonly label: string;
|
|
384
|
+
readonly category: string | undefined;
|
|
385
|
+
}): string;
|
|
386
|
+
/**
|
|
387
|
+
* Builds a `tree` mark's geometry (spec 1.1): node boxes, the links between
|
|
388
|
+
* them and the nested outline the interpreters render as the accessible
|
|
389
|
+
* text alternative. Pure and DOM-free; label widths are estimated from
|
|
390
|
+
* character counts, as the pure path's tick layout does.
|
|
391
|
+
*
|
|
392
|
+
* @throws {Error} on a duplicate or missing id, an unknown parent, or a cycle; the message names the row.
|
|
393
|
+
*/
|
|
394
|
+
declare function buildTreeGeometry(args: {
|
|
395
|
+
readonly data: DataRows;
|
|
396
|
+
readonly plot: Box;
|
|
397
|
+
readonly id: Channel;
|
|
398
|
+
readonly parent: Channel;
|
|
399
|
+
readonly label?: Channel | undefined;
|
|
400
|
+
readonly color?: Channel | undefined;
|
|
401
|
+
readonly colorScale?: ResolvedScale | undefined;
|
|
402
|
+
readonly options?: TreeOptions | undefined;
|
|
403
|
+
}): TreeGeometry;
|
|
404
|
+
export { Dimensions as A, LineGeometry as B, computeContext as C, ChartTicks as D, ChartScales as E, Tick as F, TreeGeometry as G, PointGeometry as H, AreaGeometry as I, TreeOutlineNode as J, TreeLink as K, BarGeometry as L, Margins as M, ResolvedScale as N, ComputeContextOptions as O, ScaleKind as P, BarRect as R, resolveChart as S, ChartContext as T, Series as U, PointCircle as V, SeriesPoint as W, FieldValue as _, buildBarGeometry as a, computeDimensions as b, DEFAULT_TICK_COUNT as c, DEFAULT_POINT_RADIUS as d, DEFAULT_RADIUS_RANGE as f, resolveSizeScale as g, resolvePositionalScale as h, buildPointGeometry as i, DomainValue as j, DataRows as k, computeTicks as l, resolveColorScale as m, buildTreeGeometry as n, buildAreaGeometry as o, PositionalScale as p, TreeNodeBox as q, outlineText as r, buildLineGeometry as s, VISUALLY_HIDDEN_STYLE as t, CATEGORICAL_PALETTE as u, makeAccessor as v, Box as w, ResolvedChart as x, DEFAULT_MARGINS as y, Geometry as z };
|
|
405
|
+
//# sourceMappingURL=index-B32E5tbG.d.mts.map
|