@antv/gpt-vis 1.0.2 → 1.3.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 +53 -7
- package/README.zh-CN.md +32 -9
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/theme/g2.d.ts +9 -0
- package/dist/cjs/theme/g2.js +605 -0
- package/dist/cjs/theme/g6.d.ts +28 -0
- package/dist/cjs/theme/g6.js +124 -0
- package/dist/cjs/theme/merge.d.ts +2 -0
- package/dist/cjs/theme/merge.js +49 -0
- package/dist/cjs/theme/presets.d.ts +5 -0
- package/dist/cjs/theme/presets.js +663 -0
- package/dist/cjs/theme/resolve.d.ts +7 -0
- package/dist/cjs/theme/resolve.js +59 -0
- package/dist/cjs/theme/shared.d.ts +7 -0
- package/dist/cjs/theme/shared.js +61 -0
- package/dist/cjs/theme/summary.d.ts +11 -0
- package/dist/cjs/theme/summary.js +61 -0
- package/dist/cjs/theme/table.d.ts +13 -0
- package/dist/cjs/theme/table.js +121 -0
- package/dist/cjs/types/index.d.ts +8 -5
- package/dist/cjs/types/theme.d.ts +109 -0
- package/dist/cjs/types/theme.js +17 -0
- package/dist/cjs/util/animation.js +6 -1
- package/dist/cjs/util/components.d.ts +20 -0
- package/dist/cjs/util/components.js +40 -0
- package/dist/cjs/util/crosshair-axis-labels.d.ts +1 -2
- package/dist/cjs/util/crosshair-axis-labels.js +17 -0
- package/dist/cjs/util/index.d.ts +0 -2
- package/dist/cjs/util/index.js +1 -5
- package/dist/cjs/util/interaction.d.ts +4 -3
- package/dist/cjs/util/interaction.js +14 -1
- package/dist/cjs/util/tokens.d.ts +4 -3
- package/dist/cjs/util/tokens.js +9 -6
- package/dist/cjs/vis/area/index.d.ts +3 -6
- package/dist/cjs/vis/area/index.js +43 -30
- package/dist/cjs/vis/bar/index.d.ts +5 -5
- package/dist/cjs/vis/bar/index.js +34 -20
- package/dist/cjs/vis/boxplot/index.d.ts +4 -5
- package/dist/cjs/vis/boxplot/index.js +36 -23
- package/dist/cjs/vis/column/index.d.ts +5 -5
- package/dist/cjs/vis/column/index.js +38 -26
- package/dist/cjs/vis/dual-axes/index.d.ts +3 -4
- package/dist/cjs/vis/dual-axes/index.js +70 -52
- package/dist/cjs/vis/fishbone-diagram/index.d.ts +4 -10
- package/dist/cjs/vis/fishbone-diagram/index.js +43 -28
- package/dist/cjs/vis/flow-diagram/index.d.ts +4 -6
- package/dist/cjs/vis/flow-diagram/index.js +21 -22
- package/dist/cjs/vis/funnel/index.d.ts +3 -5
- package/dist/cjs/vis/funnel/index.js +63 -42
- package/dist/cjs/vis/histogram/index.d.ts +4 -6
- package/dist/cjs/vis/histogram/index.js +17 -19
- package/dist/cjs/vis/indented-tree/index.d.ts +4 -6
- package/dist/cjs/vis/indented-tree/index.js +58 -34
- package/dist/cjs/vis/line/index.d.ts +3 -6
- package/dist/cjs/vis/line/index.js +43 -22
- package/dist/cjs/vis/liquid/index.d.ts +4 -6
- package/dist/cjs/vis/liquid/index.js +22 -17
- package/dist/cjs/vis/mindmap/index.d.ts +4 -6
- package/dist/cjs/vis/mindmap/index.js +43 -25
- package/dist/cjs/vis/network-graph/index.d.ts +4 -6
- package/dist/cjs/vis/network-graph/index.js +26 -20
- package/dist/cjs/vis/organization-chart/index.d.ts +4 -6
- package/dist/cjs/vis/organization-chart/index.js +39 -33
- package/dist/cjs/vis/pie/index.d.ts +3 -5
- package/dist/cjs/vis/pie/index.js +45 -26
- package/dist/cjs/vis/radar/index.d.ts +3 -6
- package/dist/cjs/vis/radar/index.js +32 -24
- package/dist/cjs/vis/sankey/index.d.ts +4 -6
- package/dist/cjs/vis/sankey/index.js +17 -7
- package/dist/cjs/vis/scatter/index.d.ts +3 -5
- package/dist/cjs/vis/scatter/index.js +32 -19
- package/dist/cjs/vis/summary/index.js +5 -6
- package/dist/cjs/vis/table/index.d.ts +4 -2
- package/dist/cjs/vis/table/index.js +46 -4
- package/dist/cjs/vis/treemap/index.d.ts +4 -6
- package/dist/cjs/vis/treemap/index.js +11 -7
- package/dist/cjs/vis/venn/index.d.ts +4 -6
- package/dist/cjs/vis/venn/index.js +18 -16
- package/dist/cjs/vis/violin/index.d.ts +4 -5
- package/dist/cjs/vis/violin/index.js +35 -27
- package/dist/cjs/vis/waterfall/index.d.ts +4 -4
- package/dist/cjs/vis/waterfall/index.js +48 -39
- package/dist/cjs/vis/word-cloud/index.d.ts +3 -5
- package/dist/cjs/vis/word-cloud/index.js +18 -12
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/theme/g2.d.ts +9 -0
- package/dist/esm/theme/g2.js +504 -0
- package/dist/esm/theme/g6.d.ts +28 -0
- package/dist/esm/theme/g6.js +84 -0
- package/dist/esm/theme/merge.d.ts +2 -0
- package/dist/esm/theme/merge.js +36 -0
- package/dist/esm/theme/presets.d.ts +5 -0
- package/dist/esm/theme/presets.js +1070 -0
- package/dist/esm/theme/resolve.d.ts +7 -0
- package/dist/esm/theme/resolve.js +31 -0
- package/dist/esm/theme/shared.d.ts +7 -0
- package/dist/esm/theme/shared.js +21 -0
- package/dist/esm/theme/summary.d.ts +11 -0
- package/dist/esm/theme/summary.js +45 -0
- package/dist/esm/theme/table.d.ts +13 -0
- package/dist/esm/theme/table.js +112 -0
- package/dist/esm/types/index.d.ts +8 -5
- package/dist/esm/types/theme.d.ts +109 -0
- package/dist/esm/types/theme.js +1 -0
- package/dist/esm/util/animation.js +12 -2
- package/dist/esm/util/components.d.ts +20 -0
- package/dist/esm/util/components.js +57 -1
- package/dist/esm/util/crosshair-axis-labels.d.ts +1 -2
- package/dist/esm/util/crosshair-axis-labels.js +18 -0
- package/dist/esm/util/index.d.ts +0 -2
- package/dist/esm/util/index.js +1 -3
- package/dist/esm/util/interaction.d.ts +4 -3
- package/dist/esm/util/interaction.js +18 -1
- package/dist/esm/util/tokens.d.ts +4 -3
- package/dist/esm/util/tokens.js +9 -6
- package/dist/esm/vis/area/index.d.ts +3 -6
- package/dist/esm/vis/area/index.js +53 -45
- package/dist/esm/vis/bar/index.d.ts +5 -5
- package/dist/esm/vis/bar/index.js +38 -27
- package/dist/esm/vis/boxplot/index.d.ts +4 -5
- package/dist/esm/vis/boxplot/index.js +47 -29
- package/dist/esm/vis/column/index.d.ts +5 -5
- package/dist/esm/vis/column/index.js +46 -36
- package/dist/esm/vis/dual-axes/index.d.ts +3 -4
- package/dist/esm/vis/dual-axes/index.js +68 -58
- package/dist/esm/vis/fishbone-diagram/index.d.ts +4 -10
- package/dist/esm/vis/fishbone-diagram/index.js +52 -27
- package/dist/esm/vis/flow-diagram/index.d.ts +4 -6
- package/dist/esm/vis/flow-diagram/index.js +28 -23
- package/dist/esm/vis/funnel/index.d.ts +3 -5
- package/dist/esm/vis/funnel/index.js +63 -54
- package/dist/esm/vis/histogram/index.d.ts +4 -6
- package/dist/esm/vis/histogram/index.js +28 -21
- package/dist/esm/vis/indented-tree/index.d.ts +4 -6
- package/dist/esm/vis/indented-tree/index.js +59 -52
- package/dist/esm/vis/line/index.d.ts +3 -6
- package/dist/esm/vis/line/index.js +44 -32
- package/dist/esm/vis/liquid/index.d.ts +4 -6
- package/dist/esm/vis/liquid/index.js +28 -21
- package/dist/esm/vis/mindmap/index.d.ts +4 -6
- package/dist/esm/vis/mindmap/index.js +32 -28
- package/dist/esm/vis/network-graph/index.d.ts +4 -6
- package/dist/esm/vis/network-graph/index.js +37 -22
- package/dist/esm/vis/organization-chart/index.d.ts +4 -6
- package/dist/esm/vis/organization-chart/index.js +47 -36
- package/dist/esm/vis/pie/index.d.ts +3 -5
- package/dist/esm/vis/pie/index.js +42 -26
- package/dist/esm/vis/radar/index.d.ts +3 -6
- package/dist/esm/vis/radar/index.js +28 -20
- package/dist/esm/vis/sankey/index.d.ts +4 -6
- package/dist/esm/vis/sankey/index.js +20 -10
- package/dist/esm/vis/scatter/index.d.ts +3 -5
- package/dist/esm/vis/scatter/index.js +32 -21
- package/dist/esm/vis/summary/index.js +5 -7
- package/dist/esm/vis/table/index.d.ts +4 -2
- package/dist/esm/vis/table/index.js +41 -4
- package/dist/esm/vis/treemap/index.d.ts +4 -6
- package/dist/esm/vis/treemap/index.js +16 -11
- package/dist/esm/vis/venn/index.d.ts +4 -6
- package/dist/esm/vis/venn/index.js +24 -16
- package/dist/esm/vis/violin/index.d.ts +4 -5
- package/dist/esm/vis/violin/index.js +45 -37
- package/dist/esm/vis/waterfall/index.d.ts +4 -4
- package/dist/esm/vis/waterfall/index.js +46 -36
- package/dist/esm/vis/word-cloud/index.d.ts +3 -5
- package/dist/esm/vis/word-cloud/index.js +24 -17
- package/dist/umd/index.min.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/util/theme.d.ts +0 -20
- package/dist/cjs/util/theme.js +0 -372
- package/dist/esm/util/theme.d.ts +0 -20
- package/dist/esm/util/theme.js +0 -326
|
@@ -0,0 +1,605 @@
|
|
|
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/theme/g2.ts
|
|
20
|
+
var g2_exports = {};
|
|
21
|
+
__export(g2_exports, {
|
|
22
|
+
getThemeObject: () => getThemeObject
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(g2_exports);
|
|
25
|
+
var import_tokens = require("../util/tokens");
|
|
26
|
+
var import_merge = require("./merge");
|
|
27
|
+
var import_resolve = require("./resolve");
|
|
28
|
+
var import_shared = require("./shared");
|
|
29
|
+
var createTheme = (type) => {
|
|
30
|
+
const tokens = (0, import_tokens.getChartVisualTokens)(type);
|
|
31
|
+
const isDark = type === "dark";
|
|
32
|
+
const isAcademy = type === "academy";
|
|
33
|
+
const colors = isAcademy ? import_shared.ACADEMY_COLOR_PALETTE : import_shared.DEFAULT_COLOR_PALETTE;
|
|
34
|
+
return {
|
|
35
|
+
type,
|
|
36
|
+
color: colors[0],
|
|
37
|
+
category10: colors,
|
|
38
|
+
category20: colors,
|
|
39
|
+
view: {
|
|
40
|
+
viewFill: tokens.background,
|
|
41
|
+
plotFill: "transparent",
|
|
42
|
+
mainFill: "transparent",
|
|
43
|
+
contentFill: "transparent"
|
|
44
|
+
},
|
|
45
|
+
interval: {
|
|
46
|
+
rect: {
|
|
47
|
+
fillOpacity: 0.96
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
line: {
|
|
51
|
+
line: {
|
|
52
|
+
lineWidth: import_tokens.CHART_STYLE_DEFAULTS.lineWidth
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
area: {
|
|
56
|
+
area: {
|
|
57
|
+
fillOpacity: import_tokens.CHART_STYLE_DEFAULTS.areaOpacity
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
point: {
|
|
61
|
+
point: {
|
|
62
|
+
lineWidth: import_tokens.CHART_STYLE_DEFAULTS.pointLineWidth,
|
|
63
|
+
fillOpacity: 0.82
|
|
64
|
+
},
|
|
65
|
+
hollow: {
|
|
66
|
+
lineWidth: 2,
|
|
67
|
+
strokeOpacity: 1
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
axis: {
|
|
71
|
+
labelAutoHide: { keepHeader: true, keepTail: true },
|
|
72
|
+
titleOpacity: 1,
|
|
73
|
+
titleFillOpacity: 1,
|
|
74
|
+
labelOpacity: 1,
|
|
75
|
+
labelFillOpacity: 1,
|
|
76
|
+
line: true,
|
|
77
|
+
lineLineWidth: 1,
|
|
78
|
+
lineStroke: tokens.axisLine,
|
|
79
|
+
lineStrokeOpacity: 1,
|
|
80
|
+
tick: true,
|
|
81
|
+
tickLineWidth: 1,
|
|
82
|
+
tickStroke: tokens.axisTick,
|
|
83
|
+
tickStrokeOpacity: 1,
|
|
84
|
+
...isAcademy ? {
|
|
85
|
+
titleFill: "#000000",
|
|
86
|
+
titleStrokeOpacity: 1,
|
|
87
|
+
titleFontSize: 11,
|
|
88
|
+
titleFontWeight: "bold",
|
|
89
|
+
titleSpacing: 12,
|
|
90
|
+
labelFill: "#000000",
|
|
91
|
+
labelStrokeOpacity: 1,
|
|
92
|
+
labelFontSize: 10,
|
|
93
|
+
labelFontWeight: "normal",
|
|
94
|
+
labelSpacing: 4,
|
|
95
|
+
tickLength: 5
|
|
96
|
+
} : {
|
|
97
|
+
titleFill: tokens.textSecondary,
|
|
98
|
+
titleFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
99
|
+
titleFontSize: 12,
|
|
100
|
+
titleFontWeight: 500,
|
|
101
|
+
titleLineWidth: 0,
|
|
102
|
+
titleSpacing: 16,
|
|
103
|
+
labelFill: tokens.textSecondary,
|
|
104
|
+
labelFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
105
|
+
labelFontSize: 12,
|
|
106
|
+
labelFontWeight: 400,
|
|
107
|
+
labelLineWidth: 0,
|
|
108
|
+
labelSpacing: 6,
|
|
109
|
+
tickLength: 3,
|
|
110
|
+
tickOpacity: 1
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
axisX: {
|
|
114
|
+
grid: isAcademy,
|
|
115
|
+
labelAutoRotate: { optionalAngles: [0, 45, 90], recoverWhenFailed: true },
|
|
116
|
+
...isAcademy ? {
|
|
117
|
+
gridStroke: tokens.axisGrid,
|
|
118
|
+
gridStrokeOpacity: 1,
|
|
119
|
+
gridLineWidth: 1,
|
|
120
|
+
gridLineDash: [0, 0]
|
|
121
|
+
} : {}
|
|
122
|
+
},
|
|
123
|
+
axisY: {
|
|
124
|
+
lineLineWidth: 1,
|
|
125
|
+
grid: true,
|
|
126
|
+
gridStroke: tokens.axisGrid,
|
|
127
|
+
gridStrokeOpacity: 1,
|
|
128
|
+
gridLineWidth: isAcademy ? 1 : 0.75,
|
|
129
|
+
gridLineDash: isAcademy ? [0, 0] : [3, 3],
|
|
130
|
+
gridFilter: (_, index) => index !== 0
|
|
131
|
+
},
|
|
132
|
+
axisRadar: {
|
|
133
|
+
zIndex: 1,
|
|
134
|
+
titleFill: isAcademy ? tokens.textPrimary : tokens.textSecondary,
|
|
135
|
+
titleFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
136
|
+
titleFontSize: isAcademy ? 10 : 12,
|
|
137
|
+
titleFontWeight: isAcademy ? 600 : 500,
|
|
138
|
+
titleSpacing: 10,
|
|
139
|
+
labelFill: tokens.textSecondary,
|
|
140
|
+
labelOpacity: 1,
|
|
141
|
+
labelFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
142
|
+
labelFontSize: isAcademy ? 10 : 11,
|
|
143
|
+
line: true,
|
|
144
|
+
lineStroke: tokens.axisLine,
|
|
145
|
+
lineStrokeOpacity: isAcademy ? 1 : 0.64,
|
|
146
|
+
lineLineWidth: isAcademy ? 1 : 0.75,
|
|
147
|
+
tick: true,
|
|
148
|
+
tickLength: isAcademy ? 4 : 2,
|
|
149
|
+
tickStroke: tokens.axisTick,
|
|
150
|
+
tickStrokeOpacity: isAcademy ? 1 : 0.68,
|
|
151
|
+
tickCount: 4,
|
|
152
|
+
gridStroke: tokens.axisGrid,
|
|
153
|
+
gridStrokeOpacity: isAcademy ? 1 : 0.9,
|
|
154
|
+
gridLineWidth: isAcademy ? 1 : 0.75,
|
|
155
|
+
gridLineDash: [0, 0]
|
|
156
|
+
},
|
|
157
|
+
title: {
|
|
158
|
+
spacing: 6,
|
|
159
|
+
titleFill: tokens.textPrimary,
|
|
160
|
+
titleFontSize: 16,
|
|
161
|
+
titleFontWeight: 600,
|
|
162
|
+
subtitleFill: tokens.textSecondary,
|
|
163
|
+
subtitleFontSize: 12,
|
|
164
|
+
subtitleFontWeight: 400
|
|
165
|
+
},
|
|
166
|
+
legendCategory: {
|
|
167
|
+
backgroundFill: "transparent",
|
|
168
|
+
padding: [5, 0, 10, 0],
|
|
169
|
+
itemMarkerSize: 10,
|
|
170
|
+
itemMarkerFillOpacity: 0.92,
|
|
171
|
+
itemMarkerStrokeOpacity: 0.92,
|
|
172
|
+
itemLabelFill: tokens.textPrimary,
|
|
173
|
+
itemLabelFillOpacity: 0.78,
|
|
174
|
+
itemLabelFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
175
|
+
itemLabelFontSize: 12,
|
|
176
|
+
itemLabelFontWeight: 400,
|
|
177
|
+
itemLabelLineHeight: 16,
|
|
178
|
+
itemLabelLetterSpacing: 0.1,
|
|
179
|
+
itemLabelTextBaseline: "middle",
|
|
180
|
+
itemSpacing: [8, 0, 0],
|
|
181
|
+
itemCursor: "pointer",
|
|
182
|
+
rowPadding: 8,
|
|
183
|
+
colPadding: 22,
|
|
184
|
+
navButtonFill: tokens.textSecondary,
|
|
185
|
+
navButtonFillOpacity: 0.72,
|
|
186
|
+
navButtonSize: 9,
|
|
187
|
+
navPageNumFill: tokens.textSecondary,
|
|
188
|
+
navPageNumFillOpacity: 0.72,
|
|
189
|
+
navPageNumFontFamily: import_tokens.CHART_FONT_FAMILY,
|
|
190
|
+
navPageNumFontSize: 11,
|
|
191
|
+
navPageNumFontWeight: 400,
|
|
192
|
+
navControllerPadding: 4,
|
|
193
|
+
navControllerSpacing: 14
|
|
194
|
+
},
|
|
195
|
+
tooltip: {
|
|
196
|
+
markerR: 4,
|
|
197
|
+
markerLineWidth: 2,
|
|
198
|
+
markerStroke: tokens.background,
|
|
199
|
+
crosshairsStroke: tokens.textSecondary,
|
|
200
|
+
crosshairsStrokeOpacity: 0.18,
|
|
201
|
+
crosshairsLineWidth: 1,
|
|
202
|
+
crosshairsLineDash: [0, 0],
|
|
203
|
+
css: {
|
|
204
|
+
".g2-tooltip": {
|
|
205
|
+
"background-color": tokens.tooltipBackground,
|
|
206
|
+
border: `1px solid ${tokens.tooltipBorder}`,
|
|
207
|
+
"border-radius": "10px",
|
|
208
|
+
"box-shadow": tokens.tooltipShadow,
|
|
209
|
+
color: tokens.textSecondary,
|
|
210
|
+
padding: "10px 12px",
|
|
211
|
+
"min-width": "164px",
|
|
212
|
+
"max-width": "300px",
|
|
213
|
+
overflow: "hidden",
|
|
214
|
+
"box-sizing": "border-box",
|
|
215
|
+
"backdrop-filter": "blur(10px) saturate(1.08)",
|
|
216
|
+
"-webkit-backdrop-filter": "blur(10px) saturate(1.08)",
|
|
217
|
+
"font-family": import_tokens.CHART_FONT_FAMILY,
|
|
218
|
+
"font-size": "12px",
|
|
219
|
+
"line-height": "18px",
|
|
220
|
+
"font-variant-numeric": "tabular-nums",
|
|
221
|
+
"font-feature-settings": '"tnum" 1, "zero" 1',
|
|
222
|
+
"-webkit-font-smoothing": "antialiased",
|
|
223
|
+
contain: "layout paint style"
|
|
224
|
+
},
|
|
225
|
+
".g2-tooltip-title": {
|
|
226
|
+
color: tokens.textSecondary,
|
|
227
|
+
"font-size": "11px",
|
|
228
|
+
"font-weight": "500",
|
|
229
|
+
"line-height": "16px",
|
|
230
|
+
"letter-spacing": "0.01em",
|
|
231
|
+
"margin-bottom": "6px",
|
|
232
|
+
"padding-bottom": "7px",
|
|
233
|
+
"border-bottom": `1px solid ${tokens.tooltipDivider}`,
|
|
234
|
+
"max-width": "276px"
|
|
235
|
+
},
|
|
236
|
+
".g2-tooltip-list": {
|
|
237
|
+
display: "grid",
|
|
238
|
+
gap: "4px"
|
|
239
|
+
},
|
|
240
|
+
".g2-tooltip-list-item": {
|
|
241
|
+
display: "grid",
|
|
242
|
+
"grid-template-columns": "minmax(0, 1fr) auto",
|
|
243
|
+
"align-items": "center",
|
|
244
|
+
"column-gap": "18px",
|
|
245
|
+
"min-height": "22px",
|
|
246
|
+
"line-height": "22px"
|
|
247
|
+
},
|
|
248
|
+
".g2-tooltip-list-item-name": {
|
|
249
|
+
gap: "8px",
|
|
250
|
+
"min-width": "0",
|
|
251
|
+
"max-width": "208px",
|
|
252
|
+
overflow: "hidden",
|
|
253
|
+
color: tokens.textSecondary
|
|
254
|
+
},
|
|
255
|
+
".g2-tooltip-list-item-name-label": {
|
|
256
|
+
color: tokens.textSecondary,
|
|
257
|
+
"font-weight": "400"
|
|
258
|
+
},
|
|
259
|
+
".g2-tooltip-list-item-value": {
|
|
260
|
+
color: tokens.textPrimary,
|
|
261
|
+
"font-weight": "600",
|
|
262
|
+
flex: "0 0 auto",
|
|
263
|
+
"min-width": "40px",
|
|
264
|
+
"margin-left": "0",
|
|
265
|
+
"text-align": "right",
|
|
266
|
+
"letter-spacing": "-0.01em",
|
|
267
|
+
"font-variant-numeric": "tabular-nums",
|
|
268
|
+
"font-feature-settings": '"tnum" 1, "zero" 1'
|
|
269
|
+
},
|
|
270
|
+
".g2-tooltip-list-item-marker": {
|
|
271
|
+
width: "7px",
|
|
272
|
+
height: "7px",
|
|
273
|
+
flex: "0 0 auto",
|
|
274
|
+
"margin-right": "0",
|
|
275
|
+
"border-radius": "999px",
|
|
276
|
+
"box-shadow": tokens.tooltipMarkerShadow
|
|
277
|
+
},
|
|
278
|
+
".g2-tooltip-crosshair-x": {
|
|
279
|
+
"background-color": isDark ? "rgba(255, 255, 255, 0.16)" : "rgba(71, 84, 103, 0.16)"
|
|
280
|
+
},
|
|
281
|
+
".g2-tooltip-crosshair-y": {
|
|
282
|
+
"background-color": isDark ? "rgba(255, 255, 255, 0.16)" : "rgba(71, 84, 103, 0.16)"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
var TITLE_KEYS = [
|
|
289
|
+
"align",
|
|
290
|
+
"spacing",
|
|
291
|
+
"titleFill",
|
|
292
|
+
"titleFillOpacity",
|
|
293
|
+
"titleFontFamily",
|
|
294
|
+
"titleFontSize",
|
|
295
|
+
"titleFontWeight",
|
|
296
|
+
"subtitleFill",
|
|
297
|
+
"subtitleFillOpacity",
|
|
298
|
+
"subtitleFontFamily",
|
|
299
|
+
"subtitleFontSize",
|
|
300
|
+
"subtitleFontWeight"
|
|
301
|
+
];
|
|
302
|
+
var AXIS_KEYS = [
|
|
303
|
+
"line",
|
|
304
|
+
"lineStroke",
|
|
305
|
+
"lineStrokeOpacity",
|
|
306
|
+
"lineLineWidth",
|
|
307
|
+
"lineLineDash",
|
|
308
|
+
"tick",
|
|
309
|
+
"tickStroke",
|
|
310
|
+
"tickStrokeOpacity",
|
|
311
|
+
"tickOpacity",
|
|
312
|
+
"tickLineWidth",
|
|
313
|
+
"tickLength",
|
|
314
|
+
"grid",
|
|
315
|
+
"gridStroke",
|
|
316
|
+
"gridStrokeOpacity",
|
|
317
|
+
"gridLineWidth",
|
|
318
|
+
"gridLineDash",
|
|
319
|
+
"labelFill",
|
|
320
|
+
"labelFillOpacity",
|
|
321
|
+
"labelOpacity",
|
|
322
|
+
"labelFontFamily",
|
|
323
|
+
"labelFontSize",
|
|
324
|
+
"labelFontWeight",
|
|
325
|
+
"labelSpacing",
|
|
326
|
+
"titleFill",
|
|
327
|
+
"titleFillOpacity",
|
|
328
|
+
"titleOpacity",
|
|
329
|
+
"titleFontFamily",
|
|
330
|
+
"titleFontSize",
|
|
331
|
+
"titleFontWeight",
|
|
332
|
+
"titleSpacing"
|
|
333
|
+
];
|
|
334
|
+
var LEGEND_KEYS = [
|
|
335
|
+
"titleFill",
|
|
336
|
+
"titleFillOpacity",
|
|
337
|
+
"titleFontFamily",
|
|
338
|
+
"titleFontSize",
|
|
339
|
+
"titleFontWeight",
|
|
340
|
+
"titleSpacing",
|
|
341
|
+
"itemLabelFill",
|
|
342
|
+
"itemLabelFillOpacity",
|
|
343
|
+
"itemLabelFontFamily",
|
|
344
|
+
"itemLabelFontSize",
|
|
345
|
+
"itemLabelFontWeight",
|
|
346
|
+
"itemLabelLineHeight",
|
|
347
|
+
"itemLabelLetterSpacing",
|
|
348
|
+
"itemSpacing",
|
|
349
|
+
"itemMarkerSize",
|
|
350
|
+
"itemMarkerFillOpacity",
|
|
351
|
+
"itemMarkerStroke",
|
|
352
|
+
"itemMarkerStrokeOpacity",
|
|
353
|
+
"itemMarkerLineWidth",
|
|
354
|
+
"rowPadding",
|
|
355
|
+
"colPadding"
|
|
356
|
+
];
|
|
357
|
+
var LABEL_KEYS = [
|
|
358
|
+
"fill",
|
|
359
|
+
"fillOpacity",
|
|
360
|
+
"stroke",
|
|
361
|
+
"strokeOpacity",
|
|
362
|
+
"lineWidth",
|
|
363
|
+
"opacity",
|
|
364
|
+
"fontFamily",
|
|
365
|
+
"fontSize",
|
|
366
|
+
"fontWeight",
|
|
367
|
+
"fontStyle",
|
|
368
|
+
"lineHeight"
|
|
369
|
+
];
|
|
370
|
+
var MARK_PAINT_KEYS = [
|
|
371
|
+
"fillOpacity",
|
|
372
|
+
"strokeOpacity",
|
|
373
|
+
"lineWidth",
|
|
374
|
+
"lineDash",
|
|
375
|
+
"opacity",
|
|
376
|
+
"shadowColor",
|
|
377
|
+
"shadowBlur",
|
|
378
|
+
"shadowOffsetX",
|
|
379
|
+
"shadowOffsetY"
|
|
380
|
+
];
|
|
381
|
+
var MARK_KEYS = {
|
|
382
|
+
line: [...MARK_PAINT_KEYS, "shape", "lineCap", "lineJoin"],
|
|
383
|
+
area: [...MARK_PAINT_KEYS, "shape"],
|
|
384
|
+
point: [...MARK_PAINT_KEYS, "shape", "size", "stroke"],
|
|
385
|
+
interval: [
|
|
386
|
+
...MARK_PAINT_KEYS,
|
|
387
|
+
"shape",
|
|
388
|
+
"stroke",
|
|
389
|
+
"radius",
|
|
390
|
+
"radiusTopLeft",
|
|
391
|
+
"radiusTopRight",
|
|
392
|
+
"radiusBottomLeft",
|
|
393
|
+
"radiusBottomRight"
|
|
394
|
+
],
|
|
395
|
+
box: [...MARK_PAINT_KEYS, "shape", "stroke"],
|
|
396
|
+
path: [...MARK_PAINT_KEYS, "shape", "stroke"],
|
|
397
|
+
density: [...MARK_PAINT_KEYS, "stroke"],
|
|
398
|
+
link: [...MARK_PAINT_KEYS, "shape", "stroke"],
|
|
399
|
+
connector: [
|
|
400
|
+
...MARK_PAINT_KEYS,
|
|
401
|
+
"stroke",
|
|
402
|
+
"endMarker",
|
|
403
|
+
"endMarkerSize",
|
|
404
|
+
"endMarkerFill",
|
|
405
|
+
"endMarkerFillOpacity"
|
|
406
|
+
]
|
|
407
|
+
};
|
|
408
|
+
var COMPOSITE_KEYS = {
|
|
409
|
+
liquid: [
|
|
410
|
+
...MARK_PAINT_KEYS,
|
|
411
|
+
"shape",
|
|
412
|
+
"contentFill",
|
|
413
|
+
"contentStroke",
|
|
414
|
+
"contentStrokeOpacity",
|
|
415
|
+
"contentLineWidth",
|
|
416
|
+
"contentFontFamily",
|
|
417
|
+
"contentFontSize",
|
|
418
|
+
"contentFontWeight",
|
|
419
|
+
"backgroundFill",
|
|
420
|
+
"backgroundFillOpacity",
|
|
421
|
+
"backgroundStroke",
|
|
422
|
+
"backgroundStrokeOpacity",
|
|
423
|
+
"backgroundLineWidth",
|
|
424
|
+
"outlineBorder",
|
|
425
|
+
"outlineStroke",
|
|
426
|
+
"outlineStrokeOpacity"
|
|
427
|
+
],
|
|
428
|
+
treemap: [...MARK_PAINT_KEYS, "stroke", "radius"],
|
|
429
|
+
wordCloud: ["fontFamily", "opacity", "fillOpacity", "strokeOpacity"],
|
|
430
|
+
sankey: [
|
|
431
|
+
"nodeFillOpacity",
|
|
432
|
+
"nodeStroke",
|
|
433
|
+
"nodeStrokeOpacity",
|
|
434
|
+
"nodeLineWidth",
|
|
435
|
+
"linkFillOpacity",
|
|
436
|
+
"linkStroke",
|
|
437
|
+
"linkStrokeOpacity",
|
|
438
|
+
"linkLineWidth",
|
|
439
|
+
"labelFill",
|
|
440
|
+
"labelFillOpacity",
|
|
441
|
+
"labelFontFamily",
|
|
442
|
+
"labelFontSize",
|
|
443
|
+
"labelFontWeight"
|
|
444
|
+
]
|
|
445
|
+
};
|
|
446
|
+
var expandTokens = (t) => ({
|
|
447
|
+
axis: {
|
|
448
|
+
lineStroke: t.colorStroke,
|
|
449
|
+
tickStroke: t.colorStroke,
|
|
450
|
+
gridStroke: t.colorStroke,
|
|
451
|
+
lineLineWidth: t.lineWidth,
|
|
452
|
+
tickLineWidth: t.lineWidth,
|
|
453
|
+
gridLineWidth: t.lineWidth,
|
|
454
|
+
labelFill: t.colorTextSecondary,
|
|
455
|
+
titleFill: t.colorTextSecondary,
|
|
456
|
+
labelFontFamily: t.fontFamily,
|
|
457
|
+
titleFontFamily: t.fontFamily,
|
|
458
|
+
labelFontSize: t.fontSize,
|
|
459
|
+
titleFontSize: t.fontSize,
|
|
460
|
+
labelFontWeight: t.fontWeight,
|
|
461
|
+
titleFontWeight: t.fontWeight,
|
|
462
|
+
labelSpacing: t.spacingSmall,
|
|
463
|
+
titleSpacing: t.spacingMedium
|
|
464
|
+
},
|
|
465
|
+
legend: {
|
|
466
|
+
titleFill: t.colorText,
|
|
467
|
+
itemLabelFill: t.colorText,
|
|
468
|
+
titleFontFamily: t.fontFamily,
|
|
469
|
+
itemLabelFontFamily: t.fontFamily,
|
|
470
|
+
titleFontSize: t.fontSize,
|
|
471
|
+
itemLabelFontSize: t.fontSize,
|
|
472
|
+
titleFontWeight: t.fontWeight,
|
|
473
|
+
itemLabelFontWeight: t.fontWeight,
|
|
474
|
+
itemLabelLineHeight: t.lineHeight,
|
|
475
|
+
titleSpacing: t.spacingSmall,
|
|
476
|
+
itemSpacing: t.spacingSmall,
|
|
477
|
+
rowPadding: t.spacingSmall,
|
|
478
|
+
colPadding: t.spacingMedium
|
|
479
|
+
},
|
|
480
|
+
label: {
|
|
481
|
+
fontFamily: t.fontFamily,
|
|
482
|
+
fontSize: t.fontSize,
|
|
483
|
+
fontWeight: t.fontWeight,
|
|
484
|
+
lineHeight: t.lineHeight
|
|
485
|
+
},
|
|
486
|
+
mark: {
|
|
487
|
+
line: { lineWidth: t.lineWidth },
|
|
488
|
+
point: { lineWidth: t.lineWidth },
|
|
489
|
+
interval: { lineWidth: t.lineWidth, radius: t.radius },
|
|
490
|
+
box: { lineWidth: t.lineWidth },
|
|
491
|
+
connector: { lineWidth: t.lineWidth },
|
|
492
|
+
path: { lineWidth: t.lineWidth },
|
|
493
|
+
density: { lineWidth: t.lineWidth },
|
|
494
|
+
link: { lineWidth: t.lineWidth },
|
|
495
|
+
treemap: { lineWidth: t.lineWidth, radius: t.radius },
|
|
496
|
+
liquid: {
|
|
497
|
+
contentFill: t.colorText,
|
|
498
|
+
contentFontFamily: t.fontFamily,
|
|
499
|
+
contentFontWeight: t.fontWeight,
|
|
500
|
+
backgroundFill: t.colorSurface,
|
|
501
|
+
backgroundStroke: t.colorStroke,
|
|
502
|
+
outlineStroke: t.colorDefault
|
|
503
|
+
},
|
|
504
|
+
sankey: {
|
|
505
|
+
nodeStroke: t.colorStroke,
|
|
506
|
+
nodeLineWidth: t.lineWidth,
|
|
507
|
+
linkStroke: t.colorStroke,
|
|
508
|
+
linkLineWidth: t.lineWidth,
|
|
509
|
+
labelFill: t.colorText,
|
|
510
|
+
labelFontFamily: t.fontFamily,
|
|
511
|
+
labelFontSize: t.fontSize,
|
|
512
|
+
labelFontWeight: t.fontWeight
|
|
513
|
+
},
|
|
514
|
+
wordCloud: { fontFamily: t.fontFamily }
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
function getThemeObject(type, theme, localStyle) {
|
|
518
|
+
var _a, _b;
|
|
519
|
+
const { baseTheme, tokens, styles } = (0, import_resolve.resolveTheme)(type, theme, localStyle);
|
|
520
|
+
const layers = styles.map(
|
|
521
|
+
(layer) => {
|
|
522
|
+
var _a2, _b2;
|
|
523
|
+
return ["line", "area", "radar"].includes(type) && (layer == null ? void 0 : layer.lineWidth) !== void 0 ? (0, import_merge.mergeTheme)(layer, {
|
|
524
|
+
mark: { line: { lineWidth: ((_b2 = (_a2 = layer.mark) == null ? void 0 : _a2.line) == null ? void 0 : _b2.lineWidth) ?? layer.lineWidth } }
|
|
525
|
+
}) : layer;
|
|
526
|
+
}
|
|
527
|
+
);
|
|
528
|
+
const style = (0, import_merge.mergeTheme)(expandTokens(tokens), ...layers);
|
|
529
|
+
const values = (0, import_tokens.getChartVisualTokens)(baseTheme);
|
|
530
|
+
const colors = (0, import_shared.normalizePalette)(
|
|
531
|
+
((_a = style.palette) == null ? void 0 : _a.length) ? style.palette : type === "waterfall" ? ["#FF4D4F", "#2EBB59", "#1783FF"] : void 0,
|
|
532
|
+
baseTheme
|
|
533
|
+
);
|
|
534
|
+
if (type === "dual-axes" && style.palette) {
|
|
535
|
+
colors.push(
|
|
536
|
+
...(0, import_shared.normalizePalette)(void 0, baseTheme).filter((color) => !colors.includes(color))
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
const backgroundColor = style.backgroundColor || values.background;
|
|
540
|
+
const mark = {};
|
|
541
|
+
for (const [name, keys] of Object.entries({ ...MARK_KEYS, ...COMPOSITE_KEYS })) {
|
|
542
|
+
const kind = name;
|
|
543
|
+
mark[kind] = (0, import_shared.pickStyle)((_b = style.mark) == null ? void 0 : _b[kind], keys);
|
|
544
|
+
}
|
|
545
|
+
const axisStyle = (0, import_shared.pickStyle)(style.axis, AXIS_KEYS);
|
|
546
|
+
const titleStyle = (0, import_shared.pickStyle)(style.title, TITLE_KEYS);
|
|
547
|
+
const legendStyle = (0, import_shared.pickStyle)(style.legend, LEGEND_KEYS);
|
|
548
|
+
const labelStyle = (0, import_shared.pickStyle)(style.label, LABEL_KEYS);
|
|
549
|
+
const { axis: axisDefaults, ...builtInTheme } = createTheme(baseTheme);
|
|
550
|
+
const rendererTheme = (0, import_merge.mergeTheme)(builtInTheme, {
|
|
551
|
+
color: colors[0],
|
|
552
|
+
category10: colors,
|
|
553
|
+
category20: colors,
|
|
554
|
+
view: { viewFill: backgroundColor },
|
|
555
|
+
tooltip: {
|
|
556
|
+
markerStroke: backgroundColor,
|
|
557
|
+
crosshairsStroke: tokens.colorTextSecondary ?? values.textSecondary
|
|
558
|
+
},
|
|
559
|
+
title: titleStyle,
|
|
560
|
+
axis: axisStyle,
|
|
561
|
+
axisX: { ...axisDefaults, ...builtInTheme.axisX, ...axisStyle },
|
|
562
|
+
axisY: { ...axisDefaults, ...builtInTheme.axisY, ...axisStyle },
|
|
563
|
+
axisRadar: axisStyle,
|
|
564
|
+
legendCategory: legendStyle,
|
|
565
|
+
label: { fill: tokens.colorText ?? values.textPrimary, ...labelStyle },
|
|
566
|
+
innerLabel: { fill: tokens.colorTextInverse ?? values.textInverse, ...labelStyle }
|
|
567
|
+
});
|
|
568
|
+
const css = rendererTheme.tooltip.css;
|
|
569
|
+
css[".g2-tooltip"] = (0, import_merge.mergeTheme)(css[".g2-tooltip"], {
|
|
570
|
+
"background-color": tokens.colorSurface,
|
|
571
|
+
color: tokens.colorTextSecondary ?? tokens.colorText,
|
|
572
|
+
border: tokens.colorStroke === void 0 && tokens.lineWidth === void 0 ? void 0 : `${tokens.lineWidth ?? 1}px solid ${tokens.colorStroke ?? values.tooltipBorder}`,
|
|
573
|
+
"border-radius": tokens.radius === void 0 ? void 0 : `${tokens.radius}px`,
|
|
574
|
+
"font-family": tokens.fontFamily,
|
|
575
|
+
"font-size": tokens.fontSize === void 0 ? void 0 : `${tokens.fontSize}px`,
|
|
576
|
+
"font-weight": tokens.fontWeight === void 0 ? void 0 : String(tokens.fontWeight),
|
|
577
|
+
"line-height": tokens.lineHeight === void 0 ? void 0 : `${tokens.lineHeight}px`,
|
|
578
|
+
padding: tokens.spacingSmall === void 0 && tokens.spacingMedium === void 0 ? void 0 : `${tokens.spacingSmall ?? 10}px ${tokens.spacingMedium ?? 12}px`
|
|
579
|
+
});
|
|
580
|
+
for (const name of [
|
|
581
|
+
".g2-tooltip-title",
|
|
582
|
+
".g2-tooltip-list-item-name",
|
|
583
|
+
".g2-tooltip-list-item-name-label"
|
|
584
|
+
]) {
|
|
585
|
+
if (tokens.fontSize !== void 0 && name === ".g2-tooltip-title")
|
|
586
|
+
css[name]["font-size"] = `${tokens.fontSize}px`;
|
|
587
|
+
if (tokens.lineHeight !== void 0 && name === ".g2-tooltip-title")
|
|
588
|
+
css[name]["line-height"] = `${tokens.lineHeight}px`;
|
|
589
|
+
if (tokens.colorTextSecondary ?? tokens.colorText)
|
|
590
|
+
css[name].color = tokens.colorTextSecondary ?? tokens.colorText;
|
|
591
|
+
}
|
|
592
|
+
if (tokens.colorText !== void 0)
|
|
593
|
+
css[".g2-tooltip-list-item-value"].color = tokens.colorText;
|
|
594
|
+
if (tokens.colorStroke !== void 0 || tokens.lineWidth !== void 0)
|
|
595
|
+
css[".g2-tooltip-title"]["border-bottom"] = `${tokens.lineWidth ?? 1}px solid ${tokens.colorStroke ?? values.tooltipDivider}`;
|
|
596
|
+
if (tokens.lineHeight !== void 0)
|
|
597
|
+
css[".g2-tooltip-list-item"]["line-height"] = `${tokens.lineHeight}px`;
|
|
598
|
+
if (tokens.colorSurface !== void 0)
|
|
599
|
+
css[".g2-tooltip-list-item-marker"]["box-shadow"] = `0 0 0 2px ${tokens.colorSurface}`;
|
|
600
|
+
return { theme: { ...rendererTheme, type: baseTheme }, mark };
|
|
601
|
+
}
|
|
602
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
603
|
+
0 && (module.exports = {
|
|
604
|
+
getThemeObject
|
|
605
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ChartType, ThemeStyle, VisualizationTheme } from '../types';
|
|
2
|
+
export declare function getThemeObject(type: ChartType, theme?: VisualizationTheme, localStyle?: ThemeStyle): {
|
|
3
|
+
baseTheme: "light" | "dark" | "academy";
|
|
4
|
+
theme: "light" | "dark";
|
|
5
|
+
colors: string[];
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
node: {
|
|
8
|
+
type: string | undefined;
|
|
9
|
+
style: {
|
|
10
|
+
[k: string]: any;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
edge: {
|
|
14
|
+
type: string | undefined;
|
|
15
|
+
style: {
|
|
16
|
+
[k: string]: any;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
titleStyle: {
|
|
20
|
+
titleFill: string;
|
|
21
|
+
titleFontFamily: string;
|
|
22
|
+
subtitleFill: string;
|
|
23
|
+
};
|
|
24
|
+
tooltipStyle: {
|
|
25
|
+
[k: string]: any;
|
|
26
|
+
};
|
|
27
|
+
texture: "default" | "rough" | undefined;
|
|
28
|
+
};
|