@antv/gpt-vis 1.0.0-beta.2 → 1.0.1
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/README.md +282 -43
- package/README.zh-CN.md +286 -47
- package/dist/cjs/gpt-vis/index.js +1 -1
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/util/animation.d.ts +2 -0
- package/dist/cjs/util/animation.js +38 -0
- package/dist/cjs/util/components.d.ts +15 -0
- package/dist/cjs/util/components.js +94 -0
- package/dist/cjs/util/crosshair-axis-labels.d.ts +9 -0
- package/dist/cjs/util/crosshair-axis-labels.js +304 -0
- package/dist/cjs/util/index.d.ts +6 -0
- package/dist/cjs/util/index.js +33 -0
- package/dist/cjs/util/interaction.d.ts +14 -0
- package/dist/cjs/util/interaction.js +89 -0
- package/dist/cjs/util/theme.d.ts +18 -24
- package/dist/cjs/util/theme.js +303 -120
- package/dist/cjs/util/tokens.d.ts +31 -0
- package/dist/cjs/util/tokens.js +98 -0
- package/dist/cjs/vis/area/index.d.ts +2 -2
- package/dist/cjs/vis/area/index.js +76 -31
- package/dist/cjs/vis/bar/index.d.ts +2 -2
- package/dist/cjs/vis/bar/index.js +22 -19
- package/dist/cjs/vis/boxplot/index.js +1 -4
- package/dist/cjs/vis/column/index.d.ts +2 -2
- package/dist/cjs/vis/column/index.js +28 -18
- package/dist/cjs/vis/dual-axes/index.d.ts +2 -2
- package/dist/cjs/vis/dual-axes/index.js +90 -36
- package/dist/cjs/vis/fishbone-diagram/index.js +12 -4
- package/dist/cjs/vis/flow-diagram/index.js +27 -11
- package/dist/cjs/vis/funnel/index.d.ts +4 -2
- package/dist/cjs/vis/funnel/index.js +171 -92
- package/dist/cjs/vis/histogram/index.js +1 -4
- package/dist/cjs/vis/indented-tree/index.js +13 -3
- package/dist/cjs/vis/line/index.d.ts +2 -2
- package/dist/cjs/vis/line/index.js +71 -31
- package/dist/cjs/vis/liquid/index.d.ts +2 -2
- package/dist/cjs/vis/liquid/index.js +41 -16
- package/dist/cjs/vis/mindmap/index.js +12 -4
- package/dist/cjs/vis/network-graph/index.js +11 -2
- package/dist/cjs/vis/organization-chart/index.js +12 -3
- package/dist/cjs/vis/pie/index.d.ts +2 -2
- package/dist/cjs/vis/pie/index.js +26 -16
- package/dist/cjs/vis/radar/index.d.ts +2 -2
- package/dist/cjs/vis/radar/index.js +21 -29
- package/dist/cjs/vis/sankey/index.js +1 -4
- package/dist/cjs/vis/scatter/index.d.ts +4 -2
- package/dist/cjs/vis/scatter/index.js +43 -16
- package/dist/cjs/vis/treemap/index.js +1 -4
- package/dist/cjs/vis/venn/index.js +1 -4
- package/dist/cjs/vis/violin/index.js +1 -1
- package/dist/cjs/vis/waterfall/index.js +2 -2
- package/dist/cjs/vis/word-cloud/index.d.ts +3 -2
- package/dist/cjs/vis/word-cloud/index.js +125 -10
- package/dist/esm/gpt-vis/index.js +1 -1
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/esm/util/animation.d.ts +2 -0
- package/dist/esm/util/animation.js +17 -0
- package/dist/esm/util/components.d.ts +15 -0
- package/dist/esm/util/components.js +67 -0
- package/dist/esm/util/crosshair-axis-labels.d.ts +9 -0
- package/dist/esm/util/crosshair-axis-labels.js +328 -0
- package/dist/esm/util/index.d.ts +6 -0
- package/dist/esm/util/index.js +6 -0
- package/dist/esm/util/interaction.d.ts +14 -0
- package/dist/esm/util/interaction.js +73 -0
- package/dist/esm/util/theme.d.ts +18 -24
- package/dist/esm/util/theme.js +302 -126
- package/dist/esm/util/tokens.d.ts +31 -0
- package/dist/esm/util/tokens.js +64 -0
- package/dist/esm/vis/area/index.d.ts +2 -2
- package/dist/esm/vis/area/index.js +91 -41
- package/dist/esm/vis/bar/index.d.ts +2 -2
- package/dist/esm/vis/bar/index.js +28 -29
- package/dist/esm/vis/boxplot/index.js +4 -5
- package/dist/esm/vis/column/index.d.ts +2 -2
- package/dist/esm/vis/column/index.js +36 -29
- package/dist/esm/vis/dual-axes/index.d.ts +2 -2
- package/dist/esm/vis/dual-axes/index.js +123 -43
- package/dist/esm/vis/fishbone-diagram/index.js +6 -5
- package/dist/esm/vis/flow-diagram/index.js +17 -10
- package/dist/esm/vis/funnel/index.d.ts +4 -2
- package/dist/esm/vis/funnel/index.js +156 -83
- package/dist/esm/vis/histogram/index.js +4 -5
- package/dist/esm/vis/indented-tree/index.js +9 -4
- package/dist/esm/vis/line/index.d.ts +2 -2
- package/dist/esm/vis/line/index.js +80 -37
- package/dist/esm/vis/liquid/index.d.ts +2 -2
- package/dist/esm/vis/liquid/index.js +41 -14
- package/dist/esm/vis/mindmap/index.js +6 -5
- package/dist/esm/vis/network-graph/index.js +5 -3
- package/dist/esm/vis/organization-chart/index.js +6 -4
- package/dist/esm/vis/pie/index.d.ts +2 -2
- package/dist/esm/vis/pie/index.js +36 -16
- package/dist/esm/vis/radar/index.d.ts +2 -2
- package/dist/esm/vis/radar/index.js +21 -34
- package/dist/esm/vis/sankey/index.js +4 -5
- package/dist/esm/vis/scatter/index.d.ts +4 -2
- package/dist/esm/vis/scatter/index.js +45 -19
- package/dist/esm/vis/treemap/index.js +4 -5
- package/dist/esm/vis/venn/index.js +4 -5
- package/dist/esm/vis/violin/index.js +5 -13
- package/dist/esm/vis/waterfall/index.js +11 -11
- package/dist/esm/vis/word-cloud/index.d.ts +3 -2
- package/dist/esm/vis/word-cloud/index.js +158 -10
- package/dist/umd/index.min.js +1 -1
- package/package.json +18 -19
package/dist/cjs/util/theme.js
CHANGED
|
@@ -29,17 +29,17 @@ __export(theme_exports, {
|
|
|
29
29
|
normalizePalette: () => normalizePalette
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(theme_exports);
|
|
32
|
+
var import_tokens = require("./tokens");
|
|
32
33
|
var DEFAULT_COLOR_PALETTE = [
|
|
33
|
-
"#
|
|
34
|
-
"#
|
|
35
|
-
"#
|
|
36
|
-
"#
|
|
37
|
-
"#
|
|
38
|
-
"#
|
|
39
|
-
"#
|
|
40
|
-
"#
|
|
41
|
-
"#
|
|
42
|
-
"#17C76F"
|
|
34
|
+
"#5B6CFF",
|
|
35
|
+
"#2DAF9E",
|
|
36
|
+
"#F2B84B",
|
|
37
|
+
"#EF6A6A",
|
|
38
|
+
"#55A6D9",
|
|
39
|
+
"#3AA76D",
|
|
40
|
+
"#F58A57",
|
|
41
|
+
"#8B6FD6",
|
|
42
|
+
"#D96C9B"
|
|
43
43
|
];
|
|
44
44
|
var ACADEMY_COLOR_PALETTE = [
|
|
45
45
|
"#4e79a7",
|
|
@@ -53,127 +53,310 @@ var ACADEMY_COLOR_PALETTE = [
|
|
|
53
53
|
"#9c755f",
|
|
54
54
|
"#bab0ab"
|
|
55
55
|
];
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
var filterBaselineGrid = (_, index) => index !== 0;
|
|
57
|
+
var createTheme = (type) => {
|
|
58
|
+
const tokens = (0, import_tokens.getChartVisualTokens)(type);
|
|
59
|
+
const isDark = type === "dark";
|
|
60
|
+
const isAcademy = type === "academy";
|
|
61
|
+
const colors = isAcademy ? ACADEMY_COLOR_PALETTE : DEFAULT_COLOR_PALETTE;
|
|
62
|
+
return {
|
|
63
|
+
type,
|
|
64
|
+
color: colors[0],
|
|
65
|
+
category10: colors,
|
|
66
|
+
category20: colors,
|
|
67
|
+
view: {
|
|
68
|
+
viewFill: tokens.background,
|
|
69
|
+
plotFill: "transparent",
|
|
70
|
+
mainFill: "transparent",
|
|
71
|
+
contentFill: "transparent"
|
|
72
|
+
},
|
|
73
|
+
interval: {
|
|
74
|
+
rect: {
|
|
75
|
+
fillOpacity: 0.96
|
|
76
|
+
}
|
|
77
|
+
},
|
|
70
78
|
line: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
line: {
|
|
80
|
+
lineWidth: import_tokens.CHART_STYLE_DEFAULTS.lineWidth
|
|
81
|
+
}
|
|
82
|
+
},
|
|
75
83
|
area: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
area: {
|
|
85
|
+
fillOpacity: import_tokens.CHART_STYLE_DEFAULTS.areaOpacity
|
|
86
|
+
}
|
|
87
|
+
},
|
|
80
88
|
point: {
|
|
81
|
-
|
|
89
|
+
point: {
|
|
90
|
+
lineWidth: import_tokens.CHART_STYLE_DEFAULTS.pointLineWidth,
|
|
91
|
+
fillOpacity: 0.82
|
|
92
|
+
},
|
|
93
|
+
hollow: {
|
|
94
|
+
lineWidth: 2,
|
|
95
|
+
strokeOpacity: 1
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
enter: {
|
|
99
|
+
duration: import_tokens.CHART_STYLE_DEFAULTS.animationDuration,
|
|
100
|
+
easing: "ease-out"
|
|
101
|
+
},
|
|
102
|
+
axis: {
|
|
103
|
+
labelAutoHide: { keepHeader: true, keepTail: true },
|
|
104
|
+
titleOpacity: 1,
|
|
105
|
+
titleFillOpacity: 1,
|
|
106
|
+
labelOpacity: 1,
|
|
107
|
+
labelFillOpacity: 1,
|
|
108
|
+
line: true,
|
|
109
|
+
lineLineWidth: 1,
|
|
110
|
+
lineStroke: tokens.axisLine,
|
|
111
|
+
lineStrokeOpacity: 1,
|
|
112
|
+
tick: true,
|
|
113
|
+
tickLineWidth: 1,
|
|
114
|
+
tickStroke: tokens.axisTick,
|
|
115
|
+
tickStrokeOpacity: 1,
|
|
116
|
+
...isAcademy ? {
|
|
117
|
+
titleFill: "#000000",
|
|
118
|
+
titleStrokeOpacity: 1,
|
|
119
|
+
titleFontSize: 11,
|
|
120
|
+
titleFontWeight: "bold",
|
|
121
|
+
titleSpacing: 12,
|
|
122
|
+
labelFill: "#000000",
|
|
123
|
+
labelStrokeOpacity: 1,
|
|
124
|
+
labelFontSize: 10,
|
|
125
|
+
labelFontWeight: "normal",
|
|
126
|
+
labelSpacing: 4,
|
|
127
|
+
tickLength: 5
|
|
128
|
+
} : {
|
|
129
|
+
titleFill: tokens.textSecondary,
|
|
130
|
+
titleFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
131
|
+
titleFontSize: 12,
|
|
132
|
+
titleFontWeight: 500,
|
|
133
|
+
titleLineWidth: 0,
|
|
134
|
+
titleSpacing: 16,
|
|
135
|
+
labelFill: tokens.textSecondary,
|
|
136
|
+
labelFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
137
|
+
labelFontSize: 12,
|
|
138
|
+
labelFontWeight: 400,
|
|
139
|
+
labelLineWidth: 0,
|
|
140
|
+
labelSpacing: 6,
|
|
141
|
+
tickLength: 3,
|
|
142
|
+
tickOpacity: 1
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
axisX: {
|
|
146
|
+
grid: isAcademy,
|
|
147
|
+
labelAutoRotate: {
|
|
148
|
+
optionalAngles: [0, 45, 90],
|
|
149
|
+
recoverWhenFailed: true
|
|
150
|
+
},
|
|
151
|
+
...isAcademy ? {
|
|
152
|
+
gridStroke: tokens.axisGrid,
|
|
153
|
+
gridStrokeOpacity: 1,
|
|
154
|
+
gridLineWidth: 1,
|
|
155
|
+
gridLineDash: [0, 0]
|
|
156
|
+
} : {}
|
|
157
|
+
},
|
|
158
|
+
axisY: {
|
|
159
|
+
lineLineWidth: isAcademy ? 1 : 0.75,
|
|
160
|
+
grid: true,
|
|
161
|
+
gridStroke: tokens.axisGrid,
|
|
162
|
+
gridStrokeOpacity: 1,
|
|
163
|
+
gridLineWidth: isAcademy ? 1 : 0.5,
|
|
164
|
+
gridLineDash: isAcademy ? [0, 0] : [2, 4],
|
|
165
|
+
gridFilter: filterBaselineGrid
|
|
166
|
+
},
|
|
167
|
+
axisRadar: {
|
|
168
|
+
zIndex: 1,
|
|
169
|
+
titleFill: isAcademy ? tokens.textPrimary : tokens.textSecondary,
|
|
170
|
+
titleFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
171
|
+
titleFontSize: isAcademy ? 10 : 12,
|
|
172
|
+
titleFontWeight: isAcademy ? 600 : 500,
|
|
173
|
+
titleSpacing: 10,
|
|
174
|
+
labelFill: tokens.textSecondary,
|
|
175
|
+
labelOpacity: 1,
|
|
176
|
+
labelFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
177
|
+
labelFontSize: isAcademy ? 10 : 11,
|
|
178
|
+
line: true,
|
|
179
|
+
lineStroke: tokens.axisLine,
|
|
180
|
+
lineStrokeOpacity: isAcademy ? 1 : 0.64,
|
|
181
|
+
lineLineWidth: isAcademy ? 1 : 0.75,
|
|
182
|
+
tick: true,
|
|
183
|
+
tickLength: isAcademy ? 4 : 2,
|
|
184
|
+
tickStroke: tokens.axisTick,
|
|
185
|
+
tickStrokeOpacity: isAcademy ? 1 : 0.68,
|
|
186
|
+
tickCount: 4,
|
|
187
|
+
gridStroke: tokens.axisGrid,
|
|
188
|
+
gridStrokeOpacity: isAcademy ? 1 : 0.9,
|
|
189
|
+
gridLineWidth: isAcademy ? 1 : 0.75,
|
|
190
|
+
gridLineDash: [0, 0]
|
|
191
|
+
},
|
|
192
|
+
title: {
|
|
193
|
+
spacing: 6,
|
|
194
|
+
titleFill: tokens.textPrimary,
|
|
195
|
+
titleFontSize: 16,
|
|
196
|
+
titleFontWeight: 600,
|
|
197
|
+
subtitleFill: tokens.textSecondary,
|
|
198
|
+
subtitleFontSize: 12,
|
|
199
|
+
subtitleFontWeight: 400
|
|
200
|
+
},
|
|
201
|
+
legendCategory: {
|
|
202
|
+
backgroundFill: "transparent",
|
|
203
|
+
padding: [5, 0, 10, 0],
|
|
204
|
+
itemMarkerSize: 10,
|
|
205
|
+
itemMarkerFillOpacity: 0.92,
|
|
206
|
+
itemMarkerStrokeOpacity: 0.92,
|
|
207
|
+
itemLabelFill: tokens.textPrimary,
|
|
208
|
+
itemLabelFillOpacity: 0.78,
|
|
209
|
+
itemLabelFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
210
|
+
itemLabelFontSize: 12,
|
|
211
|
+
itemLabelFontWeight: 400,
|
|
212
|
+
itemLabelLineHeight: 16,
|
|
213
|
+
itemLabelLetterSpacing: 0.1,
|
|
214
|
+
itemLabelTextBaseline: "middle",
|
|
215
|
+
itemSpacing: [8, 0, 0],
|
|
216
|
+
itemCursor: "pointer",
|
|
217
|
+
rowPadding: 8,
|
|
218
|
+
colPadding: 22,
|
|
219
|
+
navButtonFill: tokens.textSecondary,
|
|
220
|
+
navButtonFillOpacity: 0.72,
|
|
221
|
+
navButtonSize: 9,
|
|
222
|
+
navPageNumFill: tokens.textSecondary,
|
|
223
|
+
navPageNumFillOpacity: 0.72,
|
|
224
|
+
navPageNumFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
225
|
+
navPageNumFontSize: 11,
|
|
226
|
+
navPageNumFontWeight: 400,
|
|
227
|
+
navControllerPadding: 4,
|
|
228
|
+
navControllerSpacing: 14
|
|
229
|
+
},
|
|
230
|
+
tooltip: {
|
|
231
|
+
shared: false,
|
|
232
|
+
series: false,
|
|
233
|
+
crosshairs: false,
|
|
234
|
+
marker: true,
|
|
235
|
+
markerR: 4,
|
|
236
|
+
markerLineWidth: 2,
|
|
237
|
+
markerStroke: tokens.background,
|
|
238
|
+
crosshairsStroke: tokens.textSecondary,
|
|
239
|
+
crosshairsStrokeOpacity: 0.18,
|
|
240
|
+
crosshairsLineWidth: 1,
|
|
241
|
+
crosshairsLineDash: [0, 0],
|
|
242
|
+
css: {
|
|
243
|
+
".g2-tooltip": {
|
|
244
|
+
"background-color": tokens.tooltipBackground,
|
|
245
|
+
border: `1px solid ${tokens.tooltipBorder}`,
|
|
246
|
+
"border-radius": "10px",
|
|
247
|
+
"box-shadow": tokens.tooltipShadow,
|
|
248
|
+
color: tokens.textSecondary,
|
|
249
|
+
padding: "10px 12px",
|
|
250
|
+
"min-width": "164px",
|
|
251
|
+
"max-width": "300px",
|
|
252
|
+
overflow: "hidden",
|
|
253
|
+
"box-sizing": "border-box",
|
|
254
|
+
"backdrop-filter": "blur(10px) saturate(1.08)",
|
|
255
|
+
"-webkit-backdrop-filter": "blur(10px) saturate(1.08)",
|
|
256
|
+
"font-family": import_tokens.CHART_FONT_FAMILY,
|
|
257
|
+
"font-size": "12px",
|
|
258
|
+
"line-height": "18px",
|
|
259
|
+
"font-variant-numeric": "tabular-nums",
|
|
260
|
+
"font-feature-settings": '"tnum" 1, "zero" 1',
|
|
261
|
+
"-webkit-font-smoothing": "antialiased",
|
|
262
|
+
contain: "layout paint style"
|
|
263
|
+
},
|
|
264
|
+
".g2-tooltip-title": {
|
|
265
|
+
color: tokens.textSecondary,
|
|
266
|
+
"font-size": "11px",
|
|
267
|
+
"font-weight": "500",
|
|
268
|
+
"line-height": "16px",
|
|
269
|
+
"letter-spacing": "0.01em",
|
|
270
|
+
"margin-bottom": "6px",
|
|
271
|
+
"padding-bottom": "7px",
|
|
272
|
+
"border-bottom": `1px solid ${tokens.tooltipDivider}`,
|
|
273
|
+
"max-width": "276px"
|
|
274
|
+
},
|
|
275
|
+
".g2-tooltip-list": {
|
|
276
|
+
display: "grid",
|
|
277
|
+
gap: "4px"
|
|
278
|
+
},
|
|
279
|
+
".g2-tooltip-list-item": {
|
|
280
|
+
display: "grid",
|
|
281
|
+
"grid-template-columns": "minmax(0, 1fr) auto",
|
|
282
|
+
"align-items": "center",
|
|
283
|
+
"column-gap": "18px",
|
|
284
|
+
"min-height": "22px",
|
|
285
|
+
"line-height": "22px"
|
|
286
|
+
},
|
|
287
|
+
".g2-tooltip-list-item-name": {
|
|
288
|
+
gap: "8px",
|
|
289
|
+
"min-width": "0",
|
|
290
|
+
"max-width": "208px",
|
|
291
|
+
overflow: "hidden",
|
|
292
|
+
color: tokens.textSecondary
|
|
293
|
+
},
|
|
294
|
+
".g2-tooltip-list-item-name-label": {
|
|
295
|
+
color: tokens.textSecondary,
|
|
296
|
+
"font-weight": "400"
|
|
297
|
+
},
|
|
298
|
+
".g2-tooltip-list-item-value": {
|
|
299
|
+
color: tokens.textPrimary,
|
|
300
|
+
"font-weight": "600",
|
|
301
|
+
flex: "0 0 auto",
|
|
302
|
+
"min-width": "40px",
|
|
303
|
+
"margin-left": "0",
|
|
304
|
+
"text-align": "right",
|
|
305
|
+
"letter-spacing": "-0.01em",
|
|
306
|
+
"font-variant-numeric": "tabular-nums",
|
|
307
|
+
"font-feature-settings": '"tnum" 1, "zero" 1'
|
|
308
|
+
},
|
|
309
|
+
".g2-tooltip-list-item-marker": {
|
|
310
|
+
width: "7px",
|
|
311
|
+
height: "7px",
|
|
312
|
+
flex: "0 0 auto",
|
|
313
|
+
"margin-right": "0",
|
|
314
|
+
"border-radius": "999px",
|
|
315
|
+
"box-shadow": tokens.tooltipMarkerShadow
|
|
316
|
+
},
|
|
317
|
+
".g2-tooltip-crosshair-x": {
|
|
318
|
+
"background-color": isDark ? "rgba(255, 255, 255, 0.16)" : "rgba(71, 84, 103, 0.16)"
|
|
319
|
+
},
|
|
320
|
+
".g2-tooltip-crosshair-y": {
|
|
321
|
+
"background-color": isDark ? "rgba(255, 255, 255, 0.16)" : "rgba(71, 84, 103, 0.16)"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
elementHighlight: {
|
|
326
|
+
delay: import_tokens.CHART_STYLE_DEFAULTS.interactionDelay
|
|
327
|
+
},
|
|
328
|
+
elementHighlightByColor: {
|
|
329
|
+
delay: import_tokens.CHART_STYLE_DEFAULTS.interactionDelay
|
|
330
|
+
},
|
|
331
|
+
elementHoverScale: {
|
|
332
|
+
delay: import_tokens.CHART_STYLE_DEFAULTS.interactionDelay,
|
|
333
|
+
scale: 1.04,
|
|
334
|
+
shadow: true,
|
|
335
|
+
shadowBlur: isDark ? 7 : isAcademy ? 5 : 6,
|
|
336
|
+
shadowColor: isDark ? "rgba(226, 232, 240, 0.38)" : isAcademy ? "rgba(63, 49, 38, 0.44)" : "rgba(15, 23, 42, 0.46)",
|
|
337
|
+
shadowOffsetX: 0,
|
|
338
|
+
shadowOffsetY: isDark ? 0 : 3,
|
|
339
|
+
zIndex: 10
|
|
82
340
|
}
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
var DARK_THEME = {
|
|
86
|
-
type: "dark",
|
|
87
|
-
view: {
|
|
88
|
-
viewFill: "#000",
|
|
89
|
-
plotFill: "transparent",
|
|
90
|
-
mainFill: "transparent",
|
|
91
|
-
contentFill: "transparent"
|
|
92
|
-
},
|
|
93
|
-
interval: {
|
|
94
|
-
rect: {
|
|
95
|
-
fillOpacity: 0.8
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
line: {
|
|
99
|
-
line: {
|
|
100
|
-
lineWidth: 2
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
area: {
|
|
104
|
-
area: {
|
|
105
|
-
fillOpacity: 0.6
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
point: {
|
|
109
|
-
point: {
|
|
110
|
-
lineWidth: 1
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
var ACADEMY_THEME = {
|
|
115
|
-
type: "academy",
|
|
116
|
-
view: {
|
|
117
|
-
viewFill: "#FFF",
|
|
118
|
-
plotFill: "transparent",
|
|
119
|
-
mainFill: "transparent",
|
|
120
|
-
contentFill: "transparent"
|
|
121
|
-
},
|
|
122
|
-
interval: {
|
|
123
|
-
rect: {
|
|
124
|
-
fillOpacity: 0.8
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
line: {
|
|
128
|
-
line: {
|
|
129
|
-
lineWidth: 2
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
area: {
|
|
133
|
-
area: {
|
|
134
|
-
fillOpacity: 0.6
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
point: {
|
|
138
|
-
point: {
|
|
139
|
-
lineWidth: 1
|
|
140
|
-
}
|
|
141
|
-
}
|
|
341
|
+
};
|
|
142
342
|
};
|
|
343
|
+
var LIGHT_THEME = createTheme("light");
|
|
344
|
+
var ACADEMY_THEME = createTheme("academy");
|
|
345
|
+
var DARK_THEME = createTheme("dark");
|
|
143
346
|
var THEME_MAP = {
|
|
144
|
-
default:
|
|
347
|
+
default: LIGHT_THEME,
|
|
348
|
+
light: LIGHT_THEME,
|
|
145
349
|
academy: ACADEMY_THEME,
|
|
146
350
|
dark: DARK_THEME
|
|
147
351
|
};
|
|
148
|
-
var getTheme = (theme) =>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
var
|
|
152
|
-
return THEME_MAP[theme] || THEME_MAP.default;
|
|
153
|
-
};
|
|
154
|
-
var getThemeColors = (theme) => {
|
|
155
|
-
switch (theme) {
|
|
156
|
-
case "academy":
|
|
157
|
-
return ACADEMY_COLOR_PALETTE;
|
|
158
|
-
case "dark":
|
|
159
|
-
case "default":
|
|
160
|
-
default:
|
|
161
|
-
return DEFAULT_COLOR_PALETTE;
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
var getBackgroundColor = (theme) => {
|
|
165
|
-
switch (theme) {
|
|
166
|
-
case "dark":
|
|
167
|
-
return "#000";
|
|
168
|
-
case "academy":
|
|
169
|
-
case "default":
|
|
170
|
-
default:
|
|
171
|
-
return "#FFF";
|
|
172
|
-
}
|
|
173
|
-
};
|
|
352
|
+
var getTheme = (theme) => theme === "default" ? "light" : theme;
|
|
353
|
+
var getThemeObject = (theme) => THEME_MAP[theme] || THEME_MAP.default;
|
|
354
|
+
var getThemeColors = (theme) => theme === "academy" ? ACADEMY_COLOR_PALETTE : DEFAULT_COLOR_PALETTE;
|
|
355
|
+
var getBackgroundColor = (theme) => (0, import_tokens.getChartVisualTokens)(theme).background;
|
|
174
356
|
var normalizePalette = (palette, theme) => {
|
|
175
|
-
if (!palette || Array.isArray(palette) && palette.length === 0)
|
|
357
|
+
if (!palette || Array.isArray(palette) && palette.length === 0) {
|
|
176
358
|
return getThemeColors(theme);
|
|
359
|
+
}
|
|
177
360
|
return Array.isArray(palette) ? palette : [palette];
|
|
178
361
|
};
|
|
179
362
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { VisualizationTheme } from '../types';
|
|
2
|
+
export declare const CHART_FONT_FAMILY = "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif";
|
|
3
|
+
export declare const CHART_STYLE_DEFAULTS: {
|
|
4
|
+
readonly animationDuration: 260;
|
|
5
|
+
readonly interactionDelay: 40;
|
|
6
|
+
readonly lineWidth: 2.5;
|
|
7
|
+
readonly areaOpacity: 0.24;
|
|
8
|
+
readonly lineOpacity: 0.92;
|
|
9
|
+
readonly inactiveOpacity: 0.24;
|
|
10
|
+
readonly pointSize: 3.5;
|
|
11
|
+
readonly scatterPointSize: 5;
|
|
12
|
+
readonly pointLineWidth: 1.5;
|
|
13
|
+
readonly pointActiveLineWidth: 5;
|
|
14
|
+
readonly intervalWidthRatio: 0.64;
|
|
15
|
+
};
|
|
16
|
+
export type ChartVisualTokens = {
|
|
17
|
+
background: string;
|
|
18
|
+
textPrimary: string;
|
|
19
|
+
textSecondary: string;
|
|
20
|
+
grid: string;
|
|
21
|
+
axisGrid: string;
|
|
22
|
+
axisLine: string;
|
|
23
|
+
axisTick: string;
|
|
24
|
+
separator: string;
|
|
25
|
+
tooltipBackground: string;
|
|
26
|
+
tooltipBorder: string;
|
|
27
|
+
tooltipDivider: string;
|
|
28
|
+
tooltipMarkerShadow: string;
|
|
29
|
+
tooltipShadow: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const getChartVisualTokens: (theme: VisualizationTheme) => ChartVisualTokens;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/util/tokens.ts
|
|
20
|
+
var tokens_exports = {};
|
|
21
|
+
__export(tokens_exports, {
|
|
22
|
+
CHART_FONT_FAMILY: () => CHART_FONT_FAMILY,
|
|
23
|
+
CHART_STYLE_DEFAULTS: () => CHART_STYLE_DEFAULTS,
|
|
24
|
+
getChartVisualTokens: () => getChartVisualTokens
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(tokens_exports);
|
|
27
|
+
var CHART_FONT_FAMILY = 'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif';
|
|
28
|
+
var CHART_STYLE_DEFAULTS = {
|
|
29
|
+
animationDuration: 260,
|
|
30
|
+
interactionDelay: 40,
|
|
31
|
+
lineWidth: 2.5,
|
|
32
|
+
areaOpacity: 0.24,
|
|
33
|
+
lineOpacity: 0.92,
|
|
34
|
+
inactiveOpacity: 0.24,
|
|
35
|
+
pointSize: 3.5,
|
|
36
|
+
scatterPointSize: 5,
|
|
37
|
+
pointLineWidth: 1.5,
|
|
38
|
+
pointActiveLineWidth: 5,
|
|
39
|
+
intervalWidthRatio: 0.64
|
|
40
|
+
};
|
|
41
|
+
var LIGHT_TOKENS = {
|
|
42
|
+
background: "#FFFFFF",
|
|
43
|
+
textPrimary: "#1F2937",
|
|
44
|
+
textSecondary: "#667085",
|
|
45
|
+
grid: "#E7EAF0",
|
|
46
|
+
axisGrid: "#EAECF0",
|
|
47
|
+
axisLine: "#D0D5DD",
|
|
48
|
+
axisTick: "#98A2B3",
|
|
49
|
+
separator: "#FFFFFF",
|
|
50
|
+
tooltipBackground: "rgba(255, 255, 255, 0.96)",
|
|
51
|
+
tooltipBorder: "rgba(15, 23, 42, 0.09)",
|
|
52
|
+
tooltipDivider: "rgba(15, 23, 42, 0.08)",
|
|
53
|
+
tooltipMarkerShadow: "0 0 0 2px #FFFFFF, 0 1px 3px rgba(15, 23, 42, 0.20)",
|
|
54
|
+
tooltipShadow: "0 12px 32px rgba(15, 23, 42, 0.12), 0 3px 8px rgba(15, 23, 42, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.82)"
|
|
55
|
+
};
|
|
56
|
+
var DARK_TOKENS = {
|
|
57
|
+
background: "#141414",
|
|
58
|
+
textPrimary: "#F3F4F6",
|
|
59
|
+
textSecondary: "#A7AFBE",
|
|
60
|
+
grid: "#343841",
|
|
61
|
+
axisGrid: "#2B2F36",
|
|
62
|
+
axisLine: "#454B56",
|
|
63
|
+
axisTick: "#596170",
|
|
64
|
+
separator: "#141414",
|
|
65
|
+
tooltipBackground: "rgba(26, 27, 31, 0.96)",
|
|
66
|
+
tooltipBorder: "rgba(255, 255, 255, 0.12)",
|
|
67
|
+
tooltipDivider: "rgba(255, 255, 255, 0.10)",
|
|
68
|
+
tooltipMarkerShadow: "0 0 0 2px #1A1B1F, 0 1px 3px rgba(0, 0, 0, 0.42)",
|
|
69
|
+
tooltipShadow: "0 14px 36px rgba(0, 0, 0, 0.34), 0 3px 10px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08)"
|
|
70
|
+
};
|
|
71
|
+
var ACADEMY_TOKENS = {
|
|
72
|
+
background: "#FFFFFF",
|
|
73
|
+
textPrimary: "#23262D",
|
|
74
|
+
textSecondary: "#626975",
|
|
75
|
+
grid: "#DDDDDD",
|
|
76
|
+
axisGrid: "#DDDDDD",
|
|
77
|
+
axisLine: "#888888",
|
|
78
|
+
axisTick: "#000000",
|
|
79
|
+
separator: "#FFFFFF",
|
|
80
|
+
tooltipBackground: "rgba(255, 253, 249, 0.98)",
|
|
81
|
+
tooltipBorder: "rgba(83, 72, 60, 0.14)",
|
|
82
|
+
tooltipDivider: "rgba(83, 72, 60, 0.12)",
|
|
83
|
+
tooltipMarkerShadow: "0 0 0 2px #FFFDF9, 0 1px 3px rgba(63, 49, 38, 0.20)",
|
|
84
|
+
tooltipShadow: "0 12px 30px rgba(63, 49, 38, 0.11), 0 3px 8px rgba(63, 49, 38, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.88)"
|
|
85
|
+
};
|
|
86
|
+
var getChartVisualTokens = (theme) => {
|
|
87
|
+
if (theme === "dark")
|
|
88
|
+
return DARK_TOKENS;
|
|
89
|
+
if (theme === "academy")
|
|
90
|
+
return ACADEMY_TOKENS;
|
|
91
|
+
return LIGHT_TOKENS;
|
|
92
|
+
};
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
CHART_FONT_FAMILY,
|
|
96
|
+
CHART_STYLE_DEFAULTS,
|
|
97
|
+
getChartVisualTokens
|
|
98
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VisualizationOptions } from '../../types';
|
|
1
|
+
import type { VisualizationOptions, VisualizationTheme } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* AreaDataItem is the type for each data item in the area chart.
|
|
4
4
|
*/
|
|
@@ -17,7 +17,7 @@ export interface AreaConfig {
|
|
|
17
17
|
title?: string;
|
|
18
18
|
axisXTitle?: string;
|
|
19
19
|
axisYTitle?: string;
|
|
20
|
-
theme?:
|
|
20
|
+
theme?: VisualizationTheme;
|
|
21
21
|
style?: {
|
|
22
22
|
backgroundColor?: string;
|
|
23
23
|
palette?: string[];
|