@motionscript/charts 0.1.1-alpha.1 → 0.1.1-alpha.3

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 (81) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +21 -12
  3. package/dist/bar-chart/bar-chart.d.ts +113 -81
  4. package/dist/bar-chart/bar-chart.d.ts.map +1 -1
  5. package/dist/bar-chart/bar-chart.js +9 -5
  6. package/dist/bar-chart/bar-chart.js.map +1 -1
  7. package/dist/bar-chart/chart-bars.d.ts +29 -5
  8. package/dist/bar-chart/chart-bars.d.ts.map +1 -1
  9. package/dist/bar-chart/chart-bars.js +33 -8
  10. package/dist/bar-chart/chart-bars.js.map +1 -1
  11. package/dist/bar-chart/shared.d.ts +10 -4
  12. package/dist/bar-chart/shared.d.ts.map +1 -1
  13. package/dist/bar-chart/shared.js +12 -5
  14. package/dist/bar-chart/shared.js.map +1 -1
  15. package/dist/browser/chunks/chunk-FJHNBNPQ.js +2 -0
  16. package/dist/browser/chunks/chunk-FJHNBNPQ.js.map +7 -0
  17. package/dist/browser/index.js +1 -1
  18. package/dist/browser/index.js.map +3 -3
  19. package/dist/browser/kit.js +1 -1
  20. package/dist/browser/manifest.json +1 -1
  21. package/dist/kit/cartesian.d.ts +6 -4
  22. package/dist/kit/cartesian.d.ts.map +1 -1
  23. package/dist/kit/cartesian.js +5 -3
  24. package/dist/kit/cartesian.js.map +1 -1
  25. package/dist/kit/style.d.ts +344 -76
  26. package/dist/kit/style.d.ts.map +1 -1
  27. package/dist/kit/style.js +198 -101
  28. package/dist/kit/style.js.map +1 -1
  29. package/dist/line-chart/line-chart.d.ts +97 -73
  30. package/dist/line-chart/line-chart.d.ts.map +1 -1
  31. package/dist/line-chart/line-chart.js +9 -7
  32. package/dist/line-chart/line-chart.js.map +1 -1
  33. package/dist/line-chart/shared.d.ts +2 -1
  34. package/dist/line-chart/shared.d.ts.map +1 -1
  35. package/dist/line-chart/shared.js +2 -0
  36. package/dist/line-chart/shared.js.map +1 -1
  37. package/dist/pie-chart/pie-chart.d.ts +43 -49
  38. package/dist/pie-chart/pie-chart.d.ts.map +1 -1
  39. package/dist/pie-chart/pie-chart.js +2 -1
  40. package/dist/pie-chart/pie-chart.js.map +1 -1
  41. package/dist/pie-chart/shared.d.ts +15 -10
  42. package/dist/pie-chart/shared.d.ts.map +1 -1
  43. package/dist/pie-chart/shared.js +18 -20
  44. package/dist/pie-chart/shared.js.map +1 -1
  45. package/dist/radar-chart/radar-chart.d.ts +37 -49
  46. package/dist/radar-chart/radar-chart.d.ts.map +1 -1
  47. package/dist/radar-chart/radar-chart.js +10 -11
  48. package/dist/radar-chart/radar-chart.js.map +1 -1
  49. package/dist/radar-chart/radar-grid.d.ts +7 -1
  50. package/dist/radar-chart/radar-grid.d.ts.map +1 -1
  51. package/dist/radar-chart/radar-grid.js +17 -15
  52. package/dist/radar-chart/radar-grid.js.map +1 -1
  53. package/dist/radar-chart/shared.d.ts +4 -2
  54. package/dist/radar-chart/shared.d.ts.map +1 -1
  55. package/dist/radar-chart/shared.js +3 -0
  56. package/dist/radar-chart/shared.js.map +1 -1
  57. package/dist/radial-chart/radial-chart.d.ts +37 -49
  58. package/dist/radial-chart/radial-chart.d.ts.map +1 -1
  59. package/dist/radial-chart/radial-chart.js +2 -1
  60. package/dist/radial-chart/radial-chart.js.map +1 -1
  61. package/dist/radial-chart/shared.d.ts +13 -11
  62. package/dist/radial-chart/shared.d.ts.map +1 -1
  63. package/dist/radial-chart/shared.js +12 -16
  64. package/dist/radial-chart/shared.js.map +1 -1
  65. package/package.json +4 -4
  66. package/src/bar-chart/bar-chart.ts +17 -6
  67. package/src/bar-chart/chart-bars.ts +48 -9
  68. package/src/bar-chart/shared.ts +23 -5
  69. package/src/kit/cartesian.ts +10 -7
  70. package/src/kit/style.ts +216 -118
  71. package/src/line-chart/line-chart.ts +14 -8
  72. package/src/line-chart/shared.ts +3 -1
  73. package/src/pie-chart/pie-chart.ts +3 -1
  74. package/src/pie-chart/shared.ts +26 -22
  75. package/src/radar-chart/radar-chart.ts +14 -13
  76. package/src/radar-chart/radar-grid.ts +18 -13
  77. package/src/radar-chart/shared.ts +5 -2
  78. package/src/radial-chart/radial-chart.ts +3 -1
  79. package/src/radial-chart/shared.ts +26 -18
  80. package/dist/browser/chunks/chunk-R3Q5EE6E.js +0 -2
  81. package/dist/browser/chunks/chunk-R3Q5EE6E.js.map +0 -7
@@ -2,42 +2,60 @@
2
2
  * The chart family's style: one `style` entry per chart, built from the groups
3
3
  * below, so a look saved off one chart lays onto any other (a field the other
4
4
  * chart does not draw is dropped). A chart spreads the shared groups and adds a
5
- * `marks` group of its own.
5
+ * `marks` group of its own. Every run of text a chart draws is its own
6
+ * `Types.typography` field, set the way a text node is, in the group of the
7
+ * part it labels: axis text with its axis, values with the labels, the
8
+ * legend's captions with the legend.
6
9
  */
7
10
  import { type Fill, type StrokeResolved, type Stroke as _Stroke, type StyleInput, type TextStyle, type FillResolved as _FillResolved, type Type as _Type } from "@motionscript/sdk";
8
11
  import type { AxisConfig, ChartSeries, LegendConfig } from "./shared.js";
9
- /** The style family every chart shares; a host keys saved styles by it. */
12
+ /** The style family every chart shares; the built-in presets are written for it. */
10
13
  export declare const CHART_STYLE_FAMILY = "chart";
11
- /** The out-of-the-box series colours, cycled by series (or row) index. */
14
+ /** The out-of-the-box series fills, cycled by series (or row) index. */
12
15
  export declare const CHART_PALETTE_DEFAULT: readonly ["#4f8cff", "#2fbf8f", "#f5a524", "#e5547a", "#9b6cf0"];
13
- export declare const CHART_COLORS: {
14
- /** A colour per series (a pie's or radial's per row), cycled. */
15
- palette: _Type<Fill[], _FillResolved[][], false>;
16
- /** Values, legend captions, centre text. */
17
- foreground: _Type<Fill, _FillResolved[], false>;
18
- /** Axis markers and captions, spoke labels. */
19
- muted: _Type<Fill, _FillResolved[], false>;
20
- /** Behind the plot; none by default, so the chart reads against the stage. */
16
+ /** The default ink of values, legend captions and centre text, on the dark stage. */
17
+ export declare const CHART_FOREGROUND = "#f4f4f5";
18
+ /** The default ink of axis markers, axis captions and spoke labels. */
19
+ export declare const CHART_MUTED = "#a1a1aa";
20
+ export declare const CHART_SERIES: {
21
+ /** A fill per series (a pie's or radial's per row), cycled; each may stack several paints. */
22
+ seriesFills: _Type<Fill[], _FillResolved[][], false>;
23
+ };
24
+ export declare const CHART_BACKGROUND: {
25
+ /** Behind the whole chart, legend and axes included; none by default, so the chart reads against the stage. */
26
+ background: _Type<Fill, _FillResolved[], false>;
27
+ };
28
+ export declare const GRID_BACKGROUND: {
29
+ /** Behind the plot only, under the grid lines; none by default. */
30
+ gridBackground: _Type<Fill, _FillResolved[], false>;
31
+ /** Behind the whole chart, legend and axes included; none by default, so the chart reads against the stage. */
21
32
  background: _Type<Fill, _FillResolved[], false>;
22
33
  };
23
- export declare const CHART_TEXT: {
24
- /** Empty: the scene's default face. */
25
- fontFamily: _Type<string, string, false>;
26
- /** Marker and legend size at 1080p; titles and values scale from it. */
27
- fontSize: _Type<number, number, false>;
28
- fontWeight: _Type<number, number, false>;
34
+ /** The figures printed by the marks, for a chart's `labels` group. */
35
+ export declare const VALUE_TEXT: {
36
+ valueText: _Type<TextStyle, TextStyle, false>;
29
37
  };
30
38
  export declare const CARTESIAN_GRID: {
31
39
  /** The lines along the value ticks of a column chart (one per tick); empty draws none. */
32
40
  horizontalGrid: _Type<_Stroke, StrokeResolved[], false>;
33
41
  /** The lines under the category markers; empty draws none. */
34
42
  verticalGrid: _Type<_Stroke, StrokeResolved[], false>;
43
+ };
44
+ export declare const CARTESIAN_AXES: {
35
45
  /** The baseline and the value-axis rule; empty draws none. */
36
46
  axisStroke: _Type<_Stroke, StrokeResolved[], false>;
37
47
  /** Read as the chart is built: whether the category (x) axis row is drawn. */
38
48
  showXAxis: _Type<boolean, boolean, false>;
49
+ /** The markers under the plot: categories on a column chart, values on a horizontal bar chart. */
50
+ xLabelText: _Type<TextStyle, TextStyle, false>;
51
+ /** The caption under the plot. */
52
+ xTitleText: _Type<TextStyle, TextStyle, false>;
39
53
  /** Read as the chart is built: whether the value (y) axis column is drawn. */
40
54
  showYAxis: _Type<boolean, boolean, false>;
55
+ /** The markers beside the plot. */
56
+ yLabelText: _Type<TextStyle, TextStyle, false>;
57
+ /** The caption beside the plot, turned on its side. */
58
+ yTitleText: _Type<TextStyle, TextStyle, false>;
41
59
  };
42
60
  export type LegendPosition = "bottom" | "top" | "right" | "none";
43
61
  export type LegendSwatch = "square" | "circle" | "line";
@@ -45,45 +63,71 @@ export declare const CHART_LEGEND: {
45
63
  /** Read as the chart is built: where the legend sits, or `none`. */
46
64
  legend: _Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
47
65
  swatch: _Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
66
+ /** The legend's captions. */
67
+ legendText: _Type<TextStyle, TextStyle, false>;
48
68
  };
49
- /** The type fields, and the two text colours: what every text helper reads. */
50
- export interface ChartTextStyle {
51
- readonly foreground: Fill;
52
- readonly muted: Fill;
53
- readonly fontFamily: string;
54
- readonly fontSize: number;
55
- readonly fontWeight: number;
56
- }
57
69
  /** The fields every chart's style resolves, whichever groups it spreads. */
58
- export interface ChartStyleBase extends ChartTextStyle {
59
- readonly palette: readonly Fill[];
70
+ export interface ChartStyleBase {
71
+ readonly seriesFills: readonly Fill[];
60
72
  readonly background: Fill;
73
+ readonly legendText: TextStyle;
61
74
  readonly legend: LegendPosition;
62
75
  readonly swatch: LegendSwatch;
63
76
  }
64
- /** The cartesian grid fields, for the line and bar charts. */
77
+ /** The cartesian fields, for the line and bar charts. */
65
78
  export interface CartesianStyle extends ChartStyleBase {
79
+ readonly gridBackground: Fill;
80
+ readonly xLabelText: TextStyle;
81
+ readonly xTitleText: TextStyle;
82
+ readonly yLabelText: TextStyle;
83
+ readonly yTitleText: TextStyle;
84
+ readonly valueText: TextStyle;
66
85
  readonly horizontalGrid: StrokeResolved[];
67
86
  readonly verticalGrid: StrokeResolved[];
68
87
  readonly axisStroke: StrokeResolved[];
69
88
  readonly showXAxis: boolean;
70
89
  readonly showYAxis: boolean;
71
90
  }
72
- /** The rule and track fields a preset restates so its rules read on its background (a chart keeps those it draws). */
73
- declare const _PRESET_RULES: {
91
+ /** The fields a preset restates so its rules and text read on its background (a chart keeps those it draws). */
92
+ declare const _PRESET_FIELDS: {
93
+ legendText: _Type<TextStyle, TextStyle, false>;
94
+ labelText: _Type<TextStyle, TextStyle, false>;
95
+ centerText: _Type<TextStyle, TextStyle, false>;
96
+ spokeText: _Type<TextStyle, TextStyle, false>;
74
97
  horizontalGrid: _Type<_Stroke, StrokeResolved[], false>;
75
98
  gridStroke: _Type<_Stroke, StrokeResolved[], false>;
76
99
  spokeStroke: _Type<_Stroke, StrokeResolved[], false>;
77
100
  track: _Type<Fill, _FillResolved[], false>;
101
+ valueText: _Type<TextStyle, TextStyle, false>;
102
+ /** The baseline and the value-axis rule; empty draws none. */
103
+ axisStroke: _Type<_Stroke, StrokeResolved[], false>;
104
+ /** Read as the chart is built: whether the category (x) axis row is drawn. */
105
+ showXAxis: _Type<boolean, boolean, false>;
106
+ /** The markers under the plot: categories on a column chart, values on a horizontal bar chart. */
107
+ xLabelText: _Type<TextStyle, TextStyle, false>;
108
+ /** The caption under the plot. */
109
+ xTitleText: _Type<TextStyle, TextStyle, false>;
110
+ /** Read as the chart is built: whether the value (y) axis column is drawn. */
111
+ showYAxis: _Type<boolean, boolean, false>;
112
+ /** The markers beside the plot. */
113
+ yLabelText: _Type<TextStyle, TextStyle, false>;
114
+ /** The caption beside the plot, turned on its side. */
115
+ yTitleText: _Type<TextStyle, TextStyle, false>;
116
+ /** Behind the plot only, under the grid lines; none by default. */
117
+ gridBackground: _Type<Fill, _FillResolved[], false>;
118
+ /** Behind the whole chart, legend and axes included; none by default, so the chart reads against the stage. */
119
+ background: _Type<Fill, _FillResolved[], false>;
120
+ /** A fill per series (a pie's or radial's per row), cycled; each may stack several paints. */
121
+ seriesFills: _Type<Fill[], _FillResolved[][], false>;
78
122
  };
79
123
  /** A preset's fields: any chart's, so one preset dresses every chart. */
80
- export type ChartStylePreset = StyleInput<typeof CHART_COLORS & typeof CHART_TEXT & typeof _PRESET_RULES>;
124
+ export type ChartStylePreset = StyleInput<typeof _PRESET_FIELDS>;
81
125
  /** Ready-made looks, each stating every colour so applying one replaces the last. */
82
126
  export declare const CHART_STYLE_PRESETS: {
83
127
  midnight: {
84
- palette: ("#4f8cff" | "#2fbf8f" | "#f5a524" | "#e5547a" | "#9b6cf0")[];
85
- foreground: string;
86
- muted: string;
128
+ track: string;
129
+ background: never[];
130
+ gridBackground: never[];
87
131
  horizontalGrid: {
88
132
  weight: number;
89
133
  fill: string;
@@ -96,13 +140,38 @@ export declare const CHART_STYLE_PRESETS: {
96
140
  weight: number;
97
141
  fill: string;
98
142
  };
99
- track: string;
100
- background: never[];
143
+ xLabelText: {
144
+ fill: string;
145
+ };
146
+ xTitleText: {
147
+ fill: string;
148
+ };
149
+ yLabelText: {
150
+ fill: string;
151
+ };
152
+ yTitleText: {
153
+ fill: string;
154
+ };
155
+ valueText: {
156
+ fill: string;
157
+ };
158
+ legendText: {
159
+ fill: string;
160
+ };
161
+ labelText: {
162
+ fill: string;
163
+ };
164
+ centerText: {
165
+ fill: string;
166
+ };
167
+ spokeText: {
168
+ fill: string;
169
+ };
170
+ seriesFills: ("#4f8cff" | "#2fbf8f" | "#f5a524" | "#e5547a" | "#9b6cf0")[];
101
171
  };
102
172
  paper: {
103
- palette: string[];
104
- foreground: string;
105
- muted: string;
173
+ background: string;
174
+ gridBackground: never[];
106
175
  horizontalGrid: {
107
176
  weight: number;
108
177
  fill: string;
@@ -116,12 +185,38 @@ export declare const CHART_STYLE_PRESETS: {
116
185
  fill: string;
117
186
  };
118
187
  track: string;
119
- background: string;
188
+ xLabelText: {
189
+ fill: string;
190
+ };
191
+ xTitleText: {
192
+ fill: string;
193
+ };
194
+ yLabelText: {
195
+ fill: string;
196
+ };
197
+ yTitleText: {
198
+ fill: string;
199
+ };
200
+ valueText: {
201
+ fill: string;
202
+ };
203
+ legendText: {
204
+ fill: string;
205
+ };
206
+ labelText: {
207
+ fill: string;
208
+ };
209
+ centerText: {
210
+ fill: string;
211
+ };
212
+ spokeText: {
213
+ fill: string;
214
+ };
215
+ seriesFills: string[];
120
216
  };
121
217
  ember: {
122
- palette: string[];
123
- foreground: string;
124
- muted: string;
218
+ background: string;
219
+ gridBackground: never[];
125
220
  horizontalGrid: {
126
221
  weight: number;
127
222
  fill: string;
@@ -135,12 +230,38 @@ export declare const CHART_STYLE_PRESETS: {
135
230
  fill: string;
136
231
  };
137
232
  track: string;
138
- background: string;
233
+ xLabelText: {
234
+ fill: string;
235
+ };
236
+ xTitleText: {
237
+ fill: string;
238
+ };
239
+ yLabelText: {
240
+ fill: string;
241
+ };
242
+ yTitleText: {
243
+ fill: string;
244
+ };
245
+ valueText: {
246
+ fill: string;
247
+ };
248
+ legendText: {
249
+ fill: string;
250
+ };
251
+ labelText: {
252
+ fill: string;
253
+ };
254
+ centerText: {
255
+ fill: string;
256
+ };
257
+ spokeText: {
258
+ fill: string;
259
+ };
260
+ seriesFills: string[];
139
261
  };
140
262
  neon: {
141
- palette: string[];
142
- foreground: string;
143
- muted: string;
263
+ background: never[];
264
+ gridBackground: never[];
144
265
  horizontalGrid: {
145
266
  weight: number;
146
267
  fill: string;
@@ -154,12 +275,38 @@ export declare const CHART_STYLE_PRESETS: {
154
275
  fill: string;
155
276
  };
156
277
  track: string;
157
- background: never[];
278
+ xLabelText: {
279
+ fill: string;
280
+ };
281
+ xTitleText: {
282
+ fill: string;
283
+ };
284
+ yLabelText: {
285
+ fill: string;
286
+ };
287
+ yTitleText: {
288
+ fill: string;
289
+ };
290
+ valueText: {
291
+ fill: string;
292
+ };
293
+ legendText: {
294
+ fill: string;
295
+ };
296
+ labelText: {
297
+ fill: string;
298
+ };
299
+ centerText: {
300
+ fill: string;
301
+ };
302
+ spokeText: {
303
+ fill: string;
304
+ };
305
+ seriesFills: string[];
158
306
  };
159
307
  ocean: {
160
- palette: string[];
161
- foreground: string;
162
- muted: string;
308
+ background: string;
309
+ gridBackground: never[];
163
310
  horizontalGrid: {
164
311
  weight: number;
165
312
  fill: string;
@@ -173,12 +320,38 @@ export declare const CHART_STYLE_PRESETS: {
173
320
  fill: string;
174
321
  };
175
322
  track: string;
176
- background: string;
323
+ xLabelText: {
324
+ fill: string;
325
+ };
326
+ xTitleText: {
327
+ fill: string;
328
+ };
329
+ yLabelText: {
330
+ fill: string;
331
+ };
332
+ yTitleText: {
333
+ fill: string;
334
+ };
335
+ valueText: {
336
+ fill: string;
337
+ };
338
+ legendText: {
339
+ fill: string;
340
+ };
341
+ labelText: {
342
+ fill: string;
343
+ };
344
+ centerText: {
345
+ fill: string;
346
+ };
347
+ spokeText: {
348
+ fill: string;
349
+ };
350
+ seriesFills: string[];
177
351
  };
178
352
  sunset: {
179
- palette: string[];
180
- foreground: string;
181
- muted: string;
353
+ background: never[];
354
+ gridBackground: never[];
182
355
  horizontalGrid: {
183
356
  weight: number;
184
357
  fill: string;
@@ -192,12 +365,38 @@ export declare const CHART_STYLE_PRESETS: {
192
365
  fill: string;
193
366
  };
194
367
  track: string;
195
- background: never[];
368
+ xLabelText: {
369
+ fill: string;
370
+ };
371
+ xTitleText: {
372
+ fill: string;
373
+ };
374
+ yLabelText: {
375
+ fill: string;
376
+ };
377
+ yTitleText: {
378
+ fill: string;
379
+ };
380
+ valueText: {
381
+ fill: string;
382
+ };
383
+ legendText: {
384
+ fill: string;
385
+ };
386
+ labelText: {
387
+ fill: string;
388
+ };
389
+ centerText: {
390
+ fill: string;
391
+ };
392
+ spokeText: {
393
+ fill: string;
394
+ };
395
+ seriesFills: string[];
196
396
  };
197
397
  pastel: {
198
- palette: string[];
199
- foreground: string;
200
- muted: string;
398
+ background: never[];
399
+ gridBackground: never[];
201
400
  horizontalGrid: {
202
401
  weight: number;
203
402
  fill: string;
@@ -211,12 +410,38 @@ export declare const CHART_STYLE_PRESETS: {
211
410
  fill: string;
212
411
  };
213
412
  track: string;
214
- background: never[];
413
+ xLabelText: {
414
+ fill: string;
415
+ };
416
+ xTitleText: {
417
+ fill: string;
418
+ };
419
+ yLabelText: {
420
+ fill: string;
421
+ };
422
+ yTitleText: {
423
+ fill: string;
424
+ };
425
+ valueText: {
426
+ fill: string;
427
+ };
428
+ legendText: {
429
+ fill: string;
430
+ };
431
+ labelText: {
432
+ fill: string;
433
+ };
434
+ centerText: {
435
+ fill: string;
436
+ };
437
+ spokeText: {
438
+ fill: string;
439
+ };
440
+ seriesFills: string[];
215
441
  };
216
442
  mono: {
217
- palette: string[];
218
- foreground: string;
219
- muted: string;
443
+ background: never[];
444
+ gridBackground: never[];
220
445
  horizontalGrid: {
221
446
  weight: number;
222
447
  fill: string;
@@ -230,25 +455,68 @@ export declare const CHART_STYLE_PRESETS: {
230
455
  fill: string;
231
456
  };
232
457
  track: string;
233
- background: never[];
458
+ xLabelText: {
459
+ fill: string;
460
+ };
461
+ xTitleText: {
462
+ fill: string;
463
+ };
464
+ yLabelText: {
465
+ fill: string;
466
+ };
467
+ yTitleText: {
468
+ fill: string;
469
+ };
470
+ valueText: {
471
+ fill: string;
472
+ };
473
+ legendText: {
474
+ fill: string;
475
+ };
476
+ labelText: {
477
+ fill: string;
478
+ };
479
+ centerText: {
480
+ fill: string;
481
+ };
482
+ spokeText: {
483
+ fill: string;
484
+ };
485
+ seriesFills: string[];
234
486
  };
235
487
  };
236
- /** Series `index`'s colour: its own `fill`, else the palette's, cycled. */
237
- export declare function paletteFill(style: Pick<ChartStyleBase, "palette">, index: number, own?: Fill): Fill;
488
+ /** Series `index`'s fill: its own `fill`, else the style's series fills, cycled. */
489
+ export declare function paletteFill(style: Pick<ChartStyleBase, "seriesFills">, index: number, own?: Fill): Fill;
238
490
  /** {@link paletteFill} for a series. */
239
- export declare function seriesFill(style: Pick<ChartStyleBase, "palette">, series: ChartSeries, index: number): Fill;
240
- /** Axis markers, spoke labels: muted, at the base size. */
241
- export declare function markerText(style: ChartTextStyle, textAlign?: TextStyle["textAlign"]): TextStyle;
242
- /** Axis captions: muted, a step larger and heavier than the markers. */
243
- export declare function titleText(style: ChartTextStyle): TextStyle;
244
- /** Values on marks and legend captions: the foreground, at the base size. */
245
- export declare function valueText(style: ChartTextStyle, textAlign?: TextStyle["textAlign"]): TextStyle;
491
+ export declare function seriesFill(style: Pick<ChartStyleBase, "seriesFills">, series: ChartSeries, index: number): Fill;
492
+ /** A text style's size in px; an autofit or unset size reads as `fallback`. */
493
+ export declare function sizeOf(text: TextStyle | undefined, fallback?: number): number;
494
+ /**
495
+ * `text` as a text node takes it, aligned where the chart puts it, with `over`
496
+ * laid on top. Unset keys are dropped: an `undefined` spread onto a node is a
497
+ * value, and an unset face must stay unset so the host's default applies.
498
+ */
499
+ export declare function placedText(text: TextStyle, textAlign?: TextStyle["textAlign"], over?: TextStyle): TextStyle;
500
+ /** Axis markers on `axis`, aligned as that axis sets them. */
501
+ export declare function markerText(style: Pick<CartesianStyle, "xLabelText" | "yLabelText">, axis: "x" | "y"): TextStyle;
502
+ /** The figures printed by the marks. */
503
+ export declare function valueText(style: Pick<CartesianStyle, "valueText">, textAlign?: TextStyle["textAlign"]): TextStyle;
246
504
  /**
247
505
  * The kit axis parts' config from a style. `x` is the axis under the plot;
248
506
  * its grid lines are vertical (one per x marker), the `y` axis's horizontal.
249
507
  */
250
- export declare function axisConfigOf(style: Pick<CartesianStyle, "verticalGrid" | "horizontalGrid"> & ChartTextStyle, axis: "x" | "y"): AxisConfig;
251
- /** The kit legend's config: captions in the foreground, the swatch shaped by `swatch`. */
252
- export declare function legendConfigOf(style: ChartTextStyle & Pick<ChartStyleBase, "swatch">): LegendConfig;
508
+ export declare function axisConfigOf(style: Pick<CartesianStyle, "verticalGrid" | "horizontalGrid" | "xLabelText" | "xTitleText" | "yLabelText" | "yTitleText">, axis: "x" | "y"): AxisConfig;
509
+ /** The kit legend's config: captions in `legendText`, the swatch shaped by `swatch` and sized off the captions. */
510
+ export declare function legendConfigOf(style: Pick<ChartStyleBase, "swatch" | "legendText">): LegendConfig;
511
+ /** Which text a chart drew from the retired shared text fields. */
512
+ export type ChartTextLayout = "cartesian" | "pie" | "radar" | "radial";
513
+ /**
514
+ * The `style` entry's hook for documents written before every run of text got
515
+ * its own field (0.1.1-alpha.1): `barRadius` became `barCornerRadius`, `palette` became `seriesFills`; `foreground`,
516
+ * `muted` and the one `fontFamily`/`fontSize`/`fontWeight` became the text
517
+ * fields as each chart derived them; a cartesian or radar `background`, which
518
+ * painted the plot, became `gridBackground`. A current style comes back as is.
519
+ */
520
+ export declare function migrateChartStyle(layout: ChartTextLayout): (value: unknown) => unknown;
253
521
  export {};
254
522
  //# sourceMappingURL=style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/kit/style.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,UAAU,EACf,KAAK,SAAS,EAEd,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,IAAI,IAAI,KAAK,EACnB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAErE,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAEzC,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,kEAAmE,CAAA;AAErG,eAAO,MAAM,YAAY;IACvB,iEAAiE;;IAEjE,4CAA4C;;IAE5C,+CAA+C;;IAE/C,8EAA8E;;CAE/E,CAAA;AAED,eAAO,MAAM,UAAU;IACrB,uCAAuC;;IAEvC,wEAAwE;;;CAGzE,CAAA;AAED,eAAO,MAAM,cAAc;IACzB,0FAA0F;;IAE1F,8DAA8D;;IAE9D,8DAA8D;;IAE9D,8EAA8E;;IAE9E,8EAA8E;;CAE/E,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