Skip to content

Commit 695c93a

Browse files
Release (#2108)
* refactor: sub-package governance (#2094) * refactor: sub-package governance * refactor: type error * refactor: merge @antv/g-plugin-canvas-path-generator into @antv/g-canvas * chore: remove legacy code * chore: fix build error * refactor: merge @antv/g-plugin-canvas-picker into @antv/g-canvas * refactor: merge @antv/g-plugin-image-loader into @antv/g-lite * refactor: merge @antv/g-plugin-html-renderer into @antv/g-lite * refactor: merge @antv/g-plugin-dom-interaction into @antv/g-lite * refactor: merge @antv/g-plugin-canvas-renderer into @antv/g-canvas * refactor: merge @antv/g-plugin-svg-picker into @antv/g-svg * refactor: merge @antv/g-plugin-svg-renderer into @antv/g-svg * refactor: merge @antv/g-plugin-mobile-interaction into @antv/g-lite * refactor: remove package @antv/g-layout-blocklike * refactor: remove package @antv/g-css-typed-om-api * refactor: remove package @antv/g-css-layout-api * refactor: merge @antv/g-plugin-canvaskit-renderer into @antv/g-canvaskit * refactor: merge @antv/g-image-exporter into @antv/g * refactor: merge @antv/g-mobile-canvas-element into @antv/g-mobile-canvas * refactor: remove package @antv/g-gesture * refactor: merge @antv/g-pattern into @antv/g * refactor: merge @antv/g-components into @antv/g * chore: update docs * chore: add changeset * chore(release): bump version (#2106) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 64651e7 commit 695c93a

437 files changed

Lines changed: 1049 additions & 20098 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
1-
# 构建产物
1+
# build
22
dist/
33
build/
44
lib/
55
esm/
66
coverage/
77
types/
88

9-
# 依赖目录
9+
# dependencies
1010
node_modules/
1111

12-
# 配置文件
12+
# configs
1313
.commitlintrc.cjs
1414
.eslintrc.cjs
1515
.lintstagedrc.mjs
1616
babel.config.mjs
1717
rollup.config.mjs
1818
vite.config.mjs
19+
vite.config.js
1920
jest.unit.config.js
2021
jest.visual.config.js
2122

22-
# 大型包目录(可选择性排除)
23+
# large packages
2324
packages/g-devtool/
2425
packages/g-webgpu-compiler/
2526
packages/site/
2627

27-
# 测试文件
28+
# tests
2829
__tests__/
2930
scripts/
3031

31-
# 其他
32+
# docs
33+
site/
34+
35+
# others
3236
*.min.js
33-
gui.min.js
37+
gui.min.js

README-zh_CN.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@
3131
- [webgpu-graph](https://g-next.antv.vision/zh/docs/api/gpgpu/webgpu-graph) 使用 GPU 加速的图分析算法库
3232
- 可扩展的插件机制以及丰富的插件集:
3333
- 渲染相关
34-
- [g-plugin-canvas-renderer](https://g-next.antv.vision/zh/docs/plugins/canvas-renderer) 基于 Canvas2D 渲染 2D 图形
35-
- [g-plugin-svg-renderer](https://g-next.antv.vision/zh/docs/plugins/svg-renderer) 基于 SVG 渲染 2D 图形
36-
- [g-plugin-device-renderer](https://g-next.antv.vision/zh/docs/plugins/device-renderer) 基于 GPUDevice 渲染 2D 图形
37-
- [g-plugin-html-renderer](https://g-next.antv.vision/zh/docs/plugins/html-renderer) 渲染 DOM 元素
34+
- [canvas-renderer](https://g-next.antv.vision/zh/docs/plugins/canvas-renderer) 基于 Canvas2D 渲染 2D 图形
35+
- [svg-renderer](https://g-next.antv.vision/zh/docs/plugins/svg-renderer) 基于 SVG 渲染 2D 图形
36+
- [device-renderer](https://g-next.antv.vision/zh/docs/plugins/device-renderer) 基于 GPUDevice 渲染 2D 图形
37+
- [html-renderer](https://g-next.antv.vision/zh/docs/plugins/html-renderer) 渲染 DOM 元素
3838
- [g-plugin-3d](https://g-next.antv.vision/zh/docs/plugins/3d) 基于 g-plugin-device-renderer 扩展 3D 能力
3939
- [g-plugin-rough-canvas-renderer](https://g-next.antv.vision/zh/docs/plugins/rough-canvas-renderer) 使用 [rough.js](https://roughjs.com/) 和 Canvs2D 进行手绘风格渲染
4040
- [g-plugin-rough-svg-renderer](https://g-next.antv.vision/zh/docs/plugins/rough-svg-renderer) 使用 [rough.js](https://roughjs.com/) 和 SVG 进行手绘风格渲染
41-
- [g-plugin-canvaskit-renderer](https://g-next.antv.vision/zh/docs/plugins/canvaskit-renderer) 基于 [Skia](https://skia.org/docs/user/modules/quickstart) 渲染 2D 图形
41+
- [canvaskit-renderer](https://g-next.antv.vision/zh/docs/plugins/canvaskit-renderer) 基于 [Skia](https://skia.org/docs/user/modules/quickstart) 渲染 2D 图形
4242
- 拾取
43-
- [g-plugin-canvas-picker](https://g-next.antv.vision/zh/docs/plugins/canvas-picker) 基于 Canvas2D
44-
- [g-plugin-svg-picker](https://g-next.antv.vision/zh/docs/plugins/svg-picker) 基于 SVG
43+
- [canvas-picker](https://g-next.antv.vision/zh/docs/plugins/canvas-picker) 基于 Canvas2D
44+
- [svg-picker](https://g-next.antv.vision/zh/docs/plugins/svg-picker) 基于 SVG
4545
- 交互
46-
- [g-plugin-dom-interaction](https://g-next.antv.vision/zh/docs/plugins/dom-interaction) 基于 DOM API 绑定事件
46+
- [dom-interaction](https://g-next.antv.vision/zh/docs/plugins/dom-interaction) 基于 DOM API 绑定事件
4747
- [g-plugin-control](https://g-next.antv.vision/zh/docs/plugins/control) 为 3D 场景提供相机交互
4848
- [g-plugin-dragndrop](https://g-next.antv.vision/en/docs/plugins/dragndrop) 基于 PointerEvents 提供 Drag 'n' Drop
4949
- 物理引擎

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ As the underlying rendering engine of AntV, G is dedicated to provide consistent
3434
Extensible plug-in mechanism and rich set of plug-ins:
3535

3636
- Rendering Related
37-
- [g-plugin-canvas-renderer](https://g-next.antv.vision/en/docs/plugins/canvas-renderer) Rendering 2D graphics based on Canvas2D.
38-
- [g-plugin-svg-renderer](https://g-next.antv.vision/en/docs/plugins/svg-renderer) Rendering 2D graphics based on SVG.
37+
- [canvas-renderer](https://g-next.antv.vision/en/docs/plugins/canvas-renderer) Rendering 2D graphics based on Canvas2D.
38+
- [svg-renderer](https://g-next.antv.vision/en/docs/plugins/svg-renderer) Rendering 2D graphics based on SVG.
3939
- [g-plugin-device-renderer](https://g-next.antv.vision/en/docs/plugins/device-renderer) Rendering 2D graphics based on GPUDevice.
40-
- [g-plugin-html-renderer](https://g-next.antv.vision/en/docs/plugins/html-renderer) Rendering DOM with HTML.
40+
- [html-renderer](https://g-next.antv.vision/en/docs/plugins/html-renderer) Rendering DOM with HTML.
4141
- [g-plugin-3d](https://g-next.antv.vision/en/docs/plugins/3d) Extended 3D capabilities.
4242
- [g-plugin-rough-canvas-renderer](https://g-next.antv.vision/en/docs/plugins/rough-canvas-renderer) Perform hand-drawn style rendering with [rough.js](https://roughjs.com/) and Canvs2D.
4343
- [g-plugin-rough-svg-renderer](https://g-next.antv.vision/en/docs/plugins/rough-svg-renderer) Perform hand-drawn style rendering with [rough.js](https://roughjs.com/) and SVG.
44-
- [g-plugin-canvaskit-renderer](https://g-next.antv.vision/en/docs/plugins/canvaskit-renderer) Rendering 2D graphics based on [Skia](https://skia.org/docs/user/modules/quickstart).
44+
- [canvaskit-renderer](https://g-next.antv.vision/en/docs/plugins/canvaskit-renderer) Rendering 2D graphics based on [Skia](https://skia.org/docs/user/modules/quickstart).
4545
- Picking
46-
- [g-plugin-canvas-picker](https://g-next.antv.vision/en/docs/plugins/canvas-picker) Do picking with Canvas2D and mathematical calculations.
47-
- [g-plugin-svg-picker](https://g-next.antv.vision/en/docs/plugins/svg-picker) Do picking with SVG and DOM API.
46+
- [canvas-picker](https://g-next.antv.vision/en/docs/plugins/canvas-picker) Do picking with Canvas2D and mathematical calculations.
47+
- [svg-picker](https://g-next.antv.vision/en/docs/plugins/svg-picker) Do picking with SVG and DOM API.
4848
- Interaction
49-
- [g-plugin-dom-interaction](https://g-next.antv.vision/en/docs/plugins/dom-interaction) Binds event listeners with DOM API.
49+
- [dom-interaction](https://g-next.antv.vision/en/docs/plugins/dom-interaction) Binds event listeners with DOM API.
5050
- [g-plugin-control](https://g-next.antv.vision/en/docs/plugins/control) Provides camera interaction for 3D scenes.
5151
- [g-plugin-dragndrop](https://g-next.antv.vision/en/docs/plugins/dragndrop) Provides Drag 'n' Drop based on PointerEvents.
5252
- Physics Engine

__tests__/demos/2d/clippath.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Circle, Rect, Path, Group } from '@antv/g';
2-
import { Sector } from '@antv/g-components';
1+
import { Circle, Rect, Path, Group, Sector } from '@antv/g';
32

43
export async function clipPath(context) {
54
const { canvas } = context;

__tests__/demos/2d/custom-element.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Path, Polyline, Line } from '@antv/g';
2-
import { Arrow } from '@antv/g-components';
1+
import { Path, Polyline, Line, Arrow } from '@antv/g';
32

43
export async function customElement(context) {
54
const { canvas } = context;

__tests__/demos/2d/pattern2.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Circle, Rect } from '@antv/g';
2-
import { dots, lines } from '@antv/g-pattern';
1+
import { Circle, Rect, dots, lines } from '@antv/g';
32
import * as d3 from 'd3';
43

54
export async function pattern2(context) {

__tests__/demos/plugin/exporter.ts

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as d3 from 'd3';
2-
import { HTML, Rectangle } from '@antv/g';
3-
import { ImageExporter } from '@antv/g-image-exporter';
2+
import { HTML, Rectangle, ImageExporter } from '@antv/g';
43

54
export async function exporter(context) {
65
const { canvas, gui } = context;
@@ -13,7 +12,9 @@ export async function exporter(context) {
1312

1413
const drawBars = async () => {
1514
// 1. Access data
16-
const dataset = await d3.json('https://gw.alipayobjects.com/os/bmw-prod/8e7cfeb6-28e5-4e78-8d16-c08468360f5f.json');
15+
const dataset = await d3.json(
16+
'https://gw.alipayobjects.com/os/bmw-prod/8e7cfeb6-28e5-4e78-8d16-c08468360f5f.json',
17+
);
1718
const metricAccessor = (d) => d.humidity;
1819
const yAccessor = (d) => d.length;
1920

@@ -31,8 +32,10 @@ export async function exporter(context) {
3132
boundedWidth: 0,
3233
boundedHeight: 0,
3334
};
34-
dimensions.boundedWidth = dimensions.width - dimensions.margin.left - dimensions.margin.right;
35-
dimensions.boundedHeight = dimensions.height - dimensions.margin.top - dimensions.margin.bottom;
35+
dimensions.boundedWidth =
36+
dimensions.width - dimensions.margin.left - dimensions.margin.right;
37+
dimensions.boundedHeight =
38+
dimensions.height - dimensions.margin.top - dimensions.margin.bottom;
3639

3740
// 3. Draw canvas
3841
const wrapper = d3.select(
@@ -41,7 +44,10 @@ export async function exporter(context) {
4144

4245
const bounds = wrapper
4346
.append('g')
44-
.style('transform', `translate(${dimensions.margin.left}px, ${dimensions.margin.top}px)`);
47+
.style(
48+
'transform',
49+
`translate(${dimensions.margin.left}px, ${dimensions.margin.top}px)`,
50+
);
4551

4652
// 4. Create scales
4753

@@ -51,7 +57,11 @@ export async function exporter(context) {
5157
.range([0, dimensions.boundedWidth])
5258
.nice();
5359

54-
const binsGenerator = d3.bin().domain(xScale.domain()).value(metricAccessor).thresholds(12);
60+
const binsGenerator = d3
61+
.bin()
62+
.domain(xScale.domain())
63+
.value(metricAccessor)
64+
.thresholds(12);
5565

5666
const bins = binsGenerator(dataset);
5767

@@ -63,14 +73,20 @@ export async function exporter(context) {
6373

6474
// 5. Draw data
6575
const binsGroup = bounds.append('g');
66-
const binGroups = binsGroup.selectAll('g').data(bins).join('g').attr('class', 'bin');
76+
const binGroups = binsGroup
77+
.selectAll('g')
78+
.data(bins)
79+
.join('g')
80+
.attr('class', 'bin');
6781

6882
const barPadding = 1;
6983
const barRects = binGroups
7084
.append('rect')
7185
.attr('x', (d) => xScale(d.x0) + barPadding / 2)
7286
.attr('y', (d) => yScale(yAccessor(d)))
73-
.attr('width', (d) => d3.max([0, xScale(d.x1) - xScale(d.x0) - barPadding]))
87+
.attr('width', (d) =>
88+
d3.max([0, xScale(d.x1) - xScale(d.x0) - barPadding]),
89+
)
7490
.attr('height', (d) => dimensions.boundedHeight - yScale(yAccessor(d)))
7591
.attr('fill', 'cornflowerblue')
7692
.on('mouseenter', function (e) {
@@ -174,7 +190,12 @@ export async function exporter(context) {
174190
ignoreElements: (element) => {
175191
return [gui.domElement].indexOf(element) > -1;
176192
},
177-
clippingRegion: new Rectangle(clippingRegionX, clippingRegionY, clippingRegionWidth, clippingRegionHeight),
193+
clippingRegion: new Rectangle(
194+
clippingRegionX,
195+
clippingRegionY,
196+
clippingRegionWidth,
197+
clippingRegionHeight,
198+
),
178199
beforeDrawImage: (context) => {
179200
if (enableBackgroundColor) {
180201
context.fillStyle = backgroundColor;
@@ -207,7 +228,12 @@ export async function exporter(context) {
207228
ignoreElements: (element) => {
208229
return [gui.domElement].indexOf(element) > -1;
209230
},
210-
clippingRegion: new Rectangle(clippingRegionX, clippingRegionY, clippingRegionWidth, clippingRegionHeight),
231+
clippingRegion: new Rectangle(
232+
clippingRegionX,
233+
clippingRegionY,
234+
clippingRegionWidth,
235+
clippingRegionHeight,
236+
),
211237
beforeDrawImage: (context) => {
212238
if (enableBackgroundColor) {
213239
context.fillStyle = backgroundColor;
@@ -255,7 +281,12 @@ export async function exporter(context) {
255281
exporterFolder.add(exporterConfig, 'enableBackgroundColor');
256282
exporterFolder.addColor(exporterConfig, 'backgroundColor');
257283
exporterFolder.add(exporterConfig, 'enableWatermark');
258-
exporterFolder.add(exporterConfig, 'type', ['image/png', 'image/jpeg', 'image/webp', 'image/bmp']);
284+
exporterFolder.add(exporterConfig, 'type', [
285+
'image/png',
286+
'image/jpeg',
287+
'image/webp',
288+
'image/bmp',
289+
]);
259290
exporterFolder.add(exporterConfig, 'encoderOptions', 0, 1);
260291
exporterFolder.add(exporterConfig, 'toDataURL');
261292
exporterFolder.add(exporterConfig, 'downloadImage');

__tests__/demos/plugin/html-renderer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { HTML } from '@antv/g';
2-
import { Plugin as HTMLRenderingPlugin } from '@antv/g-plugin-html-renderer';
1+
import { HTML, HTMLRenderer } from '@antv/g';
32
import { ExampleLayoutManager } from '../_helper/example-layout-manager';
43

54
export async function htmlRenderer(context) {
65
const { canvas, renderer } = context;
76

8-
renderer.registerPlugin(new HTMLRenderingPlugin());
7+
renderer.registerPlugin(new HTMLRenderer.Plugin());
98

109
await canvas.ready;
1110

__tests__/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Stats from 'stats.js';
22
import * as lil from 'lil-gui';
3-
import '@antv/g-camera-api';
43
import { Canvas, CanvasEvent, runtime } from '@antv/g';
54
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
65
import { Renderer as CanvaskitRenderer } from '@antv/g-canvaskit';

0 commit comments

Comments
 (0)