Skip to content

Commit

Permalink
feat: 接入g-lite && 去掉jsx (#1614)
Browse files Browse the repository at this point in the history
  • Loading branch information
tangying1027 committed Oct 13, 2022
1 parent 950b65c commit 9232d8e
Show file tree
Hide file tree
Showing 79 changed files with 89 additions and 905 deletions.
9 changes: 5 additions & 4 deletions packages/f2/.fatherrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ export default process.env.CI
file: 'index',
minFile: true,
},
entry: ['src/index.ts', 'src/jsx/jsx-runtime.ts'],
// entry: ['src/index.ts', 'src/jsx/jsx-runtime.ts'],
entry: ['src/index.ts'],
overridesByEntry: {
'src/index.ts': {
umd: { name: 'F2', file: 'index' },
},
// for weixin miniapp
'src/jsx/jsx-runtime.ts': {
umd: { name: 'F2JSXRuntime', file: 'jsx-runtime' },
},
// 'src/jsx/jsx-runtime.ts': {
// umd: { name: 'F2JSXRuntime', file: 'jsx-runtime' },
// },
},
extraRollupPlugins: [...(isBundleVis ? [visualizer()] : [])],
};
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@antv/event-emitter": "^0.1.2",
"@antv/f-engine": "~0.0.2",
"@antv/scale": "~0.3.3",
"@antv/util": "~2.0.6",
"@antv/util": "~3.3.0",
"@babel/runtime": "^7.12.5",
"d3-cloud": "~1.2.5"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/f2/src/canvas.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/f2/src/chart/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { JSX } from '../jsx/jsx-namespace';
import { JSX } from '../index';
import { ScaleConfig } from '@antv/scale';
import { each, findIndex, isArray } from '@antv/util';
import equal from '../base/equal';
import { Layout, Component } from '../index';
import Coord from '../coord';
import Children from '../children';
import { Children } from '../index';
// types
import LayoutController from '../controller/layout';
import CoordController from '../controller/coord';
Expand Down
111 changes: 0 additions & 111 deletions packages/f2/src/children.ts

This file was deleted.

6 changes: 2 additions & 4 deletions packages/f2/src/components/area/areaView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export default (props) => {
type: 'sector',
property: ['endAngle'],
attrs: {
x: center.x,
y: center.y,
x: center.x - left,
y: center.y - top,
startAngle,
r: radius,
},
Expand All @@ -35,8 +35,6 @@ export default (props) => {
type: 'rect',
property: ['width'],
attrs: {
x: left,
y: top,
height: height,
},
start: {
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/axis/axisView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../jsx';
import { jsx } from '../../index';
import PolarX from './polar/polar-x';
import PolarY from './polar/polar-y';
import Top from './rect/top';
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/axis/polar/polar-x.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { length as vec2Length } from 'gl-matrix/vec2';
import type { vec2 } from 'gl-matrix';
import { PolarProps } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/axis/polar/polar-y.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { length as vec2Length } from 'gl-matrix/vec2';
import { PolarProps } from '../types';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/axis/rect/bottom.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { RectProps } from '../types';
import { TextAttrs } from '../../../types';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/axis/rect/left.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { RectProps } from '../types';

export default (props: RectProps) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/axis/rect/right.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { RectProps } from '../types';

export default (props: RectProps) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/axis/rect/top.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { RectProps } from '../types';

export default (props: RectProps) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/axis/withAxis.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deepMix, isFunction, mix, each, clone, isString, isNumber } from '@antv/util';
import { jsx } from '../../jsx';
import { jsx } from '../../index';
import equal from '../../base/equal';
import { PositionLayout } from '../../chart/index';
import { Component } from '@antv/f-engine';
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/gauge/withGauge.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../jsx';
import { jsx } from '../../index';
import { Component } from '@antv/f-engine';

const getPoint = (cener, angle, r) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/guide/views/Arc.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { deepMix } from '@antv/util';
import { Style } from '../../../types';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/guide/views/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { Style } from '../../../types';
import { deepMix } from '@antv/util';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/guide/views/Line.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { isArray, deepMix } from '@antv/util';
import { Style } from '../../../types';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/guide/views/Point.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { deepMix } from '@antv/util';
import { Style } from '../../../types';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/guide/views/Rect.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { deepMix } from '@antv/util';
import { Style } from '../../../types';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/guide/views/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { deepMix } from '@antv/util';
import { Style } from '../../../types';

Expand Down
4 changes: 2 additions & 2 deletions packages/f2/src/components/guide/withGuide.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../jsx';
import { jsx } from '../../index';
import { Component } from '@antv/f-engine';
import { isString, isNil, isFunction } from '@antv/util';
import { Ref } from '../../types';
Expand Down Expand Up @@ -48,7 +48,7 @@ export default (View) => {
super.didUpdate();
const shape = this.triggerRef.current;
if (!shape || shape.destroyed) return;
const { x, y, width, height } = shape.get('attrs');
const { x, y, width, height } = shape.getBBox();
const bbox = {
minX: x,
minY: y,
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/interval/label/polygonLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isFunction, mix } from '@antv/util';
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { getMiddlePoint } from '../../../util/coord';

const DEFAULT_LABEL_CFG = {
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/interval/view/intervalView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import Rect from './rect';
import Polar from './polar';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/interval/view/polar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { deepMix } from '@antv/util';

export default (props) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/interval/view/polygonView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';
import { getMiddlePoint } from '../../../util/coord';
import { convertToPoints } from '../util';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/interval/view/rect.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deepMix } from '@antv/util';
import { jsx } from '../../../jsx';
import { jsx } from '../../../index';

export default (props) => {
const { records, animation, y0, clip } = props;
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/legend/legendView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isFunction } from '@antv/util';
import { jsx } from '../../jsx';
import { jsx } from '../../index';

const Marker = ({ type, color }) => {
if (type === 'square') {
Expand Down
6 changes: 3 additions & 3 deletions packages/f2/src/components/legend/withLegend.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../jsx';
import { jsx } from '../../index';
import { Component, renderShape } from '@antv/f-engine';
import Chart from '../../chart';
import { find, isFunction } from '@antv/util';
Expand Down Expand Up @@ -119,7 +119,7 @@ export default (View) => {
getMaxItemBox(legendShape) {
let maxItemWidth = 0;
let maxItemHeight = 0;
(legendShape.getChildren() || []).forEach((child) => {
(legendShape.children || []).forEach((child) => {
const width = child.getAttribute('width');
const height = child.getAttribute('height');

Expand Down Expand Up @@ -264,7 +264,7 @@ export default (View) => {
return;
}
// @ts-ignore
const dataItem = clickItem.get('data-item');
const dataItem = clickItem.config['data-item'];
if (!dataItem) {
return;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/f2/src/components/line/lineView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deepMix, isArray } from '@antv/util';
import { jsx } from '../../jsx';
import { jsx } from '../../index';
import { LineViewProps } from './types';

function concatPoints(children) {
Expand Down Expand Up @@ -55,7 +55,7 @@ function AnimationEndView(props) {
onFrame: function(t) {
// 这段逻辑有点恶心。。
const { element } = this;
const children = element.getChildren();
const children = element.children;
const point = getPoint(points, t);
children.forEach((child) => {
child.moveTo(point.x, point.y);
Expand All @@ -82,8 +82,8 @@ export default (props: LineViewProps) => {
type: 'sector',
property: ['endAngle'],
attrs: {
x: center.x,
y: center.y,
x: center.x - left,
y: center.y - top,
startAngle,
r: radius,
},
Expand All @@ -102,8 +102,8 @@ export default (props: LineViewProps) => {
type: 'rect',
property: ['width'],
attrs: {
x: left,
y: top,
// x: left,
// y: top,
height: height,
},
start: {
Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/line/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSX } from '../../jsx/jsx-namespace';
import { JSX } from '../../index';
import { GeometryProps, AdjustConfig } from '../geometry/interface';
import Coord from '../../coord';

Expand Down
2 changes: 1 addition & 1 deletion packages/f2/src/components/line/withLine.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jsx } from '../../jsx';
import { jsx } from '../../index';
import { isArray } from '@antv/util';
import Geometry from '../geometry';
import { LineProps } from './types';
Expand Down
Loading

0 comments on commit 9232d8e

Please sign in to comment.