@antv/gpt-vis 1.0.0 → 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.
Files changed (92) hide show
  1. package/README.md +66 -1
  2. package/README.zh-CN.md +66 -1
  3. package/dist/cjs/types/index.d.ts +2 -1
  4. package/dist/cjs/util/animation.d.ts +2 -0
  5. package/dist/cjs/util/animation.js +38 -0
  6. package/dist/cjs/util/components.d.ts +15 -0
  7. package/dist/cjs/util/components.js +94 -0
  8. package/dist/cjs/util/crosshair-axis-labels.d.ts +9 -0
  9. package/dist/cjs/util/crosshair-axis-labels.js +304 -0
  10. package/dist/cjs/util/index.d.ts +6 -0
  11. package/dist/cjs/util/index.js +33 -0
  12. package/dist/cjs/util/interaction.d.ts +14 -0
  13. package/dist/cjs/util/interaction.js +89 -0
  14. package/dist/cjs/util/theme.d.ts +18 -24
  15. package/dist/cjs/util/theme.js +303 -120
  16. package/dist/cjs/util/tokens.d.ts +31 -0
  17. package/dist/cjs/util/tokens.js +98 -0
  18. package/dist/cjs/vis/area/index.d.ts +2 -2
  19. package/dist/cjs/vis/area/index.js +76 -31
  20. package/dist/cjs/vis/bar/index.d.ts +2 -2
  21. package/dist/cjs/vis/bar/index.js +22 -19
  22. package/dist/cjs/vis/boxplot/index.js +1 -4
  23. package/dist/cjs/vis/column/index.d.ts +2 -2
  24. package/dist/cjs/vis/column/index.js +28 -18
  25. package/dist/cjs/vis/dual-axes/index.d.ts +2 -2
  26. package/dist/cjs/vis/dual-axes/index.js +89 -34
  27. package/dist/cjs/vis/funnel/index.d.ts +4 -2
  28. package/dist/cjs/vis/funnel/index.js +171 -92
  29. package/dist/cjs/vis/histogram/index.js +1 -4
  30. package/dist/cjs/vis/line/index.d.ts +2 -2
  31. package/dist/cjs/vis/line/index.js +71 -31
  32. package/dist/cjs/vis/liquid/index.d.ts +2 -2
  33. package/dist/cjs/vis/liquid/index.js +41 -16
  34. package/dist/cjs/vis/pie/index.d.ts +2 -2
  35. package/dist/cjs/vis/pie/index.js +26 -16
  36. package/dist/cjs/vis/radar/index.d.ts +2 -2
  37. package/dist/cjs/vis/radar/index.js +21 -29
  38. package/dist/cjs/vis/sankey/index.js +1 -4
  39. package/dist/cjs/vis/scatter/index.d.ts +2 -2
  40. package/dist/cjs/vis/scatter/index.js +40 -17
  41. package/dist/cjs/vis/treemap/index.js +1 -4
  42. package/dist/cjs/vis/venn/index.js +1 -4
  43. package/dist/cjs/vis/violin/index.js +1 -1
  44. package/dist/cjs/vis/waterfall/index.js +1 -1
  45. package/dist/cjs/vis/word-cloud/index.d.ts +3 -2
  46. package/dist/cjs/vis/word-cloud/index.js +125 -10
  47. package/dist/esm/types/index.d.ts +2 -1
  48. package/dist/esm/util/animation.d.ts +2 -0
  49. package/dist/esm/util/animation.js +17 -0
  50. package/dist/esm/util/components.d.ts +15 -0
  51. package/dist/esm/util/components.js +67 -0
  52. package/dist/esm/util/crosshair-axis-labels.d.ts +9 -0
  53. package/dist/esm/util/crosshair-axis-labels.js +328 -0
  54. package/dist/esm/util/index.d.ts +6 -0
  55. package/dist/esm/util/index.js +6 -0
  56. package/dist/esm/util/interaction.d.ts +14 -0
  57. package/dist/esm/util/interaction.js +73 -0
  58. package/dist/esm/util/theme.d.ts +18 -24
  59. package/dist/esm/util/theme.js +302 -126
  60. package/dist/esm/util/tokens.d.ts +31 -0
  61. package/dist/esm/util/tokens.js +64 -0
  62. package/dist/esm/vis/area/index.d.ts +2 -2
  63. package/dist/esm/vis/area/index.js +91 -41
  64. package/dist/esm/vis/bar/index.d.ts +2 -2
  65. package/dist/esm/vis/bar/index.js +28 -29
  66. package/dist/esm/vis/boxplot/index.js +4 -5
  67. package/dist/esm/vis/column/index.d.ts +2 -2
  68. package/dist/esm/vis/column/index.js +36 -29
  69. package/dist/esm/vis/dual-axes/index.d.ts +2 -2
  70. package/dist/esm/vis/dual-axes/index.js +115 -42
  71. package/dist/esm/vis/funnel/index.d.ts +4 -2
  72. package/dist/esm/vis/funnel/index.js +156 -83
  73. package/dist/esm/vis/histogram/index.js +4 -5
  74. package/dist/esm/vis/line/index.d.ts +2 -2
  75. package/dist/esm/vis/line/index.js +80 -37
  76. package/dist/esm/vis/liquid/index.d.ts +2 -2
  77. package/dist/esm/vis/liquid/index.js +41 -14
  78. package/dist/esm/vis/pie/index.d.ts +2 -2
  79. package/dist/esm/vis/pie/index.js +36 -16
  80. package/dist/esm/vis/radar/index.d.ts +2 -2
  81. package/dist/esm/vis/radar/index.js +21 -34
  82. package/dist/esm/vis/sankey/index.js +4 -5
  83. package/dist/esm/vis/scatter/index.d.ts +2 -2
  84. package/dist/esm/vis/scatter/index.js +41 -25
  85. package/dist/esm/vis/treemap/index.js +4 -5
  86. package/dist/esm/vis/venn/index.js +4 -5
  87. package/dist/esm/vis/violin/index.js +5 -13
  88. package/dist/esm/vis/waterfall/index.js +5 -7
  89. package/dist/esm/vis/word-cloud/index.d.ts +3 -2
  90. package/dist/esm/vis/word-cloud/index.js +158 -10
  91. package/dist/umd/index.min.js +1 -1
  92. package/package.json +18 -15
@@ -0,0 +1,14 @@
1
+ import type { VisualizationTheme } from '../types';
2
+ export type SharedTooltipInteractionOptions = {
3
+ crosshairs?: boolean;
4
+ };
5
+ export type PointHighlightStateOptions = {
6
+ activeLineWidth?: number;
7
+ inactiveOpacity?: number;
8
+ };
9
+ export declare const getSharedTooltipInteraction: ({ crosshairs, }?: SharedTooltipInteractionOptions) => Record<string, boolean>;
10
+ export declare const getCategoryBackgroundHighlightState: (theme: VisualizationTheme) => Record<string, any>;
11
+ export declare const getCategoryHighlightInteraction: () => Record<string, any>;
12
+ export declare const getPointHighlightState: ({ activeLineWidth, inactiveOpacity, }?: PointHighlightStateOptions) => Record<string, any>;
13
+ export declare const getSeriesHighlightByColorInteraction: () => Record<string, boolean>;
14
+ export declare const getLineHighlightState: (lineWidth: number) => Record<string, any>;
@@ -0,0 +1,89 @@
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/interaction.ts
20
+ var interaction_exports = {};
21
+ __export(interaction_exports, {
22
+ getCategoryBackgroundHighlightState: () => getCategoryBackgroundHighlightState,
23
+ getCategoryHighlightInteraction: () => getCategoryHighlightInteraction,
24
+ getLineHighlightState: () => getLineHighlightState,
25
+ getPointHighlightState: () => getPointHighlightState,
26
+ getSeriesHighlightByColorInteraction: () => getSeriesHighlightByColorInteraction,
27
+ getSharedTooltipInteraction: () => getSharedTooltipInteraction
28
+ });
29
+ module.exports = __toCommonJS(interaction_exports);
30
+ var import_tokens = require("./tokens");
31
+ var getSharedTooltipInteraction = ({
32
+ crosshairs = false
33
+ } = {}) => ({
34
+ shared: true,
35
+ series: true,
36
+ crosshairs
37
+ });
38
+ var getCategoryBackgroundHighlightState = (theme) => {
39
+ const tokens = (0, import_tokens.getChartVisualTokens)(theme);
40
+ return {
41
+ active: {
42
+ backgroundFill: tokens.grid,
43
+ backgroundFillOpacity: theme === "dark" ? 0.56 : 0.58,
44
+ backgroundLineWidth: 0,
45
+ backgroundPadding: 0.08,
46
+ backgroundRadius: 4
47
+ }
48
+ };
49
+ };
50
+ var getCategoryHighlightInteraction = () => ({
51
+ background: true,
52
+ region: true
53
+ });
54
+ var getPointHighlightState = ({
55
+ activeLineWidth = import_tokens.CHART_STYLE_DEFAULTS.pointActiveLineWidth,
56
+ inactiveOpacity
57
+ } = {}) => ({
58
+ active: {
59
+ lineWidth: activeLineWidth,
60
+ stroke: (_datum, _index, _data, element) => {
61
+ var _a, _b;
62
+ return ((_a = element == null ? void 0 : element.style) == null ? void 0 : _a.fill) || ((_b = element == null ? void 0 : element.style) == null ? void 0 : _b.stroke);
63
+ },
64
+ fillOpacity: 1,
65
+ zIndex: 10
66
+ },
67
+ ...inactiveOpacity === void 0 ? {} : {
68
+ inactive: {
69
+ fillOpacity: inactiveOpacity,
70
+ strokeOpacity: inactiveOpacity
71
+ }
72
+ }
73
+ });
74
+ var getSeriesHighlightByColorInteraction = () => ({
75
+ elementHighlightByColor: true
76
+ });
77
+ var getLineHighlightState = (lineWidth) => ({
78
+ active: { lineWidth: lineWidth + 1, strokeOpacity: 1 },
79
+ inactive: { strokeOpacity: import_tokens.CHART_STYLE_DEFAULTS.inactiveOpacity }
80
+ });
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ getCategoryBackgroundHighlightState,
84
+ getCategoryHighlightInteraction,
85
+ getLineHighlightState,
86
+ getPointHighlightState,
87
+ getSeriesHighlightByColorInteraction,
88
+ getSharedTooltipInteraction
89
+ });
@@ -1,26 +1,20 @@
1
+ import type { Theme } from '@antv/g2';
2
+ import type { VisualizationTheme } from '../types';
1
3
  export declare const DEFAULT_COLOR_PALETTE: string[];
2
4
  export declare const ACADEMY_COLOR_PALETTE: string[];
3
- export declare const THEME_MAP: Record<string, any>;
4
- /**
5
- * Get normalized theme name for G2.
6
- * Converts 'default' to 'light' for G2 compatibility.
7
- */
8
- export declare const getTheme: (theme: string) => string;
9
- /**
10
- * Get theme object from THEME_MAP.
11
- * This should be used for visualization components to properly support dark theme with multiple marks.
12
- */
13
- export declare const getThemeObject: (theme: string) => any;
14
- /**
15
- * Get theme color palette based on theme name.
16
- */
17
- export declare const getThemeColors: (theme: string) => string[];
18
- /**
19
- * Get background color based on theme.
20
- */
21
- export declare const getBackgroundColor: (theme: string) => string;
22
- /**
23
- * Normalize palette to always return an array.
24
- * Handles the case where a single color is parsed as a string instead of an array.
25
- */
26
- export declare const normalizePalette: (palette: string | string[] | undefined, theme: string) => string[];
5
+ type G2ThemeType = 'light' | 'dark' | 'academy';
6
+ type ChartTheme = Theme & {
7
+ enter?: {
8
+ duration?: number;
9
+ easing?: string;
10
+ };
11
+ elementHighlightByColor?: Record<string, unknown>;
12
+ elementHoverScale?: Record<string, unknown>;
13
+ };
14
+ export declare const THEME_MAP: Record<VisualizationTheme, ChartTheme>;
15
+ export declare const getTheme: (theme: VisualizationTheme) => G2ThemeType;
16
+ export declare const getThemeObject: (theme: VisualizationTheme) => ChartTheme;
17
+ export declare const getThemeColors: (theme: VisualizationTheme) => string[];
18
+ export declare const getBackgroundColor: (theme: VisualizationTheme) => string;
19
+ export declare const normalizePalette: (palette: string | string[] | undefined, theme: VisualizationTheme) => string[];
20
+ export {};
@@ -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
- "#1783FF",
34
- "#F08F56",
35
- "#D580FF",
36
- "#00C9C9",
37
- "#7863FF",
38
- "#DB9D0D",
39
- "#60C42D",
40
- "#FF80CA",
41
- "#2491B3",
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 DEFAULT_THEME = {
57
- type: "light",
58
- view: {
59
- viewFill: "#FFF",
60
- plotFill: "transparent",
61
- mainFill: "transparent",
62
- contentFill: "transparent"
63
- },
64
- interval: {
65
- rect: {
66
- fillOpacity: 0.8
67
- }
68
- },
69
- line: {
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
- lineWidth: 2
72
- }
73
- },
74
- area: {
79
+ line: {
80
+ lineWidth: import_tokens.CHART_STYLE_DEFAULTS.lineWidth
81
+ }
82
+ },
75
83
  area: {
76
- fillOpacity: 0.6
77
- }
78
- },
79
- point: {
84
+ area: {
85
+ fillOpacity: import_tokens.CHART_STYLE_DEFAULTS.areaOpacity
86
+ }
87
+ },
80
88
  point: {
81
- lineWidth: 1
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: DEFAULT_THEME,
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
- return theme === "default" ? "light" : theme;
150
- };
151
- var getThemeObject = (theme) => {
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;