@motionscript/charts 0.1.0-alpha.6 → 0.1.0-alpha.8

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 (66) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/NOTICE +15 -14
  3. package/dist/bar-chart/bar-chart.d.ts +46 -2
  4. package/dist/bar-chart/bar-chart.d.ts.map +1 -1
  5. package/dist/bar-chart/bar-chart.js +13 -5
  6. package/dist/bar-chart/bar-chart.js.map +1 -1
  7. package/dist/bar-chart/category-axis.d.ts +12 -1
  8. package/dist/bar-chart/category-axis.d.ts.map +1 -1
  9. package/dist/bar-chart/chart-bars.d.ts +15 -1
  10. package/dist/bar-chart/chart-bars.d.ts.map +1 -1
  11. package/dist/bar-chart/chart-bars.js +6 -7
  12. package/dist/bar-chart/chart-bars.js.map +1 -1
  13. package/dist/browser/index.js +1 -1
  14. package/dist/browser/index.js.map +3 -3
  15. package/dist/browser/manifest.json +1 -1
  16. package/dist/kit/chart-border.d.ts +3 -1
  17. package/dist/kit/chart-border.d.ts.map +1 -1
  18. package/dist/kit/chart-canvas.d.ts +10 -1
  19. package/dist/kit/chart-canvas.d.ts.map +1 -1
  20. package/dist/kit/chart-legend.d.ts +48 -1
  21. package/dist/kit/chart-legend.d.ts.map +1 -1
  22. package/dist/kit/vertical-axis.d.ts +13 -1
  23. package/dist/kit/vertical-axis.d.ts.map +1 -1
  24. package/dist/line-chart/chart-line.d.ts +46 -37
  25. package/dist/line-chart/chart-line.d.ts.map +1 -1
  26. package/dist/line-chart/chart-line.js +11 -1
  27. package/dist/line-chart/chart-line.js.map +1 -1
  28. package/dist/line-chart/chart-region.d.ts +21 -22
  29. package/dist/line-chart/chart-region.d.ts.map +1 -1
  30. package/dist/line-chart/chart-region.js +5 -1
  31. package/dist/line-chart/chart-region.js.map +1 -1
  32. package/dist/line-chart/horizontal-axis.d.ts +43 -25
  33. package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
  34. package/dist/line-chart/horizontal-axis.js +10 -1
  35. package/dist/line-chart/horizontal-axis.js.map +1 -1
  36. package/dist/line-chart/line-chart.d.ts +47 -2
  37. package/dist/line-chart/line-chart.d.ts.map +1 -1
  38. package/dist/line-chart/line-chart.js +16 -7
  39. package/dist/line-chart/line-chart.js.map +1 -1
  40. package/dist/line-chart/x-scale.d.ts +3 -10
  41. package/dist/line-chart/x-scale.d.ts.map +1 -1
  42. package/dist/line-chart/x-scale.js +15 -4
  43. package/dist/line-chart/x-scale.js.map +1 -1
  44. package/dist/pie-chart/pie-chart.d.ts +35 -2
  45. package/dist/pie-chart/pie-chart.d.ts.map +1 -1
  46. package/dist/pie-chart/pie-chart.js +4 -1
  47. package/dist/pie-chart/pie-chart.js.map +1 -1
  48. package/dist/pie-chart/pie-legend.d.ts +31 -1
  49. package/dist/pie-chart/pie-legend.d.ts.map +1 -1
  50. package/dist/pie-chart/pie-ring.d.ts +19 -1
  51. package/dist/pie-chart/pie-ring.d.ts.map +1 -1
  52. package/dist/pie-chart/shared.d.ts +8 -2
  53. package/dist/pie-chart/shared.d.ts.map +1 -1
  54. package/dist/pie-chart/shared.js +10 -4
  55. package/dist/pie-chart/shared.js.map +1 -1
  56. package/package.json +5 -4
  57. package/src/bar-chart/bar-chart.ts +13 -5
  58. package/src/bar-chart/chart-bars.ts +6 -7
  59. package/src/line-chart/chart-line.ts +11 -36
  60. package/src/line-chart/chart-region.ts +5 -21
  61. package/src/line-chart/horizontal-axis.ts +10 -25
  62. package/src/line-chart/line-chart.ts +20 -7
  63. package/src/line-chart/x-scale.ts +18 -3
  64. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  65. package/src/pie-chart/pie-chart.ts +4 -1
  66. package/src/pie-chart/shared.ts +10 -4
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motionscript/charts",
3
- "version": "0.1.0-alpha.6",
3
+ "version": "0.1.0-alpha.8",
4
4
  "exports": {
5
5
  ".": "dist/browser/index.js",
6
6
  "./kit": "dist/browser/kit.js"
@@ -20,6 +20,8 @@ export declare const ChartBorder: import("@motionscript/sdk").Component<"chartBo
20
20
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
21
21
  }>, {}, null, _Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
22
22
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
23
- }>, null>>;
23
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
24
+ readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
25
+ }>, {}, _Node2D<Node2DProps>>>>;
24
26
  export type ChartBorder = NodeOf<typeof ChartBorder>;
25
27
  //# sourceMappingURL=chart-border.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chart-border.d.ts","sourceRoot":"","sources":["../../src/kit/chart-border.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAK1B,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;;;;UAatB,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAA"}
1
+ {"version":3,"file":"chart-border.d.ts","sourceRoot":"","sources":["../../src/kit/chart-border.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAK1B,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;;;;;;+BAatB,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAA"}
@@ -53,6 +53,15 @@ export declare const ChartCanvas: import("@motionscript/sdk").Component<"chartCa
53
53
  readonly yMarkers: import("@motionscript/sdk").Type<number[], number[], false>;
54
54
  readonly xExtent: import("@motionscript/sdk").Type<Range, Range, false>;
55
55
  readonly yExtent: import("@motionscript/sdk").Type<Range, Range, false>;
56
- }>, null>>;
56
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
57
+ readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
58
+ readonly shadow: import("@motionscript/sdk").Type<Shadow, ShadowResolved[], false>;
59
+ readonly xGridStroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
60
+ readonly yGridStroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
61
+ readonly xMarkers: import("@motionscript/sdk").Type<number[], number[], false>;
62
+ readonly yMarkers: import("@motionscript/sdk").Type<number[], number[], false>;
63
+ readonly xExtent: import("@motionscript/sdk").Type<Range, Range, false>;
64
+ readonly yExtent: import("@motionscript/sdk").Type<Range, Range, false>;
65
+ }>, {}, _Node2D<Node2DProps>>>>;
57
66
  export type ChartCanvas = NodeOf<typeof ChartCanvas>;
58
67
  //# sourceMappingURL=chart-canvas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chart-canvas.d.ts","sourceRoot":"","sources":["../../src/kit/chart-canvas.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX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ACtE,WAAW,EAAE,MAAM,CAAA;IACnB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,mFAAmF;IACnF,OAAO,EAAE,KAAK,CAAA;IACd,iFAAiF;IACjF,OAAO,EAAE,KAAK,CAAA;CACf;AAKD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAoDtB,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAA"}
@@ -108,7 +108,54 @@ export declare const ChartLegend: import("@motionscript/sdk").Component<"chartLe
108
108
  readonly overlay: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
109
109
  readonly start: import("@motionscript/sdk").Type<number, number, false>;
110
110
  readonly end: import("@motionscript/sdk").Type<number, number, false>;
111
- }>, null>>;
111
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
112
+ readonly series: import("@motionscript/sdk").Type<ChartSeries[], ChartSeries[], false>;
113
+ readonly swatches: import("@motionscript/sdk").Type<Fill[], Fill[], false>;
114
+ readonly legend: import("@motionscript/sdk").Type<LegendConfig, LegendConfig, false>;
115
+ /**
116
+ * How far each entry is shown, `0`–`1`. Drives its width, opacity and gap
117
+ * together, so `0` is an entry that takes no room and `1` is one at its
118
+ * natural size.
119
+ *
120
+ * This replaces adding and removing the entry from the row: a command is
121
+ * asked what it looks like at a time, and "is this node a child" is not a
122
+ * value a time can produce. Collapsed-but-present is the same picture reached
123
+ * by a route that *is* a function of `t`.
124
+ */
125
+ readonly reveal: import("@motionscript/sdk").Type<number[] | Readonly<Record<number, number>>, number[], false>;
126
+ readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
127
+ readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
128
+ readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
129
+ readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
130
+ readonly wrap: boolean;
131
+ readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
132
+ readonly columns: import("@motionscript/sdk").Type<number, number, false>;
133
+ readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
134
+ readonly fill: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
135
+ readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
136
+ readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
137
+ readonly overlay: import("@motionscript/sdk").Attribute<Fill, _FillResolved[]>;
138
+ readonly start: import("@motionscript/sdk").Type<number, number, false>;
139
+ readonly end: import("@motionscript/sdk").Type<number, number, false>;
140
+ }>, {
141
+ readonly showSeries: {
142
+ readonly index: import("@motionscript/sdk").Type<number, number, false>;
143
+ };
144
+ readonly hideSeries: {
145
+ readonly index: import("@motionscript/sdk").Type<number, number, false>;
146
+ };
147
+ readonly spotlightSeries: {
148
+ readonly index: import("@motionscript/sdk").Type<number, number, false>;
149
+ };
150
+ readonly fillTo: readonly ["fill"];
151
+ readonly strokeTo: readonly ["stroke"];
152
+ readonly shadowTo: readonly ["shadow"];
153
+ readonly overlayTo: readonly ["overlay"];
154
+ readonly progressTo: readonly ["start", "end"];
155
+ readonly flash: {
156
+ readonly portion: import("@motionscript/sdk").Type<number, number, false>;
157
+ };
158
+ }, _Node2D<_Node2DProps>>>>;
112
159
  /** Whether series `index` is showing at all on `legend`. */
113
160
  export declare function legendShows(legend: {
114
161
  readonly reveal: readonly number[];
@@ -1 +1 @@
1
- {"version":3,"file":"chart-legend.d.ts","sourceRoot":"","sources":["../../src/kit/chart-legend.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EACT,KAAK,MAAM,EACX,KA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,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAElG;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAA"}
@@ -69,6 +69,18 @@ export declare const VerticalAxis: import("@motionscript/sdk").Component<"vertic
69
69
  readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
70
70
  readonly label: "";
71
71
  readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
72
- }>, null>>;
72
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
73
+ readonly range: import("@motionscript/sdk").Type<Range, Range, false>;
74
+ readonly markers: import("@motionscript/sdk").Type<number[], number[], false>;
75
+ readonly captions: import("@motionscript/sdk").Type<string[], string[], false>;
76
+ readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
77
+ readonly label: "";
78
+ readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
79
+ }>, {
80
+ readonly enter: {
81
+ readonly stagger: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
82
+ readonly slide: import("@motionscript/sdk").Type<number, number, false>;
83
+ };
84
+ }, Node2D<Node2DProps>>>>;
73
85
  export type VerticalAxis = NodeOf<typeof VerticalAxis>;
74
86
  //# sourceMappingURL=vertical-axis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vertical-axis.d.ts","sourceRoot":"","sources":["../../src/kit/vertical-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAA8D,KAAK,OAAO,EAAE,MAAM,UAAU,CAAA;AACnG,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,KAAK,EACX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E,MAAM,EAAE,CAAA;IAClB,oFAAoF;IACpF,IAAI,EAAE,UAAU,CAAA;IAChB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;CACd;AAKD,8EAA8E;AAC9E,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;AAEnD,0FAA0F;AAC1F,wBAAgB,aAAa,CAAC,CAAC,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGrI;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAiHvB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,YAAY,CAAC,CAAA"}
@@ -1,65 +1,74 @@
1
- import { type NodeOf, type Node2D as _Node2D, type Node2DProps, type Stroke, type StrokeResolved, type Vector2 } from "@motionscript/sdk";
1
+ import { type NodeOf, type Node2D as _Node2D, type Stroke, type StrokeResolved, type Vector2 } from "@motionscript/sdk";
2
2
  import { type RegionBox } from "./shared.js";
3
- export interface ChartLineProps extends Node2DProps {
4
- /**
5
- * The series polyline, already mapped into this node's local pixel space
6
- * (origin at centre, y-up) by the parent {@link LineChart}. Ordered along x.
7
- */
8
- points: Vector2[];
9
- /** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
10
- stroke: Stroke;
11
- /**
12
- * Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
13
- * end to its right.
14
- *
15
- * Defaults to **1**, unlike the standalone chart this was ported from: in an
16
- * editor a node's resting state is what the paused editor canvas paints, so a
17
- * chart that only appeared once a command had run would edit blind. {@link
18
- * ChartLine.enter} drives it from 0 regardless of where it rests, so the
19
- * animation is unchanged.
20
- */
21
- progress: number;
22
- /**
23
- * Whether this line is drawn at all. `false` hides it outright — the switch
24
- * the chart flips alongside its legend's per-series toggle.
25
- */
26
- enabled: boolean;
27
- /**
28
- * A slice of the plot to spotlight, in this node's own pixel space. When set
29
- * to a real box, the stretches of the line *outside* it drop to
30
- * {@link ChartLineProps.dimOpacity} while the stretches inside stay full.
31
- */
32
- spotlight: RegionBox;
33
- /** Opacity the out-of-region stretches fade to. */
34
- dimOpacity: number;
35
- }
36
3
  /**
37
4
  * A single series line of a {@link LineChart}: one rounded polyline traced
38
5
  * through pre-mapped pixel `points`, drawn as one {@link Graphics2D} command list.
39
6
  * Sized and positioned by the parent, which shares the plot's coordinate frame.
40
7
  *
41
- * Two signals drive it: {@link ChartLineProps.progress} traces the line in
8
+ * Two signals drive it: `progress` traces the line in
42
9
  * (animated by `enter`) and `enabled` shows or hides it wholesale.
43
10
  */
44
11
  export declare const ChartLine: import("@motionscript/sdk").Component<"chartLine", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
12
+ /** 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. */
45
13
  readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
14
+ /** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
46
15
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
16
+ /**
17
+ * Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
18
+ * end to its right. Defaults to 1, so the paused editor canvas paints the line;
19
+ * `enter` drives it from 0 regardless of where it rests.
20
+ */
47
21
  readonly progress: 1;
22
+ /** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */
48
23
  readonly enabled: true;
24
+ /** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */
49
25
  readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
26
+ /** Opacity the out-of-region stretches fade to. */
50
27
  readonly dimOpacity: 0.2;
51
28
  }>, {
52
29
  readonly enter: {
53
30
  readonly from: import("@motionscript/sdk").Type<number, number, false>;
54
31
  readonly to: import("@motionscript/sdk").Type<number, number, false>;
55
32
  };
56
- }, null, _Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
33
+ }, null, _Node2D<import("@motionscript/core").Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
34
+ /** 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. */
57
35
  readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
36
+ /** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
58
37
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
38
+ /**
39
+ * Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
40
+ * end to its right. Defaults to 1, so the paused editor canvas paints the line;
41
+ * `enter` drives it from 0 regardless of where it rests.
42
+ */
43
+ readonly progress: 1;
44
+ /** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */
45
+ readonly enabled: true;
46
+ /** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */
47
+ readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
48
+ /** Opacity the out-of-region stretches fade to. */
49
+ readonly dimOpacity: 0.2;
50
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
51
+ /** 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. */
52
+ readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
53
+ /** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
54
+ readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
55
+ /**
56
+ * Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
57
+ * end to its right. Defaults to 1, so the paused editor canvas paints the line;
58
+ * `enter` drives it from 0 regardless of where it rests.
59
+ */
59
60
  readonly progress: 1;
61
+ /** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */
60
62
  readonly enabled: true;
63
+ /** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */
61
64
  readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
65
+ /** Opacity the out-of-region stretches fade to. */
62
66
  readonly dimOpacity: 0.2;
63
- }>, null>>;
67
+ }>, {
68
+ readonly enter: {
69
+ readonly from: import("@motionscript/sdk").Type<number, number, false>;
70
+ readonly to: import("@motionscript/sdk").Type<number, number, false>;
71
+ };
72
+ }, _Node2D<import("@motionscript/core").Node2DProps>>>>;
64
73
  export type ChartLine = NodeOf<typeof ChartLine>;
65
74
  //# sourceMappingURL=chart-line.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chart-line.d.ts","sourceRoot":"","sources":["../../src/line-chart/chart-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD;;;OAGG;IACH,MAAM,EAAE,OAAO,EAAE,CAAA;IACjB,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;;;;OASG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,SAAS,EAAE,SAAS,CAAA;IACpB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAA;CACnB;AAuCD;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;UA0EpB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA"}
1
+ {"version":3,"file":"chart-line.d.ts","sourceRoot":"","sources":["../../src/line-chart/chart-line.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAuCjB;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;IAGlB,wJAAwJ;;IAExJ,+EAA+E;;IAE/E;;;;OAIG;;IAEH,8GAA8G;;IAE9G,mHAAmH;;IAEnH,mDAAmD;;;;;;;;IAdnD,wJAAwJ;;IAExJ,+EAA+E;;IAE/E;;;;OAIG;;IAEH,8GAA8G;;IAE9G,mHAAmH;;IAEnH,mDAAmD;;;IAdnD,wJAAwJ;;IAExJ,+EAA+E;;IAE/E;;;;OAIG;;IAEH,8GAA8G;;IAE9G,mHAAmH;;IAEnH,mDAAmD;;;;;;;uDAmErD,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA"}
@@ -47,17 +47,27 @@ function tracePoints(pts, p) {
47
47
  * through pre-mapped pixel `points`, drawn as one {@link Graphics2D} command list.
48
48
  * Sized and positioned by the parent, which shares the plot's coordinate frame.
49
49
  *
50
- * Two signals drive it: {@link ChartLineProps.progress} traces the line in
50
+ * Two signals drive it: `progress` traces the line in
51
51
  * (animated by `enter`) and `enabled` shows or hides it wholesale.
52
52
  */
53
53
  export const ChartLine = component2d({
54
54
  key: "chartLine",
55
55
  state: {
56
+ /** 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. */
56
57
  points: fresh(() => []),
58
+ /** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */
57
59
  stroke: Types.custom([], { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),
60
+ /**
61
+ * Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left
62
+ * end to its right. Defaults to 1, so the paused editor canvas paints the line;
63
+ * `enter` drives it from 0 regardless of where it rests.
64
+ */
58
65
  progress: 1,
66
+ /** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */
59
67
  enabled: true,
68
+ /** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */
60
69
  spotlight: fresh(() => EMPTY_REGION_BOX),
70
+ /** Opacity the out-of-region stretches fade to. */
61
71
  dimOpacity: SPOTLIGHT_DIM,
62
72
  },
63
73
  load: (loader, state) => loadPaints(loader, { strokes: [state.stroke] }),
@@ -1 +1 @@
1
- {"version":3,"file":"chart-line.js","sourceRoot":"","sources":["../../src/line-chart/chart-line.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,SAAS,GAQV,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,GAEV,MAAM,UAAU,CAAA;AAoCjB;;;;;GAKG;AACH,SAAS,WAAW,CAAC,GAAc,EAAE,CAAS;IAC5C,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,GAAG,CAAA;IACxC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAA;IAErB,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,KAAK,GA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G,CAAC,EAAE,CAAC;YACpB,GAAG,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;YACzE,OAAM;QACR,CAAC;QAED,wEAAwE;QACxE,6EAA6E;QAC7E,wEAAwE;QACxE,wEAAwE;QACxE,8EAA8E;QAC9E,GAAG,CAAC,IAAI,CACN,IAAI,UAAU,EAAE;aACb,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;aAC/B,MAAM,CAAC,MAAM,CAAC;aACd,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CACvD,CAAA;QAED,6EAA6E;QAC7E,4EAA4E;QAC5E,4EAA4E;QAC5E,KAAK,MAAM,GAAG,IAAI,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;YAChD,GAAG,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;QACzE,CAAC;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Graphics2D,\r\n Types,\r\n component2d,\r\n strokeOps,\r\n type NodeOf,\r\n // Named so this component's emitted type reaches `Node2D` through the sdk, not core.\r\n type Node2D as _Node2D,\r\n type Node2DProps,\r\n type Stroke,\r\n type StrokeResolved,\r\n type Vector2,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { fresh } from \"../kit/entries\"\r\nimport { frameEase } from \"../kit/motion\"\r\nimport { loadPaints } from \"../kit/paints\"\r\nimport { SPOTLIGHT_DIM } from \"../kit/shared\"\r\nimport {\r\n EMPTY_REGION_BOX,\r\n clipPolylineToBox,\r\n hasRegion,\r\n type RegionBox,\r\n} from \"./shared\"\r\n\r\nexport interface ChartLineProps extends Node2DProps {\r\n /**\r\n * The series polyline, already mapped into this node's local pixel space\r\n * (origin at centre, y-up) by the parent {@link LineChart}. Ordered along x.\r\n */\r\n points: Vector2[]\r\n /** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */\r\n stroke: Stroke\r\n /**\r\n * Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left\r\n * end to its right.\r\n *\r\n * Defaults to **1**, unlike the standalone chart this was ported from: in an\r\n * editor a node's resting state is what the paused editor canvas paints, so a\r\n * chart that only appeared once a command had run would edit blind. {@link\r\n * ChartLine.enter} drives it from 0 regardless of where it rests, so the\r\n * animation is unchanged.\r\n */\r\n progress: number\r\n /**\r\n * Whether this line is drawn at all. `false` hides it outright — the switch\r\n * the chart flips alongside its legend's per-series toggle.\r\n */\r\n enabled: boolean\r\n /**\r\n * A slice of the plot to spotlight, in this node's own pixel space. When set\r\n * to a real box, the stretches of the line *outside* it drop to\r\n * {@link ChartLineProps.dimOpacity} while the stretches inside stay full.\r\n */\r\n spotlight: RegionBox\r\n /** Opacity the out-of-region stretches fade to. */\r\n dimOpacity: number\r\n}\r\n\r\n/**\r\n * The prefix of `pts` revealed at fraction `p ∈ [0, 1]`, measuring the reveal\r\n * by *cumulative arc length* so the line traces at a steady pace regardless of\r\n * uneven point spacing. Returns the whole-point prefix plus one interpolated\r\n * point partway along the active segment.\r\n */\r\nfunction tracePoints(pts: Vector2[], p: number): Vector2[] {\r\n if (p >= 1 || pts.length < 2) return pts\r\n if (p <= 0) return []\r\n\r\n const segLen: number[] = []\r\n let total = 0\r\n for (let i = 1; i < pts.length; i++) {\r\n const d = Math.hypot(pts[i].x - pts[i - 1].x, pts[i].y - pts[i - 1].y)\r\n segLen.push(d)\r\n total += d\r\n }\r\n if (total === 0) return pts\r\n\r\n let target = total * p\r\n const out: Vector2[] = [pts[0]]\r\n for (let i = 0; i < segLen.length; i++) {\r\n if (target >= segLen[i]) {\r\n out.push(pts[i + 1])\r\n target -= segLen[i]\r\n } else {\r\n const t = segLen[i] === 0 ? 0 : target / segLen[i]\r\n out.push({\r\n x: pts[i].x + (pts[i + 1].x - pts[i].x) * t,\r\n y: pts[i].y + (pts[i + 1].y - pts[i].y) * t,\r\n })\r\n break\r\n }\r\n }\r\n return out\r\n}\r\n\r\n/**\r\n * A single series line of a {@link LineChart}: one rounded polyline traced\r\n * through pre-mapped pixel `points`, drawn as one {@link Graphics2D} command list.\r\n * Sized and positioned by the parent, which shares the plot's coordinate frame.\r\n *\r\n * Two signals drive it: {@link ChartLineProps.progress} traces the line in\r\n * (animated by `enter`) and `enabled` shows or hides it wholesale.\r\n */\r\nexport const ChartLine = component2d({\r\n key: \"chartLine\",\r\n state: {\r\n points: fresh<Vector2[]>(() => []),\r\n stroke: Types.custom<Stroke, StrokeResolved[]>([], { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),\r\n progress: 1,\r\n enabled: true,\r\n spotlight: fresh<RegionBox>(() => EMPTY_REGION_BOX),\r\n dimOpacity: SPOTLIGHT_DIM,\r\n },\r\n load: (loader, state) => loadPaints(loader, { strokes: [state.stroke] }),\r\n commands: {\r\n /**\r\n * Trace the line from `from` to `to` over the command — by default in from\r\n * its left end to its right. `showSeries` and `hideSeries` are the same\r\n * motion in opposite directions, so both are this with their ends stated.\r\n *\r\n * `enabled` rides along in the same value rather than being set before or\r\n * after the command: a line is drawable for every `t` the trace covers and\r\n * undrawn outside it, which is what makes arriving at a time backwards show\r\n * what arriving forwards does.\r\n */\r\n enter: {\r\n args: { from: Types.number(0, { min: 0, max: 1 }), to: Types.number(1, { min: 0, max: 1 }) },\r\n run: (timeline) => {\r\n const { from, to } = timeline.args\r\n const ease = frameEase(timeline)\r\n return timeline.animate((t) => {\r\n const progress = from + (to - from) * ease(t)\r\n // Hidden only once it has fully retraced, so the last frame of a hide is\r\n // the empty plot rather than a line that vanished a frame early.\r\n return { progress, enabled: progress > 0 }\r\n })\r\n },\r\n },\r\n },\r\n render: (ctx, state) => {\r\n if (!state.enabled) return\r\n const pts = state.points\r\n if (pts.length < 2) return\r\n\r\n const p = Math.max(0, Math.min(1, state.progress))\r\n if (p <= 0) return\r\n\r\n const drawn = tracePoints(pts, p)\r\n if (drawn.length < 2) return\r\n const stroke = state.stroke\r\n const radius = (stroke[0]?.weight ?? 0) * 2 // round the joins\r\n\r\n const box = state.spotlight\r\n if (!hasRegion(box)) {\r\n ctx.draw(new Graphics2D().line({ points: drawn, radius }).stroke(stroke))\r\n return\r\n }\r\n\r\n // Spotlit: the whole line goes down to `dimOpacity`, then the stretches\r\n // inside the region are re-drawn over it at full strength. Two passes rather\r\n // than one dim + one bright *complementary* pair, so the bright run has\r\n // continuous geometry through the region and its joins round the way an\r\n // unspotlit line's do — and so the boundary lands exactly on the region edge.\r\n ctx.draw(\r\n new Graphics2D()\r\n .line({ points: drawn, radius })\r\n .stroke(stroke)\r\n .opacity(Math.max(0, Math.min(1, state.dimOpacity)))\r\n )\r\n\r\n // One `draw` per run: shapes chained before a `stroke()` are combined into a\r\n // single surface, and stroking a union of disjoint open paths doesn't paint\r\n // — so a line that leaves the region and comes back would lose both halves.\r\n for (const run of clipPolylineToBox(drawn, box)) {\r\n ctx.draw(new Graphics2D().line({ points: run, radius }).stroke(stroke))\r\n }\r\n },\r\n})\r\n\r\nexport type ChartLine = NodeOf<typeof ChartLine>\r\n"]}
1
+ {"version":3,"file":"chart-line.js","sourceRoot":"","sources":["../../src/line-chart/chart-line.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,SAAS,GAOV,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EA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G,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;QACzE,CAAC;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Graphics2D,\r\n Types,\r\n component2d,\r\n strokeOps,\r\n type NodeOf,\r\n // Named so this component's emitted type reaches `Node2D` through the sdk, not core.\r\n type Node2D as _Node2D,\r\n type Stroke,\r\n type StrokeResolved,\r\n type Vector2,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { fresh } from \"../kit/entries\"\r\nimport { frameEase } from \"../kit/motion\"\r\nimport { loadPaints } from \"../kit/paints\"\r\nimport { SPOTLIGHT_DIM } from \"../kit/shared\"\r\nimport {\r\n EMPTY_REGION_BOX,\r\n clipPolylineToBox,\r\n hasRegion,\r\n type RegionBox,\r\n} from \"./shared\"\r\n\r\n/**\r\n * The prefix of `pts` revealed at fraction `p ∈ [0, 1]`, measuring the reveal\r\n * by *cumulative arc length* so the line traces at a steady pace regardless of\r\n * uneven point spacing. Returns the whole-point prefix plus one interpolated\r\n * point partway along the active segment.\r\n */\r\nfunction tracePoints(pts: Vector2[], p: number): Vector2[] {\r\n if (p >= 1 || pts.length < 2) return pts\r\n if (p <= 0) return []\r\n\r\n const segLen: number[] = []\r\n let total = 0\r\n for (let i = 1; i < pts.length; i++) {\r\n const d = Math.hypot(pts[i].x - pts[i - 1].x, pts[i].y - pts[i - 1].y)\r\n segLen.push(d)\r\n total += d\r\n }\r\n if (total === 0) return pts\r\n\r\n let target = total * p\r\n const out: Vector2[] = [pts[0]]\r\n for (let i = 0; i < segLen.length; i++) {\r\n if (target >= segLen[i]) {\r\n out.push(pts[i + 1])\r\n target -= segLen[i]\r\n } else {\r\n const t = segLen[i] === 0 ? 0 : target / segLen[i]\r\n out.push({\r\n x: pts[i].x + (pts[i + 1].x - pts[i].x) * t,\r\n y: pts[i].y + (pts[i + 1].y - pts[i].y) * t,\r\n })\r\n break\r\n }\r\n }\r\n return out\r\n}\r\n\r\n/**\r\n * A single series line of a {@link LineChart}: one rounded polyline traced\r\n * through pre-mapped pixel `points`, drawn as one {@link Graphics2D} command list.\r\n * Sized and positioned by the parent, which shares the plot's coordinate frame.\r\n *\r\n * Two signals drive it: `progress` traces the line in\r\n * (animated by `enter`) and `enabled` shows or hides it wholesale.\r\n */\r\nexport const ChartLine = component2d({\r\n key: \"chartLine\",\r\n state: {\r\n /** 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. */\r\n points: fresh<Vector2[]>(() => []),\r\n /** Line colour + weight (+ optional dash/cap/join) — the per-series stroke. */\r\n stroke: Types.custom<Stroke, StrokeResolved[]>([], { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),\r\n /**\r\n * Reveal of the line in `[0, 1]`: 0 hides it, 1 traces it fully from its left\r\n * end to its right. Defaults to 1, so the paused editor canvas paints the line;\r\n * `enter` drives it from 0 regardless of where it rests.\r\n */\r\n progress: 1,\r\n /** Whether this line is drawn at all: the switch the chart flips alongside its legend's per-series toggle. */\r\n enabled: true,\r\n /** A slice of the plot to spotlight, in this node's own pixel space: outside it the line drops to `dimOpacity`. */\r\n spotlight: fresh<RegionBox>(() => EMPTY_REGION_BOX),\r\n /** Opacity the out-of-region stretches fade to. */\r\n dimOpacity: SPOTLIGHT_DIM,\r\n },\r\n load: (loader, state) => loadPaints(loader, { strokes: [state.stroke] }),\r\n commands: {\r\n /**\r\n * Trace the line from `from` to `to` over the command — by default in from\r\n * its left end to its right. `showSeries` and `hideSeries` are the same\r\n * motion in opposite directions, so both are this with their ends stated.\r\n *\r\n * `enabled` rides along in the same value rather than being set before or\r\n * after the command: a line is drawable for every `t` the trace covers and\r\n * undrawn outside it, which is what makes arriving at a time backwards show\r\n * what arriving forwards does.\r\n */\r\n enter: {\r\n args: { from: Types.number(0, { min: 0, max: 1 }), to: Types.number(1, { min: 0, max: 1 }) },\r\n run: (timeline) => {\r\n const { from, to } = timeline.args\r\n const ease = frameEase(timeline)\r\n return timeline.animate((t) => {\r\n const progress = from + (to - from) * ease(t)\r\n // Hidden only once it has fully retraced, so the last frame of a hide is\r\n // the empty plot rather than a line that vanished a frame early.\r\n return { progress, enabled: progress > 0 }\r\n })\r\n },\r\n },\r\n },\r\n render: (ctx, state) => {\r\n if (!state.enabled) return\r\n const pts = state.points\r\n if (pts.length < 2) return\r\n\r\n const p = Math.max(0, Math.min(1, state.progress))\r\n if (p <= 0) return\r\n\r\n const drawn = tracePoints(pts, p)\r\n if (drawn.length < 2) return\r\n const stroke = state.stroke\r\n const radius = (stroke[0]?.weight ?? 0) * 2 // round the joins\r\n\r\n const box = state.spotlight\r\n if (!hasRegion(box)) {\r\n ctx.draw(new Graphics2D().line({ points: drawn, radius }).stroke(stroke))\r\n return\r\n }\r\n\r\n // Spotlit: the whole line goes down to `dimOpacity`, then the stretches\r\n // inside the region are re-drawn over it at full strength. Two passes rather\r\n // than one dim + one bright *complementary* pair, so the bright run has\r\n // continuous geometry through the region and its joins round the way an\r\n // unspotlit line's do — and so the boundary lands exactly on the region edge.\r\n ctx.draw(\r\n new Graphics2D()\r\n .line({ points: drawn, radius })\r\n .stroke(stroke)\r\n .opacity(Math.max(0, Math.min(1, state.dimOpacity)))\r\n )\r\n\r\n // One `draw` per run: shapes chained before a `stroke()` are combined into a\r\n // single surface, and stroking a union of disjoint open paths doesn't paint\r\n // — so a line that leaves the region and comes back would lose both halves.\r\n for (const run of clipPolylineToBox(drawn, box)) {\r\n ctx.draw(new Graphics2D().line({ points: run, radius }).stroke(stroke))\r\n }\r\n },\r\n})\r\n\r\nexport type ChartLine = NodeOf<typeof ChartLine>\r\n"]}
@@ -1,27 +1,9 @@
1
- import { type Fill, type FillResolved, type NodeOf, type Node2D as _Node2D, type Node2DProps, type Stroke, type StrokeResolved } from "@motionscript/sdk";
1
+ import { type Fill, type FillResolved, type NodeOf, type Node2D as _Node2D, type Stroke, type StrokeResolved } from "@motionscript/sdk";
2
2
  import { type RegionBox } from "./shared.js";
3
- export interface ChartRegionProps extends Node2DProps {
4
- /**
5
- * The highlighted slice, already resolved into this node's local pixel space
6
- * (origin at centre, y-up) by the parent {@link LineChart}. A degenerate box
7
- * draws nothing.
8
- */
9
- box: RegionBox;
10
- /** Dashed rule marking each *bounded* edge of the box. */
11
- stroke: Stroke;
12
- /** Wash filling the box, under the series lines. */
13
- fill: Fill;
14
- /**
15
- * Reveal of the annotation in `[0, 1]`: 0 hides it, 1 draws it fully. Driven
16
- * by the chart's own `regionReveal`, so the rules and the series' dimming move
17
- * as one.
18
- */
19
- reveal: number;
20
- }
21
3
  /**
22
4
  * The **region call-out** of a {@link LineChart}: a washed rectangle over the
23
5
  * plot with a dashed rule down each edge the author actually bounded. Sized and
24
- * positioned entirely from the pre-mapped {@link ChartRegionProps.box} rather
6
+ * positioned entirely from the pre-mapped `box` rather
25
7
  * than its own box — the region already carries the plot geometry.
26
8
  *
27
9
  * It draws only the *marking*; fading the series outside the region is
@@ -33,15 +15,32 @@ export interface ChartRegionProps extends Node2DProps {
33
15
  * bound — drawing dashes there would assert a limit the author didn't set.
34
16
  */
35
17
  export declare const ChartRegion: import("@motionscript/sdk").Component<"chartRegion", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
18
+ /** 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. */
19
+ readonly box: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
20
+ /** Dashed rule marking each *bounded* edge of the box. */
21
+ readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
22
+ /** Wash filling the box, under the series lines. */
23
+ readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
24
+ /** Reveal of the annotation in `[0, 1]`, driven by the chart's own `regionReveal` so the rules and the series' dimming move as one. */
25
+ readonly reveal: 0;
26
+ }>, {}, null, _Node2D<import("@motionscript/core").Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
27
+ /** 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
28
  readonly box: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
29
+ /** Dashed rule marking each *bounded* edge of the box. */
37
30
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
31
+ /** Wash filling the box, under the series lines. */
38
32
  readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
33
+ /** Reveal of the annotation in `[0, 1]`, driven by the chart's own `regionReveal` so the rules and the series' dimming move as one. */
39
34
  readonly reveal: 0;
40
- }>, {}, null, _Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
35
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
36
+ /** 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. */
41
37
  readonly box: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
38
+ /** Dashed rule marking each *bounded* edge of the box. */
42
39
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
40
+ /** Wash filling the box, under the series lines. */
43
41
  readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
42
+ /** Reveal of the annotation in `[0, 1]`, driven by the chart's own `regionReveal` so the rules and the series' dimming move as one. */
44
43
  readonly reveal: 0;
45
- }>, null>>;
44
+ }>, {}, _Node2D<import("@motionscript/core").Node2DProps>>>>;
46
45
  export type ChartRegion = NodeOf<typeof ChartRegion>;
47
46
  //# sourceMappingURL=chart-region.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chart-region.d.ts","sourceRoot":"","sources":["../../src/line-chart/chart-region.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAI1B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAEjB,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;OAIG;IACH,GAAG,EAAE,SAAS,CAAA;IACd,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,IAAI,EAAE,IAAI,CAAA;IACV;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;UA6CtB,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAA"}
1
+ {"version":3,"file":"chart-region.d.ts","sourceRoot":"","sources":["../../src/line-chart/chart-region.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,MAAM,EAEX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAI1B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAEjB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;IAGpB,2KAA2K;;IAE3K,0DAA0D;;IAE1D,oDAAoD;;IAEpD,uIAAuI;;;IANvI,2KAA2K;;IAE3K,0DAA0D;;IAE1D,oDAAoD;;IAEpD,uIAAuI;;;IANvI,2KAA2K;;IAE3K,0DAA0D;;IAE1D,oDAAoD;;IAEpD,uIAAuI;;4DAwCzI,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAA"}
@@ -5,7 +5,7 @@ import { DEFAULT_CHART_THEME, EMPTY_REGION_BOX, hasRegion, } from "./shared.js";
5
5
  /**
6
6
  * The **region call-out** of a {@link LineChart}: a washed rectangle over the
7
7
  * plot with a dashed rule down each edge the author actually bounded. Sized and
8
- * positioned entirely from the pre-mapped {@link ChartRegionProps.box} rather
8
+ * positioned entirely from the pre-mapped `box` rather
9
9
  * than its own box — the region already carries the plot geometry.
10
10
  *
11
11
  * It draws only the *marking*; fading the series outside the region is
@@ -19,9 +19,13 @@ import { DEFAULT_CHART_THEME, EMPTY_REGION_BOX, hasRegion, } from "./shared.js";
19
19
  export const ChartRegion = component2d({
20
20
  key: "chartRegion",
21
21
  state: {
22
+ /** 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. */
22
23
  box: fresh(() => EMPTY_REGION_BOX),
24
+ /** Dashed rule marking each *bounded* edge of the box. */
23
25
  stroke: Types.custom(DEFAULT_CHART_THEME.region.stroke, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),
26
+ /** Wash filling the box, under the series lines. */
24
27
  fill: Types.custom(DEFAULT_CHART_THEME.region.fill, { resolve: fillOps.resolve, lerp: fillOps.lerp }),
28
+ /** Reveal of the annotation in `[0, 1]`, driven by the chart's own `regionReveal` so the rules and the series' dimming move as one. */
25
29
  reveal: 0,
26
30
  },
27
31
  load: (loader, state) => loadPaints(loader, { fills: [state.fill], strokes: [state.stroke] }),
@@ -1 +1 @@
1
- {"version":3,"file":"chart-region.js","sourceRoot":"","sources":["../../src/line-chart/chart-region.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,GASV,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,GAEV,MAAM,UAAU,CAAA;AAqBjB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM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MAAM,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;YAC5B,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC;gBAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACzF,CAAC;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Graphics2D,\r\n Types,\r\n component2d,\r\n fillOps,\r\n strokeOps,\r\n type Fill,\r\n type FillResolved,\r\n type NodeOf,\r\n // Named so this component's emitted type reaches `Node2D` through the sdk, not core.\r\n type Node2D as _Node2D,\r\n type Node2DProps,\r\n type Stroke,\r\n type StrokeResolved,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { fresh } from \"../kit/entries\"\r\nimport { loadPaints } from \"../kit/paints\"\r\nimport {\r\n DEFAULT_CHART_THEME,\r\n EMPTY_REGION_BOX,\r\n hasRegion,\r\n type RegionBox,\r\n} from \"./shared\"\r\n\r\nexport interface ChartRegionProps extends Node2DProps {\r\n /**\r\n * The highlighted slice, already resolved into this node's local pixel space\r\n * (origin at centre, y-up) by the parent {@link LineChart}. A degenerate box\r\n * draws nothing.\r\n */\r\n box: RegionBox\r\n /** Dashed rule marking each *bounded* edge of the box. */\r\n stroke: Stroke\r\n /** Wash filling the box, under the series lines. */\r\n fill: Fill\r\n /**\r\n * Reveal of the annotation in `[0, 1]`: 0 hides it, 1 draws it fully. Driven\r\n * by the chart's own `regionReveal`, so the rules and the series' dimming move\r\n * as one.\r\n */\r\n reveal: number\r\n}\r\n\r\n/**\r\n * The **region call-out** of a {@link LineChart}: a washed rectangle over the\r\n * plot with a dashed rule down each edge the author actually bounded. Sized and\r\n * positioned entirely from the pre-mapped {@link ChartRegionProps.box} rather\r\n * than its own box — the region already carries the plot geometry.\r\n *\r\n * It draws only the *marking*; fading the series outside the region is\r\n * {@link ChartLine}'s job (it clips its own polyline against the same box), so\r\n * the two can't disagree about where the boundary is.\r\n *\r\n * Only bounded edges get a rule: a region given just an `x` range spans the full\r\n * plot height, so its top and bottom edges are the plot's own border, not a data\r\n * bound — drawing dashes there would assert a limit the author didn't set.\r\n */\r\nexport const ChartRegion = component2d({\r\n key: \"chartRegion\",\r\n state: {\r\n box: fresh<RegionBox>(() => EMPTY_REGION_BOX),\r\n stroke: Types.custom<Stroke, StrokeResolved[]>(DEFAULT_CHART_THEME.region.stroke, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),\r\n fill: Types.custom<Fill, FillResolved[]>(DEFAULT_CHART_THEME.region.fill, { resolve: fillOps.resolve, lerp: fillOps.lerp }),\r\n reveal: 0,\r\n },\r\n load: (loader, state) => loadPaints(loader, { fills: [state.fill], strokes: [state.stroke] }),\r\n render: (ctx, state) => {\r\n const box = state.box\r\n if (!hasRegion(box)) return\r\n\r\n const r = Math.max(0, Math.min(1, state.reveal))\r\n if (r <= 0) return\r\n\r\n const width = box.right - box.left\r\n const height = box.top - box.bottom\r\n const cx = (box.left + box.right) / 2\r\n const cy = (box.bottom + box.top) / 2\r\n\r\n // Wash first, so the rules sit over their own tint.\r\n if (state.fill.length > 0) {\r\n ctx.draw(new Graphics2D().rect({ x: cx, y: cy, width, height }).fill(state.fill).opacity(r))\r\n }\r\n\r\n // One rule per bounded edge, growing from the region's centre outward as\r\n // `reveal` climbs — the same \"trace it in\" beat as the series lines.\r\n if (state.stroke.length === 0) return\r\n\r\n // One `draw` per rule rather than four line ops under a single paint:\r\n // shapes chained before a `stroke()` are combined into one surface, and\r\n // stroking a union of disjoint open paths doesn't paint.\r\n const rule = (points: { x: number; y: number }[]) =>\r\n ctx.draw(new Graphics2D().line({ points }).stroke(state.stroke).opacity(r))\r\n\r\n if (box.xBounded) {\r\n const half = (height / 2) * r\r\n for (const x of [box.left, box.right]) rule([{ x, y: cy - half }, { x, y: cy + half }])\r\n }\r\n if (box.yBounded) {\r\n const half = (width / 2) * r\r\n for (const y of [box.bottom, box.top]) rule([{ x: cx - half, y }, { x: cx + half, y }])\r\n }\r\n },\r\n})\r\n\r\nexport type ChartRegion = NodeOf<typeof ChartRegion>\r\n"]}
1
+ {"version":3,"file":"chart-region.js","sourceRoot":"","sources":["../../src/line-chart/chart-region.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,GAQV,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,GAEV,MAAM,UAAU,CAAA;AAEjB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;IACrC,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE;QACL,2KAA2K;QAC3K,GAAG,EAAE,KAAK,CAAY,GAAG,EAAE,CAAC,gBAAgB,CAAC;QAC7C,0DAA0D;QAC1D,MAAM,EAAE,KAAK,CAAC,MAAM,CAA2B,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;QACvI,oDAAoD;QACpD,IAAI,EAAE,KAAK,CAAC,MAAM,CAAuB,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QAC3H,uIAAuI;QACvI,MAAM,EAAE,CAAC;KACV;IACD,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,KA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AyD;QACzD,MAAM,IAAI,GAAG,CAAC,MAAkC,EAAE,EAAE,CAClD,GAAG,CAAC,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;QAE7E,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;YAC7B,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC;gBAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,CAAA;QACzF,CAAC;QACD,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;YAC5B,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC;gBAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;QACzF,CAAC;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\r\n Graphics2D,\r\n Types,\r\n component2d,\r\n fillOps,\r\n strokeOps,\r\n type Fill,\r\n type FillResolved,\r\n type NodeOf,\r\n // Named so this component's emitted type reaches `Node2D` through the sdk, not core.\r\n type Node2D as _Node2D,\r\n type Stroke,\r\n type StrokeResolved,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { fresh } from \"../kit/entries\"\r\nimport { loadPaints } from \"../kit/paints\"\r\nimport {\r\n DEFAULT_CHART_THEME,\r\n EMPTY_REGION_BOX,\r\n hasRegion,\r\n type RegionBox,\r\n} from \"./shared\"\r\n\r\n/**\r\n * The **region call-out** of a {@link LineChart}: a washed rectangle over the\r\n * plot with a dashed rule down each edge the author actually bounded. Sized and\r\n * positioned entirely from the pre-mapped `box` rather\r\n * than its own box — the region already carries the plot geometry.\r\n *\r\n * It draws only the *marking*; fading the series outside the region is\r\n * {@link ChartLine}'s job (it clips its own polyline against the same box), so\r\n * the two can't disagree about where the boundary is.\r\n *\r\n * Only bounded edges get a rule: a region given just an `x` range spans the full\r\n * plot height, so its top and bottom edges are the plot's own border, not a data\r\n * bound — drawing dashes there would assert a limit the author didn't set.\r\n */\r\nexport const ChartRegion = component2d({\r\n key: \"chartRegion\",\r\n state: {\r\n /** 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. */\r\n box: fresh<RegionBox>(() => EMPTY_REGION_BOX),\r\n /** Dashed rule marking each *bounded* edge of the box. */\r\n stroke: Types.custom<Stroke, StrokeResolved[]>(DEFAULT_CHART_THEME.region.stroke, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),\r\n /** Wash filling the box, under the series lines. */\r\n fill: Types.custom<Fill, FillResolved[]>(DEFAULT_CHART_THEME.region.fill, { resolve: fillOps.resolve, lerp: fillOps.lerp }),\r\n /** Reveal of the annotation in `[0, 1]`, driven by the chart's own `regionReveal` so the rules and the series' dimming move as one. */\r\n reveal: 0,\r\n },\r\n load: (loader, state) => loadPaints(loader, { fills: [state.fill], strokes: [state.stroke] }),\r\n render: (ctx, state) => {\r\n const box = state.box\r\n if (!hasRegion(box)) return\r\n\r\n const r = Math.max(0, Math.min(1, state.reveal))\r\n if (r <= 0) return\r\n\r\n const width = box.right - box.left\r\n const height = box.top - box.bottom\r\n const cx = (box.left + box.right) / 2\r\n const cy = (box.bottom + box.top) / 2\r\n\r\n // Wash first, so the rules sit over their own tint.\r\n if (state.fill.length > 0) {\r\n ctx.draw(new Graphics2D().rect({ x: cx, y: cy, width, height }).fill(state.fill).opacity(r))\r\n }\r\n\r\n // One rule per bounded edge, growing from the region's centre outward as\r\n // `reveal` climbs — the same \"trace it in\" beat as the series lines.\r\n if (state.stroke.length === 0) return\r\n\r\n // One `draw` per rule rather than four line ops under a single paint:\r\n // shapes chained before a `stroke()` are combined into one surface, and\r\n // stroking a union of disjoint open paths doesn't paint.\r\n const rule = (points: { x: number; y: number }[]) =>\r\n ctx.draw(new Graphics2D().line({ points }).stroke(state.stroke).opacity(r))\r\n\r\n if (box.xBounded) {\r\n const half = (height / 2) * r\r\n for (const x of [box.left, box.right]) rule([{ x, y: cy - half }, { x, y: cy + half }])\r\n }\r\n if (box.yBounded) {\r\n const half = (width / 2) * r\r\n for (const y of [box.bottom, box.top]) rule([{ x: cx - half, y }, { x: cx + half, y }])\r\n }\r\n },\r\n})\r\n\r\nexport type ChartRegion = NodeOf<typeof ChartRegion>\r\n"]}
@@ -1,27 +1,6 @@
1
- import { type NodeOf, type Node2D, type Node2DProps } from "@motionscript/sdk";
1
+ import { type NodeOf, type Node2D } from "@motionscript/sdk";
2
2
  import { type Arrival } from "../kit/motion.js";
3
3
  import { type AxisConfig, type Range } from "../kit/shared.js";
4
- export interface HorizontalAxisProps extends Node2DProps {
5
- /** `[min, max]` of the horizontal scale the markers are positioned within. */
6
- range: Range;
7
- /** Tick values (in data units) to draw along the axis. */
8
- markers: number[];
9
- /**
10
- * How each marker is captioned, one per entry of `markers` and in its order.
11
- * Empty (the default), or short, captions a marker with its bare numeric
12
- * reading; a chart whose x column names months or categories writes those.
13
- */
14
- captions: string[];
15
- /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
16
- axis: AxisConfig;
17
- /**
18
- * Caption drawn centred in the gutter beneath the marker row. Empty string
19
- * (the default) hides it.
20
- */
21
- label: string;
22
- }
23
- /** How a tick value is captioned — see {@link HorizontalAxisProps.captions}. */
24
- export type MarkerLabel = (value: number) => string;
25
4
  /**
26
5
  * The horizontal axis of a {@link LineChart}: a **row of {@link Text} nodes**,
27
6
  * one per marker value, running left-to-right. Pure layout — the mirror of the
@@ -32,16 +11,25 @@ export type MarkerLabel = (value: number) => string;
32
11
  * `2026-03` sits three months along, not three slots along. That is what keeps
33
12
  * it distinct from a bar chart's bottom axis, which centres a caption on each
34
13
  * 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; see {@link HorizontalAxisProps.captions}.
14
+ * captioned *as* is the chart's to decide, in `captions`.
36
15
  *
37
16
  * `enter` staggers the markers in **left-to-right**: each starts lifted a
38
17
  * little above its slot and transparent, then fades and slides down into place.
39
18
  */
40
19
  export declare const HorizontalAxis: import("@motionscript/sdk").Component<"horizontalAxis", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
20
+ /** `[min, max]` of the horizontal scale the markers are positioned within. */
41
21
  readonly range: import("@motionscript/sdk").Type<Range, Range, false>;
22
+ /** Tick values (in data units) to draw along the axis. */
42
23
  readonly markers: import("@motionscript/sdk").Type<number[], number[], false>;
24
+ /**
25
+ * How each marker is captioned, one per entry of `markers` and in its order.
26
+ * Empty (the default), or short, captions a marker with its bare numeric
27
+ * reading; a chart whose x column names months or categories writes those.
28
+ */
43
29
  readonly captions: import("@motionscript/sdk").Type<string[], string[], false>;
30
+ /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
44
31
  readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
32
+ /** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
45
33
  readonly label: "";
46
34
  readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
47
35
  }>, {
@@ -49,13 +37,43 @@ export declare const HorizontalAxis: import("@motionscript/sdk").Component<"hori
49
37
  readonly stagger: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
50
38
  readonly slide: import("@motionscript/sdk").Type<number, number, false>;
51
39
  };
52
- }, null, Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
40
+ }, null, Node2D<import("@motionscript/core").Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
41
+ /** `[min, max]` of the horizontal scale the markers are positioned within. */
53
42
  readonly range: import("@motionscript/sdk").Type<Range, Range, false>;
43
+ /** Tick values (in data units) to draw along the axis. */
54
44
  readonly markers: import("@motionscript/sdk").Type<number[], number[], false>;
45
+ /**
46
+ * How each marker is captioned, one per entry of `markers` and in its order.
47
+ * Empty (the default), or short, captions a marker with its bare numeric
48
+ * reading; a chart whose x column names months or categories writes those.
49
+ */
50
+ readonly captions: import("@motionscript/sdk").Type<string[], string[], false>;
51
+ /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
52
+ readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
53
+ /** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
54
+ readonly label: "";
55
+ readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
56
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
57
+ /** `[min, max]` of the horizontal scale the markers are positioned within. */
58
+ readonly range: import("@motionscript/sdk").Type<Range, Range, false>;
59
+ /** Tick values (in data units) to draw along the axis. */
60
+ readonly markers: import("@motionscript/sdk").Type<number[], number[], false>;
61
+ /**
62
+ * How each marker is captioned, one per entry of `markers` and in its order.
63
+ * Empty (the default), or short, captions a marker with its bare numeric
64
+ * reading; a chart whose x column names months or categories writes those.
65
+ */
55
66
  readonly captions: import("@motionscript/sdk").Type<string[], string[], false>;
67
+ /** Marker/caption text style, grid stroke, and gutters — see {@link AxisConfig}. */
56
68
  readonly axis: import("@motionscript/sdk").Type<AxisConfig, AxisConfig, false>;
69
+ /** Caption drawn centred in the gutter beneath the marker row; empty (the default) hides it. */
57
70
  readonly label: "";
58
71
  readonly arrivals: import("@motionscript/sdk").Type<Readonly<Record<string, Arrival>>, Readonly<Record<string, Arrival>>, false>;
59
- }>, null>>;
72
+ }>, {
73
+ readonly enter: {
74
+ readonly stagger: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
75
+ readonly slide: import("@motionscript/sdk").Type<number, number, false>;
76
+ };
77
+ }, Node2D<import("@motionscript/core").Node2DProps>>>>;
60
78
  export type HorizontalAxis = NodeOf<typeof HorizontalAxis>;
61
79
  //# sourceMappingURL=horizontal-axis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"horizontal-axis.d.ts","sourceRoot":"","sources":["../../src/line-chart/horizontal-axis.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAA8D,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,8EAA8E;IAC9E,KAAK,EAAE,KAAK,CAAC;IACb,0DAA0D;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,oFAAoF;IACpF,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAKD,gFAAgF;AAChF,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;UAoGzB,CAAC;AAEH,MAAM,M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