@motionscript/charts 0.1.1-alpha.0 → 0.1.1-alpha.2

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 (207) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +109 -28
  3. package/dist/bar-chart/bar-chart.d.ts +265 -39
  4. package/dist/bar-chart/bar-chart.d.ts.map +1 -1
  5. package/dist/bar-chart/bar-chart.js +219 -171
  6. package/dist/bar-chart/bar-chart.js.map +1 -1
  7. package/dist/bar-chart/category-axis.d.ts +12 -7
  8. package/dist/bar-chart/category-axis.d.ts.map +1 -1
  9. package/dist/bar-chart/category-axis.js +56 -42
  10. package/dist/bar-chart/category-axis.js.map +1 -1
  11. package/dist/bar-chart/chart-bars.d.ts +76 -52
  12. package/dist/bar-chart/chart-bars.d.ts.map +1 -1
  13. package/dist/bar-chart/chart-bars.js +105 -89
  14. package/dist/bar-chart/chart-bars.js.map +1 -1
  15. package/dist/bar-chart/index.d.ts +4 -4
  16. package/dist/bar-chart/index.d.ts.map +1 -1
  17. package/dist/bar-chart/index.js +2 -2
  18. package/dist/bar-chart/index.js.map +1 -1
  19. package/dist/bar-chart/shared.d.ts +41 -65
  20. package/dist/bar-chart/shared.d.ts.map +1 -1
  21. package/dist/bar-chart/shared.js +73 -117
  22. package/dist/bar-chart/shared.js.map +1 -1
  23. package/dist/browser/chunks/chunk-7XCRX6GE.js +2 -0
  24. package/dist/browser/chunks/chunk-7XCRX6GE.js.map +7 -0
  25. package/dist/browser/index.js +1 -1
  26. package/dist/browser/index.js.map +4 -4
  27. package/dist/browser/kit.js +1 -1
  28. package/dist/browser/manifest.json +1 -1
  29. package/dist/engine.d.ts +5 -2
  30. package/dist/engine.d.ts.map +1 -1
  31. package/dist/engine.js +5 -2
  32. package/dist/engine.js.map +1 -1
  33. package/dist/index.d.ts +2 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +2 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/kit/cartesian.d.ts +51 -15
  38. package/dist/kit/cartesian.d.ts.map +1 -1
  39. package/dist/kit/cartesian.js +81 -29
  40. package/dist/kit/cartesian.js.map +1 -1
  41. package/dist/kit/chart-canvas.d.ts +32 -24
  42. package/dist/kit/chart-canvas.d.ts.map +1 -1
  43. package/dist/kit/chart-canvas.js +52 -46
  44. package/dist/kit/chart-canvas.js.map +1 -1
  45. package/dist/kit/chart-legend.d.ts +8 -4
  46. package/dist/kit/chart-legend.d.ts.map +1 -1
  47. package/dist/kit/chart-legend.js +30 -20
  48. package/dist/kit/chart-legend.js.map +1 -1
  49. package/dist/{line-chart → kit}/horizontal-axis.d.ts +31 -6
  50. package/dist/kit/horizontal-axis.d.ts.map +1 -0
  51. package/dist/{line-chart → kit}/horizontal-axis.js +23 -24
  52. package/dist/kit/horizontal-axis.js.map +1 -0
  53. package/dist/kit/motion.d.ts +5 -0
  54. package/dist/kit/motion.d.ts.map +1 -1
  55. package/dist/kit/motion.js +8 -0
  56. package/dist/kit/motion.js.map +1 -1
  57. package/dist/{pie-chart → kit}/pie-legend.d.ts +3 -3
  58. package/dist/kit/pie-legend.d.ts.map +1 -0
  59. package/dist/{pie-chart → kit}/pie-legend.js +11 -10
  60. package/dist/kit/pie-legend.js.map +1 -0
  61. package/dist/kit/polar.d.ts +31 -0
  62. package/dist/kit/polar.d.ts.map +1 -0
  63. package/dist/kit/polar.js +33 -0
  64. package/dist/kit/polar.js.map +1 -0
  65. package/dist/kit/shared.d.ts +11 -50
  66. package/dist/kit/shared.d.ts.map +1 -1
  67. package/dist/kit/shared.js +58 -141
  68. package/dist/kit/shared.js.map +1 -1
  69. package/dist/kit/style.d.ts +517 -0
  70. package/dist/kit/style.d.ts.map +1 -0
  71. package/dist/kit/style.js +292 -0
  72. package/dist/kit/style.js.map +1 -0
  73. package/dist/kit/vertical-axis.d.ts +22 -2
  74. package/dist/kit/vertical-axis.d.ts.map +1 -1
  75. package/dist/kit/vertical-axis.js +56 -43
  76. package/dist/kit/vertical-axis.js.map +1 -1
  77. package/dist/line-chart/chart-line.d.ts +95 -3
  78. package/dist/line-chart/chart-line.d.ts.map +1 -1
  79. package/dist/line-chart/chart-line.js +165 -53
  80. package/dist/line-chart/chart-line.js.map +1 -1
  81. package/dist/line-chart/chart-region.d.ts +1 -1
  82. package/dist/line-chart/chart-region.d.ts.map +1 -1
  83. package/dist/line-chart/chart-region.js +7 -8
  84. package/dist/line-chart/chart-region.js.map +1 -1
  85. package/dist/line-chart/index.d.ts +5 -6
  86. package/dist/line-chart/index.d.ts.map +1 -1
  87. package/dist/line-chart/index.js +3 -4
  88. package/dist/line-chart/index.js.map +1 -1
  89. package/dist/line-chart/line-chart.d.ts +281 -18
  90. package/dist/line-chart/line-chart.d.ts.map +1 -1
  91. package/dist/line-chart/line-chart.js +284 -134
  92. package/dist/line-chart/line-chart.js.map +1 -1
  93. package/dist/line-chart/shared.d.ts +51 -34
  94. package/dist/line-chart/shared.d.ts.map +1 -1
  95. package/dist/line-chart/shared.js +175 -83
  96. package/dist/line-chart/shared.js.map +1 -1
  97. package/dist/line-chart/x-scale.d.ts +2 -0
  98. package/dist/line-chart/x-scale.d.ts.map +1 -1
  99. package/dist/line-chart/x-scale.js +15 -0
  100. package/dist/line-chart/x-scale.js.map +1 -1
  101. package/dist/nodes.d.ts +3 -1
  102. package/dist/nodes.d.ts.map +1 -1
  103. package/dist/nodes.js +9 -1
  104. package/dist/nodes.js.map +1 -1
  105. package/dist/pie-chart/index.d.ts +2 -3
  106. package/dist/pie-chart/index.d.ts.map +1 -1
  107. package/dist/pie-chart/index.js +1 -2
  108. package/dist/pie-chart/index.js.map +1 -1
  109. package/dist/pie-chart/pie-chart.d.ts +114 -18
  110. package/dist/pie-chart/pie-chart.d.ts.map +1 -1
  111. package/dist/pie-chart/pie-chart.js +38 -24
  112. package/dist/pie-chart/pie-chart.js.map +1 -1
  113. package/dist/pie-chart/pie-ring.d.ts +16 -5
  114. package/dist/pie-chart/pie-ring.d.ts.map +1 -1
  115. package/dist/pie-chart/pie-ring.js +89 -55
  116. package/dist/pie-chart/pie-ring.js.map +1 -1
  117. package/dist/pie-chart/shared.d.ts +61 -62
  118. package/dist/pie-chart/shared.d.ts.map +1 -1
  119. package/dist/pie-chart/shared.js +44 -123
  120. package/dist/pie-chart/shared.js.map +1 -1
  121. package/dist/radar-chart/index.d.ts +5 -0
  122. package/dist/radar-chart/index.d.ts.map +1 -0
  123. package/dist/radar-chart/index.js +5 -0
  124. package/dist/radar-chart/index.js.map +1 -0
  125. package/dist/radar-chart/radar-chart.d.ts +212 -0
  126. package/dist/radar-chart/radar-chart.d.ts.map +1 -0
  127. package/dist/radar-chart/radar-chart.js +224 -0
  128. package/dist/radar-chart/radar-chart.js.map +1 -0
  129. package/dist/radar-chart/radar-grid.d.ts +49 -0
  130. package/dist/radar-chart/radar-grid.d.ts.map +1 -0
  131. package/dist/radar-chart/radar-grid.js +63 -0
  132. package/dist/radar-chart/radar-grid.js.map +1 -0
  133. package/dist/radar-chart/radar-series.d.ts +59 -0
  134. package/dist/radar-chart/radar-series.d.ts.map +1 -0
  135. package/dist/radar-chart/radar-series.js +71 -0
  136. package/dist/radar-chart/radar-series.js.map +1 -0
  137. package/dist/radar-chart/shared.d.ts +78 -0
  138. package/dist/radar-chart/shared.d.ts.map +1 -0
  139. package/dist/radar-chart/shared.js +129 -0
  140. package/dist/radar-chart/shared.js.map +1 -0
  141. package/dist/radial-chart/index.d.ts +6 -0
  142. package/dist/radial-chart/index.d.ts.map +1 -0
  143. package/dist/radial-chart/index.js +4 -0
  144. package/dist/radial-chart/index.js.map +1 -0
  145. package/dist/radial-chart/radial-chart.d.ts +210 -0
  146. package/dist/radial-chart/radial-chart.d.ts.map +1 -0
  147. package/dist/radial-chart/radial-chart.js +175 -0
  148. package/dist/radial-chart/radial-chart.js.map +1 -0
  149. package/dist/radial-chart/radial-rings.d.ts +121 -0
  150. package/dist/radial-chart/radial-rings.d.ts.map +1 -0
  151. package/dist/radial-chart/radial-rings.js +273 -0
  152. package/dist/radial-chart/radial-rings.js.map +1 -0
  153. package/dist/radial-chart/shared.d.ts +77 -0
  154. package/dist/radial-chart/shared.d.ts.map +1 -0
  155. package/dist/radial-chart/shared.js +78 -0
  156. package/dist/radial-chart/shared.js.map +1 -0
  157. package/package.json +4 -4
  158. package/registry.json +21 -6
  159. package/src/bar-chart/bar-chart.ts +263 -179
  160. package/src/bar-chart/category-axis.ts +46 -40
  161. package/src/bar-chart/chart-bars.ts +136 -117
  162. package/src/bar-chart/index.ts +7 -10
  163. package/src/bar-chart/shared.ts +88 -233
  164. package/src/engine.ts +5 -2
  165. package/src/index.ts +2 -0
  166. package/src/kit/cartesian.ts +121 -40
  167. package/src/kit/chart-canvas.ts +49 -54
  168. package/src/kit/chart-legend.ts +28 -20
  169. package/src/kit/horizontal-axis.ts +114 -0
  170. package/src/kit/motion.ts +7 -0
  171. package/src/{pie-chart → kit}/pie-legend.ts +12 -11
  172. package/src/kit/polar.ts +54 -0
  173. package/src/kit/shared.ts +55 -277
  174. package/src/kit/style.ts +353 -0
  175. package/src/kit/vertical-axis.ts +67 -48
  176. package/src/line-chart/chart-line.ts +176 -54
  177. package/src/line-chart/chart-region.ts +6 -10
  178. package/src/line-chart/index.ts +14 -10
  179. package/src/line-chart/line-chart.ts +353 -151
  180. package/src/line-chart/shared.ts +193 -174
  181. package/src/line-chart/x-scale.ts +13 -0
  182. package/src/nodes.ts +9 -1
  183. package/src/pie-chart/index.ts +2 -23
  184. package/src/pie-chart/pie-chart.ts +54 -35
  185. package/src/pie-chart/pie-ring.ts +92 -71
  186. package/src/pie-chart/shared.ts +80 -270
  187. package/src/radar-chart/index.ts +4 -0
  188. package/src/radar-chart/radar-chart.ts +290 -0
  189. package/src/radar-chart/radar-grid.ts +83 -0
  190. package/src/radar-chart/radar-series.ts +88 -0
  191. package/src/radar-chart/shared.ts +153 -0
  192. package/src/radial-chart/index.ts +5 -0
  193. package/src/radial-chart/radial-chart.ts +212 -0
  194. package/src/radial-chart/radial-rings.ts +328 -0
  195. package/src/radial-chart/shared.ts +126 -0
  196. package/dist/browser/chunks/chunk-4SMRCU24.js +0 -2
  197. package/dist/browser/chunks/chunk-4SMRCU24.js.map +0 -7
  198. package/dist/kit/chart-border.d.ts +0 -18
  199. package/dist/kit/chart-border.d.ts.map +0 -1
  200. package/dist/kit/chart-border.js +0 -23
  201. package/dist/kit/chart-border.js.map +0 -1
  202. package/dist/line-chart/horizontal-axis.d.ts.map +0 -1
  203. package/dist/line-chart/horizontal-axis.js.map +0 -1
  204. package/dist/pie-chart/pie-legend.d.ts.map +0 -1
  205. package/dist/pie-chart/pie-legend.js.map +0 -1
  206. package/src/kit/chart-border.ts +0 -36
  207. package/src/line-chart/horizontal-axis.ts +0 -122
@@ -1,10 +1,20 @@
1
- import { type NodeOf, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type Stroke, type StrokeResolved, type Vector2 } from "@motionscript/sdk";
2
- import { type RegionBox } from "./shared.js";
3
- /** 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. */
1
+ import { type Fill, type FillResolved, type NodeOf, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type Stroke, type StrokeResolved, type Vector2 } from "@motionscript/sdk";
2
+ import { type LineCurve, type RegionBox } from "./shared.js";
3
+ /** The x a trace at `progress` has reached, across `points` ordered along x. */
4
+ export declare function traceX(points: readonly Vector2[], progress: number): number;
5
+ /**
6
+ * One series of a {@link LineChart}: its line through pre-mapped pixel `points`,
7
+ * shaped by `curve`, and a dot on each point. `progress` traces it in from the
8
+ * left; `enabled` shows or hides it wholesale.
9
+ */
4
10
  export declare const ChartLine: import("@motionscript/sdk").Component<"chartLine", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
5
11
  /** In this node's pixel space (origin at centre, y-up), mapped by the parent and ordered along x. */
6
12
  readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
13
+ readonly curve: import("@motionscript/sdk").Type<LineCurve, LineCurve, false>;
7
14
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
15
+ /** A dot of `dotSize` on each point, in `dotFill`; none at size 0. */
16
+ readonly dotSize: 0;
17
+ readonly dotFill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
8
18
  /** Trace from the left end, `[0, 1]`. Rests at 1 so a paused editor canvas paints the line; `enter` drives it from 0. */
9
19
  readonly progress: 1;
10
20
  /** Whether the line is drawn at all, flipped alongside its legend entry. */
@@ -17,10 +27,17 @@ export declare const ChartLine: import("@motionscript/sdk").Component<"chartLine
17
27
  readonly from: import("@motionscript/sdk").Type<number, number, false>;
18
28
  readonly to: import("@motionscript/sdk").Type<number, number, false>;
19
29
  };
30
+ readonly hold: {
31
+ readonly shown: import("@motionscript/sdk").Type<boolean, boolean, false>;
32
+ };
20
33
  }, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
21
34
  /** In this node's pixel space (origin at centre, y-up), mapped by the parent and ordered along x. */
22
35
  readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
36
+ readonly curve: import("@motionscript/sdk").Type<LineCurve, LineCurve, false>;
23
37
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
38
+ /** A dot of `dotSize` on each point, in `dotFill`; none at size 0. */
39
+ readonly dotSize: 0;
40
+ readonly dotFill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
24
41
  /** Trace from the left end, `[0, 1]`. Rests at 1 so a paused editor canvas paints the line; `enter` drives it from 0. */
25
42
  readonly progress: 1;
26
43
  /** Whether the line is drawn at all, flipped alongside its legend entry. */
@@ -31,7 +48,11 @@ export declare const ChartLine: import("@motionscript/sdk").Component<"chartLine
31
48
  }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
32
49
  /** In this node's pixel space (origin at centre, y-up), mapped by the parent and ordered along x. */
33
50
  readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
51
+ readonly curve: import("@motionscript/sdk").Type<LineCurve, LineCurve, false>;
34
52
  readonly stroke: import("@motionscript/sdk").Type<Stroke, StrokeResolved[], false>;
53
+ /** A dot of `dotSize` on each point, in `dotFill`; none at size 0. */
54
+ readonly dotSize: 0;
55
+ readonly dotFill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
35
56
  /** Trace from the left end, `[0, 1]`. Rests at 1 so a paused editor canvas paints the line; `enter` drives it from 0. */
36
57
  readonly progress: 1;
37
58
  /** Whether the line is drawn at all, flipped alongside its legend entry. */
@@ -44,6 +65,77 @@ export declare const ChartLine: import("@motionscript/sdk").Component<"chartLine
44
65
  readonly from: import("@motionscript/sdk").Type<number, number, false>;
45
66
  readonly to: import("@motionscript/sdk").Type<number, number, false>;
46
67
  };
68
+ readonly hold: {
69
+ readonly shown: import("@motionscript/sdk").Type<boolean, boolean, false>;
70
+ };
47
71
  }, _Node2D<_Node2DProps>>>>;
48
72
  export type ChartLine = NodeOf<typeof ChartLine>;
73
+ /**
74
+ * The fill under one series of a {@link LineChart}: down to `base` (the series
75
+ * below it in a stack) or, without one, to the `baseline`. Drawn by its own node
76
+ * so every area sits under every line; the chart binds its trace, switch and
77
+ * opacity to its line's, so the two move as one.
78
+ */
79
+ export declare const ChartArea: import("@motionscript/sdk").Component<"chartArea", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
80
+ /** The series' points, as its line has them. */
81
+ readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
82
+ /** The line the area fills down to, at the same x positions; empty for the baseline. */
83
+ readonly base: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
84
+ /** Pixel y of the baseline. */
85
+ readonly baseline: 0;
86
+ readonly curve: import("@motionscript/sdk").Type<LineCurve, LineCurve, false>;
87
+ readonly area: import("@motionscript/sdk").Type<"none" | "solid" | "gradient", "none" | "solid" | "gradient", false>;
88
+ /** The series colour; the area paints it at `areaOpacity`, a gradient fading it out towards the bottom. */
89
+ readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
90
+ readonly areaOpacity: 0.4;
91
+ readonly progress: 1;
92
+ readonly enabled: true;
93
+ readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
94
+ readonly dimOpacity: 0.2;
95
+ }>, {}, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
96
+ /** The series' points, as its line has them. */
97
+ readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
98
+ /** The line the area fills down to, at the same x positions; empty for the baseline. */
99
+ readonly base: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
100
+ /** Pixel y of the baseline. */
101
+ readonly baseline: 0;
102
+ readonly curve: import("@motionscript/sdk").Type<LineCurve, LineCurve, false>;
103
+ readonly area: import("@motionscript/sdk").Type<"none" | "solid" | "gradient", "none" | "solid" | "gradient", false>;
104
+ /** The series colour; the area paints it at `areaOpacity`, a gradient fading it out towards the bottom. */
105
+ readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
106
+ readonly areaOpacity: 0.4;
107
+ readonly progress: 1;
108
+ readonly enabled: true;
109
+ readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
110
+ readonly dimOpacity: 0.2;
111
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
112
+ /** The series' points, as its line has them. */
113
+ readonly points: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
114
+ /** The line the area fills down to, at the same x positions; empty for the baseline. */
115
+ readonly base: import("@motionscript/sdk").Type<Vector2[], Vector2[], false>;
116
+ /** Pixel y of the baseline. */
117
+ readonly baseline: 0;
118
+ readonly curve: import("@motionscript/sdk").Type<LineCurve, LineCurve, false>;
119
+ readonly area: import("@motionscript/sdk").Type<"none" | "solid" | "gradient", "none" | "solid" | "gradient", false>;
120
+ /** The series colour; the area paints it at `areaOpacity`, a gradient fading it out towards the bottom. */
121
+ readonly fill: import("@motionscript/sdk").Type<Fill, FillResolved[], false>;
122
+ readonly areaOpacity: 0.4;
123
+ readonly progress: 1;
124
+ readonly enabled: true;
125
+ readonly spotlight: import("@motionscript/sdk").Type<RegionBox, RegionBox, false>;
126
+ readonly dimOpacity: 0.2;
127
+ }>, {}, _Node2D<_Node2DProps>>>>;
128
+ interface Span {
129
+ readonly top: number;
130
+ readonly bottom: number;
131
+ }
132
+ /**
133
+ * The area's paint for an outline spanning `own`: the series colour at
134
+ * `opacity`, or for a gradient that colour fading to nearly nothing across
135
+ * `whole`. A gradient maps onto the bounds of the shape it fills, so its ends
136
+ * are placed in `own`'s unit box (y-up) at `whole`'s top and bottom.
137
+ */
138
+ export declare function areaFill(colour: FillResolved[], area: "none" | "solid" | "gradient", opacity: number, whole: Span, own: Span): FillResolved[];
139
+ export type ChartArea = NodeOf<typeof ChartArea>;
140
+ export {};
49
141
  //# 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,IAAI,YAAY,EAChC,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAkCjB,oMAAoM;AACpM,eAAO,MAAM,SAAS;IAGlB,qGAAqG;;;IAGrG,yHAAyH;;IAEzH,4EAA4E;;IAE5E,6EAA6E;;;;;;;;;IAP7E,qGAAqG;;;IAGrG,yHAAyH;;IAEzH,4EAA4E;;IAE5E,6EAA6E;;;;IAP7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R3G,gDAAgD;;IAEhD,wFAAwF;;IAExF,+BAA+B;;;;IAI/B,2GAA2G;;;;;;;gCAkC7G,CAAA;AAEF,UAAU,IAAI;IACZ,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAYD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,YAAY,EAAE,CAY7I;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA"}
@@ -1,49 +1,51 @@
1
- import { Graphics2D, Types, component2d, strokeOps, } from "@motionscript/sdk";
1
+ import { Graphics2D, Types, clamp, component2d, fillOps, strokeOps, } from "@motionscript/sdk";
2
+ import { fade } from "../kit/cartesian.js";
2
3
  import { fresh } from "../kit/entries.js";
3
4
  import { frameEase } from "../kit/motion.js";
4
5
  import { loadPaints } from "../kit/paints.js";
5
6
  import { SPOTLIGHT_DIM } from "../kit/shared.js";
6
- import { EMPTY_REGION_BOX, clipPolylineToBox, hasRegion, } from "./shared.js";
7
- /** The prefix of `pts` revealed at fraction `p`, measured by cumulative arc length so the trace keeps a steady pace over uneven spacing. */
8
- function tracePoints(pts, p) {
9
- if (p >= 1 || pts.length < 2)
10
- return pts;
11
- if (p <= 0)
12
- return [];
13
- const segLen = [];
14
- let total = 0;
15
- for (let i = 1; i < pts.length; i++) {
16
- const d = Math.hypot(pts[i].x - pts[i - 1].x, pts[i].y - pts[i - 1].y);
17
- segLen.push(d);
18
- total += d;
19
- }
20
- if (total === 0)
21
- return pts;
22
- let target = total * p;
23
- const out = [pts[0]];
24
- for (let i = 0; i < segLen.length; i++) {
25
- if (target >= segLen[i]) {
26
- out.push(pts[i + 1]);
27
- target -= segLen[i];
28
- }
29
- else {
30
- const t = segLen[i] === 0 ? 0 : target / segLen[i];
31
- out.push({
32
- x: pts[i].x + (pts[i + 1].x - pts[i].x) * t,
33
- y: pts[i].y + (pts[i + 1].y - pts[i].y) * t,
34
- });
35
- break;
36
- }
37
- }
38
- return out;
7
+ import { EMPTY_REGION_BOX, clipPolygonToBox, clipPolylineToBox, cutAt, curvePoints, hasRegion, } from "./shared.js";
8
+ /** The x a trace at `progress` has reached, across `points` ordered along x. */
9
+ export function traceX(points, progress) {
10
+ if (points.length === 0)
11
+ return 0;
12
+ const first = points[0].x;
13
+ const last = points[points.length - 1].x;
14
+ return progress >= 1 ? Infinity : first + (last - first) * progress;
39
15
  }
40
- /** 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. */
16
+ /** The drawn path at `progress`: the whole curve once traced, else the part left of the trace. */
17
+ function traced(points, curve, progress) {
18
+ const path = curvePoints(points, curve);
19
+ return progress >= 1 ? path : cutAt(path, traceX(points, progress));
20
+ }
21
+ const curveEntry = () => Types.custom("smooth");
22
+ /** A closed outline as path commands. */
23
+ function outlineCommands(points) {
24
+ return [...points.map((p, i) => ({ type: i === 0 ? "M" : "L", x: p.x, y: p.y })), { type: "Z" }];
25
+ }
26
+ function fillOutline(ctx, outline, fill, opacity) {
27
+ if (outline.length < 3 || opacity <= 0)
28
+ return;
29
+ const { width, height } = ctx.size;
30
+ // A frame symmetric about the origin, so the outline draws where its points say rather than re-centred on itself.
31
+ const centerBounds = [-width / 2, -height / 2, width / 2, height / 2];
32
+ ctx.draw(new Graphics2D().path({ data: outlineCommands(outline), centerBounds }).fill(fill).opacity(opacity));
33
+ }
34
+ /**
35
+ * One series of a {@link LineChart}: its line through pre-mapped pixel `points`,
36
+ * shaped by `curve`, and a dot on each point. `progress` traces it in from the
37
+ * left; `enabled` shows or hides it wholesale.
38
+ */
41
39
  export const ChartLine = component2d({
42
40
  key: "chartLine",
43
41
  state: {
44
42
  /** In this node's pixel space (origin at centre, y-up), mapped by the parent and ordered along x. */
45
43
  points: fresh(() => []),
44
+ curve: curveEntry(),
46
45
  stroke: Types.custom([], { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),
46
+ /** A dot of `dotSize` on each point, in `dotFill`; none at size 0. */
47
+ dotSize: 0,
48
+ dotFill: Types.custom([], { resolve: fillOps.resolve, lerp: fillOps.lerp }),
47
49
  /** Trace from the left end, `[0, 1]`. Rests at 1 so a paused editor canvas paints the line; `enter` drives it from 0. */
48
50
  progress: 1,
49
51
  /** Whether the line is drawn at all, flipped alongside its legend entry. */
@@ -52,7 +54,7 @@ export const ChartLine = component2d({
52
54
  spotlight: fresh(() => EMPTY_REGION_BOX),
53
55
  dimOpacity: SPOTLIGHT_DIM,
54
56
  },
55
- load: (loader, state) => loadPaints(loader, { strokes: [state.stroke] }),
57
+ load: (loader, state) => loadPaints(loader, { fills: [state.dotFill], strokes: [state.stroke] }),
56
58
  commands: {
57
59
  /**
58
60
  * Trace the line from `from` to `to`; `showSeries`/`hideSeries` are this with
@@ -72,35 +74,145 @@ export const ChartLine = component2d({
72
74
  });
73
75
  },
74
76
  },
77
+ /** Hold the line fully traced while its chart moves it, switched on throughout a show and off once a hide lands. */
78
+ hold: {
79
+ args: { shown: Types.boolean(true) },
80
+ run: (timeline) => {
81
+ const { shown } = timeline.args;
82
+ return timeline.animate((t) => ({ progress: 1, enabled: shown || t < 1 }), { eased: false });
83
+ },
84
+ },
75
85
  },
76
86
  render: (ctx, state) => {
77
87
  if (!state.enabled)
78
88
  return;
79
89
  const pts = state.points;
80
- if (pts.length < 2)
90
+ const p = clamp(state.progress, 0, 1);
91
+ if (pts.length === 0 || p <= 0)
81
92
  return;
82
- const p = Math.max(0, Math.min(1, state.progress));
83
- if (p <= 0)
93
+ const box = state.spotlight;
94
+ const lit = hasRegion(box);
95
+ const dim = clamp(state.dimOpacity, 0, 1);
96
+ const stroke = state.stroke;
97
+ const weight = stroke[0]?.weight ?? 0;
98
+ const drawn = traced(pts, state.curve, p);
99
+ if (drawn.length >= 2 && weight > 0) {
100
+ // Rounded corners only where the line has corners to round.
101
+ const radius = state.curve === "linear" ? weight * 2 : 0;
102
+ ctx.draw(new Graphics2D().line({ points: drawn, radius }).stroke(stroke).opacity(lit ? dim : 1));
103
+ // One `draw` per run: shapes chained before `stroke()` combine into one surface, and stroking a union of disjoint open paths paints nothing.
104
+ if (lit)
105
+ for (const run of clipPolylineToBox(drawn, box))
106
+ ctx.draw(new Graphics2D().line({ points: run, radius }).stroke(stroke));
107
+ }
108
+ const size = state.dotSize;
109
+ if (size <= 0)
84
110
  return;
85
- const drawn = tracePoints(pts, p);
86
- if (drawn.length < 2)
111
+ const reach = traceX(pts, p);
112
+ const bright = new Graphics2D();
113
+ const dimmed = new Graphics2D();
114
+ let brightAny = false;
115
+ let dimAny = false;
116
+ for (const pt of pts) {
117
+ // A dot grows in as the trace passes it.
118
+ const grown = reach === Infinity ? 1 : clamp((reach - pt.x) / (size * 2), 0, 1);
119
+ if (grown <= 0)
120
+ continue;
121
+ const inside = !lit || (pt.x >= box.left && pt.x <= box.right && pt.y >= box.bottom && pt.y <= box.top);
122
+ (inside ? bright : dimmed).ellipse({ x: pt.x, y: pt.y, width: size * grown, height: size * grown });
123
+ if (inside)
124
+ brightAny = true;
125
+ else
126
+ dimAny = true;
127
+ }
128
+ if (dimAny)
129
+ ctx.draw(dimmed.fill(state.dotFill).opacity(dim));
130
+ if (brightAny)
131
+ ctx.draw(bright.fill(state.dotFill));
132
+ },
133
+ });
134
+ /**
135
+ * The fill under one series of a {@link LineChart}: down to `base` (the series
136
+ * below it in a stack) or, without one, to the `baseline`. Drawn by its own node
137
+ * so every area sits under every line; the chart binds its trace, switch and
138
+ * opacity to its line's, so the two move as one.
139
+ */
140
+ export const ChartArea = component2d({
141
+ key: "chartArea",
142
+ state: {
143
+ /** The series' points, as its line has them. */
144
+ points: fresh(() => []),
145
+ /** The line the area fills down to, at the same x positions; empty for the baseline. */
146
+ base: fresh(() => []),
147
+ /** Pixel y of the baseline. */
148
+ baseline: 0,
149
+ curve: curveEntry(),
150
+ area: Types.custom("solid"),
151
+ /** The series colour; the area paints it at `areaOpacity`, a gradient fading it out towards the bottom. */
152
+ fill: Types.custom([], { resolve: fillOps.resolve, lerp: fillOps.lerp }),
153
+ areaOpacity: 0.4,
154
+ progress: 1,
155
+ enabled: true,
156
+ spotlight: fresh(() => EMPTY_REGION_BOX),
157
+ dimOpacity: SPOTLIGHT_DIM,
158
+ },
159
+ load: (loader, state) => loadPaints(loader, { fills: [state.fill] }),
160
+ render: (ctx, state) => {
161
+ const pts = state.points;
162
+ const p = clamp(state.progress, 0, 1);
163
+ if (!state.enabled || state.area === "none" || pts.length < 2 || p <= 0 || state.fill.length === 0)
87
164
  return;
88
- const stroke = state.stroke;
89
- const radius = (stroke[0]?.weight ?? 0) * 2;
165
+ const outlineAt = (progress) => {
166
+ const top = traced(pts, state.curve, progress);
167
+ if (top.length < 2)
168
+ return [];
169
+ const base = state.base.length === pts.length
170
+ ? traced(state.base, state.curve, progress)
171
+ : [{ x: top[0].x, y: state.baseline }, { x: top[top.length - 1].x, y: state.baseline }];
172
+ return [...top, ...[...base].reverse()];
173
+ };
174
+ // The gradient spans the whole area's height, so it holds still while the area traces in and across a spotlight's cut.
175
+ const span = verticalSpan(outlineAt(1));
176
+ const paint = (outline, opacity) => fillOutline(ctx, outline, areaFill(state.fill, state.area, state.areaOpacity, span, verticalSpan(outline)), opacity);
177
+ const outline = outlineAt(p);
90
178
  const box = state.spotlight;
91
179
  if (!hasRegion(box)) {
92
- ctx.draw(new Graphics2D().line({ points: drawn, radius }).stroke(stroke));
180
+ paint(outline, 1);
93
181
  return;
94
182
  }
95
- // 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.
96
- ctx.draw(new Graphics2D()
97
- .line({ points: drawn, radius })
98
- .stroke(stroke)
99
- .opacity(Math.max(0, Math.min(1, state.dimOpacity))));
100
- // One `draw` per run: shapes chained before `stroke()` combine into one surface, and stroking a union of disjoint open paths paints nothing.
101
- for (const run of clipPolylineToBox(drawn, box)) {
102
- ctx.draw(new Graphics2D().line({ points: run, radius }).stroke(stroke));
103
- }
183
+ paint(outline, clamp(state.dimOpacity, 0, 1));
184
+ paint(clipPolygonToBox(outline, box), 1);
104
185
  },
105
186
  });
187
+ function verticalSpan(points) {
188
+ let top = -Infinity;
189
+ let bottom = Infinity;
190
+ for (const p of points) {
191
+ if (p.y > top)
192
+ top = p.y;
193
+ if (p.y < bottom)
194
+ bottom = p.y;
195
+ }
196
+ return { top, bottom };
197
+ }
198
+ /**
199
+ * The area's paint for an outline spanning `own`: the series colour at
200
+ * `opacity`, or for a gradient that colour fading to nearly nothing across
201
+ * `whole`. A gradient maps onto the bounds of the shape it fills, so its ends
202
+ * are placed in `own`'s unit box (y-up) at `whole`'s top and bottom.
203
+ */
204
+ export function areaFill(colour, area, opacity, whole, own) {
205
+ const top = colour[colour.length - 1];
206
+ if (area !== "gradient" || top?.type !== "solid" || !(own.top > own.bottom))
207
+ return fade(colour, opacity);
208
+ const [r, g, b, a] = top.color;
209
+ const middle = (own.top + own.bottom) / 2;
210
+ const half = (own.top - own.bottom) / 2;
211
+ return fillOps.resolve({
212
+ type: "linear-gradient",
213
+ colors: [[r, g, b, a * opacity], [r, g, b, a * opacity * 0.04]],
214
+ start: { x: 0, y: (whole.top - middle) / half },
215
+ end: { x: 0, y: (whole.bottom - middle) / half },
216
+ });
217
+ }
106
218
  //# sourceMappingURL=chart-line.js.map
@@ -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,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zE,CAAC;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n Graphics2D,\n Types,\n component2d,\n strokeOps,\n type NodeOf,\n // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Stroke,\n type StrokeResolved,\n type Vector2,\n} from \"@motionscript/sdk\"\n\nimport { fresh } from \"../kit/entries\"\nimport { frameEase } from \"../kit/motion\"\nimport { loadPaints } from \"../kit/paints\"\nimport { SPOTLIGHT_DIM } from \"../kit/shared\"\nimport {\n EMPTY_REGION_BOX,\n clipPolylineToBox,\n hasRegion,\n type RegionBox,\n} from \"./shared\"\n\n/** The prefix of `pts` revealed at fraction `p`, measured by cumulative arc length so the trace keeps a steady pace over uneven spacing. */\nfunction tracePoints(pts: Vector2[], p: number): Vector2[] {\n if (p >= 1 || pts.length < 2) return pts\n if (p <= 0) return []\n\n const segLen: number[] = []\n let total = 0\n for (let i = 1; i < pts.length; i++) {\n const d = Math.hypot(pts[i].x - pts[i - 1].x, pts[i].y - pts[i - 1].y)\n segLen.push(d)\n total += d\n }\n if (total === 0) return pts\n\n let target = total * p\n const out: Vector2[] = [pts[0]]\n for (let i = 0; i < segLen.length; i++) {\n if (target >= segLen[i]) {\n out.push(pts[i + 1])\n target -= segLen[i]\n } else {\n const t = segLen[i] === 0 ? 0 : target / segLen[i]\n out.push({\n x: pts[i].x + (pts[i + 1].x - pts[i].x) * t,\n y: pts[i].y + (pts[i + 1].y - pts[i].y) * t,\n })\n break\n }\n }\n return out\n}\n\n/** 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. */\nexport const ChartLine = component2d({\n key: \"chartLine\",\n state: {\n /** In this node's pixel space (origin at centre, y-up), mapped by the parent and ordered along x. */\n points: fresh<Vector2[]>(() => []),\n stroke: Types.custom<Stroke, StrokeResolved[]>([], { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),\n /** Trace from the left end, `[0, 1]`. Rests at 1 so a paused editor canvas paints the line; `enter` drives it from 0. */\n progress: 1,\n /** Whether the line is drawn at all, flipped alongside its legend entry. */\n enabled: true,\n /** In this node's pixel space; outside it the line drops to `dimOpacity`. */\n spotlight: fresh<RegionBox>(() => EMPTY_REGION_BOX),\n dimOpacity: SPOTLIGHT_DIM,\n },\n load: (loader, state) => loadPaints(loader, { strokes: [state.stroke] }),\n commands: {\n /**\n * Trace the line from `from` to `to`; `showSeries`/`hideSeries` are this with\n * the ends stated. `enabled` rides along in the same value, so the line is\n * drawable for every `t` the trace covers and arriving backwards matches\n * arriving forwards.\n */\n enter: {\n args: { from: Types.number(0, { min: 0, max: 1 }), to: Types.number(1, { min: 0, max: 1 }) },\n run: (timeline) => {\n const { from, to } = timeline.args\n const ease = frameEase(timeline)\n return timeline.animate((t) => {\n const progress = from + (to - from) * ease(t)\n // Hidden only once fully retraced, so a hide does not vanish a frame early.\n return { progress, enabled: progress > 0 }\n })\n },\n },\n },\n render: (ctx, state) => {\n if (!state.enabled) return\n const pts = state.points\n if (pts.length < 2) return\n\n const p = Math.max(0, Math.min(1, state.progress))\n if (p <= 0) return\n\n const drawn = tracePoints(pts, p)\n if (drawn.length < 2) return\n const stroke = state.stroke\n const radius = (stroke[0]?.weight ?? 0) * 2\n\n const box = state.spotlight\n if (!hasRegion(box)) {\n ctx.draw(new Graphics2D().line({ points: drawn, radius }).stroke(stroke))\n return\n }\n\n // 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.\n ctx.draw(\n new Graphics2D()\n .line({ points: drawn, radius })\n .stroke(stroke)\n .opacity(Math.max(0, Math.min(1, state.dimOpacity)))\n )\n\n // One `draw` per run: shapes chained before `stroke()` combine into one surface, and stroking a union of disjoint open paths paints nothing.\n for (const run of clipPolylineToBox(drawn, box)) {\n ctx.draw(new Graphics2D().line({ points: run, radius }).stroke(stroke))\n }\n },\n})\n\nexport type ChartL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AG,GAAG,CAAC,KAAK,CAAA;IAC9B,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACvC,OAAO,OAAO,CAAC,OAAO,CAAC;QACrB,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;QAC/D,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,EAAE;QAC/C,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,EAAE;KACjD,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n Graphics2D,\n Types,\n clamp,\n component2d,\n fillOps,\n strokeOps,\n type Fill,\n type FillResolved,\n type NodeOf,\n // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type PathCommand,\n type RenderContext,\n type Stroke,\n type StrokeResolved,\n type Vector2,\n} from \"@motionscript/sdk\"\n\nimport { fade } from \"../kit/cartesian\"\nimport { fresh } from \"../kit/entries\"\nimport { frameEase } from \"../kit/motion\"\nimport { loadPaints } from \"../kit/paints\"\nimport { SPOTLIGHT_DIM } from \"../kit/shared\"\nimport {\n EMPTY_REGION_BOX,\n clipPolygonToBox,\n clipPolylineToBox,\n cutAt,\n curvePoints,\n hasRegion,\n type LineCurve,\n type RegionBox,\n} from \"./shared\"\n\n/** The x a trace at `progress` has reached, across `points` ordered along x. */\nexport function traceX(points: readonly Vector2[], progress: number): number {\n if (points.length === 0) return 0\n const first = points[0].x\n const last = points[points.length - 1].x\n return progress >= 1 ? Infinity : first + (last - first) * progress\n}\n\n/** The drawn path at `progress`: the whole curve once traced, else the part left of the trace. */\nfunction traced(points: readonly Vector2[], curve: LineCurve, progress: number): Vector2[] {\n const path = curvePoints(points, curve)\n return progress >= 1 ? path : cutAt(path, traceX(points, progress))\n}\n\nconst curveEntry = () => Types.custom<LineCurve>(\"smooth\")\n\n/** A closed outline as path commands. */\nfunction outlineCommands(points: readonly Vector2[]): PathCommand[] {\n return [...points.map((p, i): PathCommand => ({ type: i === 0 ? \"M\" : \"L\", x: p.x, y: p.y })), { type: \"Z\" }]\n}\n\nfunction fillOutline(ctx: RenderContext, outline: readonly Vector2[], fill: FillResolved[], opacity: number): void {\n if (outline.length < 3 || opacity <= 0) return\n const { width, height } = ctx.size\n // A frame symmetric about the origin, so the outline draws where its points say rather than re-centred on itself.\n const centerBounds: [number, number, number, number] = [-width / 2, -height / 2, width / 2, height / 2]\n ctx.draw(new Graphics2D().path({ data: outlineCommands(outline), centerBounds }).fill(fill).opacity(opacity))\n}\n\n/**\n * One series of a {@link LineChart}: its line through pre-mapped pixel `points`,\n * shaped by `curve`, and a dot on each point. `progress` traces it in from the\n * left; `enabled` shows or hides it wholesale.\n */\nexport const ChartLine = component2d({\n key: \"chartLine\",\n state: {\n /** In this node's pixel space (origin at centre, y-up), mapped by the parent and ordered along x. */\n points: fresh<Vector2[]>(() => []),\n curve: curveEntry(),\n stroke: Types.custom<Stroke, StrokeResolved[]>([], { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),\n /** A dot of `dotSize` on each point, in `dotFill`; none at size 0. */\n dotSize: 0,\n dotFill: Types.custom<Fill, FillResolved[]>([], { resolve: fillOps.resolve, lerp: fillOps.lerp }),\n /** Trace from the left end, `[0, 1]`. Rests at 1 so a paused editor canvas paints the line; `enter` drives it from 0. */\n progress: 1,\n /** Whether the line is drawn at all, flipped alongside its legend entry. */\n enabled: true,\n /** In this node's pixel space; outside it the line drops to `dimOpacity`. */\n spotlight: fresh<RegionBox>(() => EMPTY_REGION_BOX),\n dimOpacity: SPOTLIGHT_DIM,\n },\n load: (loader, state) => loadPaints(loader, { fills: [state.dotFill], strokes: [state.stroke] }),\n commands: {\n /**\n * Trace the line from `from` to `to`; `showSeries`/`hideSeries` are this with\n * the ends stated. `enabled` rides along in the same value, so the line is\n * drawable for every `t` the trace covers and arriving backwards matches\n * arriving forwards.\n */\n enter: {\n args: { from: Types.number(0, { min: 0, max: 1 }), to: Types.number(1, { min: 0, max: 1 }) },\n run: (timeline) => {\n const { from, to } = timeline.args\n const ease = frameEase(timeline)\n return timeline.animate((t) => {\n const progress = from + (to - from) * ease(t)\n // Hidden only once fully retraced, so a hide does not vanish a frame early.\n return { progress, enabled: progress > 0 }\n })\n },\n },\n /** Hold the line fully traced while its chart moves it, switched on throughout a show and off once a hide lands. */\n hold: {\n args: { shown: Types.boolean(true) },\n run: (timeline) => {\n const { shown } = timeline.args\n return timeline.animate((t) => ({ progress: 1, enabled: shown || t < 1 }), { eased: false })\n },\n },\n },\n render: (ctx, state) => {\n if (!state.enabled) return\n const pts = state.points\n const p = clamp(state.progress, 0, 1)\n if (pts.length === 0 || p <= 0) return\n\n const box = state.spotlight\n const lit = hasRegion(box)\n const dim = clamp(state.dimOpacity, 0, 1)\n const stroke = state.stroke\n const weight = stroke[0]?.weight ?? 0\n const drawn = traced(pts, state.curve, p)\n\n if (drawn.length >= 2 && weight > 0) {\n // Rounded corners only where the line has corners to round.\n const radius = state.curve === \"linear\" ? weight * 2 : 0\n ctx.draw(new Graphics2D().line({ points: drawn, radius }).stroke(stroke).opacity(lit ? dim : 1))\n // One `draw` per run: shapes chained before `stroke()` combine into one surface, and stroking a union of disjoint open paths paints nothing.\n if (lit) for (const run of clipPolylineToBox(drawn, box)) ctx.draw(new Graphics2D().line({ points: run, radius }).stroke(stroke))\n }\n\n const size = state.dotSize\n if (size <= 0) return\n const reach = traceX(pts, p)\n const bright = new Graphics2D()\n const dimmed = new Graphics2D()\n let brightAny = false\n let dimAny = false\n for (const pt of pts) {\n // A dot grows in as the trace passes it.\n const grown = reach === Infinity ? 1 : clamp((reach - pt.x) / (size * 2), 0, 1)\n if (grown <= 0) continue\n const inside = !lit || (pt.x >= box.left && pt.x <= box.right && pt.y >= box.bottom && pt.y <= box.top)\n ;(inside ? bright : dimmed).ellipse({ x: pt.x, y: pt.y, width: size * grown, height: size * grown })\n if (inside) brightAny = true\n else dimAny = true\n }\n if (dimAny) ctx.draw(dimmed.fill(state.dotFill).opacity(dim))\n if (brightAny) ctx.draw(bright.fill(state.dotFill))\n },\n})\n\nexport type ChartLine = NodeOf<typeof ChartLine>\n\n/**\n * The fill under one series of a {@link LineChart}: down to `base` (the series\n * below it in a stack) or, without one, to the `baseline`. Drawn by its own node\n * so every area sits under every line; the chart binds its trace, switch and\n * opacity to its line's, so the two move as one.\n */\nexport const ChartArea = component2d({\n key: \"chartArea\",\n state: {\n /** The series' points, as its line has them. */\n points: fresh<Vector2[]>(() => []),\n /** The line the area fills down to, at the same x positions; empty for the baseline. */\n base: fresh<Vector2[]>(() => []),\n /** Pixel y of the baseline. */\n baseline: 0,\n curve: curveEntry(),\n area: Types.custom<\"none\" | \"solid\" | \"gradient\">(\"solid\"),\n /** The series colour; the area paints it at `areaOpacity`, a gradient fading it out towards the bottom. */\n fill: Types.custom<Fill, FillResolved[]>([], { resolve: fillOps.resolve, lerp: fillOps.lerp }),\n areaOpacity: 0.4,\n progress: 1,\n enabled: true,\n spotlight: fresh<RegionBox>(() => EMPTY_REGION_BOX),\n dimOpacity: SPOTLIGHT_DIM,\n },\n load: (loader, state) => loadPaints(loader, { fills: [state.fill] }),\n render: (ctx, state) => {\n const pts = state.points\n const p = clamp(state.progress, 0, 1)\n if (!state.enabled || state.area === \"none\" || pts.length < 2 || p <= 0 || state.fill.length === 0) return\n const outlineAt = (progress: number) => {\n const top = traced(pts, state.curve, progress)\n if (top.length < 2) return []\n const base = state.base.length === pts.length\n ? traced(state.base, state.curve, progress)\n : [{ x: top[0].x, y: state.baseline }, { x: top[top.length - 1].x, y: state.baseline }]\n return [...top, ...[...base].reverse()]\n }\n // The gradient spans the whole area's height, so it holds still while the area traces in and across a spotlight's cut.\n const span = verticalSpan(outlineAt(1))\n const paint = (outline: readonly Vector2[], opacity: number) =>\n fillOutline(ctx, outline, areaFill(state.fill, state.area, state.areaOpacity, span, verticalSpan(outline)), opacity)\n const outline = outlineAt(p)\n const box = state.spotlight\n if (!hasRegion(box)) {\n paint(outline, 1)\n return\n }\n paint(outline, clamp(state.dimOpacity, 0, 1))\n paint(clipPolygonToBox(outline, box), 1)\n },\n})\n\ninterface Span {\n readonly top: number\n readonly bottom: number\n}\n\nfunction verticalSpan(points: readonly Vector2[]): Span {\n let top = -Infinity\n let bottom = Infinity\n for (const p of points) {\n if (p.y > top) top = p.y\n if (p.y < bottom) bottom = p.y\n }\n return { top, bottom }\n}\n\n/**\n * The area's paint for an outline spanning `own`: the series colour at\n * `opacity`, or for a gradient that colour fading to nearly nothing across\n * `whole`. A gradient maps onto the bounds of the shape it fills, so its ends\n * are placed in `own`'s unit box (y-up) at `whole`'s top and bottom.\n */\nexport function areaFill(colour: FillResolved[], area: \"none\" | \"solid\" | \"gradient\", opacity: number, whole: Span, own: Span): FillResolved[] {\n const top = colour[colour.length - 1]\n if (area !== \"gradient\" || top?.type !== \"solid\" || !(own.top > own.bottom)) return fade(colour, opacity) as FillResolved[]\n const [r, g, b, a] = top.color\n const middle = (own.top + own.bottom) / 2\n const half = (own.top - own.bottom) / 2\n return fillOps.resolve({\n type: \"linear-gradient\",\n colors: [[r, g, b, a * opacity], [r, g, b, a * opacity * 0.04]],\n start: { x: 0, y: (whole.top - middle) / half },\n end: { x: 0, y: (whole.bottom - middle) / half },\n })\n}\n\nexport type ChartArea = NodeOf<typeof ChartArea>\n"]}
@@ -3,7 +3,7 @@ import { type RegionBox } from "./shared.js";
3
3
  /**
4
4
  * The call-out of a {@link LineChart}: a washed rectangle with a dashed rule on
5
5
  * each bounded edge, drawn from the pre-mapped `box`. Dimming the series outside
6
- * is {@link ChartLine}'s job, clipped against the same box so the two agree on
6
+ * is the line's and area's job, clipped against the same box so they agree on
7
7
  * the boundary. An unbounded edge is the plot's own border, and a rule there
8
8
  * would assert a limit the author did not set.
9
9
  */
@@ -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,IAAI,YAAY,EAChC,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAI1B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAEjB;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;IAGpB,iHAAiH;;;;IAIjH,8FAA8F;;;IAJ9F,iHAAiH;;;;IAIjH,8FAA8F;;;IAJ9F,iHAAiH;;;;IAIjH,8FAA8F;;gCAmChG,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,WAAW,IAAI,YAAY,EAChC,KAAK,MAAM,EACX,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAK1B,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,UAAU,CAAA;AAEjB;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;IAGpB,iHAAiH;;;;IAIjH,8FAA8F;;;IAJ9F,iHAAiH;;;;IAIjH,8FAA8F;;;IAJ9F,iHAAiH;;;;IAIjH,8FAA8F;;gCA+BhG,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAA"}
@@ -1,11 +1,12 @@
1
1
  import { Graphics2D, Types, component2d, fillOps, strokeOps, } from "@motionscript/sdk";
2
+ import { rule } from "../kit/chart-canvas.js";
2
3
  import { fresh } from "../kit/entries.js";
3
4
  import { loadPaints } from "../kit/paints.js";
4
- import { DEFAULT_CHART_THEME, EMPTY_REGION_BOX, hasRegion, } from "./shared.js";
5
+ import { EMPTY_REGION_BOX, hasRegion, } from "./shared.js";
5
6
  /**
6
7
  * The call-out of a {@link LineChart}: a washed rectangle with a dashed rule on
7
8
  * each bounded edge, drawn from the pre-mapped `box`. Dimming the series outside
8
- * is {@link ChartLine}'s job, clipped against the same box so the two agree on
9
+ * is the line's and area's job, clipped against the same box so they agree on
9
10
  * the boundary. An unbounded edge is the plot's own border, and a rule there
10
11
  * would assert a limit the author did not set.
11
12
  */
@@ -14,8 +15,8 @@ export const ChartRegion = component2d({
14
15
  state: {
15
16
  /** In this node's pixel space (origin at centre, y-up), mapped by the parent. A degenerate box draws nothing. */
16
17
  box: fresh(() => EMPTY_REGION_BOX),
17
- stroke: Types.custom(DEFAULT_CHART_THEME.region.stroke, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),
18
- fill: Types.custom(DEFAULT_CHART_THEME.region.fill, { resolve: fillOps.resolve, lerp: fillOps.lerp }),
18
+ stroke: Types.custom({ weight: 2, fill: "white/70", dash: [14, 12], cap: "butt", align: "center" }, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),
19
+ fill: Types.custom("white/6", { resolve: fillOps.resolve, lerp: fillOps.lerp }),
19
20
  /** Driven by the chart's `regionReveal`, so the rules and the series' dimming move as one. */
20
21
  reveal: 0,
21
22
  },
@@ -36,17 +37,15 @@ export const ChartRegion = component2d({
36
37
  }
37
38
  if (state.stroke.length === 0)
38
39
  return;
39
- // One `draw` per rule: stroking a union of disjoint open paths paints nothing.
40
- const rule = (points) => ctx.draw(new Graphics2D().line({ points }).stroke(state.stroke).opacity(r));
41
40
  if (box.xBounded) {
42
41
  const half = (height / 2) * r;
43
42
  for (const x of [box.left, box.right])
44
- rule([{ x, y: cy - half }, { x, y: cy + half }]);
43
+ rule(ctx, { x, y: cy - half }, { x, y: cy + half }, state.stroke, r);
45
44
  }
46
45
  if (box.yBounded) {
47
46
  const half = (width / 2) * r;
48
47
  for (const y of [box.bottom, box.top])
49
- rule([{ x: cx - half, y }, { x: cx + half, y }]);
48
+ rule(ctx, { x: cx - half, y }, { x: cx + half, y }, state.stroke, r);
50
49
  }
51
50
  },
52
51
  });
@@ -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;AAEjB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;IACrC,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE;QACL,iHAAiH;QACjH,GAAG,EAAE,KAAK,CAAY,GAAG,EAAE,CAAC,gBAAgB,CAAC;QAC7C,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,IAAI,EAAE,KAAK,CAAC,MAA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\n fillOps,\n strokeOps,\n type Fill,\n type FillResolved,\n type NodeOf,\n // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Stroke,\n type StrokeResolved,\n} from \"@motionscript/sdk\"\n\nimport { fresh } from \"../kit/entries\"\nimport { loadPaints } from \"../kit/paints\"\nimport {\n DEFAULT_CHART_THEME,\n EMPTY_REGION_BOX,\n hasRegion,\n type RegionBox,\n} from \"./shared\"\n\n/**\n * The call-out of a {@link LineChart}: a washed rectangle with a dashed rule on\n * each bounded edge, drawn from the pre-mapped `box`. Dimming the series outside\n * is {@link ChartLine}'s job, clipped against the same box so the two agree on\n * the boundary. An unbounded edge is the plot's own border, and a rule there\n * would assert a limit the author did not set.\n */\nexport const ChartRegion = component2d({\n key: \"chartRegion\",\n state: {\n /** In this node's pixel space (origin at centre, y-up), mapped by the parent. A degenerate box draws nothing. */\n box: fresh<RegionBox>(() => EMPTY_REGION_BOX),\n stroke: Types.custom<Stroke, StrokeResolved[]>(DEFAULT_CHART_THEME.region.stroke, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),\n fill: Types.custom<Fill, FillResolved[]>(DEFAULT_CHART_THEME.region.fill, { resolve: fillOps.resolve, lerp: fillOps.lerp }),\n /** Driven by the chart's `regionReveal`, so the rules and the series' dimming move as one. */\n reveal: 0,\n },\n load: (loader, state) => loadPaints(loader, { fills: [state.fill], strokes: [state.stroke] }),\n render: (ctx, state) => {\n const box = state.box\n if (!hasRegion(box)) return\n\n const r = Math.max(0, Math.min(1, state.reveal))\n if (r <= 0) return\n\n const width = box.right - box.left\n const height = box.top - box.bottom\n const cx = (box.left + box.right) / 2\n const cy = (box.bottom + box.top) / 2\n\n if (state.fill.length > 0) {\n ctx.draw(new Graphics2D().rect({ x: cx, y: cy, width, height }).fill(state.fill).opacity(r))\n }\n\n if (state.stroke.length === 0) return\n\n // One `draw` per rule: stroking a union of disjoint open paths paints nothing.\n const rule = (points: { x: number; y: number }[]) =>\n ctx.draw(new Graphics2D().line({ points }).stroke(state.stroke).opacity(r))\n\n if (box.xBounded) {\n const half = (height / 2) * r\n for (const x of [box.left, box.right]) rule([{ x, y: cy - half }, { x, y: cy + half }])\n }\n if (box.yBounded) {\n const half = (width / 2) * r\n for (const y of [box.bottom, box.top]) rule([{ x: cx - half, y }, { x: cx + half, y }])\n }\n },\n})\n\nexport type ChartRegion = NodeOf<typeof ChartRegion>\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,GASV,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAChB,SAAS,GAEV,MAAM,UAAU,CAAA;AAEjB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;IACrC,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE;QACL,iHAAiH;QACjH,GAAG,EAAE,KAAK,CAAY,GAAG,EAAE,CAAC,gBAAgB,CAAC;QAC7C,MAAM,EAAE,KAAK,CAAC,MAAM,CAA2B,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;QACnL,IAAI,EAAE,KAAK,CAAC,MAAM,CAAuB,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EA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AC,CAAC,CAAC,CAAA;QAC9F,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QAErC,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,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QAC7G,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,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QAC7G,CAAC;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n Graphics2D,\n Types,\n component2d,\n fillOps,\n strokeOps,\n type Fill,\n type FillResolved,\n type NodeOf,\n // Named so this component's emitted type reaches `Node2D` and its props through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Stroke,\n type StrokeResolved,\n} from \"@motionscript/sdk\"\n\nimport { rule } from \"../kit/chart-canvas\"\nimport { fresh } from \"../kit/entries\"\nimport { loadPaints } from \"../kit/paints\"\nimport {\n EMPTY_REGION_BOX,\n hasRegion,\n type RegionBox,\n} from \"./shared\"\n\n/**\n * The call-out of a {@link LineChart}: a washed rectangle with a dashed rule on\n * each bounded edge, drawn from the pre-mapped `box`. Dimming the series outside\n * is the line's and area's job, clipped against the same box so they agree on\n * the boundary. An unbounded edge is the plot's own border, and a rule there\n * would assert a limit the author did not set.\n */\nexport const ChartRegion = component2d({\n key: \"chartRegion\",\n state: {\n /** In this node's pixel space (origin at centre, y-up), mapped by the parent. A degenerate box draws nothing. */\n box: fresh<RegionBox>(() => EMPTY_REGION_BOX),\n stroke: Types.custom<Stroke, StrokeResolved[]>({ weight: 2, fill: \"white/70\", dash: [14, 12], cap: \"butt\", align: \"center\" }, { resolve: strokeOps.resolve, lerp: strokeOps.lerp }),\n fill: Types.custom<Fill, FillResolved[]>(\"white/6\", { resolve: fillOps.resolve, lerp: fillOps.lerp }),\n /** Driven by the chart's `regionReveal`, so the rules and the series' dimming move as one. */\n reveal: 0,\n },\n load: (loader, state) => loadPaints(loader, { fills: [state.fill], strokes: [state.stroke] }),\n render: (ctx, state) => {\n const box = state.box\n if (!hasRegion(box)) return\n\n const r = Math.max(0, Math.min(1, state.reveal))\n if (r <= 0) return\n\n const width = box.right - box.left\n const height = box.top - box.bottom\n const cx = (box.left + box.right) / 2\n const cy = (box.bottom + box.top) / 2\n\n if (state.fill.length > 0) {\n ctx.draw(new Graphics2D().rect({ x: cx, y: cy, width, height }).fill(state.fill).opacity(r))\n }\n\n if (state.stroke.length === 0) return\n\n if (box.xBounded) {\n const half = (height / 2) * r\n for (const x of [box.left, box.right]) rule(ctx, { x, y: cy - half }, { x, y: cy + half }, state.stroke, r)\n }\n if (box.yBounded) {\n const half = (width / 2) * r\n for (const y of [box.bottom, box.top]) rule(ctx, { x: cx - half, y }, { x: cx + half, y }, state.stroke, r)\n }\n },\n})\n\nexport type ChartRegion = NodeOf<typeof ChartRegion>\n"]}
@@ -1,10 +1,9 @@
1
1
  export { LineChart, lineChartDomains } from "./line-chart.js";
2
- export type { LineChartDomains, LineChartValues } from "./line-chart.js";
2
+ export type { LineChartDomains, LineChartStyle, LineChartValues } from "./line-chart.js";
3
3
  export { ChartRegion } from "./chart-region.js";
4
- export { ChartLine } from "./chart-line.js";
5
- export { HorizontalAxis } from "./horizontal-axis.js";
6
- export { DEFAULT_CHART_THEME, EMPTY_REGION_BOX, clipPolylineToBox, hasRegion, lerpChartTheme, resolveChartTheme, resolveRegionBox, resolveYScale, seriesPoints, yExtent, } from "./shared.js";
7
- export type { ChartConfig, ChartTheme, LineSeries, PlotRegion, RegionBox, RegionConfig, } from "./shared.js";
8
- export { formatInstant, parseInstant, resolveXScale } from "./x-scale.js";
4
+ export { ChartArea, ChartLine, areaFill, traceX } from "./chart-line.js";
5
+ export { EMPTY_REGION_BOX, LINE_LABELS, LINE_MARKS, clipPolygonToBox, clipPolylineToBox, curvePoints, cutAt, hasRegion, resolveRegionBox, resolveYScale, seriesPoints, stackExtent, stackSeries, yExtent, } from "./shared.js";
6
+ export type { LineCurve, LineSeries, LineStack, PlotRegion, RegionBox, StackedSeries, } from "./shared.js";
7
+ export { EVERY_SAMPLE, formatInstant, parseInstant, resolveXScale } from "./x-scale.js";
9
8
  export type { XScale, XScaleKind } from "./x-scale.js";
10
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1D,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,OAAO,GACR,MAAM,UAAU,CAAA;AACjB,YAAY,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,GACb,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACtE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1D,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,KAAK,EACL,SAAS,EAET,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,OAAO,GACR,MAAM,UAAU,CAAA;AACjB,YAAY,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACpF,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA"}
@@ -1,7 +1,6 @@
1
1
  export { LineChart, lineChartDomains } from "./line-chart.js";
2
2
  export { ChartRegion } from "./chart-region.js";
3
- export { ChartLine } from "./chart-line.js";
4
- export { HorizontalAxis } from "./horizontal-axis.js";
5
- export { DEFAULT_CHART_THEME, EMPTY_REGION_BOX, clipPolylineToBox, hasRegion, lerpChartTheme, resolveChartTheme, resolveRegionBox, resolveYScale, seriesPoints, yExtent, } from "./shared.js";
6
- export { formatInstant, parseInstant, resolveXScale } from "./x-scale.js";
3
+ export { ChartArea, ChartLine, areaFill, traceX } from "./chart-line.js";
4
+ export { EMPTY_REGION_BOX, LINE_LABELS, LINE_MARKS, clipPolygonToBox, clipPolylineToBox, curvePoints, cutAt, hasRegion, resolveRegionBox, resolveYScale, seriesPoints, stackExtent, stackSeries, yExtent, } from "./shared.js";
5
+ export { EVERY_SAMPLE, formatInstant, parseInstant, resolveXScale } from "./x-scale.js";
7
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,OAAO,GACR,MAAM,UAAU,CAAA;AASjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA","sourcesContent":["export { LineChart, lineChartDomains } from \"./line-chart\"\nexport type { LineChartDomains, LineChartValues } from \"./line-chart\"\nexport { ChartRegion } from \"./chart-region\"\nexport { ChartLine } from \"./chart-line\"\nexport { HorizontalAxis } from \"./horizontal-axis\"\nexport {\n DEFAULT_CHART_THEME,\n EMPTY_REGION_BOX,\n clipPolylineToBox,\n hasRegion,\n lerpChartTheme,\n resolveChartTheme,\n resolveRegionBox,\n resolveYScale,\n seriesPoints,\n yExtent,\n} from \"./shared\"\nexport type {\n ChartConfig,\n ChartTheme,\n LineSeries,\n PlotRegion,\n RegionBox,\n RegionConfig,\n} from \"./shared\"\nexport { formatInstant, parseInstant, resolveXScale } from \"./x-scale\"\nexport type { XScale, XScaleKind } from \"./x-scale\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/line-chart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,KAAK,EACL,SAAS,EAET,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,OAAO,GACR,MAAM,UAAU,CAAA;AASjB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA","sourcesContent":["export { LineChart, lineChartDomains } from \"./line-chart\"\nexport type { LineChartDomains, LineChartStyle, LineChartValues } from \"./line-chart\"\nexport { ChartRegion } from \"./chart-region\"\nexport { ChartArea, ChartLine, areaFill, traceX } from \"./chart-line\"\nexport {\n EMPTY_REGION_BOX,\n LINE_LABELS,\n LINE_MARKS,\n clipPolygonToBox,\n clipPolylineToBox,\n curvePoints,\n cutAt,\n hasRegion,\n\n resolveRegionBox,\n resolveYScale,\n seriesPoints,\n stackExtent,\n stackSeries,\n yExtent,\n} from \"./shared\"\nexport type {\n LineCurve,\n LineSeries,\n LineStack,\n PlotRegion,\n RegionBox,\n StackedSeries,\n} from \"./shared\"\nexport { EVERY_SAMPLE, formatInstant, parseInstant, resolveXScale } from \"./x-scale\"\nexport type { XScale, XScaleKind } from \"./x-scale\"\n"]}