@motionscript/charts 0.1.0-alpha.0 → 0.1.0-alpha.10

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 (152) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/NOTICE +49 -0
  3. package/README.md +99 -0
  4. package/dist/bar-chart/bar-chart.d.ts +133 -228
  5. package/dist/bar-chart/bar-chart.d.ts.map +1 -1
  6. package/dist/bar-chart/bar-chart.js +386 -565
  7. package/dist/bar-chart/bar-chart.js.map +1 -1
  8. package/dist/bar-chart/category-axis.d.ts +35 -41
  9. package/dist/bar-chart/category-axis.d.ts.map +1 -1
  10. package/dist/bar-chart/category-axis.js +93 -115
  11. package/dist/bar-chart/category-axis.js.map +1 -1
  12. package/dist/bar-chart/chart-bars.d.ts +50 -70
  13. package/dist/bar-chart/chart-bars.d.ts.map +1 -1
  14. package/dist/bar-chart/chart-bars.js +155 -210
  15. package/dist/bar-chart/chart-bars.js.map +1 -1
  16. package/dist/bar-chart/index.d.ts +2 -2
  17. package/dist/bar-chart/index.d.ts.map +1 -1
  18. package/dist/bar-chart/index.js +1 -1
  19. package/dist/bar-chart/index.js.map +1 -1
  20. package/dist/bar-chart/shared.d.ts +7 -7
  21. package/dist/bar-chart/shared.d.ts.map +1 -1
  22. package/dist/bar-chart/shared.js +7 -7
  23. package/dist/bar-chart/shared.js.map +1 -1
  24. package/dist/browser/chunks/chunk-TJNHLQGV.js +2 -0
  25. package/dist/browser/chunks/chunk-TJNHLQGV.js.map +7 -0
  26. package/dist/browser/index.js +1 -1
  27. package/dist/browser/index.js.map +3 -3
  28. package/dist/browser/kit.js +1 -1
  29. package/dist/browser/manifest.json +4 -3
  30. package/dist/engine.d.ts +10 -8
  31. package/dist/engine.d.ts.map +1 -1
  32. package/dist/engine.js +10 -8
  33. package/dist/engine.js.map +1 -1
  34. package/dist/kit/cartesian.d.ts +44 -0
  35. package/dist/kit/cartesian.d.ts.map +1 -0
  36. package/dist/kit/cartesian.js +59 -0
  37. package/dist/kit/cartesian.js.map +1 -0
  38. package/dist/kit/chart-border.d.ts +10 -11
  39. package/dist/kit/chart-border.d.ts.map +1 -1
  40. package/dist/kit/chart-border.js +15 -32
  41. package/dist/kit/chart-border.js.map +1 -1
  42. package/dist/kit/chart-canvas.d.ts +32 -21
  43. package/dist/kit/chart-canvas.d.ts.map +1 -1
  44. package/dist/kit/chart-canvas.js +33 -90
  45. package/dist/kit/chart-canvas.js.map +1 -1
  46. package/dist/kit/chart-legend.d.ts +123 -85
  47. package/dist/kit/chart-legend.d.ts.map +1 -1
  48. package/dist/kit/chart-legend.js +137 -186
  49. package/dist/kit/chart-legend.js.map +1 -1
  50. package/dist/kit/entries.d.ts +17 -0
  51. package/dist/kit/entries.d.ts.map +1 -0
  52. package/dist/kit/entries.js +19 -0
  53. package/dist/kit/entries.js.map +1 -0
  54. package/dist/kit/motion.d.ts +48 -0
  55. package/dist/kit/motion.d.ts.map +1 -0
  56. package/dist/kit/motion.js +63 -0
  57. package/dist/kit/motion.js.map +1 -0
  58. package/dist/kit/paints.d.ts +10 -0
  59. package/dist/kit/paints.d.ts.map +1 -0
  60. package/dist/kit/paints.js +12 -0
  61. package/dist/kit/paints.js.map +1 -0
  62. package/dist/kit/shared.d.ts +61 -10
  63. package/dist/kit/shared.d.ts.map +1 -1
  64. package/dist/kit/shared.js +108 -13
  65. package/dist/kit/shared.js.map +1 -1
  66. package/dist/kit/vertical-axis.d.ts +48 -61
  67. package/dist/kit/vertical-axis.d.ts.map +1 -1
  68. package/dist/kit/vertical-axis.js +97 -132
  69. package/dist/kit/vertical-axis.js.map +1 -1
  70. package/dist/line-chart/chart-line.d.ts +60 -77
  71. package/dist/line-chart/chart-line.d.ts.map +1 -1
  72. package/dist/line-chart/chart-line.js +100 -121
  73. package/dist/line-chart/chart-line.js.map +1 -1
  74. package/dist/line-chart/chart-region.d.ts +32 -33
  75. package/dist/line-chart/chart-region.d.ts.map +1 -1
  76. package/dist/line-chart/chart-region.js +31 -65
  77. package/dist/line-chart/chart-region.js.map +1 -1
  78. package/dist/line-chart/horizontal-axis.d.ts +58 -64
  79. package/dist/line-chart/horizontal-axis.d.ts.map +1 -1
  80. package/dist/line-chart/horizontal-axis.js +94 -123
  81. package/dist/line-chart/horizontal-axis.js.map +1 -1
  82. package/dist/line-chart/index.d.ts +3 -3
  83. package/dist/line-chart/index.d.ts.map +1 -1
  84. package/dist/line-chart/index.js +2 -2
  85. package/dist/line-chart/index.js.map +1 -1
  86. package/dist/line-chart/line-chart.d.ts +156 -303
  87. package/dist/line-chart/line-chart.d.ts.map +1 -1
  88. package/dist/line-chart/line-chart.js +410 -638
  89. package/dist/line-chart/line-chart.js.map +1 -1
  90. package/dist/line-chart/shared.d.ts +7 -7
  91. package/dist/line-chart/shared.d.ts.map +1 -1
  92. package/dist/line-chart/shared.js +23 -8
  93. package/dist/line-chart/shared.js.map +1 -1
  94. package/dist/line-chart/x-scale.d.ts +4 -11
  95. package/dist/line-chart/x-scale.d.ts.map +1 -1
  96. package/dist/line-chart/x-scale.js +16 -5
  97. package/dist/line-chart/x-scale.js.map +1 -1
  98. package/dist/nodes.d.ts +6 -9
  99. package/dist/nodes.d.ts.map +1 -1
  100. package/dist/nodes.js +7 -9
  101. package/dist/nodes.js.map +1 -1
  102. package/dist/pie-chart/index.d.ts +2 -2
  103. package/dist/pie-chart/index.d.ts.map +1 -1
  104. package/dist/pie-chart/index.js +1 -1
  105. package/dist/pie-chart/index.js.map +1 -1
  106. package/dist/pie-chart/pie-chart.d.ts +108 -126
  107. package/dist/pie-chart/pie-chart.d.ts.map +1 -1
  108. package/dist/pie-chart/pie-chart.js +202 -271
  109. package/dist/pie-chart/pie-chart.js.map +1 -1
  110. package/dist/pie-chart/pie-legend.d.ts +84 -31
  111. package/dist/pie-chart/pie-legend.d.ts.map +1 -1
  112. package/dist/pie-chart/pie-legend.js +93 -107
  113. package/dist/pie-chart/pie-legend.js.map +1 -1
  114. package/dist/pie-chart/pie-ring.d.ts +160 -122
  115. package/dist/pie-chart/pie-ring.d.ts.map +1 -1
  116. package/dist/pie-chart/pie-ring.js +333 -361
  117. package/dist/pie-chart/pie-ring.js.map +1 -1
  118. package/dist/pie-chart/shared.d.ts +12 -6
  119. package/dist/pie-chart/shared.d.ts.map +1 -1
  120. package/dist/pie-chart/shared.js +14 -8
  121. package/dist/pie-chart/shared.js.map +1 -1
  122. package/package.json +7 -4
  123. package/src/bar-chart/bar-chart.ts +424 -686
  124. package/src/bar-chart/category-axis.ts +96 -111
  125. package/src/bar-chart/chart-bars.ts +178 -201
  126. package/src/bar-chart/index.ts +2 -2
  127. package/src/bar-chart/shared.ts +7 -7
  128. package/src/engine.ts +10 -8
  129. package/src/kit/cartesian.ts +81 -0
  130. package/src/kit/chart-border.ts +23 -34
  131. package/src/kit/chart-canvas.ts +45 -80
  132. package/src/kit/chart-legend.ts +185 -206
  133. package/src/kit/entries.ts +20 -0
  134. package/src/kit/motion.ts +90 -0
  135. package/src/kit/paints.ts +15 -0
  136. package/src/kit/shared.ts +120 -13
  137. package/src/kit/vertical-axis.ts +111 -141
  138. package/src/line-chart/chart-line.ts +103 -155
  139. package/src/line-chart/chart-region.ts +36 -81
  140. package/src/line-chart/horizontal-axis.ts +102 -153
  141. package/src/line-chart/index.ts +3 -3
  142. package/src/line-chart/line-chart.ts +463 -759
  143. package/src/line-chart/shared.ts +22 -8
  144. package/src/line-chart/x-scale.ts +20 -5
  145. package/src/nodes.ts +8 -10
  146. package/src/pie-chart/index.ts +2 -2
  147. package/src/pie-chart/pie-chart.ts +225 -303
  148. package/src/pie-chart/pie-legend.ts +125 -115
  149. package/src/pie-chart/pie-ring.ts +388 -443
  150. package/src/pie-chart/shared.ts +14 -8
  151. package/dist/browser/chunks/chunk-ZMBOBHYL.js +0 -2
  152. package/dist/browser/chunks/chunk-ZMBOBHYL.js.map +0 -7
@@ -1,5 +1,5 @@
1
- import { type AssetScope, Node2D, type Command, type CommandArgs, type NodeConfig, type Node2DProps, type RenderContext2D } from "@motionscript/core";
2
- import { type CenterConfig, type LabelConfig, type PieLabelMode, type PieLabelPlacement, type PieSlice, type RingConfig } from "./shared.js";
1
+ import { type FillResolved, type NodeOf, type Node2D, type Node2DProps, type Vector2 } from "@motionscript/sdk";
2
+ import { type CenterConfig, type LabelConfig, type PieArc, type PieLabelMode, type PieLabelPlacement, type PieSlice, type RingConfig } from "./shared.js";
3
3
  export interface PieRingProps extends Node2DProps {
4
4
  /** One entry per slice: its `category`, `value` and `fill`. */
5
5
  slices: PieSlice[];
@@ -52,72 +52,47 @@ export interface PieRingProps extends Node2DProps {
52
52
  */
53
53
  centerReveal: number;
54
54
  }
55
+ /** Where one slice's label sits and the polyline that points at it. */
56
+ interface LabelPlacement {
57
+ /** Index of the slice. */
58
+ index: number;
59
+ /** Which side of the ring the label sits on: +1 right, −1 left. */
60
+ side: 1 | -1;
61
+ /** Leader polyline: wedge edge → elbow → label. */
62
+ leader: Vector2[];
63
+ /** Point the label's inner edge is pinned to. */
64
+ text: Vector2;
65
+ }
66
+ /** What the ring's geometry reads off its entries. */
67
+ interface RingState {
68
+ readonly slices: PieSlice[];
69
+ readonly ring: RingConfig;
70
+ readonly label: LabelConfig;
71
+ readonly centerStyle: CenterConfig;
72
+ readonly labelMode: PieLabelMode;
73
+ readonly labelPlacement: PieLabelPlacement;
74
+ readonly pops: readonly number[];
75
+ readonly dimOpacity: number;
76
+ readonly centerLabel: string;
77
+ readonly centerCaption: string;
78
+ }
55
79
  /**
56
- * The ring itself: one wedge per {@link PieSlice}, sized by its share of the
57
- * total, swept clockwise from the theme's `startAngle` with a `gap` of clear
58
- * space between neighbours — a *constant-width* channel, the same at the hole as
59
- * at the rim (see {@link wedgePath}). A **selected** slice reaches further out
60
- * while its hole edge stays put — so it reads as that band swelling out of the
61
- * ring rather than breaking off it — and the rest of the ring dims behind it,
62
- * leaders and labels included.
63
- *
64
- * This is the only part of the chart family that draws a path: the wedges are
65
- * filled {@link PathBuilder} polygons approximating each arc, and the leaders are
66
- * stroked polylines — both in the node's centred, y-up space, so neither depends
67
- * on SVG arc-sweep conventions. The **labels are real {@link Text} nodes**
68
- * (stacked in a hug vertical flow and pinned by their inner edge), so no
69
- * glyph-width guesswork decides where a caption starts.
70
- *
71
- * ### Label placement
72
- * Each label sits either **inside** its wedge or **outside** on a leader.
73
- *
74
- * An inside label is centred on its slice's band and leads with the number, the
75
- * caption set small underneath — inside a wedge the reader already knows which
76
- * slice they're on, so the magnitude is the thing being read. It costs no gutter
77
- * and no eye round-trip, so a ring labelled that way draws considerably bigger in
78
- * the same box.
79
- *
80
- * A leader label sits outside on the end of a polyline that lifts off its wedge,
81
- * elbows, and runs horizontally into the text. Labels are split into a left and a
82
- * right column by which way their slice's bisector points, and each column is
83
- * de-conflicted independently (see {@link relaxLabels}): a label takes the spot
84
- * nearest its wedge that still clears its neighbour, and the column is squeezed
85
- * to fit the node's height rather than spilling out of it. The elbow then rides on
86
- * a circle just outside the ring **at the label's settled y**, so the run into the
87
- * text is always horizontal and a nudged label never drags its leader back across
88
- * the ring.
89
- *
90
- * Only the sides that actually carry a leader reserve a gutter, and the ring's
91
- * centre slides into whatever the other side left over ({@link centerX}) — so a
92
- * ring whose slices all leader one way doesn't leave a bald patch on the other.
80
+ * The ring's geometry for one box: every radius, gutter and label position,
81
+ * derived from the entries and the size the ring was laid out at, and asked
82
+ * afresh wherever it is read — the drawing, and the labels' bound positions
83
+ * and sizes alike, so the two cannot disagree.
93
84
  */
94
- export declare class PieRing extends Node2D<PieRingProps> {
95
- slices: PieSlice[];
96
- ring: RingConfig;
97
- label: LabelConfig;
98
- centerStyle: CenterConfig;
99
- labelMode: PieLabelMode;
100
- labelPlacement: PieLabelPlacement;
101
- growth: number;
102
- labelReveal: number;
103
- pops: number[];
104
- dimOpacity: number;
105
- centerLabel: string;
106
- centerCaption: string;
107
- centerReveal: number;
108
- /** Each slice's fill, resolved once so `renderSelf` doesn't re-resolve every frame. */
109
- private fills;
110
- constructor(props?: NodeConfig<PieRing, PieRingProps>);
111
- /** Build slice `arc`'s label, in whichever form the chart's placement asks for. */
112
- private addLabel;
113
- /** Build the hole's summary block. */
114
- private addCenterLabel;
85
+ export declare class RingGeometry {
86
+ private readonly s;
87
+ private readonly box;
88
+ constructor(s: RingState, box: {
89
+ readonly width: number;
90
+ readonly height: number;
91
+ });
115
92
  /** The drawn slices' angular spans, re-read every frame so a value tween re-cuts them. */
116
- private get arcs();
117
- /** Which side a leader off bisector `mid` runs to: +1 right, −1 left. */
118
- private sideOf;
93
+ get arcs(): PieArc[];
119
94
  /** Whether any slice is labelled on a leader — the only thing that costs a gutter. */
120
- private get hasLeaderLabels();
95
+ get hasLeaderLabels(): boolean;
121
96
  /**
122
97
  * How wide a horizontal label centred in slice `arc`'s band can run before it
123
98
  * leaves the wedge, in px.
@@ -134,9 +109,9 @@ export declare class PieRing extends Node2D<PieRingProps> {
134
109
  * Measured off the *unpopped* radius, so a slice growing out of the ring
135
110
  * doesn't resize its own text mid-animation.
136
111
  */
137
- private insideRoom;
112
+ insideRoom(arc: PieArc): number;
138
113
  /** Widest line, in glyphs at the leading line's size, an inside label runs to. */
139
- private insideGlyphs;
114
+ insideGlyphs(arc: PieArc): number;
140
115
  /**
141
116
  * Font size of an inside label's leading line: what the theme asked for,
142
117
  * shrunk if that wouldn't fit inside its wedge. **One size across every inside
@@ -146,24 +121,22 @@ export declare class PieRing extends Node2D<PieRingProps> {
146
121
  * So the theme's `insideStyle.fontSize` is an upper bound, not a promise: ask
147
122
  * for the size the chart wants and the ring keeps it legal.
148
123
  */
149
- private get insideFont();
150
- /** Whether the hole carries a summary at all. */
151
- private get hasCenterLabel();
124
+ get insideFont(): number;
152
125
  /**
153
126
  * Font size of the hole's summary: the configured size, capped so it still
154
127
  * fits across the hole. The cap matters because the hole's radius derives from
155
128
  * the box, so a chart that reflows smaller would otherwise push its summary out
156
129
  * through the ring.
157
130
  */
158
- private get centerFont();
131
+ get centerFont(): number;
159
132
  /** Rim radius of a fully selected slice as a multiple of the ring's, clamped sane. */
160
- private get growFactor();
133
+ get growFactor(): number;
161
134
  /** How far past the ring's rim a fully selected slice reaches, in px. */
162
- private get maxPop();
135
+ get maxPop(): number;
163
136
  /** Height of one **leader** label block, in px — the unit those columns are spaced by. */
164
- private get labelRowHeight();
137
+ get labelRowHeight(): number;
165
138
  /** Widest line, in glyphs, that a leader label for slice `index` can run to. */
166
- private captionGlyphs;
139
+ captionGlyphs(index: number): number;
167
140
  /**
168
141
  * Horizontal room reserved on each side for the leaders and their labels, in
169
142
  * px — measured **per side**, from the slices that actually leader out that
@@ -172,51 +145,56 @@ export declare class PieRing extends Node2D<PieRingProps> {
172
145
  * Excludes the ring's own selection-growth allowance, which scales with the
173
146
  * radius and so is divided out in {@link outerRadius} instead.
174
147
  */
175
- private get labelGutters();
148
+ get labelGutters(): {
149
+ left: number;
150
+ right: number;
151
+ };
176
152
  /**
177
153
  * How far the ring's centre sits from the node's, in px. Zero while the
178
154
  * gutters match; when the labels all fall one way it slides the ring into the
179
155
  * empty half so the ring-plus-labels group stays centred in the box instead of
180
156
  * the ring sitting dead centre with a bald patch beside it.
181
157
  */
182
- private get centerX();
158
+ get centerX(): number;
183
159
  /**
184
160
  * Radius of the ring's outer edge, fitted to whatever the label gutters leave.
185
161
  * A fully selected slice reaches `radius × growFactor`, so the room has to
186
162
  * cover that — hence the divisor, which keeps even the grown slice inside the
187
163
  * box (and holds the ring the same size whether or not anything is selected).
188
164
  */
189
- private get outerRadius();
165
+ get outerRadius(): number;
190
166
  /** Radius of the hole in the middle: a fraction of the outer radius, or explicit px. */
191
- private get holeRadius();
167
+ get holeRadius(): number;
192
168
  /** Radius of the circle every leader elbows on, clear of even a popped-out slice. */
193
- private get elbowRadius();
169
+ get elbowRadius(): number;
194
170
  /** How far slice `index` is currently pushed out, in `[0, 1]`. */
195
- private popOf;
171
+ popOf(index: number): number;
196
172
  /** Radius of slice `index`'s outer edge, its selection growth included. */
197
- private anchorRadius;
173
+ anchorRadius(index: number): number;
198
174
  /**
199
175
  * Radius an inside label sits at on slice `index`: halfway across the band on a
200
176
  * donut, and further out than halfway on a solid pie, where "halfway" would
201
177
  * crowd the point every wedge converges on. Rides the slice's own pop, so an
202
178
  * inside label travels out with the wedge it belongs to.
203
179
  */
204
- private bandMidRadius;
205
- /** Node2D-space point slice `index`'s inside label is centred on. */
206
- private insideAnchor;
180
+ bandMidRadius(index: number): number;
181
+ /** The point slice `index`'s inside label is centred on. */
182
+ insideAnchor(index: number): Vector2;
207
183
  /**
208
184
  * How selected the ring is overall, in `[0, 1]` — the most-grown slice. Rides
209
185
  * the same tween the pops do, so the dim below arrives with the growth rather
210
186
  * than needing an animation of its own.
211
187
  */
212
- private get selectionStrength();
188
+ get selectionStrength(): number;
213
189
  /**
214
190
  * Opacity slice `index` (and its leader and label) is drawn at: full while
215
- * nothing is selected, falling toward {@link dimOpacity} in proportion to how
191
+ * nothing is selected, falling toward `dimOpacity` in proportion to how
216
192
  * selected the *rest* of the ring is. A slice that's selected itself stays at
217
193
  * full — the two factors cancel.
218
194
  */
219
- private sliceOpacity;
195
+ sliceOpacity(index: number): number;
196
+ /** Slice `index`'s share of the ring as its label reads it, off the live values. */
197
+ percentText(index: number): string;
220
198
  /**
221
199
  * Where every leader label sits and how its leader gets there. Labels are split
222
200
  * into a right and a left column by their slice's bisector, each column is
@@ -225,42 +203,102 @@ export declare class PieRing extends Node2D<PieRingProps> {
225
203
  * the label's *settled* y, which keeps the final run horizontal and the whole
226
204
  * polyline outside the ring however far the label was nudged.
227
205
  */
228
- private placements;
206
+ placements(): LabelPlacement[];
229
207
  /** This frame's placement for slice `index`, or `undefined` if it isn't leadered. */
230
- private placementFor;
231
- /**
232
- * The ring's paints live nowhere `ShapeNode` would look: one fill per slice,
233
- * resolved once into {@link fills}, plus the leader line's own stroke. Both are
234
- * passed explicitly — see {@link declarePaints}.
235
- */
236
- declareAssets(assets: AssetScope): void;
237
- protected renderSelf(ctx: RenderContext2D): void;
238
- /** Tween {@link growth} `0 → 1`, wiping the wedges in around the ring. */
239
- sweep(args: CommandArgs<Record<string, never>> & {
240
- duration: number;
241
- }): Command<RingSweep>;
242
- /** Tween {@link labelReveal} `0 → 1`, fading the leaders and captions up. */
243
- revealLabels(args: CommandArgs<Record<string, never>> & {
244
- duration: number;
245
- }): Command<RingLabels>;
246
- /**
247
- * Fade the hole's summary up. Deliberately not part of the ring's entrance: a
248
- * hole label is usually the chart's conclusion, so the scene decides when it
249
- * lands.
250
- */
251
- revealCenter(args?: CommandArgs<Record<string, never>> & {
252
- duration?: number;
253
- }): Command<RingCenter>;
208
+ placementFor(index: number): LabelPlacement | undefined;
254
209
  }
255
- /** The signals the ring's own commands move, as props types. */
256
- type RingSweep = {
257
- growth: number;
258
- };
259
- type RingLabels = {
260
- labelReveal: number;
261
- };
262
- type RingCenter = {
263
- centerReveal: number;
264
- };
210
+ /** Each slice's fill, resolved. */
211
+ export declare function ringFills(slices: readonly PieSlice[]): FillResolved[][];
212
+ /**
213
+ * The ring itself: one wedge per {@link PieSlice}, sized by its share of the
214
+ * total, swept clockwise from the theme's `startAngle` with a `gap` of clear
215
+ * space between neighbours — a *constant-width* channel, the same at the hole as
216
+ * at the rim (see {@link wedgePath}). A **selected** slice reaches further out
217
+ * while its hole edge stays put — so it reads as that band swelling out of the
218
+ * ring rather than breaking off it — and the rest of the ring dims behind it,
219
+ * leaders and labels included.
220
+ *
221
+ * This is the only part of the chart family that draws a path: the wedges are
222
+ * filled {@link PathBuilder} polygons approximating each arc, and the leaders are
223
+ * stroked polylines — both in the node's centred, y-up space, so neither depends
224
+ * on SVG arc-sweep conventions. The **labels are real {@link Text} nodes**
225
+ * (stacked in a hug vertical flow and pinned by their inner edge), so no
226
+ * glyph-width guesswork decides where a caption starts.
227
+ *
228
+ * ### Label placement
229
+ * Each label sits either **inside** its wedge or **outside** on a leader.
230
+ *
231
+ * An inside label is centred on its slice's band and leads with the number, the
232
+ * caption set small underneath — inside a wedge the reader already knows which
233
+ * slice they're on, so the magnitude is the thing being read. It costs no gutter
234
+ * and no eye round-trip, so a ring labelled that way draws considerably bigger in
235
+ * the same box.
236
+ *
237
+ * A leader label sits outside on the end of a polyline that lifts off its wedge,
238
+ * elbows, and runs horizontally into the text. Labels are split into a left and a
239
+ * right column by which way their slice's bisector points, and each column is
240
+ * de-conflicted independently (see {@link relaxLabels}): a label takes the spot
241
+ * nearest its wedge that still clears its neighbour, and the column is squeezed
242
+ * to fit the node's height rather than spilling out of it. The elbow then rides on
243
+ * a circle just outside the ring **at the label's settled y**, so the run into the
244
+ * text is always horizontal and a nudged label never drags its leader back across
245
+ * the ring.
246
+ *
247
+ * Only the sides that actually carry a leader reserve a gutter, and the ring's
248
+ * centre slides into whatever the other side left over — so a ring whose slices
249
+ * all leader one way doesn't leave a bald patch on the other.
250
+ */
251
+ export declare const PieRing: import("@motionscript/sdk").Component<"pieRing", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
252
+ readonly slices: import("@motionscript/sdk").Type<PieSlice[], PieSlice[], false>;
253
+ readonly ring: import("@motionscript/sdk").Type<RingConfig, RingConfig, false>;
254
+ readonly label: import("@motionscript/sdk").Type<LabelConfig, LabelConfig, false>;
255
+ readonly centerStyle: import("@motionscript/sdk").Type<CenterConfig, CenterConfig, false>;
256
+ readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
257
+ readonly labelPlacement: import("@motionscript/sdk").Type<PieLabelPlacement, PieLabelPlacement, false>;
258
+ readonly growth: 1;
259
+ readonly labelReveal: 1;
260
+ readonly pops: import("@motionscript/sdk").Type<number[], number[], false>;
261
+ readonly dimOpacity: number;
262
+ readonly centerLabel: "";
263
+ readonly centerCaption: "";
264
+ readonly centerReveal: 1;
265
+ }>, {
266
+ readonly sweep: unknown;
267
+ readonly revealLabels: unknown;
268
+ readonly revealCenter: unknown;
269
+ }, null, Node2D<Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
270
+ readonly slices: import("@motionscript/sdk").Type<PieSlice[], PieSlice[], false>;
271
+ readonly ring: import("@motionscript/sdk").Type<RingConfig, RingConfig, false>;
272
+ readonly label: import("@motionscript/sdk").Type<LabelConfig, LabelConfig, false>;
273
+ readonly centerStyle: import("@motionscript/sdk").Type<CenterConfig, CenterConfig, false>;
274
+ readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
275
+ readonly labelPlacement: import("@motionscript/sdk").Type<PieLabelPlacement, PieLabelPlacement, false>;
276
+ readonly growth: 1;
277
+ readonly labelReveal: 1;
278
+ readonly pops: import("@motionscript/sdk").Type<number[], number[], false>;
279
+ readonly dimOpacity: number;
280
+ readonly centerLabel: "";
281
+ readonly centerCaption: "";
282
+ readonly centerReveal: 1;
283
+ }>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
284
+ readonly slices: import("@motionscript/sdk").Type<PieSlice[], PieSlice[], false>;
285
+ readonly ring: import("@motionscript/sdk").Type<RingConfig, RingConfig, false>;
286
+ readonly label: import("@motionscript/sdk").Type<LabelConfig, LabelConfig, false>;
287
+ readonly centerStyle: import("@motionscript/sdk").Type<CenterConfig, CenterConfig, false>;
288
+ readonly labelMode: import("@motionscript/sdk").Type<PieLabelMode, PieLabelMode, false>;
289
+ readonly labelPlacement: import("@motionscript/sdk").Type<PieLabelPlacement, PieLabelPlacement, false>;
290
+ readonly growth: 1;
291
+ readonly labelReveal: 1;
292
+ readonly pops: import("@motionscript/sdk").Type<number[], number[], false>;
293
+ readonly dimOpacity: number;
294
+ readonly centerLabel: "";
295
+ readonly centerCaption: "";
296
+ readonly centerReveal: 1;
297
+ }>, {
298
+ readonly sweep: unknown;
299
+ readonly revealLabels: unknown;
300
+ readonly revealCenter: unknown;
301
+ }, Node2D<Node2DProps>>>>;
302
+ export type PieRing = NodeOf<typeof PieRing>;
265
303
  export {};
266
304
  //# sourceMappingURL=pie-ring.d.ts.map
@@ -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