@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.
- package/CHANGELOG.md +450 -0
- package/dist/g2.full.min.js +1 -0
- package/dist/g2.lite.min.js +1 -0
- package/dist/g2.min.js +1 -1
- package/esm/api/chart.d.ts +2 -164
- package/esm/api/library.d.ts +1 -163
- package/esm/api/library.js +1 -2
- package/esm/api/library.js.map +1 -1
- package/esm/api/runtime.d.ts +1 -1
- package/esm/api/runtime.js +6 -1
- package/esm/api/runtime.js.map +1 -1
- package/esm/api/utils.d.ts +0 -4
- package/esm/api/utils.js +4 -3
- package/esm/api/utils.js.map +1 -1
- package/esm/component/axis.js +1 -1
- package/esm/component/axis.js.map +1 -1
- package/esm/component/legendCategory.js +1 -1
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +1 -1
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/scrollbar.js +1 -1
- package/esm/component/scrollbar.js.map +1 -1
- package/esm/component/slider.js +1 -1
- package/esm/component/slider.js.map +1 -1
- package/esm/component/utils.d.ts +1 -1
- package/esm/component/utils.js +1 -1
- package/esm/component/utils.js.map +1 -1
- package/esm/exports.d.ts +5 -0
- package/esm/exports.js +7 -0
- package/esm/exports.js.map +1 -0
- package/esm/index.d.ts +338 -7
- package/esm/index.js +9 -8
- package/esm/index.js.map +1 -1
- package/esm/interaction/tooltip.js +1 -2
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/lib/auto.d.ts +3 -0
- package/esm/lib/auto.js +7 -0
- package/esm/lib/auto.js.map +1 -0
- package/esm/lib/index.d.ts +1 -0
- package/esm/lib/index.js +1 -0
- package/esm/lib/index.js.map +1 -1
- package/esm/lib/std.d.ts +29 -29
- package/esm/mark/auto.d.ts +1 -0
- package/esm/mark/auto.js +26 -0
- package/esm/mark/auto.js.map +1 -0
- package/esm/mark/index.d.ts +1 -0
- package/esm/mark/index.js +1 -0
- package/esm/mark/index.js.map +1 -1
- package/esm/runtime/plot.js +2 -2
- package/esm/runtime/plot.js.map +1 -1
- package/esm/shape/connector/connector.js +1 -1
- package/esm/shape/connector/connector.js.map +1 -1
- package/esm/shape/index.d.ts +1 -1
- package/esm/shape/text/advance.js +1 -1
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/shape/text/badge.js +1 -1
- package/esm/shape/text/badge.js.map +1 -1
- package/esm/spec/index.d.ts +3 -3
- package/esm/spec/interaction.d.ts +1 -1
- package/esm/spec/mark.d.ts +4 -2
- package/esm/theme/academy.d.ts +17 -0
- package/esm/theme/academy.js +27 -4
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/dark.d.ts +17 -0
- package/esm/theme/dark.js +3 -2
- package/esm/theme/dark.js.map +1 -1
- package/esm/theme/light.d.ts +17 -0
- package/esm/theme/light.js +4 -3
- package/esm/theme/light.js.map +1 -1
- package/esm/utils/event.d.ts +31 -32
- package/esm/utils/event.js +2 -12
- package/esm/utils/event.js.map +1 -1
- package/esm/utils/size.js +0 -1
- package/esm/utils/size.js.map +1 -1
- package/lib/api/chart.d.ts +2 -164
- package/lib/api/library.d.ts +1 -163
- package/lib/api/library.js +1 -2
- package/lib/api/library.js.map +1 -1
- package/lib/api/runtime.d.ts +1 -1
- package/lib/api/runtime.js +6 -1
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/utils.d.ts +0 -4
- package/lib/api/utils.js +4 -3
- package/lib/api/utils.js.map +1 -1
- package/lib/component/axis.js +3 -3
- package/lib/component/axis.js.map +1 -1
- package/lib/component/legendCategory.js +2 -2
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +2 -2
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/scrollbar.js +2 -2
- package/lib/component/scrollbar.js.map +1 -1
- package/lib/component/slider.js +2 -2
- package/lib/component/slider.js.map +1 -1
- package/lib/component/utils.d.ts +1 -1
- package/lib/component/utils.js +2 -2
- package/lib/component/utils.js.map +1 -1
- package/lib/exports.d.ts +5 -0
- package/lib/exports.js +39 -0
- package/lib/exports.js.map +1 -0
- package/lib/index.d.ts +338 -7
- package/lib/index.js +11 -28
- package/lib/index.js.map +1 -1
- package/lib/interaction/tooltip.js +2 -3
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/lib/auto.d.ts +3 -0
- package/lib/lib/auto.js +11 -0
- package/lib/lib/auto.js.map +1 -0
- package/lib/lib/index.d.ts +1 -0
- package/lib/lib/index.js +3 -1
- package/lib/lib/index.js.map +1 -1
- package/lib/lib/std.d.ts +29 -29
- package/lib/mark/auto.d.ts +1 -0
- package/lib/mark/auto.js +30 -0
- package/lib/mark/auto.js.map +1 -0
- package/lib/mark/index.d.ts +1 -0
- package/lib/mark/index.js +3 -1
- package/lib/mark/index.js.map +1 -1
- package/lib/runtime/plot.js +2 -2
- package/lib/runtime/plot.js.map +1 -1
- package/lib/shape/connector/connector.js +2 -2
- package/lib/shape/connector/connector.js.map +1 -1
- package/lib/shape/index.d.ts +1 -1
- package/lib/shape/text/advance.js +3 -3
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/shape/text/badge.js +2 -2
- package/lib/shape/text/badge.js.map +1 -1
- package/lib/spec/index.d.ts +3 -3
- package/lib/spec/interaction.d.ts +1 -1
- package/lib/spec/mark.d.ts +4 -2
- package/lib/theme/academy.d.ts +17 -0
- package/lib/theme/academy.js +28 -5
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/dark.d.ts +17 -0
- package/lib/theme/dark.js +4 -3
- package/lib/theme/dark.js.map +1 -1
- package/lib/theme/light.d.ts +17 -0
- package/lib/theme/light.js +5 -4
- package/lib/theme/light.js.map +1 -1
- package/lib/utils/event.d.ts +31 -32
- package/lib/utils/event.js +2 -12
- package/lib/utils/event.js.map +1 -1
- package/lib/utils/size.js +0 -1
- package/lib/utils/size.js.map +1 -1
- package/package.json +24 -9
- package/src/api/chart.ts +1 -1
- package/src/api/library.ts +1 -2
- package/src/api/runtime.ts +7 -2
- package/src/api/utils.ts +4 -2
- package/src/component/axis.ts +1 -1
- package/src/component/legendCategory.ts +1 -1
- package/src/component/legendContinuous.ts +1 -1
- package/src/component/scrollbar.ts +1 -1
- package/src/component/slider.ts +1 -1
- package/src/component/utils.ts +1 -1
- package/src/exports.ts +32 -0
- package/src/index.ts +13 -41
- package/src/interaction/tooltip.ts +1 -2
- package/src/lib/auto.ts +7 -0
- package/src/lib/index.ts +1 -0
- package/src/mark/auto.ts +22 -0
- package/src/mark/index.ts +1 -0
- package/src/runtime/plot.ts +2 -2
- package/src/shape/connector/connector.ts +1 -1
- package/src/shape/index.ts +1 -1
- package/src/shape/text/advance.ts +1 -1
- package/src/shape/text/badge.ts +1 -1
- package/src/spec/index.ts +3 -3
- package/src/spec/interaction.ts +1 -1
- package/src/spec/mark.ts +4 -0
- package/src/theme/academy.ts +28 -4
- package/src/theme/dark.ts +4 -2
- package/src/theme/light.ts +5 -3
- package/src/utils/event.ts +32 -45
- package/src/utils/size.ts +0 -1
- package/dist/g2-lite.min.js +0 -1
package/src/api/runtime.ts
CHANGED
|
@@ -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 = {
|
|
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
|
-
|
|
75
|
-
|
|
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
|
|
package/src/component/axis.ts
CHANGED
|
@@ -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/
|
|
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';
|
package/src/component/slider.ts
CHANGED
package/src/component/utils.ts
CHANGED
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 {
|
|
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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
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/
|
|
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 }) => {
|
package/src/lib/auto.ts
ADDED
package/src/lib/index.ts
CHANGED
package/src/mark/auto.ts
ADDED
|
@@ -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';
|
package/src/runtime/plot.ts
CHANGED
|
@@ -424,8 +424,8 @@ function updateTooltip(
|
|
|
424
424
|
container: selection.node(),
|
|
425
425
|
update: (options) => Promise.resolve(options),
|
|
426
426
|
};
|
|
427
|
-
const
|
|
428
|
-
nameInteraction.set('tooltip',
|
|
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/
|
|
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';
|
package/src/shape/index.ts
CHANGED
|
@@ -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
|
|
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/
|
|
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';
|
package/src/shape/text/badge.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextStyleProps, DisplayObject } from '@antv/g';
|
|
2
|
-
import { Marker } from '@antv/
|
|
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;
|
package/src/spec/interaction.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TooltipStyleProps } from '@antv/
|
|
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;
|
package/src/theme/academy.ts
CHANGED
|
@@ -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
|
|
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:
|
|
12
|
-
|
|
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
|
|
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(
|
package/src/theme/light.ts
CHANGED
|
@@ -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
|
|
5
|
+
export const tokens = {
|
|
6
6
|
colorBlack: '#1D2129',
|
|
7
|
-
colorWhite: '#
|
|
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
|
|
package/src/utils/event.ts
CHANGED
|
@@ -1,52 +1,39 @@
|
|
|
1
1
|
// to prevent users from tampering with internal values.
|
|
2
|
-
const ChartEvent =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
AFTER_RENDER: 'afterrender',
|
|
2
|
+
export const ChartEvent = {
|
|
3
|
+
BEFORE_RENDER: 'beforerender',
|
|
4
|
+
AFTER_RENDER: 'afterrender',
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
BEFORE_PAINT: 'beforepaint',
|
|
7
|
+
AFTER_PAINT: 'afterpaint',
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
BEFORE_CHANGE_DATA: 'beforechangedata',
|
|
10
|
+
AFTER_CHANGE_DATA: 'afterchangedata',
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
BEFORE_CLEAR: 'beforeclear',
|
|
13
|
+
AFTER_CLEAR: 'afterclear',
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
BEFORE_DESTROY: 'beforedestroy',
|
|
16
|
+
AFTER_DESTROY: 'afterdestroy',
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
BEFORE_CHANGE_SIZE: 'beforechangesize',
|
|
19
|
+
AFTER_CHANGE_SIZE: 'afterchangesize',
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
+
};
|