Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(esm): remove all lib import #3141

Merged
merged 2 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g2",
"version": "4.1.3",
"version": "4.1.4",
"description": "the Grammar of Graphics in Javascript",
"main": "lib/index.js",
"module": "esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/animate/animation/sector-path-update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getArcParams from '@antv/g-canvas/lib/util/arc-params';
import { getArcParams } from '@antv/g-canvas';
import { isNumberEqual, isEqual } from '@antv/util';

import { IShape, PathCommand } from '../../dependents';
Expand Down
2 changes: 1 addition & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* G2 的一个壳子,不包含 Geometry,由开发者自己定义和引入 */

export const VERSION = '4.1.3';
export const VERSION = '4.1.4';

// 核心基类导出
export { Chart, View, Event } from './chart'; // Chart, View 类
Expand Down
22 changes: 13 additions & 9 deletions src/dependents.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
/* 依赖的模块,在这里统一引入,方便打包优化 */

// G
export { ICanvas, IElement, IGroup, IShape } from '@antv/g-base/lib/interfaces';
export { PathCommand, BBox, Point, ShapeAttrs } from '@antv/g-base/lib/types';
export { Event, AbstractGroup, AbstractShape } from '@antv/g-base';
export {
ICanvas, IElement, IGroup, IShape,
PathCommand, BBox, Point, ShapeAttrs,
Event, AbstractGroup, AbstractShape
} from '@antv/g-base';
// 需要有 G-base 提供 g engine 类型定义
export type IG = any;

// adjust
export { registerAdjust, getAdjust, Adjust } from '@antv/adjust/lib/factory';
export { registerAdjust, getAdjust, Adjust } from '@antv/adjust';

// attr
export { getAttribute, Attribute } from '@antv/attr/lib/factory';
export { getAttribute, Attribute } from '@antv/attr';
export { Color } from '@antv/attr';

// coordinate
export { getCoordinate, registerCoordinate, Coordinate, CoordinateCfg } from '@antv/coord';

// scale
export { getScale, registerScale, Scale, ScaleConfig } from '@antv/scale';
export { Tick } from '@antv/scale/lib/types';
export { getScale, registerScale, Scale, ScaleConfig, Tick } from '@antv/scale';

// component
import {
Expand All @@ -35,7 +36,7 @@ import {
Tooltip,
Scrollbar,
} from '@antv/component';
export { IComponent, IList } from '@antv/component/lib/interfaces';

export {
CategoryLegendCfg,
CircleAxisCfg,
Expand Down Expand Up @@ -65,7 +66,10 @@ export {
TrendCfg,
EnhancedTextCfg,
LineAnnotationTextCfg,
} from '@antv/component/lib/types';
IComponent,
IList,
} from '@antv/component';

export { HtmlComponent, GroupComponent, Component, Crosshair };
export { Annotation };
// axis
Expand Down
4 changes: 3 additions & 1 deletion src/geometry/element/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { deepMix, each, get, isArray, isEmpty, isEqual, isFunction, isString } from '@antv/util';
import { propagationDelegate } from '@antv/component/lib/util/event';
// 暂未发包
// @ts-ignore
import { propagationDelegate } from '@antv/component';
import { doAnimate } from '../../animate';
import Base from '../../base';
import { BBox, IGroup, IShape } from '../../dependents';
Expand Down
2 changes: 1 addition & 1 deletion src/interaction/action/component/list-highlight-util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IList } from '@antv/component/lib/interfaces';
import { IList } from '@antv/component';
import { each } from '@antv/util';

const STATUS_UNACTIVE = 'inactive';
Expand Down
2 changes: 1 addition & 1 deletion src/interaction/action/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Geometry from '../../geometry/base';
import Element from '../../geometry/element/';
import { catmullRom2bezier, getLinePath } from '../../geometry/shape/util/path';
import { toPoints } from '../../util/bbox';
import isPolygonsIntersect from '@antv/path-util/lib/is-polygons-intersect';
import { isPolygonsIntersect } from '@antv/path-util';
import { ComponentOption, IInteractionContext, LooseObject } from '../../interface';

function getMaskBBox(context: IInteractionContext, tolerance: number) {
Expand Down
2 changes: 1 addition & 1 deletion src/interaction/action/view/button.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LooseObject } from '@antv/component/lib/types';
import { LooseObject } from '../../../interface';
import { IGroup } from '@antv/g-base';
import { ext } from '@antv/matrix-util';
import { deepMix } from '@antv/util';
Expand Down
2 changes: 1 addition & 1 deletion src/theme/util/create-by-style-sheet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as TOOLTIP_CSS_CONST from '@antv/component/lib/tooltip/css-const';
import { TOOLTIP_CSS_CONST } from '@antv/component';
import { ext } from '@antv/matrix-util';
import { deepMix } from '@antv/util';
import Element from '../../geometry/element';
Expand Down
2 changes: 1 addition & 1 deletion tests/bugs/2173-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ describe('#2173', () => {

it('legend should not be overlap', () => {
const [l1, l2] = chart.getComponents().filter((co) => co.type === COMPONENT_TYPE.LEGEND);
expect(Math.abs(l1.component.getBBox().y - l2.component.getBBox().y)).toBe(13);
expect(Math.abs(l1.component.getBBox().y - l2.component.getBBox().y)).toBe(14);
});
});
2 changes: 1 addition & 1 deletion tests/unit/component/axis-circle-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Component', () => {

const grids = chart.getComponents().filter((co) => co.type === COMPONENT_TYPE.GRID);
// circle grid 需要传入 coordinate 的 center
expect(grids[0].component.get('center')).toEqual({ x: 400, y: 285.5 });
expect(grids[0].component.get('center')).toEqual({ x: 400, y: 285 });
});

it('linear x axis ticks', () => {
Expand Down