Skip to content

refactor layout with build-in and update layout API - #75

Merged
hustcc merged 6 commits into
masterfrom
refactor-layout
Nov 30, 2026
Merged

hustcc merged 6 commits into
masterfrom
refactor-layout

Conversation

@hustcc

@hustcc hustcc commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

改动

  • 内置布局仅保留 force、force-atlas2、d3-force、fruchterman。
  • 其他布局统一从 @antv/layout 导入布局类传入,无需注册。
  • 删除 G6Lite 全部布局封装和 @antv/g6-lite/layouts/* 子入口。
  • 升级 @antv/layout 到 2.1.0。

使用方式

内置布局:

layout: { type: 'force' }

外置布局:

import { DagreLayout } from '@antv/layout';
layout: { type: DagreLayout, rankdir: 'LR' }

包大小

  • UMD:171.7 KB → 118.5 KB gzip(-31%)

#74)

* feat(layout): bundle only force-directed layouts and support custom layout classes

- Bundle only force, force-atlas2, d3-force, and fruchterman by default
- Allow passing @antv/layout classes directly as layout.type
- Run custom layout classes on the main thread; keep Worker for built-in names
- Update docs, demos, and tests to use the new layout API
- Reduce UMD gzip size from 171.7 KB to 118.6 KB

* fix(layout): align LayoutInstance with @antv/layout node types

- Allow string | number node ids and optional forEachNode index
- Remove unnecessary type assertions for built-in layouts
- Use built-in force layout in README examples

* refactor(layout): remove layout wrappers and import classes from @antv/layout

- Upgrade @antv/layout to 2.1.0-beta.1
- Remove all custom layout implementations and optional subpath entries
- Import layout classes directly from @antv/layout in docs and demos
- Remove g6-lite-layouts.min.js build and registration requirements
- Delete obsolete tests for removed layout functions

* docs: update package size measurements after layout cleanup

- Remove hardcoded byte counts from README badge descriptions
- Update performance docs with current UMD and ESM sizes

* docs: use versionless CDN URLs for automatic latest version resolution

* docs: simplify package size section to UMD minified and gzip sizes

* docs: update homepage UMD size measurement to 118.2 kB
@hustcc

hustcc commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

官网,文档人工验证一下,如果还有问题,pr 提交到 refactor-layout 分支,确认没问题后再合并本分支。

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

✅ Preview is ready!

PR preview ✅ Ready ✅ Ready
🔗 Preview https://antvis-G6Lite-preview-pr-75.surge.sh
📝 Commit1a9c508
⏱️ Build time0.008s
📦 Size203.8 MB (+37.5 KB ⬆️) · 4927 files
🪵 LogsView logs
📱 MobileScan to open preview on mobile

↩️ Previous: ⚡️ 1a9c508 · antvis-G6Lite-preview-pr-75.surge.sh (open ↗) · 2026-11-30 11:31:46 UTC

🤖 Powered by surge-preview

@hustcc hustcc changed the title WIP refactor layout with build-in and update layout API refactor layout with build-in and update layout API Nov 30, 2026
@hustcc
hustcc merged commit 56d3ed9 into master Nov 30, 2026
3 checks passed
@hustcc
hustcc deleted the refactor-layout branch November 30, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants