@motionscript/charts 0.1.0-alpha.5 → 0.1.0-alpha.7

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 (146) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +30 -16
  3. package/dist/bar-chart/bar-chart.d.ts +133 -242
  4. package/dist/bar-chart/bar-chart.d.ts.map +1 -1
  5. package/dist/bar-chart/bar-chart.js +378 -569
  6. package/dist/bar-chart/bar-chart.js.map +1 -1
  7. package/dist/bar-chart/category-axis.d.ts +35 -41
  8. package/dist/bar-chart/category-axis.d.ts.map +1 -1
  9. package/dist/bar-chart/category-axis.js +93 -115
  10. package/dist/bar-chart/category-axis.js.map +1 -1
  11. package/dist/bar-chart/chart-bars.d.ts +50 -70
  12. package/dist/bar-chart/chart-bars.d.ts.map +1 -1
  13. package/dist/bar-chart/chart-bars.js +156 -210
  14. package/dist/bar-chart/chart-bars.js.map +1 -1
  15. package/dist/bar-chart/index.d.ts +2 -2
  16. package/dist/bar-chart/index.d.ts.map +1 -1
  17. package/dist/bar-chart/index.js +1 -1
  18. package/dist/bar-chart/index.js.map +1 -1
  19. package/dist/bar-chart/shared.d.ts +3 -3
  20. package/dist/bar-chart/shared.d.ts.map +1 -1
  21. package/dist/bar-chart/shared.js +3 -3
  22. package/dist/bar-chart/shared.js.map +1 -1
  23. package/dist/browser/chunks/chunk-XROBIRQK.js +2 -0
  24. package/dist/browser/chunks/chunk-XROBIRQK.js.map +7 -0
  25. package/dist/browser/index.js +1 -1
  26. package/dist/browser/index.js.map +3 -3
  27. package/dist/browser/kit.js +1 -1
  28. package/dist/browser/manifest.json +1 -1
  29. package/dist/engine.d.ts +8 -6
  30. package/dist/engine.d.ts.map +1 -1
  31. package/dist/engine.js +8 -6
  32. package/dist/engine.js.map +1 -1
  33. package/dist/kit/cartesian.d.ts +44 -0
  34. package/dist/kit/cartesian.d.ts.map +1 -0
  35. package/dist/kit/cartesian.js +59 -0
  36. package/dist/kit/cartesian.js.map +1 -0
  37. package/dist/kit/chart-border.d.ts +10 -11
  38. package/dist/kit/chart-border.d.ts.map +1 -1
  39. package/dist/kit/chart-border.js +15 -32
  40. package/dist/kit/chart-border.js.map +1 -1
  41. package/dist/kit/chart-canvas.d.ts +32 -21
  42. package/dist/kit/chart-canvas.d.ts.map +1 -1
  43. package/dist/kit/chart-canvas.js +33 -90
  44. package/dist/kit/chart-canvas.js.map +1 -1
  45. package/dist/kit/chart-legend.d.ts +123 -64
  46. package/dist/kit/chart-legend.d.ts.map +1 -1
  47. package/dist/kit/chart-legend.js +129 -154
  48. package/dist/kit/chart-legend.js.map +1 -1
  49. package/dist/kit/entries.d.ts +17 -0
  50. package/dist/kit/entries.d.ts.map +1 -0
  51. package/dist/kit/entries.js +19 -0
  52. package/dist/kit/entries.js.map +1 -0
  53. package/dist/kit/motion.d.ts +48 -0
  54. package/dist/kit/motion.d.ts.map +1 -0
  55. package/dist/kit/motion.js +63 -0
  56. package/dist/kit/motion.js.map +1 -0
  57. package/dist/kit/paints.d.ts +10 -0
  58. package/dist/kit/paints.d.ts.map +1 -0
  59. package/dist/kit/paints.js +12 -0
  60. package/dist/kit/paints.js.map +1 -0
  61. package/dist/kit/shared.d.ts +31 -3
  62. package/dist/kit/shared.d.ts.map +1 -1
  63. package/dist/kit/shared.js +42 -3
  64. package/dist/kit/shared.js.map +1 -1
  65. package/dist/kit/vertical-axis.d.ts +48 -61
  66. package/dist/kit/vertical-axis.d.ts.map +1 -1
  67. package/dist/kit/vertical-axis.js +97 -132
  68. package/dist/kit/vertical-axis.js.map +1 -1
  69. package/dist/line-chart/chart-line.d.ts +60 -77
  70. package/dist/line-chart/chart-line.d.ts.map +1 -1
  71. package/dist/line-chart/chart-line.js +100 -121
  72. package/dist/line-chart/chart-line.js.map +1 -1
  73. package/dist/line-chart/chart-region.d.ts +32 -33
  74. package/dist/line-chart/chart-region.d.ts.map +1 -1
  75. package/dist/line-chart/chart-region.js +31 -65
  76. package/dist/line-chart/chart-region.js.map +1 -1
  77. package/dist/line-chart/horizontal-axis.d.ts +58 -64
  78. package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
  79. package/dist/line-chart/horizontal-axis.js +94 -123
  80. package/dist/line-chart/horizontal-axis.js.map +1 -1
  81. package/dist/line-chart/index.d.ts +2 -2
  82. package/dist/line-chart/index.d.ts.map +1 -1
  83. package/dist/line-chart/index.js +1 -1
  84. package/dist/line-chart/index.js.map +1 -1
  85. package/dist/line-chart/line-chart.d.ts +156 -319
  86. package/dist/line-chart/line-chart.d.ts.map +1 -1
  87. package/dist/line-chart/line-chart.js +403 -663
  88. package/dist/line-chart/line-chart.js.map +1 -1
  89. package/dist/line-chart/shared.d.ts +3 -3
  90. package/dist/line-chart/shared.d.ts.map +1 -1
  91. package/dist/line-chart/shared.js +3 -3
  92. package/dist/line-chart/shared.js.map +1 -1
  93. package/dist/nodes.d.ts +6 -9
  94. package/dist/nodes.d.ts.map +1 -1
  95. package/dist/nodes.js +7 -9
  96. package/dist/nodes.js.map +1 -1
  97. package/dist/pie-chart/index.d.ts +2 -2
  98. package/dist/pie-chart/index.d.ts.map +1 -1
  99. package/dist/pie-chart/index.js +1 -1
  100. package/dist/pie-chart/index.js.map +1 -1
  101. package/dist/pie-chart/pie-chart.d.ts +108 -132
  102. package/dist/pie-chart/pie-chart.d.ts.map +1 -1
  103. package/dist/pie-chart/pie-chart.js +200 -271
  104. package/dist/pie-chart/pie-chart.js.map +1 -1
  105. package/dist/pie-chart/pie-legend.d.ts +84 -31
  106. package/dist/pie-chart/pie-legend.d.ts.map +1 -1
  107. package/dist/pie-chart/pie-legend.js +93 -107
  108. package/dist/pie-chart/pie-legend.js.map +1 -1
  109. package/dist/pie-chart/pie-ring.d.ts +160 -131
  110. package/dist/pie-chart/pie-ring.d.ts.map +1 -1
  111. package/dist/pie-chart/pie-ring.js +333 -391
  112. package/dist/pie-chart/pie-ring.js.map +1 -1
  113. package/dist/pie-chart/shared.d.ts +2 -2
  114. package/dist/pie-chart/shared.d.ts.map +1 -1
  115. package/dist/pie-chart/shared.js +2 -2
  116. package/dist/pie-chart/shared.js.map +1 -1
  117. package/package.json +4 -4
  118. package/src/bar-chart/bar-chart.ts +415 -701
  119. package/src/bar-chart/category-axis.ts +95 -110
  120. package/src/bar-chart/chart-bars.ts +178 -200
  121. package/src/bar-chart/index.ts +2 -2
  122. package/src/bar-chart/shared.ts +3 -3
  123. package/src/engine.ts +8 -6
  124. package/src/kit/cartesian.ts +81 -0
  125. package/src/kit/chart-border.ts +22 -33
  126. package/src/kit/chart-canvas.ts +44 -79
  127. package/src/kit/chart-legend.ts +173 -189
  128. package/src/kit/entries.ts +20 -0
  129. package/src/kit/motion.ts +90 -0
  130. package/src/kit/paints.ts +15 -0
  131. package/src/kit/shared.ts +52 -3
  132. package/src/kit/vertical-axis.ts +110 -140
  133. package/src/line-chart/chart-line.ts +102 -154
  134. package/src/line-chart/chart-region.ts +35 -80
  135. package/src/line-chart/horizontal-axis.ts +101 -152
  136. package/src/line-chart/index.ts +2 -2
  137. package/src/line-chart/line-chart.ts +449 -825
  138. package/src/line-chart/shared.ts +3 -3
  139. package/src/nodes.ts +8 -10
  140. package/src/pie-chart/index.ts +2 -2
  141. package/src/pie-chart/pie-chart.ts +221 -311
  142. package/src/pie-chart/pie-legend.ts +124 -114
  143. package/src/pie-chart/pie-ring.ts +386 -473
  144. package/src/pie-chart/shared.ts +2 -2
  145. package/dist/browser/chunks/chunk-5ZPBV6BU.js +0 -2
  146. package/dist/browser/chunks/chunk-5ZPBV6BU.js.map +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"bar-chart.js","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EACL,OAAO,EACP,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,QAAQ,GAOT,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA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AAmCD;IADC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;iDAe1F;AAQD;IADC,OAAO,EAAE;6CAiBT;AAjoBU,QAAQ;IAfpB,IAAI,CAAC;QACJ,GAAG,EAAE,UAAU;QACf,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,QAAQ,EAAE,UAAU;YACpB,gBAAgB,EAAE,OAAO;YACzB,iBAAiB,EAAE,OAAO;YAC1B,eAAe,EAAE,IAAI;SACtB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACZ;KACF,CAAC;GACW,QAAQ,CAuoBpB","sourcesContent":["import {\r\n command,\r\n node,\r\n Node2D,\r\n Rect,\r\n easeOut,\r\n property,\r\n type CommandArgs,\r\n type DataRecord,\r\n type Command,\r\n type EasingFunction,\r\n type NodeConfig,\r\n type Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { ChartBorder } from \"../kit/chart-border\"\r\nimport { ChartCanvas } from \"../kit/chart-canvas\"\r\nimport { ChartLegend } from \"../kit/chart-legend\"\r\nimport { VerticalAxis } from \"../kit/vertical-axis\"\r\nimport {\r\n clampUnit,\r\n formatMarker,\r\n markerStep,\r\n axisTweenTarget,\r\n lerpAxisDomain,\r\n markerValues,\r\n num,\r\n resolveAxisDomain,\r\n type AxisDomainConfig,\r\n type Range,\r\n} from \"../kit/shared\"\r\nimport { formatNumber } from \"@motionscript/sdk/component\"\r\nimport {\r\n asCommand,\r\n drive,\r\n hold,\r\n sequence as sequenceOf,\r\n together,\r\n type Seekable,\r\n} from \"@motionscript/sdk/component\"\r\nimport { CategoryAxis } from \"./category-axis\"\r\nimport { ChartBars, type BarGeometry } from \"./chart-bars\"\r\nimport {\r\n DEFAULT_BAR_CHART_THEME,\r\n barCategories,\r\n barSpans,\r\n lerpBarChartTheme,\r\n resolveBarChartTheme,\r\n resolveBarFill,\r\n resolveBarScale,\r\n stackCapIndex,\r\n type BarChartConfig,\r\n type BarChartTheme,\r\n type BarSeries,\r\n} from \"./shared\"\r\n\r\nexport interface BarChartProps extends Node2DProps {\r\n /** One row per category — a plain record of field name to value. */\r\n data: DataRecord[]\r\n /**\r\n * Key into each row for its category caption, drawn beneath the baseline.\r\n * Named `categoryField` rather than `category` for the same reason the line\r\n * chart's is `xField`: it names a *column*, not a value.\r\n */\r\n categoryField: string\r\n /** One entry per bar series: which column it plots, its `label`, its `fill`. */\r\n series: BarSeries[]\r\n /**\r\n * When `true` every category's series stack into one column; when `false`\r\n * (the default) each series gets its own bar, grouped side by side within the\r\n * category's slot.\r\n */\r\n stacked?: boolean\r\n /** The value axis's domain: caption, scale range, and tick placement. */\r\n valueAxis?: AxisDomainConfig\r\n /** The category axis's domain. Only its `label` is read — the slots are the rows. */\r\n categoryAxis?: AxisDomainConfig\r\n /**\r\n * The chart's visual theme — bar palette and geometry, axis furniture, plot\r\n * panel paint, legend, value figures. Every branch is optional and deep-merged\r\n * onto {@link DEFAULT_BAR_CHART_THEME}.\r\n */\r\n theme?: BarChartTheme\r\n /** Whether the legend row below the plot is drawn at all. */\r\n showLegend?: boolean\r\n /** Whether each column prints the figure it plots. */\r\n showValues?: boolean\r\n}\r\n\r\n/**\r\n * Headroom above the plot, in px — the line chart's, so the two sit at the same\r\n * size in the same box and a scene can swap one for the other without re-tuning\r\n * its layout. The plot's top grid line is the one place a marker would\r\n * otherwise be drawn outside the chart's own box.\r\n */\r\nconst TOP_HEADROOM = 24\r\n\r\n/** How far the legend starts below its slot when it enters, in px. */\r\nconst LEGEND_SLIDE = 20\r\n\r\n/**\r\n * How {@link BarChart.enter} divides its duration between its three beats: the\r\n * axes arriving, the columns rising, and the legend coming up. Shares of the\r\n * whole, so they must sum to 1 — the entrance takes exactly the time it was\r\n * given, for the reason spelt out on `LineChart.enter`.\r\n */\r\n/**\r\n * The signals the bar chart's own commands move, as props types.\r\n *\r\n * Written out rather than reusing `BarChartProps` because these are signals of\r\n * the chart's own — how far the columns have risen, and which category is lit —\r\n * rather than part of what an author states about it. Same reason the line chart\r\n * types its `RegionState` separately.\r\n */\r\ntype CategorySpotlight = { spotlight: number | null; spotlightReveal: number }\r\ntype BarGrowth = { growth: number }\r\n\r\nconst AXES_SHARE = 0.35\r\nconst BARS_SHARE = 0.5\r\nconst LEGEND_SHARE = 0.15\r\n\r\n/**\r\n * A grouped or stacked bar chart, composed from independent parts rather than\r\n * one monolithic draw — the sibling of the {@link LineChart} family, built the\r\n * same way and out of several of the same pieces:\r\n *\r\n * - `ChartCanvas` — the plot panel with a horizontal grid, under everything.\r\n * - `VerticalAxis` — the numeric value markers, staggering in bottom-to-top.\r\n * - {@link CategoryAxis} — the row of names beneath the baseline, one per row of\r\n * the data, staggering in left-to-right.\r\n * - {@link ChartBars} (one per series) — that series' column in every category,\r\n * plus the figures printed on them.\r\n * - `ChartLegend` — a row of entries below the chart, one per series.\r\n *\r\n * The parts are laid out from this node's `layoutBounds` exactly as the line\r\n * chart's are: the value axis on the left, the category captions below, the\r\n * plot filling what's left, and the legend row beneath the whole thing. The\r\n * columns are mapped across the plot panel's own laid-out box and read the same\r\n * resolved scale the axis does, so a column's end lands exactly on its marker\r\n * and the chart re-flows if its box changes.\r\n *\r\n * **Resting state is the finished chart** — the same bargain the line chart\r\n * makes: an editor paints a node's Initial state on a paused canvas, so a chart\r\n * that only appeared once a command had run would be edited blind. {@link enter}\r\n * arms every part back to its pre-entrance state before animating.\r\n *\r\n * **Zero is always on the scale** (see `barValueExtent`), and the columns\r\n * grow about it rather than about the plot floor, so a negative value draws\r\n * downward out of the same `growth` signal that draws a positive one up.\r\n *\r\n * Past the entrance, two things move the chart:\r\n * {@link showSeries}/{@link hideSeries}/{@link spotlightSeries} pick out a\r\n * *series* — and hiding one **reflows the group**, the remaining columns\r\n * widening into the space as it goes, rather than leaving a hole where it was —\r\n * while {@link spotlightCategory}/{@link clearCategory} pick out a *column of\r\n * the table*, dimming every other category and its caption with it.\r\n */\r\n@node({\r\n key: \"barChart\",\r\n parentKey: \"node\",\r\n forkable: true,\r\n layout: {\r\n children: \"freeform\",\r\n defaultWidthMode: \"fixed\",\r\n defaultHeightMode: \"fixed\",\r\n acceptsChildren: true,\r\n },\r\n seed: {\r\n width: 760,\r\n height: 460,\r\n },\r\n})\r\nexport class BarChart extends Node2D<BarChartProps> {\r\n @property({ default: () => [] as DataRecord[] }) declare data: DataRecord[]\r\n @property({ default: \"\" }) declare categoryField: string\r\n @property({ default: () => [] as BarSeries[] }) declare series: BarSeries[]\r\n @property({ default: false }) declare stacked: boolean\r\n /**\r\n * The value axis's domain (label/range/ticks), tweenable and mappable exactly\r\n * as the line chart's axes are: the mapper merges a partial input onto the\r\n * previous resolved domain and the tween interpolates numerically, so\r\n * `chart.to({ data: { valueAxis: { range: [0, 10] } }, duration: 1 })` smoothly\r\n * rescales every column. The axis *label* text is captured once at construction.\r\n */\r\n @property({\r\n default: {},\r\n mapper: resolveAxisDomain,\r\n tween: lerpAxisDomain,\r\n })\r\n declare valueAxis: AxisDomainConfig\r\n @property({\r\n default: {},\r\n mapper: resolveAxisDomain,\r\n tween: lerpAxisDomain,\r\n })\r\n declare categoryAxis: AxisDomainConfig\r\n @property({\r\n default: DEFAULT_BAR_CHART_THEME,\r\n mapper: resolveBarChartTheme,\r\n tween: lerpBarChartTheme,\r\n })\r\n declare theme: BarChartTheme\r\n\r\n /**\r\n * Global rise of every column in `[0, 1]`, measured about the baseline: 0\r\n * collapses them all onto it, 1 draws them at full length. Each\r\n * {@link ChartBars}' own `growth` is bound to this, so tweening this one\r\n * signal raises the whole chart in proportion.\r\n */\r\n @property({ default: 1 }) declare growth: number\r\n\r\n /**\r\n * How much of the slot each series currently claims, one entry per series.\r\n *\r\n * A *weight* rather than a boolean, because that is what makes hiding a series\r\n * an animation instead of a jump: the grouped columns divide the slot in\r\n * proportion to these, so tweening one to 0 has the remaining columns widen\r\n * into the space as it shrinks away, and a stacked segment's contribution to\r\n * the stack fades out with it. Seeded from each series' `enabled` field.\r\n */\r\n @property({ default: () => [] as number[] }) declare weights: number[]\r\n\r\n /**\r\n * The category currently spotlit, or `null` for none. Held as a plain reactive\r\n * value rather than a tweened one: the *choice* snaps, and the animation is\r\n * {@link spotlightReveal} dimming everything else.\r\n */\r\n @property({ default: null }) declare spotlight: number | null\r\n\r\n /** How far the category spotlight is drawn in, `[0, 1]`. */\r\n @property({ default: 0 }) declare spotlightReveal: number\r\n\r\n // ---- Part handles (built in the constructor) --------------------------\r\n private vAxis: VerticalAxis\r\n private cAxis: CategoryAxis\r\n private legend: ChartLegend | null = null\r\n private barSets: ChartBars[] = []\r\n /** The plot panel: the box the grid, the columns and the border all share. */\r\n private plotRect: Rect\r\n\r\n /**\r\n * `this.theme` read back through its *resolved* shape — the same\r\n * loose-declared/resolved-stored idiom as a shape's `fill`/`stroke`, and as\r\n * the line chart's own theme.\r\n */\r\n private get resolvedTheme(): BarChartConfig {\r\n return this.theme as unknown as BarChartConfig\r\n }\r\n\r\n // ---- Derived scale ----------------------------------------------------\r\n\r\n /** Fallback marker count when the value axis states no ticks. */\r\n private static readonly DEFAULT_MARKERS = 5\r\n\r\n private get valueScale(): Range {\r\n const divisions =\r\n (this.valueAxis.ticks?.length ?? BarChart.DEFAULT_MARKERS) - 1\r\n return resolveBarScale(\r\n this.data,\r\n this.series,\r\n this.stacked,\r\n this.valueAxis.range,\r\n divisions\r\n )\r\n }\r\n\r\n /**\r\n * A value written down as this chart's value axis says — the axis ticks and\r\n * the figures printed on the columns both read through here, so the two\r\n * cannot disagree about what a number looks like.\r\n */\r\n private valueLabel(value: number): string {\r\n const pattern = this.valueAxis.format\r\n return pattern === undefined\r\n ? formatMarker(value, markerStep(this.resolvedMarkers))\r\n : formatNumber(value, pattern)\r\n }\r\n\r\n /** The value axis ticks: the explicit ones, else five across the scale. */\r\n private get resolvedMarkers(): number[] {\r\n return (\r\n this.valueAxis.ticks ??\r\n markerValues(this.valueScale, BarChart.DEFAULT_MARKERS - 1)\r\n )\r\n }\r\n\r\n // ---- Plot geometry ------------------------------------------------------\r\n\r\n /**\r\n * The plot panel's size, **as laid out**.\r\n *\r\n * The value axis is `width: \"hug\"` and the category row and legend are as tall\r\n * as their text, so the panel's real box is whatever the layout makes it. An\r\n * estimate built from gutter constants never matched it, and the columns sat a\r\n * few percent off the grid line they were supposed to end on. Asking the panel\r\n * is exact by construction: the grid, the columns and the border all resolve\r\n * against the one box they are drawn in. Zero until the first layout pass, like\r\n * any other `layoutBounds` read; the bindings that call this re-run on the\r\n * next frame.\r\n */\r\n private plotSize(): { w: number; h: number } {\r\n const { width, height } = this.plotRect.layoutBounds\r\n return { w: width, h: height }\r\n }\r\n\r\n /** Map a value onto the plot's **centred** pixel space (origin at its centre, y-up). */\r\n private valueToY(value: number): number {\r\n const [min, max] = this.valueScale\r\n const { h } = this.plotSize()\r\n if (max <= min) return -h / 2\r\n return ((value - min) / (max - min) - 0.5) * h\r\n }\r\n\r\n /**\r\n * Pixel y of the line every column grows from.\r\n *\r\n * Zero, clamped onto the scale — so an author who *did* crop the axis to\r\n * `[40, 100]` gets columns rising from the plot floor rather than from a\r\n * baseline off the bottom of the panel.\r\n */\r\n private get baselinePx(): number {\r\n const [min, max] = this.valueScale\r\n return this.valueToY(Math.min(Math.max(0, min), max))\r\n }\r\n\r\n // ---- Slot geometry ----------------------------------------------------\r\n\r\n /** Width of one category's slot across the plot. */\r\n private get slotWidth(): number {\r\n const n = this.data.length\r\n return n > 0 ? this.plotSize().w / n : 0\r\n }\r\n\r\n /** Centre x of category `i`'s slot, in the plot's centred space. */\r\n private slotCenter(index: number): number {\r\n return -this.plotSize().w / 2 + this.slotWidth * (index + 0.5)\r\n }\r\n\r\n /** The part of a slot the columns fill — the rest is the channel between categories. */\r\n private get slotInner(): number {\r\n return this.slotWidth * clampUnit(this.resolvedTheme.bar.slotFill)\r\n }\r\n\r\n /** Series `i`'s live share of the slot; 0 once it has been hidden. */\r\n private weightAt(index: number): number {\r\n return Math.max(0, this.weights[index] ?? 1)\r\n }\r\n\r\n /** Total live share across the series — the slot's inner width divides by this. */\r\n private get totalWeight(): number {\r\n let sum = 0\r\n for (let i = 0; i < this.series.length; i++) sum += this.weightAt(i)\r\n return sum > 0 ? sum : 1\r\n }\r\n\r\n /** Live share of every series *before* `index`, for the grouped offset. */\r\n private weightBefore(index: number): number {\r\n let sum = 0\r\n for (let i = 0; i < index; i++) sum += this.weightAt(i)\r\n return sum\r\n }\r\n\r\n /**\r\n * Series `index`'s columns, mapped into the plot's centred pixel space.\r\n *\r\n * Both modes come out of one walk over the rows: a grouped series divides the\r\n * slot with its siblings and every column runs from zero, a stacked one takes\r\n * the whole slot and each column runs from the running total below it. The\r\n * live {@link weights} scale the grouped widths and the stacked contributions\r\n * alike, which is what lets `hideSeries` reflow rather than punch a hole.\r\n */\r\n private seriesBars(index: number): BarGeometry[] {\r\n const series = this.series[index]\r\n if (!series) return []\r\n const stacked = this.stacked\r\n const inner = this.slotInner\r\n const gap = this.resolvedTheme.bar.groupGap\r\n const unit = inner / this.totalWeight\r\n const weight = this.weightAt(index)\r\n\r\n return this.data.map((row, rowIndex) => {\r\n // The stack is built from the *live* contributions, so a series fading out\r\n // lowers the segments above it as it goes instead of dropping them by a\r\n // step when it finally switches off. A grouped row needs no such scaling —\r\n // there its weight moves the column's width, not its length.\r\n const spans = barSpans(\r\n stacked ? this.weightedRow(row) : row,\r\n this.series,\r\n stacked\r\n )\r\n const span = spans[index] ?? { from: 0, to: 0, value: 0 }\r\n const cap = stacked ? stackCapIndex(row, this.series) : index\r\n\r\n const slotLeft = this.slotCenter(rowIndex) - inner / 2\r\n const x = stacked\r\n ? this.slotCenter(rowIndex)\r\n : slotLeft + unit * this.weightBefore(index) + (unit * weight) / 2\r\n const width = stacked\r\n ? inner\r\n : Math.max(0, unit * weight - (this.series.length > 1 ? gap : 0))\r\n\r\n return {\r\n x,\r\n width,\r\n from: this.valueToY(span.from),\r\n to: this.valueToY(span.to),\r\n round: cap === index,\r\n // The figure printed is the row's own value, not the weighted one — a\r\n // series on its way out should not be seen counting down.\r\n value: num(row, series.field),\r\n }\r\n })\r\n }\r\n\r\n /**\r\n * `row` with each series' value scaled by that series' live {@link weights}\r\n * entry — what the stacked spans are measured from.\r\n */\r\n private weightedRow(row: DataRecord): DataRecord {\r\n const scaled: DataRecord = { ...row }\r\n this.series.forEach((s, i) => {\r\n const value = row[s.field]\r\n if (typeof value === \"number\") scaled[s.field] = value * this.weightAt(i)\r\n })\r\n return scaled\r\n }\r\n\r\n /**\r\n * How far each category is dimmed by the spotlight, one entry per row —\r\n * 1 while nothing is spotlit, falling to the theme's `dimOpacity` for every\r\n * category but the chosen one as the reveal climbs.\r\n */\r\n private categoryDims(): number[] {\r\n const focus = clampUnit(this.spotlightReveal)\r\n const dim = this.resolvedTheme.spotlight.dimOpacity\r\n const chosen = this.spotlight\r\n return this.data.map((_, i) =>\r\n focus <= 0 || chosen === i ? 1 : 1 - (1 - dim) * focus\r\n )\r\n }\r\n\r\n // ---- Build ------------------------------------------------------------\r\n\r\n constructor(props?: NodeConfig<BarChart, BarChartProps>) {\r\n super(props)\r\n\r\n // The whole chart is composed from plain props/`data` — no context needed,\r\n // so the parts are built here (super() applied the props above). Everything\r\n // a *leaf* reads live in `renderSelf` — each series' geometry, paint and\r\n // dim, the panel's fill, the border's stroke — is passed as a closure rather\r\n // than a snapshot, so `chart.to({ theme })` and\r\n // `chart.to({ valueAxis: { range } })` genuinely animate the drawn chart.\r\n const enabled = this.series.map((s) => s.enabled ?? true)\r\n this.weights = enabled.map((on) => (on ? 1 : 0))\r\n const showLegend = props?.showLegend !== false\r\n const showValues = props?.showValues === true\r\n\r\n this.vAxis = new VerticalAxis({\r\n range: () => this.valueScale,\r\n markers: () => this.resolvedMarkers,\r\n axis: () => this.resolvedTheme.yAxis,\r\n label: this.valueAxis.label ?? \"\",\r\n width: \"hug\",\r\n height: \"fill\",\r\n })\r\n this.vAxis.labelFor = (value) => this.valueLabel(value)\r\n\r\n this.cAxis = new CategoryAxis({\r\n categories: barCategories(this.data, this.categoryField),\r\n axis: () => this.resolvedTheme.xAxis,\r\n label: this.categoryAxis.label ?? \"\",\r\n dims: () => this.categoryDims(),\r\n width: \"fill\",\r\n height: \"hug\",\r\n })\r\n\r\n this.barSets = this.series.map(\r\n (s, i) =>\r\n new ChartBars({\r\n bars: () => this.seriesBars(i),\r\n baseline: () => this.baselinePx,\r\n fill: () => resolveBarFill(this.resolvedTheme.seriesFills, s, i),\r\n barStroke: () => this.resolvedTheme.bar.stroke,\r\n barShadow: () => this.resolvedTheme.bar.shadow,\r\n cornerRadius: () => this.resolvedTheme.bar.cornerRadius,\r\n growth: () => this.growth,\r\n dims: () => this.categoryDims(),\r\n showValues,\r\n valueStyle: this.resolvedTheme.valueStyle,\r\n enabled: enabled[i],\r\n })\r\n )\r\n // The figures on the columns are the same numbers the value axis ticks, so\r\n // they read through the same format.\r\n for (const set of this.barSets) set.labelFor = (value) => this.valueLabel(value)\r\n\r\n if (showLegend) {\r\n this.legend = new ChartLegend({\r\n series: this.series,\r\n swatches: () =>\r\n this.series.map((s, i) =>\r\n resolveBarFill(this.resolvedTheme.seriesFills, s, i)\r\n ),\r\n legend: () => this.resolvedTheme.legend,\r\n })\r\n }\r\n\r\n this.plotRect = new Rect({\r\n clip: true,\r\n children: [\r\n new ChartCanvas({\r\n fill: () => this.resolvedTheme.plotArea.fill,\r\n shadow: () => this.resolvedTheme.plotArea.shadow,\r\n xGridStroke: () => this.resolvedTheme.xAxis.lineStyle,\r\n yGridStroke: () => this.resolvedTheme.yAxis.lineStyle,\r\n // No vertical rules: the horizontal axis is categorical, so there is\r\n // no numeric position along it for a grid line to mark. The channel\r\n // between slots does that job, and better.\r\n xMarkers: [],\r\n yMarkers: () => this.resolvedMarkers,\r\n xExtent: () => [0, 1] as Range,\r\n yExtent: () => this.valueScale,\r\n }),\r\n ...this.barSets,\r\n new ChartBorder({\r\n stroke: () => this.resolvedTheme.plotArea.stroke,\r\n }),\r\n ],\r\n })\r\n\r\n // Invisible twin of the value axis, reserving the same left gutter under the\r\n // plot so the category row starts at the plot's left edge rather than the\r\n // chart's — and so a caption lands under the columns it names.\r\n const gutterSpacer = new VerticalAxis({\r\n opacity: 0,\r\n range: () => this.valueScale,\r\n markers: () => this.resolvedMarkers,\r\n axis: () => this.resolvedTheme.yAxis,\r\n label: this.valueAxis.label ?? \"\",\r\n width: \"hug\",\r\n height: 0,\r\n })\r\n\r\n const below: Node2D[] = [this.cAxis]\r\n if (this.legend) below.push(this.legend)\r\n\r\n this.add(\r\n new Rect({ flow: \"vertical\",\r\n width: \"fill\",\r\n height: \"fill\",\r\n // See {@link TOP_HEADROOM}.\r\n padding: { top: TOP_HEADROOM },\r\n children: [\r\n new Rect({ flow: \"horizontal\",\r\n height: \"fill\",\r\n width: \"fill\",\r\n children: [this.vAxis, this.plotRect],\r\n }),\r\n new Rect({ flow: \"horizontal\",\r\n width: \"fill\",\r\n children: [\r\n gutterSpacer,\r\n new Rect({ flow: \"vertical\", width: \"fill\", gap: 20, children: below }),\r\n ],\r\n }),\r\n ],\r\n })\r\n )\r\n }\r\n\r\n // ---- Orchestrated entrance --------------------------------------------\r\n\r\n /**\r\n * Prime every part at its pre-entrance state — axis markers and captions\r\n * shifted and transparent, columns collapsed onto the baseline, legend dropped\r\n * and transparent.\r\n *\r\n * Called by {@link enter} before its first frame so nothing flashes ahead of\r\n * its beat. Idempotent, and public so a scene can hide a chart ahead of time\r\n * without starting the entrance.\r\n */\r\n arm(): void {\r\n this.vAxis.arm()\r\n this.cAxis.arm()\r\n this.growth = 0\r\n this.legend?.set({ opacity: 0, y: -LEGEND_SLIDE })\r\n }\r\n\r\n /**\r\n * Animate the whole chart in: the two axes stagger their markers and captions\r\n * in, the columns rise from the baseline, and the legend fades up last.\r\n *\r\n * `duration` is the **whole** entrance. The phases are shares of it, not\r\n * multiples — a command that declares 1.4 seconds has to take 1.4 seconds,\r\n * because that is the slot the timeline lays out for it, the length its\r\n * parallel siblings are timed against, and its contribution to the scene's own\r\n * duration.\r\n */\r\n @command()\r\n enter(args: CommandArgs<Record<string, never>> & { duration: number }): Command<Record<string, never>> {\r\n const { duration } = args\r\n const easing = args.easing ?? easeOut()\r\n this.arm()\r\n\r\n return asCommand(\r\n sequenceOf(\r\n together(\r\n this.vAxis.enter({ data: { slide: 24 }, duration: duration * AXES_SHARE, easing }),\r\n this.cAxis.enter({ data: { slide: 24 }, duration: duration * AXES_SHARE, easing })\r\n ),\r\n this.riseBars(duration * BARS_SHARE, easing),\r\n // Without a legend the beat is still its share of the whole, so the\r\n // entrance ends exactly when it was laid out to.\r\n this.legend\r\n ? this.legend.to({ data: { opacity: 1, y: 0 }, duration: duration * LEGEND_SHARE, easing })\r\n : hold(duration * LEGEND_SHARE)\r\n ),\r\n duration\r\n )\r\n }\r\n\r\n /**\r\n * Move props to new values; a restated value-axis `range` or `ticks` tweens\r\n * from the domain as drawn, so an auto axis (the default) rescales the columns\r\n * continuously instead of cutting at the midpoint of the move.\r\n */\r\n override to<D extends Partial<BarChartProps> = Partial<BarChartProps>>(\r\n args: CommandArgs<D> & { duration: number }\r\n ): Command<BarChartProps> {\r\n const data = (args.data ?? {}) as Partial<BarChartProps>\r\n const drawn: AxisDomainConfig = {\r\n ...this.valueAxis,\r\n range: this.valueScale,\r\n ticks: this.resolvedMarkers,\r\n }\r\n const target = axisTweenTarget(drawn, data.valueAxis)\r\n if (!target) return super.to(args)\r\n\r\n const { valueAxis: _valueAxis, ...rest } = data\r\n const axis = this.command<{ valueAxis: AxisDomainConfig }>(\r\n (t) => ({ valueAxis: lerpAxisDomain(drawn, target, t) }),\r\n args.duration,\r\n args.easing\r\n )\r\n if (Object.keys(rest).length === 0) return axis as unknown as Command<BarChartProps>\r\n return asCommand(\r\n together(super.to({ ...args, data: rest } as typeof args), axis),\r\n args.duration\r\n ) as unknown as Command<BarChartProps>\r\n }\r\n\r\n /** Tween {@link growth} `0 → 1`, raising every column about the baseline. */\r\n private riseBars(\r\n duration: number,\r\n easing: EasingFunction\r\n ): Command<BarGrowth> {\r\n // No priming to 0 first: the value at `t` is a function of `t`, so a repeat\r\n // call re-raises by definition rather than by having reset something.\r\n return this.command<BarGrowth>((t) => ({ growth: t }), duration, easing)\r\n }\r\n\r\n /**\r\n * Show series `index`: bring its columns back, the group reflowing to make\r\n * room as they arrive, in lockstep with its legend entry growing in.\r\n */\r\n @command({ args: [{ key: \"seriesIndex\", kind: \"series\", default: 0, min: 0, step: 1 }] })\r\n showSeries(args: CommandArgs<{ seriesIndex: number }>): Command<Record<string, never>> {\r\n const { seriesIndex = 0 } = args.data ?? {}\r\n return this.toggleSeries(seriesIndex, 1, args.duration ?? 0.35, args.easing ?? easeOut())\r\n }\r\n\r\n /**\r\n * Hide series `index`: its columns narrow away (or, stacked, sink out of the\r\n * stack) while the rest of the group widens into the space, its legend entry\r\n * shrinking beside them — the mirror of {@link showSeries}.\r\n */\r\n @command({ args: [{ key: \"seriesIndex\", kind: \"series\", default: 0, min: 0, step: 1 }] })\r\n hideSeries(args: CommandArgs<{ seriesIndex: number }>): Command<Record<string, never>> {\r\n const { seriesIndex = 0 } = args.data ?? {}\r\n return this.toggleSeries(seriesIndex, 0, args.duration ?? 0.35, args.easing ?? easeOut())\r\n }\r\n\r\n /**\r\n * Move series `index`'s slot share to `target`, with its legend entry.\r\n *\r\n * One method for both directions, so the pair cannot drift apart. `enabled`\r\n * rides in the same value as the weight rather than being set before or after,\r\n * which is what makes arriving at a time backwards show what arriving forwards\r\n * does.\r\n */\r\n private toggleSeries(\r\n index: number,\r\n target: number,\r\n duration: number,\r\n easing: EasingFunction\r\n ): Command<Record<string, never>> {\r\n const bars = this.barSets[index]\r\n if (!bars) return asCommand(hold(duration))\r\n\r\n return asCommand(\r\n together(\r\n this.tweenWeight(index, target, duration, easing),\r\n drive(duration, (t) => {\r\n const share = t >= 1 ? target : Math.max(target, 1 - t)\r\n bars.set({ enabled: target > 0 || share > 0 })\r\n }),\r\n ...(this.legend\r\n ? [\r\n target > 0\r\n ? this.legend.showSeries({ data: { index }, duration, easing })\r\n : this.legend.hideSeries({ data: { index }, duration, easing }),\r\n ]\r\n : [])\r\n ),\r\n duration\r\n )\r\n }\r\n\r\n /**\r\n * Fade out every other series — its columns **and its legend entry** — to\r\n * focus attention on `index`, which comes back to full. Nothing moves, so the\r\n * group doesn't reflow.\r\n */\r\n @command({ args: [{ key: \"seriesIndex\", kind: \"series\", default: 0, min: 0, step: 1 }] })\r\n spotlightSeries(args: CommandArgs<{ seriesIndex: number }>): Command<Record<string, never>> {\r\n const { seriesIndex = 0 } = args.data ?? {}\r\n const duration = args.duration ?? 0.35\r\n const easing = args.easing ?? easeOut()\r\n const dim = this.resolvedTheme.spotlight.dimOpacity\r\n return asCommand(\r\n together(\r\n ...this.barSets.map((bars, i) =>\r\n bars.to({ data: { opacity: i === seriesIndex ? 1 : dim }, duration, easing })\r\n ),\r\n ...(this.legend\r\n ? [this.legend.spotlightSeries({ data: { index: seriesIndex }, duration, easing })]\r\n : [])\r\n ),\r\n duration\r\n )\r\n }\r\n\r\n /** Ease series `index`'s slot share toward `target`, reflowing the group. */\r\n private tweenWeight(\r\n index: number,\r\n target: number,\r\n duration: number,\r\n easing: EasingFunction\r\n ): Seekable {\r\n // Read through `weightAt` rather than off the array, so a chart whose stored\r\n // weights are short (or absent) still tweens from the 1 it is drawing at.\r\n const from = this.series.map((_, i) => this.weightAt(i))\r\n const start = from[index] ?? 1\r\n if (start === target) return hold(duration)\r\n\r\n return drive(duration, (t) => {\r\n const next = [...from]\r\n next[index] = start + (target - start) * easing(t)\r\n this.weights = next\r\n })\r\n }\r\n\r\n // ---- Per-category ------------------------------------------------------\r\n\r\n /**\r\n * Spotlight one **category** — one column of the table rather than one series:\r\n * every other category's bars and its caption fade to the theme's\r\n * `dimOpacity`, and the chosen one stays full.\r\n *\r\n * The counterpart of the line chart's `spotlightRegion`, and the same shape of\r\n * thing: it picks out a slice of the plot without changing what is drawn.\r\n * Calling it while another category is already lit moves the focus directly —\r\n * only the dimming changes, so there is nothing to retract first.\r\n */\r\n @command({ args: [{ key: \"categoryIndex\", kind: \"number\", default: 0, min: 0, step: 1 }] })\r\n spotlightCategory(args: CommandArgs<{ categoryIndex: number }>): Command<CategorySpotlight> {\r\n const { categoryIndex = 0 } = args.data ?? {}\r\n const duration = args.duration ?? 0.4\r\n const easing = args.easing ?? easeOut()\r\n if (categoryIndex < 0 || categoryIndex >= this.data.length) return this.holdSpotlight(duration)\r\n const from = this.spotlightReveal\r\n // Which category is lit is part of the value, set from the first frame: the\r\n // focus moves directly, so unlike the line chart's region there is nothing to\r\n // retract before it.\r\n return this.command<CategorySpotlight>(\r\n (t) => ({ spotlight: categoryIndex, spotlightReveal: from + (1 - from) * t }),\r\n duration,\r\n easing\r\n )\r\n }\r\n\r\n /**\r\n * Drop the category spotlight, bringing every category back to full. A no-op\r\n * when nothing is lit — but it still takes its slot on the timeline, for the\r\n * reason `LineChart.clearRegion` does.\r\n */\r\n @command()\r\n clearCategory(args: CommandArgs<Record<string, never>>): Command<CategorySpotlight> {\r\n const duration = args.duration ?? 0.4\r\n const easing = args.easing ?? easeOut()\r\n const from = this.spotlightReveal\r\n if (from === 0) return this.holdSpotlight(duration)\r\n\r\n // The lit category is held until the fade lands — cleared at `t === 1` rather\r\n // than up front, or there would be nothing left to fade.\r\n return this.command<CategorySpotlight>(\r\n (t) =>\r\n t >= 1\r\n ? { spotlight: null, spotlightReveal: 0 }\r\n : { spotlightReveal: from * (1 - t) },\r\n duration,\r\n easing\r\n )\r\n }\r\n\r\n /** The no-op both of the above return — see {@link hold}. */\r\n private holdSpotlight(duration: number): Command<CategorySpotlight> {\r\n return this.command<CategorySpotlight>(() => ({}), duration)\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"bar-chart.js","sour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IAAI,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAC1I,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Rect,\r\n Types,\r\n component2d,\r\n easeOut,\r\n type ChildView,\r\n type DataRecord,\r\n type EntryOptions,\r\n type NodeOf,\r\n // Named so this component's emitted type reaches `Node2D` through the sdk, not core.\r\n type Node2D,\r\n type Node2DProps,\r\n type Size2D,\r\n type Timeline,\r\n} from \"@motionscript/sdk\"\r\nimport { formatNumber } from \"@motionscript/sdk/component\"\r\n\r\nimport { cartesianFrame, cartesianViews, laidOutSize } from \"../kit/cartesian\"\r\nimport { ChartBorder } from \"../kit/chart-border\"\r\nimport { ChartCanvas } from \"../kit/chart-canvas\"\r\nimport { ChartLegend } from \"../kit/chart-legend\"\r\nimport { asParts, fresh } from \"../kit/entries\"\r\nimport { beats, type Beat } from \"../kit/motion\"\r\nimport { VerticalAxis } from \"../kit/vertical-axis\"\r\nimport {\r\n clampUnit,\r\n formatMarker,\r\n lerpAxisDomain,\r\n lerpAxisEntry,\r\n markerStep,\r\n markerValues,\r\n num,\r\n resolveAxisDomain,\r\n settleAxisDomain,\r\n type AxisDomainConfig,\r\n type Range,\r\n} from \"../kit/shared\"\r\nimport { CategoryAxis } from \"./category-axis\"\r\nimport { ChartBars, type BarGeometry } from \"./chart-bars\"\r\nimport {\r\n DEFAULT_BAR_CHART_THEME,\r\n barCategories,\r\n barSpans,\r\n lerpBarChartTheme,\r\n resolveBarChartTheme,\r\n resolveBarFill,\r\n resolveBarScale,\r\n stackCapIndex,\r\n type BarChartConfig,\r\n type BarChartTheme,\r\n type BarSeries,\r\n} from \"./shared\"\r\n\r\nexport interface BarChartProps extends Node2DProps {\r\n /** One row per category — a plain record of field name to value. */\r\n data: DataRecord[]\r\n /**\r\n * Key into each row for its category caption, drawn beneath the baseline.\r\n * Named `categoryField` rather than `category` for the same reason the line\r\n * chart's is `xField`: it names a *column*, not a value.\r\n */\r\n categoryField: string\r\n /** One entry per bar series: which column it plots, its `label`, its `fill`. */\r\n series: BarSeries[]\r\n /**\r\n * When `true` every category's series stack into one column; when `false`\r\n * (the default) each series gets its own bar, grouped side by side within the\r\n * category's slot.\r\n */\r\n stacked?: boolean\r\n /** The value axis's domain: caption, scale range, and tick placement. */\r\n valueAxis?: AxisDomainConfig\r\n /** The category axis's domain. Only its `label` is read — the slots are the rows. */\r\n categoryAxis?: AxisDomainConfig\r\n /**\r\n * The chart's visual theme — bar palette and geometry, axis furniture, plot\r\n * panel paint, legend, value figures. Every branch is optional and deep-merged\r\n * onto {@link DEFAULT_BAR_CHART_THEME}.\r\n */\r\n theme?: BarChartTheme\r\n /** Whether the legend row below the plot is drawn at all. */\r\n showLegend?: boolean\r\n /** Whether each column prints the figure it plots. */\r\n showValues?: boolean\r\n}\r\n\r\n/** What a bar chart plots, as its entries hold it. */\r\nexport interface BarChartValues {\r\n readonly data: DataRecord[]\r\n readonly series: BarSeries[]\r\n readonly stacked: boolean\r\n readonly valueAxis: AxisDomainConfig\r\n}\r\n\r\n/** The value axis's domain with its range and ticks resolved. */\r\nexport type BarChartDomain = AxisDomainConfig & { readonly range: Range; readonly ticks: number[] }\r\n\r\n/** The argument every per-series command takes: an index into `series`, offered by name. */\r\nconst SERIES_ARG = Types.custom<number, number, EntryOptions & { readonly min: number; readonly step: number }>(0, { kind: \"series\", min: 0, step: 1 })\r\n\r\n/** How far the legend starts below its slot when it enters, in px. */\r\nconst LEGEND_SLIDE = 20\r\n\r\n/** Fallback marker count when the value axis states no ticks. */\r\nconst DEFAULT_MARKERS = 5\r\n\r\n/**\r\n * How `enter` divides its duration between its three beats: the axes arriving,\r\n * the columns rising, and the legend coming up. Shares of the whole, so they\r\n * must sum to 1.\r\n */\r\nconst AXES_SHARE = 0.35\r\nconst BARS_SHARE = 0.5\r\nconst LEGEND_SHARE = 0.15\r\n\r\n/** What the geometry reads: what the chart plots, its theme and the signals its commands move. */\r\ninterface BarState extends BarChartValues {\r\n readonly theme: BarChartConfig\r\n readonly weights: number[]\r\n readonly spotlight: number | null\r\n readonly spotlightReveal: number\r\n}\r\n\r\n/** The value axis with its range and ticks resolved: the explicit ones, else five across the scale. */\r\nfunction drawnValue(s: BarChartValues, domain: AxisDomainConfig): AxisDomainConfig {\r\n const divisions = (domain.ticks?.length ?? DEFAULT_MARKERS) - 1\r\n const range = resolveBarScale(s.data, s.series, s.stacked, domain.range, divisions)\r\n return { ...domain, range, ticks: domain.ticks ?? markerValues(range, DEFAULT_MARKERS - 1) }\r\n}\r\n\r\n/** The value axis as a bar chart draws it now, an auto range or tick row read back as itself. */\r\nexport function barChartDomain(s: BarChartValues): BarChartDomain {\r\n return settleAxisDomain(s.valueAxis, (d) => drawnValue(s, d)) as BarChartDomain\r\n}\r\n\r\n/**\r\n * A value written down as this chart's value axis says: the ticks and the\r\n * figures printed on the columns both read through here, so the two cannot\r\n * disagree about what a number looks like.\r\n */\r\nfunction valueLabel(s: BarChartValues, domain: BarChartDomain, value: number): string {\r\n const pattern = s.valueAxis.format\r\n return pattern === undefined ? formatMarker(value, markerStep(domain.ticks)) : formatNumber(value, pattern)\r\n}\r\n\r\n/** A value on the plot's **centred** pixel space (origin at its centre, y-up). */\r\nfunction valueToY(domain: BarChartDomain, plot: Size2D, value: number): number {\r\n const [min, max] = domain.range\r\n if (max <= min) return -plot.height / 2\r\n return ((value - min) / (max - min) - 0.5) * plot.height\r\n}\r\n\r\n/**\r\n * Pixel y of the line every column grows from: zero clamped onto the scale, so\r\n * a cropped axis grows its columns from the plot floor.\r\n */\r\nfunction baselinePx(domain: BarChartDomain, plot: Size2D): number {\r\n const [min, max] = domain.range\r\n return valueToY(domain, plot, Math.min(Math.max(0, min), max))\r\n}\r\n\r\n/** Series `i`'s live share of the slot; 0 once it has been hidden. */\r\nfunction weightAt(s: BarState, index: number): number {\r\n return Math.max(0, s.weights[index] ?? 1)\r\n}\r\n\r\n/** `row` with each series' value scaled by its live weight: what the stacked spans are measured from. */\r\nfunction weightedRow(s: BarState, row: DataRecord): DataRecord {\r\n const scaled: DataRecord = { ...row }\r\n s.series.forEach((series, i) => {\r\n const value = row[series.field]\r\n if (typeof value === \"number\") scaled[series.field] = value * weightAt(s, i)\r\n })\r\n return scaled\r\n}\r\n\r\n/**\r\n * Series `index`'s columns, mapped into the plot's centred pixel space. A\r\n * grouped series divides the slot with its siblings by their live weights, a\r\n * stacked one takes the whole slot and runs from the running total below it,\r\n * so hiding a series reflows rather than punching a hole.\r\n */\r\nfunction seriesBars(s: BarState, index: number, plot: Size2D, captioned: boolean): BarGeometry[] {\r\n const series = s.series[index]\r\n if (!series) return []\r\n const domain = barChartDomain(s)\r\n const n = s.data.length\r\n const slotWidth = n > 0 ? plot.width / n : 0\r\n const slotCenter = (i: number) => -plot.width / 2 + slotWidth * (i + 0.5)\r\n const inner = slotWidth * clampUnit(s.theme.bar.slotFill)\r\n const gap = s.theme.bar.groupGap\r\n let total = 0\r\n for (let i = 0; i < s.series.length; i++) total += weightAt(s, i)\r\n const unit = inner / (total > 0 ? total : 1)\r\n const weight = weightAt(s, index)\r\n let before = 0\r\n for (let i = 0; i < index; i++) before += weightAt(s, i)\r\n\r\n return s.data.map((row, rowIndex) => {\r\n // The stack is built from the *live* contributions, so a series fading out\r\n // lowers the segments above it as it goes.\r\n const spans = barSpans(s.stacked ? weightedRow(s, row) : row, s.series, s.stacked)\r\n const span = spans[index] ?? { from: 0, to: 0, value: 0 }\r\n const cap = s.stacked ? stackCapIndex(row, s.series) : index\r\n const slotLeft = slotCenter(rowIndex) - inner / 2\r\n const x = s.stacked ? slotCenter(rowIndex) : slotLeft + unit * before + (unit * weight) / 2\r\n const width = s.stacked ? inner : Math.max(0, unit * weight - (s.series.length > 1 ? gap : 0))\r\n // The figure printed is the row's own value, not the weighted one.\r\n const value = num(row, series.field)\r\n return {\r\n x,\r\n width,\r\n from: valueToY(domain, plot, span.from),\r\n to: valueToY(domain, plot, span.to),\r\n round: cap === index,\r\n value,\r\n ...(captioned && { caption: valueLabel(s, domain, value) }),\r\n }\r\n })\r\n}\r\n\r\n/**\r\n * How far each category is dimmed by the spotlight, one entry per row: 1 while\r\n * nothing is spotlit, falling to the theme's `dimOpacity` for every category but\r\n * the chosen one as the reveal climbs.\r\n */\r\nfunction categoryDims(s: BarState): number[] {\r\n const focus = clampUnit(s.spotlightReveal)\r\n const dim = s.theme.spotlight.dimOpacity\r\n const chosen = s.spotlight\r\n return s.data.map((_, i) => (focus <= 0 || chosen === i ? 1 : 1 - (1 - dim) * focus))\r\n}\r\n\r\ntype AnyTimeline = Timeline<any, any>\r\n\r\n/** The parts a bar chart's commands drive, found through its children. */\r\nfunction partsOf(children: readonly ChildView[]) {\r\n const frame = cartesianViews(children)\r\n if (!frame) return null\r\n const cAxis = frame.below.find(CategoryAxis.is)\r\n if (!VerticalAxis.is(frame.axis) || !cAxis) return null\r\n return {\r\n vAxis: frame.axis,\r\n cAxis,\r\n bars: frame.plot.filter(ChartBars.is),\r\n legend: frame.below.find(ChartLegend.is) ?? null,\r\n }\r\n}\r\n\r\n/**\r\n * Move series `index`'s slot share to `target` with its legend entry, the group\r\n * reflowing. Its columns are drawn for every frame the move covers, and switch\r\n * off only once a hide has landed, so arriving at a time backwards shows what\r\n * arriving forwards does.\r\n */\r\nfunction toggling(timeline: AnyTimeline, state: BarState & { readonly showing: boolean[] }, children: readonly ChildView[], index: number, target: number) {\r\n const parts = partsOf(children)\r\n if (!parts || !parts.bars[index]) return timeline.wait(timeline.duration)\r\n // Read through `weightAt`, so a chart whose stored weights are short still\r\n // tweens from the 1 it is drawing at.\r\n const from = state.series.map((_, i) => weightAt(state, i))\r\n const start = from[index] ?? 1\r\n const showing = state.series.map((s, i) => state.showing[i] ?? (s.enabled ?? true))\r\n return timeline.together([\r\n timeline.animate((t) => {\r\n const weights = [...from]\r\n weights[index] = start + (target - start) * timeline.ease(t)\r\n const shown = [...showing]\r\n shown[index] = target > 0 || t < 1\r\n return { weights, showing: shown }\r\n }, { eased: false }),\r\n ...(parts.legend ? [parts.legend.run(target > 0 ? \"showSeries\" : \"hideSeries\", { index })] : []),\r\n ])\r\n}\r\n\r\n/**\r\n * A grouped or stacked bar chart, the sibling of the line chart and built the\r\n * same way, out of several of the same pieces:\r\n *\r\n * - `ChartCanvas` — the plot panel with a horizontal grid, under everything.\r\n * - `VerticalAxis` — the numeric value markers, staggering in bottom-to-top.\r\n * - {@link CategoryAxis} — the row of names beneath the baseline, one per row.\r\n * - {@link ChartBars} (one per series) — that series' column in every category,\r\n * plus the figures printed on them.\r\n * - `ChartLegend` — a row of entries below the chart, one per series.\r\n *\r\n * Every part reads the chart's entries through bindings, and the columns map\r\n * across the plot panel's own laid-out box, so a column's end lands exactly on\r\n * its marker. **Zero is always on the scale**, and the columns grow about it, so\r\n * a negative value draws downward out of the same `growth` signal.\r\n *\r\n * **Resting state is the finished chart**; `enter` arms every part on its first\r\n * frame. `showSeries`/`hideSeries`/`spotlightSeries` pick out a *series* (hiding\r\n * one reflows the group), `spotlightCategory`/`clearCategory` a *column of the\r\n * table*. A `to` of the value axis's `range` or `ticks` tweens from the domain\r\n * as drawn, so an auto axis rescales the columns continuously.\r\n */\r\nexport const BarChart = component2d({\r\n key: \"barChart\",\r\n state: {\r\n data: fresh<DataRecord[]>(() => []),\r\n categoryField: \"\",\r\n series: fresh<BarSeries[]>(() => []),\r\n stacked: false,\r\n valueAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisEntry }),\r\n categoryAxis: Types.custom<AxisDomainConfig>({}, { resolve: resolveAxisDomain, lerp: lerpAxisDomain }),\r\n theme: Types.custom<BarChartTheme, BarChartConfig>(DEFAULT_BAR_CHART_THEME, { resolve: resolveBarChartTheme, lerp: lerpBarChartTheme }),\r\n /**\r\n * Global rise of every column in `[0, 1]`, measured about the baseline: 0\r\n * collapses them all onto it, 1 draws them at full length.\r\n */\r\n growth: 1,\r\n /**\r\n * How much of the slot each series claims, one entry per series: a weight\r\n * rather than a switch, so hiding one is the others widening into the space.\r\n * Seeded from each series' `enabled`.\r\n */\r\n weights: fresh<number[]>(() => []),\r\n /** The category spotlit, or `null` for none. The choice snaps; `spotlightReveal` is the animation. */\r\n spotlight: Types.custom<number | null>(null),\r\n /** How far the category spotlight is drawn in, `[0, 1]`. */\r\n spotlightReveal: 0,\r\n /** Read as the chart is built: the legend is a part the chart builds or doesn't. */\r\n showLegend: Types.boolean(true, { animatable: false }),\r\n /** Read as the chart is built: whether each column prints the figure it plots. */\r\n showValues: Types.boolean(false, { animatable: false }),\r\n /** Whether each series' columns are drawn: on for every frame a show or hide covers, off once a hide lands. */\r\n showing: Types.custom<boolean[]>([], { private: true }),\r\n },\r\n defaults: {\r\n // Its parts fill it; a node made of them would hug them.\r\n width: \"fill\",\r\n height: \"fill\",\r\n weights: (state) => state.series.map((s) => ((s.enabled ?? true) ? 1 : 0)),\r\n showing: (state) => state.series.map((s) => s.enabled ?? true),\r\n },\r\n children: (state) => {\r\n const theme = () => state.theme\r\n const domain = () => barChartDomain(state)\r\n let plot: Node2D | undefined\r\n // Before the panel is built or laid out it has no size, and the columns map onto nothing.\r\n const plotSize = () => laidOutSize(plot)\r\n const captioned = state.showValues === true\r\n\r\n const vAxis = new VerticalAxis({\r\n range: () => domain().range,\r\n markers: () => domain().ticks,\r\n captions: () => {\r\n const d = domain()\r\n return d.ticks.map((value) => valueLabel(state, d, value))\r\n },\r\n axis: () => theme().yAxis,\r\n label: state.valueAxis.label ?? \"\",\r\n width: \"hug\",\r\n height: \"fill\",\r\n })\r\n\r\n const cAxis = new CategoryAxis({\r\n categories: barCategories(state.data, state.categoryField),\r\n axis: () => theme().xAxis,\r\n label: state.categoryAxis.label ?? \"\",\r\n dims: () => categoryDims(state),\r\n width: \"fill\",\r\n height: \"hug\",\r\n }) as unknown as Node2D\r\n\r\n const barSets = state.series.map(\r\n (s, i) =>\r\n new ChartBars({\r\n bars: () => seriesBars(state, i, plotSize(), captioned),\r\n baseline: () => baselinePx(domain(), plotSize()),\r\n fill: () => resolveBarFill(theme().seriesFills, s, i),\r\n barStroke: () => theme().bar.stroke,\r\n barShadow: () => theme().bar.shadow,\r\n cornerRadius: () => theme().bar.cornerRadius,\r\n growth: () => state.growth,\r\n dims: () => categoryDims(state),\r\n showValues: captioned,\r\n valueStyle: state.theme.valueStyle,\r\n enabled: () => state.showing[i] ?? (s.enabled ?? true),\r\n }) as unknown as Node2D\r\n )\r\n\r\n const below: Node2D[] = [cAxis]\r\n if (state.showLegend !== false) {\r\n below.push(\r\n new ChartLegend({\r\n series: state.series,\r\n swatches: () => state.series.map((s, i) => resolveBarFill(theme().seriesFills, s, i)),\r\n legend: () => theme().legend,\r\n // The row's spacing is the theme's as the chart was built, like the\r\n // entries' type and chips: a theme tween re-paints the swatches only.\r\n gap: state.theme.legend.itemGap,\r\n padding: state.theme.legend.padding,\r\n }) as unknown as Node2D\r\n )\r\n }\r\n\r\n plot = new Rect({\r\n clip: true,\r\n children: [\r\n new ChartCanvas({\r\n fill: () => theme().plotArea.fill,\r\n shadow: () => theme().plotArea.shadow,\r\n xGridStroke: () => theme().xAxis.lineStyle,\r\n yGridStroke: () => theme().yAxis.lineStyle,\r\n // No vertical rules: the horizontal axis is categorical, so there is no\r\n // numeric position along it for a grid line to mark.\r\n xMarkers: [],\r\n yMarkers: () => domain().ticks,\r\n xExtent: () => [0, 1] as Range,\r\n yExtent: () => domain().range,\r\n }),\r\n ...barSets,\r\n new ChartBorder({ stroke: () => theme().plotArea.stroke }),\r\n ],\r\n }) as unknown as Node2D\r\n\r\n const gutter = new VerticalAxis({\r\n opacity: 0,\r\n range: () => domain().range,\r\n markers: () => domain().ticks,\r\n axis: () => theme().yAxis,\r\n label: state.valueAxis.label ?? \"\",\r\n width: \"hug\",\r\n height: 0,\r\n }) as unknown as Node2D\r\n\r\n return asParts([\r\n ...(state.children as unknown as Node2D[]),\r\n cartesianFrame({ axis: vAxis as unknown as Node2D, plot, gutter, below }),\r\n ])\r\n },\r\n commands: {\r\n /**\r\n * Animate the whole chart in: the two axes stagger their markers and\r\n * captions in, the columns rise from the baseline, and the legend fades up\r\n * last. Its first frame arms every part: markers and captions shifted and\r\n * transparent, columns collapsed, the legend dropped and transparent.\r\n * `duration` is the **whole** entrance; the beats are shares of it.\r\n */\r\n enter: {\r\n args: {},\r\n easing: easeOut(),\r\n run: (timeline, _state, children) => {\r\n const parts = partsOf(children)\r\n if (!parts) return timeline.wait(timeline.duration)\r\n const duration = timeline.duration\r\n const axes = duration * AXES_SHARE\r\n const rise = duration * BARS_SHARE\r\n const { legend } = parts\r\n const at0 = (piece: Beat[\"piece\"]): Beat => ({ at: 0, duration: 0, piece })\r\n // Without a legend the beat is still its share of the whole.\r\n return beats(timeline, [\r\n at0(timeline.animate(() => ({ growth: 0 }))),\r\n ...(legend ? [at0(legend.to({ opacity: 0, y: -LEGEND_SLIDE }))] : []),\r\n { at: 0, duration: axes, piece: parts.vAxis.run(\"enter\", { slide: 24 }) },\r\n { at: 0, duration: axes, piece: parts.cAxis.run(\"enter\", { slide: 24 }) },\r\n // No priming to 0 first: the value at `t` is a function of `t`.\r\n { at: axes, duration: rise, piece: timeline.animate((t) => ({ growth: t })) },\r\n ...(legend ? [{ at: axes + rise, duration: duration * LEGEND_SHARE, piece: legend.to({ opacity: 1, y: 0 }) }] : []),\r\n ])\r\n },\r\n },\r\n /** Show series `index`: its columns come back, the group reflowing to make room, with its legend entry. */\r\n showSeries: {\r\n args: { seriesIndex: SERIES_ARG },\r\n easing: easeOut(),\r\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 1),\r\n },\r\n /**\r\n * Hide series `index`: its columns narrow away (or, stacked, sink out of the\r\n * stack) while the rest of the group widens into the space — the mirror of\r\n * `showSeries`.\r\n */\r\n hideSeries: {\r\n args: { seriesIndex: SERIES_ARG },\r\n easing: easeOut(),\r\n run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 0),\r\n },\r\n /**\r\n * Fade every other series — its columns **and its legend entry** — to focus\r\n * on `index`, which comes back to full. Nothing moves, so the group doesn't\r\n * reflow.\r\n */\r\n spotlightSeries: {\r\n args: { seriesIndex: SERIES_ARG },\r\n easing: easeOut(),\r\n run: (timeline, state, children) => {\r\n const parts = partsOf(children)\r\n if (!parts) return timeline.wait(timeline.duration)\r\n const index = timeline.args.seriesIndex\r\n const dim = state.theme.spotlight.dimOpacity\r\n return timeline.together([\r\n ...parts.bars.map((bars, i) => bars.to({ opacity: i === index ? 1 : dim })),\r\n ...(parts.legend ? [parts.legend.run(\"spotlightSeries\", { index })] : []),\r\n ])\r\n },\r\n },\r\n /**\r\n * Spotlight one **category**: every other category's columns and caption\r\n * fade to the theme's `dimOpacity`. Called while another is lit, the focus\r\n * moves directly: only the dimming changes, so nothing retracts first. A\r\n * category that is not there takes its slot and changes nothing.\r\n */\r\n spotlightCategory: {\r\n args: { categoryIndex: Types.number(0, { min: 0, step: 1 }) },\r\n easing: easeOut(),\r\n run: (timeline, state) => {\r\n const index = timeline.args.categoryIndex\r\n if (index < 0 || index >= state.data.length) return timeline.wait(timeline.duration)\r\n const from = state.spotlightReveal\r\n return timeline.animate((t) => ({ spotlight: index, spotlightReveal: from + (1 - from) * t }))\r\n },\r\n },\r\n /**\r\n * Drop the category spotlight, every category back to full. The lit\r\n * category is held until the fade lands; a no-op when nothing is lit, which\r\n * still takes its slot.\r\n */\r\n clearCategory: {\r\n args: {},\r\n easing: easeOut(),\r\n run: (timeline, state) => {\r\n const from = state.spotlightReveal\r\n if (from === 0) return timeline.wait(timeline.duration)\r\n const lit = state.spotlight\r\n return timeline.animate((t) => (t >= 1 ? { spotlight: null, spotlightReveal: 0 } : { spotlight: lit, spotlightReveal: from * (1 - t) }))\r\n },\r\n },\r\n },\r\n})\r\n\r\nexport type BarChart = NodeOf<typeof BarChart>\r\n"]}
@@ -1,6 +1,6 @@
1
- import { Node2D, type CommandArgs, type NodeConfig, type Node2DProps } from "@motionscript/sdk";
1
+ import { type NodeOf, type Node2D, type Node2DProps } from "@motionscript/sdk";
2
+ import { type Arrival } from "../kit/motion.js";
2
3
  import { type AxisConfig } from "../kit/shared.js";
3
- import { type Seekable } from "@motionscript/sdk/component";
4
4
  export interface CategoryAxisProps extends Node2DProps {
5
5
  /** One caption per category slot, left to right — the chart's rows, in order. */
6
6
  categories: string[];
@@ -34,44 +34,38 @@ export interface CategoryAxisProps extends Node2DProps {
34
34
  * invisible twin of the value axis, as the line chart does), so a caption lands
35
35
  * under the columns it names without either side being told about the other.
36
36
  *
37
- * {@link enter} staggers the captions in left-to-right, each lifted a little
38
- * above its slot and transparent; the resting state is the landed one, so a
39
- * chart that is never told to enter still reads as finished.
37
+ * `enter` staggers the captions in left-to-right, each lifted a little above
38
+ * its slot and transparent; the resting state is the landed one, so a chart
39
+ * that is never told to enter still reads as finished.
40
40
  */
41
- export declare class CategoryAxis extends Node2D<CategoryAxisProps> {
42
- categories: string[];
43
- axis: AxisConfig;
44
- label: string;
45
- dims: number[];
46
- /** One caption per category, ordered left → right, for the staggered enter. */
47
- private captionNodes;
48
- /** The axis title, or null when `label` is empty. */
49
- private labelNode;
50
- /** Centre x of slot `i`, in the node's centred space. */
51
- private slotCenter;
52
- constructor(props?: NodeConfig<CategoryAxis, CategoryAxisProps>);
53
- /**
54
- * Primes every caption (and the title) at its pre-entrance state: lifted above
55
- * its slot and transparent. Idempotent, so the chart can arm its whole
56
- * composition before the first frame is drawn.
57
- */
58
- arm(slide?: number): void;
59
- /**
60
- * Slide + fade every caption in from above, staggered left-to-right, then
61
- * bring the title down behind them.
62
- *
63
- * `args.duration` is the **whole** entrance — the stagger and the title are
64
- * carved out of it rather than added on top. See {@link enterBudget}.
65
- *
66
- * `args.data.stagger` is seconds between successive captions (derived when
67
- * omitted); `args.data.slide` is the starting upward offset in px (node space
68
- * is y-up, so a positive start slides *down* into place).
69
- */
70
- enter(args: CommandArgs<{
71
- stagger?: number;
72
- slide?: number;
73
- }> & {
74
- duration: number;
75
- }): Seekable;
76
- }
41
+ export declare const CategoryAxis: import("@motionscript/sdk").Component<"categoryAxis", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
42
+ readonly categories: import("@motionscript/sdk").Type<string[], string[], false>;
43
+ readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
44
+ readonly label: "";
45
+ readonly dims: import("@motionscript/sdk").Type<number[], number[], false>;
46
+ readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
47
+ }>, {
48
+ readonly enter: {
49
+ readonly stagger: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
50
+ readonly slide: import("@motionscript/sdk").Type<number, number, false>;
51
+ };
52
+ }, null, Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
53
+ readonly categories: import("@motionscript/sdk").Type<string[], string[], false>;
54
+ readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
55
+ readonly label: "";
56
+ readonly dims: import("@motionscript/sdk").Type<number[], number[], false>;
57
+ readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
58
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
59
+ readonly categories: import("@motionscript/sdk").Type<string[], string[], false>;
60
+ readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
61
+ readonly label: "";
62
+ readonly dims: import("@motionscript/sdk").Type<number[], number[], false>;
63
+ readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
64
+ }>, {
65
+ readonly enter: {
66
+ readonly stagger: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
67
+ readonly slide: import("@motionscript/sdk").Type<number, number, false>;
68
+ };
69
+ }, Node2D<Node2DProps>>>>;
70
+ export type CategoryAxis = NodeOf<typeof CategoryAxis>;
77
71
  //# sourceMappingURL=category-axis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"category-axis.d.ts","sourceRoot":"","sources":["../../src/bar-chart/category-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAON,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAE9E,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,iFAAiF;IACjF,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,qEAAqE;IACrE,IAAI,EAAE,UAAU,CAAA;IAChB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAKD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,YAAa,SAAQ,MAAM,CAAC,iBAAiB,CAAC;IACJ,UAAU,EAAE,MAAM,EAAE,CAAA;IAC1B,IAAI,EAAE,UAAU,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;IACK,IAAI,EAAE,MAAM,EAAE,CAAA;IAEnE,+EAA+E;IAC/E,OAAO,CAAC,YAAY,CAAa;IACjC,qDAAqD;IACrD,OAAO,CAAC,SAAS,CAAoB;IAErC,yDAAyD;IACzD,OAAO,CAAC,UAAU;gBAON,KAAK,CAAC,EAAE,UAAU,CAAC,YAAY,EAAE,iBAAiB,CAAC;IA6C/D;;;;OAIG;IACH,GAAG,CAAC,KAAK,SAAQ,GAAG,IAAI;IAKxB;;;;;;;;;;OAUG;IAEH,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,QAAQ;CA2BhG"}
1
+ {"version":3,"file":"category-axis.d.ts","sourceRoot":"","sources":["../../src/bar-chart/category-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAA8D,KAAK,OAAO,EAAE,MAAM,eAAe,CAAA;AACxG,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,eAAe,CAAA;AAEtB,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,iFAAiF;IACjF,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,qEAAqE;IACrE,IAAI,EAAE,UAAU,CAAA;IAChB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAKD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAiGvB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,YAAY,CAAC,CAAA"}
@@ -1,12 +1,7 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { command, Node2D, Rect, Text, easeOut, property, insetsOps, textOps, } from "@motionscript/sdk";
1
+ import { Rect, Text, Types, component2d, insetsOps, textOps, } from "@motionscript/sdk";
2
+ import { asParts, fresh } from "../kit/entries.js";
3
+ import { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase } from "../kit/motion.js";
8
4
  import { DEFAULT_X_AXIS, clampUnit, enterBudget, } from "../kit/shared.js";
9
- import { at, compose, hold } from "@motionscript/sdk/component";
10
5
  /** How far a caption starts above its slot when it enters, in px. */
11
6
  const SLIDE = 24;
12
7
  /**
@@ -25,117 +20,100 @@ const SLIDE = 24;
25
20
  * invisible twin of the value axis, as the line chart does), so a caption lands
26
21
  * under the columns it names without either side being told about the other.
27
22
  *
28
- * {@link enter} staggers the captions in left-to-right, each lifted a little
29
- * above its slot and transparent; the resting state is the landed one, so a
30
- * chart that is never told to enter still reads as finished.
23
+ * `enter` staggers the captions in left-to-right, each lifted a little above
24
+ * its slot and transparent; the resting state is the landed one, so a chart
25
+ * that is never told to enter still reads as finished.
31
26
  */
32
- export class CategoryAxis extends Node2D {
33
- /** One caption per category, ordered left → right, for the staggered enter. */
34
- captionNodes = [];
35
- /** The axis title, or null when `label` is empty. */
36
- labelNode = null;
37
- /** Centre x of slot `i`, in the node's centred space. */
38
- slotCenter(index) {
39
- const n = this.categories.length;
40
- if (n <= 0)
41
- return 0;
42
- const width = this.layoutBounds.width;
43
- return -width / 2 + (width / n) * (index + 0.5);
44
- }
45
- constructor(props) {
46
- super(props);
47
- const tickPad = insetsOps.resolve(this.axis.tickPadding).top;
48
- const titlePad = insetsOps.resolve(this.axis.titlePadding).top;
27
+ export const CategoryAxis = component2d({
28
+ key: "categoryAxis",
29
+ state: {
30
+ categories: fresh(() => []),
31
+ axis: Types.custom(DEFAULT_X_AXIS),
32
+ label: "",
33
+ dims: fresh(() => []),
34
+ arrivals: arrivalsEntry(),
35
+ },
36
+ // A plain node filled its parent; one made of its captions would hug them.
37
+ defaults: { width: "fill", height: "fill" },
38
+ children: (state) => {
39
+ const tickPad = insetsOps.resolve(state.axis.tickPadding).top;
40
+ const titlePad = insetsOps.resolve(state.axis.titlePadding).top;
41
+ const column = [];
42
+ // The column's parent is the axis: its box is what the slots divide.
43
+ const width = () => column[0]?.parent?.layoutBounds.width ?? 0;
44
+ /** Centre x of slot `i`, in the node's centred space. */
45
+ const slotCenter = (index) => {
46
+ const n = state.categories.length;
47
+ if (n <= 0)
48
+ return 0;
49
+ return -width() / 2 + (width() / n) * (index + 0.5);
50
+ };
49
51
  // Each caption sits in a hug box carrying the spotlight dim, so the
50
52
  // entrance can animate the text's own opacity without the two fighting over
51
53
  // one value — opacity multiplies down the tree, which is exactly the
52
54
  // composition wanted here.
53
- const slots = this.categories.map((caption, i) => {
54
- const text = new Text({
55
- ...textOps.styleProps(this.axis.labelStyle),
56
- text: caption,
57
- });
58
- this.captionNodes.push(text);
59
- return new Rect({
60
- width: "hug",
61
- height: "hug",
62
- flow: "freeform",
63
- opacity: () => clampUnit(this.dims[i] ?? 1),
64
- x: () => this.slotCenter(i),
65
- children: [text],
66
- });
67
- });
68
- const children = [
69
- new Rect({
70
- width: "fill",
71
- height: "hug",
72
- padding: { top: tickPad },
73
- children: slots,
74
- }),
75
- ];
76
- if (this.label !== "") {
77
- this.labelNode = new Text({
78
- ...textOps.styleProps(this.axis.titleStyle),
79
- text: this.label,
80
- });
81
- children.push(this.labelNode);
55
+ const slots = state.categories.map((caption, i) => new Rect({
56
+ width: "hug",
57
+ height: "hug",
58
+ flow: "freeform",
59
+ opacity: () => clampUnit(state.dims[i] ?? 1),
60
+ x: () => slotCenter(i),
61
+ children: [
62
+ new Text({
63
+ ...textOps.styleProps(state.axis.labelStyle),
64
+ text: caption,
65
+ opacity: () => arrivalOf(state.arrivals, i).opacity,
66
+ y: () => arrivalOf(state.arrivals, i).shift,
67
+ }),
68
+ ],
69
+ }));
70
+ const children = [new Rect({ width: "fill", height: "hug", padding: { top: tickPad }, children: slots })];
71
+ if (state.label !== "") {
72
+ children.push(new Text({
73
+ ...textOps.styleProps(state.axis.titleStyle),
74
+ text: state.label,
75
+ opacity: () => arrivalOf(state.arrivals, "label").opacity,
76
+ y: () => arrivalOf(state.arrivals, "label").shift,
77
+ }));
82
78
  }
83
- this.add(new Rect({ flow: "vertical", gap: titlePad, height: "hug", width: "fill", children }));
84
- }
85
- /**
86
- * Primes every caption (and the title) at its pre-entrance state: lifted above
87
- * its slot and transparent. Idempotent, so the chart can arm its whole
88
- * composition before the first frame is drawn.
89
- */
90
- arm(slide = SLIDE) {
91
- for (const caption of this.captionNodes)
92
- caption.set({ opacity: 0, y: slide });
93
- this.labelNode?.set({ opacity: 0, y: slide });
94
- }
95
- /**
96
- * Slide + fade every caption in from above, staggered left-to-right, then
97
- * bring the title down behind them.
98
- *
99
- * `args.duration` is the **whole** entrance — the stagger and the title are
100
- * carved out of it rather than added on top. See {@link enterBudget}.
101
- *
102
- * `args.data.stagger` is seconds between successive captions (derived when
103
- * omitted); `args.data.slide` is the starting upward offset in px (node space
104
- * is y-up, so a positive start slides *down* into place).
105
- */
106
- enter(args) {
107
- const { stagger, slide = SLIDE } = args.data ?? {};
108
- const easing = args.easing ?? easeOut();
109
- const nodes = this.captionNodes;
110
- if (nodes.length === 0)
111
- return hold(args.duration);
112
- const { step, per, caption } = enterBudget(args.duration, nodes.length, this.labelNode !== null, stagger);
113
- this.arm(slide);
114
- // The stagger was `wait(i * step)` inside a generator, so its offsets only
115
- // existed while it ran. They were always `i * step`; placed, the same
116
- // entrance can be asked what it looks like partway through.
117
- const lastCaptionEnds = (nodes.length - 1) * step + per;
118
- return compose([
119
- ...nodes.map((node, i) => at(i * step, node.to({ data: { opacity: 1, y: 0 }, duration: per, easing }))),
120
- ...(this.labelNode
121
- ? [at(lastCaptionEnds, this.labelNode.to({ data: { opacity: 1, y: 0 }, duration: caption, easing }))]
122
- : []),
123
- ]);
124
- }
125
- }
126
- __decorate([
127
- property({ default: () => [] })
128
- ], CategoryAxis.prototype, "categories", void 0);
129
- __decorate([
130
- property({ default: DEFAULT_X_AXIS })
131
- ], CategoryAxis.prototype, "axis", void 0);
132
- __decorate([
133
- property({ default: "" })
134
- ], CategoryAxis.prototype, "label", void 0);
135
- __decorate([
136
- property({ default: () => [] })
137
- ], CategoryAxis.prototype, "dims", void 0);
138
- __decorate([
139
- command()
140
- ], CategoryAxis.prototype, "enter", null);
79
+ column.push(new Rect({ flow: "vertical", gap: titlePad, height: "hug", width: "fill", children }));
80
+ return asParts(column);
81
+ },
82
+ commands: {
83
+ /**
84
+ * Slide + fade every caption in from above, staggered left-to-right, then
85
+ * bring the title down behind them. Its first frame arms them all: lifted
86
+ * by `slide` and transparent.
87
+ *
88
+ * The timeline's duration is the **whole** entrance — the stagger and the
89
+ * title are carved out of it rather than added on top. See {@link enterBudget}.
90
+ *
91
+ * `stagger` is seconds between successive captions (derived when omitted);
92
+ * `slide` is the starting upward offset in px (node space is y-up, so a
93
+ * positive start slides *down* into place).
94
+ */
95
+ enter: {
96
+ args: {
97
+ stagger: Types.custom(undefined),
98
+ slide: Types.number(SLIDE),
99
+ },
100
+ run: (timeline, state) => {
101
+ const { stagger, slide } = timeline.args;
102
+ const count = state.categories.length;
103
+ const captioned = state.label !== "";
104
+ const from = { opacity: 0, shift: slide };
105
+ const keys = [...state.categories.keys(), ...(captioned ? ["label"] : [])];
106
+ const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }));
107
+ if (count === 0)
108
+ return arm;
109
+ const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger);
110
+ const ease = frameEase(timeline);
111
+ const lastCaptionEnds = (count - 1) * step + per;
112
+ const captions = state.categories.map((_, i) => ({ at: i * step, duration: per, piece: arrival(timeline, i, from, ease) }));
113
+ const label = captioned ? [{ at: lastCaptionEnds, duration: caption, piece: arrival(timeline, "label", from, ease) }] : [];
114
+ return timeline.together([arm, beats(timeline, [...captions, ...label])]);
115
+ },
116
+ },
117
+ },
118
+ });
141
119
  //# sourceMappingURL=category-axis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"category-axis.js","sourceRo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AAC,EAAE,EAAE,CACvB,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,CAC7E;YACD,GAAG,CAAC,IAAI,CAAC,SAAS;gBAChB,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;gBACrG,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAA;IACJ,CAAC;CACF;AAhHsD;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAc,EAAE,CAAC;gDAA6B;AAC1B;IAA9C,QAAQ,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;0CAAyB;AAC5B;IAAlC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;2CAAsB;AACK;IAApD,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAc,EAAE,CAAC;0CAAuB;AAkFnE;IADC,OAAO,EAAE;yCA2BT","sourcesContent":["import {\r\n command,\r\n Node2D,\r\n Rect,\r\n Text,\r\n easeOut,\r\n property,\r\n insetsOps,\r\n textOps,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport {\r\n DEFAULT_X_AXIS,\r\n clampUnit,\r\n enterBudget,\r\n type AxisConfig,\r\n} from \"../kit/shared\"\r\nimport { at, compose, hold, type Seekable } from \"@motionscript/sdk/component\"\r\n\r\nexport interface CategoryAxisProps extends Node2DProps {\r\n /** One caption per category slot, left to right — the chart's rows, in order. */\r\n categories: string[]\r\n /** Caption/title text style and gutters — see {@link AxisConfig}. */\r\n axis: AxisConfig\r\n /**\r\n * Caption drawn centred in the gutter beneath the category row. Empty string\r\n * (the default) hides it.\r\n */\r\n label: string\r\n /**\r\n * Per-category opacity multiplier — how the chart's category spotlight reaches\r\n * the captions, so the name under a dimmed column dims with it. Missing\r\n * entries read as 1.\r\n */\r\n dims: number[]\r\n}\r\n\r\n/** How far a caption starts above its slot when it enters, in px. */\r\nconst SLIDE = 24\r\n\r\n/**\r\n * The **categorical** horizontal axis of a {@link BarChart}: a row of\r\n * {@link Text} captions, one per row of the data, each centred on its slot\r\n * beneath the baseline.\r\n *\r\n * Not a variant of the line chart's `HorizontalAxis` and deliberately not\r\n * folded into it: that axis places markers by *value* across a numeric range,\r\n * this one divides its width into equal slots and centres a name in each. The\r\n * two look alike on screen and share nothing underneath — one reads a scale,\r\n * the other counts rows.\r\n *\r\n * The slot arithmetic is the same as the plot's, because this node is laid out\r\n * to exactly the plot's width (the chart reserves the axis gutter with an\r\n * invisible twin of the value axis, as the line chart does), so a caption lands\r\n * under the columns it names without either side being told about the other.\r\n *\r\n * {@link enter} staggers the captions in left-to-right, each lifted a little\r\n * above its slot and transparent; the resting state is the landed one, so a\r\n * chart that is never told to enter still reads as finished.\r\n */\r\nexport class CategoryAxis extends Node2D<CategoryAxisProps> {\r\n @property({ default: () => [] as string[] }) declare categories: string[]\r\n @property({ default: DEFAULT_X_AXIS }) declare axis: AxisConfig\r\n @property({ default: \"\" }) declare label: string\r\n @property({ default: () => [] as number[] }) declare dims: number[]\r\n\r\n /** One caption per category, ordered left → right, for the staggered enter. */\r\n private captionNodes: Text[] = []\r\n /** The axis title, or null when `label` is empty. */\r\n private labelNode: Text | null = null\r\n\r\n /** Centre x of slot `i`, in the node's centred space. */\r\n private slotCenter(index: number): number {\r\n const n = this.categories.length\r\n if (n <= 0) return 0\r\n const width = this.layoutBounds.width\r\n return -width / 2 + (width / n) * (index + 0.5)\r\n }\r\n\r\n constructor(props?: NodeConfig<CategoryAxis, CategoryAxisProps>) {\r\n super(props)\r\n\r\n const tickPad = insetsOps.resolve(this.axis.tickPadding).top\r\n const titlePad = insetsOps.resolve(this.axis.titlePadding).top\r\n\r\n // Each caption sits in a hug box carrying the spotlight dim, so the\r\n // entrance can animate the text's own opacity without the two fighting over\r\n // one value — opacity multiplies down the tree, which is exactly the\r\n // composition wanted here.\r\n const slots = this.categories.map((caption, i) => {\r\n const text = new Text({\r\n ...textOps.styleProps(this.axis.labelStyle),\r\n text: caption,\r\n })\r\n this.captionNodes.push(text)\r\n return new Rect({\r\n width: \"hug\",\r\n height: \"hug\",\r\n flow: \"freeform\",\r\n opacity: () => clampUnit(this.dims[i] ?? 1),\r\n x: () => this.slotCenter(i),\r\n children: [text],\r\n })\r\n })\r\n\r\n const children: Node2D[] = [\r\n new Rect({\r\n width: \"fill\",\r\n height: \"hug\",\r\n padding: { top: tickPad },\r\n children: slots,\r\n }),\r\n ]\r\n if (this.label !== \"\") {\r\n this.labelNode = new Text({\r\n ...textOps.styleProps(this.axis.titleStyle),\r\n text: this.label,\r\n })\r\n children.push(this.labelNode)\r\n }\r\n\r\n this.add(new Rect({ flow: \"vertical\", gap: titlePad, height: \"hug\", width: \"fill\", children }))\r\n }\r\n\r\n /**\r\n * Primes every caption (and the title) at its pre-entrance state: lifted above\r\n * its slot and transparent. Idempotent, so the chart can arm its whole\r\n * composition before the first frame is drawn.\r\n */\r\n arm(slide = SLIDE): void {\r\n for (const caption of this.captionNodes) caption.set({ opacity: 0, y: slide })\r\n this.labelNode?.set({ opacity: 0, y: slide })\r\n }\r\n\r\n /**\r\n * Slide + fade every caption in from above, staggered left-to-right, then\r\n * bring the title down behind them.\r\n *\r\n * `args.duration` is the **whole** entrance — the stagger and the title are\r\n * carved out of it rather than added on top. See {@link enterBudget}.\r\n *\r\n * `args.data.stagger` is seconds between successive captions (derived when\r\n * omitted); `args.data.slide` is the starting upward offset in px (node space\r\n * is y-up, so a positive start slides *down* into place).\r\n */\r\n @command()\r\n enter(args: CommandArgs<{ stagger?: number; slide?: number }> & { duration: number }): Seekable {\r\n const { stagger, slide = SLIDE } = args.data ?? {}\r\n const easing = args.easing ?? easeOut()\r\n const nodes = this.captionNodes\r\n if (nodes.length === 0) return hold(args.duration)\r\n const { step, per, caption } = enterBudget(\r\n args.duration,\r\n nodes.length,\r\n this.labelNode !== null,\r\n stagger\r\n )\r\n\r\n this.arm(slide)\r\n\r\n // The stagger was `wait(i * step)` inside a generator, so its offsets only\r\n // existed while it ran. They were always `i * step`; placed, the same\r\n // entrance can be asked what it looks like partway through.\r\n const lastCaptionEnds = (nodes.length - 1) * step + per\r\n return compose([\r\n ...nodes.map((node, i) =>\r\n at(i * step, node.to({ data: { opacity: 1, y: 0 }, duration: per, easing }))\r\n ),\r\n ...(this.labelNode\r\n ? [at(lastCaptionEnds, this.labelNode.to({ data: { opacity: 1, y: 0 }, duration: caption, easing }))]\r\n : []),\r\n ])\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"category-axis.js","sourceRoot":"","sources":["../../src/bar-chart/category-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,OAAO,GAIR,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAgB,MAAM,eAAe,CAAA;AACxG,OAAO,EACL,cAAc,EACd,SAAS,EACT,WAAW,GAEZ,MAAM,eAAe,CAAA;AAoBtB,qEAAqE;AACrE,MAAM,KAAK,GAAG,EAAE,CAAA;AAEhB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;IACtC,GAAG,EAAE,cAAc;IACnB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,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;gBACxF,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;gBAChC,MAAM,eAAe,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAA;gBAChD,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;gBAC3H,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;gBAC1H,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC3E,CAAC;SACF;KACF;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Rect,\r\n Text,\r\n Types,\r\n component2d,\r\n insetsOps,\r\n textOps,\r\n type NodeOf,\r\n type Node2D,\r\n type Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { asParts, fresh } from \"../kit/entries\"\r\nimport { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase, type Arrival } from \"../kit/motion\"\r\nimport {\r\n DEFAULT_X_AXIS,\r\n clampUnit,\r\n enterBudget,\r\n type AxisConfig,\r\n} from \"../kit/shared\"\r\n\r\nexport interface CategoryAxisProps extends Node2DProps {\r\n /** One caption per category slot, left to right — the chart's rows, in order. */\r\n categories: string[]\r\n /** Caption/title text style and gutters — see {@link AxisConfig}. */\r\n axis: AxisConfig\r\n /**\r\n * Caption drawn centred in the gutter beneath the category row. Empty string\r\n * (the default) hides it.\r\n */\r\n label: string\r\n /**\r\n * Per-category opacity multiplier — how the chart's category spotlight reaches\r\n * the captions, so the name under a dimmed column dims with it. Missing\r\n * entries read as 1.\r\n */\r\n dims: number[]\r\n}\r\n\r\n/** How far a caption starts above its slot when it enters, in px. */\r\nconst SLIDE = 24\r\n\r\n/**\r\n * The **categorical** horizontal axis of a {@link BarChart}: a row of\r\n * {@link Text} captions, one per row of the data, each centred on its slot\r\n * beneath the baseline.\r\n *\r\n * Not a variant of the line chart's `HorizontalAxis` and deliberately not\r\n * folded into it: that axis places markers by *value* across a numeric range,\r\n * this one divides its width into equal slots and centres a name in each. The\r\n * two look alike on screen and share nothing underneath — one reads a scale,\r\n * the other counts rows.\r\n *\r\n * The slot arithmetic is the same as the plot's, because this node is laid out\r\n * to exactly the plot's width (the chart reserves the axis gutter with an\r\n * invisible twin of the value axis, as the line chart does), so a caption lands\r\n * under the columns it names without either side being told about the other.\r\n *\r\n * `enter` staggers the captions in left-to-right, each lifted a little above\r\n * its slot and transparent; the resting state is the landed one, so a chart\r\n * that is never told to enter still reads as finished.\r\n */\r\nexport const CategoryAxis = component2d({\r\n key: \"categoryAxis\",\r\n state: {\r\n categories: fresh<string[]>(() => []),\r\n axis: Types.custom<AxisConfig>(DEFAULT_X_AXIS),\r\n label: \"\",\r\n dims: fresh<number[]>(() => []),\r\n arrivals: arrivalsEntry(),\r\n },\r\n // A plain node filled its parent; one made of its captions would hug them.\r\n defaults: { width: \"fill\", height: \"fill\" },\r\n children: (state) => {\r\n const tickPad = insetsOps.resolve(state.axis.tickPadding).top\r\n const titlePad = insetsOps.resolve(state.axis.titlePadding).top\r\n\r\n const column: Node2D[] = []\r\n // The column's parent is the axis: its box is what the slots divide.\r\n const width = () => (column[0]?.parent as Node2D | null | undefined)?.layoutBounds.width ?? 0\r\n /** Centre x of slot `i`, in the node's centred space. */\r\n const slotCenter = (index: number) => {\r\n const n = state.categories.length\r\n if (n <= 0) return 0\r\n return -width() / 2 + (width() / n) * (index + 0.5)\r\n }\r\n\r\n // Each caption sits in a hug box carrying the spotlight dim, so the\r\n // entrance can animate the text's own opacity without the two fighting over\r\n // one value — opacity multiplies down the tree, which is exactly the\r\n // composition wanted here.\r\n const slots = state.categories.map((caption, i) =>\r\n new Rect({\r\n width: \"hug\",\r\n height: \"hug\",\r\n flow: \"freeform\",\r\n opacity: () => clampUnit(state.dims[i] ?? 1),\r\n x: () => slotCenter(i),\r\n children: [\r\n new Text({\r\n ...textOps.styleProps(state.axis.labelStyle),\r\n text: caption,\r\n opacity: () => arrivalOf(state.arrivals, i).opacity,\r\n y: () => arrivalOf(state.arrivals, i).shift,\r\n }),\r\n ],\r\n })\r\n )\r\n\r\n const children: Node2D[] = [new Rect({ width: \"fill\", height: \"hug\", padding: { top: tickPad }, children: slots })]\r\n if (state.label !== \"\") {\r\n children.push(\r\n new Text({\r\n ...textOps.styleProps(state.axis.titleStyle),\r\n text: state.label,\r\n opacity: () => arrivalOf(state.arrivals, \"label\").opacity,\r\n y: () => arrivalOf(state.arrivals, \"label\").shift,\r\n })\r\n )\r\n }\r\n\r\n column.push(new Rect({ flow: \"vertical\", gap: titlePad, height: \"hug\", width: \"fill\", children }))\r\n return asParts(column)\r\n },\r\n commands: {\r\n /**\r\n * Slide + fade every caption in from above, staggered left-to-right, then\r\n * bring the title down behind them. Its first frame arms them all: lifted\r\n * by `slide` and transparent.\r\n *\r\n * The timeline's duration is the **whole** entrance — the stagger and the\r\n * title are carved out of it rather than added on top. See {@link enterBudget}.\r\n *\r\n * `stagger` is seconds between successive captions (derived when omitted);\r\n * `slide` is the starting upward offset in px (node space is y-up, so a\r\n * positive start slides *down* into place).\r\n */\r\n enter: {\r\n args: {\r\n stagger: Types.custom<number | undefined>(undefined),\r\n slide: Types.number(SLIDE),\r\n },\r\n run: (timeline, state) => {\r\n const { stagger, slide } = timeline.args\r\n const count = state.categories.length\r\n const captioned = state.label !== \"\"\r\n const from: Arrival = { opacity: 0, shift: slide }\r\n const keys = [...state.categories.keys(), ...(captioned ? [\"label\"] : [])]\r\n const arm = timeline.animate(() => ({ arrivals: armed(keys, from) }))\r\n if (count === 0) return arm\r\n const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger)\r\n const ease = frameEase(timeline)\r\n const lastCaptionEnds = (count - 1) * step + per\r\n const captions = state.categories.map((_, i) => ({ at: i * step, duration: per, piece: arrival(timeline, i, from, ease) }))\r\n const label = captioned ? [{ at: lastCaptionEnds, duration: caption, piece: arrival(timeline, \"label\", from, ease) }] : []\r\n return timeline.together([arm, beats(timeline, [...captions, ...label])])\r\n },\r\n },\r\n },\r\n})\r\n\r\nexport type CategoryAxis = NodeOf<typeof CategoryAxis>\r\n"]}