@motionscript/charts 0.1.1-alpha.2 → 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.
- package/CHANGELOG.md +8 -0
- package/README.md +7 -9
- package/dist/bar-chart/bar-chart.d.ts +48 -48
- package/dist/bar-chart/bar-chart.js +2 -2
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/shared.d.ts +2 -1
- package/dist/bar-chart/shared.d.ts.map +1 -1
- package/dist/bar-chart/shared.js +2 -0
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/chunk-FJHNBNPQ.js +2 -0
- package/dist/browser/chunks/chunk-FJHNBNPQ.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/kit/style.d.ts +25 -20
- package/dist/kit/style.d.ts.map +1 -1
- package/dist/kit/style.js +20 -18
- package/dist/kit/style.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +48 -48
- package/dist/line-chart/line-chart.js +2 -2
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/line-chart/shared.d.ts +2 -1
- package/dist/line-chart/shared.d.ts.map +1 -1
- package/dist/line-chart/shared.js +2 -0
- package/dist/line-chart/shared.js.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +18 -24
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/shared.d.ts +7 -9
- package/dist/pie-chart/shared.d.ts.map +1 -1
- package/dist/pie-chart/shared.js +7 -10
- package/dist/pie-chart/shared.js.map +1 -1
- package/dist/radar-chart/index.d.ts +1 -1
- package/dist/radar-chart/index.d.ts.map +1 -1
- package/dist/radar-chart/index.js +1 -1
- package/dist/radar-chart/index.js.map +1 -1
- package/dist/radar-chart/radar-chart.d.ts +6 -12
- package/dist/radar-chart/radar-chart.d.ts.map +1 -1
- package/dist/radar-chart/radar-chart.js +1 -2
- package/dist/radar-chart/radar-chart.js.map +1 -1
- package/dist/radar-chart/shared.d.ts +2 -5
- package/dist/radar-chart/shared.d.ts.map +1 -1
- package/dist/radar-chart/shared.js +3 -6
- package/dist/radar-chart/shared.js.map +1 -1
- package/dist/radial-chart/radial-chart.d.ts +12 -18
- package/dist/radial-chart/radial-chart.d.ts.map +1 -1
- package/dist/radial-chart/shared.d.ts +5 -7
- package/dist/radial-chart/shared.d.ts.map +1 -1
- package/dist/radial-chart/shared.js +5 -8
- package/dist/radial-chart/shared.js.map +1 -1
- package/package.json +4 -4
- package/src/bar-chart/bar-chart.ts +2 -2
- package/src/bar-chart/shared.ts +3 -0
- package/src/kit/style.ts +21 -19
- package/src/line-chart/line-chart.ts +2 -2
- package/src/line-chart/shared.ts +3 -1
- package/src/pie-chart/shared.ts +6 -10
- package/src/radar-chart/index.ts +1 -1
- package/src/radar-chart/radar-chart.ts +0 -2
- package/src/radar-chart/shared.ts +3 -7
- package/src/radial-chart/shared.ts +4 -8
- package/dist/browser/chunks/chunk-7XCRX6GE.js +0 -2
- package/dist/browser/chunks/chunk-7XCRX6GE.js.map +0 -7
package/dist/browser/kit.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,g,ga,h,ha,i,ia,j,ja,k,ka,l,la,m,ma,n,na,o,oa,p,pa,q,qa,r,ra,s,sa,t,ta,u,ua,v,va,w,x,y,z}from"./chunks/chunk-
|
|
1
|
+
import{$,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,g,ga,h,ha,i,ia,j,ja,k,ka,l,la,m,ma,n,na,o,oa,p,pa,q,qa,r,ra,s,sa,t,ta,u,ua,v,va,w,x,y,z}from"./chunks/chunk-FJHNBNPQ.js";export{j as CARTESIAN_AXES,i as CARTESIAN_GRID,f as CHART_BACKGROUND,c as CHART_FOREGROUND,k as CHART_LEGEND,d as CHART_MUTED,b as CHART_PALETTE_DEFAULT,e as CHART_SERIES,a as CHART_STYLE_FAMILY,l as CHART_STYLE_PRESETS,J as ChartCanvas,ja as ChartLegend,ca as DEFAULT_LEGEND,M as DEFAULT_MARKERS,aa as DEFAULT_X_AXIS,ba as DEFAULT_Y_AXIS,qa as DEG,N as ENTER_SHARE,g as GRID_BACKGROUND,oa as HorizontalAxis,K as LEGEND_SLIDE,ta as PIE_SPOTLIGHT_DIM,pa as PieLegend,G as SERIES_ARG,Y as SPOTLIGHT_DIM,h as VALUE_TEXT,na as VerticalAxis,S as armed,T as arrival,R as arrivalOf,Q as arrivalsEntry,F as asParts,s as axisConfigOf,la as axisPads,P as beats,B as boundText,ma as captionColumn,y as cartesianFrame,z as chartViews,C as columnGhost,D as fade,da as formatMarker,fa as formatPercent,O as frameEase,v as frameGap,E as fresh,w as headroom,A as laidOutSize,L as legendAway,t as legendConfigOf,V as lerpAxisDomain,W as lerpAxisEntry,H as loadPaints,ka as markerCaption,ea as markerStep,q as markerText,ga as markerValues,u as migrateChartStyle,ha as niceRange,ia as niceTicks,Z as num,$ as numericFields,x as overhang,m as paletteFill,p as placedText,U as resolveAxisDomain,ua as resolvedFill,va as ringFills,sa as ringPoint,I as rule,ra as selectionFade,n as seriesFill,X as settleAxisDomain,o as sizeOf,_ as text,r as valueText};
|
|
2
2
|
//# sourceMappingURL=kit.js.map
|
package/dist/kit/style.d.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
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
5
|
* `marks` group of its own. Every run of text a chart draws is its own
|
|
6
|
-
* `Types.typography` field,
|
|
7
|
-
*
|
|
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.
|
|
8
9
|
*/
|
|
9
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";
|
|
10
11
|
import type { AxisConfig, ChartSeries, LegendConfig } from "./shared.js";
|
|
@@ -30,21 +31,8 @@ export declare const GRID_BACKGROUND: {
|
|
|
30
31
|
/** Behind the whole chart, legend and axes included; none by default, so the chart reads against the stage. */
|
|
31
32
|
background: _Type<Fill, _FillResolved[], false>;
|
|
32
33
|
};
|
|
33
|
-
/** The
|
|
34
|
-
export declare const
|
|
35
|
-
legendText: _Type<TextStyle, TextStyle, false>;
|
|
36
|
-
};
|
|
37
|
-
export declare const CARTESIAN_TEXT: {
|
|
38
|
-
legendText: _Type<TextStyle, TextStyle, false>;
|
|
39
|
-
/** The markers under the plot: categories on a column chart, values on a horizontal bar chart. */
|
|
40
|
-
xLabelText: _Type<TextStyle, TextStyle, false>;
|
|
41
|
-
/** The caption under the plot. */
|
|
42
|
-
xTitleText: _Type<TextStyle, TextStyle, false>;
|
|
43
|
-
/** The markers beside the plot. */
|
|
44
|
-
yLabelText: _Type<TextStyle, TextStyle, false>;
|
|
45
|
-
/** The caption beside the plot, turned on its side. */
|
|
46
|
-
yTitleText: _Type<TextStyle, TextStyle, false>;
|
|
47
|
-
/** The figures printed by the marks. */
|
|
34
|
+
/** The figures printed by the marks, for a chart's `labels` group. */
|
|
35
|
+
export declare const VALUE_TEXT: {
|
|
48
36
|
valueText: _Type<TextStyle, TextStyle, false>;
|
|
49
37
|
};
|
|
50
38
|
export declare const CARTESIAN_GRID: {
|
|
@@ -52,12 +40,22 @@ export declare const CARTESIAN_GRID: {
|
|
|
52
40
|
horizontalGrid: _Type<_Stroke, StrokeResolved[], false>;
|
|
53
41
|
/** The lines under the category markers; empty draws none. */
|
|
54
42
|
verticalGrid: _Type<_Stroke, StrokeResolved[], false>;
|
|
43
|
+
};
|
|
44
|
+
export declare const CARTESIAN_AXES: {
|
|
55
45
|
/** The baseline and the value-axis rule; empty draws none. */
|
|
56
46
|
axisStroke: _Type<_Stroke, StrokeResolved[], false>;
|
|
57
47
|
/** Read as the chart is built: whether the category (x) axis row is drawn. */
|
|
58
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>;
|
|
59
53
|
/** Read as the chart is built: whether the value (y) axis column is drawn. */
|
|
60
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>;
|
|
61
59
|
};
|
|
62
60
|
export type LegendPosition = "bottom" | "top" | "right" | "none";
|
|
63
61
|
export type LegendSwatch = "square" | "circle" | "line";
|
|
@@ -65,6 +63,8 @@ export declare const CHART_LEGEND: {
|
|
|
65
63
|
/** Read as the chart is built: where the legend sits, or `none`. */
|
|
66
64
|
legend: _Type<"right" | "top" | "bottom" | "none", "right" | "top" | "bottom" | "none", false>;
|
|
67
65
|
swatch: _Type<"square" | "circle" | "line", "square" | "circle" | "line", false>;
|
|
66
|
+
/** The legend's captions. */
|
|
67
|
+
legendText: _Type<TextStyle, TextStyle, false>;
|
|
68
68
|
};
|
|
69
69
|
/** The fields every chart's style resolves, whichever groups it spreads. */
|
|
70
70
|
export interface ChartStyleBase {
|
|
@@ -90,6 +90,7 @@ export interface CartesianStyle extends ChartStyleBase {
|
|
|
90
90
|
}
|
|
91
91
|
/** The fields a preset restates so its rules and text read on its background (a chart keeps those it draws). */
|
|
92
92
|
declare const _PRESET_FIELDS: {
|
|
93
|
+
legendText: _Type<TextStyle, TextStyle, false>;
|
|
93
94
|
labelText: _Type<TextStyle, TextStyle, false>;
|
|
94
95
|
centerText: _Type<TextStyle, TextStyle, false>;
|
|
95
96
|
spokeText: _Type<TextStyle, TextStyle, false>;
|
|
@@ -97,17 +98,21 @@ declare const _PRESET_FIELDS: {
|
|
|
97
98
|
gridStroke: _Type<_Stroke, StrokeResolved[], false>;
|
|
98
99
|
spokeStroke: _Type<_Stroke, StrokeResolved[], false>;
|
|
99
100
|
track: _Type<Fill, _FillResolved[], false>;
|
|
100
|
-
|
|
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>;
|
|
101
106
|
/** The markers under the plot: categories on a column chart, values on a horizontal bar chart. */
|
|
102
107
|
xLabelText: _Type<TextStyle, TextStyle, false>;
|
|
103
108
|
/** The caption under the plot. */
|
|
104
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>;
|
|
105
112
|
/** The markers beside the plot. */
|
|
106
113
|
yLabelText: _Type<TextStyle, TextStyle, false>;
|
|
107
114
|
/** The caption beside the plot, turned on its side. */
|
|
108
115
|
yTitleText: _Type<TextStyle, TextStyle, false>;
|
|
109
|
-
/** The figures printed by the marks. */
|
|
110
|
-
valueText: _Type<TextStyle, TextStyle, false>;
|
|
111
116
|
/** Behind the plot only, under the grid lines; none by default. */
|
|
112
117
|
gridBackground: _Type<Fill, _FillResolved[], false>;
|
|
113
118
|
/** Behind the whole chart, legend and axes included; none by default, so the chart reads against the stage. */
|
package/dist/kit/style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/kit/style.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/kit/style.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAGL,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,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAEzC,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,kEAAmE,CAAA;AAErG,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,YAAY,CAAA;AACzC,uEAAuE;AACvE,eAAO,MAAM,WAAW,YAAY,CAAA;AAEpC,eAAO,MAAM,YAAY;IACvB,8FAA8F;;CAE/F,CAAA;AAED,eAAO,MAAM,gBAAgB;IAC3B,+GAA+G;;CAEhH,CAAA;AAED,eAAO,MAAM,eAAe;IAE1B,mEAAmE;;IANnE,+GAA+G;;CAQhH,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,UAAU;;CAEtB,CAAA;AAED,eAAO,MAAM,cAAc;IACzB,0FAA0F;;IAE1F,8DAA8D;;CAE/D,CAAA;AAED,eAAO,MAAM,cAAc;IACzB,8DAA8D;;IAE9D,8EAA8E;;IAE9E,kGAAkG;;IAElG,kCAAkC;;IAElC,8EAA8E;;IAE9E,mCAAmC;;IAEnC,uDAAuD;;CAExD,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;AAChE,MAAM,MAAM,YAAY,GAAG,QAAQ,G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S,CAE/G;AAED,wCAAwC;AACxC,wBAAgB,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,EAAE,SAAS,GAAE,SAAS,CAAC,WAAW,CAAY,GAAG,SAAS,CAE3H;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,GAAG,gBAAgB,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC,EAC1H,IAAI,EAAE,GAAG,GAAG,GAAG,GACd,UAAU,CASZ;AAED,mHAAmH;AACnH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,YAAY,CAAC,GAAG,YAAY,CAejG;AAED,mEAAmE;AACnE,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEtE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAiDtF"}
|
package/dist/kit/style.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
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
5
|
* `marks` group of its own. Every run of text a chart draws is its own
|
|
6
|
-
* `Types.typography` field,
|
|
7
|
-
*
|
|
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.
|
|
8
9
|
*/
|
|
9
10
|
import { Types, textOps, } from "@motionscript/sdk";
|
|
10
11
|
/** The style family every chart shares; the built-in presets are written for it. */
|
|
@@ -28,45 +29,46 @@ export const GRID_BACKGROUND = {
|
|
|
28
29
|
/** Behind the plot only, under the grid lines; none by default. */
|
|
29
30
|
gridBackground: Types.fill([]),
|
|
30
31
|
};
|
|
31
|
-
/** The
|
|
32
|
-
export const
|
|
33
|
-
legendText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_FOREGROUND }),
|
|
34
|
-
};
|
|
35
|
-
export const CARTESIAN_TEXT = {
|
|
36
|
-
/** The markers under the plot: categories on a column chart, values on a horizontal bar chart. */
|
|
37
|
-
xLabelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),
|
|
38
|
-
/** The caption under the plot. */
|
|
39
|
-
xTitleText: Types.typography({ fontSize: 31, fontWeight: 600, fill: CHART_MUTED }),
|
|
40
|
-
/** The markers beside the plot. */
|
|
41
|
-
yLabelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),
|
|
42
|
-
/** The caption beside the plot, turned on its side. */
|
|
43
|
-
yTitleText: Types.typography({ fontSize: 31, fontWeight: 600, fill: CHART_MUTED }),
|
|
44
|
-
/** The figures printed by the marks. */
|
|
32
|
+
/** The figures printed by the marks, for a chart's `labels` group. */
|
|
33
|
+
export const VALUE_TEXT = {
|
|
45
34
|
valueText: Types.typography({ fontSize: 24, fontWeight: 600, fill: CHART_FOREGROUND }),
|
|
46
|
-
...LEGEND_TEXT,
|
|
47
35
|
};
|
|
48
36
|
export const CARTESIAN_GRID = {
|
|
49
37
|
/** The lines along the value ticks of a column chart (one per tick); empty draws none. */
|
|
50
38
|
horizontalGrid: Types.stroke({ weight: 2, fill: "white/15" }),
|
|
51
39
|
/** The lines under the category markers; empty draws none. */
|
|
52
40
|
verticalGrid: Types.stroke([]),
|
|
41
|
+
};
|
|
42
|
+
export const CARTESIAN_AXES = {
|
|
53
43
|
/** The baseline and the value-axis rule; empty draws none. */
|
|
54
44
|
axisStroke: Types.stroke([]),
|
|
55
45
|
/** Read as the chart is built: whether the category (x) axis row is drawn. */
|
|
56
46
|
showXAxis: Types.boolean(true, { animatable: false }),
|
|
47
|
+
/** The markers under the plot: categories on a column chart, values on a horizontal bar chart. */
|
|
48
|
+
xLabelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),
|
|
49
|
+
/** The caption under the plot. */
|
|
50
|
+
xTitleText: Types.typography({ fontSize: 31, fontWeight: 600, fill: CHART_MUTED }),
|
|
57
51
|
/** Read as the chart is built: whether the value (y) axis column is drawn. */
|
|
58
52
|
showYAxis: Types.boolean(true, { animatable: false }),
|
|
53
|
+
/** The markers beside the plot. */
|
|
54
|
+
yLabelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),
|
|
55
|
+
/** The caption beside the plot, turned on its side. */
|
|
56
|
+
yTitleText: Types.typography({ fontSize: 31, fontWeight: 600, fill: CHART_MUTED }),
|
|
59
57
|
};
|
|
60
58
|
export const CHART_LEGEND = {
|
|
61
59
|
/** Read as the chart is built: where the legend sits, or `none`. */
|
|
62
60
|
legend: Types.oneOf(["bottom", "top", "right", "none"], { animatable: false }),
|
|
63
61
|
swatch: Types.oneOf(["square", "circle", "line"]),
|
|
62
|
+
/** The legend's captions. */
|
|
63
|
+
legendText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_FOREGROUND }),
|
|
64
64
|
};
|
|
65
65
|
/** The fields a preset restates so its rules and text read on its background (a chart keeps those it draws). */
|
|
66
66
|
const _PRESET_FIELDS = {
|
|
67
67
|
...CHART_SERIES,
|
|
68
68
|
...GRID_BACKGROUND,
|
|
69
|
-
...
|
|
69
|
+
...CARTESIAN_AXES,
|
|
70
|
+
...VALUE_TEXT,
|
|
71
|
+
legendText: CHART_LEGEND.legendText,
|
|
70
72
|
labelText: Types.typography(),
|
|
71
73
|
centerText: Types.typography(),
|
|
72
74
|
spokeText: Types.typography(),
|
package/dist/kit/style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/kit/style.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,EACL,OAAO,GASR,MAAM,mBAAmB,CAAA;AAI1B,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CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;QAChC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;YAC9B,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;QAChD,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,IAAI,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACxG,OAAO,GAAG,CAAA;IACZ,CAAC,CAAA;AACH,CAAC","sourcesContent":["/**\n * The chart family's style: one `style` entry per chart, built from the groups\n * below, so a look saved off one chart lays onto any other (a field the other\n * chart does not draw is dropped). A chart spreads the shared groups and adds a\n * `marks` group of its own. Every run of text a chart draws is its own\n * `Types.typography` field, so axis labels, titles, values and the legend are\n * each set the way a text node is.\n */\n\nimport {\n Types,\n textOps,\n type Fill,\n type StrokeResolved,\n type Stroke as _Stroke,\n type StyleInput,\n type TextStyle,\n // Named so the emitted style types reach these through the sdk, not core.\n type FillResolved as _FillResolved,\n type Type as _Type,\n} from \"@motionscript/sdk\"\n\nimport type { AxisConfig, ChartSeries, LegendConfig } from \"./shared\"\n\n/** The style family every chart shares; the built-in presets are written for it. */\nexport const CHART_STYLE_FAMILY = \"chart\"\n\n/** The out-of-the-box series fills, cycled by series (or row) index. */\nexport const CHART_PALETTE_DEFAULT = [\"#4f8cff\", \"#2fbf8f\", \"#f5a524\", \"#e5547a\", \"#9b6cf0\"] as const\n\n/** The default ink of values, legend captions and centre text, on the dark stage. */\nexport const CHART_FOREGROUND = \"#f4f4f5\"\n/** The default ink of axis markers, axis captions and spoke labels. */\nexport const CHART_MUTED = \"#a1a1aa\"\n\nexport const CHART_SERIES = {\n /** A fill per series (a pie's or radial's per row), cycled; each may stack several paints. */\n seriesFills: Types.palette(CHART_PALETTE_DEFAULT),\n}\n\nexport const CHART_BACKGROUND = {\n /** Behind the whole chart, legend and axes included; none by default, so the chart reads against the stage. */\n background: Types.fill([]),\n}\n\nexport const GRID_BACKGROUND = {\n ...CHART_BACKGROUND,\n /** Behind the plot only, under the grid lines; none by default. */\n gridBackground: Types.fill([]),\n}\n\n/** The legend's captions, which every chart with a legend draws. */\nexport const LEGEND_TEXT = {\n legendText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_FOREGROUND }),\n}\n\nexport const CARTESIAN_TEXT = {\n /** The markers under the plot: categories on a column chart, values on a horizontal bar chart. */\n xLabelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),\n /** The caption under the plot. */\n xTitleText: Types.typography({ fontSize: 31, fontWeight: 600, fill: CHART_MUTED }),\n /** The markers beside the plot. */\n yLabelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),\n /** The caption beside the plot, turned on its side. */\n yTitleText: Types.typography({ fontSize: 31, fontWeight: 600, fill: CHART_MUTED }),\n /** The figures printed by the marks. */\n valueText: Types.typography({ fontSize: 24, fontWeight: 600, fill: CHART_FOREGROUND }),\n ...LEGEND_TEXT,\n}\n\nexport const CARTESIAN_GRID = {\n /** The lines along the value ticks of a column chart (one per tick); empty draws none. */\n horizontalGrid: Types.stroke({ weight: 2, fill: \"white/15\" }),\n /** The lines under the category markers; empty draws none. */\n verticalGrid: Types.stroke([]),\n /** The baseline and the value-axis rule; empty draws none. */\n axisStroke: Types.stroke([]),\n /** Read as the chart is built: whether the category (x) axis row is drawn. */\n showXAxis: Types.boolean(true, { animatable: false }),\n /** Read as the chart is built: whether the value (y) axis column is drawn. */\n showYAxis: Types.boolean(true, { animatable: false }),\n}\n\nexport type LegendPosition = \"bottom\" | \"top\" | \"right\" | \"none\"\nexport type LegendSwatch = \"square\" | \"circle\" | \"line\"\n\nexport const CHART_LEGEND = {\n /** Read as the chart is built: where the legend sits, or `none`. */\n legend: Types.oneOf([\"bottom\", \"top\", \"right\", \"none\"] as const, { animatable: false }),\n swatch: Types.oneOf([\"square\", \"circle\", \"line\"] as const),\n}\n\n/** The fields every chart's style resolves, whichever groups it spreads. */\nexport interface ChartStyleBase {\n readonly seriesFills: readonly Fill[]\n readonly background: Fill\n readonly legendText: TextStyle\n readonly legend: LegendPosition\n readonly swatch: LegendSwatch\n}\n\n/** The cartesian fields, for the line and bar charts. */\nexport interface CartesianStyle extends ChartStyleBase {\n readonly gridBackground: Fill\n readonly xLabelText: TextStyle\n readonly xTitleText: TextStyle\n readonly yLabelText: TextStyle\n readonly yTitleText: TextStyle\n readonly valueText: TextStyle\n readonly horizontalGrid: StrokeResolved[]\n readonly verticalGrid: StrokeResolved[]\n readonly axisStroke: StrokeResolved[]\n readonly showXAxis: boolean\n readonly showYAxis: boolean\n}\n\n/** The fields a preset restates so its rules and text read on its background (a chart keeps those it draws). */\nconst _PRESET_FIELDS = {\n ...CHART_SERIES,\n ...GRID_BACKGROUND,\n ...CARTESIAN_TEXT,\n labelText: Types.typography(),\n centerText: Types.typography(),\n spokeText: Types.typography(),\n horizontalGrid: CARTESIAN_GRID.horizontalGrid,\n gridStroke: Types.stroke([]),\n spokeStroke: Types.stroke([]),\n track: Types.fill([]),\n}\n\n/** A preset's fields: any chart's, so one preset dresses every chart. */\nexport type ChartStylePreset = StyleInput<typeof _PRESET_FIELDS>\n\n/** Every text field's ink: `foreground` for values, the legend and centre text, `muted` for markers and captions. */\nfunction inks(foreground: string, muted: string) {\n const on = (fill: string) => ({ fill })\n return {\n xLabelText: on(muted),\n xTitleText: on(muted),\n yLabelText: on(muted),\n yTitleText: on(muted),\n valueText: on(foreground),\n legendText: on(foreground),\n labelText: on(muted),\n centerText: on(foreground),\n spokeText: on(muted),\n } satisfies ChartStylePreset\n}\n\n/** Every rule a chart draws, and a radial's track, in one paint. */\nfunction rules(fill: string) {\n return {\n horizontalGrid: { weight: 2, fill },\n gridStroke: { weight: 2, fill },\n spokeStroke: { weight: 2, fill },\n track: fill,\n } satisfies ChartStylePreset\n}\n\n/** Ready-made looks, each stating every colour so applying one replaces the last. */\nexport const CHART_STYLE_PRESETS = {\n midnight: {\n seriesFills: [...CHART_PALETTE_DEFAULT],\n ...inks(CHART_FOREGROUND, CHART_MUTED),\n ...rules(\"white/15\"),\n track: \"white/10\",\n background: [],\n gridBackground: [],\n },\n paper: {\n seriesFills: [\"#2563eb\", \"#059669\", \"#d97706\", \"#db2777\", \"#7c3aed\"],\n ...inks(\"#1c1917\", \"#57534e\"),\n ...rules(\"#1c1917/12\"),\n background: \"#fafaf9\",\n gridBackground: [],\n },\n ember: {\n seriesFills: [\"#d9603b\", \"#8194ad\", \"#e0a93b\", \"#5e9d6b\", \"#9ec85a\"],\n ...inks(\"#e9e1d4\", \"#8a7f70\"),\n ...rules(\"#2c2820\"),\n background: \"#15130e\",\n gridBackground: [],\n },\n neon: {\n seriesFills: [\"#22d3ee\", \"#a3e635\", \"#f472b6\", \"#facc15\", \"#818cf8\"],\n ...inks(\"#ffffff\", \"#94a3b8\"),\n ...rules(\"white/10\"),\n background: [],\n gridBackground: [],\n },\n ocean: {\n seriesFills: [\"#0ea5e9\", \"#14b8a6\", \"#6366f1\", \"#38bdf8\", \"#2dd4bf\"],\n ...inks(\"#e0f2fe\", \"#7dd3fc\"),\n ...rules(\"#7dd3fc/20\"),\n background: \"#082f49\",\n gridBackground: [],\n },\n sunset: {\n seriesFills: [\"#f97316\", \"#ef4444\", \"#ec4899\", \"#f59e0b\", \"#a855f7\"],\n ...inks(\"#fff7ed\", \"#fdba74\"),\n ...rules(\"#fdba74/20\"),\n background: [],\n gridBackground: [],\n },\n pastel: {\n seriesFills: [\"#a5b4fc\", \"#f9a8d4\", \"#86efac\", \"#fde68a\", \"#7dd3fc\"],\n ...inks(\"#f8fafc\", \"#cbd5e1\"),\n ...rules(\"white/12\"),\n background: [],\n gridBackground: [],\n },\n mono: {\n seriesFills: [\"#fafafa\", \"#a3a3a3\", \"#737373\", \"#d4d4d4\", \"#525252\"],\n ...inks(\"#fafafa\", \"#a3a3a3\"),\n ...rules(\"white/12\"),\n background: [],\n gridBackground: [],\n },\n} satisfies Record<string, ChartStylePreset>\n\n/** Series `index`'s fill: its own `fill`, else the style's series fills, cycled. */\nexport function paletteFill(style: Pick<ChartStyleBase, \"seriesFills\">, index: number, own?: Fill): Fill {\n if (own != null) return own\n const fills = style.seriesFills\n return fills.length > 0 ? fills[index % fills.length] : \"white\"\n}\n\n/** {@link paletteFill} for a series. */\nexport function seriesFill(style: Pick<ChartStyleBase, \"seriesFills\">, series: ChartSeries, index: number): Fill {\n return paletteFill(style, index, series.fill)\n}\n\n/** A text style's size in px; an autofit or unset size reads as `fallback`. */\nexport function sizeOf(text: TextStyle | undefined, fallback = 28): number {\n const size = text?.fontSize\n return typeof size === \"number\" && Number.isFinite(size) ? size : fallback\n}\n\n/**\n * `text` as a text node takes it, aligned where the chart puts it, with `over`\n * laid on top. Unset keys are dropped: an `undefined` spread onto a node is a\n * value, and an unset face must stay unset so the host's default applies.\n */\nexport function placedText(text: TextStyle, textAlign: TextStyle[\"textAlign\"] = \"center\", over?: TextStyle): TextStyle {\n return textOps.styleProps({ ...textOps.mergeStyle(text, over), textAlign }) as TextStyle\n}\n\n/** Axis markers on `axis`, aligned as that axis sets them. */\nexport function markerText(style: Pick<CartesianStyle, \"xLabelText\" | \"yLabelText\">, axis: \"x\" | \"y\"): TextStyle {\n return placedText(axis === \"x\" ? style.xLabelText : style.yLabelText, axis === \"x\" ? \"center\" : \"right\")\n}\n\n/** The figures printed by the marks. */\nexport function valueText(style: Pick<CartesianStyle, \"valueText\">, textAlign: TextStyle[\"textAlign\"] = \"center\"): TextStyle {\n return placedText(style.valueText, textAlign)\n}\n\n/**\n * The kit axis parts' config from a style. `x` is the axis under the plot;\n * its grid lines are vertical (one per x marker), the `y` axis's horizontal.\n */\nexport function axisConfigOf(\n style: Pick<CartesianStyle, \"verticalGrid\" | \"horizontalGrid\" | \"xLabelText\" | \"xTitleText\" | \"yLabelText\" | \"yTitleText\">,\n axis: \"x\" | \"y\"\n): AxisConfig {\n const gap = Math.round(sizeOf(axis === \"x\" ? style.xLabelText : style.yLabelText) * 0.6)\n return {\n labelStyle: markerText(style, axis),\n titleStyle: placedText(axis === \"x\" ? style.xTitleText : style.yTitleText),\n lineStyle: axis === \"x\" ? style.verticalGrid : style.horizontalGrid,\n tickPadding: axis === \"x\" ? { top: gap } : { right: gap },\n titlePadding: axis === \"x\" ? { top: Math.round(gap / 2) } : { right: gap },\n }\n}\n\n/** The kit legend's config: captions in `legendText`, the swatch shaped by `swatch` and sized off the captions. */\nexport function legendConfigOf(style: Pick<ChartStyleBase, \"swatch\" | \"legendText\">): LegendConfig {\n const type = sizeOf(style.legendText)\n const size = Math.max(8, Math.round(type * 0.6))\n const marker =\n style.swatch === \"line\"\n ? { width: Math.round(size * 2), height: Math.max(3, Math.round(size / 4)), borderRadius: size }\n : style.swatch === \"circle\"\n ? { width: size, height: size, borderRadius: size / 2 }\n : { width: size, height: size, borderRadius: Math.round(size / 4) }\n return {\n padding: 0,\n textStyle: placedText(style.legendText, \"left\"),\n itemGap: Math.round(type * 1.4),\n markerStyle: { ...marker, stroke: [], shadow: [] },\n }\n}\n\n/** Which text a chart drew from the retired shared text fields. */\nexport type ChartTextLayout = \"cartesian\" | \"pie\" | \"radar\" | \"radial\"\n\n/**\n * The `style` entry's hook for documents written before every run of text got\n * its own field (0.1.1-alpha.1): `barRadius` became `barCornerRadius`, `palette` became `seriesFills`; `foreground`,\n * `muted` and the one `fontFamily`/`fontSize`/`fontWeight` became the text\n * fields as each chart derived them; a cartesian or radar `background`, which\n * painted the plot, became `gridBackground`. A current style comes back as is.\n */\nexport function migrateChartStyle(layout: ChartTextLayout): (value: unknown) => unknown {\n return (value) => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return value\n const old = value as Record<string, unknown>\n const retired = [\"palette\", \"foreground\", \"muted\", \"fontFamily\", \"fontSize\", \"fontWeight\", \"barRadius\"]\n const plotBackground = layout === \"cartesian\" || layout === \"radar\"\n if (!retired.some((key) => key in old) && !(plotBackground && \"background\" in old && !(\"gridBackground\" in old))) return value\n\n const { palette, foreground, muted, fontFamily, fontSize, fontWeight, barRadius, ...rest } = old\n const out: Record<string, unknown> = { ...rest }\n // A bar radius rounded only the far end; its replacement states every corner.\n if (typeof barRadius === \"number\" && out.barCornerRadius === undefined) {\n out.barCornerRadius = { topLeft: barRadius, topRight: barRadius, bottomRight: 0, bottomLeft: 0 }\n }\n if (palette !== undefined && out.seriesFills === undefined) out.seriesFills = palette\n if (plotBackground && \"background\" in old && !(\"gridBackground\" in old)) {\n out.gridBackground = old.background\n delete out.background\n }\n const size = typeof fontSize === \"number\" ? fontSize : undefined\n const weight = typeof fontWeight === \"number\" ? fontWeight : undefined\n const text = (ink: unknown, scale = 1, heavier = 0): Record<string, unknown> | undefined => {\n const t: Record<string, unknown> = {}\n if (typeof fontFamily === \"string\" && fontFamily !== \"\") t.fontFamily = fontFamily\n if (size !== undefined) t.fontSize = Math.round(size * scale)\n if (weight !== undefined) t.fontWeight = Math.min(900, weight + heavier)\n if (ink !== undefined) t.fill = ink\n return Object.keys(t).length > 0 ? t : undefined\n }\n const fields: Record<string, Record<string, unknown> | undefined> = { legendText: text(foreground) }\n if (layout === \"cartesian\") {\n fields.xLabelText = text(muted)\n fields.yLabelText = text(muted)\n fields.xTitleText = text(muted, 1.1, 100)\n fields.yTitleText = text(muted, 1.1, 100)\n fields.valueText = text(foreground, 0.85, 100)\n } else if (layout === \"pie\") {\n fields.labelText = text(muted)\n fields.valueText = text(foreground, 1, 200)\n fields.centerText = text(foreground, 1.8, 300)\n } else if (layout === \"radar\") {\n fields.spokeText = text(muted)\n } else {\n fields.labelText = text(muted)\n fields.centerText = text(foreground, 1.8, 300)\n }\n for (const [key, field] of Object.entries(fields)) if (field && out[key] === undefined) out[key] = field\n return out\n }\n}\n"]}
|
|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AAU,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;YAC3C,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;QAChD,CAAC;aAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YAC9B,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;QAChC,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;YAC9B,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;QAChD,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,IAAI,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACxG,OAAO,GAAG,CAAA;IACZ,CAAC,CAAA;AACH,CAAC","sourcesContent":["/**\n * The chart family's style: one `style` entry per chart, built from the groups\n * below, so a look saved off one chart lays onto any other (a field the other\n * chart does not draw is dropped). A chart spreads the shared groups and adds a\n * `marks` group of its own. Every run of text a chart draws is its own\n * `Types.typography` field, set the way a text node is, in the group of the\n * part it labels: axis text with its axis, values with the labels, the\n * legend's captions with the legend.\n */\n\nimport {\n Types,\n textOps,\n type Fill,\n type StrokeResolved,\n type Stroke as _Stroke,\n type StyleInput,\n type TextStyle,\n // Named so the emitted style types reach these through the sdk, not core.\n type FillResolved as _FillResolved,\n type Type as _Type,\n} from \"@motionscript/sdk\"\n\nimport type { AxisConfig, ChartSeries, LegendConfig } from \"./shared\"\n\n/** The style family every chart shares; the built-in presets are written for it. */\nexport const CHART_STYLE_FAMILY = \"chart\"\n\n/** The out-of-the-box series fills, cycled by series (or row) index. */\nexport const CHART_PALETTE_DEFAULT = [\"#4f8cff\", \"#2fbf8f\", \"#f5a524\", \"#e5547a\", \"#9b6cf0\"] as const\n\n/** The default ink of values, legend captions and centre text, on the dark stage. */\nexport const CHART_FOREGROUND = \"#f4f4f5\"\n/** The default ink of axis markers, axis captions and spoke labels. */\nexport const CHART_MUTED = \"#a1a1aa\"\n\nexport const CHART_SERIES = {\n /** A fill per series (a pie's or radial's per row), cycled; each may stack several paints. */\n seriesFills: Types.palette(CHART_PALETTE_DEFAULT),\n}\n\nexport const CHART_BACKGROUND = {\n /** Behind the whole chart, legend and axes included; none by default, so the chart reads against the stage. */\n background: Types.fill([]),\n}\n\nexport const GRID_BACKGROUND = {\n ...CHART_BACKGROUND,\n /** Behind the plot only, under the grid lines; none by default. */\n gridBackground: Types.fill([]),\n}\n\n/** The figures printed by the marks, for a chart's `labels` group. */\nexport const VALUE_TEXT = {\n valueText: Types.typography({ fontSize: 24, fontWeight: 600, fill: CHART_FOREGROUND }),\n}\n\nexport const CARTESIAN_GRID = {\n /** The lines along the value ticks of a column chart (one per tick); empty draws none. */\n horizontalGrid: Types.stroke({ weight: 2, fill: \"white/15\" }),\n /** The lines under the category markers; empty draws none. */\n verticalGrid: Types.stroke([]),\n}\n\nexport const CARTESIAN_AXES = {\n /** The baseline and the value-axis rule; empty draws none. */\n axisStroke: Types.stroke([]),\n /** Read as the chart is built: whether the category (x) axis row is drawn. */\n showXAxis: Types.boolean(true, { animatable: false }),\n /** The markers under the plot: categories on a column chart, values on a horizontal bar chart. */\n xLabelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),\n /** The caption under the plot. */\n xTitleText: Types.typography({ fontSize: 31, fontWeight: 600, fill: CHART_MUTED }),\n /** Read as the chart is built: whether the value (y) axis column is drawn. */\n showYAxis: Types.boolean(true, { animatable: false }),\n /** The markers beside the plot. */\n yLabelText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_MUTED }),\n /** The caption beside the plot, turned on its side. */\n yTitleText: Types.typography({ fontSize: 31, fontWeight: 600, fill: CHART_MUTED }),\n}\n\nexport type LegendPosition = \"bottom\" | \"top\" | \"right\" | \"none\"\nexport type LegendSwatch = \"square\" | \"circle\" | \"line\"\n\nexport const CHART_LEGEND = {\n /** Read as the chart is built: where the legend sits, or `none`. */\n legend: Types.oneOf([\"bottom\", \"top\", \"right\", \"none\"] as const, { animatable: false }),\n swatch: Types.oneOf([\"square\", \"circle\", \"line\"] as const),\n /** The legend's captions. */\n legendText: Types.typography({ fontSize: 28, fontWeight: 500, fill: CHART_FOREGROUND }),\n}\n\n/** The fields every chart's style resolves, whichever groups it spreads. */\nexport interface ChartStyleBase {\n readonly seriesFills: readonly Fill[]\n readonly background: Fill\n readonly legendText: TextStyle\n readonly legend: LegendPosition\n readonly swatch: LegendSwatch\n}\n\n/** The cartesian fields, for the line and bar charts. */\nexport interface CartesianStyle extends ChartStyleBase {\n readonly gridBackground: Fill\n readonly xLabelText: TextStyle\n readonly xTitleText: TextStyle\n readonly yLabelText: TextStyle\n readonly yTitleText: TextStyle\n readonly valueText: TextStyle\n readonly horizontalGrid: StrokeResolved[]\n readonly verticalGrid: StrokeResolved[]\n readonly axisStroke: StrokeResolved[]\n readonly showXAxis: boolean\n readonly showYAxis: boolean\n}\n\n/** The fields a preset restates so its rules and text read on its background (a chart keeps those it draws). */\nconst _PRESET_FIELDS = {\n ...CHART_SERIES,\n ...GRID_BACKGROUND,\n ...CARTESIAN_AXES,\n ...VALUE_TEXT,\n legendText: CHART_LEGEND.legendText,\n labelText: Types.typography(),\n centerText: Types.typography(),\n spokeText: Types.typography(),\n horizontalGrid: CARTESIAN_GRID.horizontalGrid,\n gridStroke: Types.stroke([]),\n spokeStroke: Types.stroke([]),\n track: Types.fill([]),\n}\n\n/** A preset's fields: any chart's, so one preset dresses every chart. */\nexport type ChartStylePreset = StyleInput<typeof _PRESET_FIELDS>\n\n/** Every text field's ink: `foreground` for values, the legend and centre text, `muted` for markers and captions. */\nfunction inks(foreground: string, muted: string) {\n const on = (fill: string) => ({ fill })\n return {\n xLabelText: on(muted),\n xTitleText: on(muted),\n yLabelText: on(muted),\n yTitleText: on(muted),\n valueText: on(foreground),\n legendText: on(foreground),\n labelText: on(muted),\n centerText: on(foreground),\n spokeText: on(muted),\n } satisfies ChartStylePreset\n}\n\n/** Every rule a chart draws, and a radial's track, in one paint. */\nfunction rules(fill: string) {\n return {\n horizontalGrid: { weight: 2, fill },\n gridStroke: { weight: 2, fill },\n spokeStroke: { weight: 2, fill },\n track: fill,\n } satisfies ChartStylePreset\n}\n\n/** Ready-made looks, each stating every colour so applying one replaces the last. */\nexport const CHART_STYLE_PRESETS = {\n midnight: {\n seriesFills: [...CHART_PALETTE_DEFAULT],\n ...inks(CHART_FOREGROUND, CHART_MUTED),\n ...rules(\"white/15\"),\n track: \"white/10\",\n background: [],\n gridBackground: [],\n },\n paper: {\n seriesFills: [\"#2563eb\", \"#059669\", \"#d97706\", \"#db2777\", \"#7c3aed\"],\n ...inks(\"#1c1917\", \"#57534e\"),\n ...rules(\"#1c1917/12\"),\n background: \"#fafaf9\",\n gridBackground: [],\n },\n ember: {\n seriesFills: [\"#d9603b\", \"#8194ad\", \"#e0a93b\", \"#5e9d6b\", \"#9ec85a\"],\n ...inks(\"#e9e1d4\", \"#8a7f70\"),\n ...rules(\"#2c2820\"),\n background: \"#15130e\",\n gridBackground: [],\n },\n neon: {\n seriesFills: [\"#22d3ee\", \"#a3e635\", \"#f472b6\", \"#facc15\", \"#818cf8\"],\n ...inks(\"#ffffff\", \"#94a3b8\"),\n ...rules(\"white/10\"),\n background: [],\n gridBackground: [],\n },\n ocean: {\n seriesFills: [\"#0ea5e9\", \"#14b8a6\", \"#6366f1\", \"#38bdf8\", \"#2dd4bf\"],\n ...inks(\"#e0f2fe\", \"#7dd3fc\"),\n ...rules(\"#7dd3fc/20\"),\n background: \"#082f49\",\n gridBackground: [],\n },\n sunset: {\n seriesFills: [\"#f97316\", \"#ef4444\", \"#ec4899\", \"#f59e0b\", \"#a855f7\"],\n ...inks(\"#fff7ed\", \"#fdba74\"),\n ...rules(\"#fdba74/20\"),\n background: [],\n gridBackground: [],\n },\n pastel: {\n seriesFills: [\"#a5b4fc\", \"#f9a8d4\", \"#86efac\", \"#fde68a\", \"#7dd3fc\"],\n ...inks(\"#f8fafc\", \"#cbd5e1\"),\n ...rules(\"white/12\"),\n background: [],\n gridBackground: [],\n },\n mono: {\n seriesFills: [\"#fafafa\", \"#a3a3a3\", \"#737373\", \"#d4d4d4\", \"#525252\"],\n ...inks(\"#fafafa\", \"#a3a3a3\"),\n ...rules(\"white/12\"),\n background: [],\n gridBackground: [],\n },\n} satisfies Record<string, ChartStylePreset>\n\n/** Series `index`'s fill: its own `fill`, else the style's series fills, cycled. */\nexport function paletteFill(style: Pick<ChartStyleBase, \"seriesFills\">, index: number, own?: Fill): Fill {\n if (own != null) return own\n const fills = style.seriesFills\n return fills.length > 0 ? fills[index % fills.length] : \"white\"\n}\n\n/** {@link paletteFill} for a series. */\nexport function seriesFill(style: Pick<ChartStyleBase, \"seriesFills\">, series: ChartSeries, index: number): Fill {\n return paletteFill(style, index, series.fill)\n}\n\n/** A text style's size in px; an autofit or unset size reads as `fallback`. */\nexport function sizeOf(text: TextStyle | undefined, fallback = 28): number {\n const size = text?.fontSize\n return typeof size === \"number\" && Number.isFinite(size) ? size : fallback\n}\n\n/**\n * `text` as a text node takes it, aligned where the chart puts it, with `over`\n * laid on top. Unset keys are dropped: an `undefined` spread onto a node is a\n * value, and an unset face must stay unset so the host's default applies.\n */\nexport function placedText(text: TextStyle, textAlign: TextStyle[\"textAlign\"] = \"center\", over?: TextStyle): TextStyle {\n return textOps.styleProps({ ...textOps.mergeStyle(text, over), textAlign }) as TextStyle\n}\n\n/** Axis markers on `axis`, aligned as that axis sets them. */\nexport function markerText(style: Pick<CartesianStyle, \"xLabelText\" | \"yLabelText\">, axis: \"x\" | \"y\"): TextStyle {\n return placedText(axis === \"x\" ? style.xLabelText : style.yLabelText, axis === \"x\" ? \"center\" : \"right\")\n}\n\n/** The figures printed by the marks. */\nexport function valueText(style: Pick<CartesianStyle, \"valueText\">, textAlign: TextStyle[\"textAlign\"] = \"center\"): TextStyle {\n return placedText(style.valueText, textAlign)\n}\n\n/**\n * The kit axis parts' config from a style. `x` is the axis under the plot;\n * its grid lines are vertical (one per x marker), the `y` axis's horizontal.\n */\nexport function axisConfigOf(\n style: Pick<CartesianStyle, \"verticalGrid\" | \"horizontalGrid\" | \"xLabelText\" | \"xTitleText\" | \"yLabelText\" | \"yTitleText\">,\n axis: \"x\" | \"y\"\n): AxisConfig {\n const gap = Math.round(sizeOf(axis === \"x\" ? style.xLabelText : style.yLabelText) * 0.6)\n return {\n labelStyle: markerText(style, axis),\n titleStyle: placedText(axis === \"x\" ? style.xTitleText : style.yTitleText),\n lineStyle: axis === \"x\" ? style.verticalGrid : style.horizontalGrid,\n tickPadding: axis === \"x\" ? { top: gap } : { right: gap },\n titlePadding: axis === \"x\" ? { top: Math.round(gap / 2) } : { right: gap },\n }\n}\n\n/** The kit legend's config: captions in `legendText`, the swatch shaped by `swatch` and sized off the captions. */\nexport function legendConfigOf(style: Pick<ChartStyleBase, \"swatch\" | \"legendText\">): LegendConfig {\n const type = sizeOf(style.legendText)\n const size = Math.max(8, Math.round(type * 0.6))\n const marker =\n style.swatch === \"line\"\n ? { width: Math.round(size * 2), height: Math.max(3, Math.round(size / 4)), borderRadius: size }\n : style.swatch === \"circle\"\n ? { width: size, height: size, borderRadius: size / 2 }\n : { width: size, height: size, borderRadius: Math.round(size / 4) }\n return {\n padding: 0,\n textStyle: placedText(style.legendText, \"left\"),\n itemGap: Math.round(type * 1.4),\n markerStyle: { ...marker, stroke: [], shadow: [] },\n }\n}\n\n/** Which text a chart drew from the retired shared text fields. */\nexport type ChartTextLayout = \"cartesian\" | \"pie\" | \"radar\" | \"radial\"\n\n/**\n * The `style` entry's hook for documents written before every run of text got\n * its own field (0.1.1-alpha.1): `barRadius` became `barCornerRadius`, `palette` became `seriesFills`; `foreground`,\n * `muted` and the one `fontFamily`/`fontSize`/`fontWeight` became the text\n * fields as each chart derived them; a cartesian or radar `background`, which\n * painted the plot, became `gridBackground`. A current style comes back as is.\n */\nexport function migrateChartStyle(layout: ChartTextLayout): (value: unknown) => unknown {\n return (value) => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return value\n const old = value as Record<string, unknown>\n const retired = [\"palette\", \"foreground\", \"muted\", \"fontFamily\", \"fontSize\", \"fontWeight\", \"barRadius\"]\n const plotBackground = layout === \"cartesian\" || layout === \"radar\"\n if (!retired.some((key) => key in old) && !(plotBackground && \"background\" in old && !(\"gridBackground\" in old))) return value\n\n const { palette, foreground, muted, fontFamily, fontSize, fontWeight, barRadius, ...rest } = old\n const out: Record<string, unknown> = { ...rest }\n // A bar radius rounded only the far end; its replacement states every corner.\n if (typeof barRadius === \"number\" && out.barCornerRadius === undefined) {\n out.barCornerRadius = { topLeft: barRadius, topRight: barRadius, bottomRight: 0, bottomLeft: 0 }\n }\n if (palette !== undefined && out.seriesFills === undefined) out.seriesFills = palette\n if (plotBackground && \"background\" in old && !(\"gridBackground\" in old)) {\n out.gridBackground = old.background\n delete out.background\n }\n const size = typeof fontSize === \"number\" ? fontSize : undefined\n const weight = typeof fontWeight === \"number\" ? fontWeight : undefined\n const text = (ink: unknown, scale = 1, heavier = 0): Record<string, unknown> | undefined => {\n const t: Record<string, unknown> = {}\n if (typeof fontFamily === \"string\" && fontFamily !== \"\") t.fontFamily = fontFamily\n if (size !== undefined) t.fontSize = Math.round(size * scale)\n if (weight !== undefined) t.fontWeight = Math.min(900, weight + heavier)\n if (ink !== undefined) t.fill = ink\n return Object.keys(t).length > 0 ? t : undefined\n }\n const fields: Record<string, Record<string, unknown> | undefined> = { legendText: text(foreground) }\n if (layout === \"cartesian\") {\n fields.xLabelText = text(muted)\n fields.yLabelText = text(muted)\n fields.xTitleText = text(muted, 1.1, 100)\n fields.yTitleText = text(muted, 1.1, 100)\n fields.valueText = text(foreground, 0.85, 100)\n } else if (layout === \"pie\") {\n fields.labelText = text(muted)\n fields.valueText = text(foreground, 1, 200)\n fields.centerText = text(foreground, 1.8, 300)\n } else if (layout === \"radar\") {\n fields.spokeText = text(muted)\n } else {\n fields.labelText = text(muted)\n fields.centerText = text(foreground, 1.8, 300)\n }\n for (const [key, field] of Object.entries(fields)) if (field && out[key] === undefined) out[key] = field\n return out\n }\n}\n"]}
|