@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.
Files changed (106) hide show
  1. package/README.md +282 -43
  2. package/README.zh-CN.md +286 -47
  3. package/dist/cjs/gpt-vis/index.js +1 -1
  4. package/dist/cjs/types/index.d.ts +2 -1
  5. package/dist/cjs/util/animation.d.ts +2 -0
  6. package/dist/cjs/util/animation.js +38 -0
  7. package/dist/cjs/util/components.d.ts +15 -0
  8. package/dist/cjs/util/components.js +94 -0
  9. package/dist/cjs/util/crosshair-axis-labels.d.ts +9 -0
  10. package/dist/cjs/util/crosshair-axis-labels.js +304 -0
  11. package/dist/cjs/util/index.d.ts +6 -0
  12. package/dist/cjs/util/index.js +33 -0
  13. package/dist/cjs/util/interaction.d.ts +14 -0
  14. package/dist/cjs/util/interaction.js +89 -0
  15. package/dist/cjs/util/theme.d.ts +18 -24
  16. package/dist/cjs/util/theme.js +303 -120
  17. package/dist/cjs/util/tokens.d.ts +31 -0
  18. package/dist/cjs/util/tokens.js +98 -0
  19. package/dist/cjs/vis/area/index.d.ts +2 -2
  20. package/dist/cjs/vis/area/index.js +76 -31
  21. package/dist/cjs/vis/bar/index.d.ts +2 -2
  22. package/dist/cjs/vis/bar/index.js +22 -19
  23. package/dist/cjs/vis/boxplot/index.js +1 -4
  24. package/dist/cjs/vis/column/index.d.ts +2 -2
  25. package/dist/cjs/vis/column/index.js +28 -18
  26. package/dist/cjs/vis/dual-axes/index.d.ts +2 -2
  27. package/dist/cjs/vis/dual-axes/index.js +90 -36
  28. package/dist/cjs/vis/fishbone-diagram/index.js +12 -4
  29. package/dist/cjs/vis/flow-diagram/index.js +27 -11
  30. package/dist/cjs/vis/funnel/index.d.ts +4 -2
  31. package/dist/cjs/vis/funnel/index.js +171 -92
  32. package/dist/cjs/vis/histogram/index.js +1 -4
  33. package/dist/cjs/vis/indented-tree/index.js +13 -3
  34. package/dist/cjs/vis/line/index.d.ts +2 -2
  35. package/dist/cjs/vis/line/index.js +71 -31
  36. package/dist/cjs/vis/liquid/index.d.ts +2 -2
  37. package/dist/cjs/vis/liquid/index.js +41 -16
  38. package/dist/cjs/vis/mindmap/index.js +12 -4
  39. package/dist/cjs/vis/network-graph/index.js +11 -2
  40. package/dist/cjs/vis/organization-chart/index.js +12 -3
  41. package/dist/cjs/vis/pie/index.d.ts +2 -2
  42. package/dist/cjs/vis/pie/index.js +26 -16
  43. package/dist/cjs/vis/radar/index.d.ts +2 -2
  44. package/dist/cjs/vis/radar/index.js +21 -29
  45. package/dist/cjs/vis/sankey/index.js +1 -4
  46. package/dist/cjs/vis/scatter/index.d.ts +4 -2
  47. package/dist/cjs/vis/scatter/index.js +43 -16
  48. package/dist/cjs/vis/treemap/index.js +1 -4
  49. package/dist/cjs/vis/venn/index.js +1 -4
  50. package/dist/cjs/vis/violin/index.js +1 -1
  51. package/dist/cjs/vis/waterfall/index.js +2 -2
  52. package/dist/cjs/vis/word-cloud/index.d.ts +3 -2
  53. package/dist/cjs/vis/word-cloud/index.js +125 -10
  54. package/dist/esm/gpt-vis/index.js +1 -1
  55. package/dist/esm/types/index.d.ts +2 -1
  56. package/dist/esm/util/animation.d.ts +2 -0
  57. package/dist/esm/util/animation.js +17 -0
  58. package/dist/esm/util/components.d.ts +15 -0
  59. package/dist/esm/util/components.js +67 -0
  60. package/dist/esm/util/crosshair-axis-labels.d.ts +9 -0
  61. package/dist/esm/util/crosshair-axis-labels.js +328 -0
  62. package/dist/esm/util/index.d.ts +6 -0
  63. package/dist/esm/util/index.js +6 -0
  64. package/dist/esm/util/interaction.d.ts +14 -0
  65. package/dist/esm/util/interaction.js +73 -0
  66. package/dist/esm/util/theme.d.ts +18 -24
  67. package/dist/esm/util/theme.js +302 -126
  68. package/dist/esm/util/tokens.d.ts +31 -0
  69. package/dist/esm/util/tokens.js +64 -0
  70. package/dist/esm/vis/area/index.d.ts +2 -2
  71. package/dist/esm/vis/area/index.js +91 -41
  72. package/dist/esm/vis/bar/index.d.ts +2 -2
  73. package/dist/esm/vis/bar/index.js +28 -29
  74. package/dist/esm/vis/boxplot/index.js +4 -5
  75. package/dist/esm/vis/column/index.d.ts +2 -2
  76. package/dist/esm/vis/column/index.js +36 -29
  77. package/dist/esm/vis/dual-axes/index.d.ts +2 -2
  78. package/dist/esm/vis/dual-axes/index.js +123 -43
  79. package/dist/esm/vis/fishbone-diagram/index.js +6 -5
  80. package/dist/esm/vis/flow-diagram/index.js +17 -10
  81. package/dist/esm/vis/funnel/index.d.ts +4 -2
  82. package/dist/esm/vis/funnel/index.js +156 -83
  83. package/dist/esm/vis/histogram/index.js +4 -5
  84. package/dist/esm/vis/indented-tree/index.js +9 -4
  85. package/dist/esm/vis/line/index.d.ts +2 -2
  86. package/dist/esm/vis/line/index.js +80 -37
  87. package/dist/esm/vis/liquid/index.d.ts +2 -2
  88. package/dist/esm/vis/liquid/index.js +41 -14
  89. package/dist/esm/vis/mindmap/index.js +6 -5
  90. package/dist/esm/vis/network-graph/index.js +5 -3
  91. package/dist/esm/vis/organization-chart/index.js +6 -4
  92. package/dist/esm/vis/pie/index.d.ts +2 -2
  93. package/dist/esm/vis/pie/index.js +36 -16
  94. package/dist/esm/vis/radar/index.d.ts +2 -2
  95. package/dist/esm/vis/radar/index.js +21 -34
  96. package/dist/esm/vis/sankey/index.js +4 -5
  97. package/dist/esm/vis/scatter/index.d.ts +4 -2
  98. package/dist/esm/vis/scatter/index.js +45 -19
  99. package/dist/esm/vis/treemap/index.js +4 -5
  100. package/dist/esm/vis/venn/index.js +4 -5
  101. package/dist/esm/vis/violin/index.js +5 -13
  102. package/dist/esm/vis/waterfall/index.js +11 -11
  103. package/dist/esm/vis/word-cloud/index.d.ts +3 -2
  104. package/dist/esm/vis/word-cloud/index.js +158 -10
  105. package/dist/umd/index.min.js +1 -1
  106. package/package.json +18 -19
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
8
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -5,7 +11,7 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
5
11
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
13
  import { Chart } from '@antv/g2';
8
- import { getBackgroundColor, getThemeObject, normalizePalette } from "../../util/theme";
14
+ import { CHART_STYLE_DEFAULTS, getCartesianAxis, getCartesianLayout, getChartAnimation, getLineHighlightState, getSeriesHighlightByColorInteraction, getSharedTooltipInteraction, getThemeObject, normalizePalette } from "../../util";
9
15
 
10
16
  /**
11
17
  * DualAxesSeriesItem defines a single series in the dual-axes chart.
@@ -23,14 +29,16 @@ import { getBackgroundColor, getThemeObject, normalizePalette } from "../../util
23
29
  * Transform series data to G2 format.
24
30
  * Combines multiple series into a single data array with categories.
25
31
  */
32
+ var getSeriesField = function getSeriesField(index) {
33
+ return "value_".concat(index + 1);
34
+ };
26
35
  function transformData(series, categories) {
27
36
  return categories.map(function (category, index) {
28
37
  var dataPoint = {
29
38
  category: category
30
39
  };
31
- series.forEach(function (s, i) {
32
- var yField = s.axisYTitle || "value_".concat(i + 1);
33
- dataPoint[yField] = s.data[index];
40
+ series.forEach(function (item, seriesIndex) {
41
+ dataPoint[getSeriesField(seriesIndex)] = item.data[index];
34
42
  });
35
43
  return dataPoint;
36
44
  });
@@ -74,6 +82,7 @@ export var DualAxes = function DualAxes(options) {
74
82
  _options$theme = options.theme,
75
83
  chartTheme = _options$theme === void 0 ? 'default' : _options$theme;
76
84
  var chart = null;
85
+ var hasRendered = false;
77
86
 
78
87
  /**
79
88
  * Render the dual-axes chart with the given configuration.
@@ -94,8 +103,11 @@ export var DualAxes = function DualAxes(options) {
94
103
  }
95
104
  var _style$startAtZero = style.startAtZero,
96
105
  startAtZero = _style$startAtZero === void 0 ? false : _style$startAtZero;
97
- var colors = normalizePalette(style.palette, theme);
98
- var backgroundColor = style.backgroundColor || getBackgroundColor(theme);
106
+ var requestedColors = style.palette ? normalizePalette(style.palette, theme) : [];
107
+ var defaultColors = normalizePalette(undefined, theme);
108
+ var colors = [].concat(_toConsumableArray(requestedColors), _toConsumableArray(defaultColors.filter(function (color) {
109
+ return !requestedColors.includes(color);
110
+ })));
99
111
 
100
112
  // Transform data
101
113
  var data = transformData(series, categories);
@@ -109,15 +121,55 @@ export var DualAxes = function DualAxes(options) {
109
121
  });
110
122
 
111
123
  // Sort series: column first, then line (line rendered last appears on top)
112
- var sortedSeries = _toConsumableArray(series).sort(function (a, b) {
124
+ var sortedSeries = series.map(function (item, originalIndex) {
125
+ return {
126
+ item: item,
127
+ originalIndex: originalIndex
128
+ };
129
+ }).sort(function (a, b) {
113
130
  var order = ['column', 'line'];
114
- return order.indexOf(a.type) - order.indexOf(b.type);
131
+ return order.indexOf(a.item.type) - order.indexOf(b.item.type);
115
132
  });
133
+ var seriesMeta = sortedSeries.map(function (_ref, index) {
134
+ var item = _ref.item,
135
+ originalIndex = _ref.originalIndex;
136
+ return {
137
+ item: item,
138
+ yField: getSeriesField(originalIndex),
139
+ displayName: item.axisYTitle || getSeriesField(originalIndex),
140
+ color: colors[index % colors.length]
141
+ };
142
+ });
143
+ var seriesByField = new Map(seriesMeta.map(function (_ref2) {
144
+ var item = _ref2.item,
145
+ yField = _ref2.yField,
146
+ displayName = _ref2.displayName;
147
+ return [yField, {
148
+ type: item.type,
149
+ displayName: displayName
150
+ }];
151
+ }));
152
+ var cartesianAxisOptions = {
153
+ axisXTitle: axisXTitle,
154
+ xLabels: categories,
155
+ chartWidth: width
156
+ };
157
+ var cartesianAxis = getCartesianAxis(cartesianAxisOptions);
116
158
 
117
159
  // Create children configurations for each series
118
- var children = sortedSeries.map(function (item, index) {
119
- var yField = item.axisYTitle || "value_".concat(index + 1);
120
- var color = colors[index % colors.length];
160
+ var children = seriesMeta.map(function (_ref3) {
161
+ var item = _ref3.item,
162
+ yField = _ref3.yField,
163
+ displayName = _ref3.displayName,
164
+ color = _ref3.color;
165
+ var tooltip = {
166
+ items: [function (datum) {
167
+ return {
168
+ name: displayName,
169
+ value: datum[yField]
170
+ };
171
+ }]
172
+ };
121
173
  if (item.type === 'column') {
122
174
  return {
123
175
  type: 'interval',
@@ -132,21 +184,25 @@ export var DualAxes = function DualAxes(options) {
132
184
  y: {
133
185
  nice: true,
134
186
  zero: startAtZero
135
- },
136
- color: {
137
- range: [color]
138
187
  }
139
188
  },
189
+ tooltip: tooltip,
140
190
  axis: {
141
- y: {
142
- title: item.axisYTitle || ''
143
- }
191
+ y: _objectSpread(_objectSpread({}, cartesianAxis.y), {}, {
192
+ title: item.axisYTitle || '',
193
+ titleFill: color,
194
+ titleFontWeight: 500
195
+ })
144
196
  },
145
- style: {
146
- columnWidthRatio: 0.8,
197
+ style: _objectSpread({
198
+ fill: color,
199
+ fillOpacity: 0.86,
200
+ columnWidthRatio: CHART_STYLE_DEFAULTS.intervalWidthRatio
201
+ }, theme !== 'academy' ? {
147
202
  radiusTopLeft: 4,
148
203
  radiusTopRight: 4
149
- }
204
+ } : {}),
205
+ animate: getChartAnimation(hasRendered, 'growInY')
150
206
  };
151
207
  } else {
152
208
  // line type
@@ -164,20 +220,26 @@ export var DualAxes = function DualAxes(options) {
164
220
  y: {
165
221
  independent: true,
166
222
  zero: startAtZero
167
- },
168
- color: {
169
- range: [color]
170
223
  }
171
224
  },
225
+ tooltip: tooltip,
172
226
  axis: {
173
- y: {
227
+ y: _objectSpread(_objectSpread({}, cartesianAxis.y), {}, {
174
228
  position: 'right',
175
- title: item.axisYTitle || ''
176
- }
229
+ title: item.axisYTitle || '',
230
+ titleFill: color,
231
+ titleFontWeight: 500,
232
+ grid: false
233
+ })
177
234
  },
178
235
  style: {
179
- lineWidth: 2
180
- }
236
+ stroke: color,
237
+ lineWidth: CHART_STYLE_DEFAULTS.lineWidth,
238
+ lineCap: 'round',
239
+ lineJoin: 'round'
240
+ },
241
+ state: getLineHighlightState(CHART_STYLE_DEFAULTS.lineWidth),
242
+ animate: getChartAnimation(hasRendered, 'pathIn')
181
243
  };
182
244
  }
183
245
  });
@@ -185,38 +247,55 @@ export var DualAxes = function DualAxes(options) {
185
247
  // Configure chart options
186
248
  // Note: Using 'any' type due to G2's complex type system with transformations
187
249
  // This is consistent with how G2 5.0 is used elsewhere in the codebase
188
- var chartOptions = {
189
- animate: false,
250
+ var chartOptions = _objectSpread(_objectSpread({
190
251
  type: 'view',
191
252
  data: data,
192
- title: title !== null && title !== void 0 ? title : '',
193
- children: children,
253
+ title: title || '',
254
+ children: children
255
+ }, getCartesianLayout(cartesianAxisOptions)), {}, {
194
256
  axis: {
195
- x: {
196
- title: axisXTitle || false
197
- }
257
+ x: cartesianAxis.x
198
258
  },
199
259
  scale: {
200
260
  y: {
201
261
  nice: true
262
+ },
263
+ color: {
264
+ domain: seriesMeta.map(function (_ref4) {
265
+ var yField = _ref4.yField;
266
+ return yField;
267
+ }),
268
+ range: seriesMeta.map(function (_ref5) {
269
+ var color = _ref5.color;
270
+ return color;
271
+ })
202
272
  }
203
273
  },
204
274
  legend: {
205
275
  color: {
206
- position: 'top',
207
- itemMarker: function itemMarker(v, index) {
208
- var seriesItem = series[index];
209
- return (seriesItem === null || seriesItem === void 0 ? void 0 : seriesItem.type) === 'line' ? 'smooth' : 'rect';
276
+ labelFormatter: function labelFormatter(value) {
277
+ var _seriesByField$get;
278
+ return ((_seriesByField$get = seriesByField.get(value)) === null || _seriesByField$get === void 0 ? void 0 : _seriesByField$get.displayName) || value;
279
+ },
280
+ itemMarker: function itemMarker(value) {
281
+ var _seriesByField$get2;
282
+ return ((_seriesByField$get2 = seriesByField.get(value)) === null || _seriesByField$get2 === void 0 ? void 0 : _seriesByField$get2.type) === 'line' ? 'smooth' : 'rect';
210
283
  }
211
284
  }
212
285
  },
213
- viewStyle: {
214
- viewFill: backgroundColor
215
- },
286
+ interaction: _objectSpread({
287
+ tooltip: getSharedTooltipInteraction({
288
+ crosshairs: true
289
+ })
290
+ }, getSeriesHighlightByColorInteraction()),
291
+ viewStyle: style.backgroundColor ? {
292
+ viewFill: style.backgroundColor
293
+ } : undefined,
216
294
  theme: getThemeObject(theme)
217
- };
295
+ });
218
296
  chart.options(chartOptions);
219
297
  chart.render();
298
+ hasRendered = true;
220
299
  };
221
300
 
222
301
  /**
@@ -227,6 +306,7 @@ export var DualAxes = function DualAxes(options) {
227
306
  chart.destroy();
228
307
  chart = null;
229
308
  }
309
+ hasRendered = false;
230
310
  };
231
311
  return {
232
312
  render: render,
@@ -8,7 +8,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
  import { Graph, treeToGraphData } from '@antv/g6';
11
- import { getBackgroundColor, normalizePalette } from "../../util/theme";
11
+ import { getBackgroundColor, getTheme, normalizePalette } from "../../util/theme";
12
12
 
13
13
  /**
14
14
  * FishboneDiagramConfig defines the configuration for rendering the fishbone diagram.
@@ -126,13 +126,14 @@ export var FishboneDiagram = function FishboneDiagram(options) {
126
126
  height: height,
127
127
  autoFit: 'view',
128
128
  autoResize: true,
129
- padding: 20,
130
- theme: chartTheme,
129
+ padding: title ? [46, 20, 20, 20] : 20,
130
+ theme: getTheme(theme),
131
131
  plugins: title ? [{
132
132
  key: 'title',
133
133
  type: 'title',
134
134
  title: title,
135
- titleFill: isDark ? '#e0e6ed' : '#1a1a2e'
135
+ titleFill: isDark ? '#e0e6ed' : '#000',
136
+ titleFontFamily: 'sans-serif'
136
137
  }] : [],
137
138
  data: graphData,
138
139
  node: {
@@ -141,7 +142,7 @@ export var FishboneDiagram = function FishboneDiagram(options) {
141
142
  var _d$depth;
142
143
  var depth = (_d$depth = d.depth) !== null && _d$depth !== void 0 ? _d$depth : 0;
143
144
  var nodeStyle = {
144
- radius: 8,
145
+ radius: theme === 'academy' ? 0 : 8,
145
146
  size: getNodeSize(String(d.id), depth),
146
147
  labelText: String(d.id),
147
148
  labelPlacement: 'left',
@@ -19,7 +19,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
19
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
20
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
21
  import { ExtensionCategory, Graph, HoverActivate, idOf, register } from '@antv/g6';
22
- import { getBackgroundColor, normalizePalette } from "../../util/theme";
22
+ import { getBackgroundColor, getTheme, normalizePalette } from "../../util/theme";
23
23
 
24
24
  /**
25
25
  * FlowDiagramConfig defines the configuration for rendering the flow diagram.
@@ -75,13 +75,16 @@ function escapeHtml() {
75
75
  function createNodeHTML(d, color) {
76
76
  var _d$data, _d$states, _d$states2;
77
77
  var selectedBorderColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '#000';
78
+ var theme = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'default';
78
79
  var text = escapeHtml(((_d$data = d.data) === null || _d$data === void 0 ? void 0 : _d$data.text) || '');
79
80
  var isHovered = (_d$states = d.states) === null || _d$states === void 0 ? void 0 : _d$states.includes('active');
80
81
  var isSelected = (_d$states2 = d.states) === null || _d$states2 === void 0 ? void 0 : _d$states2.includes('selected');
81
82
  var nodeColor = isHovered ? ACTIVE_COLOR : color;
82
- return "\n <div\n data-node-key=\"".concat(escapeHtml(String(d.id)), "\"\n style=\"\n box-sizing: border-box;\n width: ").concat(DEFAULT_NODE_WIDTH, "px;\n min-height: ").concat(DEFAULT_NODE_HEIGHT, "px;\n padding: 16px;\n background: ").concat(nodeColor, ";\n border: 3px solid ").concat(isSelected ? selectedBorderColor : nodeColor, ";\n border-radius: 16px;\n color: #fff;\n font-size: 16px;\n font-weight: 600;\n line-height: 22px;\n text-align: center;\n white-space: normal;\n word-break: break-word;\n overflow-wrap: anywhere;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n \"\n >\n <div style=\"width: 100%;\">\n ").concat(text, "\n </div>\n </div>\n ");
83
+ var borderRadius = theme === 'academy' ? '0px' : '8px';
84
+ return "\n <div\n data-node-key=\"".concat(escapeHtml(String(d.id)), "\"\n style=\"\n box-sizing: border-box;\n width: ").concat(DEFAULT_NODE_WIDTH, "px;\n min-height: ").concat(DEFAULT_NODE_HEIGHT, "px;\n padding: 16px;\n background: ").concat(nodeColor, ";\n border: 3px solid ").concat(isSelected ? selectedBorderColor : nodeColor, ";\n border-radius: ").concat(borderRadius, ";\n color: #fff;\n font-size: 16px;\n font-weight: 600;\n line-height: 22px;\n text-align: center;\n white-space: normal;\n word-break: break-word;\n overflow-wrap: anywhere;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n \"\n >\n <div style=\"width: 100%;\">\n ").concat(text, "\n </div>\n </div>\n ");
83
85
  }
84
86
  function measureAndUpdateNodeSizes(graph, container, nodeColorMap, selectedBorderColor) {
87
+ var theme = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'default';
85
88
  var nodes = graph.getNodeData();
86
89
  var updatedNodes = nodes.map(function (node) {
87
90
  var dom = container.querySelector("[data-node-key=\"".concat(CSS.escape(String(node.id)), "\"]"));
@@ -95,7 +98,7 @@ function measureAndUpdateNodeSizes(graph, container, nodeColorMap, selectedBorde
95
98
  size: [DEFAULT_NODE_WIDTH, height],
96
99
  dx: -DEFAULT_NODE_WIDTH / 2,
97
100
  dy: -height / 2,
98
- innerHTML: createNodeHTML(node, nodeColorMap.get(String(node.id)) || '#1783FF', selectedBorderColor)
101
+ innerHTML: createNodeHTML(node, nodeColorMap.get(String(node.id)) || '#1783FF', selectedBorderColor, theme)
99
102
  }
100
103
  };
101
104
  });
@@ -235,29 +238,33 @@ export var FlowDiagram = function FlowDiagram(options) {
235
238
  container: containerEl,
236
239
  width: width,
237
240
  height: height,
238
- theme: theme,
241
+ theme: getTheme(theme),
239
242
  data: {
240
243
  nodes: g6Nodes,
241
244
  edges: g6Edges
242
245
  },
243
246
  autoFit: 'view',
244
247
  autoResize: true,
245
- padding: 20,
248
+ padding: title ? [46, 20, 20, 20] : 20,
246
249
  plugins: title ? [{
247
250
  key: 'title',
248
251
  type: 'title',
249
252
  title: title,
250
- titleFill: isDark ? '#e0e6ed' : '#1a1a2e'
253
+ titleFill: isDark ? '#e0e6ed' : '#000',
254
+ titleFontFamily: 'sans-serif'
251
255
  }] : [],
252
256
  node: {
253
257
  type: 'html',
254
258
  style: function style(d) {
259
+ var _d$style;
255
260
  var color = nodeColorMap.get(String(d.id)) || colors[0];
261
+ var size = ((_d$style = d.style) === null || _d$style === void 0 ? void 0 : _d$style.size) || [DEFAULT_NODE_WIDTH, DEFAULT_NODE_HEIGHT];
262
+ var height = size[1];
256
263
  return {
257
- size: [DEFAULT_NODE_WIDTH, DEFAULT_NODE_HEIGHT],
264
+ size: size,
258
265
  dx: -DEFAULT_NODE_WIDTH / 2,
259
- dy: -DEFAULT_NODE_HEIGHT / 2,
260
- innerHTML: createNodeHTML(d, color, selectedBorder),
266
+ dy: -height / 2,
267
+ innerHTML: createNodeHTML(d, color, selectedBorder, theme),
261
268
  ports: [{
262
269
  placement: 'top'
263
270
  }, {
@@ -317,7 +324,7 @@ export var FlowDiagram = function FlowDiagram(options) {
317
324
  // Measure real node heights after initial render
318
325
  graph.once('afterrender', function () {
319
326
  if (graph) {
320
- measureAndUpdateNodeSizes(graph, containerEl, nodeColorMap, selectedBorder);
327
+ measureAndUpdateNodeSizes(graph, containerEl, nodeColorMap, selectedBorder, theme);
321
328
  }
322
329
  });
323
330
  };
@@ -1,4 +1,4 @@
1
- import type { VisualizationOptions } from '../../types';
1
+ import type { VisualizationOptions, VisualizationTheme } from '../../types';
2
2
  /**
3
3
  * FunnelDataItem is the type for each data item in the funnel chart.
4
4
  */
@@ -12,8 +12,10 @@ export type FunnelDataItem = {
12
12
  export interface FunnelConfig {
13
13
  type?: 'funnel';
14
14
  data: FunnelDataItem[];
15
- theme?: 'default' | 'academy' | 'dark';
15
+ theme?: VisualizationTheme;
16
16
  title?: string;
17
+ locale?: string;
18
+ conversionRateLabel?: string;
17
19
  style?: {
18
20
  backgroundColor?: string;
19
21
  palette?: string[];