@antv/g2 5.1.5-beta.0 → 5.1.6-beta.0

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 (176) hide show
  1. package/CHANGELOG.md +450 -0
  2. package/dist/g2.full.min.js +1 -0
  3. package/dist/g2.lite.min.js +1 -0
  4. package/dist/g2.min.js +1 -1
  5. package/esm/api/chart.d.ts +2 -164
  6. package/esm/api/library.d.ts +1 -163
  7. package/esm/api/library.js +1 -2
  8. package/esm/api/library.js.map +1 -1
  9. package/esm/api/runtime.d.ts +1 -1
  10. package/esm/api/runtime.js +6 -1
  11. package/esm/api/runtime.js.map +1 -1
  12. package/esm/api/utils.d.ts +0 -4
  13. package/esm/api/utils.js +4 -3
  14. package/esm/api/utils.js.map +1 -1
  15. package/esm/component/axis.js +1 -1
  16. package/esm/component/axis.js.map +1 -1
  17. package/esm/component/legendCategory.js +1 -1
  18. package/esm/component/legendCategory.js.map +1 -1
  19. package/esm/component/legendContinuous.js +1 -1
  20. package/esm/component/legendContinuous.js.map +1 -1
  21. package/esm/component/scrollbar.js +1 -1
  22. package/esm/component/scrollbar.js.map +1 -1
  23. package/esm/component/slider.js +1 -1
  24. package/esm/component/slider.js.map +1 -1
  25. package/esm/component/utils.d.ts +1 -1
  26. package/esm/component/utils.js +1 -1
  27. package/esm/component/utils.js.map +1 -1
  28. package/esm/exports.d.ts +5 -0
  29. package/esm/exports.js +7 -0
  30. package/esm/exports.js.map +1 -0
  31. package/esm/index.d.ts +338 -7
  32. package/esm/index.js +9 -8
  33. package/esm/index.js.map +1 -1
  34. package/esm/interaction/tooltip.js +1 -2
  35. package/esm/interaction/tooltip.js.map +1 -1
  36. package/esm/lib/auto.d.ts +3 -0
  37. package/esm/lib/auto.js +7 -0
  38. package/esm/lib/auto.js.map +1 -0
  39. package/esm/lib/index.d.ts +1 -0
  40. package/esm/lib/index.js +1 -0
  41. package/esm/lib/index.js.map +1 -1
  42. package/esm/lib/std.d.ts +29 -29
  43. package/esm/mark/auto.d.ts +1 -0
  44. package/esm/mark/auto.js +26 -0
  45. package/esm/mark/auto.js.map +1 -0
  46. package/esm/mark/index.d.ts +1 -0
  47. package/esm/mark/index.js +1 -0
  48. package/esm/mark/index.js.map +1 -1
  49. package/esm/runtime/plot.js +2 -2
  50. package/esm/runtime/plot.js.map +1 -1
  51. package/esm/shape/connector/connector.js +1 -1
  52. package/esm/shape/connector/connector.js.map +1 -1
  53. package/esm/shape/index.d.ts +1 -1
  54. package/esm/shape/text/advance.js +1 -1
  55. package/esm/shape/text/advance.js.map +1 -1
  56. package/esm/shape/text/badge.js +1 -1
  57. package/esm/shape/text/badge.js.map +1 -1
  58. package/esm/spec/index.d.ts +3 -3
  59. package/esm/spec/interaction.d.ts +1 -1
  60. package/esm/spec/mark.d.ts +4 -2
  61. package/esm/theme/academy.d.ts +17 -0
  62. package/esm/theme/academy.js +27 -4
  63. package/esm/theme/academy.js.map +1 -1
  64. package/esm/theme/dark.d.ts +17 -0
  65. package/esm/theme/dark.js +3 -2
  66. package/esm/theme/dark.js.map +1 -1
  67. package/esm/theme/light.d.ts +17 -0
  68. package/esm/theme/light.js +4 -3
  69. package/esm/theme/light.js.map +1 -1
  70. package/esm/utils/event.d.ts +31 -32
  71. package/esm/utils/event.js +2 -12
  72. package/esm/utils/event.js.map +1 -1
  73. package/esm/utils/size.js +0 -1
  74. package/esm/utils/size.js.map +1 -1
  75. package/lib/api/chart.d.ts +2 -164
  76. package/lib/api/library.d.ts +1 -163
  77. package/lib/api/library.js +1 -2
  78. package/lib/api/library.js.map +1 -1
  79. package/lib/api/runtime.d.ts +1 -1
  80. package/lib/api/runtime.js +6 -1
  81. package/lib/api/runtime.js.map +1 -1
  82. package/lib/api/utils.d.ts +0 -4
  83. package/lib/api/utils.js +4 -3
  84. package/lib/api/utils.js.map +1 -1
  85. package/lib/component/axis.js +3 -3
  86. package/lib/component/axis.js.map +1 -1
  87. package/lib/component/legendCategory.js +2 -2
  88. package/lib/component/legendCategory.js.map +1 -1
  89. package/lib/component/legendContinuous.js +2 -2
  90. package/lib/component/legendContinuous.js.map +1 -1
  91. package/lib/component/scrollbar.js +2 -2
  92. package/lib/component/scrollbar.js.map +1 -1
  93. package/lib/component/slider.js +2 -2
  94. package/lib/component/slider.js.map +1 -1
  95. package/lib/component/utils.d.ts +1 -1
  96. package/lib/component/utils.js +2 -2
  97. package/lib/component/utils.js.map +1 -1
  98. package/lib/exports.d.ts +5 -0
  99. package/lib/exports.js +39 -0
  100. package/lib/exports.js.map +1 -0
  101. package/lib/index.d.ts +338 -7
  102. package/lib/index.js +11 -28
  103. package/lib/index.js.map +1 -1
  104. package/lib/interaction/tooltip.js +2 -3
  105. package/lib/interaction/tooltip.js.map +1 -1
  106. package/lib/lib/auto.d.ts +3 -0
  107. package/lib/lib/auto.js +11 -0
  108. package/lib/lib/auto.js.map +1 -0
  109. package/lib/lib/index.d.ts +1 -0
  110. package/lib/lib/index.js +3 -1
  111. package/lib/lib/index.js.map +1 -1
  112. package/lib/lib/std.d.ts +29 -29
  113. package/lib/mark/auto.d.ts +1 -0
  114. package/lib/mark/auto.js +30 -0
  115. package/lib/mark/auto.js.map +1 -0
  116. package/lib/mark/index.d.ts +1 -0
  117. package/lib/mark/index.js +3 -1
  118. package/lib/mark/index.js.map +1 -1
  119. package/lib/runtime/plot.js +2 -2
  120. package/lib/runtime/plot.js.map +1 -1
  121. package/lib/shape/connector/connector.js +2 -2
  122. package/lib/shape/connector/connector.js.map +1 -1
  123. package/lib/shape/index.d.ts +1 -1
  124. package/lib/shape/text/advance.js +3 -3
  125. package/lib/shape/text/advance.js.map +1 -1
  126. package/lib/shape/text/badge.js +2 -2
  127. package/lib/shape/text/badge.js.map +1 -1
  128. package/lib/spec/index.d.ts +3 -3
  129. package/lib/spec/interaction.d.ts +1 -1
  130. package/lib/spec/mark.d.ts +4 -2
  131. package/lib/theme/academy.d.ts +17 -0
  132. package/lib/theme/academy.js +28 -5
  133. package/lib/theme/academy.js.map +1 -1
  134. package/lib/theme/dark.d.ts +17 -0
  135. package/lib/theme/dark.js +4 -3
  136. package/lib/theme/dark.js.map +1 -1
  137. package/lib/theme/light.d.ts +17 -0
  138. package/lib/theme/light.js +5 -4
  139. package/lib/theme/light.js.map +1 -1
  140. package/lib/utils/event.d.ts +31 -32
  141. package/lib/utils/event.js +2 -12
  142. package/lib/utils/event.js.map +1 -1
  143. package/lib/utils/size.js +0 -1
  144. package/lib/utils/size.js.map +1 -1
  145. package/package.json +24 -9
  146. package/src/api/chart.ts +1 -1
  147. package/src/api/library.ts +1 -2
  148. package/src/api/runtime.ts +7 -2
  149. package/src/api/utils.ts +4 -2
  150. package/src/component/axis.ts +1 -1
  151. package/src/component/legendCategory.ts +1 -1
  152. package/src/component/legendContinuous.ts +1 -1
  153. package/src/component/scrollbar.ts +1 -1
  154. package/src/component/slider.ts +1 -1
  155. package/src/component/utils.ts +1 -1
  156. package/src/exports.ts +32 -0
  157. package/src/index.ts +13 -41
  158. package/src/interaction/tooltip.ts +1 -2
  159. package/src/lib/auto.ts +7 -0
  160. package/src/lib/index.ts +1 -0
  161. package/src/mark/auto.ts +22 -0
  162. package/src/mark/index.ts +1 -0
  163. package/src/runtime/plot.ts +2 -2
  164. package/src/shape/connector/connector.ts +1 -1
  165. package/src/shape/index.ts +1 -1
  166. package/src/shape/text/advance.ts +1 -1
  167. package/src/shape/text/badge.ts +1 -1
  168. package/src/spec/index.ts +3 -3
  169. package/src/spec/interaction.ts +1 -1
  170. package/src/spec/mark.ts +4 -0
  171. package/src/theme/academy.ts +28 -4
  172. package/src/theme/dark.ts +4 -2
  173. package/src/theme/light.ts +5 -3
  174. package/src/utils/event.ts +32 -45
  175. package/src/utils/size.ts +0 -1
  176. package/dist/g2-lite.min.js +0 -1
@@ -6,7 +6,7 @@ import EventEmitter from '@antv/event-emitter';
6
6
  import { G2Context, render, destroy } from '../runtime';
7
7
  import { G2Spec, ViewComposition } from '../spec';
8
8
  import { ChartEvent } from '../utils/event';
9
- import { G2Library } from '../runtime/types/options';
9
+ import type { G2Library } from '../runtime/types/options';
10
10
  import {
11
11
  normalizeContainer,
12
12
  removeContainer,
@@ -20,6 +20,7 @@ import { CompositionNode } from './composition';
20
20
  import { Node } from './node';
21
21
  import { defineProps, nodeProps } from './define';
22
22
  import { MarkNode } from './mark';
23
+ import { library } from './library';
23
24
 
24
25
  export const G2_CHART_KEY = 'G2_CHART_KEY';
25
26
 
@@ -58,7 +59,11 @@ export class Runtime<Spec extends G2Spec = G2Spec> extends CompositionNode {
58
59
  this._plugins = plugins || [];
59
60
  this._container = normalizeContainer(container);
60
61
  this._emitter = new EventEmitter();
61
- this._context = { library: lib, emitter: this._emitter, canvas };
62
+ this._context = {
63
+ library: { ...lib, ...library },
64
+ emitter: this._emitter,
65
+ canvas,
66
+ };
62
67
  this._create();
63
68
  }
64
69
 
package/src/api/utils.ts CHANGED
@@ -71,8 +71,10 @@ export function valueOf(node: Node): Record<string, any> {
71
71
 
72
72
  export function sizeOf(options, container) {
73
73
  const { autoFit } = options;
74
- if (autoFit) return getContainerSize(container);
75
- const { width = 640, height = 480, depth = 0 } = options;
74
+ const { width = 640, height = 480 } = autoFit
75
+ ? getContainerSize(container)
76
+ : options;
77
+ const { depth = 0 } = options;
76
78
  return { width, height, depth };
77
79
  }
78
80
 
@@ -1,6 +1,6 @@
1
1
  import { Coordinate } from '@antv/coord';
2
2
  import type { DisplayObject } from '@antv/g';
3
- import { Axis as AxisComponent } from '@antv/gui';
3
+ import { Axis as AxisComponent } from '@antv/component';
4
4
  import { Linear as LinearScale } from '@antv/scale';
5
5
  import { deepMix, omit, upperFirst } from '@antv/util';
6
6
  import { extent } from 'd3-array';
@@ -1,5 +1,5 @@
1
1
  import type { DisplayObject } from '@antv/g';
2
- import { Category } from '@antv/gui';
2
+ import { Category } from '@antv/component';
3
3
  import { last } from '@antv/util';
4
4
  import { format } from 'd3-format';
5
5
  import { Identity } from '@antv/scale';
@@ -1,5 +1,5 @@
1
1
  import { DisplayObject, parseColor } from '@antv/g';
2
- import { Continuous } from '@antv/gui';
2
+ import { Continuous } from '@antv/component';
3
3
  import { Constant, Quantile, Quantize, Threshold } from '@antv/scale';
4
4
  import { format } from 'd3-format';
5
5
  import type {
@@ -1,4 +1,4 @@
1
- import { Scrollbar as ScrollbarComponent } from '@antv/gui';
1
+ import { Scrollbar as ScrollbarComponent } from '@antv/component';
2
2
  import { DisplayObject } from '@antv/g';
3
3
  import { GuideComponentComponent as GCC } from '../runtime';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Slider as SliderComponent } from '@antv/gui';
1
+ import { Slider as SliderComponent } from '@antv/component';
2
2
  import { format } from 'd3-format';
3
3
  import { DisplayObject } from '@antv/g';
4
4
  import { isTranspose } from '../utils/coordinate';
@@ -1,5 +1,5 @@
1
1
  import { CustomElement, DisplayObjectConfig, Group } from '@antv/g';
2
- import { Layout } from '@antv/gui';
2
+ import { Layout } from '@antv/component';
3
3
  import { deepMix, upperFirst } from '@antv/util';
4
4
  import {
5
5
  FlexLayout,
package/src/exports.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { runtime } from '@antv/g';
2
+
3
+ runtime.enableCSSParsing = false;
4
+
5
+ export {
6
+ render,
7
+ renderToMountedElement,
8
+ MAIN_LAYER_CLASS_NAME,
9
+ LABEL_LAYER_CLASS_NAME,
10
+ ELEMENT_CLASS_NAME,
11
+ VIEW_CLASS_NAME,
12
+ PLOT_CLASS_NAME,
13
+ COMPONENT_CLASS_NAME,
14
+ LABEL_CLASS_NAME,
15
+ AREA_CLASS_NAME,
16
+ MASK_CLASS_NAME,
17
+ } from './runtime';
18
+
19
+ export {
20
+ type MarkNode,
21
+ type CompositionNode,
22
+ register,
23
+ Runtime,
24
+ extend,
25
+ type ChartOptions,
26
+ } from './api';
27
+
28
+ export { ChartEvent } from './utils/event';
29
+
30
+ export type { G2Context } from './runtime';
31
+
32
+ export * from './spec';
package/src/index.ts CHANGED
@@ -1,45 +1,17 @@
1
- import { runtime } from '@antv/g';
1
+ import { corelib, plotlib, graphlib, geolib, stdlib, threedlib } from './lib';
2
+ import { extend, Runtime } from './api';
3
+ import { API, CompositionAPI } from './api/extend';
4
+ import { G2Spec } from './spec';
2
5
 
3
- runtime.enableCSSParsing = false;
6
+ export { corelib, plotlib, graphlib, geolib, stdlib, threedlib };
4
7
 
5
- export {
6
- render,
7
- renderToMountedElement,
8
- MAIN_LAYER_CLASS_NAME,
9
- LABEL_LAYER_CLASS_NAME,
10
- ELEMENT_CLASS_NAME,
11
- VIEW_CLASS_NAME,
12
- PLOT_CLASS_NAME,
13
- COMPONENT_CLASS_NAME,
14
- LABEL_CLASS_NAME,
15
- AREA_CLASS_NAME,
16
- MASK_CLASS_NAME,
17
- } from './runtime';
8
+ export * from './exports';
18
9
 
19
- export {
20
- corelib,
21
- stdlib,
22
- litelib,
23
- graphlib,
24
- plotlib,
25
- geolib,
26
- threedlib,
27
- } from './lib';
10
+ /**
11
+ * G2 standard library initial all the libs except 3D and auto.
12
+ */
13
+ const library = { ...stdlib() };
28
14
 
29
- export * from './mark';
30
-
31
- export {
32
- Chart,
33
- type MarkNode,
34
- type CompositionNode,
35
- register,
36
- Runtime,
37
- extend,
38
- type ChartOptions,
39
- } from './api';
40
-
41
- export { ChartEvent } from './utils/event';
42
-
43
- export type { G2Context } from './runtime';
44
-
45
- export * from './spec';
15
+ export const Chart = extend(Runtime, library);
16
+ export interface Chart extends API<G2Spec, typeof library> {}
17
+ export interface CompositionNode extends CompositionAPI<typeof library> {}
@@ -1,7 +1,7 @@
1
1
  import { Circle, DisplayObject, IElement, Line } from '@antv/g';
2
2
  import { sort, group, mean, bisector, minIndex } from 'd3-array';
3
3
  import { deepMix, lowerFirst, throttle } from '@antv/util';
4
- import { Tooltip as TooltipComponent } from '@antv/gui';
4
+ import { Tooltip as TooltipComponent } from '@antv/component';
5
5
  import { Constant, Band } from '@antv/scale';
6
6
  import { defined, subObject } from '../utils/helper';
7
7
  import { isTranspose, isPolar } from '../utils/coordinate';
@@ -864,7 +864,6 @@ export function tooltip(
864
864
  root.removeEventListener('pointermove', pointerover);
865
865
  root.removeEventListener('pointerout', pointerout);
866
866
  }
867
- destroyTooltip({ root, single });
868
867
  };
869
868
 
870
869
  const onTooltipShow = ({ nativeEvent, data }) => {
@@ -0,0 +1,7 @@
1
+ import { Auto } from '../mark/auto';
2
+
3
+ export function autolib() {
4
+ return {
5
+ 'mark.auto': Auto,
6
+ } as const;
7
+ }
package/src/lib/index.ts CHANGED
@@ -5,3 +5,4 @@ export { plotlib } from './plot';
5
5
  export { threedlib } from './threed';
6
6
  export { stdlib } from './std';
7
7
  export { litelib } from './lite';
8
+ export { autolib } from './auto';
@@ -0,0 +1,22 @@
1
+ import { Advisor } from '@antv/ava';
2
+ import { deepMix } from '@antv/util';
3
+
4
+ export const Auto = (options) => {
5
+ const chartAdvisor = new Advisor();
6
+ const {
7
+ data,
8
+ dataProps,
9
+ fields,
10
+ options: o,
11
+ colorOptions,
12
+ ...rest
13
+ } = options;
14
+ const results = chartAdvisor.advise({
15
+ data,
16
+ dataProps,
17
+ fields,
18
+ options: o,
19
+ colorOptions,
20
+ });
21
+ return deepMix({}, rest, results?.[0].spec);
22
+ };
package/src/mark/index.ts CHANGED
@@ -32,6 +32,7 @@ export { Gauge } from './gauge';
32
32
  export { Density } from './density';
33
33
  export { Heatmap } from './heatmap';
34
34
  export { Liquid } from './liquid';
35
+ export { Auto } from './auto';
35
36
 
36
37
  export type { IntervalOptions } from './interval';
37
38
  export type { RectOptions } from './rect';
@@ -424,8 +424,8 @@ function updateTooltip(
424
424
  container: selection.node(),
425
425
  update: (options) => Promise.resolve(options),
426
426
  };
427
- const newTooltip = applyTooltip(target, [], context.emitter);
428
- nameInteraction.set('tooltip', newTooltip);
427
+ const destroy = applyTooltip(target, [], context.emitter);
428
+ nameInteraction.set('tooltip', { destroy });
429
429
  }
430
430
 
431
431
  async function initializeView(
@@ -1,7 +1,7 @@
1
1
  import { Coordinate } from '@antv/coord';
2
2
  import type { PathArray } from '@antv/util';
3
3
  import { PathStyleProps, Path } from '@antv/g';
4
- import { Marker } from '@antv/gui';
4
+ import { Marker } from '@antv/component';
5
5
  import { line as d3line } from 'd3-shape';
6
6
  import { ShapeComponent as SC, Vector2, WithPrefix } from '../../runtime';
7
7
  import { isTranspose } from '../../utils/coordinate';
@@ -66,7 +66,7 @@ export { Liquid as LiquidShape } from './liquid/liquid';
66
66
  export type { RectOptions as IntervalShapeOptions } from './interval/rect';
67
67
  export type { HollowOptions as IntervalHollowOptions } from './interval/hollow';
68
68
  export type { FunnelOptions as IntervalFunnelOptions } from './interval/funnel';
69
- export type { PyramidOptions as IntervalPyline3DramidOptions } from './interval/pyramid';
69
+ export type { PyramidOptions as IntervalPyramidOptions } from './interval/pyramid';
70
70
  export type { LineOptions as LineShapeOptions } from './line/line';
71
71
  export type { SmoothOptions as LineSmoothOptions } from './line/smooth';
72
72
  export type { HVOptions as LineHVOptions } from './line/hv';
@@ -8,7 +8,7 @@ import {
8
8
  PathStyleProps,
9
9
  } from '@antv/g';
10
10
  import { isNumber } from '@antv/util';
11
- import { Marker } from '@antv/gui';
11
+ import { Marker } from '@antv/component';
12
12
  import { line } from 'd3-shape';
13
13
  import { WithPrefix } from '../../runtime';
14
14
  import { createElement } from '../../utils/createElement';
@@ -1,5 +1,5 @@
1
1
  import { TextStyleProps, DisplayObject } from '@antv/g';
2
- import { Marker } from '@antv/gui';
2
+ import { Marker } from '@antv/component';
3
3
  import { ShapeComponent as SC, WithPrefix } from '../../runtime';
4
4
  import { createElement } from '../../utils/createElement';
5
5
  import { subObject } from '../../utils/helper';
package/src/spec/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { AxisComponent, LegendComponent } from './component';
2
- import { Composition } from './composition';
3
- import { Mark } from './mark';
1
+ import type { AxisComponent, LegendComponent } from './component';
2
+ import type { Composition } from './composition';
3
+ import type { Mark } from './mark';
4
4
 
5
5
  export type G2Spec = (Mark | Composition | AxisComponent | LegendComponent) & {
6
6
  width?: number;
@@ -1,4 +1,4 @@
1
- import type { TooltipStyleProps } from '@antv/gui';
1
+ import type { TooltipStyleProps } from '@antv/component';
2
2
  import { BBox, InteractionComponent } from '../runtime';
3
3
  import { FisheyeCoordinate } from './coordinateTransform';
4
4
  import { TooltipItemValue } from './component';
package/src/spec/mark.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { AdviseParams } from '@antv/ava';
1
2
  import { MarkComponent } from '../runtime';
2
3
  import { Encode } from './encode';
3
4
  import { Transform } from './transform';
@@ -18,6 +19,7 @@ import {
18
19
  import { Closeable, Literal2Object, Padding } from './utils';
19
20
 
20
21
  export type Mark =
22
+ | AutoMark
21
23
  | IntervalMark
22
24
  | RectMark
23
25
  | LineMark
@@ -51,6 +53,7 @@ export type Mark =
51
53
  | CompositeMark;
52
54
 
53
55
  export type MarkTypes =
56
+ | 'auto'
54
57
  | 'interval'
55
58
  | 'rect'
56
59
  | 'line'
@@ -391,3 +394,4 @@ export type HeatmapMark = BaseMark<'heatmap'>;
391
394
  export type LiquidMark = BaseMark<'liquid'>;
392
395
 
393
396
  export type CustomMark = BaseMark<MarkComponent, ChannelTypes>;
397
+ export type AutoMark = BaseMark<'auto'> & AdviseParams;
@@ -2,14 +2,36 @@ import { deepMix } from '@antv/util';
2
2
  import { ThemeComponent as TC, Theme } from '../runtime';
3
3
  import { create } from './create';
4
4
 
5
- const defaults = create({
5
+ export const tokens = {
6
6
  colorBlack: '#000',
7
7
  colorWhite: '#fff',
8
8
  colorStroke: '#888',
9
9
  colorDefault: '#4e79a7',
10
10
  colorBackground: 'transparent',
11
- category10: 'tableau10',
12
- category20: 'tableau10',
11
+ category10: [
12
+ '#4e79a7',
13
+ '#f28e2c',
14
+ '#e15759',
15
+ '#76b7b2',
16
+ '#59a14f',
17
+ '#edc949',
18
+ '#af7aa1',
19
+ '#ff9da7',
20
+ '#9c755f',
21
+ '#bab0ab',
22
+ ],
23
+ category20: [
24
+ '#4e79a7',
25
+ '#f28e2c',
26
+ '#e15759',
27
+ '#76b7b2',
28
+ '#59a14f',
29
+ '#edc949',
30
+ '#af7aa1',
31
+ '#ff9da7',
32
+ '#9c755f',
33
+ '#bab0ab',
34
+ ],
13
35
  padding1: 8,
14
36
  padding2: 12,
15
37
  padding3: 20,
@@ -18,7 +40,9 @@ const defaults = create({
18
40
  alpha45: 0.45,
19
41
  alpha25: 0.25,
20
42
  alpha10: 0.1,
21
- });
43
+ };
44
+
45
+ const defaults = create(tokens);
22
46
 
23
47
  export type AcademyOptions = Theme;
24
48
 
package/src/theme/dark.ts CHANGED
@@ -4,7 +4,7 @@ import { create } from './create';
4
4
 
5
5
  export type DarkOptions = Theme;
6
6
 
7
- const defaults = create({
7
+ export const tokens = {
8
8
  colorBlack: '#fff',
9
9
  colorWhite: '#000',
10
10
  colorStroke: '#416180',
@@ -52,7 +52,9 @@ const defaults = create({
52
52
  alpha45: 0.45,
53
53
  alpha25: 0.25,
54
54
  alpha10: 0.25,
55
- });
55
+ };
56
+
57
+ const defaults = create(tokens);
56
58
 
57
59
  export const Dark: TC<DarkOptions> = (options) => {
58
60
  return deepMix(
@@ -2,9 +2,9 @@ import { deepMix } from '@antv/util';
2
2
  import { ThemeComponent as TC, Theme } from '../runtime';
3
3
  import { create } from './create';
4
4
 
5
- const defaults = create({
5
+ export const tokens = {
6
6
  colorBlack: '#1D2129',
7
- colorWhite: '#fff',
7
+ colorWhite: '#ffffff',
8
8
  colorStroke: '#416180',
9
9
  colorDefault: '#1783FF',
10
10
  colorBackground: 'transparent',
@@ -50,7 +50,9 @@ const defaults = create({
50
50
  alpha45: 0.45,
51
51
  alpha25: 0.25,
52
52
  alpha10: 0.1,
53
- });
53
+ };
54
+
55
+ const defaults = create(tokens);
54
56
 
55
57
  export type LightOptions = Theme;
56
58
 
@@ -1,52 +1,39 @@
1
1
  // to prevent users from tampering with internal values.
2
- const ChartEvent = new Proxy(
3
- {
4
- BEFORE_RENDER: 'beforerender',
5
- AFTER_RENDER: 'afterrender',
2
+ export const ChartEvent = {
3
+ BEFORE_RENDER: 'beforerender',
4
+ AFTER_RENDER: 'afterrender',
6
5
 
7
- BEFORE_PAINT: 'beforepaint',
8
- AFTER_PAINT: 'afterpaint',
6
+ BEFORE_PAINT: 'beforepaint',
7
+ AFTER_PAINT: 'afterpaint',
9
8
 
10
- BEFORE_CHANGE_DATA: 'beforechangedata',
11
- AFTER_CHANGE_DATA: 'afterchangedata',
9
+ BEFORE_CHANGE_DATA: 'beforechangedata',
10
+ AFTER_CHANGE_DATA: 'afterchangedata',
12
11
 
13
- BEFORE_CLEAR: 'beforeclear',
14
- AFTER_CLEAR: 'afterclear',
12
+ BEFORE_CLEAR: 'beforeclear',
13
+ AFTER_CLEAR: 'afterclear',
15
14
 
16
- BEFORE_DESTROY: 'beforedestroy',
17
- AFTER_DESTROY: 'afterdestroy',
15
+ BEFORE_DESTROY: 'beforedestroy',
16
+ AFTER_DESTROY: 'afterdestroy',
18
17
 
19
- BEFORE_CHANGE_SIZE: 'beforechangesize',
20
- AFTER_CHANGE_SIZE: 'afterchangesize',
18
+ BEFORE_CHANGE_SIZE: 'beforechangesize',
19
+ AFTER_CHANGE_SIZE: 'afterchangesize',
21
20
 
22
- POINTER_TAP: 'pointertap',
23
- POINTER_DOWN: 'pointerdown',
24
- POINTER_UP: 'pointerup',
25
- POINTER_OVER: 'pointerover',
26
- POINTER_OUT: 'pointerout',
27
- POINTER_MOVE: 'pointermove',
28
- POINTER_ENTER: 'pointerenter',
29
- POINTER_LEAVE: 'pointerleave',
30
- POINTER_UPOUTSIDE: 'pointerupoutside',
31
- DRAG_START: 'dragstart',
32
- DRAG: 'drag',
33
- DRAG_END: 'dragend',
34
- DRAG_ENTER: 'dragenter',
35
- DRAG_LEAVE: 'dragleave',
36
- DRAG_OVER: 'dragover',
37
- DROP: 'DROP',
38
- CLICK: 'click',
39
- DBLCLICK: 'dblclick',
40
- } as const,
41
- {
42
- get(target, prop) {
43
- if (prop in target) return target[prop];
44
- return undefined;
45
- },
46
- set() {
47
- return true;
48
- },
49
- },
50
- );
51
-
52
- export { ChartEvent };
21
+ POINTER_TAP: 'pointertap',
22
+ POINTER_DOWN: 'pointerdown',
23
+ POINTER_UP: 'pointerup',
24
+ POINTER_OVER: 'pointerover',
25
+ POINTER_OUT: 'pointerout',
26
+ POINTER_MOVE: 'pointermove',
27
+ POINTER_ENTER: 'pointerenter',
28
+ POINTER_LEAVE: 'pointerleave',
29
+ POINTER_UPOUTSIDE: 'pointerupoutside',
30
+ DRAG_START: 'dragstart',
31
+ DRAG: 'drag',
32
+ DRAG_END: 'dragend',
33
+ DRAG_ENTER: 'dragenter',
34
+ DRAG_LEAVE: 'dragleave',
35
+ DRAG_OVER: 'dragover',
36
+ DROP: 'DROP',
37
+ CLICK: 'click',
38
+ DBLCLICK: 'dblclick',
39
+ };
package/src/utils/size.ts CHANGED
@@ -29,7 +29,6 @@ export function getContainerSize(container: HTMLElement): Size {
29
29
  return {
30
30
  width: wrapperWidth - widthPadding,
31
31
  height: wrapperHeight - heightPadding,
32
- depth: wrapperWidth,
33
32
  };
34
33
  }
35
34