@motionscript/charts 0.1.0 → 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 +19 -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
@@ -4,8 +4,9 @@ import {
4
4
  component2d,
5
5
  strokeOps,
6
6
  type NodeOf,
7
- // Named so this component's emitted type reaches `Node2D` through the sdk, not core.
7
+ // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.
8
8
  type Node2D as _Node2D,
9
+ type Node2DProps as _Node2DProps,
9
10
  type Stroke,
10
11
  type StrokeResolved,
11
12
  type Vector2,
@@ -22,12 +23,7 @@ import {
22
23
  type RegionBox,
23
24
  } from "./shared"
24
25
 
25
- /**
26
- * The prefix of `pts` revealed at fraction `p ∈ [0, 1]`, measuring the reveal
27
- * by *cumulative arc length* so the line traces at a steady pace regardless of
28
- * uneven point spacing. Returns the whole-point prefix plus one interpolated
29
- * point partway along the active segment.
30
- */
26
+ /** The prefix of `pts` revealed at fraction `p`, measured by cumulative arc length so the trace keeps a steady pace over uneven spacing. */
31
27
  function tracePoints(pts: Vector2[], p: number): Vector2[] {
32
28
  if (p >= 1 || pts.length < 2) return pts
33
29
  if (p <= 0) return []
@@ -59,45 +55,28 @@ function tracePoints(pts: Vector2[], p: number): Vector2[] {
59
55
  return out
60
56
  }
61
57
 
62
- /**
63
- * A single series line of a {@link LineChart}: one rounded polyline traced
64
- * through pre-mapped pixel `points`, drawn as one {@link Graphics2D} command list.
65
- * Sized and positioned by the parent, which shares the plot's coordinate frame.
66
- *
67
- * Two signals drive it: `progress` traces the line in
68
- * (animated by `enter`) and `enabled` shows or hides it wholesale.
69
- */
58
+ /** One series of a {@link LineChart}: a rounded polyline through pre-mapped pixel `points`, one {@link Graphics2D} command list. `progress` traces it in; `enabled` shows or hides it wholesale. */
70
59
  export const ChartLine = component2d({
71
60
  key: "chartLine",
72
61
  state: {
73
- /** The series polyline, already mapped into this node's local pixel space (origin at centre, y-up) by the parent {@link LineChart}. Ordered along x. */
62
+ /** In this node's pixel space (origin at centre, y-up), mapped by the parent and ordered along x. */
74
63
  points: fresh<Vector2[]>(() => []),
75
- /** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
76
64
  stroke: Types.custom<Stroke, StrokeResolved[]>([], { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),
77
- /**
78
- * Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
79
- * end to its right. Defaults to 1, so the paused editor canvas paints the line;
80
- * `enter` drives it from 0 regardless of where it rests.
81
- */
65
+ /** Trace from the left end, `[0, 1]`. Rests at 1 so a paused editor canvas paints the line; `enter` drives it from 0. */
82
66
  progress: 1,
83
- /** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */
67
+ /** Whether the line is drawn at all, flipped alongside its legend entry. */
84
68
  enabled: true,
85
- /** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */
69
+ /** In this node's pixel space; outside it the line drops to `dimOpacity`. */
86
70
  spotlight: fresh<RegionBox>(() => EMPTY_REGION_BOX),
87
- /** Opacity the out-of-region stretches fade to. */
88
71
  dimOpacity: SPOTLIGHT_DIM,
89
72
  },
90
73
  load: (loader, state) => loadPaints(loader, { strokes: [state.stroke] }),
91
74
  commands: {
92
75
  /**
93
- * Trace the line from `from` to `to` over the command — by default in from
94
- * its left end to its right. `showSeries` and `hideSeries` are the same
95
- * motion in opposite directions, so both are this with their ends stated.
96
- *
97
- * `enabled` rides along in the same value rather than being set before or
98
- * after the command: a line is drawable for every `t` the trace covers and
99
- * undrawn outside it, which is what makes arriving at a time backwards show
100
- * what arriving forwards does.
76
+ * Trace the line from `from` to `to`; `showSeries`/`hideSeries` are this with
77
+ * the ends stated. `enabled` rides along in the same value, so the line is
78
+ * drawable for every `t` the trace covers and arriving backwards matches
79
+ * arriving forwards.
101
80
  */
102
81
  enter: {
103
82
  args: { from: Types.number(0, { min: 0, max: 1 }), to: Types.number(1, { min: 0, max: 1 }) },
@@ -106,8 +85,7 @@ export const ChartLine = component2d({
106
85
  const ease = frameEase(timeline)
107
86
  return timeline.animate((t) => {
108
87
  const progress = from + (to - from) * ease(t)
109
- // Hidden only once it has fully retraced, so the last frame of a hide is
110
- // the empty plot rather than a line that vanished a frame early.
88
+ // Hidden only once fully retraced, so a hide does not vanish a frame early.
111
89
  return { progress, enabled: progress > 0 }
112
90
  })
113
91
  },
@@ -124,7 +102,7 @@ export const ChartLine = component2d({
124
102
  const drawn = tracePoints(pts, p)
125
103
  if (drawn.length < 2) return
126
104
  const stroke = state.stroke
127
- const radius = (stroke[0]?.weight ?? 0) * 2 // round the joins
105
+ const radius = (stroke[0]?.weight ?? 0) * 2
128
106
 
129
107
  const box = state.spotlight
130
108
  if (!hasRegion(box)) {
@@ -132,11 +110,7 @@ export const ChartLine = component2d({
132
110
  return
133
111
  }
134
112
 
135
- // Spotlit: the whole line goes down to `dimOpacity`, then the stretches
136
- // inside the region are re-drawn over it at full strength. Two passes rather
137
- // than one dim + one bright *complementary* pair, so the bright run has
138
- // continuous geometry through the region and its joins round the way an
139
- // unspotlit line's do — and so the boundary lands exactly on the region edge.
113
+ // Dim the whole line, then redraw the stretches inside the region at full strength: the bright run keeps continuous geometry and round joins, and the boundary lands on the region edge.
140
114
  ctx.draw(
141
115
  new Graphics2D()
142
116
  .line({ points: drawn, radius })
@@ -144,9 +118,7 @@ export const ChartLine = component2d({
144
118
  .opacity(Math.max(0, Math.min(1, state.dimOpacity)))
145
119
  )
146
120
 
147
- // One `draw` per run: shapes chained before a `stroke()` are combined into a
148
- // single surface, and stroking a union of disjoint open paths doesn't paint
149
- // — so a line that leaves the region and comes back would lose both halves.
121
+ // One `draw` per run: shapes chained before `stroke()` combine into one surface, and stroking a union of disjoint open paths paints nothing.
150
122
  for (const run of clipPolylineToBox(drawn, box)) {
151
123
  ctx.draw(new Graphics2D().line({ points: run, radius }).stroke(stroke))
152
124
  }
@@ -7,8 +7,9 @@ import {
7
7
  type Fill,
8
8
  type FillResolved,
9
9
  type NodeOf,
10
- // Named so this component's emitted type reaches `Node2D` through the sdk, not core.
10
+ // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.
11
11
  type Node2D as _Node2D,
12
+ type Node2DProps as _Node2DProps,
12
13
  type Stroke,
13
14
  type StrokeResolved,
14
15
  } from "@motionscript/sdk"
@@ -23,29 +24,20 @@ import {
23
24
  } from "./shared"
24
25
 
25
26
  /**
26
- * The **region call-out** of a {@link LineChart}: a washed rectangle over the
27
- * plot with a dashed rule down each edge the author actually bounded. Sized and
28
- * positioned entirely from the pre-mapped `box` rather
29
- * than its own box — the region already carries the plot geometry.
30
- *
31
- * It draws only the *marking*; fading the series outside the region is
32
- * {@link ChartLine}'s job (it clips its own polyline against the same box), so
33
- * the two can't disagree about where the boundary is.
34
- *
35
- * Only bounded edges get a rule: a region given just an `x` range spans the full
36
- * plot height, so its top and bottom edges are the plot's own border, not a data
37
- * bound — drawing dashes there would assert a limit the author didn't set.
27
+ * The call-out of a {@link LineChart}: a washed rectangle with a dashed rule on
28
+ * each bounded edge, drawn from the pre-mapped `box`. Dimming the series outside
29
+ * is {@link ChartLine}'s job, clipped against the same box so the two agree on
30
+ * the boundary. An unbounded edge is the plot's own border, and a rule there
31
+ * would assert a limit the author did not set.
38
32
  */
39
33
  export const ChartRegion = component2d({
40
34
  key: "chartRegion",
41
35
  state: {
42
- /** The highlighted slice, already resolved into this node's local pixel space (origin at centre, y-up) by the parent {@link LineChart}. A degenerate box draws nothing. */
36
+ /** In this node's pixel space (origin at centre, y-up), mapped by the parent. A degenerate box draws nothing. */
43
37
  box: fresh<RegionBox>(() => EMPTY_REGION_BOX),
44
- /** Dashed rule marking each *bounded* edge of the box. */
45
38
  stroke: Types.custom<Stroke, StrokeResolved[]>(DEFAULT_CHART_THEME.region.stroke, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),
46
- /** Wash filling the box, under the series lines. */
47
39
  fill: Types.custom<Fill, FillResolved[]>(DEFAULT_CHART_THEME.region.fill, { resolve: fillOps.resolve, lerp: fillOps.lerp }),
48
- /** Reveal of the annotation in `[0, 1]`, driven by the chart's own `regionReveal` so the rules and the series' dimming move as one. */
40
+ /** Driven by the chart's `regionReveal`, so the rules and the series' dimming move as one. */
49
41
  reveal: 0,
50
42
  },
51
43
  load: (loader, state) => loadPaints(loader, { fills: [state.fill], strokes: [state.stroke] }),
@@ -61,18 +53,13 @@ export const ChartRegion = component2d({
61
53
  const cx = (box.left + box.right) / 2
62
54
  const cy = (box.bottom + box.top) / 2
63
55
 
64
- // Wash first, so the rules sit over their own tint.
65
56
  if (state.fill.length > 0) {
66
57
  ctx.draw(new Graphics2D().rect({ x: cx, y: cy, width, height }).fill(state.fill).opacity(r))
67
58
  }
68
59
 
69
- // One rule per bounded edge, growing from the region's centre outward as
70
- // `reveal` climbs — the same "trace it in" beat as the series lines.
71
60
  if (state.stroke.length === 0) return
72
61
 
73
- // One `draw` per rule rather than four line ops under a single paint:
74
- // shapes chained before a `stroke()` are combined into one surface, and
75
- // stroking a union of disjoint open paths doesn't paint.
62
+ // One `draw` per rule: stroking a union of disjoint open paths paints nothing.
76
63
  const rule = (points: { x: number; y: number }[]) =>
77
64
  ctx.draw(new Graphics2D().line({ points }).stroke(state.stroke).opacity(r))
78
65
 
@@ -7,67 +7,50 @@ import {
7
7
  textOps,
8
8
  type NodeOf,
9
9
  type Node2D,
10
+ type Node2DProps as _Node2DProps,
10
11
  } from "@motionscript/sdk";
12
+ import { enterBudget } from "@motionscript/sdk/component";
11
13
 
12
14
  import { asParts, fresh } from "../kit/entries";
13
15
  import { armed, arrival, arrivalOf, arrivalsEntry, beats, frameEase, type Arrival } from "../kit/motion";
14
16
  import {
15
17
  DEFAULT_X_AXIS,
16
- enterBudget,
17
18
  type AxisConfig,
18
19
  type Range,
19
20
  } from "../kit/shared";
20
21
  import { markerCaption } from "../kit/vertical-axis";
21
22
 
22
- /** How far a marker starts above its slot when it enters, in px. */
23
23
  const SLIDE = 24;
24
24
 
25
25
  /**
26
- * The horizontal axis of a {@link LineChart}: a **row of {@link Text} nodes**,
27
- * one per marker value, running left-to-right. Pure layout — the mirror of the
28
- * kit's `VerticalAxis`, including its bound (not snapshotted) marker text and
29
- * positions, and its landed resting state.
30
- *
31
- * Markers are always placed **by value** across the range, whatever they say:
32
- * `2026-03` sits three months along, not three slots along. That is what keeps
33
- * it distinct from a bar chart's bottom axis, which centres a caption on each
34
- * slot and has no scale at all — the two only look alike. What the values are
35
- * captioned *as* is the chart's to decide, in `captions`.
36
- *
37
- * `enter` staggers the markers in **left-to-right**: each starts lifted a
38
- * little above its slot and transparent, then fades and slides down into place.
26
+ * The horizontal axis of a {@link LineChart}: a row of {@link Text} markers, the
27
+ * mirror of `VerticalAxis` (bound text and positions, landed resting state).
28
+ * Markers are placed by value across the range, whatever they say: `2026-03`
29
+ * sits three months along, not three slots along, unlike a bar chart's axis.
39
30
  */
40
31
  export const HorizontalAxis = component2d({
41
32
  key: "horizontalAxis",
42
33
  state: {
43
- /** `[min, max]` of the horizontal scale the markers are positioned within. */
44
34
  range: fresh<Range>(() => [0, 1]),
45
- /** Tick values (in data units) to draw along the axis. */
35
+ /** Tick values in data units. */
46
36
  markers: fresh<number[]>(() => []),
47
- /**
48
- * How each marker is captioned, one per entry of `markers` and in its order.
49
- * Empty (the default), or short, captions a marker with its bare numeric
50
- * reading; a chart whose x column names months or categories writes those.
51
- */
37
+ /** One caption per marker in its order; a missing one reads as the bare numeric value. */
52
38
  captions: fresh<string[]>(() => []),
53
- /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
54
39
  axis: Types.custom<AxisConfig>(DEFAULT_X_AXIS),
55
- /** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
40
+ /** Caption centred beneath the markers; empty hides it. */
56
41
  label: "",
57
42
  arrivals: arrivalsEntry(),
58
43
  },
59
- // A plain node filled its parent; one made of its markers would hug them.
44
+ // A node made of markers would otherwise hug them.
60
45
  defaults: { width: "fill", height: "fill" },
61
46
  children: (state) => {
62
47
  const tickPad = insetsOps.resolve(state.axis.tickPadding).top;
63
48
  const titlePad = insetsOps.resolve(state.axis.titlePadding).top;
64
49
 
65
50
  const column: Node2D[] = [];
66
- // The column's parent is the axis: its box is what the markers are placed in.
51
+ // The column's parent is the axis, whose box the markers are placed in.
67
52
  const box = () => (column[0]?.parent as Node2D | null | undefined)?.layoutBounds ?? { width: 0, height: 0 };
68
- /** The live tick values, left → right — re-read every frame, not snapshotted. */
69
53
  const sorted = () => [...state.markers].sort((a, b) => a - b);
70
- /** Tick `i`'s fraction across the live `range`, 0 at the left edge. */
71
54
  const fracAt = (value: number | undefined) => {
72
55
  if (value === undefined) return 0;
73
56
  const [min, max] = state.range;
@@ -84,12 +67,7 @@ export const HorizontalAxis = component2d({
84
67
  x: () => {
85
68
  const width = box().width;
86
69
  const centred = (fracAt(sorted()[i]) - 0.5) * width;
87
- // Held inside the axis's right edge, which is also the *chart's*: the
88
- // last marker is centred on the last grid line, so half of `2026-06`
89
- // — or of `3300` — would be drawn outside the node's box and outside
90
- // the rectangle the editor draws around it. Only the right edge is
91
- // held, because the left one has the vertical axis's whole gutter
92
- // beyond it, and a marker overhanging into that is inside the chart.
70
+ // Held inside the right edge, the chart's own: the last marker is centred on the last grid line, so half of it would fall outside the box. The left edge has the vertical axis's gutter beyond it.
93
71
  const limit = width / 2 - marker.layoutBounds.width / 2;
94
72
  return Math.min(centred, limit);
95
73
  },
@@ -117,13 +95,7 @@ export const HorizontalAxis = component2d({
117
95
  return asParts(column);
118
96
  },
119
97
  commands: {
120
- /**
121
- * Stagger the markers in left to right, then slide the caption in after
122
- * them. Its first frame arms them all: lifted by `slide` and transparent.
123
- *
124
- * The timeline's duration is the **whole** entrance — see
125
- * `VerticalAxis.enter` and {@link enterBudget}.
126
- */
98
+ /** Stagger markers in left to right, then the caption. The duration is the whole entrance ({@link enterBudget}). */
127
99
  enter: {
128
100
  args: {
129
101
  stagger: Types.custom<number | undefined>(undefined),
@@ -139,7 +111,6 @@ export const HorizontalAxis = component2d({
139
111
  if (count === 0) return arm;
140
112
  const { step, per, caption } = enterBudget(timeline.duration, count, captioned, stagger);
141
113
  const ease = frameEase(timeline);
142
- // Left marker leads: the row is already left → right.
143
114
  const markers = state.markers.map((_, i) => ({ at: i * step, duration: per, piece: arrival(timeline, i, from, ease) }));
144
115
  const label = captioned ? [{ at: (count - 1) * step + per, duration: caption, piece: arrival(timeline, "label", from, ease) }] : [];
145
116
  return timeline.together([arm, beats(timeline, [...markers, ...label])]);
@@ -1,17 +1,5 @@
1
- /**
2
- * The line chart: a cartesian plot with a traced polyline, spotlit regions and
3
- * a staggered entrance.
4
- *
5
- * {@link LineChart} composes the parts below plus the shared ones in the kit
6
- * (the plot panel, the value axis, the legend); each part is exported too, so
7
- * another node type can reuse one on its own.
8
- *
9
- * These files are what a copy of the line chart takes (`registry.json`). Everything they reach for
10
- * that is *not* here comes from the kit and stays a dependency — see
11
- * `../engine.ts` for why that line is where it is.
12
- */
13
1
  export { LineChart, lineChartDomains } from "./line-chart"
14
- export type { LineChartDomains, LineChartProps, LineChartValues } from "./line-chart"
2
+ export type { LineChartDomains, LineChartValues } from "./line-chart"
15
3
  export { ChartRegion } from "./chart-region"
16
4
  export { ChartLine } from "./chart-line"
17
5
  export { HorizontalAxis } from "./horizontal-axis"