@photon-ai/pho-ui 4.9.0 → 4.10.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/dist/chunks/{bar-chart-ht70KKj3.js → bar-chart-HsoFFaPb.js} +2 -2
- package/dist/chunks/{bar-chart-ht70KKj3.js.map → bar-chart-HsoFFaPb.js.map} +1 -1
- package/dist/chunks/chart-BrIXaMue.js +1365 -0
- package/dist/chunks/chart-BrIXaMue.js.map +1 -0
- package/dist/chunks/line-chart-Bv25WyGp.js +23 -0
- package/dist/chunks/line-chart-Bv25WyGp.js.map +1 -0
- package/dist/components/bar-chart.js +1 -1
- package/dist/components/chart.js +1 -1
- package/dist/components/line-chart.js +1 -1
- package/dist/index.js +3 -3
- package/dist/src/components/chart/chart.d.ts +1 -1
- package/dist/src/components/chart/index.d.ts +1 -1
- package/dist/src/components/chart/tooltip.d.ts +4 -2
- package/dist/src/components/chart/types.d.ts +14 -0
- package/dist/src/components/line-chart/index.d.ts +1 -1
- package/dist/src/components/line-chart/line-chart.d.ts +10 -4
- package/package.json +1 -1
- package/dist/chunks/chart-B5c8gmlj.js +0 -1338
- package/dist/chunks/chart-B5c8gmlj.js.map +0 -1
- package/dist/chunks/line-chart-Cm_Ac7f4.js +0 -22
- package/dist/chunks/line-chart-Cm_Ac7f4.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chart-B5c8gmlj.js","names":[],"sources":["../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js","../../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/monotone.js","../../src/components/chart/color.ts","../../src/components/chart/format.ts","../../src/components/chart/legend.tsx","../../../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ascending.js","../../../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/descending.js","../../../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisector.js","../../../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ticks.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/interval.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/millisecond.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/duration.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/second.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/minute.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/hour.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/day.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/week.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/month.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/year.js","../../../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/ticks.js","../../src/components/chart/scale.ts","../../src/components/chart/shell.tsx","../../src/components/chart/skeleton.tsx","../../src/components/chart/theme.ts","../../src/components/chart/tooltip.tsx","../../src/components/chart/use-measure.ts","../../src/components/chart/chart.tsx"],"sourcesContent":["function Linear(context) {\n this._context = context;\n}\n\nLinear.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; // falls through\n default: this._context.lineTo(x, y); break;\n }\n }\n};\n\nexport default function(context) {\n return new Linear(context);\n}\n","function sign(x) {\n return x < 0 ? -1 : 1;\n}\n\n// Calculate the slopes of the tangents (Hermite-type interpolation) based on\n// the following paper: Steffen, M. 1990. A Simple Method for Monotonic\n// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.\n// NOV(II), P. 443, 1990.\nfunction slope3(that, x2, y2) {\n var h0 = that._x1 - that._x0,\n h1 = x2 - that._x1,\n s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),\n s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),\n p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;\n}\n\n// Calculate a one-sided slope.\nfunction slope2(that, t) {\n var h = that._x1 - that._x0;\n return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;\n}\n\n// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations\n// \"you can express cubic Hermite interpolation in terms of cubic Bézier curves\n// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1\".\nfunction point(that, t0, t1) {\n var x0 = that._x0,\n y0 = that._y0,\n x1 = that._x1,\n y1 = that._y1,\n dx = (x1 - x0) / 3;\n that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);\n}\n\nfunction MonotoneX(context) {\n this._context = context;\n}\n\nMonotoneX.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 =\n this._y0 = this._y1 =\n this._t0 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x1, this._y1); break;\n case 3: point(this, this._t0, slope2(this, this._t0)); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n var t1 = NaN;\n\n x = +x, y = +y;\n if (x === this._x1 && y === this._y1) return; // Ignore coincident points.\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; break;\n case 2: this._point = 3; point(this, slope2(this, t1 = slope3(this, x, y)), t1); break;\n default: point(this, this._t0, t1 = slope3(this, x, y)); break;\n }\n\n this._x0 = this._x1, this._x1 = x;\n this._y0 = this._y1, this._y1 = y;\n this._t0 = t1;\n }\n}\n\nfunction MonotoneY(context) {\n this._context = new ReflectContext(context);\n}\n\n(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {\n MonotoneX.prototype.point.call(this, y, x);\n};\n\nfunction ReflectContext(context) {\n this._context = context;\n}\n\nReflectContext.prototype = {\n moveTo: function(x, y) { this._context.moveTo(y, x); },\n closePath: function() { this._context.closePath(); },\n lineTo: function(x, y) { this._context.lineTo(y, x); },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }\n};\n\nexport function monotoneX(context) {\n return new MonotoneX(context);\n}\n\nexport function monotoneY(context) {\n return new MonotoneY(context);\n}\n","import type { ChartColor } from \"./types\";\n\n/** The categorical slots, in the order series take them. */\nexport const CHART_SLOTS = [\n \"chart-1\",\n \"chart-2\",\n \"chart-3\",\n \"chart-4\",\n \"chart-5\",\n \"chart-6\",\n] as const satisfies ReadonlyArray<ChartColor>;\n\n/**\n * The CSS value for a series colour: the named colour, or the categorical\n * slot at `index` when the series names none. Slots are an ordered,\n * validated set — a seventh series wraps, so fold a long tail into\n * \"Other\" before it gets there.\n */\nexport function chartColor(\n color: ChartColor | undefined,\n index: number,\n): string {\n const name = color ?? CHART_SLOTS[index % CHART_SLOTS.length]!;\n const token = name.startsWith(\"chart-\") ? name : `chart-${name}`;\n return `var(--color-pho-${token})`;\n}\n","import type { ChartDatum } from \"./types\";\n\n/**\n * The default number format: grouped digits for a value someone reads\n * (\"12,001\"), compact for an axis tick (\"12K\") where room is short.\n */\nexport function numberFormatter(\n locale: string | undefined,\n compact = false,\n): (value: number) => string {\n const format = new Intl.NumberFormat(\n locale,\n compact\n ? { notation: \"compact\", maximumFractionDigits: 1 }\n : { maximumFractionDigits: 2 },\n );\n return (value) => format.format(value);\n}\n\n/** A number under a series key, or nothing: missing, null, or not a number. */\nexport function readValue(datum: object, key: string): number | null {\n const value = (datum as Record<string, unknown>)[key];\n return typeof value === \"number\" && Number.isFinite(value) ? value : null;\n}\n\n/** \"Inbound and outbound\", \"p50, p90 and p99\". */\nexport function joinNames(names: ReadonlyArray<string>): string {\n if (names.length <= 1) return names[0] ?? \"\";\n return `${names.slice(0, -1).join(\", \")} and ${names[names.length - 1]}`;\n}\n\nexport interface DescribedSeries {\n key: string;\n label: string;\n /** Bars sum to a total; lines run between a low and a high. */\n kind: \"bar\" | \"line\";\n}\n\ninterface DescribeOptions<T extends ChartDatum> {\n data: ReadonlyArray<T>;\n series: ReadonlyArray<DescribedSeries>;\n valueFormat: (value: number) => string;\n timeFormat: (date: Date) => string;\n}\n\n/**\n * What the figure says about itself to assistive tech: which series, over\n * what range, and for each one the total (bars) or the low and high\n * (lines), plus where it peaked.\n */\nexport function describeChart<T extends ChartDatum>({\n data,\n series,\n valueFormat,\n timeFormat,\n}: DescribeOptions<T>): string {\n if (data.length === 0) return \"No data to show.\";\n const first = data[0]!;\n const last = data[data.length - 1]!;\n const range =\n data.length > 1\n ? `${timeFormat(new Date(first.x))} to ${timeFormat(new Date(last.x))}`\n : timeFormat(new Date(first.x));\n const parts = [`${joinNames(series.map((s) => s.label))}, ${range}.`];\n for (const s of series) {\n let total = 0;\n let min = Infinity;\n let max = -Infinity;\n let peakAt: Date | null = null;\n let seen = 0;\n for (const datum of data) {\n const value = readValue(datum, s.key);\n if (value == null) continue;\n seen++;\n total += value;\n if (value < min) min = value;\n if (value > max) {\n max = value;\n peakAt = new Date(datum.x);\n }\n }\n if (seen === 0) {\n parts.push(`${s.label}: no values.`);\n continue;\n }\n const peak = peakAt\n ? `, peak ${valueFormat(max)} at ${timeFormat(peakAt)}`\n : \"\";\n parts.push(\n s.kind === \"bar\"\n ? `${s.label}: ${valueFormat(total)} in total${peak}.`\n : `${s.label}: from ${valueFormat(min)} to ${valueFormat(max)}${peak}.`,\n );\n }\n return parts.join(\" \");\n}\n","import { type ComponentProps } from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** A legend or tooltip key mirrors its mark: a square for a bar, a stroke for a line. */\nexport type ChartSwatchKind = \"rect\" | \"line\";\n\nexport interface ChartSwatchProps {\n /** A CSS colour value — what `chartColor` returns. */\n color: string;\n kind?: ChartSwatchKind;\n dashed?: boolean;\n}\n\nexport function ChartSwatch({\n color,\n kind = \"rect\",\n dashed,\n}: ChartSwatchProps) {\n if (kind === \"line\") {\n return (\n <svg aria-hidden width=\"14\" height=\"6\" className=\"shrink-0\">\n <line\n x1=\"1\"\n x2=\"13\"\n y1=\"3\"\n y2=\"3\"\n stroke={color}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeDasharray={dashed ? \"3 3\" : undefined}\n />\n </svg>\n );\n }\n return (\n <span\n aria-hidden\n className=\"inline-block size-2 shrink-0 rounded-[2px]\"\n style={{ background: color }}\n />\n );\n}\n\nexport interface ChartLegendItem {\n label: string;\n /** A CSS colour value — what `chartColor` returns. */\n color: string;\n kind?: ChartSwatchKind;\n dashed?: boolean;\n}\n\nexport interface ChartLegendProps extends Omit<\n ComponentProps<\"ul\">,\n \"children\"\n> {\n items: ReadonlyArray<ChartLegendItem>;\n}\n\n/**\n * The legend a chart of two or more series carries below the plot: a key\n * per series, in series order, wrapping when the row runs out. Text stays\n * in the UI ink; the swatch alone carries the colour.\n */\nexport function ChartLegend({ items, className, ...props }: ChartLegendProps) {\n return (\n <ul\n className={cn(\n \"text-pho-secondary flex flex-wrap gap-x-4 gap-y-1 text-xs\",\n className,\n )}\n {...props}\n >\n {items.map((item) => (\n <li key={item.label} className=\"flex items-center gap-1.5\">\n <ChartSwatch\n color={item.color}\n kind={item.kind}\n dashed={item.dashed}\n />\n {item.label}\n </li>\n ))}\n </ul>\n );\n}\n","export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n","import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can’t do this\n // for a comparator (except for specific, known comparators) because we can’t\n // tell if the comparator is symmetric, and an asymmetric comparator can’t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n","const e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction tickSpec(start, stop, count) {\n const step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log10(step)),\n error = step / Math.pow(10, power),\n factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;\n let i1, i2, inc;\n if (power < 0) {\n inc = Math.pow(10, -power) / factor;\n i1 = Math.round(start * inc);\n i2 = Math.round(stop * inc);\n if (i1 / inc < start) ++i1;\n if (i2 / inc > stop) --i2;\n inc = -inc;\n } else {\n inc = Math.pow(10, power) * factor;\n i1 = Math.round(start / inc);\n i2 = Math.round(stop / inc);\n if (i1 * inc < start) ++i1;\n if (i2 * inc > stop) --i2;\n }\n if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);\n return [i1, i2, inc];\n}\n\nexport default function ticks(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n if (!(count > 0)) return [];\n if (start === stop) return [start];\n const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);\n if (!(i2 >= i1)) return [];\n const n = i2 - i1 + 1, ticks = new Array(n);\n if (reverse) {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;\n } else {\n if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;\n else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;\n }\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n return tickSpec(start, stop, count)[2];\n}\n\nexport function tickStep(start, stop, count) {\n stop = +stop, start = +start, count = +count;\n const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);\n}\n","const t0 = new Date, t1 = new Date;\n\nexport function timeInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;\n }\n\n interval.floor = (date) => {\n return floori(date = new Date(+date)), date;\n };\n\n interval.ceil = (date) => {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = (date) => {\n const d0 = interval(date), d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = (date, step) => {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = (start, stop, step) => {\n const range = [];\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n let previous;\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = (test) => {\n return timeInterval((date) => {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, (date, step) => {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = (start, end) => {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = (step) => {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? (d) => field(d) % step === 0\n : (d) => interval.count(0, d) % step === 0);\n };\n }\n\n return interval;\n}\n","import {timeInterval} from \"./interval.js\";\n\nexport const millisecond = timeInterval(() => {\n // noop\n}, (date, step) => {\n date.setTime(+date + step);\n}, (start, end) => {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = (k) => {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return timeInterval((date) => {\n date.setTime(Math.floor(date / k) * k);\n }, (date, step) => {\n date.setTime(+date + step * k);\n }, (start, end) => {\n return (end - start) / k;\n });\n};\n\nexport const milliseconds = millisecond.range;\n","export const durationSecond = 1000;\nexport const durationMinute = durationSecond * 60;\nexport const durationHour = durationMinute * 60;\nexport const durationDay = durationHour * 24;\nexport const durationWeek = durationDay * 7;\nexport const durationMonth = durationDay * 30;\nexport const durationYear = durationDay * 365;\n","import {timeInterval} from \"./interval.js\";\nimport {durationSecond} from \"./duration.js\";\n\nexport const second = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds());\n}, (date, step) => {\n date.setTime(+date + step * durationSecond);\n}, (start, end) => {\n return (end - start) / durationSecond;\n}, (date) => {\n return date.getUTCSeconds();\n});\n\nexport const seconds = second.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeMinute = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getMinutes();\n});\n\nexport const timeMinutes = timeMinute.range;\n\nexport const utcMinute = timeInterval((date) => {\n date.setUTCSeconds(0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationMinute);\n}, (start, end) => {\n return (end - start) / durationMinute;\n}, (date) => {\n return date.getUTCMinutes();\n});\n\nexport const utcMinutes = utcMinute.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationHour, durationMinute, durationSecond} from \"./duration.js\";\n\nexport const timeHour = timeInterval((date) => {\n date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getHours();\n});\n\nexport const timeHours = timeHour.range;\n\nexport const utcHour = timeInterval((date) => {\n date.setUTCMinutes(0, 0, 0);\n}, (date, step) => {\n date.setTime(+date + step * durationHour);\n}, (start, end) => {\n return (end - start) / durationHour;\n}, (date) => {\n return date.getUTCHours();\n});\n\nexport const utcHours = utcHour.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationDay, durationMinute} from \"./duration.js\";\n\nexport const timeDay = timeInterval(\n date => date.setHours(0, 0, 0, 0),\n (date, step) => date.setDate(date.getDate() + step),\n (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,\n date => date.getDate() - 1\n);\n\nexport const timeDays = timeDay.range;\n\nexport const utcDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return date.getUTCDate() - 1;\n});\n\nexport const utcDays = utcDay.range;\n\nexport const unixDay = timeInterval((date) => {\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step);\n}, (start, end) => {\n return (end - start) / durationDay;\n}, (date) => {\n return Math.floor(date / durationDay);\n});\n\nexport const unixDays = unixDay.range;\n","import {timeInterval} from \"./interval.js\";\nimport {durationMinute, durationWeek} from \"./duration.js\";\n\nfunction timeWeekday(i) {\n return timeInterval((date) => {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setDate(date.getDate() + step * 7);\n }, (start, end) => {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport const timeSunday = timeWeekday(0);\nexport const timeMonday = timeWeekday(1);\nexport const timeTuesday = timeWeekday(2);\nexport const timeWednesday = timeWeekday(3);\nexport const timeThursday = timeWeekday(4);\nexport const timeFriday = timeWeekday(5);\nexport const timeSaturday = timeWeekday(6);\n\nexport const timeSundays = timeSunday.range;\nexport const timeMondays = timeMonday.range;\nexport const timeTuesdays = timeTuesday.range;\nexport const timeWednesdays = timeWednesday.range;\nexport const timeThursdays = timeThursday.range;\nexport const timeFridays = timeFriday.range;\nexport const timeSaturdays = timeSaturday.range;\n\nfunction utcWeekday(i) {\n return timeInterval((date) => {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, (start, end) => {\n return (end - start) / durationWeek;\n });\n}\n\nexport const utcSunday = utcWeekday(0);\nexport const utcMonday = utcWeekday(1);\nexport const utcTuesday = utcWeekday(2);\nexport const utcWednesday = utcWeekday(3);\nexport const utcThursday = utcWeekday(4);\nexport const utcFriday = utcWeekday(5);\nexport const utcSaturday = utcWeekday(6);\n\nexport const utcSundays = utcSunday.range;\nexport const utcMondays = utcMonday.range;\nexport const utcTuesdays = utcTuesday.range;\nexport const utcWednesdays = utcWednesday.range;\nexport const utcThursdays = utcThursday.range;\nexport const utcFridays = utcFriday.range;\nexport const utcSaturdays = utcSaturday.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const timeMonth = timeInterval((date) => {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setMonth(date.getMonth() + step);\n}, (start, end) => {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, (date) => {\n return date.getMonth();\n});\n\nexport const timeMonths = timeMonth.range;\n\nexport const utcMonth = timeInterval((date) => {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, (start, end) => {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, (date) => {\n return date.getUTCMonth();\n});\n\nexport const utcMonths = utcMonth.range;\n","import {timeInterval} from \"./interval.js\";\n\nexport const timeYear = timeInterval((date) => {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setFullYear(date.getFullYear() + step);\n}, (start, end) => {\n return end.getFullYear() - start.getFullYear();\n}, (date) => {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\ntimeYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport const timeYears = timeYear.range;\n\nexport const utcYear = timeInterval((date) => {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, (start, end) => {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, (date) => {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = (k) => {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, (date, step) => {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport const utcYears = utcYear.range;\n","import {bisector, tickStep} from \"d3-array\";\nimport {durationDay, durationHour, durationMinute, durationMonth, durationSecond, durationWeek, durationYear} from \"./duration.js\";\nimport {millisecond} from \"./millisecond.js\";\nimport {second} from \"./second.js\";\nimport {timeMinute, utcMinute} from \"./minute.js\";\nimport {timeHour, utcHour} from \"./hour.js\";\nimport {timeDay, unixDay} from \"./day.js\";\nimport {timeSunday, utcSunday} from \"./week.js\";\nimport {timeMonth, utcMonth} from \"./month.js\";\nimport {timeYear, utcYear} from \"./year.js\";\n\nfunction ticker(year, month, week, day, hour, minute) {\n\n const tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function ticks(start, stop, count) {\n const reverse = stop < start;\n if (reverse) [start, stop] = [stop, start];\n const interval = count && typeof count.range === \"function\" ? count : tickInterval(start, stop, count);\n const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop\n return reverse ? ticks.reverse() : ticks;\n }\n\n function tickInterval(start, stop, count) {\n const target = Math.abs(stop - start) / count;\n const i = bisector(([,, step]) => step).right(tickIntervals, target);\n if (i === tickIntervals.length) return year.every(tickStep(start / durationYear, stop / durationYear, count));\n if (i === 0) return millisecond.every(Math.max(tickStep(start, stop, count), 1));\n const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n return t.every(step);\n }\n\n return [ticks, tickInterval];\n}\n\nconst [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);\nconst [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);\n\nexport {utcTicks, utcTickInterval, timeTicks, timeTickInterval};\n","import { tickStep, ticks } from \"d3-array\";\nimport { timeDay, timeTicks, timeYear } from \"d3-time\";\n\n/** Epoch milliseconds for a datum's `x`. */\nexport function toTime(x: Date | number): number {\n return typeof x === \"number\" ? x : x.getTime();\n}\n\n/**\n * A y domain on round numbers with three to five ticks, the last tick on\n * or above the data's high end so the top of the plot is labelled.\n * `count` is the tick count that produced them, for a scale's `.ticks()`.\n *\n * When `integer` is set — or when both ends are whole numbers — the step\n * stays ≥ 1 so a count axis never labels 0.5 / 1.5.\n */\nexport function niceLinearDomain(\n min: number,\n max: number,\n options?: { integer?: boolean },\n): { domain: [number, number]; ticks: number[]; count: number } {\n if (!Number.isFinite(min) || !Number.isFinite(max)) {\n return { domain: [0, 1], ticks: [0, 1], count: 1 };\n }\n if (min > max) [min, max] = [max, min];\n const integer =\n options?.integer ?? (Number.isInteger(min) && Number.isInteger(max));\n if (min === max) {\n // A flat series still needs room to sit in.\n if (max === 0) {\n return integer\n ? { domain: [0, 1], ticks: [0, 1], count: 1 }\n : { domain: [0, 1], ticks: [0, 0.5, 1], count: 2 };\n }\n if (max > 0) min = 0;\n else max = 0;\n }\n for (let count = 4; count >= 2; count--) {\n const step = integer\n ? wholeTickStep(min, max, count)\n : tickStep(min, max, count);\n const lo = Math.floor(min / step) * step;\n const hi = Math.ceil(max / step) * step;\n const values = integer ? rangeTicks(lo, hi, step) : ticks(lo, hi, count);\n if (values.length <= 5 || count === 2) {\n // A whole-number step can differ from d3's own for `count`; the\n // interval count asks a scale for the same lines back.\n return {\n domain: [lo, hi],\n ticks: values,\n count: integer ? Math.max(1, values.length - 1) : count,\n };\n }\n }\n return { domain: [min, max], ticks: [min, max], count: 1 };\n}\n\n/** A 1-2-5 step that is never a fraction. */\nfunction wholeTickStep(min: number, max: number, count: number): number {\n const raw = tickStep(min, max, count);\n if (raw <= 1) return 1;\n if (Number.isInteger(raw)) return raw;\n const exp = Math.floor(Math.log10(raw));\n const mag = 10 ** exp;\n const n = raw / mag;\n const nice = n <= 1 ? 1 : n <= 2 ? 2 : n <= 5 ? 5 : 10;\n return nice * mag;\n}\n\nfunction rangeTicks(lo: number, hi: number, step: number): number[] {\n const values: number[] = [];\n for (let at = lo; at <= hi + step / 2; at += step) values.push(at);\n return values;\n}\n\n/** The gap between buckets, in ms — the median step, so one hole doesn't skew it. */\nexport function bucketSpan(times: ReadonlyArray<number>): number {\n if (times.length < 2) return 0;\n const steps = [];\n for (let i = 1; i < times.length; i++) steps.push(times[i]! - times[i - 1]!);\n steps.sort((a, b) => a - b);\n return steps[Math.floor(steps.length / 2)]!;\n}\n\nconst DAY = 86_400_000;\n\n/**\n * Time ticks for a plot `width` px wide: one every ~96px, on the round\n * boundaries d3-time picks (5 minutes, an hour, a day, a month…).\n */\nexport function timeAxisTicks(\n start: number,\n stop: number,\n width: number,\n): Date[] {\n if (stop <= start || width <= 0) return [new Date(start)];\n const count = Math.max(2, Math.floor(width / 96));\n const chosen = timeTicks(new Date(start), new Date(stop), count);\n // d3's every-nth-day interval counts from the first of the month, so a\n // two-day step reads Aug 29, Aug 31, Sep 1, Sep 3. Re-step multi-day\n // ticks evenly from the first one instead.\n if (chosen.length > 2 && chosen.every((t) => isMidnight(t))) {\n const gaps = chosen.slice(1).map((t, i) => timeDay.count(chosen[i]!, t));\n const step = Math.max(...gaps);\n if (step > 1 && gaps.some((gap) => gap !== step)) {\n return timeDay.range(chosen[0]!, new Date(stop + 1), step);\n }\n }\n return chosen;\n}\n\nfunction isMidnight(date: Date): boolean {\n return timeDay(date).getTime() === date.getTime();\n}\n\n/**\n * Labels a tick by the boundary it sits on: a time within a day, a date at\n * midnight, month and year at a new year. `Intl` does the wording, so the\n * labels follow the locale.\n */\nexport function timeTickFormatter(locale?: string): (date: Date) => string {\n const time = new Intl.DateTimeFormat(locale, {\n hour: \"numeric\",\n minute: \"2-digit\",\n });\n const day = new Intl.DateTimeFormat(locale, {\n month: \"short\",\n day: \"numeric\",\n });\n const year = new Intl.DateTimeFormat(locale, {\n month: \"short\",\n year: \"numeric\",\n });\n return (date) => {\n if (timeDay(date).getTime() < date.getTime()) return time.format(date);\n if (timeYear(date).getTime() < date.getTime()) return day.format(date);\n return year.format(date);\n };\n}\n\n/**\n * The tooltip's heading for a bucket: the date alone when buckets are a\n * day or longer, date and time below that.\n */\nexport function bucketTimeFormatter(\n locale: string | undefined,\n span: number,\n): (date: Date) => string {\n const format = new Intl.DateTimeFormat(\n locale,\n span >= DAY\n ? { month: \"short\", day: \"numeric\" }\n : { month: \"short\", day: \"numeric\", hour: \"numeric\", minute: \"2-digit\" },\n );\n return (date) => format.format(date);\n}\n\n/** Estimated width of a tick label at the axis's 11px, with breathing room. */\nfunction labelWidth(label: string): number {\n return label.length * 6.5 + 16;\n}\n\n/** Keep every nth tick so the labels fit the width without touching. */\nexport function thinTicks<T>(\n values: ReadonlyArray<T>,\n labelOf: (value: T) => string,\n width: number,\n): T[] {\n if (values.length < 2) return [...values];\n const widest = Math.max(...values.map((value) => labelWidth(labelOf(value))));\n const fit = Math.max(1, Math.floor(width / widest));\n const every = Math.ceil(values.length / fit);\n if (every <= 1) return [...values];\n return values.filter((_, index) => index % every === 0);\n}\n\n/** The index of the position nearest `px` in an ascending list. */\nexport function nearestIndex(positions: ReadonlyArray<number>, px: number) {\n if (positions.length === 0) return -1;\n let lo = 0;\n let hi = positions.length - 1;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (positions[mid]! < px) lo = mid + 1;\n else hi = mid;\n }\n if (lo > 0 && px - positions[lo - 1]! < positions[lo]! - px) return lo - 1;\n return lo;\n}\n","import {\n useId,\n type ComponentProps,\n type CSSProperties,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** The bands around the plot, and the inner box the marks draw in. */\nexport interface ChartLayout {\n width: number;\n height: number;\n left: number;\n top: number;\n right: number;\n bottom: number;\n innerWidth: number;\n innerHeight: number;\n /** The same bands in the shape visx takes. */\n margin: { top: number; right: number; bottom: number; left: number };\n}\n\nconst TOP = 8;\nconst RIGHT = 8;\nconst X_AXIS = 22;\n\n/** The plot's box for a measured width and the y-axis labels it must fit. */\nexport function chartLayout(\n width: number,\n height: number,\n yLabels: ReadonlyArray<string>,\n): ChartLayout {\n const widest = yLabels.reduce((max, label) => Math.max(max, label.length), 0);\n const left = Math.ceil(widest * 6.5) + 10;\n const bottom = height - X_AXIS;\n return {\n width,\n height,\n left,\n top: TOP,\n right: width - RIGHT,\n bottom,\n innerWidth: Math.max(0, width - left - RIGHT),\n innerHeight: Math.max(0, bottom - TOP),\n margin: { top: TOP, right: RIGHT, bottom: X_AXIS, left },\n };\n}\n\n/**\n * The surface a stacked segment's gap is cut in: the nearest registered\n * surface, the card by default. Read once here so the stroke below and\n * the hover rings agree.\n */\nconst SURFACE_STYLE = {\n \"--pho-chart-surface\":\n \"var(--pho-surface, var(--background-color-pho-primary))\",\n} as CSSProperties;\n\nexport interface ChartShellProps extends Omit<\n ComponentProps<\"div\">,\n \"children\"\n> {\n /** The figure's `aria-label`. */\n label: string;\n /** The figure's spoken summary. */\n description: string;\n height: number;\n containerRef: RefObject<HTMLDivElement | null>;\n legend?: ReactNode;\n loading?: boolean;\n empty?: ReactNode;\n /** The frame says `empty` instead of drawing. */\n showEmpty?: boolean;\n /** What stands in for the plot while the first data is on its way. */\n placeholder?: ReactNode;\n /**\n * The figure itself — the svg and its tooltip. Presentational to\n * assistive tech: the frame's label and description speak for it.\n */\n children?: ReactNode;\n}\n\n/**\n * The frame every chart draws in: a fixed-height plot box holding the\n * figure (`role=\"img\"`, labelled and described for assistive tech), the\n * legend on its own line below. Width comes from the parent; `height`\n * covers the plot and the x-axis band, so a card never grows a nested\n * scroll.\n */\nexport function ChartShell({\n label,\n description,\n height,\n containerRef,\n legend,\n loading,\n empty,\n showEmpty,\n placeholder,\n className,\n children,\n ...props\n}: ChartShellProps) {\n const descriptionId = useId();\n return (\n <div\n data-chart=\"\"\n className={cn(\"flex w-full min-w-0 flex-col gap-3\", className)}\n {...props}\n >\n <div\n ref={containerRef}\n aria-busy={loading || undefined}\n className={cn(\n \"relative w-full transition-opacity duration-150 ease-out\",\n loading && \"opacity-50\",\n )}\n style={{ height }}\n >\n <div\n // A drawn figure is `role=\"img\"`; there is no <img> to reach\n // for, and the svg is visx's, so the role sits on its box.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"img\"\n aria-label={label}\n aria-describedby={descriptionId}\n // The 2px gap between stacked segments is a stroke in the\n // surface colour on every segment: one pixel shaved off each\n // side of a boundary, and nothing drawn that isn't surface.\n className=\"animate-pho-chart-in relative size-full select-none [&_.visx-bar-stack_.visx-bar]:stroke-(--pho-chart-surface) [&_.visx-bar-stack_.visx-bar]:stroke-2 [&_svg]:block [&_svg]:overflow-visible\"\n style={SURFACE_STYLE}\n >\n {children}\n </div>\n <p id={descriptionId} className=\"sr-only\">\n {description}\n </p>\n {placeholder}\n {showEmpty && (\n <div className=\"text-pho-description absolute inset-0 flex items-center justify-center text-xs\">\n {empty}\n </div>\n )}\n </div>\n {legend}\n </div>\n );\n}\n","import { Skeleton } from \"../skeleton\";\nimport { cn } from \"../../utils/cn\";\nimport type { ChartLayout } from \"./shell\";\n\n/**\n * Heights for the column bones, as a share of the plot: a made-up week\n * or two that reads as a chart without pretending to be one. Fixed, so\n * the placeholder is the same on the server and the browser.\n */\nconst BARS = [\n 0.42, 0.58, 0.5, 0.7, 0.62, 0.8, 0.66, 0.9, 0.72, 0.56, 0.76, 0.64,\n];\n\n/** The grid rows, as a share of the plot from the top; the last is the baseline. */\nconst ROWS = [0, 1 / 3, 2 / 3, 1];\n\n/** Time labels along the bottom band. */\nconst X_LABELS = 5;\n\n/**\n * Bones in the shape of a chart, for a first load with nothing to hold:\n * the frame's own coordinate system — hairline rows, a baseline, a label\n * bone at every row on the left and a few along the bottom — with a\n * dozen columns standing on the baseline in the plot's box. A refetch\n * never shows this; the chart keeps its last render at half opacity.\n */\nexport function ChartSkeleton({ layout }: { layout: ChartLayout }) {\n const { margin } = layout;\n return (\n <div\n aria-hidden\n data-chart-skeleton=\"\"\n className=\"absolute inset-0 grid\"\n style={{\n gridTemplateColumns: `${margin.left}px 1fr ${margin.right}px`,\n gridTemplateRows: `${margin.top}px 1fr ${margin.bottom}px`,\n }}\n >\n <div className=\"relative col-start-1 row-start-2\">\n {ROWS.map((share) => (\n <Skeleton\n key={share}\n data-bone=\"y\"\n className=\"absolute right-2 h-2.5 w-4 -translate-y-1/2\"\n style={{ top: `${share * 100}%` }}\n />\n ))}\n </div>\n <div className=\"relative col-start-2 row-start-2\">\n {ROWS.map((share, index) => (\n <div\n key={share}\n data-bone={index === ROWS.length - 1 ? \"baseline\" : \"grid\"}\n className={cn(\n \"absolute inset-x-0 border-t\",\n index === ROWS.length - 1\n ? \"border-pho-chart-crosshair\"\n : \"border-pho-chart-grid\",\n )}\n style={{ top: `${share * 100}%` }}\n />\n ))}\n <div className=\"absolute inset-0 flex items-end justify-between gap-2\">\n {BARS.map((share, index) => (\n <Skeleton\n key={index}\n data-bone=\"bar\"\n className=\"w-full max-w-6 rounded-t-[4px] rounded-b-none\"\n style={{ height: `${share * 100}%` }}\n />\n ))}\n </div>\n </div>\n <div className=\"col-start-2 row-start-3 flex items-center justify-between px-1\">\n {Array.from({ length: X_LABELS }, (_, index) => (\n <Skeleton key={index} data-bone=\"x\" className=\"h-2.5 w-8\" />\n ))}\n </div>\n </div>\n );\n}\n","import { buildChartTheme, type XYChartTheme } from \"@visx/xychart\";\n\n/**\n * The tick label: the axis's 11px in description ink, tabular so a column\n * of numbers lines up, in the page's own font rather than visx's stack.\n */\nconst LABEL = {\n fontFamily: \"inherit\",\n fontSize: 11,\n fontWeight: 400,\n letterSpacing: 0,\n fill: \"var(--text-color-pho-description)\",\n style: { fontVariantNumeric: \"tabular-nums\" },\n} as const;\n\n/**\n * The visx theme for a chart's furniture: gridlines one step off the\n * surface, description-ink ticks, and the series colours in part order\n * as the fallback palette. Everything is a CSS custom property, so the\n * theme follows light and dark without a second copy.\n */\nexport function buildPhoTheme(colors: ReadonlyArray<string>): XYChartTheme {\n return buildChartTheme({\n backgroundColor: \"var(--pho-surface, var(--background-color-pho-primary))\",\n colors: [...colors],\n gridColor: \"var(--color-pho-chart-grid)\",\n gridColorDark: \"var(--color-pho-chart-crosshair)\",\n // Labels hang this far off the plot; the tick lines themselves are hidden.\n tickLength: 4,\n svgLabelSmall: LABEL,\n svgLabelBig: LABEL,\n htmlLabel: {\n fontFamily: \"inherit\",\n fontSize: 11,\n fontWeight: 400,\n letterSpacing: 0,\n color: \"var(--text-color-pho-description)\",\n },\n });\n}\n","import { type ReactNode } from \"react\";\nimport { ChartSwatch, type ChartSwatchKind } from \"./legend\";\nimport type { ChartBreakdownItem } from \"./types\";\n\nexport interface ChartTooltipRow {\n label: string;\n value: string;\n color: string;\n kind?: ChartSwatchKind;\n dashed?: boolean;\n}\n\nexport interface ChartTooltipProps {\n /** The snapped x of the hovered bucket, in container px. */\n x: number;\n /** The container's width — the tooltip flips to the left past the middle. */\n width: number;\n /** Where the tooltip's top sits — the plot's top. */\n top: number;\n heading: string;\n rows: ReadonlyArray<ChartTooltipRow>;\n breakdown?: ReadonlyArray<ChartBreakdownItem>;\n breakdownTitle?: ReactNode;\n valueFormat: (value: number) => string;\n}\n\n/**\n * The readout for one bucket: its time, then every series' value (values\n * lead, in primary ink; labels follow), then the bucket's breakdown when\n * it carries one. Presentational — the figure's description already\n * speaks the data — and it never takes the pointer.\n */\nexport function ChartTooltip({\n x,\n width,\n top,\n heading,\n rows,\n breakdown,\n breakdownTitle,\n valueFormat,\n}: ChartTooltipProps) {\n const flip = x > width / 2;\n return (\n <div\n aria-hidden\n data-chart-tooltip=\"\"\n className=\"bg-pho-primary shadow-pho-lg ring-pho-secondary rounded-base pointer-events-none absolute z-10 max-w-72 min-w-40 px-3 py-2 text-xs ring-1 ring-inset\"\n style={flip ? { right: width - x + 12, top } : { left: x + 12, top }}\n >\n <div className=\"text-pho-primary font-medium\">{heading}</div>\n <ul className=\"mt-1 flex flex-col gap-0.5\">\n {rows.map((row) => (\n <li\n key={row.label}\n className=\"flex items-center justify-between gap-4\"\n >\n <span className=\"text-pho-secondary flex min-w-0 items-center gap-1.5\">\n <ChartSwatch\n color={row.color}\n kind={row.kind}\n dashed={row.dashed}\n />\n <span className=\"truncate\">{row.label}</span>\n </span>\n <span className=\"text-pho-primary font-medium tabular-nums\">\n {row.value}\n </span>\n </li>\n ))}\n </ul>\n {breakdown != null && breakdown.length > 0 && (\n <div className=\"border-pho-secondary mt-2 border-t pt-2\">\n {breakdownTitle != null && (\n <div className=\"text-pho-description mb-1\">{breakdownTitle}</div>\n )}\n <ul className=\"flex flex-col gap-0.5\">\n {breakdown.map((item) => (\n <li\n key={item.label}\n className=\"flex items-center justify-between gap-4\"\n >\n <span className=\"text-pho-secondary truncate\">\n {item.label}\n </span>\n <span className=\"text-pho-primary tabular-nums\">\n {valueFormat(item.value)}\n </span>\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n}\n","import {\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type RefObject,\n} from \"react\";\n\n// React 18 warns that useLayoutEffect does nothing on the server (19 dropped\n// the warning); a plain effect there keeps a server render quiet.\nexport const useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * The width of the element the ref lands on, kept current through a\n * ResizeObserver. Nothing runs on the server: the first render is 0 wide\n * and the plot fills in once the browser has measured. A `fixed` width\n * skips measuring altogether.\n */\nexport function useMeasuredWidth<T extends HTMLElement>(\n fixed?: number,\n): [RefObject<T | null>, number] {\n const ref = useRef<T>(null);\n const [width, setWidth] = useState(0);\n useIsomorphicLayoutEffect(() => {\n if (fixed != null) return;\n const element = ref.current;\n if (element == null) return;\n setWidth(element.getBoundingClientRect().width);\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver((entries) => {\n const next = entries[0]?.contentRect.width;\n if (next != null) setWidth(next);\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, [fixed]);\n return [ref, fixed ?? width];\n}\n","import {\n Children,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useId,\n useMemo,\n useRef,\n type ReactNode,\n} from \"react\";\nimport { curveLinear, curveMonotoneX } from \"d3-shape\";\nimport { useAnimate, useReducedMotion } from \"motion/react\";\nimport {\n AreaSeries,\n Axis,\n BarGroup,\n BarSeries,\n BarStack,\n DataContext,\n DataProvider,\n Grid,\n LineSeries,\n TooltipContext,\n TooltipProvider,\n XYChart,\n} from \"@visx/xychart\";\nimport {\n FADE_ENTRANCE,\n RISE_PX,\n SPAN_SCALE,\n SPRING_ENTRANCE,\n} from \"../../motion\";\nimport { chartColor } from \"./color\";\nimport { describeChart, numberFormatter, readValue } from \"./format\";\nimport { ChartLegend } from \"./legend\";\nimport {\n bucketSpan,\n bucketTimeFormatter,\n nearestIndex,\n niceLinearDomain,\n thinTicks,\n timeAxisTicks,\n timeTickFormatter,\n toTime,\n} from \"./scale\";\nimport { ChartShell, chartLayout, type ChartLayout } from \"./shell\";\nimport { ChartSkeleton } from \"./skeleton\";\nimport { buildPhoTheme } from \"./theme\";\nimport { ChartTooltip } from \"./tooltip\";\nimport type {\n ChartBarProps,\n ChartColor,\n ChartCurve,\n ChartDatum,\n ChartLineProps,\n ChartProps,\n} from \"./types\";\nimport { useIsomorphicLayoutEffect, useMeasuredWidth } from \"./use-measure\";\n\n/**\n * Chart — buckets over time, drawn as the parts it is given: `Chart.Bar`\n * for columns, `Chart.Line` for lines, mixed when a page wants a daily\n * count under its rolling average. The root owns everything the parts\n * share: the frame, the scales, the axes and grid, the tooltip, the\n * legend and the figure's spoken summary. Built on @visx/xychart.\n *\n * Design notes:\n * - Bars are thin: a column never fills its band and never runs past\n * 24px; the leftover is air. The data end is rounded (4px), the\n * baseline end square — in a stack only the top part gets the corners,\n * and a 2px stroke in the surface colour separates segments instead of\n * a border. Side by side, bars sit 2px apart inside the same slot.\n * - Lines are 2px with round joins, straight by default: a curve invents\n * values between samples, so `curve=\"monotone\"` is a choice the page\n * makes for a smooth-by-nature quantity. `area` washes the surface\n * under a line at 10%.\n * - Charts with bars run on a band scale, buckets centred in equal bands;\n * lines alone run edge to edge on a time scale. Either way the x-axis\n * labels the round times that fit, and the y-axis three to five round\n * numbers with a hairline grid.\n * - Hover snaps to the nearest bucket: bars lift it with the ghost wash,\n * lines get a crosshair and a surface-ringed point per series, and one\n * tooltip lists every part's value plus the bucket's `breakdown`.\n * - Data arrives the way a page section does, on the entrance spring and\n * fade `Reveal` uses. A chart that mounts with data rises from its\n * base; data that follows the bones slides in from the left, the same\n * reveal turned along the time axis. A range switch follows the range:\n * a wider span opens outward from inside the plot, a narrower one\n * closes inward from outside it (clipped to the plot); the same span\n * slides in again. A first load with nothing to hold shows bones in\n * the chart's shape, coordinate system included; a refetch keeps the\n * last render at half opacity. Reduced motion makes every arrival\n * static.\n * - The figure is `role=\"img\"` with the `label` and a spoken summary; the\n * legend is real text below the plot, present for two or more parts.\n * Marks register with visx after mount, so a server render carries the\n * frame, the legend and the summary, and the plot fills on hydration.\n */\n\nconst BAR_MAX = 24;\nconst RADIUS = 4;\nconst LINE_WIDTH = 2;\nconst POINT_RADIUS = 4;\nconst SURFACE = \"var(--pho-chart-surface)\";\nconst WASH = \"var(--background-color-pho-ghost-hover)\";\nconst CROSSHAIR = \"var(--color-pho-chart-crosshair)\";\n\n/* ---------------------------------- parts --------------------------------- */\n\n/**\n * `Chart.Bar` — one bar series. Renders nothing itself: the root reads\n * its props and draws the columns among the other parts.\n */\nexport function ChartBar(_props: ChartBarProps): null {\n return null;\n}\nChartBar.displayName = \"Chart.Bar\";\nChartBar.chartPart = \"bar\" as const;\n\n/**\n * `Chart.Line` — one line series. Renders nothing itself: the root reads\n * its props and draws the line among the other parts.\n */\nexport function ChartLine(_props: ChartLineProps): null {\n return null;\n}\nChartLine.displayName = \"Chart.Line\";\nChartLine.chartPart = \"line\" as const;\n\ninterface Part {\n kind: \"bar\" | \"line\";\n dataKey: string;\n label: string;\n color?: ChartColor;\n dashed?: boolean;\n curve: ChartCurve;\n area?: boolean;\n}\n\n/** What a part element is, by the marker on its component rather than its identity: a hot reload or a second copy of the library must not lose the parts. */\nfunction partKind(type: unknown): \"bar\" | \"line\" | undefined {\n return (type as { chartPart?: \"bar\" | \"line\" } | null)?.chartPart;\n}\n\n/** The parts among `children`, in order; fragments are looked through. */\nfunction collectParts(children: ReactNode, into: Part[] = []): Part[] {\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n const kind = partKind(child.type);\n if (child.type === Fragment) {\n collectParts((child.props as { children?: ReactNode }).children, into);\n } else if (kind === \"bar\") {\n const p = child.props as ChartBarProps;\n into.push({\n kind: \"bar\",\n dataKey: p.dataKey,\n label: p.label,\n color: p.color,\n curve: \"linear\",\n });\n } else if (kind === \"line\") {\n const p = child.props as ChartLineProps;\n into.push({\n kind: \"line\",\n dataKey: p.dataKey,\n label: p.label,\n color: p.color,\n dashed: p.dashed,\n curve: p.curve ?? \"linear\",\n area: p.area,\n });\n }\n });\n return into;\n}\n\n/* -------------------------------- accessors ------------------------------- */\n// visx registers a series again whenever an accessor's identity changes,\n// so these are made once per key and shared.\n\ntype Datum = object;\ntype Accessor = (d: Datum) => number;\n\nconst xAccessor: Accessor = (d) => toTime((d as ChartDatum).x);\n\nconst barAccessors = new Map<string, Accessor>();\n/** A bar's value; a hole reads as zero so the segments above still stack. */\nfunction barAccessor(key: string): Accessor {\n let fn = barAccessors.get(key);\n if (fn == null) {\n fn = (d) => readValue(d, key) ?? 0;\n barAccessors.set(key, fn);\n }\n return fn;\n}\n\nconst lineAccessors = new Map<string, Accessor>();\n/** A line's value; a hole reads as NaN so the line breaks there. */\nfunction lineAccessor(key: string): Accessor {\n let fn = lineAccessors.get(key);\n if (fn == null) {\n fn = (d) => readValue(d, key) ?? NaN;\n lineAccessors.set(key, fn);\n }\n return fn;\n}\n\nconst fillAccessors = new Map<string, (d: Datum) => string>();\n/** A bar's fill: its colour, or nothing for an empty bucket so no sliver shows. */\nfunction fillAccessor(key: string, color: string): (d: Datum) => string {\n const id = `${key} ${color}`;\n let fn = fillAccessors.get(id);\n if (fn == null) {\n fn = (d) => (readValue(d, key) ? color : \"transparent\");\n fillAccessors.set(id, fn);\n }\n return fn;\n}\n\n/* --------------------------------- scales --------------------------------- */\n\ntype Positioner = (value: number | Date) => number | undefined;\n\n/** A value's x: the middle of its band, or its point on the time scale. */\nfunction xPositioner(scale: unknown): Positioner {\n const s = scale as ((v: number | Date) => number | undefined) & {\n bandwidth?: () => number;\n };\n const half = typeof s.bandwidth === \"function\" ? s.bandwidth() / 2 : 0;\n return (value) => {\n const x = s(value);\n return typeof x === \"number\" && Number.isFinite(x) ? x + half : undefined;\n };\n}\n\nfunction yPositioner(scale: unknown): Positioner {\n const s = scale as (v: number) => number | undefined;\n return (value) => {\n const y = s(Number(value));\n return typeof y === \"number\" && Number.isFinite(y) ? y : undefined;\n };\n}\n\n/** A band scale's step; a continuous scale has none. */\nfunction stepOf(scale: unknown): number {\n const s = scale as { step?: () => number };\n return typeof s.step === \"function\" ? s.step() : 0;\n}\n\ninterface BandLayout {\n /** The bands' padding: what keeps a bar thin and, in a group, apart. */\n paddingInner: number;\n paddingOuter: number;\n /** The padding inside a group of bars, for visx's group scale. */\n groupPadding: number;\n}\n\n/**\n * How much of each band the bars take. Buckets are centred in equal\n * bands (`paddingOuter` is half the inner padding, so every step is the\n * same width and the tooltip's snapping matches the marks). The bar slot\n * is capped at 24px with a 2px gap; a group spends 2px between its bars,\n * a stack 2px on its surface stroke, so the visible mark stays in the\n * slot.\n */\nfunction bandLayout(\n innerWidth: number,\n count: number,\n groups: number,\n stacked: boolean,\n): BandLayout {\n const step = count > 0 ? innerWidth / count : 0;\n const gap = step >= 6 ? 2 : step >= 3 ? 1 : 0;\n const slot = Math.max(1, Math.min(BAR_MAX, step - gap));\n const inner = Math.min(2, gap);\n const target = stacked ? slot + inner : groups > 1 ? slot + 2 * inner : slot;\n const bandwidth = Math.min(step, target);\n const paddingInner = step > 0 ? 1 - bandwidth / step : 0;\n // A group's band scale pads inside and outside alike; this keeps the\n // gaps between bars at `inner` px.\n const groupPadding =\n groups > 1 && bandwidth > inner\n ? Math.min(0.5, (inner * groups) / (bandwidth - inner))\n : 0;\n return { paddingInner, paddingOuter: paddingInner / 2, groupPadding };\n}\n\n/* --------------------------------- layers --------------------------------- */\n\n/**\n * visx makes its scales once a series has registered, and hands out a\n * placeholder before that: nothing is drawn against it, on the server or\n * in the first client frame.\n */\nfunction Registered({ children }: { children: ReactNode }) {\n const { dataRegistry } = useContext(DataContext);\n const ready =\n dataRegistry?.entries().some((entry) => entry.data.length > 0) ?? false;\n return ready ? <>{children}</> : null;\n}\n\n/** The hovered bucket's index, when visx has one and it still exists. */\nfunction useHoveredIndex(count: number): number | null {\n const tooltip = useContext(TooltipContext);\n const index = tooltip?.tooltipOpen\n ? tooltip.tooltipData?.nearestDatum?.index\n : undefined;\n return index != null && index >= 0 && index < count ? index : null;\n}\n\ninterface LayerProps {\n data: ReadonlyArray<ChartDatum>;\n layout: ChartLayout;\n}\n\n/** The time labels along the bottom; the end labels tuck inside the plot. */\nfunction BottomAxis({\n values,\n format,\n layout,\n}: {\n values: ReadonlyArray<number | Date>;\n format: (value: number | Date) => string;\n layout: ChartLayout;\n}) {\n const { xScale } = useContext(DataContext);\n const tickLabelProps = useCallback(\n (raw: unknown) => {\n const value = raw as number | Date;\n const x = xPositioner(xScale)(value) ?? layout.left;\n const half = (format(value).length * 6.5) / 2;\n const textAnchor =\n x - half < layout.left\n ? \"start\"\n : x + half > layout.right\n ? \"end\"\n : \"middle\";\n return { textAnchor } as const;\n },\n [xScale, format, layout.left, layout.right],\n );\n return (\n <Axis\n orientation=\"bottom\"\n tickValues={[...values]}\n tickFormat={(value: unknown) => format(value as number | Date)}\n hideAxisLine\n hideTicks\n tickLabelProps={tickLabelProps}\n />\n );\n}\n\n/** The ghost wash under the hovered bucket's column. */\nfunction HoverWash({ data, layout }: LayerProps) {\n const { xScale } = useContext(DataContext);\n const index = useHoveredIndex(data.length);\n if (index == null || xScale == null) return null;\n const cx = xPositioner(xScale)(toTime(data[index]!.x));\n const step = stepOf(xScale);\n if (cx == null) return null;\n return (\n <rect\n data-hover-wash=\"\"\n x={cx - step / 2}\n y={layout.top}\n width={step}\n height={layout.innerHeight}\n fill={WASH}\n />\n );\n}\n\n/** The bars' baseline, a touch stronger than the grid so they stand on something. */\nfunction ZeroLine({ layout }: { layout: ChartLayout }) {\n const { yScale } = useContext(DataContext);\n const y = yScale ? yPositioner(yScale)(0) : undefined;\n if (y == null) return null;\n return (\n <line\n data-zero=\"\"\n x1={layout.left}\n x2={layout.right}\n y1={y}\n y2={y}\n stroke={CROSSHAIR}\n />\n );\n}\n\n/** The crosshair on a line chart, and a surface-ringed point per line at the hovered bucket. */\nfunction HoverMarks({\n data,\n layout,\n lines,\n crosshair,\n}: LayerProps & {\n lines: ReadonlyArray<{ dataKey: string; color: string }>;\n crosshair: boolean;\n}) {\n const { xScale, yScale } = useContext(DataContext);\n const index = useHoveredIndex(data.length);\n if (index == null || xScale == null || yScale == null) return null;\n const datum = data[index]!;\n const cx = xPositioner(xScale)(toTime(datum.x));\n if (cx == null) return null;\n const y = yPositioner(yScale);\n return (\n <g data-hover=\"\">\n {crosshair && (\n <line\n x1={cx}\n x2={cx}\n y1={layout.top}\n y2={layout.bottom}\n stroke={CROSSHAIR}\n />\n )}\n {lines.length > 0 && (\n <g data-points=\"\">\n {lines.map((line) => {\n const value = readValue(datum, line.dataKey);\n const cy = value == null ? undefined : y(value);\n if (cy == null) return null;\n return (\n <circle\n key={line.dataKey}\n cx={cx}\n cy={cy}\n r={POINT_RADIUS}\n fill={line.color}\n // The surface ring keeps a dot legible where lines cross.\n stroke={SURFACE}\n strokeWidth={2}\n />\n );\n })}\n </g>\n )}\n </g>\n );\n}\n\n/**\n * The marks' arrival, on `SPRING_ENTRANCE` and `FADE_ENTRANCE` like a\n * `Reveal`. A chart that mounts with data rises from its base (scaleY\n * from 0 at the bottom of what it draws). Data that follows an empty\n * plot — the bones, or a cleared range — slides in from the left by the\n * reveal's own distance, the arrival turned along the time axis. From\n * there a change follows what the range did: a wider span opens outward\n * (scaleX from `SPAN_SCALE` about the middle), a narrower one closes\n * inward (from its inverse, clipped to the plot so nothing crosses the\n * axes), the same span slides in again. A refetch that lands mid-flight\n * restarts it. The layout effect sets the first frame before paint, so\n * new marks never flash at full size first. Static under reduced motion.\n */\nfunction Rise({\n data,\n range,\n layout,\n children,\n}: {\n data: ReadonlyArray<unknown>;\n /** The span of time the data covers, in ms; 0 with no data. */\n range: number;\n layout: ChartLayout;\n children: ReactNode;\n}) {\n const reduceMotion = useReducedMotion();\n const [scope, animate] = useAnimate<SVGGElement>();\n const clipId = useId();\n // The span last shown, 0 for an empty plot; nothing before the mount.\n const shown = useRef<number | null>(null);\n useIsomorphicLayoutEffect(() => {\n const node = scope.current;\n const previous = shown.current;\n shown.current = range;\n if (data.length === 0 || reduceMotion || node == null) return;\n const fade = { opacity: FADE_ENTRANCE };\n const controls =\n previous == null\n ? animate(\n node,\n { scaleY: [0, 1], scaleX: 1, x: 0, opacity: [0, 1], originY: 1 },\n { scaleY: SPRING_ENTRANCE, ...fade },\n )\n : previous === 0 || range === previous\n ? animate(\n node,\n { x: [-RISE_PX, 0], scaleX: 1, scaleY: 1, opacity: [0, 1] },\n { x: SPRING_ENTRANCE, ...fade },\n )\n : animate(\n node,\n {\n scaleX: [range > previous ? SPAN_SCALE : 1 / SPAN_SCALE, 1],\n scaleY: 1,\n x: 0,\n opacity: [0, 1],\n originX: 0.5,\n },\n { scaleX: SPRING_ENTRANCE, ...fade },\n );\n return () => controls.stop();\n }, [data, range, reduceMotion]);\n // A breath of room so a stroke on the plot's edge is never shaved.\n const pad = 4;\n return (\n <g clipPath={`url(#${clipId})`}>\n <defs>\n <clipPath id={clipId}>\n <rect\n x={layout.left - pad}\n y={layout.top - pad}\n width={layout.innerWidth + 2 * pad}\n height={layout.innerHeight + 2 * pad}\n />\n </clipPath>\n </defs>\n <g ref={scope} data-marks=\"\">\n {children}\n </g>\n </g>\n );\n}\n\n/** The readout beside the hovered bucket: every part's value, then the breakdown. */\nfunction HoverTooltip({\n data,\n layout,\n parts,\n colors,\n width,\n headingFormat,\n valueFormat,\n breakdownTitle,\n}: LayerProps & {\n parts: ReadonlyArray<Part>;\n colors: ReadonlyArray<string>;\n width: number;\n headingFormat: (date: Date) => string;\n valueFormat: (value: number) => string;\n breakdownTitle?: ReactNode;\n}) {\n const { xScale } = useContext(DataContext);\n const index = useHoveredIndex(data.length);\n if (index == null || xScale == null) return null;\n const datum = data[index]!;\n const x = xPositioner(xScale)(toTime(datum.x));\n if (x == null) return null;\n return (\n <ChartTooltip\n x={x}\n width={width}\n top={layout.top}\n heading={headingFormat(new Date(datum.x))}\n rows={parts.map((part, i) => {\n const value = readValue(datum, part.dataKey);\n return {\n label: part.label,\n value: value == null ? \"No data\" : valueFormat(value),\n color: colors[i]!,\n kind: part.kind === \"bar\" ? \"rect\" : \"line\",\n dashed: part.dashed,\n };\n })}\n breakdown={datum.breakdown}\n breakdownTitle={breakdownTitle}\n valueFormat={valueFormat}\n />\n );\n}\n\n/* ---------------------------------- root ---------------------------------- */\n\n// visx wraps a left label to the margin's width; the margin is sized to\n// the labels here, so a label never wraps.\nconst LEFT_TICK_LABEL = {\n dx: \"-0.35em\",\n dy: \"0.35em\",\n width: undefined,\n} as const;\n\nexport function Chart<T extends ChartDatum>({\n data,\n children,\n label,\n description,\n height = 200,\n width: fixedWidth,\n valueFormat,\n timeFormat,\n locale,\n legend,\n baseline = \"zero\",\n stacked = false,\n breakdownTitle,\n loading,\n empty = \"Nothing here yet.\",\n className,\n ...props\n}: ChartProps<T>) {\n const [containerRef, width] = useMeasuredWidth<HTMLDivElement>(fixedWidth);\n const parts = useMemo(() => collectParts(children), [children]);\n\n const model = useMemo(() => {\n const times = data.map((d) => toTime(d.x));\n const span = bucketSpan(times);\n const axisFormat = valueFormat ?? numberFormatter(locale, true);\n const fullFormat = valueFormat ?? numberFormatter(locale);\n const headingFormat = timeFormat ?? bucketTimeFormatter(locale, span);\n const colors = parts.map((part, index) => chartColor(part.color, index));\n const bars = parts.filter((part) => part.kind === \"bar\");\n const lines = parts\n .map((part, index) => ({ ...part, color: colors[index]! }))\n .filter((part) => part.kind === \"line\");\n let min = Infinity;\n let max = -Infinity;\n const consider = (value: number) => {\n if (value < min) min = value;\n if (value > max) max = value;\n };\n if (stacked && bars.length > 1) {\n for (const d of data) {\n let positive = 0;\n let negative = 0;\n for (const bar of bars) {\n const value = readValue(d, bar.dataKey);\n if (value == null) continue;\n if (value > 0) positive += value;\n else negative += value;\n }\n consider(positive);\n consider(negative);\n }\n } else {\n for (const bar of bars) {\n for (const d of data) {\n const value = readValue(d, bar.dataKey);\n if (value != null) consider(value);\n }\n }\n }\n for (const line of lines) {\n for (const d of data) {\n const value = readValue(d, line.dataKey);\n if (value != null) consider(value);\n }\n }\n if (min === Infinity) {\n min = 0;\n max = 0;\n }\n // Columns rise from zero, so a chart with bars always keeps it.\n if (baseline === \"zero\" || bars.length > 0) {\n min = Math.min(0, min);\n max = Math.max(0, max);\n }\n const y = niceLinearDomain(min, max);\n return {\n times,\n span,\n colors,\n bars,\n lines,\n hasBars: bars.length > 0,\n axisFormat,\n fullFormat,\n headingFormat,\n y,\n yLabels: y.ticks.map(axisFormat),\n described:\n description ??\n describeChart({\n data,\n series: parts.map((part) => ({\n key: part.dataKey,\n label: part.label,\n kind: part.kind,\n })),\n valueFormat: fullFormat,\n timeFormat: headingFormat,\n }),\n };\n }, [\n data,\n parts,\n stacked,\n baseline,\n valueFormat,\n timeFormat,\n locale,\n description,\n ]);\n\n const n = data.length;\n const t0 = model.times[0] ?? 0;\n const t1 = model.times[n - 1] ?? 0;\n // The span the buckets cover: their spread plus the last bucket itself.\n const range = n > 0 ? t1 - t0 + model.span : 0;\n const layout = useMemo(\n () => chartLayout(width, height, model.yLabels),\n [width, height, model.yLabels],\n );\n const band = useMemo(\n () => bandLayout(layout.innerWidth, n, model.bars.length, stacked),\n [layout.innerWidth, n, model.bars.length, stacked],\n );\n\n // Bars need a band; lines alone run edge to edge on time.\n const xScale = useMemo(\n () =>\n model.hasBars\n ? {\n type: \"band\" as const,\n domain: model.times,\n paddingInner: band.paddingInner,\n paddingOuter: band.paddingOuter,\n }\n : {\n type: \"time\" as const,\n domain: t1 > t0 ? [t0, t1] : [t0 - 1, t0 + 1],\n },\n [model.hasBars, model.times, band.paddingInner, band.paddingOuter, t0, t1],\n );\n const yScale = useMemo(\n () => ({\n type: \"linear\" as const,\n domain: model.y.domain,\n zero: false,\n nice: false,\n }),\n [model.y.domain],\n );\n const theme = useMemo(() => buildPhoTheme(model.colors), [model.colors]);\n\n const xTicks = useMemo(() => {\n const format = timeTickFormatter(locale);\n if (n === 0 || layout.innerWidth <= 0) {\n return { values: [] as Array<number | Date>, format: () => \"\" };\n }\n const ticks = thinTicks(\n timeAxisTicks(t0, t1, layout.innerWidth),\n format,\n layout.innerWidth,\n );\n if (!model.hasBars) {\n return {\n values: ticks as Array<number | Date>,\n format: (value: number | Date) => format(new Date(value)),\n };\n }\n // A band takes only its own values: each round tick lands on the\n // nearest bucket, and keeps the round time as its label.\n const labels = new Map<number, string>();\n for (const tick of ticks) {\n const at = model.times[nearestIndex(model.times, tick.getTime())]!;\n if (!labels.has(at)) labels.set(at, format(tick));\n }\n return {\n values: [...labels.keys()] as Array<number | Date>,\n format: (value: number | Date) =>\n labels.get(toTime(value)) ?? format(new Date(value)),\n };\n }, [n, t0, t1, layout.innerWidth, locale, model.hasBars, model.times]);\n\n const showLegend = legend ?? parts.length > 1;\n const showEmpty = n === 0 && !loading;\n // Bones only when there is no last render to hold.\n const showSkeleton = n === 0 && loading === true;\n const zeroAtEdge = model.y.domain[0] >= 0 || model.y.domain[1] <= 0;\n const series = data as T[];\n\n const barMarks = (() => {\n const { bars } = model;\n if (bars.length === 0) return null;\n const last = bars.length - 1;\n const marks = bars.map((bar, i) => {\n const color = model.colors[parts.indexOf(bar)]!;\n const rounded = !stacked || i === last;\n return (\n <BarSeries\n key={bar.dataKey}\n dataKey={bar.dataKey}\n data={series}\n xAccessor={xAccessor}\n yAccessor={barAccessor(bar.dataKey)}\n colorAccessor={fillAccessor(bar.dataKey, color)}\n radius={rounded ? RADIUS : undefined}\n radiusTop={rounded}\n data-series={bar.dataKey}\n />\n );\n });\n if (bars.length === 1) return marks;\n return stacked ? (\n <BarStack>{marks}</BarStack>\n ) : (\n <BarGroup padding={band.groupPadding}>{marks}</BarGroup>\n );\n })();\n\n const lineMarks = model.lines.map((line) => {\n const curve = line.curve === \"monotone\" ? curveMonotoneX : curveLinear;\n const dash = line.dashed ? \"4 4\" : undefined;\n return line.area ? (\n <AreaSeries\n key={line.dataKey}\n dataKey={line.dataKey}\n data={series}\n xAccessor={xAccessor}\n yAccessor={lineAccessor(line.dataKey)}\n curve={curve}\n fill={line.color}\n fillOpacity={0.1}\n lineProps={{\n stroke: line.color,\n strokeWidth: LINE_WIDTH,\n strokeLinejoin: \"round\",\n strokeDasharray: dash,\n }}\n data-series={line.dataKey}\n />\n ) : (\n <LineSeries\n key={line.dataKey}\n dataKey={line.dataKey}\n data={series}\n xAccessor={xAccessor}\n yAccessor={lineAccessor(line.dataKey)}\n curve={curve}\n stroke={line.color}\n strokeWidth={LINE_WIDTH}\n strokeLinejoin=\"round\"\n strokeDasharray={dash}\n data-series={line.dataKey}\n />\n );\n });\n\n return (\n <ChartShell\n label={label}\n description={model.described}\n height={height}\n containerRef={containerRef}\n loading={loading}\n empty={empty}\n showEmpty={showEmpty}\n placeholder={showSkeleton ? <ChartSkeleton layout={layout} /> : null}\n className={className}\n legend={\n showLegend ? (\n <ChartLegend\n items={parts.map((part, index) => ({\n label: part.label,\n color: model.colors[index]!,\n kind: part.kind === \"bar\" ? \"rect\" : \"line\",\n dashed: part.dashed,\n }))}\n />\n ) : null\n }\n {...props}\n >\n {width > 0 && !showEmpty && (\n <DataProvider\n xScale={xScale}\n yScale={yScale}\n theme={theme}\n initialDimensions={{ width, height, margin: layout.margin }}\n >\n <TooltipProvider hideTooltipDebounceMs={0}>\n <XYChart\n width={width}\n height={height}\n margin={layout.margin}\n accessibilityLabel={label}\n >\n <Registered>\n <Grid rows columns={false} numTicks={model.y.count} />\n </Registered>\n <Axis\n orientation=\"left\"\n tickValues={model.y.ticks}\n tickFormat={(value: unknown) => model.axisFormat(Number(value))}\n hideAxisLine\n hideTicks\n tickLabelProps={LEFT_TICK_LABEL}\n />\n <BottomAxis\n values={xTicks.values}\n format={xTicks.format}\n layout={layout}\n />\n {model.hasBars && <HoverWash data={data} layout={layout} />}\n <Rise data={data} range={range} layout={layout}>\n {barMarks}\n {lineMarks}\n </Rise>\n {model.hasBars && zeroAtEdge && (\n <Registered>\n <ZeroLine layout={layout} />\n </Registered>\n )}\n <HoverMarks\n data={data}\n layout={layout}\n lines={model.lines}\n crosshair={!model.hasBars}\n />\n </XYChart>\n <HoverTooltip\n data={data}\n layout={layout}\n parts={parts}\n colors={model.colors}\n width={width}\n headingFormat={model.headingFormat}\n valueFormat={model.fullFormat}\n breakdownTitle={breakdownTitle}\n />\n </TooltipProvider>\n </DataProvider>\n )}\n </ChartShell>\n );\n}\n\nChart.displayName = \"Chart\";\nChart.Bar = ChartBar;\nChart.Line = ChartLine;\n"],"x_google_ignoreList":[0,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],"mappings":";;;;;;;;AAAA,SAAS,GAAO,GAAS;AACvB,OAAK,WAAW;AAClB;AAEA,GAAO,YAAY;AAAA,EACjB,WAAW,WAAW;AACpB,SAAK,QAAQ;AAAA,EACf;AAAA,EACA,SAAS,WAAW;AAClB,SAAK,QAAQ;AAAA,EACf;AAAA,EACA,WAAW,WAAW;AACpB,SAAK,SAAS;AAAA,EAChB;AAAA,EACA,SAAS,WAAW;AAClB,KAAI,KAAK,SAAU,KAAK,UAAU,KAAK,KAAK,WAAW,MAAI,KAAK,SAAS,UAAU,GACnF,KAAK,QAAQ,IAAI,KAAK;AAAA,EACxB;AAAA,EACA,OAAO,SAAS,GAAG,GAAG;AAEpB,YADA,IAAI,CAAC,GAAG,IAAI,CAAC,GACL,KAAK,QAAb;AAAA,MACE,KAAK;AAAG,aAAK,SAAS,GAAG,KAAK,QAAQ,KAAK,SAAS,OAAO,GAAG,CAAC,IAAI,KAAK,SAAS,OAAO,GAAG,CAAC;AAAG;AAAA,MAC/F,KAAK;AAAG,aAAK,SAAS;AAAA,MACtB;AAAS,aAAK,SAAS,OAAO,GAAG,CAAC;AAAA,IACpC;AAAA,EACF;AACF;AAEA,SAAA,GAAwB,GAAS;AAC/B,SAAO,IAAI,GAAO,CAAO;AAC3B;AC9BA,SAAS,GAAK,GAAG;AACf,SAAO,IAAI,IAAI,KAAK;AACtB;AAMA,SAAS,GAAO,GAAM,GAAI,GAAI;AAC5B,MAAI,IAAK,EAAK,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A,cACf,QAAQ,GAAO;AAAA,cACP,QAAA;AAAA,YACT,CAAA;AAAA,YACA,EAAM,WAAW,gBAAA,EAAC,IAAD;AAAA,cAAiB,MAAA;AAAA,cAAc,QAAA;AAAA,YAAS,CAAA;AAAA,YAC1D,gBAAA,EAAC,IAAD;AAAA,cAAY,MAAA;AAAA,cAAa,OAAA;AAAA,cAAe,QAAA;AAAA,cAAxC,UAAA,CACG,IACA,EACG;AAAA;YACL,EAAM,WAAW,MAChB,gBAAA,EAAC,IAAD,EAAA,UACE,gBAAA,EAAC,IAAD,EAAkB,QAAA,EAAS,CAAA,EACjB,CAAA;AAAA,YAEd,gBAAA,EAAC,IAAD;AAAA,cACQ,MAAA;AAAA,cACE,QAAA;AAAA,cACR,OAAO,EAAM;AAAA,cACb,WAAW,CAAC,EAAM;AAAA,YACnB,CAAA;AAAA,UACM;AAAA,QACT,CAAA,GAAA,gBAAA,EAAC,IAAD;AAAA,UACQ,MAAA;AAAA,UACE,QAAA;AAAA,UACD,OAAA;AAAA,UACP,QAAQ,EAAM;AAAA,UACP,OAAA;AAAA,UACP,eAAe,EAAM;AAAA,UACrB,aAAa,EAAM;AAAA,UACH,gBAAA;AAAA,QACjB,CAAA,CACc;AAAA;IACL,CAAA;AAAA,EAEN,CAAA;AAEhB;AAEA,GAAM,cAAc;AACpB,GAAM,MAAM;AACZ,GAAM,OAAO"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { r as n, t as d } from "./chart-B5c8gmlj.js";
|
|
3
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
4
|
-
function h({ series: r, curve: t = "linear", area: l = !1, ...i }) {
|
|
5
|
-
return /* @__PURE__ */ e(d, {
|
|
6
|
-
...i,
|
|
7
|
-
children: r.map((a, o) => /* @__PURE__ */ e(n, {
|
|
8
|
-
dataKey: a.key,
|
|
9
|
-
label: a.label,
|
|
10
|
-
color: a.color,
|
|
11
|
-
dashed: a.dashed,
|
|
12
|
-
curve: t,
|
|
13
|
-
area: l && o === 0
|
|
14
|
-
}, a.key))
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
h.displayName = "LineChart";
|
|
18
|
-
export {
|
|
19
|
-
h as t
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=line-chart-Cm_Ac7f4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart-Cm_Ac7f4.js","names":[],"sources":["../../src/components/line-chart/line-chart.tsx"],"sourcesContent":["import { Chart, ChartLine } from \"../chart/chart\";\nimport type { ChartBaseProps, ChartCurve, ChartDatum } from \"../chart/types\";\n\n/**\n * LineChart — series over time as lines: latency percentiles, one line\n * per destination, a min / average / max where the bounds are dashed.\n *\n * A preset on `Chart`: the `series` array becomes one `Chart.Line` per\n * entry, in order; `curve` applies to every line and `area` washes the\n * surface under the first. The marks, axes, tooltip and legend are the\n * root's.\n */\nexport interface LineChartProps<\n T extends ChartDatum,\n> extends ChartBaseProps<T> {\n /** Straight segments, or a monotone curve that never overshoots a sample. @default \"linear\" */\n curve?: ChartCurve;\n /** A soft fill under the first series (a lone one, as a rule). */\n area?: boolean;\n}\n\nexport function LineChart<T extends ChartDatum>({\n series,\n curve = \"linear\",\n area = false,\n ...props\n}: LineChartProps<T>) {\n return (\n <Chart {...props}>\n {series.map((s, index) => (\n <ChartLine\n key={s.key}\n dataKey={s.key}\n label={s.label}\n color={s.color}\n dashed={s.dashed}\n curve={curve}\n area={area && index === 0}\n />\n ))}\n </Chart>\n );\n}\n\nLineChart.displayName = \"LineChart\";\n"],"mappings":";;;AAqBA,SAAgB,EAAgC,EAC9C,QAAA,GACA,OAAA,IAAQ,UACR,MAAA,IAAO,IACP,GAAG,EAAA,GACiB;AACpB,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,GAAI;AAAA,IACR,UAAA,EAAO,IAAA,CAAK,GAAG,MACd,gBAAA,EAAC,GAAD;AAAA,MAEE,SAAS,EAAE;AAAA,MACX,OAAO,EAAE;AAAA,MACT,OAAO,EAAE;AAAA,MACT,QAAQ,EAAE;AAAA,MACH,OAAA;AAAA,MACP,MAAM,KAAQ,MAAU;AAAA,IACzB,GAPM,EAAE,GAOR,CACF;AAAA,EACI,CAAA;AAEX;AAEA,EAAU,cAAc"}
|