@motionscript/charts 0.1.0-alpha.9 → 0.1.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/bar-chart/bar-chart.d.ts +22 -93
  3. package/dist/bar-chart/bar-chart.d.ts.map +1 -1
  4. package/dist/bar-chart/bar-chart.js +48 -121
  5. package/dist/bar-chart/bar-chart.js.map +1 -1
  6. package/dist/bar-chart/category-axis.d.ts +11 -38
  7. package/dist/bar-chart/category-axis.d.ts.map +1 -1
  8. package/dist/bar-chart/category-axis.js +15 -38
  9. package/dist/bar-chart/category-axis.js.map +1 -1
  10. package/dist/bar-chart/chart-bars.d.ts +43 -74
  11. package/dist/bar-chart/chart-bars.d.ts.map +1 -1
  12. package/dist/bar-chart/chart-bars.js +31 -59
  13. package/dist/bar-chart/chart-bars.js.map +1 -1
  14. package/dist/bar-chart/index.d.ts +2 -10
  15. package/dist/bar-chart/index.d.ts.map +1 -1
  16. package/dist/bar-chart/index.js +0 -7
  17. package/dist/bar-chart/index.js.map +1 -1
  18. package/dist/bar-chart/shared.d.ts +27 -90
  19. package/dist/bar-chart/shared.d.ts.map +1 -1
  20. package/dist/bar-chart/shared.js +15 -54
  21. package/dist/bar-chart/shared.js.map +1 -1
  22. package/dist/browser/chunks/chunk-4SMRCU24.js +2 -0
  23. package/dist/browser/chunks/chunk-4SMRCU24.js.map +7 -0
  24. package/dist/browser/index.js +1 -1
  25. package/dist/browser/index.js.map +3 -3
  26. package/dist/browser/kit.js +1 -1
  27. package/dist/browser/manifest.json +1 -1
  28. package/dist/engine.d.ts +4 -16
  29. package/dist/engine.d.ts.map +1 -1
  30. package/dist/engine.js +4 -16
  31. package/dist/engine.js.map +1 -1
  32. package/dist/kit/cartesian.d.ts +8 -28
  33. package/dist/kit/cartesian.d.ts.map +1 -1
  34. package/dist/kit/cartesian.js +7 -19
  35. package/dist/kit/cartesian.js.map +1 -1
  36. package/dist/kit/chart-border.d.ts +9 -18
  37. package/dist/kit/chart-border.d.ts.map +1 -1
  38. package/dist/kit/chart-border.js +4 -9
  39. package/dist/kit/chart-border.js.map +1 -1
  40. package/dist/kit/chart-canvas.d.ts +25 -36
  41. package/dist/kit/chart-canvas.d.ts.map +1 -1
  42. package/dist/kit/chart-canvas.js +13 -13
  43. package/dist/kit/chart-canvas.js.map +1 -1
  44. package/dist/kit/chart-legend.d.ts +14 -61
  45. package/dist/kit/chart-legend.d.ts.map +1 -1
  46. package/dist/kit/chart-legend.js +17 -65
  47. package/dist/kit/chart-legend.js.map +1 -1
  48. package/dist/kit/entries.d.ts +2 -0
  49. package/dist/kit/entries.d.ts.map +1 -1
  50. package/dist/kit/entries.js +2 -0
  51. package/dist/kit/entries.js.map +1 -1
  52. package/dist/kit/motion.d.ts +11 -3
  53. package/dist/kit/motion.d.ts.map +1 -1
  54. package/dist/kit/motion.js +7 -1
  55. package/dist/kit/motion.js.map +1 -1
  56. package/dist/kit/shared.d.ts +60 -175
  57. package/dist/kit/shared.d.ts.map +1 -1
  58. package/dist/kit/shared.js +40 -157
  59. package/dist/kit/shared.js.map +1 -1
  60. package/dist/kit/vertical-axis.d.ts +16 -45
  61. package/dist/kit/vertical-axis.d.ts.map +1 -1
  62. package/dist/kit/vertical-axis.js +17 -42
  63. package/dist/kit/vertical-axis.js.map +1 -1
  64. package/dist/line-chart/chart-line.d.ts +16 -41
  65. package/dist/line-chart/chart-line.d.ts.map +1 -1
  66. package/dist/line-chart/chart-line.js +14 -43
  67. package/dist/line-chart/chart-line.js.map +1 -1
  68. package/dist/line-chart/chart-region.d.ts +14 -27
  69. package/dist/line-chart/chart-region.d.ts.map +1 -1
  70. package/dist/line-chart/chart-region.js +8 -22
  71. package/dist/line-chart/chart-region.js.map +1 -1
  72. package/dist/line-chart/horizontal-axis.d.ts +16 -43
  73. package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
  74. package/dist/line-chart/horizontal-axis.js +13 -42
  75. package/dist/line-chart/horizontal-axis.js.map +1 -1
  76. package/dist/line-chart/index.d.ts +1 -13
  77. package/dist/line-chart/index.d.ts.map +1 -1
  78. package/dist/line-chart/index.js +0 -12
  79. package/dist/line-chart/index.js.map +1 -1
  80. package/dist/line-chart/line-chart.d.ts +23 -109
  81. package/dist/line-chart/line-chart.d.ts.map +1 -1
  82. package/dist/line-chart/line-chart.js +45 -141
  83. package/dist/line-chart/line-chart.js.map +1 -1
  84. package/dist/line-chart/shared.d.ts +33 -107
  85. package/dist/line-chart/shared.d.ts.map +1 -1
  86. package/dist/line-chart/shared.js +28 -81
  87. package/dist/line-chart/shared.js.map +1 -1
  88. package/dist/line-chart/x-scale.d.ts +14 -55
  89. package/dist/line-chart/x-scale.d.ts.map +1 -1
  90. package/dist/line-chart/x-scale.js +29 -111
  91. package/dist/line-chart/x-scale.js.map +1 -1
  92. package/dist/nodes.d.ts +0 -12
  93. package/dist/nodes.d.ts.map +1 -1
  94. package/dist/nodes.js +0 -12
  95. package/dist/nodes.js.map +1 -1
  96. package/dist/pie-chart/index.d.ts +1 -12
  97. package/dist/pie-chart/index.d.ts.map +1 -1
  98. package/dist/pie-chart/index.js +0 -9
  99. package/dist/pie-chart/index.js.map +1 -1
  100. package/dist/pie-chart/pie-chart.d.ts +37 -71
  101. package/dist/pie-chart/pie-chart.d.ts.map +1 -1
  102. package/dist/pie-chart/pie-chart.js +31 -65
  103. package/dist/pie-chart/pie-chart.js.map +1 -1
  104. package/dist/pie-chart/pie-legend.d.ts +11 -26
  105. package/dist/pie-chart/pie-legend.d.ts.map +1 -1
  106. package/dist/pie-chart/pie-legend.js +14 -39
  107. package/dist/pie-chart/pie-legend.js.map +1 -1
  108. package/dist/pie-chart/pie-ring.d.ts +50 -192
  109. package/dist/pie-chart/pie-ring.d.ts.map +1 -1
  110. package/dist/pie-chart/pie-ring.js +75 -247
  111. package/dist/pie-chart/pie-ring.js.map +1 -1
  112. package/dist/pie-chart/shared.d.ts +45 -131
  113. package/dist/pie-chart/shared.d.ts.map +1 -1
  114. package/dist/pie-chart/shared.js +29 -72
  115. package/dist/pie-chart/shared.js.map +1 -1
  116. package/package.json +4 -4
  117. package/src/bar-chart/bar-chart.ts +51 -165
  118. package/src/bar-chart/category-axis.ts +16 -57
  119. package/src/bar-chart/chart-bars.ts +43 -120
  120. package/src/bar-chart/index.ts +2 -10
  121. package/src/bar-chart/shared.ts +29 -97
  122. package/src/engine.ts +4 -16
  123. package/src/kit/cartesian.ts +11 -26
  124. package/src/kit/chart-border.ts +6 -20
  125. package/src/kit/chart-canvas.ts +15 -40
  126. package/src/kit/chart-legend.ts +17 -86
  127. package/src/kit/entries.ts +4 -1
  128. package/src/kit/motion.ts +11 -2
  129. package/src/kit/shared.ts +58 -219
  130. package/src/kit/vertical-axis.ts +18 -71
  131. package/src/line-chart/chart-line.ts +16 -44
  132. package/src/line-chart/chart-region.ts +10 -23
  133. package/src/line-chart/horizontal-axis.ts +13 -42
  134. package/src/line-chart/index.ts +1 -13
  135. package/src/line-chart/line-chart.ts +50 -184
  136. package/src/line-chart/shared.ts +51 -145
  137. package/src/line-chart/x-scale.ts +31 -121
  138. package/src/nodes.ts +0 -12
  139. package/src/pie-chart/index.ts +1 -12
  140. package/src/pie-chart/pie-chart.ts +34 -102
  141. package/src/pie-chart/pie-legend.ts +14 -55
  142. package/src/pie-chart/pie-ring.ts +80 -307
  143. package/src/pie-chart/shared.ts +50 -139
  144. package/dist/browser/chunks/chunk-TJNHLQGV.js +0 -2
  145. package/dist/browser/chunks/chunk-TJNHLQGV.js.map +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @motionscript/charts
2
2
 
3
+ ## 0.1.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - e279864: **Breaking:** the component kits drop exports nothing used.
8
+
9
+ - **math:** the hand-mirrored `*Props` interfaces of 24 components (`AngleMarkProps`, `CurlyBraceProps`, `EmphasisMarkProps`, `CurveAreaProps`, `DropLinesProps`, `PlotPointProps`, `RiemannSumProps`, `TangentLineProps`, `VectorArrowProps`, `PointsPlotProps`, `StreamLinesProps`, `TracedPathProps`, `VectorFieldProps`, `NetworkGraphProps`, `SampleSpaceProps`, `NumberLineProps`, `NumberPlaneProps`, `PolarPlaneProps`, `LatexMatrixProps`, `Axes3dProps`, `CurvePlot3dProps`, `PlotPoint3dProps`, `SurfacePlot3dProps`, `VectorArrow3dProps`), `FILL_PAINT`, `STROKE_PAINT`, `OUTLINE_TRIM` and `spaceOf` from `./kit`, and `LatexPathResult.commands`.
10
+ - **charts:** `LineChartProps`, `BarChartProps`, `PieChartProps`, `PieRingProps`, `PieLegendProps`, `ChartBarsProps`, `CategoryAxisProps`, `ChartBorderProps`, `ChartCanvasProps`, `ChartLegendProps`, `VerticalAxisProps`, and from `./kit` `axisTweenTarget`, `resolvePalettePaint`, `legendShows`, `MarkerLabel`, `clampUnit` (use the SDK's `clamp`). `niceStep` and `enterBudget` stay reachable from `@motionscript/sdk/component`.
11
+ - **audio:** `FullWaveformProps`, `LiveWaveformProps`, and `clamp01` from `./kit`.
12
+ - **patterns:** `DotGridPatternProps`, `GridPatternProps`, `LineGridPatternProps`.
13
+ - **code:** `DEFAULT_THEMES`, `splitTokensAt`, `LINE_ALIGN_CELLS`, `EDIT_ALIGN_CELLS`, and `phasesFor` (use `defaultCodePhases`). `ensureHighlighter`, `loadCodeLanguage`, `initSyntaxHighlighter` and `canHighlight` lose their ignored theme argument.
14
+ - **grids:** the `findNode2D` and `frameIn` re-exports (import them from `@motionscript/sdk`), `ArrangementKind`, `PathGridShape`, `RectangularGridProps`, `RadialGridProps`, `PathGridProps`, `SphereGridProps`.
15
+ - **geography:** `GeoBorderProps`.
16
+
17
+ Migration: no stored document is affected; only TypeScript imports change. Code that imported a removed `*Props` interface states the props it passes inline, and code that used a removed helper uses the replacement named beside it above.
18
+
19
+ - Updated dependencies [e279864]
20
+ - @motionscript/sdk@0.1.1-alpha.0
21
+
22
+ ## 0.1.0
23
+
24
+ ## 0.1.0-alpha.10
25
+
3
26
  ## 0.1.0-alpha.9
4
27
 
5
28
  ## 0.1.0-alpha.8
@@ -1,38 +1,6 @@
1
- import { type DataRecord, type NodeOf, type Node2D, type Node2DProps } from "@motionscript/sdk";
2
- import { type AxisDomainConfig, type Range } from "../kit/shared.js";
1
+ import { type DataRecord, type NodeOf, type Node2D, type Node2DProps as _Node2DProps } from "@motionscript/sdk";
2
+ import { type AxisDomainConfig, type ResolvedAxisDomain } from "../kit/shared.js";
3
3
  import { type BarChartConfig, type BarChartTheme, type BarSeries } from "./shared.js";
4
- export interface BarChartProps extends Node2DProps {
5
- /** One row per category — a plain record of field name to value. */
6
- data: DataRecord[];
7
- /**
8
- * Key into each row for its category caption, drawn beneath the baseline.
9
- * Named `categoryField` rather than `category` for the same reason the line
10
- * chart's is `xField`: it names a *column*, not a value.
11
- */
12
- categoryField: string;
13
- /** One entry per bar series: which column it plots, its `label`, its `fill`. */
14
- series: BarSeries[];
15
- /**
16
- * When `true` every category's series stack into one column; when `false`
17
- * (the default) each series gets its own bar, grouped side by side within the
18
- * category's slot.
19
- */
20
- stacked?: boolean;
21
- /** The value axis's domain: caption, scale range, and tick placement. */
22
- valueAxis?: AxisDomainConfig;
23
- /** The category axis's domain. Only its `label` is read — the slots are the rows. */
24
- categoryAxis?: AxisDomainConfig;
25
- /**
26
- * The chart's visual theme — bar palette and geometry, axis furniture, plot
27
- * panel paint, legend, value figures. Every branch is optional and deep-merged
28
- * onto {@link DEFAULT_BAR_CHART_THEME}.
29
- */
30
- theme?: BarChartTheme;
31
- /** Whether the legend row below the plot is drawn at all. */
32
- showLegend?: boolean;
33
- /** Whether each column prints the figure it plots. */
34
- showValues?: boolean;
35
- }
36
4
  /** What a bar chart plots, as its entries hold it. */
37
5
  export interface BarChartValues {
38
6
  readonly data: DataRecord[];
@@ -41,33 +9,18 @@ export interface BarChartValues {
41
9
  readonly valueAxis: AxisDomainConfig;
42
10
  }
43
11
  /** The value axis's domain with its range and ticks resolved. */
44
- export type BarChartDomain = AxisDomainConfig & {
45
- readonly range: Range;
46
- readonly ticks: number[];
47
- };
48
- /** The value axis as a bar chart draws it now, an auto range or tick row read back as itself. */
12
+ export type BarChartDomain = ResolvedAxisDomain;
13
+ /** The value axis as drawn now. */
49
14
  export declare function barChartDomain(s: BarChartValues): BarChartDomain;
50
15
  /**
51
- * A grouped or stacked bar chart, the sibling of the line chart and built the
52
- * same way, out of several of the same pieces:
53
- *
54
- * - `ChartCanvas` — the plot panel with a horizontal grid, under everything.
55
- * - `VerticalAxis` — the numeric value markers, staggering in bottom-to-top.
56
- * - {@link CategoryAxis} — the row of names beneath the baseline, one per row.
57
- * - {@link ChartBars} (one per series) — that series' column in every category,
58
- * plus the figures printed on them.
59
- * - `ChartLegend` — a row of entries below the chart, one per series.
60
- *
61
- * Every part reads the chart's entries through bindings, and the columns map
62
- * across the plot panel's own laid-out box, so a column's end lands exactly on
63
- * its marker. **Zero is always on the scale**, and the columns grow about it, so
64
- * a negative value draws downward out of the same `growth` signal.
16
+ * A grouped or stacked bar chart, built like the line chart from `ChartCanvas`,
17
+ * `VerticalAxis`, {@link CategoryAxis}, one {@link ChartBars} per series and
18
+ * `ChartLegend`. Zero is always on the scale and columns grow about it, so a
19
+ * negative value draws downward from the same `growth` signal.
65
20
  *
66
- * **Resting state is the finished chart**; `enter` arms every part on its first
67
- * frame. `showSeries`/`hideSeries`/`spotlightSeries` pick out a *series* (hiding
68
- * one reflows the group), `spotlightCategory`/`clearCategory` a *column of the
69
- * table*. A `to` of the value axis's `range` or `ticks` tweens from the domain
70
- * as drawn, so an auto axis rescales the columns continuously.
21
+ * Resting state is the finished chart; `enter` arms every part on its first
22
+ * frame. A `to` of the value axis's `range` or `ticks` tweens from the domain as
23
+ * drawn, so an auto axis rescales the columns continuously.
71
24
  */
72
25
  export declare const BarChart: import("@motionscript/sdk").Component<"barChart", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
73
26
  readonly data: import("@motionscript/sdk").Type<DataRecord[], DataRecord[], false>;
@@ -77,20 +30,12 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
77
30
  readonly valueAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
78
31
  readonly categoryAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
79
32
  readonly theme: import("@motionscript/sdk").Type<BarChartTheme, BarChartConfig, false>;
80
- /**
81
- * Global rise of every column in `[0, 1]`, measured about the baseline: 0
82
- * collapses them all onto it, 1 draws them at full length.
83
- */
33
+ /** Rise of every column about the baseline, `[0, 1]`: 0 collapses them onto it. */
84
34
  readonly growth: 1;
85
- /**
86
- * How much of the slot each series claims, one entry per series: a weight
87
- * rather than a switch, so hiding one is the others widening into the space.
88
- * Seeded from each series' `enabled`.
89
- */
35
+ /** Each series' share of the slot, seeded from `enabled`: a weight rather than a switch, so hiding one widens the others. */
90
36
  readonly weights: import("@motionscript/sdk").Type<number[], number[], false>;
91
- /** The category spotlit, or `null` for none. The choice snaps; `spotlightReveal` is the animation. */
37
+ /** The category spotlit, or `null`. The choice snaps; `spotlightReveal` animates it. */
92
38
  readonly spotlight: import("@motionscript/sdk").Type<number | null, number | null, false>;
93
- /** How far the category spotlight is drawn in, `[0, 1]`. */
94
39
  readonly spotlightReveal: 0;
95
40
  /** Read as the chart is built: the legend is a part the chart builds or doesn't. */
96
41
  readonly showLegend: import("@motionscript/sdk").Type<boolean, boolean, false>;
@@ -113,7 +58,7 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
113
58
  readonly categoryIndex: import("@motionscript/sdk").Type<number, number, false>;
114
59
  };
115
60
  readonly clearCategory: {};
116
- }, readonly [], Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
61
+ }, readonly [], Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
117
62
  readonly data: import("@motionscript/sdk").Type<DataRecord[], DataRecord[], false>;
118
63
  readonly categoryField: "";
119
64
  readonly series: import("@motionscript/sdk").Type<import("../index.js").ChartSeries[], import("../index.js").ChartSeries[], false>;
@@ -121,20 +66,12 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
121
66
  readonly valueAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
122
67
  readonly categoryAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
123
68
  readonly theme: import("@motionscript/sdk").Type<BarChartTheme, BarChartConfig, false>;
124
- /**
125
- * Global rise of every column in `[0, 1]`, measured about the baseline: 0
126
- * collapses them all onto it, 1 draws them at full length.
127
- */
69
+ /** Rise of every column about the baseline, `[0, 1]`: 0 collapses them onto it. */
128
70
  readonly growth: 1;
129
- /**
130
- * How much of the slot each series claims, one entry per series: a weight
131
- * rather than a switch, so hiding one is the others widening into the space.
132
- * Seeded from each series' `enabled`.
133
- */
71
+ /** Each series' share of the slot, seeded from `enabled`: a weight rather than a switch, so hiding one widens the others. */
134
72
  readonly weights: import("@motionscript/sdk").Type<number[], number[], false>;
135
- /** The category spotlit, or `null` for none. The choice snaps; `spotlightReveal` is the animation. */
73
+ /** The category spotlit, or `null`. The choice snaps; `spotlightReveal` animates it. */
136
74
  readonly spotlight: import("@motionscript/sdk").Type<number | null, number | null, false>;
137
- /** How far the category spotlight is drawn in, `[0, 1]`. */
138
75
  readonly spotlightReveal: 0;
139
76
  /** Read as the chart is built: the legend is a part the chart builds or doesn't. */
140
77
  readonly showLegend: import("@motionscript/sdk").Type<boolean, boolean, false>;
@@ -150,20 +87,12 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
150
87
  readonly valueAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
151
88
  readonly categoryAxis: import("@motionscript/sdk").Type<AxisDomainConfig, AxisDomainConfig, false>;
152
89
  readonly theme: import("@motionscript/sdk").Type<BarChartTheme, BarChartConfig, false>;
153
- /**
154
- * Global rise of every column in `[0, 1]`, measured about the baseline: 0
155
- * collapses them all onto it, 1 draws them at full length.
156
- */
90
+ /** Rise of every column about the baseline, `[0, 1]`: 0 collapses them onto it. */
157
91
  readonly growth: 1;
158
- /**
159
- * How much of the slot each series claims, one entry per series: a weight
160
- * rather than a switch, so hiding one is the others widening into the space.
161
- * Seeded from each series' `enabled`.
162
- */
92
+ /** Each series' share of the slot, seeded from `enabled`: a weight rather than a switch, so hiding one widens the others. */
163
93
  readonly weights: import("@motionscript/sdk").Type<number[], number[], false>;
164
- /** The category spotlit, or `null` for none. The choice snaps; `spotlightReveal` is the animation. */
94
+ /** The category spotlit, or `null`. The choice snaps; `spotlightReveal` animates it. */
165
95
  readonly spotlight: import("@motionscript/sdk").Type<number | null, number | null, false>;
166
- /** How far the category spotlight is drawn in, `[0, 1]`. */
167
96
  readonly spotlightReveal: 0;
168
97
  /** Read as the chart is built: the legend is a part the chart builds or doesn't. */
169
98
  readonly showLegend: import("@motionscript/sdk").Type<boolean, boolean, false>;
@@ -186,6 +115,6 @@ export declare const BarChart: import("@motionscript/sdk").Component<"barChart",
186
115
  readonly categoryIndex: import("@motionscript/sdk").Type<number, number, false>;
187
116
  };
188
117
  readonly clearCategory: {};
189
- }, Node2D<Node2DProps>>>>;
118
+ }, Node2D<_Node2DProps>>>>;
190
119
  export type BarChart = NodeOf<typeof BarChart>;
191
120
  //# sourceMappingURL=bar-chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bar-chart.d.ts","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,UAAU,EAEf,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,WAAW,EAGjB,MAAM,mBAAmB,CAAA;AAU1B,OAAO,EAUL,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACX,MAAM,eAAe,CAAA;AAGtB,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,oEAAoE;IACpE,IAAI,EAAE,UAAU,EAAE,CAAA;IAClB;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,gFAAgF;IAChF,MAAM,EAAE,SAAS,EAAE,CAAA;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yEAAyE;IACzE,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,qFAAqF;IACrF,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAA;CACrC;AAED,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AAsCnG,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,GAAG,cAAc,CAOhE;AA8ID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,QAAQ;;;;;;;;IAUjB;;;OAGG;;IAEH;;;;OAIG;;IAEH,sGAAsG;;IAEtG,4DAA4D;;IAE5D,oFAAoF;;IAEpF,kFAAkF;;IAElF,+GAA+G;;;;;;;;;;;;;;;;;;;;;;;;;IAnB/G;;;OAGG;;IAEH;;;;OAIG;;IAEH,sGAAsG;;IAEtG,4DAA4D;;IAE5D,oFAAoF;;IAEpF,kFAAkF;;IAElF,+GAA+G;;;;;;;;;;IAnB/G;;;OAGG;;IAEH;;;;OAIG;;IAEH,sGAAsG;;IAEtG,4DAA4D;;IAE5D,oFAAoF;;IAEpF,kFAAkF;;IAElF,+GAA+G;;;;;;;;;;;;;;;;;yBA6MjH,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAA"}
1
+ {"version":3,"file":"bar-chart.d.ts","sourceRoot":"","sources":["../../src/bar-chart/bar-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,WAAW,IAAI,YAAY,EAEjC,MAAM,mBAAmB,CAAA;AAU1B,OAAO,EASL,KAAK,gBAAgB,EAErB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAA;AAGtB,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAEjB,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAA;CACrC;AAED,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAkB/C,mCAAmC;AACnC,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,GAAG,cAAc,CAOhE;AA4HD;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;IAWjB,mFAAmF;;IAEnF,6HAA6H;;IAE7H,wFAAwF;;;IAGxF,oFAAoF;;IAEpF,kFAAkF;;IAElF,+GAA+G;;;;;;;;;;;;;;;;;;;;;;;;;IAX/G,mFAAmF;;IAEnF,6HAA6H;;IAE7H,wFAAwF;;;IAGxF,oFAAoF;;IAEpF,kFAAkF;;IAElF,+GAA+G;;;;;;;;;;IAX/G,mFAAmF;;IAEnF,6HAA6H;;IAE7H,wFAAwF;;;IAGxF,oFAAoF;;IAEpF,kFAAkF;;IAElF,+GAA+G;;;;;;;;;;;;;;;;;0BAsLjH,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAA"}
@@ -1,39 +1,24 @@
1
- import { Rect, Types, component2d, easeOut, } from "@motionscript/sdk";
1
+ import { Rect, Types, clamp, component2d, easeOut, } from "@motionscript/sdk";
2
2
  import { formatNumber } from "@motionscript/sdk/component";
3
3
  import { cartesianFrame, cartesianViews, laidOutSize } from "../kit/cartesian.js";
4
4
  import { ChartBorder } from "../kit/chart-border.js";
5
5
  import { ChartCanvas } from "../kit/chart-canvas.js";
6
6
  import { ChartLegend } from "../kit/chart-legend.js";
7
- import { asParts, fresh } from "../kit/entries.js";
8
- import { beats } from "../kit/motion.js";
7
+ import { SERIES_ARG, asParts, fresh } from "../kit/entries.js";
8
+ import { DEFAULT_MARKERS, ENTER_SHARE, LEGEND_SLIDE, beats } from "../kit/motion.js";
9
9
  import { VerticalAxis } from "../kit/vertical-axis.js";
10
- import { clampUnit, formatMarker, lerpAxisDomain, lerpAxisEntry, markerStep, markerValues, num, resolveAxisDomain, settleAxisDomain, } from "../kit/shared.js";
10
+ import { formatMarker, lerpAxisDomain, lerpAxisEntry, markerStep, markerValues, num, resolveAxisDomain, settleAxisDomain, } from "../kit/shared.js";
11
11
  import { CategoryAxis } from "./category-axis.js";
12
12
  import { ChartBars } from "./chart-bars.js";
13
13
  import { DEFAULT_BAR_CHART_THEME, barCategories, barSpans, lerpBarChartTheme, resolveBarChartTheme, resolveBarFill, resolveBarScale, stackCapIndex, } from "./shared.js";
14
- /** The argument every per-series command takes: an index into `series`, offered by name. */
15
- const SERIES_ARG = Types.custom(0, { kind: "series", min: 0, step: 1 });
16
- /** How far the legend starts below its slot when it enters, in px. */
17
- const LEGEND_SLIDE = 20;
18
- /** Fallback marker count when the value axis states no ticks. */
19
- const DEFAULT_MARKERS = 5;
20
- /**
21
- * How `enter` divides its duration between its three beats: the axes arriving,
22
- * the columns rising, and the legend coming up. Shares of the whole, so they
23
- * must sum to 1.
24
- */
25
- const AXES_SHARE = 0.35;
26
- const BARS_SHARE = 0.5;
27
- const LEGEND_SHARE = 0.15;
28
- /** The value axis with its range and ticks resolved: the explicit ones, else five across the scale. */
29
14
  function drawnValue(s, domain) {
30
15
  const divisions = (domain.ticks?.length ?? DEFAULT_MARKERS) - 1;
31
16
  const range = resolveBarScale(s.data, s.series, s.stacked, domain.range, divisions);
32
17
  return { ...domain, range, ticks: domain.ticks ?? markerValues(range, DEFAULT_MARKERS - 1) };
33
18
  }
34
- /** The last domain worked out from each data array, and what else it was read from. */
19
+ /** The last domain worked out from each data array, and what it was read from. */
35
20
  const domainsDrawn = new WeakMap();
36
- /** The value axis as a bar chart draws it now, an auto range or tick row read back as itself. */
21
+ /** The value axis as drawn now. */
37
22
  export function barChartDomain(s) {
38
23
  const { data, series, stacked, valueAxis } = s;
39
24
  const kept = domainsDrawn.get(data);
@@ -43,35 +28,27 @@ export function barChartDomain(s) {
43
28
  domainsDrawn.set(data, { series, stacked, valueAxis, domain });
44
29
  return domain;
45
30
  }
46
- /**
47
- * A value written down as this chart's value axis says: the ticks and the
48
- * figures printed on the columns both read through here, so the two cannot
49
- * disagree about what a number looks like.
50
- */
31
+ /** Ticks and the figures printed on columns both read through here, so they cannot disagree about how a number looks. */
51
32
  function valueLabel(s, domain, value) {
52
33
  const pattern = s.valueAxis.format;
53
34
  return pattern === undefined ? formatMarker(value, markerStep(domain.ticks)) : formatNumber(value, pattern);
54
35
  }
55
- /** A value on the plot's **centred** pixel space (origin at its centre, y-up). */
36
+ /** A value in the plot's centred pixel space (origin at its centre, y-up). */
56
37
  function valueToY(domain, plot, value) {
57
38
  const [min, max] = domain.range;
58
39
  if (max <= min)
59
40
  return -plot.height / 2;
60
41
  return ((value - min) / (max - min) - 0.5) * plot.height;
61
42
  }
62
- /**
63
- * Pixel y of the line every column grows from: zero clamped onto the scale, so
64
- * a cropped axis grows its columns from the plot floor.
65
- */
43
+ /** Pixel y columns grow from: zero clamped onto the scale, so a cropped axis grows them from the plot floor. */
66
44
  function baselinePx(domain, plot) {
67
45
  const [min, max] = domain.range;
68
46
  return valueToY(domain, plot, Math.min(Math.max(0, min), max));
69
47
  }
70
- /** Series `i`'s live share of the slot; 0 once it has been hidden. */
71
48
  function weightAt(s, index) {
72
49
  return Math.max(0, s.weights[index] ?? 1);
73
50
  }
74
- /** `row` with each series' value scaled by its live weight: what the stacked spans are measured from. */
51
+ /** `row` with each series' value scaled by its live weight, which stacked spans are measured from. */
75
52
  function weightedRow(s, row) {
76
53
  const scaled = { ...row };
77
54
  s.series.forEach((series, i) => {
@@ -82,10 +59,9 @@ function weightedRow(s, row) {
82
59
  return scaled;
83
60
  }
84
61
  /**
85
- * Series `index`'s columns, mapped into the plot's centred pixel space. A
86
- * grouped series divides the slot with its siblings by their live weights, a
87
- * stacked one takes the whole slot and runs from the running total below it,
88
- * so hiding a series reflows rather than punching a hole.
62
+ * Series `index`'s columns in centred pixel space. A grouped series divides the
63
+ * slot with its siblings by live weight, a stacked one takes the whole slot, so
64
+ * hiding a series reflows rather than punching a hole.
89
65
  */
90
66
  function seriesBars(s, index, plot, captioned) {
91
67
  const series = s.series[index];
@@ -95,7 +71,7 @@ function seriesBars(s, index, plot, captioned) {
95
71
  const n = s.data.length;
96
72
  const slotWidth = n > 0 ? plot.width / n : 0;
97
73
  const slotCenter = (i) => -plot.width / 2 + slotWidth * (i + 0.5);
98
- const inner = slotWidth * clampUnit(s.theme.bar.slotFill);
74
+ const inner = slotWidth * clamp(s.theme.bar.slotFill, 0, 1);
99
75
  const gap = s.theme.bar.groupGap;
100
76
  let total = 0;
101
77
  for (let i = 0; i < s.series.length; i++)
@@ -106,15 +82,14 @@ function seriesBars(s, index, plot, captioned) {
106
82
  for (let i = 0; i < index; i++)
107
83
  before += weightAt(s, i);
108
84
  return s.data.map((row, rowIndex) => {
109
- // The stack is built from the *live* contributions, so a series fading out
110
- // lowers the segments above it as it goes.
85
+ // Built from live contributions, so a fading series lowers the segments above it.
111
86
  const spans = barSpans(s.stacked ? weightedRow(s, row) : row, s.series, s.stacked);
112
87
  const span = spans[index] ?? { from: 0, to: 0, value: 0 };
113
88
  const cap = s.stacked ? stackCapIndex(row, s.series) : index;
114
89
  const slotLeft = slotCenter(rowIndex) - inner / 2;
115
90
  const x = s.stacked ? slotCenter(rowIndex) : slotLeft + unit * before + (unit * weight) / 2;
116
91
  const width = s.stacked ? inner : Math.max(0, unit * weight - (s.series.length > 1 ? gap : 0));
117
- // The figure printed is the row's own value, not the weighted one.
92
+ // The printed figure is the row's own value, not the weighted one.
118
93
  const value = num(row, series.field);
119
94
  return {
120
95
  x,
@@ -127,13 +102,9 @@ function seriesBars(s, index, plot, captioned) {
127
102
  };
128
103
  });
129
104
  }
130
- /**
131
- * How far each category is dimmed by the spotlight, one entry per row: 1 while
132
- * nothing is spotlit, falling to the theme's `dimOpacity` for every category but
133
- * the chosen one as the reveal climbs.
134
- */
105
+ /** Per-row opacity: 1 while nothing is spotlit, falling to the theme's `dimOpacity` for all but the chosen category. */
135
106
  function categoryDims(s) {
136
- const focus = clampUnit(s.spotlightReveal);
107
+ const focus = clamp(s.spotlightReveal, 0, 1);
137
108
  const dim = s.theme.spotlight.dimOpacity;
138
109
  const chosen = s.spotlight;
139
110
  return s.data.map((_, i) => (focus <= 0 || chosen === i ? 1 : 1 - (1 - dim) * focus));
@@ -154,17 +125,15 @@ function partsOf(children) {
154
125
  };
155
126
  }
156
127
  /**
157
- * Move series `index`'s slot share to `target` with its legend entry, the group
158
- * reflowing. Its columns are drawn for every frame the move covers, and switch
159
- * off only once a hide has landed, so arriving at a time backwards shows what
160
- * arriving forwards does.
128
+ * Move series `index`'s slot share to `target` with its legend entry. Its
129
+ * columns stay drawn for every frame the move covers and switch off only once a
130
+ * hide has landed, so arriving at a time backwards matches arriving forwards.
161
131
  */
162
132
  function toggling(timeline, state, children, index, target) {
163
133
  const parts = partsOf(children);
164
134
  if (!parts || !parts.bars[index])
165
135
  return timeline.wait(timeline.duration);
166
- // Read through `weightAt`, so a chart whose stored weights are short still
167
- // tweens from the 1 it is drawing at.
136
+ // Through `weightAt`, so short stored weights still tween from the 1 drawn.
168
137
  const from = state.series.map((_, i) => weightAt(state, i));
169
138
  const start = from[index] ?? 1;
170
139
  const showing = state.series.map((s, i) => state.showing[i] ?? (s.enabled ?? true));
@@ -180,51 +149,32 @@ function toggling(timeline, state, children, index, target) {
180
149
  ]);
181
150
  }
182
151
  /**
183
- * A grouped or stacked bar chart, the sibling of the line chart and built the
184
- * same way, out of several of the same pieces:
185
- *
186
- * - `ChartCanvas` — the plot panel with a horizontal grid, under everything.
187
- * - `VerticalAxis` — the numeric value markers, staggering in bottom-to-top.
188
- * - {@link CategoryAxis} — the row of names beneath the baseline, one per row.
189
- * - {@link ChartBars} (one per series) — that series' column in every category,
190
- * plus the figures printed on them.
191
- * - `ChartLegend` — a row of entries below the chart, one per series.
152
+ * A grouped or stacked bar chart, built like the line chart from `ChartCanvas`,
153
+ * `VerticalAxis`, {@link CategoryAxis}, one {@link ChartBars} per series and
154
+ * `ChartLegend`. Zero is always on the scale and columns grow about it, so a
155
+ * negative value draws downward from the same `growth` signal.
192
156
  *
193
- * Every part reads the chart's entries through bindings, and the columns map
194
- * across the plot panel's own laid-out box, so a column's end lands exactly on
195
- * its marker. **Zero is always on the scale**, and the columns grow about it, so
196
- * a negative value draws downward out of the same `growth` signal.
197
- *
198
- * **Resting state is the finished chart**; `enter` arms every part on its first
199
- * frame. `showSeries`/`hideSeries`/`spotlightSeries` pick out a *series* (hiding
200
- * one reflows the group), `spotlightCategory`/`clearCategory` a *column of the
201
- * table*. A `to` of the value axis's `range` or `ticks` tweens from the domain
202
- * as drawn, so an auto axis rescales the columns continuously.
157
+ * Resting state is the finished chart; `enter` arms every part on its first
158
+ * frame. A `to` of the value axis's `range` or `ticks` tweens from the domain as
159
+ * drawn, so an auto axis rescales the columns continuously.
203
160
  */
204
161
  export const BarChart = component2d({
205
162
  key: "barChart",
206
163
  state: {
207
164
  data: fresh(() => []),
165
+ // Names a column, not a value, like the line chart's `xField`.
208
166
  categoryField: "",
209
167
  series: fresh(() => []),
210
168
  stacked: false,
211
169
  valueAxis: Types.custom({}, { resolve: resolveAxisDomain, lerp: lerpAxisEntry }),
212
170
  categoryAxis: Types.custom({}, { resolve: resolveAxisDomain, lerp: lerpAxisDomain }),
213
171
  theme: Types.custom(DEFAULT_BAR_CHART_THEME, { resolve: resolveBarChartTheme, lerp: lerpBarChartTheme }),
214
- /**
215
- * Global rise of every column in `[0, 1]`, measured about the baseline: 0
216
- * collapses them all onto it, 1 draws them at full length.
217
- */
172
+ /** Rise of every column about the baseline, `[0, 1]`: 0 collapses them onto it. */
218
173
  growth: 1,
219
- /**
220
- * How much of the slot each series claims, one entry per series: a weight
221
- * rather than a switch, so hiding one is the others widening into the space.
222
- * Seeded from each series' `enabled`.
223
- */
174
+ /** Each series' share of the slot, seeded from `enabled`: a weight rather than a switch, so hiding one widens the others. */
224
175
  weights: fresh(() => []),
225
- /** The category spotlit, or `null` for none. The choice snaps; `spotlightReveal` is the animation. */
176
+ /** The category spotlit, or `null`. The choice snaps; `spotlightReveal` animates it. */
226
177
  spotlight: Types.custom(null),
227
- /** How far the category spotlight is drawn in, `[0, 1]`. */
228
178
  spotlightReveal: 0,
229
179
  /** Read as the chart is built: the legend is a part the chart builds or doesn't. */
230
180
  showLegend: Types.boolean(true, { animatable: false }),
@@ -234,7 +184,7 @@ export const BarChart = component2d({
234
184
  showing: Types.custom([], { private: true }),
235
185
  },
236
186
  defaults: {
237
- // Its parts fill it; a node made of them would hug them.
187
+ // A node made of parts that fill would otherwise hug them.
238
188
  width: "fill",
239
189
  height: "fill",
240
190
  weights: (state) => state.series.map((s) => ((s.enabled ?? true) ? 1 : 0)),
@@ -245,7 +195,6 @@ export const BarChart = component2d({
245
195
  const theme = () => state.theme;
246
196
  const domain = () => barChartDomain(state);
247
197
  let plot;
248
- // Before the panel is built or laid out it has no size, and the columns map onto nothing.
249
198
  const plotSize = () => laidOutSize(plot);
250
199
  const captioned = state.showValues === true;
251
200
  const vAxis = new VerticalAxis({
@@ -287,8 +236,7 @@ export const BarChart = component2d({
287
236
  series: state.series,
288
237
  swatches: () => state.series.map((s, i) => resolveBarFill(theme().seriesFills, s, i)),
289
238
  legend: () => theme().legend,
290
- // The row's spacing is the theme's as the chart was built, like the
291
- // entries' type and chips: a theme tween re-paints the swatches only.
239
+ // Spacing is fixed as built; a theme tween re-paints the swatches only.
292
240
  gap: state.theme.legend.itemGap,
293
241
  padding: state.theme.legend.padding,
294
242
  }));
@@ -301,8 +249,7 @@ export const BarChart = component2d({
301
249
  shadow: () => theme().plotArea.shadow,
302
250
  xGridStroke: () => theme().xAxis.lineStyle,
303
251
  yGridStroke: () => theme().yAxis.lineStyle,
304
- // No vertical rules: the horizontal axis is categorical, so there is no
305
- // numeric position along it for a grid line to mark.
252
+ // Categorical x axis: no numeric position for a vertical rule to mark.
306
253
  xMarkers: [],
307
254
  yMarkers: () => domain().ticks,
308
255
  xExtent: () => [0, 1],
@@ -324,16 +271,10 @@ export const BarChart = component2d({
324
271
  return asParts([cartesianFrame({ axis: vAxis, plot, gutter, below })]);
325
272
  },
326
273
  commands: {
327
- /**
328
- * Animate the whole chart in: the two axes stagger their markers and
329
- * captions in, the columns rise from the baseline, and the legend fades up
330
- * last. Its first frame arms every part: markers and captions shifted and
331
- * transparent, columns collapsed, the legend dropped and transparent.
332
- * `duration` is the **whole** entrance; the beats are shares of it.
333
- */
274
+ /** Axes stagger in, columns rise from the baseline, the legend fades up last. `duration` is the whole entrance. */
334
275
  enter: {
335
276
  args: {},
336
- // Held from the chart's arrival, so it never shows finished ahead of its draw.
277
+ // Held from arrival, so it never shows finished ahead of its draw.
337
278
  entrance: true,
338
279
  easing: easeOut(),
339
280
  run: (timeline, _state, children) => {
@@ -341,11 +282,10 @@ export const BarChart = component2d({
341
282
  if (!parts)
342
283
  return timeline.wait(timeline.duration);
343
284
  const duration = timeline.duration;
344
- const axes = duration * AXES_SHARE;
345
- const rise = duration * BARS_SHARE;
285
+ const axes = duration * ENTER_SHARE.axes;
286
+ const rise = duration * ENTER_SHARE.marks;
346
287
  const { legend } = parts;
347
288
  const at0 = (piece) => ({ at: 0, duration: 0, piece });
348
- // Without a legend the beat is still its share of the whole.
349
289
  return beats(timeline, [
350
290
  at0(timeline.animate(() => ({ growth: 0 }))),
351
291
  ...(legend ? [at0(legend.to({ opacity: 0, y: -LEGEND_SLIDE }))] : []),
@@ -353,31 +293,23 @@ export const BarChart = component2d({
353
293
  { at: 0, duration: axes, piece: parts.cAxis.run("enter", { slide: 24 }) },
354
294
  // No priming to 0 first: the value at `t` is a function of `t`.
355
295
  { at: axes, duration: rise, piece: timeline.animate((t) => ({ growth: t })) },
356
- ...(legend ? [{ at: axes + rise, duration: duration * LEGEND_SHARE, piece: legend.to({ opacity: 1, y: 0 }) }] : []),
296
+ ...(legend ? [{ at: axes + rise, duration: duration * ENTER_SHARE.legend, piece: legend.to({ opacity: 1, y: 0 }) }] : []),
357
297
  ]);
358
298
  },
359
299
  },
360
- /** Show series `index`: its columns come back, the group reflowing to make room, with its legend entry. */
300
+ /** Bring series `index` back, the group reflowing to make room, with its legend entry. */
361
301
  showSeries: {
362
302
  args: { seriesIndex: SERIES_ARG },
363
303
  easing: easeOut(),
364
304
  run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 1),
365
305
  },
366
- /**
367
- * Hide series `index`: its columns narrow away (or, stacked, sink out of the
368
- * stack) while the rest of the group widens into the space — the mirror of
369
- * `showSeries`.
370
- */
306
+ /** The mirror of `showSeries`: columns narrow away (stacked, sink out) while the rest widen into the space. */
371
307
  hideSeries: {
372
308
  args: { seriesIndex: SERIES_ARG },
373
309
  easing: easeOut(),
374
310
  run: (timeline, state, children) => toggling(timeline, state, children, timeline.args.seriesIndex, 0),
375
311
  },
376
- /**
377
- * Fade every other series — its columns **and its legend entry** — to focus
378
- * on `index`, which comes back to full. Nothing moves, so the group doesn't
379
- * reflow.
380
- */
312
+ /** Fade every other series, columns and legend entry, to focus on `index`. Nothing moves, so the group does not reflow. */
381
313
  spotlightSeries: {
382
314
  args: { seriesIndex: SERIES_ARG },
383
315
  easing: easeOut(),
@@ -394,10 +326,9 @@ export const BarChart = component2d({
394
326
  },
395
327
  },
396
328
  /**
397
- * Spotlight one **category**: every other category's columns and caption
398
- * fade to the theme's `dimOpacity`. Called while another is lit, the focus
399
- * moves directly: only the dimming changes, so nothing retracts first. A
400
- * category that is not there takes its slot and changes nothing.
329
+ * Fade every other category's columns and caption to `dimOpacity`. While
330
+ * another is lit the focus moves directly. A missing category takes its slot
331
+ * and changes nothing.
401
332
  */
402
333
  spotlightCategory: {
403
334
  args: { categoryIndex: Types.number(0, { min: 0, step: 1 }) },
@@ -410,11 +341,7 @@ export const BarChart = component2d({
410
341
  return timeline.animate((t) => ({ spotlight: index, spotlightReveal: from + (1 - from) * t }));
411
342
  },
412
343
  },
413
- /**
414
- * Drop the category spotlight, every category back to full. The lit
415
- * category is held until the fade lands; a no-op when nothing is lit, which
416
- * still takes its slot.
417
- */
344
+ /** Every category back to full; the lit one is held until the fade lands. A no-op when nothing is lit, which still takes its slot. */
418
345
  clearCategory: {
419
346
  args: {},
420
347
  easing: easeOut(),