@panneau/ui 5.0.0-alpha.36 → 5.0.0-alpha.38

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.
Files changed (53) hide show
  1. package/README.md +8 -2
  2. package/dist/bar-chart/BarChart.css +76 -0
  3. package/dist/bar-chart/BarChart.d.ts +33 -0
  4. package/dist/bar-chart/BarChart.d.ts.map +1 -0
  5. package/dist/bar-chart/BarChart.js +151 -0
  6. package/dist/bar-chart/BarChart.js.map +1 -0
  7. package/dist/bar-chart/BarChart.module.js +26 -0
  8. package/dist/bar-chart/BarChart.module.js.map +1 -0
  9. package/dist/bar-chart/tokens.d.ts +3 -0
  10. package/dist/bar-chart/tokens.d.ts.map +1 -0
  11. package/dist/bar-chart/tokens.js +17 -0
  12. package/dist/bar-chart/tokens.js.map +1 -0
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +4 -2
  16. package/dist/line-chart/LineChart.css +223 -24
  17. package/dist/line-chart/LineChart.d.ts +45 -10
  18. package/dist/line-chart/LineChart.d.ts.map +1 -1
  19. package/dist/line-chart/LineChart.js +580 -265
  20. package/dist/line-chart/LineChart.js.map +1 -1
  21. package/dist/line-chart/LineChart.module.js +42 -5
  22. package/dist/line-chart/LineChart.module.js.map +1 -1
  23. package/dist/line-chart/geometry.d.ts +37 -0
  24. package/dist/line-chart/geometry.d.ts.map +1 -0
  25. package/dist/line-chart/geometry.js +115 -0
  26. package/dist/line-chart/geometry.js.map +1 -0
  27. package/dist/line-chart/tokens.d.ts +1 -1
  28. package/dist/line-chart/tokens.d.ts.map +1 -1
  29. package/dist/line-chart/tokens.js +11 -7
  30. package/dist/line-chart/tokens.js.map +1 -1
  31. package/dist/meter/Meter.css +23 -0
  32. package/dist/meter/Meter.d.ts +26 -0
  33. package/dist/meter/Meter.d.ts.map +1 -0
  34. package/dist/meter/Meter.js +99 -0
  35. package/dist/meter/Meter.js.map +1 -0
  36. package/dist/meter/Meter.module.js +16 -0
  37. package/dist/meter/Meter.module.js.map +1 -0
  38. package/dist/meter/tokens.d.ts +3 -0
  39. package/dist/meter/tokens.d.ts.map +1 -0
  40. package/dist/meter/tokens.js +15 -0
  41. package/dist/meter/tokens.js.map +1 -0
  42. package/dist/stat/Stat.css +4 -0
  43. package/dist/stat/Stat.d.ts +11 -3
  44. package/dist/stat/Stat.d.ts.map +1 -1
  45. package/dist/stat/Stat.js +67 -42
  46. package/dist/stat/Stat.js.map +1 -1
  47. package/dist/stat/Stat.module.js +3 -1
  48. package/dist/stat/Stat.module.js.map +1 -1
  49. package/dist/theme/components.d.ts +3 -1
  50. package/dist/theme/components.d.ts.map +1 -1
  51. package/dist/theme/components.js +4 -0
  52. package/dist/theme/components.js.map +1 -1
  53. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.js","names":["CSSProperties","usePanneauIntl","Skeleton","chartColors","cx","styles","LineChartPoint","label","value","LineChartProps","points","formatValue","height","color","className","MAX_DOTS","LineChart","t0","$","_c","t1","undefined","intl","t2","formatNumber","format","t3","categorical","t4","t5","style","t6","chart","t7","t8","Symbol","for","plot","t9","first","last","t10","values","map","_temp","low","Math","min","high","max","top","t11","length","index","x","t12","value_0","y","t13","t14","point_0","index_0","point","join","line","zero","at","t15","baseline","t16","area","t17","t18","point_1","index_1","dot","svg","labels","point_2","visuallyHidden","_c","styles","_Fragment"],"sources":["../../src/line-chart/LineChart.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nimport { usePanneauIntl } from '../intl/usePanneauIntl';\nimport { Skeleton } from '../skeleton/Skeleton';\nimport { chartColors } from '../theme/chartColors';\nimport { cx } from '../utils/cx';\nimport styles from './LineChart.module.css';\n\n/** A point of a `LineChart`. */\nexport interface LineChartPoint {\n /** What the point is, under the chart and in its table: a day, a week, a month. */\n label: string;\n value: number;\n}\n\nexport interface LineChartProps {\n /** What the chart shows: the caption of its table, for assistive technologies. */\n label: string;\n /** The points, in order. Left `undefined` while they load: a skeleton of the plot. */\n points?: LineChartPoint[] | undefined;\n /** Formats a value, in the table and the top of the scale. Defaults to a number of the locale. */\n formatValue?: (value: number) => string;\n /** Height of the plot, without the labels: `'10rem'`. Defaults to the `height` token. */\n height?: string;\n /** The categorical color of the line, from 0. Defaults to the first. */\n color?: number;\n className?: string;\n}\n\n/** Points get dots up to this count: past it, only the last one has one. */\nconst MAX_DOTS = 31;\n\n/**\n * A line of values over time, on the categorical chart colors of the theme: the line, the area\n * under it, the top of its scale, and the labels of its first and last points. The plot is hidden\n * from assistive technologies, which read the values in a table instead.\n */\nexport function LineChart({\n label,\n points,\n formatValue,\n height,\n color = 0,\n className,\n}: LineChartProps) {\n const intl = usePanneauIntl();\n const format = formatValue ?? ((value: number) => intl.formatNumber(value));\n const style = {\n '--_panneau-line-chart-color': chartColors.categorical(color),\n ...(height !== undefined ? { '--_panneau-line-chart-height': height } : {}),\n } as CSSProperties;\n if (points === undefined) {\n return (\n <div className={cx('panneau-line-chart', styles.chart, className)} style={style}>\n <div className={styles.plot}>\n <Skeleton shape=\"rect\" height=\"100%\" />\n </div>\n <Skeleton width=\"100%\" />\n </div>\n );\n }\n const values = points.map((point) => point.value);\n const low = Math.min(0, ...values);\n const high = Math.max(low + 1, ...values);\n // Room above the highest point, for the width of the line and its dot\n const top = high + (high - low) * 0.08;\n const x = (index: number) => (points.length === 1 ? 50 : (index / (points.length - 1)) * 100);\n const y = (value: number) => 100 - ((value - low) / (top - low)) * 100;\n const line = points\n .map((point, index) => `${index === 0 ? 'M' : 'L'}${x(index)},${y(point.value)}`)\n .join(' ');\n const zero = y(Math.max(low, 0));\n const first = points[0];\n const last = points.at(-1);\n return (\n <figure className={cx('panneau-line-chart', styles.chart, className)} style={style}>\n <div className={styles.plot}>\n <svg\n className={styles.svg}\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <line className={styles.baseline} x1=\"0\" x2=\"100\" y1={zero} y2={zero} />\n {points.length > 1 ? (\n <>\n <path\n className={styles.area}\n d={`${line} L${x(points.length - 1)},${zero} L${x(0)},${zero} Z`}\n />\n <path className={styles.line} d={line} />\n </>\n ) : null}\n {points.map((point, index) =>\n points.length <= MAX_DOTS || index === points.length - 1 ? (\n <path\n key={point.label}\n className={styles.dot}\n d={`M${x(index)},${y(point.value)} h0`}\n >\n <title>{`${point.label}: ${format(point.value)}`}</title>\n </path>\n ) : null,\n )}\n </svg>\n {/* The top of the scale, unless every value is at the bottom of it (all 0) */}\n {points.length > 0 && Math.max(...values) > low ? (\n <span className={styles.max} aria-hidden=\"true\">\n {format(Math.max(...values))}\n </span>\n ) : null}\n </div>\n {first !== undefined && last !== undefined ? (\n <div className={styles.labels} aria-hidden=\"true\">\n <span>{first.label}</span>\n {points.length > 1 ? <span>{last.label}</span> : null}\n </div>\n ) : null}\n {/* Hidden in a wrapper: on the table itself, Chrome leaves its caption visible */}\n <div className={styles.visuallyHidden}>\n <table>\n <caption>{label}</caption>\n <tbody>\n {points.map((point) => (\n <tr key={point.label}>\n <th scope=\"row\">{point.label}</th>\n <td>{format(point.value)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </figure>\n );\n}\n"],"mappings":";;;;;;;;;AA8BA,IAAMe,WAAW;;;;;;AAOjB,SAAOC,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAmB,MAAA,EAAAZ,OAAAG,QAAAC,aAAAC,QAAAC,OAAAO,IAAAN,cAAAG;CAKtB,MAAAJ,QAAAO,OAAAC,KAAAA,IAAA,IAAAD;CAGA,MAAAE,OAAarB,eAAe;CAAE,IAAAsB;CAAA,IAAAL,EAAA,OAAAP,eAAAO,EAAA,OAAAI,MAAA;EACfC,KAAAZ,iBAAAH,UAAmCc,KAAIE,aAAchB,KAAK;EAAEU,EAAA,KAAAP;EAAAO,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAA3E,MAA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;EAAAP,EAAA,MAAAR;EAAAQ,EAAA,MAAAyC;CAAA,OAAAA,MAAAzC,EAAA;CAAA,IAAAiD;CAAA,IAAAjD,EAAA,QAAAyC,KAAA;EANNQ,MAAA,oBAAA,SAAA,EAAA,UACKR,IAMG,CAAA;EAAAzC,EAAA,MAAAyC;EAAAzC,EAAA,MAAAiD;CAAA,OAAAA,MAAAjD,EAAA;CAAA,IAAAmD;CAAA,IAAAnD,EAAA,QAAAwC,OAAAxC,EAAA,QAAAiD,KAAA;EAVhBE,MAAA,oBAAA,OAAA;GAAgB,WAAAhE,yBAAM0E;GAClB,UAAA,qBAAA,SAAA,EAAA,UAAA,CACIrB,KACAS,GAQI,EAAA,CAAA;EACN,CAAA;EAAAjD,EAAA,MAAAwC;EAAAxC,EAAA,MAAAiD;EAAAjD,EAAA,MAAAmD;CAAA,OAAAA,MAAAnD,EAAA;CAAA,IAAAqD;CAAA,IAAArD,EAAA,QAAAuB,OAAAvB,EAAA,QAAAiC,OAAAjC,EAAA,QAAAqC,OAAArC,EAAA,QAAAmD,OAAAnD,EAAA,QAAAoB,IAAA;EAzDViC,MAAA,qBAAA,UAAA;GAAmB,WAAAjC;GAA0DR,OAAAA;GAA7E,UAAA;IACIqB;IAqCCI;IAODc;GAaK;;EAAAnD,EAAA,MAAAuB;EAAAvB,EAAA,MAAAiC;EAAAjC,EAAA,MAAAqC;EAAArC,EAAA,MAAAmD;EAAAnD,EAAA,MAAAoB;EAAApB,EAAA,MAAAqD;CAAA,OAAAA,MAAArD,EAAA;CAAA,OA1DTqD;AA0DS;AAhGV,SAAA3B,MAAAkB,OAAA;CAAA,OAwBkCA,MAAKtD;AAAM"}
1
+ {"version":3,"file":"LineChart.js","names":["CSSProperties","KeyboardEvent","PointerEvent","useId","useState","messages","usePanneauIntl","Skeleton","chartColors","cx","styles","PlotPoint","axisLabelIndices","linearPath","monotonePath","niceScale","LineChartPoint","label","shortLabel","value","LineChartProps","points","formatValue","formatTick","axisLabel","showAxis","showLast","showMax","isInteractive","domain","min","max","curve","height","color","className","MAX_AXIS_LABELS","LABEL_GAP","LineChart","t0","$","_c","t1","t2","t3","t4","t5","t6","undefined","intl","t7","t8","t9","Symbol","for","replace","gradientId","active","setActive","formatNumber","format","t10","categorical","t11","t12","style","t13","chart","t14","t15","skeleton","t16","lastIndex","plotted","t17","t18","t19","t20","t21","t22","t23","t24","t25","t26","t27","t28","t29","t30","t31","values","map","_temp","scale","Math","tick","value_0","notation","y","value_1","t32","length","point_0","index","x","point","line","zero","firstPoint","lastPoint","maxValue","maxIndex","indexOf","maxPoint","labelLast","labelMax","activePoint","activeData","_temp2","t33","point_2","formatMessage","chartPoint","describe","t34","event","rect","currentTarget","getBoundingClientRect","width","ratio","clientX","left","round","point_3","t35","event_0","current","next","key","preventDefault","move","focused","t36","role","tabIndex","const","onPointerMove","onPointerDown","onPointerLeave","onFocus","current_0","onBlur","onKeyDown","interaction","widestTick","ticks","reduce","_temp3","t37","index_0","previous","current_1","placement","t38","index_1","where","placedAt","data","valueLabel","positionOf","body","widest","value_2","top","plot","t39","t40","areaTop","areaBottom","t41","t42","value_3","grid","t43","baseline","t44","reveal","area","svg","crosshair","marks","dot","activeDot","tooltip","tooltipValue","tooltipLabel","index_2","minor","data_0","where_0","date","dates","data_1","index_3","visuallyHidden","text","point_1","_c","styles","_Fragment"],"sources":["../../src/line-chart/LineChart.tsx"],"sourcesContent":["import { type CSSProperties, type KeyboardEvent, type PointerEvent, useId, useState } from 'react';\n\nimport { messages } from '../intl/messages';\nimport { usePanneauIntl } from '../intl/usePanneauIntl';\nimport { Skeleton } from '../skeleton/Skeleton';\nimport { chartColors } from '../theme/chartColors';\nimport { cx } from '../utils/cx';\nimport styles from './LineChart.module.css';\nimport { type PlotPoint, axisLabelIndices, linearPath, monotonePath, niceScale } from './geometry';\n\n/** A point of a `LineChart`. */\nexport interface LineChartPoint {\n /** What the point is, in its table and its tooltip: a day, a week, a month. */\n label: string;\n /** A shorter label, under the chart: `Oct 5`. The `label` by default. */\n shortLabel?: string | undefined;\n value: number;\n}\n\nexport interface LineChartProps {\n /** What the chart shows: the caption of its table, for assistive technologies. */\n label: string;\n /** The points, in order. Left `undefined` while they load: a skeleton of the plot. */\n points?: LineChartPoint[] | undefined;\n /** Formats a value: in the table, the labels on the line and the tooltip. A number of the locale by default. */\n formatValue?: ((value: number) => string) | undefined;\n /**\n * Formats a graduation of the scale, short: `1 min`, `25 %`. A number of the locale by default,\n * compact (`10K`) on a scale that reaches 10,000.\n */\n formatTick?: ((value: number) => string) | undefined;\n /** What the values are, above the scale: `Entries`, `Minutes`. */\n axisLabel?: string | undefined;\n /**\n * Shows the scale: round graduations, with a line across the plot for each. Without it, a line\n * at 0 alone, for a chart that only shows a trend. `true` by default.\n */\n showAxis?: boolean | undefined;\n /** Writes the last value at the end of the line. `true` by default. */\n showLast?: boolean | undefined;\n /** Marks the highest value on the line, with its value. */\n showMax?: boolean | undefined;\n /**\n * Shows the value of the point under the pointer, or chosen with the arrow keys: for a long\n * series, where a point can't be read from the scale. Off by default: the values a chart needs\n * are on it, and every one is in its table.\n */\n isInteractive?: boolean | undefined;\n /**\n * Fixes the bounds of the scale: `{ min: 0, max: 1 }` for a ratio. From 0, or the lowest value\n * under it, to a round value above the highest by default.\n */\n domain?: { min?: number | undefined; max?: number | undefined } | undefined;\n /** `monotone` (default) curves through the points without going past them, `linear` joins them straight. */\n curve?: 'monotone' | 'linear' | undefined;\n /** Height of the plot, without the labels: `'10rem'`. Defaults to the `height` token. */\n height?: string | undefined;\n /** The categorical color of the line, from 0. Defaults to the first. */\n color?: number | undefined;\n className?: string | undefined;\n}\n\n/** At most this number of labels under the chart, half of them when it is narrow. */\nconst MAX_AXIS_LABELS = 7;\n\n/** Closer than this (in percents of the width), the highest value isn't labeled beside the last one. */\nconst LABEL_GAP = 12;\n\n/**\n * A line of values over time, on the categorical chart colors of the theme: a curve and the area\n * under it, a scale of round graduations, labels of dates under it, and the last value at the end\n * of the line. The plot is hidden from assistive technologies, which read the values in a table;\n * with `isInteractive`, the pointer and the arrow keys also show the value of each point.\n */\nexport function LineChart({\n label,\n points,\n formatValue,\n formatTick,\n axisLabel,\n showAxis = true,\n showLast = true,\n showMax = false,\n isInteractive = false,\n domain,\n curve = 'monotone',\n height,\n color = 0,\n className,\n}: LineChartProps) {\n const intl = usePanneauIntl();\n const gradientId = `panneau-line-chart-${useId().replace(/[^\\w-]/g, '')}`;\n const [active, setActive] = useState<number | null>(null);\n const format = formatValue ?? ((value: number) => intl.formatNumber(value));\n const style = {\n '--_panneau-line-chart-color': chartColors.categorical(color),\n ...(height !== undefined ? { '--_panneau-line-chart-height': height } : {}),\n } as CSSProperties;\n if (points === undefined) {\n return (\n <div className={cx('panneau-line-chart', styles.chart, className)} style={style}>\n <div className={styles.skeleton}>\n <Skeleton shape=\"rect\" height=\"100%\" />\n </div>\n <Skeleton width=\"100%\" />\n </div>\n );\n }\n\n const values = points.map((point) => point.value);\n const scale = niceScale(Math.min(...values, 0), Math.max(...values, 0), domain);\n const tick =\n formatTick ??\n ((value: number) =>\n intl.formatNumber(value, scale.max >= 10_000 ? { notation: 'compact' } : {}));\n const y = (value: number) => 100 - ((value - scale.min) / (scale.max - scale.min)) * 100;\n const plotted: PlotPoint[] = points.map((point, index) => ({\n x: points.length === 1 ? 50 : (index / (points.length - 1)) * 100,\n y: y(point.value),\n }));\n const line = curve === 'linear' ? linearPath(plotted) : monotonePath(plotted);\n const zero = y(Math.min(Math.max(0, scale.min), scale.max));\n const firstPoint = plotted[0];\n const lastIndex = points.length - 1;\n const lastPoint = plotted[lastIndex];\n const maxValue = Math.max(...values);\n const maxIndex = values.indexOf(maxValue);\n const maxPoint = plotted[maxIndex];\n const labelLast = showLast && lastPoint !== undefined;\n const labelMax =\n showMax &&\n maxPoint !== undefined &&\n maxValue > scale.min &&\n !(labelLast && lastPoint.x - maxPoint.x < LABEL_GAP);\n const activePoint = active !== null ? plotted[active] : undefined;\n const activeData = active !== null ? points[active] : undefined;\n const shortLabel = (point: LineChartPoint) => point.shortLabel ?? point.label;\n const describe = (point: LineChartPoint) =>\n intl.formatMessage(messages.chartPoint, { label: point.label, value: format(point.value) });\n\n // The point under the pointer: the nearest one along the width of the plot\n const point = (event: PointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n if (rect.width > 0 && points.length > 0) {\n const ratio = Math.min(Math.max((event.clientX - rect.left) / rect.width, 0), 1);\n setActive(Math.round(ratio * lastIndex));\n }\n };\n const move = (event: KeyboardEvent<HTMLDivElement>) => {\n const current = active ?? lastIndex;\n const next =\n event.key === 'ArrowLeft' || event.key === 'ArrowDown'\n ? current - 1\n : event.key === 'ArrowRight' || event.key === 'ArrowUp'\n ? current + 1\n : event.key === 'Home'\n ? 0\n : event.key === 'End'\n ? lastIndex\n : null;\n if (next !== null) {\n event.preventDefault();\n setActive(Math.min(Math.max(next, 0), lastIndex));\n }\n };\n const focused = points[active ?? lastIndex];\n const interaction =\n isInteractive && focused !== undefined\n ? {\n role: 'slider',\n tabIndex: 0,\n 'aria-label': label,\n 'aria-orientation': 'horizontal' as const,\n 'aria-valuemin': 0,\n 'aria-valuemax': lastIndex,\n 'aria-valuenow': active ?? lastIndex,\n 'aria-valuetext': describe(focused),\n onPointerMove: point,\n onPointerDown: point,\n onPointerLeave: () => setActive(null),\n onFocus: () => setActive((current) => current ?? lastIndex),\n onBlur: () => setActive(null),\n onKeyDown: move,\n }\n : {};\n\n const widestTick = scale.ticks\n .map(tick)\n .reduce((widest, text) => (text.length > widest.length ? text : widest), '');\n const placement = (index: number): 'above' | 'below' => {\n const previous = points[index - 1];\n const current = points[index];\n return previous !== undefined && current !== undefined && previous.value > current.value\n ? 'below'\n : 'above';\n };\n const valueLabel = (index: number, where: PlotPoint, placedAt: 'above' | 'below') => {\n const data = points[index];\n return data !== undefined ? (\n <span className={styles.valueLabel} data-placement={placedAt} style={positionOf(where)}>\n {format(data.value)}\n </span>\n ) : null;\n };\n\n return (\n <figure\n className={cx('panneau-line-chart', styles.chart, className)}\n style={style}\n data-axis={showAxis ? '' : undefined}\n data-labels={labelLast || labelMax ? '' : undefined}\n >\n {axisLabel !== undefined ? (\n <div className={styles.axisLabel} aria-hidden=\"true\">\n {axisLabel}\n </div>\n ) : null}\n <div className={styles.body}>\n {showAxis ? (\n <div className={styles.scale} aria-hidden=\"true\">\n {/* The widest graduation gives the width of the column */}\n <span className={styles.widest}>{widestTick}</span>\n {scale.ticks.map((value) => (\n <span\n key={value}\n className={styles.tick}\n style={{ top: `${y(value)}%` }}\n >\n {tick(value)}\n </span>\n ))}\n </div>\n ) : null}\n <div className={styles.plot} {...interaction}>\n <svg\n className={styles.svg}\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"none\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0\" className={styles.areaTop} />\n <stop offset=\"1\" className={styles.areaBottom} />\n </linearGradient>\n </defs>\n {showAxis\n ? scale.ticks.map((value) => (\n <line\n key={value}\n className={styles.grid}\n x1=\"0\"\n x2=\"100\"\n y1={y(value)}\n y2={y(value)}\n />\n ))\n : null}\n <line className={styles.baseline} x1=\"0\" x2=\"100\" y1={zero} y2={zero} />\n {firstPoint !== undefined &&\n lastPoint !== undefined &&\n points.length > 1 ? (\n <g className={styles.reveal}>\n <path\n className={styles.area}\n fill={`url(#${gradientId})`}\n d={`${line} L${lastPoint.x},${zero} L${firstPoint.x},${zero} Z`}\n />\n <path className={styles.line} d={line} />\n </g>\n ) : null}\n </svg>\n {activePoint !== undefined ? (\n <span\n className={styles.crosshair}\n style={{ left: `${activePoint.x}%` }}\n aria-hidden=\"true\"\n />\n ) : null}\n <div className={styles.marks} aria-hidden=\"true\">\n {points.length === 1 && firstPoint !== undefined && !labelLast ? (\n <span className={styles.dot} style={positionOf(firstPoint)} />\n ) : null}\n {labelMax && maxPoint !== undefined ? (\n <span className={styles.dot} style={positionOf(maxPoint)} />\n ) : null}\n {labelLast && lastPoint !== undefined ? (\n <span className={styles.dot} style={positionOf(lastPoint)} />\n ) : null}\n {activePoint === undefined && labelMax && maxPoint !== undefined\n ? valueLabel(maxIndex, maxPoint, 'above')\n : null}\n {activePoint === undefined && labelLast && lastPoint !== undefined\n ? valueLabel(lastIndex, lastPoint, placement(lastIndex))\n : null}\n {activePoint !== undefined && activeData !== undefined ? (\n <>\n <span\n className={cx(styles.dot, styles.activeDot)}\n style={positionOf(activePoint)}\n />\n <span\n className={styles.tooltip}\n data-placement={activePoint.y < 30 ? 'below' : 'above'}\n style={positionOf(activePoint)}\n >\n <strong className={styles.tooltipValue}>\n {format(activeData.value)}\n </strong>\n <span className={styles.tooltipLabel}>{activeData.label}</span>\n </span>\n </>\n ) : null}\n </div>\n </div>\n <div className={styles.dates} aria-hidden=\"true\">\n {axisLabelIndices(points.length, MAX_AXIS_LABELS).map(({ index, minor }) => {\n const data = points[index];\n const where = plotted[index];\n return data !== undefined && where !== undefined ? (\n <span\n key={index}\n className={cx(styles.date, minor && styles.minor)}\n data-edge={\n points.length === 1\n ? undefined\n : index === 0\n ? 'start'\n : index === lastIndex\n ? 'end'\n : undefined\n }\n style={{ left: `${where.x}%` }}\n >\n {shortLabel(data)}\n </span>\n ) : null;\n })}\n </div>\n </div>\n {/* Hidden in a wrapper: on the table itself, Chrome leaves its caption visible */}\n <div className={styles.visuallyHidden}>\n <table>\n <caption>{label}</caption>\n <tbody>\n {points.map((data, index) => (\n <tr key={index}>\n <th scope=\"row\">{data.label}</th>\n <td>{format(data.value)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </figure>\n );\n}\n\n/** The position of a mark on the plot, and its place along the width, to keep its label inside. */\nfunction positionOf(where: PlotPoint): CSSProperties {\n return { left: `${where.x}%`, top: `${where.y}%`, '--_x': where.x } as CSSProperties;\n}\n"],"mappings":";;;;;;;;;;;;AA+DA,IAAMoC,kBAAkB;;AAGxB,IAAMC,YAAY;;;;;;;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;GACI,aAAAqB;GACE,eAAAC;GAJjB,UAAA;IAMKC;IAKDsD;IA6HAkC;GAaK;;EAAAxI,EAAA,OAAA4C;EAAA5C,EAAA,OAAA6C;EAAA7C,EAAA,OAAA8C;EAAA9C,EAAA,OAAA+C;EAAA/C,EAAA,OAAAgD;EAAAhD,EAAA,OAAAsG;EAAAtG,EAAA,OAAAwI;EAAAxI,EAAA,OAAA2I;CAAA,OAAAA,MAAA3I,EAAA;CAAA,OArJT2I;AAqJS;;AAzRV,SAAAtB,OAAAc,QAAAkC,MAAA;CAAA,OAkH4BA,KAAIzG,SAAUuE,OAAMvE,SAApByG,OAAAlC;AAA2C;AAlHvE,SAAAtD,OAAAyF,SAAA;CAAA,OA8D2CtG,QAAKtF,cAAesF,QAAKvF;AAAM;AA9D1E,SAAA0E,MAAAa,OAAA;CAAA,OAmCkCA,MAAKrF;AAAM;AA2PpD,SAASsJ,WAAWJ,OAAiC;CACjD,OAAO;EAAElC,MAAM,GAAGkC,MAAM9D,EAAC;EAAKsE,KAAK,GAAGR,MAAMpE,EAAC;EAAK,QAAQoE,MAAM9D;CAAE;AACtE"}
@@ -1,28 +1,65 @@
1
1
  import "./LineChart.css";
2
2
  //#region src/line-chart/LineChart.module.css
3
3
  var chart = "panneau-line-chart-chart";
4
+ var skeleton = "panneau-line-chart-skeleton";
5
+ var axisLabel = "panneau-line-chart-axis-label";
6
+ var body = "panneau-line-chart-body";
7
+ var scale = "panneau-line-chart-scale";
8
+ var widest = "panneau-line-chart-widest";
9
+ var tick = "panneau-line-chart-tick";
4
10
  var plot = "panneau-line-chart-plot";
5
11
  var svg = "panneau-line-chart-svg";
12
+ var grid = "panneau-line-chart-grid";
6
13
  var baseline = "panneau-line-chart-baseline";
14
+ var areaTop = "panneau-line-chart-area-top";
15
+ var areaBottom = "panneau-line-chart-area-bottom";
7
16
  var area = "panneau-line-chart-area";
8
17
  var line = "panneau-line-chart-line";
18
+ var reveal = "panneau-line-chart-reveal";
19
+ var marks = "panneau-line-chart-marks";
9
20
  var dot = "panneau-line-chart-dot";
10
- var max = "panneau-line-chart-max";
11
- var labels = "panneau-line-chart-labels";
21
+ var activeDot = "panneau-line-chart-active-dot";
22
+ var crosshair = "panneau-line-chart-crosshair";
23
+ var valueLabel = "panneau-line-chart-value-label";
24
+ var tooltip = "panneau-line-chart-tooltip";
25
+ var tooltipValue = "panneau-line-chart-tooltip-value";
26
+ var tooltipLabel = "panneau-line-chart-tooltip-label";
27
+ var dates = "panneau-line-chart-dates";
28
+ var date = "panneau-line-chart-date";
29
+ var minor = "panneau-line-chart-minor";
12
30
  var visuallyHidden = "panneau-line-chart-visually-hidden";
13
31
  var LineChart_module_default = {
14
32
  chart,
33
+ skeleton,
34
+ axisLabel,
35
+ body,
36
+ scale,
37
+ widest,
38
+ tick,
15
39
  plot,
16
40
  svg,
41
+ grid,
17
42
  baseline,
43
+ areaTop,
44
+ areaBottom,
18
45
  area,
19
46
  line,
47
+ reveal,
48
+ marks,
49
+ "fade-in": "panneau-line-chart-fade-in",
20
50
  dot,
21
- max,
22
- labels,
51
+ activeDot,
52
+ crosshair,
53
+ valueLabel,
54
+ tooltip,
55
+ tooltipValue,
56
+ tooltipLabel,
57
+ dates,
58
+ date,
59
+ minor,
23
60
  visuallyHidden
24
61
  };
25
62
  //#endregion
26
- export { area, baseline, chart, LineChart_module_default as default, dot, labels, line, max, plot, svg, visuallyHidden };
63
+ export { activeDot, area, areaBottom, areaTop, axisLabel, baseline, body, chart, crosshair, date, dates, LineChart_module_default as default, dot, grid, line, marks, minor, plot, reveal, scale, skeleton, svg, tick, tooltip, tooltipLabel, tooltipValue, valueLabel, visuallyHidden, widest };
27
64
 
28
65
  //# sourceMappingURL=LineChart.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.module.js","names":[],"sources":["../../src/line-chart/LineChart.module.css"],"sourcesContent":[".chart {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-1);\n min-width: 0;\n margin: 0;\n}\n\n.plot {\n position: relative;\n height: var(--_panneau-line-chart-height, var(--panneau-line-chart-height, 8rem));\n}\n\n.svg {\n display: block;\n width: 100%;\n height: 100%;\n overflow: visible;\n}\n\n.baseline {\n stroke: var(--panneau-color-border);\n stroke-width: 1px;\n vector-effect: non-scaling-stroke;\n}\n\n.area {\n fill: var(--_panneau-line-chart-color);\n fill-opacity: var(--panneau-line-chart-area-opacity, 0.12);\n stroke: none;\n}\n\n.line {\n fill: none;\n stroke: var(--_panneau-line-chart-color);\n stroke-width: var(--panneau-line-chart-line-width, 2px);\n stroke-linejoin: round;\n stroke-linecap: round;\n vector-effect: non-scaling-stroke;\n}\n\n/* A path of no length with a round cap: a dot that the stretched plot doesn't deform. */\n.dot {\n fill: none;\n stroke: var(--_panneau-line-chart-color);\n stroke-width: var(--panneau-line-chart-dot-size, 6px);\n stroke-linecap: round;\n vector-effect: non-scaling-stroke;\n}\n\n.max,\n.labels {\n font-size: var(--panneau-line-chart-label-font-size, var(--panneau-font-size-xs));\n font-variant-numeric: var(--panneau-font-numeric);\n color: var(--panneau-color-text-muted);\n}\n\n.max {\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 0;\n line-height: 1;\n transform: translateY(-50%);\n padding-inline-end: var(--panneau-space-1);\n background-color: var(--panneau-card-bg, var(--panneau-color-surface));\n}\n\n.labels {\n display: flex;\n justify-content: space-between;\n gap: var(--panneau-space-2);\n}\n\n.visuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"LineChart.module.js","names":[],"sources":["../../src/line-chart/LineChart.module.css"],"sourcesContent":[".chart {\n --_panneau-line-chart-plot-height: var(\n --_panneau-line-chart-height,\n var(--panneau-line-chart-height, 8rem)\n );\n --_panneau-line-chart-reveal: var(\n --panneau-line-chart-reveal-duration,\n calc(var(--panneau-duration-slow) * 3)\n );\n\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-1);\n min-width: 0;\n margin: 0;\n container: panneau-line-chart / inline-size;\n font-size: var(--panneau-line-chart-label-font-size, var(--panneau-font-size-xs));\n line-height: 1.5;\n}\n\n.skeleton {\n height: var(--_panneau-line-chart-plot-height);\n}\n\n.axisLabel {\n color: var(--panneau-color-text-muted);\n}\n\n/* The scale on the left of the plot, the dates under it */\n.body {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n column-gap: var(--panneau-space-2);\n row-gap: var(--panneau-space-1);\n}\n\n.chart[data-axis] .body {\n grid-template-columns: auto minmax(0, 1fr);\n /* Room for the top graduation, centered on its line */\n padding-block-start: 0.75em;\n}\n\n/* Room for a value written above the highest point */\n.chart[data-labels] .body {\n padding-block-start: 2em;\n}\n\n.scale {\n position: relative;\n height: var(--_panneau-line-chart-plot-height);\n color: var(--panneau-color-text-muted);\n font-variant-numeric: tabular-nums;\n text-align: end;\n}\n\n.widest {\n display: block;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n}\n\n.tick {\n position: absolute;\n inset-inline-end: 0;\n transform: translateY(-50%);\n white-space: nowrap;\n}\n\n.plot {\n position: relative;\n height: var(--_panneau-line-chart-plot-height);\n border-radius: var(--panneau-radius-sm);\n touch-action: pan-y;\n}\n\n.plot[role='slider'] {\n cursor: crosshair;\n}\n\n.plot[role='slider']:focus-visible {\n outline: var(--panneau-focus-width) solid var(--panneau-color-focus);\n outline-offset: 4px;\n}\n\n.svg {\n display: block;\n width: 100%;\n height: 100%;\n overflow: visible;\n}\n\n.grid,\n.baseline {\n stroke-width: 1px;\n vector-effect: non-scaling-stroke;\n shape-rendering: crispEdges;\n}\n\n.grid {\n stroke: var(--panneau-line-chart-grid-color, var(--panneau-color-border));\n stroke-opacity: 0.6;\n}\n\n.baseline {\n stroke: var(--panneau-color-border);\n}\n\n.areaTop {\n stop-color: var(--_panneau-line-chart-color);\n stop-opacity: var(--panneau-line-chart-area-opacity, 0.2);\n}\n\n.areaBottom {\n stop-color: var(--_panneau-line-chart-color);\n stop-opacity: 0;\n}\n\n.area {\n stroke: none;\n}\n\n.line {\n fill: none;\n stroke: var(--_panneau-line-chart-color);\n stroke-width: var(--panneau-line-chart-line-width, 2px);\n stroke-linejoin: round;\n stroke-linecap: round;\n vector-effect: non-scaling-stroke;\n}\n\n/* The line draws itself from the left when the chart appears, then its labels fade in */\n.reveal {\n animation: reveal var(--_panneau-line-chart-reveal) var(--panneau-ease-out) both;\n}\n\n.marks {\n animation: fade-in var(--panneau-duration-slow) var(--panneau-ease-out)\n var(--_panneau-line-chart-reveal) both;\n}\n\n@keyframes reveal {\n from {\n clip-path: inset(-10% 100% -10% -10%);\n }\n\n to {\n clip-path: inset(-10% -10% -10% -10%);\n }\n}\n\n@keyframes fade-in {\n from {\n opacity: 0;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .reveal,\n .marks {\n animation: none;\n }\n}\n\n/* A dot, round whatever the width of the chart, with a ring of the surface around it */\n.dot {\n position: absolute;\n width: var(--panneau-line-chart-dot-size, 8px);\n height: var(--panneau-line-chart-dot-size, 8px);\n border-radius: 50%;\n background-color: var(--_panneau-line-chart-color);\n box-shadow: 0 0 0 2px var(--panneau-card-bg, var(--panneau-color-surface));\n transform: translate(-50%, -50%);\n pointer-events: none;\n}\n\n.activeDot {\n width: calc(var(--panneau-line-chart-dot-size, 8px) + 2px);\n height: calc(var(--panneau-line-chart-dot-size, 8px) + 2px);\n}\n\n.crosshair {\n position: absolute;\n inset-block: 0;\n width: 1px;\n background-color: var(--panneau-color-border-control);\n transform: translateX(-50%);\n pointer-events: none;\n}\n\n/* A value on the line: above or under its point, kept inside the width of the plot */\n.valueLabel,\n.tooltip {\n position: absolute;\n white-space: nowrap;\n pointer-events: none;\n --_panneau-line-chart-shift-x: calc(var(--_x) * -1%);\n}\n\n.valueLabel {\n padding-inline: 2px;\n font-weight: var(--panneau-font-weight-medium);\n font-variant-numeric: tabular-nums;\n color: var(--panneau-color-text);\n background-color: var(--panneau-card-bg, var(--panneau-color-surface));\n border-radius: var(--panneau-radius-sm);\n}\n\n.valueLabel[data-placement='above'],\n.tooltip[data-placement='above'] {\n transform: translate(var(--_panneau-line-chart-shift-x), calc(-100% - 0.5rem));\n}\n\n.valueLabel[data-placement='below'],\n.tooltip[data-placement='below'] {\n transform: translate(var(--_panneau-line-chart-shift-x), 0.5rem);\n}\n\n.tooltip {\n display: flex;\n flex-direction: column;\n padding: var(--panneau-space-1) var(--panneau-space-2);\n color: var(--panneau-color-text);\n background-color: var(--panneau-color-surface);\n border: 1px solid var(--panneau-color-border);\n border-radius: var(--panneau-radius-sm);\n box-shadow: var(--panneau-shadow-sm, none);\n z-index: 1;\n}\n\n.tooltipValue {\n font-size: var(--panneau-font-size-sm);\n font-weight: var(--panneau-font-weight-bold);\n font-variant-numeric: tabular-nums;\n}\n\n.tooltipLabel {\n color: var(--panneau-color-text-muted);\n}\n\n.dates {\n position: relative;\n grid-column: -2 / -1;\n height: 1.5em;\n color: var(--panneau-color-text-muted);\n}\n\n/* Centered under its point, the first and last kept inside the width of the plot */\n.date {\n position: absolute;\n white-space: nowrap;\n transform: translateX(-50%);\n}\n\n.date[data-edge='start'] {\n transform: none;\n}\n\n.date[data-edge='end'] {\n transform: translateX(-100%);\n}\n\n.minor {\n display: none;\n}\n\n@container panneau-line-chart (min-width: 28rem) {\n .minor {\n display: inline;\n }\n}\n\n.visuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n"],"mappings":""}
@@ -0,0 +1,37 @@
1
+ /** A point of the drawing, in its coordinates: `x` from 0 (left) to 100, `y` from 0 (top) to 100. */
2
+ export interface PlotPoint {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ /** The scale of a chart: its bounds and the values of its graduations, from the lowest. */
7
+ export interface Scale {
8
+ min: number;
9
+ max: number;
10
+ ticks: number[];
11
+ }
12
+ /**
13
+ * A scale that holds `low` and `high`, in 2 to 4 steps of 1, 2 or 5 times a power of 10:
14
+ * 0 to 1500 by 500 for values up to 1340. `min` and `max` fix a bound instead (0 to 1 for a
15
+ * ratio), the ticks still on round values between them.
16
+ */
17
+ export declare function niceScale(low: number, high: number, { min, max }?: {
18
+ min?: number | undefined;
19
+ max?: number | undefined;
20
+ }): Scale;
21
+ /**
22
+ * The path of a curve through the points, without passing above or below them between two of them
23
+ * (a monotone cubic curve): a count never dips under 0 nor peaks between two days. Its shape doesn't
24
+ * change when the drawing is stretched, as it is to the width of the chart.
25
+ */
26
+ export declare function monotonePath(points: PlotPoint[]): string;
27
+ /** The path of straight segments through the points. */
28
+ export declare function linearPath(points: PlotPoint[]): string;
29
+ /**
30
+ * The points labeled under a chart: the first, the last, and others at regular steps between them,
31
+ * `count` at most. The ones at odd places are `minor`: hidden when the chart is narrow.
32
+ */
33
+ export declare function axisLabelIndices(length: number, count: number): {
34
+ index: number;
35
+ minor: boolean;
36
+ }[];
37
+ //# sourceMappingURL=geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/line-chart/geometry.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,MAAM,WAAW,SAAS;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED,2FAA2F;AAC3F,MAAM,WAAW,KAAK;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;CACnB;AAOD;;;;GAIG;AACH,wBAAgB,SAAS,CACrB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,EAAE,GAAG,EAAE,GAAG,EAAE,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAO,GAC1E,KAAK,CAoBP;AAoBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAuCxD;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAItD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACd;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EAAE,CAiBrC"}
@@ -0,0 +1,115 @@
1
+ //#region src/line-chart/geometry.ts
2
+ /** Rounded, so that 0.1 + 0.2 stays 0.3 on an axis. */
3
+ function round(value) {
4
+ return Number(value.toPrecision(12));
5
+ }
6
+ /**
7
+ * A scale that holds `low` and `high`, in 2 to 4 steps of 1, 2 or 5 times a power of 10:
8
+ * 0 to 1500 by 500 for values up to 1340. `min` and `max` fix a bound instead (0 to 1 for a
9
+ * ratio), the ticks still on round values between them.
10
+ */
11
+ function niceScale(low, high, { min, max } = {}) {
12
+ const from = min ?? Math.min(0, low);
13
+ const to = max ?? Math.max(high, from);
14
+ const range = to - from;
15
+ if (range <= 0) return {
16
+ min: from,
17
+ max: from + 1,
18
+ ticks: [from]
19
+ };
20
+ const rough = range / 3;
21
+ const power = 10 ** Math.floor(Math.log10(rough));
22
+ const step = round([
23
+ 1,
24
+ 2,
25
+ 5
26
+ ].map((multiple) => multiple * power).find((s) => s >= rough) ?? 10 * power);
27
+ const start = min ?? round(Math.floor(from / step) * step);
28
+ const end = max ?? round(Math.ceil(to / step) * step);
29
+ const ticks = [];
30
+ for (let tick = Math.ceil(start / step) * step; tick <= end + step / 1e6; tick += step) ticks.push(round(tick));
31
+ return {
32
+ min: start,
33
+ max: end,
34
+ ticks
35
+ };
36
+ }
37
+ /** The tangent of the curve at the middle of three points (monotone, as d3's `curveMonotoneX`). */
38
+ function innerTangent(previous, point, next) {
39
+ const h0 = point.x - previous.x;
40
+ const h1 = next.x - point.x;
41
+ const s0 = (point.y - previous.y) / h0;
42
+ const s1 = (next.y - point.y) / h1;
43
+ const p = (s0 * h1 + s1 * h0) / (h0 + h1);
44
+ return (Math.sign(s0) + Math.sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), .5 * Math.abs(p));
45
+ }
46
+ /** The tangent at an end, from the tangent next to it. */
47
+ function endTangent(from, to, tangent) {
48
+ const h = to.x - from.x;
49
+ return h !== 0 ? (3 * ((to.y - from.y) / h) - tangent) / 2 : tangent;
50
+ }
51
+ /**
52
+ * The path of a curve through the points, without passing above or below them between two of them
53
+ * (a monotone cubic curve): a count never dips under 0 nor peaks between two days. Its shape doesn't
54
+ * change when the drawing is stretched, as it is to the width of the chart.
55
+ */
56
+ function monotonePath(points) {
57
+ const first = points[0];
58
+ if (first === void 0) return "";
59
+ if (points.length < 3) return linearPath(points);
60
+ const last = points.length - 1;
61
+ const inner = (index) => {
62
+ const previous = points[index - 1];
63
+ const point = points[index];
64
+ const next = points[index + 1];
65
+ return previous !== void 0 && point !== void 0 && next !== void 0 ? innerTangent(previous, point, next) : 0;
66
+ };
67
+ const tangent = (index) => {
68
+ const from = points[index === 0 ? 0 : last - 1];
69
+ const to = points[index === 0 ? 1 : last];
70
+ if ((index === 0 || index === last) && from !== void 0 && to !== void 0) return endTangent(from, to, inner(index === 0 ? 1 : last - 1));
71
+ return inner(index);
72
+ };
73
+ let path = `M${first.x},${first.y}`;
74
+ let previous = first;
75
+ let previousTangent = tangent(0);
76
+ for (const [index, point] of points.entries()) {
77
+ if (index === 0) continue;
78
+ const pointTangent = tangent(index);
79
+ const dx = (point.x - previous.x) / 3;
80
+ path += ` C${round(previous.x + dx)},${round(previous.y + dx * previousTangent)} ${round(point.x - dx)},${round(point.y - dx * pointTangent)} ${point.x},${point.y}`;
81
+ previous = point;
82
+ previousTangent = pointTangent;
83
+ }
84
+ return path;
85
+ }
86
+ /** The path of straight segments through the points. */
87
+ function linearPath(points) {
88
+ return points.map((point, index) => `${index === 0 ? "M" : "L"}${point.x},${point.y}`).join(" ");
89
+ }
90
+ /**
91
+ * The points labeled under a chart: the first, the last, and others at regular steps between them,
92
+ * `count` at most. The ones at odd places are `minor`: hidden when the chart is narrow.
93
+ */
94
+ function axisLabelIndices(length, count) {
95
+ if (length === 0) return [];
96
+ if (length === 1) return [{
97
+ index: 0,
98
+ minor: false
99
+ }];
100
+ const step = Math.max(1, Math.ceil((length - 1) / (count - 1)));
101
+ const indices = [];
102
+ for (let index = 0; index < length - 1; index += step) if (index === 0 || length - 1 - index >= step / 2) indices.push({
103
+ index,
104
+ minor: index / step % 2 === 1
105
+ });
106
+ indices.push({
107
+ index: length - 1,
108
+ minor: false
109
+ });
110
+ return indices;
111
+ }
112
+ //#endregion
113
+ export { axisLabelIndices, linearPath, monotonePath, niceScale };
114
+
115
+ //# sourceMappingURL=geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.js","names":["PlotPoint","x","y","Scale","min","max","ticks","round","value","Number","toPrecision","niceScale","low","high","from","Math","to","range","rough","power","floor","log10","step","map","multiple","find","s","start","end","ceil","tick","push","innerTangent","previous","point","next","h0","h1","s0","s1","p","sign","abs","endTangent","tangent","h","monotonePath","points","first","undefined","length","linearPath","last","inner","index","path","previousTangent","entries","pointTangent","dx","join","axisLabelIndices","count","minor","indices"],"sources":["../../src/line-chart/geometry.ts"],"sourcesContent":["/** A point of the drawing, in its coordinates: `x` from 0 (left) to 100, `y` from 0 (top) to 100. */\nexport interface PlotPoint {\n x: number;\n y: number;\n}\n\n/** The scale of a chart: its bounds and the values of its graduations, from the lowest. */\nexport interface Scale {\n min: number;\n max: number;\n ticks: number[];\n}\n\n/** Rounded, so that 0.1 + 0.2 stays 0.3 on an axis. */\nfunction round(value: number): number {\n return Number(value.toPrecision(12));\n}\n\n/**\n * A scale that holds `low` and `high`, in 2 to 4 steps of 1, 2 or 5 times a power of 10:\n * 0 to 1500 by 500 for values up to 1340. `min` and `max` fix a bound instead (0 to 1 for a\n * ratio), the ticks still on round values between them.\n */\nexport function niceScale(\n low: number,\n high: number,\n { min, max }: { min?: number | undefined; max?: number | undefined } = {},\n): Scale {\n const from = min ?? Math.min(0, low);\n const to = max ?? Math.max(high, from);\n const range = to - from;\n if (range <= 0) {\n // Every value at the bottom (all 0): one step of 1, so the line lies on the baseline\n return { min: from, max: from + 1, ticks: [from] };\n }\n const rough = range / 3;\n const power = 10 ** Math.floor(Math.log10(rough));\n const step = round(\n [1, 2, 5].map((multiple) => multiple * power).find((s) => s >= rough) ?? 10 * power,\n );\n const start = min ?? round(Math.floor(from / step) * step);\n const end = max ?? round(Math.ceil(to / step) * step);\n const ticks: number[] = [];\n for (let tick = Math.ceil(start / step) * step; tick <= end + step / 1e6; tick += step) {\n ticks.push(round(tick));\n }\n return { min: start, max: end, ticks };\n}\n\n/** The tangent of the curve at the middle of three points (monotone, as d3's `curveMonotoneX`). */\nfunction innerTangent(previous: PlotPoint, point: PlotPoint, next: PlotPoint): number {\n const h0 = point.x - previous.x;\n const h1 = next.x - point.x;\n const s0 = (point.y - previous.y) / h0;\n const s1 = (next.y - point.y) / h1;\n const p = (s0 * h1 + s1 * h0) / (h0 + h1);\n return (\n (Math.sign(s0) + Math.sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p))\n );\n}\n\n/** The tangent at an end, from the tangent next to it. */\nfunction endTangent(from: PlotPoint, to: PlotPoint, tangent: number): number {\n const h = to.x - from.x;\n return h !== 0 ? (3 * ((to.y - from.y) / h) - tangent) / 2 : tangent;\n}\n\n/**\n * The path of a curve through the points, without passing above or below them between two of them\n * (a monotone cubic curve): a count never dips under 0 nor peaks between two days. Its shape doesn't\n * change when the drawing is stretched, as it is to the width of the chart.\n */\nexport function monotonePath(points: PlotPoint[]): string {\n const first = points[0];\n if (first === undefined) {\n return '';\n }\n if (points.length < 3) {\n return linearPath(points);\n }\n const last = points.length - 1;\n const inner = (index: number): number => {\n const previous = points[index - 1];\n const point = points[index];\n const next = points[index + 1];\n return previous !== undefined && point !== undefined && next !== undefined\n ? innerTangent(previous, point, next)\n : 0;\n };\n const tangent = (index: number): number => {\n const from = points[index === 0 ? 0 : last - 1];\n const to = points[index === 0 ? 1 : last];\n if ((index === 0 || index === last) && from !== undefined && to !== undefined) {\n return endTangent(from, to, inner(index === 0 ? 1 : last - 1));\n }\n return inner(index);\n };\n let path = `M${first.x},${first.y}`;\n let previous = first;\n let previousTangent = tangent(0);\n for (const [index, point] of points.entries()) {\n if (index === 0) {\n continue;\n }\n const pointTangent = tangent(index);\n const dx = (point.x - previous.x) / 3;\n path += ` C${round(previous.x + dx)},${round(previous.y + dx * previousTangent)} ${round(point.x - dx)},${round(point.y - dx * pointTangent)} ${point.x},${point.y}`;\n previous = point;\n previousTangent = pointTangent;\n }\n return path;\n}\n\n/** The path of straight segments through the points. */\nexport function linearPath(points: PlotPoint[]): string {\n return points\n .map((point, index) => `${index === 0 ? 'M' : 'L'}${point.x},${point.y}`)\n .join(' ');\n}\n\n/**\n * The points labeled under a chart: the first, the last, and others at regular steps between them,\n * `count` at most. The ones at odd places are `minor`: hidden when the chart is narrow.\n */\nexport function axisLabelIndices(\n length: number,\n count: number,\n): { index: number; minor: boolean }[] {\n if (length === 0) {\n return [];\n }\n if (length === 1) {\n return [{ index: 0, minor: false }];\n }\n const step = Math.max(1, Math.ceil((length - 1) / (count - 1)));\n const indices: { index: number; minor: boolean }[] = [];\n for (let index = 0; index < length - 1; index += step) {\n // Not too close to the last one, which always has its label\n if (index === 0 || length - 1 - index >= step / 2) {\n indices.push({ index, minor: (index / step) % 2 === 1 });\n }\n }\n indices.push({ index: length - 1, minor: false });\n return indices;\n}\n"],"mappings":";;AAcA,SAASO,MAAMC,OAAuB;CAClC,OAAOC,OAAOD,MAAME,YAAY,EAAE,CAAC;AACvC;;;;;;AAOA,SAAgBC,UACZC,KACAC,MACA,EAAET,KAAKC,QAAgE,CAAC,GACnE;CACL,MAAMS,OAAOV,OAAOW,KAAKX,IAAI,GAAGQ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art", "panneau-line-chart-height" | "panneau-line-chart-label-font-size" | "panneau-line-chart-line-width" | "panneau-line-chart-dot-size" | "panneau-line-chart-area-opacity">;
2
+ export declare const lineChartTokens: import("../index.js").ComponentTokens<"line-chart", "panneau-line-chart-height" | "panneau-line-chart-label-font-size" | "panneau-line-chart-line-width" | "panneau-line-chart-dot-size" | "panneau-line-chart-area-opacity" | "panneau-line-chart-grid-color" | "panneau-line-chart-reveal-duration">;
3
3
  //# sourceMappingURL=tokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/line-chart/tokens.ts"],"names":[],"mappings":"AAEA,2BAA2B;AAC3B,eAAO,MAAM,eAAe,sNAW1B,CAAC"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/line-chart/tokens.ts"],"names":[],"mappings":"AAEA,2BAA2B;AAC3B,eAAO,MAAM,eAAe,+RAe1B,CAAC"}
@@ -2,16 +2,20 @@ import { defineComponentTokens } from "../theme/componentTokens.js";
2
2
  //#region src/line-chart/tokens.ts
3
3
  /** Tokens of LineChart. */
4
4
  var lineChartTokens = defineComponentTokens("line-chart", {
5
- /** Height of the plot, without the labels under it. */
5
+ /** Height of the plot, without the labels around it. */
6
6
  height: "8rem",
7
7
  /** Width of the line. */
8
8
  "line-width": "2px",
9
- /** Diameter of the dots of the points. */
10
- "dot-size": "6px",
11
- /** Opacity of the area under the line. */
12
- "area-opacity": "0.12",
13
- /** Font size of the labels. */
14
- "label-font-size": "var(--panneau-font-size-xs)"
9
+ /** Diameter of the dots: the last value, the highest one, the point under the pointer. */
10
+ "dot-size": "8px",
11
+ /** Opacity of the area under the line, at its top: it fades out to the baseline. */
12
+ "area-opacity": "0.2",
13
+ /** Color of the lines of the graduations across the plot. */
14
+ "grid-color": "var(--panneau-color-border)",
15
+ /** Font size of the labels: the scale, the dates, the values. */
16
+ "label-font-size": "var(--panneau-font-size-xs)",
17
+ /** Duration of the line drawing itself when the chart appears: 0 with reduced motion. */
18
+ "reveal-duration": "calc(var(--panneau-duration-slow) * 3)"
15
19
  });
16
20
  //#endregion
17
21
  export { lineChartTokens };
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","names":["defineComponentTokens","lineChartTokens","height"],"sources":["../../src/line-chart/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of LineChart. */\nexport const lineChartTokens = defineComponentTokens('line-chart', {\n /** Height of the plot, without the labels under it. */\n height: '8rem',\n /** Width of the line. */\n 'line-width': '2px',\n /** Diameter of the dots of the points. */\n 'dot-size': '6px',\n /** Opacity of the area under the line. */\n 'area-opacity': '0.12',\n /** Font size of the labels. */\n 'label-font-size': 'var(--panneau-font-size-xs)',\n});\n"],"mappings":";;;AAGA,IAAaC,kBAAkBD,sBAAsB,cAAc;;CAE/DE,QAAQ;;CAER,cAAc;;CAEd,YAAY;;CAEZ,gBAAgB;;CAEhB,mBAAmB;AACvB,CAAC"}
1
+ {"version":3,"file":"tokens.js","names":["defineComponentTokens","lineChartTokens","height"],"sources":["../../src/line-chart/tokens.ts"],"sourcesContent":["import { defineComponentTokens } from '../theme/componentTokens';\n\n/** Tokens of LineChart. */\nexport const lineChartTokens = defineComponentTokens('line-chart', {\n /** Height of the plot, without the labels around it. */\n height: '8rem',\n /** Width of the line. */\n 'line-width': '2px',\n /** Diameter of the dots: the last value, the highest one, the point under the pointer. */\n 'dot-size': '8px',\n /** Opacity of the area under the line, at its top: it fades out to the baseline. */\n 'area-opacity': '0.2',\n /** Color of the lines of the graduations across the plot. */\n 'grid-color': 'var(--panneau-color-border)',\n /** Font size of the labels: the scale, the dates, the values. */\n 'label-font-size': 'var(--panneau-font-size-xs)',\n /** Duration of the line drawing itself when the chart appears: 0 with reduced motion. */\n 'reveal-duration': 'calc(var(--panneau-duration-slow) * 3)',\n});\n"],"mappings":";;;AAGA,IAAaC,kBAAkBD,sBAAsB,cAAc;;CAE/DE,QAAQ;;CAER,cAAc;;CAEd,YAAY;;CAEZ,gBAAgB;;CAEhB,cAAc;;CAEd,mBAAmB;;CAEnB,mBAAmB;AACvB,CAAC"}
@@ -0,0 +1,23 @@
1
+ .panneau-meter {
2
+ display: block;
3
+ min-width: 0;
4
+ }
5
+
6
+ .panneau-meter-track {
7
+ position: relative;
8
+ height: var(--panneau-meter-height, 0.375rem);
9
+ overflow: hidden;
10
+ background-color: var(--panneau-meter-track-bg, var(--panneau-color-surface-sunken));
11
+ border-radius: var(--panneau-meter-radius, var(--panneau-radius-full));
12
+ }
13
+
14
+ /* The fill: the first categorical chart color, or the solid color of a tone past the target. */
15
+ .panneau-meter-fill {
16
+ height: 100%;
17
+ background-color: var(--_panneau-meter-color);
18
+ border-radius: inherit;
19
+ }
20
+
21
+ .panneau-meter-toned .panneau-meter-fill {
22
+ background-color: var(--panneau-tone-solid);
23
+ }
@@ -0,0 +1,26 @@
1
+ import type { Tone } from '../theme/tones.js';
2
+ export interface MeterProps {
3
+ /** The value: how much of the target is reached. */
4
+ value: number;
5
+ /** The target, above 0: a budget, a quota. The bar is full at the target, and past it. */
6
+ target: number;
7
+ /** What the meter measures. Without it, or `aria-labelledby`, it is named "Target". */
8
+ label?: string;
9
+ /** The id of the element that names the meter, instead of `label`. */
10
+ 'aria-labelledby'?: string;
11
+ /**
12
+ * Colors the fill, when the value calls for attention (past the target): the solid color of
13
+ * the tone. The first categorical chart color by default.
14
+ */
15
+ tone?: Tone | undefined;
16
+ /** Formats the value and the target, in what assistive technologies read: `1,250 of 1,000`. */
17
+ formatValue?: (value: number) => string;
18
+ className?: string;
19
+ }
20
+ /**
21
+ * A value against a target, as a bar that fills up to it: a budget spent, a quota used. Assistive
22
+ * technologies read it as a meter, with the value and the target ("1,250 of 1,000"), even past the
23
+ * target, where the bar stays full.
24
+ */
25
+ export declare function Meter({ value, target, label, 'aria-labelledby': labelledBy, tone, formatValue, className, }: MeterProps): import("react").JSX.Element;
26
+ //# sourceMappingURL=Meter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meter.d.ts","sourceRoot":"","sources":["../../src/meter/Meter.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAI3C,MAAM,WAAW,UAAU;IACvB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,0FAA0F;IAC1F,MAAM,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACxB,+FAA+F;IAC/F,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,EAClB,KAAK,EACL,MAAM,EACN,KAAK,EACL,iBAAiB,EAAE,UAAU,EAC7B,IAAI,EACJ,WAAW,EACX,SAAS,GACZ,EAAE,UAAU,+BAkCZ"}
@@ -0,0 +1,99 @@
1
+ import { cx } from "../utils/cx.js";
2
+ import { messages } from "../intl/messages.js";
3
+ import { usePanneauIntl } from "../intl/usePanneauIntl.js";
4
+ import { toneClass } from "../theme/toneClass.js";
5
+ import { chartColors } from "../theme/chartColors.js";
6
+ import Meter_module_default from "./Meter.module.js";
7
+ import { c } from "react/compiler-runtime";
8
+ import { Meter } from "react-aria-components";
9
+ import { jsx } from "react/jsx-runtime";
10
+ //#region src/meter/Meter.tsx
11
+ /**
12
+ * A value against a target, as a bar that fills up to it: a budget spent, a quota used. Assistive
13
+ * technologies read it as a meter, with the value and the target ("1,250 of 1,000"), even past the
14
+ * target, where the bar stays full.
15
+ */
16
+ function Meter$1(t0) {
17
+ const $ = c(23);
18
+ const { value, target, label, "aria-labelledby": labelledBy, tone, formatValue, className } = t0;
19
+ const intl = usePanneauIntl();
20
+ let t1;
21
+ if ($[0] !== formatValue || $[1] !== intl) {
22
+ t1 = formatValue ?? ((number) => intl.formatNumber(number));
23
+ $[0] = formatValue;
24
+ $[1] = intl;
25
+ $[2] = t1;
26
+ } else t1 = $[2];
27
+ const format = t1;
28
+ const max = target > 0 ? target : 1;
29
+ const clamped = Math.min(Math.max(value, 0), max);
30
+ let t2;
31
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
32
+ t2 = { "--_panneau-meter-color": chartColors.categorical(0) };
33
+ $[3] = t2;
34
+ } else t2 = $[3];
35
+ const style = t2;
36
+ let t3;
37
+ if ($[4] !== format || $[5] !== intl || $[6] !== target || $[7] !== value) {
38
+ t3 = intl.formatMessage(messages.meterValue, {
39
+ value: format(value),
40
+ target: format(target)
41
+ });
42
+ $[4] = format;
43
+ $[5] = intl;
44
+ $[6] = target;
45
+ $[7] = value;
46
+ $[8] = t3;
47
+ } else t3 = $[8];
48
+ let t4;
49
+ if ($[9] !== intl || $[10] !== label || $[11] !== labelledBy) {
50
+ t4 = labelledBy !== void 0 ? { "aria-labelledby": labelledBy } : { "aria-label": label ?? intl.formatMessage(messages.meterTarget) };
51
+ $[9] = intl;
52
+ $[10] = label;
53
+ $[11] = labelledBy;
54
+ $[12] = t4;
55
+ } else t4 = $[12];
56
+ const t5 = tone !== void 0 && Meter_module_default.toned;
57
+ let t6;
58
+ if ($[13] !== className || $[14] !== t5 || $[15] !== tone) {
59
+ t6 = cx("panneau-meter", Meter_module_default.meter, t5, tone !== void 0 && toneClass(tone), className);
60
+ $[13] = className;
61
+ $[14] = t5;
62
+ $[15] = tone;
63
+ $[16] = t6;
64
+ } else t6 = $[16];
65
+ let t7;
66
+ if ($[17] !== clamped || $[18] !== max || $[19] !== t3 || $[20] !== t4 || $[21] !== t6) {
67
+ t7 = /* @__PURE__ */ jsx(Meter, {
68
+ value: clamped,
69
+ minValue: 0,
70
+ maxValue: max,
71
+ valueLabel: t3,
72
+ ...t4,
73
+ className: t6,
74
+ style,
75
+ children: _temp
76
+ });
77
+ $[17] = clamped;
78
+ $[18] = max;
79
+ $[19] = t3;
80
+ $[20] = t4;
81
+ $[21] = t6;
82
+ $[22] = t7;
83
+ } else t7 = $[22];
84
+ return t7;
85
+ }
86
+ function _temp(t0) {
87
+ const { percentage } = t0;
88
+ return /* @__PURE__ */ jsx("div", {
89
+ className: Meter_module_default.track,
90
+ children: /* @__PURE__ */ jsx("div", {
91
+ className: Meter_module_default.fill,
92
+ style: { width: `${percentage}%` }
93
+ })
94
+ });
95
+ }
96
+ //#endregion
97
+ export { Meter$1 as Meter };
98
+
99
+ //# sourceMappingURL=Meter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Meter.js","names":["CSSProperties","Meter","AriaMeter","messages","usePanneauIntl","chartColors","toneClass","Tone","cx","styles","MeterProps","value","target","label","tone","formatValue","className","t0","$","_c","labelledBy","intl","t1","number","formatNumber","format","max","clamped","Math","min","t2","Symbol","for","categorical","style","t3","formatMessage","meterValue","t4","undefined","meterTarget","t5","toned","t6","meter","t7","_temp","percentage","track","fill","width","Meter","_c","styles","AriaMeter"],"sources":["../../src/meter/Meter.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport { Meter as AriaMeter } from 'react-aria-components';\n\nimport { messages } from '../intl/messages';\nimport { usePanneauIntl } from '../intl/usePanneauIntl';\nimport { chartColors } from '../theme/chartColors';\nimport { toneClass } from '../theme/toneClass';\nimport type { Tone } from '../theme/tones';\nimport { cx } from '../utils/cx';\nimport styles from './Meter.module.css';\n\nexport interface MeterProps {\n /** The value: how much of the target is reached. */\n value: number;\n /** The target, above 0: a budget, a quota. The bar is full at the target, and past it. */\n target: number;\n /** What the meter measures. Without it, or `aria-labelledby`, it is named \"Target\". */\n label?: string;\n /** The id of the element that names the meter, instead of `label`. */\n 'aria-labelledby'?: string;\n /**\n * Colors the fill, when the value calls for attention (past the target): the solid color of\n * the tone. The first categorical chart color by default.\n */\n tone?: Tone | undefined;\n /** Formats the value and the target, in what assistive technologies read: `1,250 of 1,000`. */\n formatValue?: (value: number) => string;\n className?: string;\n}\n\n/**\n * A value against a target, as a bar that fills up to it: a budget spent, a quota used. Assistive\n * technologies read it as a meter, with the value and the target (\"1,250 of 1,000\"), even past the\n * target, where the bar stays full.\n */\nexport function Meter({\n value,\n target,\n label,\n 'aria-labelledby': labelledBy,\n tone,\n formatValue,\n className,\n}: MeterProps) {\n const intl = usePanneauIntl();\n const format = formatValue ?? ((number: number) => intl.formatNumber(number));\n const max = target > 0 ? target : 1;\n const clamped = Math.min(Math.max(value, 0), max);\n const style = { '--_panneau-meter-color': chartColors.categorical(0) } as CSSProperties;\n return (\n <AriaMeter\n value={clamped}\n minValue={0}\n maxValue={max}\n valueLabel={intl.formatMessage(messages.meterValue, {\n value: format(value),\n target: format(target),\n })}\n {...(labelledBy !== undefined\n ? { 'aria-labelledby': labelledBy }\n : { 'aria-label': label ?? intl.formatMessage(messages.meterTarget) })}\n className={cx(\n 'panneau-meter',\n styles.meter,\n tone !== undefined && styles.toned,\n tone !== undefined && toneClass(tone),\n className,\n )}\n style={style}\n >\n {({ percentage }) => (\n <div className={styles.track}>\n <div className={styles.fill} style={{ width: `${percentage}%` }} />\n </div>\n )}\n </AriaMeter>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,SAAOC,QAAAgB,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAe,MAAA,EAAAR,OAAAC,QAAAC,OAAA,mBAAAO,YAAAN,MAAAC,aAAAC,cAAAC;CASlB,MAAAI,OAAajB,eAAe;CAAE,IAAAkB;CAAA,IAAAJ,EAAA,OAAAH,eAAAG,EAAA,OAAAG,MAAA;EACfC,KAAAP,iBAAAQ,WAAoCF,KAAIG,aAAcD,MAAM;EAAEL,EAAA,KAAAH;EAAAG,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAA7E,MAAAO,SAAeH;CACf,MAAAI,MAAYd,SAAS,IAAT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