Compare commits

...

55 Commits

Author SHA1 Message Date
f901d2c149 chore(release): @antv/x6-react-components@2.0.1 [skip ci] 2022-11-24 04:22:09 +00:00
da99354379 chore(release): @antv/x6-plugin-transform@2.1.0 [skip ci] 2022-11-24 04:22:06 +00:00
28111565fa chore(release): @antv/x6-plugin-stencil@2.0.1 [skip ci] 2022-11-24 04:22:03 +00:00
85308db9a0 chore(release): @antv/x6-plugin-snapline@2.1.0 [skip ci] 2022-11-24 04:22:01 +00:00
b58ced43f6 chore(release): @antv/x6-plugin-selection@2.1.0 [skip ci] 2022-11-24 04:21:58 +00:00
9b6c5420aa chore(release): @antv/x6-plugin-scroller@2.0.1 [skip ci] 2022-11-24 04:21:55 +00:00
6fc0344552 chore(release): @antv/x6-plugin-minimap@2.0.1 [skip ci] 2022-11-24 04:21:53 +00:00
86fed91719 chore(release): @antv/x6-plugin-keyboard@2.1.0 [skip ci] 2022-11-24 04:21:50 +00:00
2ceee7d067 chore(release): @antv/x6-plugin-history@2.1.0 [skip ci] 2022-11-24 04:21:48 +00:00
a4a1b37413 chore(release): @antv/x6-plugin-export@2.1.0 [skip ci] 2022-11-24 04:21:45 +00:00
14acda8f4b chore(release): @antv/x6-plugin-dnd@2.0.1 [skip ci] 2022-11-24 04:21:42 +00:00
8af0f1c676 chore(release): @antv/x6-plugin-clipboard@2.1.0 [skip ci] 2022-11-24 04:21:40 +00:00
58853d9ac2 chore(release): @antv/x6-common@2.0.1 [skip ci] 2022-11-24 04:21:37 +00:00
7551e782c1 chore(release): @antv/x6@2.0.1 [skip ci] 2022-11-24 04:21:34 +00:00
662f138fca chore(release): @antv/x6-geometry@2.0.1 [skip ci] 2022-11-24 04:21:32 +00:00
f6001a4619 docs: add performance demos () 2022-11-24 12:12:05 +08:00
e0e7e2d80f fix: input required and not supplied: GITHUB_TOKEN 2022-11-23 14:13:03 +08:00
8d19fbc868 chore: use wow-actions/use-app-token v2 2022-11-23 13:58:53 +08:00
5cd3809859 fix: add execute permission 2022-11-23 13:53:38 +08:00
847f225632 feat: add exportSVG methods () 2022-11-18 15:50:10 +08:00
826ccdd9a0 fix: export snap methods from snapline () 2022-11-18 13:47:06 +08:00
cee4aa4e53 fix: resize graph when scale scroller () 2022-11-18 10:31:02 +08:00
4c87e47847 docs: update demos for plugins () 2022-11-18 09:51:16 +08:00
f2be4b3570 chore: update CONTRIBUTORS [skip ci] 2022-11-17 02:29:54 +00:00
febf71b6a6 docs: optimize demos for plugins () 2022-11-17 10:23:06 +08:00
9eae1a304f chore: update CONTRIBUTORS [skip ci] 2022-11-15 13:10:00 +00:00
7526379684 chore: update contributors [skip ci] 2022-11-15 13:02:12 +00:00
ee4ed4053f docs: function 'addCells()' is undefined. () () 2022-11-15 21:01:53 +08:00
047692f4f8 chore: update contributors [skip ci] 2022-11-15 13:01:34 +00:00
53a3f63aca docs: add demos for websites ()
* docs: add interacting demo

* docs: add serialization demo

* docs: add tools demo

* docs: add html render demo

* docs: add demos for react render

* docs: add demo for vue node
2022-11-15 21:01:11 +08:00
853b35fbfb docs: update docs ()
* docs: add get-started demo

* docs: add docs for graph

* docs: add docs for node

* docs: add docs for edge

* docs: update demos

* docs: update docs directory
2022-11-14 09:46:44 +08:00
bb9e560fd5 chore: updae deps for demos () 2022-11-12 15:52:08 +08:00
86412e23d2 fix: optimize typo for react-shape () 2022-11-12 11:44:25 +08:00
1f1e5bc8b2 chore: update deps version for demos () 2022-11-11 09:42:46 +08:00
774f547b85 feat: attach plugin api and events to grpah instance ()
* feat: attach api and event to graph for clipboard

* feat: attach export api and event to graph instance

* feat: attach history api and event to graph instance

* feat: attach keyboard api to graph instance

* feat: attach selection api and events to graph instance

* feat: attach snapline api and events to graph instance

* feat: attach transform events to graph instance
2022-11-10 20:24:27 +08:00
2194769e36 fix: sync render when change position () 2022-11-09 16:21:16 +08:00
e68315528a fix: add missing script for building style 2022-11-09 14:52:56 +08:00
6e7fa9d602 chore: config rss 2022-11-09 14:11:05 +08:00
1f42ecda5e chore: forbidden push to master with whitelist 2022-11-09 14:10:18 +08:00
b450a467ce chore: update build cache 2022-11-09 13:58:03 +08:00
189352a09c chore: update devdeps 2022-11-08 17:01:54 +08:00
4f3e589988 refactor: put rss scripts into root package.json 2022-11-08 17:01:53 +08:00
b59ff6916c refactor: remove unused methods 2022-11-08 17:01:53 +08:00
30c6a522f5 chore: update CONTRIBUTORS [skip ci] 2022-11-08 05:03:56 +00:00
4edee83946 chore: update contributors [skip ci] 2022-11-08 04:56:22 +00:00
10347d069b fix: Cannot use "this" here: () 2022-11-08 12:56:04 +08:00
d9d68d182e chore: remove unused util methdos 2022-11-07 17:50:19 +08:00
3ef671c223 refactor: remove unused methods 2022-11-07 12:00:16 +08:00
45185ed50a docs: fix url of embeded CONTRIBUTORS.svg 2022-11-07 11:59:40 +08:00
5295ecc957 chore: update commit message of update contributor 2022-11-07 10:00:02 +08:00
ea92193494 chore: let's start v2
clean changelogs
2022-11-07 09:33:09 +08:00
8806adc673 docs: sync doc from v1.0 () 2022-11-05 21:30:56 +08:00
09e8dfda8b chore(release): @antv/x6-vue-shape@2.0.0 [skip ci] 2022-11-05 13:25:25 +00:00
1283b74cdb chore: update deps
bump  packages/x6-vue-shape to 2.0

BREAKING CHANGE: for bump  packages/x6-vue-shape to 2.0
2022-11-05 21:18:15 +08:00
c075db4822 chore(release): @antv/x6-vue-shape@1.1.0 [skip ci] 2022-11-05 12:47:24 +00:00
1051 changed files with 8495 additions and 20864 deletions
.github/workflows
.husky
CONTRIBUTORSCONTRIBUTORS.svgREADME.md
examples/x6-example-features/src/pages/scroller
package.json
packages
pnpm-lock.yaml
scripts
sites
x6-sites-demos-helper
x6-sites-demos
package.json
packages
api
graph
registry
attr
text-anchor
text-wrap
x-align
background
connection-point/playground
connector
edge-anchor/playground
edge-tool
anchor
arrowhead
boundary
button-remove
button
custom-arrowhead
custom-vertices
segments
vertices
filter
blur
brightness
contrast
drop-shadow
gray-scale
highlight
hue-rotate
invert
outline
saturate
sepia
grid
node-anchor/playground
node-tool
boundary
button-remove
button
custom-button
editor
port-label-layout
inside-outside
radial
side
port-layout
router
ui
auto-scrollbox/basic
color-picker/basic
contextmenu/basic
dropdown/basic
menu/basic
menubar/basic
scrollbox/basic
splitbox/basic
toolbar/basic
performance
scene/sankey
tutorial
advanced
basic
background/playground/src
dnd/stencil/src
edge
connector
custom-marker
labels/src
native-marker
router
style/src
vertices
events/custom-click
graph
grid/playground/src
group
embed-edge/src
embedding
inside
outside
restrict/src
interacting
mousewheel/playground
node
port
scroller/playground
selection/playground
serialization
snapline/playground
getting-started
intermediate
attrs
connection-point/multi
custom-edge/custom-edge
custom-node/custom-node
edge-labels
events
group
html
interacting
marker
react
serialization
tools
vue
plugins
x6-sites
x6-svg-to-shape
turbo.json

@ -8,13 +8,12 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/auto-close-fixed-issues@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
comment: |
This issue was closed by #{{ pr }}.

@ -4,11 +4,10 @@ jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}

@ -8,12 +8,12 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/auto-assign@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
CONFIG_FILE: .github/workflows/config/auto-assign.yml

@ -6,14 +6,14 @@ name: 🚫 Delete Stale Releases
# clean:
# runs-on: ubuntu-latest
# steps:
# - uses: wow-actions/use-app-token@v1
# - uses: wow-actions/use-app-token@v2
# with:
# app_id: ${{ secrets.APP_ID }}
# private_key: ${{ secrets.PRIVATE_KEY }}
# env_name: bot_token
#
# - uses: wow-actions/delete-stale-releases@v1
# with:
# GITHUB_TOKEN: ${{ env.bot_token }}
# GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
# delete_tags: true
# keep_latest_count: 3
# group: '(?!^)@.*$'
@ -36,13 +36,13 @@ jobs:
clean:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/delete-stale-releases@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
delete_tags: true
keep_latest_count: -1
keep_latest_count: -1

@ -56,11 +56,11 @@ jobs:
run: pnpm run test
- name: 🔑 Generate Token
uses: wow-actions/use-app-token@v1
uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- name: 💡 Codecov
uses: codecov/codecov-action@v1
@ -72,20 +72,20 @@ jobs:
- name: 🔀 Dispatch(ci_passed)
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ env.bot_token }}
token: ${{ env.BOT_TOKEN }}
event-type: ci_passed
- name: 🔀 Dispatch(ci_pr_passed)
if: github.event_name == 'pull_request_target'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ env.bot_token }}
token: ${{ env.BOT_TOKEN }}
event-type: ci_pr_passed
- name: 🔀 Dispatch(ci_master_passed)
if: github.event_name == 'push'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ env.bot_token }}
token: ${{ env.BOT_TOKEN }}
event-type: ci_master_passed

@ -6,11 +6,11 @@ jobs:
cib:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: robvanderleek/create-issue-branch@main
env:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}

@ -64,15 +64,15 @@ jobs:
run: yarn build:sites
- name: 🔑 Generate Token
uses: wow-actions/use-app-token@v1
uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- name:  Deploy sites
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ env.bot_token }}
github_token: ${{ env.BOT_TOKEN }}
publish_dir: ./sites/x6-sites/public
publish_branch: gh-pages

@ -8,12 +8,12 @@ jobs:
cmd:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/label-commands@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
CONFIG_FILE: .github/workflows/config/label-commands.yml

@ -6,14 +6,14 @@ jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: dessant/lock-threads@v2
with:
github-token: ${{ env.bot_token }}
github-token: ${{ env.BOT_TOKEN }}
issue-lock-inactive-days: 365
issue-lock-comment: |
This thread has been automatically locked because it has not had recent activity.

@ -8,13 +8,13 @@ jobs:
evaluate:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/needs-more-info@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
CONFIG_FILE: .github/workflows/config/needs-more-info.yml

@ -6,11 +6,11 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/potential-duplicates@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}

@ -6,13 +6,13 @@ jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: TimonVS/pr-labeler-action@v3
with:
configuration-path: .github/workflows/config/pr-label-branch-name.yml
env:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}

@ -4,12 +4,12 @@ jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: actions/labeler@v2
with:
repo-token: ${{ env.bot_token }}
repo-token: ${{ env.BOT_TOKEN }}
configuration-path: .github/workflows/config/pr-label-file-paths.yml

@ -4,12 +4,12 @@ jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: pascalgn/size-label-action@v0.4.3
env:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
IGNORED: "!.gitignore\nyarn.lock\npnpm-lock.yaml"

@ -9,12 +9,12 @@ jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/pr-triage@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
WORKFLOW-ID: ${{ github.event.workflow_run.id }}

@ -11,15 +11,15 @@ jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: Naturalclar/issue-action@v2.0.1
with:
title-or-body: title
github-token: ${{ env.bot_token }}
github-token: ${{ env.BOT_TOKEN }}
parameters: >
[
{

@ -69,17 +69,17 @@ jobs:
run: yarn build:sites
- name: 🔑 Generate Token
uses: wow-actions/use-app-token@v1
uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- name:  Deploy Sites
uses: afc163/surge-preview@v1
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ env.bot_token }}
github_token: ${{ env.BOT_TOKEN }}
build: |
echo Create sites preview
dist: sites/x6-sites/public

@ -10,11 +10,11 @@ jobs:
- uses: actions/checkout@master
with:
fetch-depth: 0
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: cirrus-actions/rebase@master
env:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}

@ -51,26 +51,25 @@ jobs:
# run: pnpm run test
- name: 🔑 Generate Token
uses: wow-actions/use-app-token@v1
uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- name: 📦 Semantic Release
run: pnpm srm --debug --comment-footer 'Thanks for being a part of the [AntV](https://github.com/antvis) community! 💪💯'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ env.bot_token }}
GIT_AUTHOR_NAME: x6-bot
GIT_AUTHOR_EMAIL: x6-bot@users.noreply.github.com
GIT_COMMITTER_NAME: x6-bot
GIT_COMMITTER_EMAIL: x6-bot@users.noreply.github.com
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
GIT_AUTHOR_NAME: ${{ env.BOT_NAME }}
GIT_AUTHOR_EMAIL: ${{ env.BOT_NAME }}@users.noreply.github.com
GIT_COMMITTER_NAME: ${{ env.BOT_NAME }}
GIT_COMMITTER_EMAIL: ${{ env.BOT_NAME }}@users.noreply.github.com
- name: 🔀 Repository Dispatch
if: github.ref == 'refs/heads/master'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ env.bot_token }}
token: ${{ env.BOT_TOKEN }}
event-type: released

@ -6,11 +6,11 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/activity-report@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}

@ -6,11 +6,11 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/activity-report@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}

@ -6,12 +6,12 @@ jobs:
cmd:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/slash-commands@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
CONFIG_FILE: .github/workflows/config/slash-commands.yml

@ -6,14 +6,14 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: actions/stale@v3
with:
repo-token: ${{ env.bot_token }}
repo-token: ${{ env.BOT_TOKEN }}
stale-issue-message: |
Hiya!

@ -9,13 +9,13 @@ jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: micnncim/action-label-syncer@v1
env:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
with:
manifest: .github/workflows/config/labels.yml

@ -14,13 +14,14 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/update-authors@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
path: CONTRIBUTORS
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
bots: false
path: CONTRIBUTORS
commit: 'chore: update CONTRIBUTORS [skip ci]'

@ -13,12 +13,12 @@ jobs:
contributors:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/contributors-list@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
excludeUsers: semantic-release-bot ImgBotApp

@ -9,11 +9,11 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: FantasticFiasco/action-update-license-year@v2
with:
token: ${{ env.bot_token }}
token: ${{ env.BOT_TOKEN }}

@ -8,14 +8,14 @@ jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/use-app-token@v1
- uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
env_name: bot_token
- uses: wow-actions/welcome@v1
with:
GITHUB_TOKEN: ${{ env.bot_token }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}
FIRST_ISSUE: |
👋 @{{ author }}

14
.husky/pre-push Executable file

@ -0,0 +1,14 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
branch="$(git rev-parse --abbrev-ref HEAD)"
user="$(git config user.name)"
whitelist=("bubkoo" "NewByVector")
if [[ ! " ${whitelist[@]} " =~ " ${user} " ]]; then
if [ "$branch" = "master" ]; then
echo "Push to master branch is forbidden."
echo "Checkout your owne branch then submit a pr."
exit 1
fi
fi

@ -1,4 +0,0 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
./scripts/pre-push-check

@ -17,6 +17,7 @@ Limbo <49612796+JUST-Limbo@users.noreply.github.com>
Lixu <37231473+wflixu@users.noreply.github.com>
Lloyd <ho>
Lyn <47809781+lyn-boyu@users.noreply.github.com>
MOMO <329053928@qq.com>
Mingfei <az8641683@163.com>
MrMengJ <2646973632@qq.com>
Naveen <172697+naveensrinivasan@users.noreply.github.com>
@ -73,6 +74,7 @@ x6-bot <x6-bot@users.noreply.github.com>
xrkffgg <xrkffgg@gmail.com>
yaojin2070 <48686959+yaojin2070@users.noreply.github.com>
zdc1111 <39116292+zdc1111@users.noreply.github.com>
€alix <qq287649920@gmail.com>
九思⚡⚡⚡ <2228429150@qq.com>
何腾飞 <avrin.live.cn@outlook.com>
偏右 <afc163@gmail.com>
@ -83,6 +85,7 @@ zdc1111 <39116292+zdc1111@users.noreply.github.com>
杨凌 <89915256@qq.com>
柏愚 <boyu.zlj@antfin.com>
粑粑超 <842486229@qq.com>
诸岳 <dengfuping_private@163.com>
金强强 <wenyu.jqq@antfin.com>
问崖 <bubkoo.wy@gmail.com>
问崖 <pengxingjian.pxj@antfin.com>

File diff suppressed because one or more lines are too long

Before

(image error) Size: 9.7 MiB

After

(image error) Size: 10 MiB

@ -111,9 +111,10 @@ pnpm run start
如果希望参与到 X6 的开发中,请遵从我们的[贡献指南](/CONTRIBUTING.zh-CN.md)。如果你贡献度足够活跃,你可以申请成为社区协作者。
<a href="https://github.com/antvis/x6/graphs/contributors">
<img src="/CONTRIBUTORS.svg" alt="Contributors" width="740" />
<img src="https://raw.githubusercontent.com/antvis/X6/master/CONTRIBUTORS.svg" alt="Contributors" />
</a>
## 开源协议
该项目的代码和文档基于 [MIT License](/LICENSE) 开源协议。

@ -13,7 +13,7 @@ export default class Example extends React.Component {
private minimapContainer: HTMLDivElement
private scroller: Scroller
private selection: Selection
private exportObj: Export
private exportInstance: Export
componentDidMount() {
this.graph = new Graph({
@ -55,12 +55,12 @@ export default class Example extends React.Component {
height: 200,
padding: 10,
})
this.exportObj = new Export()
this.exportInstance = new Export()
this.graph.use(this.scroller)
this.graph.use(this.selection)
this.graph.use(minimap)
this.graph.use(this.exportObj)
this.graph.use(this.exportInstance)
const rect = this.graph.addNode({
shape: 'rect',
@ -122,7 +122,7 @@ export default class Example extends React.Component {
}
onDownload = () => {
this.exportObj.exportPNG('scroller')
this.exportInstance.exportPNG('scroller')
}
render() {

@ -2,7 +2,7 @@
"name": "x6",
"private": true,
"scripts": {
"preinstall": "node ./scripts/preinstall.js",
"preinstall": "node ./scripts/preinstall",
"lint:ts": "eslint '**/src/**/*.{js,ts}?(x)' --fix",
"lint:style": "stylelint '**/src/**/*.less' --syntax less --fix",
"lint": "run-s lint:ts lint:style",
@ -10,17 +10,43 @@
"pretty-quick": "pretty-quick",
"test": "turbo run test --filter=./packages/*",
"build": "turbo run build --filter=./packages/*",
"build:cjs": "turbo run build:cjs --filter=./packages/*",
"build:esm": "turbo run build:esm --filter=./packages/*",
"build:dev": "turbo run build:dev --filter=./packages/*",
"build:umd": "turbo run build:umd --filter=./packages/*",
"build:demos": "sh ./scripts/build-demos",
"build:sites": "sh ./scripts/build-sites",
"update:deps": "pnpm update --interactive --latest --recursive",
"clean:turbo": "pnpm -r --if-present --parallel --filter=./packages/* run clean:turbo",
"clean:build": "pnpm -r --if-present --parallel --filter=./packages/* run clean",
"clean:modules": "pnpm -r --parallel exec rimraf node_modules && rimraf node_modules",
"clean": "run-s clean:build clean:modules",
"clean": "run-s clean:build clean:turbo clean:modules",
"update:deps": "pnpm update --interactive --latest --recursive",
"setup:husky": "husky install .husky",
"prepare": "is-ci || run-p setup:husky build:dev"
},
"rss": {
"clean:turbo": "rimraf .turbo",
"clean:build": "rimraf dist es lib",
"clean:coverage": "rimraf ./test/coverage",
"clean": "run-p clean:**",
"build:less": {
"file": "./scripts/build-less"
},
"build:esm": "tsc --module esnext --target es6 --outDir ./es",
"build:cjs": "tsc --module commonjs --target es6 --outDir ./lib",
"build:umd": "pnpm run --if-present build:less && rollup -c ../../rollup.config.js --bundleConfigAsCjs",
"build:dev": "pnpm run --if-present build:less && run-p -s build:cjs build:esm",
"build:watch": "run-s -s build:watch:esm",
"build:watch:esm": "run-s -s 'build:esm -w'",
"build:watch:cjs": "run-s -s 'build:cjs -w'",
"build": "run-p -s build:dev build:umd",
"prebuild": "run-s -s clean:build",
"test": {
"file": "./scripts/run-test"
},
"coveralls": "cat ./test/coverage/lcov.info | coveralls",
"pretest": "run-s -s clean:coverage"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
@ -63,8 +89,7 @@
}
},
"dependencies": {
"@antv/x6-build-tools": "workspace:*",
"@babel/core": "^7.19.6",
"@babel/core": "^7.20.2",
"@babel/plugin-syntax-flow": "^7.18.6",
"@babel/plugin-transform-react-jsx": "^7.19.0",
"@commitlint/config-conventional": "^17.2.0",
@ -72,15 +97,15 @@
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@rollup/plugin-typescript": "^8.2.5",
"@semantic-release-monorepo/cli": "^1.0.28",
"@semantic-release-monorepo/cli": "^2.0.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@types/jasmine": "^4.3.0",
"@types/jest": "^29.2.1",
"@types/jest": "^29.2.2",
"@types/node": "^18.11.9",
"@types/sinon": "^10.0.2",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"boxen": "^7.0.0",
"colors": "^1.4.0",
"coveralls": "^3.1.1",
@ -90,7 +115,7 @@
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-jest": "^27.1.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.1.1",
@ -101,7 +126,7 @@
"husky": "^8.0.1",
"is-ci": "^3.0.0",
"jasmine-core": "^4.5.0",
"jest": "^29.2.2",
"jest": "^29.3.1",
"karma": "^6.3.4",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
@ -122,9 +147,10 @@
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-terser": "^7.0.2",
"run-shared-scripts": "^1.0.2",
"semantic-release": "^19.0.5",
"sinon": "^14.0.1",
"stylelint": "^14.14.0",
"stylelint": "^14.14.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^29.0.0",

@ -1,16 +1 @@
# @antv/x6-common [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-common@1.0.1...@antv/x6-common@2.0.0) (2022-11-05)
### Documentation
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### Features
* sync some commit from v1 ([#2851](https://github.com/antvis/x6/issues/2851)) ([a772025](https://github.com/antvis/x6/commit/a7720251ff42f2892bff9c3cd5159932322362b1))
### BREAKING CHANGES
* dump to 2.0
## @antv/x6-common [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-common@2.0.0...@antv/x6-common@2.0.1) (2022-11-24)

@ -1,6 +1,6 @@
{
"name": "@antv/x6-common",
"version": "2.0.0",
"version": "2.0.1",
"description": "Basic toolkit for X6",
"main": "lib/index.js",
"module": "es/index.js",

@ -1,25 +0,0 @@
import sinon from 'sinon'
import { Dom } from '../../dom'
describe('af', () => {
describe('#requestAnimationFrame', () => {
it('should call the callback', (done) => {
Dom.requestAnimationFrame(() => {
expect(1).toEqual(1)
done()
})
})
})
describe('#cancelAnimationFrame', () => {
it('requestAnimationFrame can be cancel', (done) => {
const spy = sinon.spy()
const id = Dom.requestAnimationFrame(spy)
Dom.cancelAnimationFrame(id)
setTimeout(() => {
expect(spy.callCount).toEqual(0)
done()
}, 100)
})
})
})

@ -151,72 +151,4 @@ describe('FunctionExt', () => {
expect(spy.calledWith(1, '2', true, obj, reg, arr, 'more')).toBeTruthy()
})
})
describe('#cacher', () => {
it('shoule cache function results with same args', () => {
let counter = 0
const raw = (a: number, b: number) => {
counter += 1
return a + b
}
const fn = FunctionExt.cacher(raw)
const ret1 = fn(1, 2)
expect(counter).toBe(1)
const ret2 = fn(1, 2)
expect(counter).toBe(1)
expect(ret1).toBe(ret2)
fn(2, 3)
expect(counter).toBe(2)
})
it('shoule remove cache when reach the max cache count', () => {
let counter = 0
const raw = (a: number, b: number) => {
counter += 1
return a + b
}
const fn = FunctionExt.cacher(raw)
fn(1, 2)
expect(counter).toBe(1)
for (let i = 0; i < 1000; i += 1) {
fn(i, i)
}
fn(1, 2)
expect(counter).toBe(1002)
})
it('shoule cache function with specified context', () => {
const ctx = {}
const spy = sinon.spy()
const fn = FunctionExt.cacher(spy, ctx)
fn()
expect(spy.calledOn(ctx)).toBeTruthy()
})
it('shoule return result processed by post processor', () => {
let counter = 0
const raw = (a: number, b: number) => {
counter += 1
return a + b
}
const processor = (v: number, hasCache: boolean) => {
return hasCache ? -v : v
}
const fn = FunctionExt.cacher(raw, {}, processor)
const ret1 = fn(1, 2)
const ret2 = fn(1, 2)
expect(counter).toBe(1)
expect(ret1).toBe(3)
expect(ret2).toBe(-3)
})
})
})

@ -1,92 +0,0 @@
import { JSONArray, JSONExt, JSONObject, JSONPrimitive } from '../../json'
describe('JSONExt', () => {
describe('isPrimitive()', () => {
it('should return `true` if the value is a primitive', () => {
expect(JSONExt.isPrimitive(null)).toEqual(true)
expect(JSONExt.isPrimitive(false)).toEqual(true)
expect(JSONExt.isPrimitive(true)).toEqual(true)
expect(JSONExt.isPrimitive(1)).toEqual(true)
expect(JSONExt.isPrimitive('1')).toEqual(true)
})
it('should return `false` if the value is not a primitive', () => {
expect(JSONExt.isPrimitive([])).toEqual(false)
expect(JSONExt.isPrimitive({})).toEqual(false)
})
})
describe('isArray()', () => {
it('should test whether a JSON value is an array', () => {
expect(JSONExt.isArray([])).toEqual(true)
expect(JSONExt.isArray(null)).toEqual(false)
expect(JSONExt.isArray(1)).toEqual(false)
})
})
describe('isObject()', () => {
it('should test whether a JSON value is an object', () => {
expect(JSONExt.isObject({ a: 1 })).toEqual(true)
expect(JSONExt.isObject({})).toEqual(true)
expect(JSONExt.isObject([])).toEqual(false)
expect(JSONExt.isObject(1)).toEqual(false)
})
})
describe('deepEqual()', () => {
it('should compare two JSON values for deep equality', () => {
expect(JSONExt.deepEqual([], [])).toEqual(true)
expect(JSONExt.deepEqual([1], [1])).toEqual(true)
expect(JSONExt.deepEqual({}, {})).toEqual(true)
expect(JSONExt.deepEqual({ a: [] }, { a: [] })).toEqual(true)
expect(JSONExt.deepEqual({ a: { b: null } }, { a: { b: null } })).toEqual(
true,
)
expect(JSONExt.deepEqual({ a: '1' }, { a: '1' })).toEqual(true)
expect(JSONExt.deepEqual({ a: { b: null } }, { a: { b: '1' } })).toEqual(
false,
)
expect(JSONExt.deepEqual({ a: [] }, { a: [1] })).toEqual(false)
expect(JSONExt.deepEqual([1], [1, 2])).toEqual(false)
expect(JSONExt.deepEqual(null, [1, 2])).toEqual(false)
expect(JSONExt.deepEqual([1], {})).toEqual(false)
expect(JSONExt.deepEqual([1], [2])).toEqual(false)
expect(JSONExt.deepEqual({}, { a: 1 })).toEqual(false)
expect(JSONExt.deepEqual({ b: 1 }, { a: 1 })).toEqual(false)
})
})
describe('deepCopy()', () => {
it('should deep copy an object', () => {
const v1: JSONPrimitive = null
const v2: JSONPrimitive = true
const v3: JSONPrimitive = false
const v4: JSONPrimitive = 'foo'
const v5: JSONPrimitive = 42
const v6: JSONArray = [1, 2, 3, [4, 5, 6], { a: 12, b: [4, 5] }, false]
const v7: JSONObject = { a: false, b: [null, [1, 2]], c: { a: 1 } }
const r1 = JSONExt.deepCopy(v1)
const r2 = JSONExt.deepCopy(v2)
const r3 = JSONExt.deepCopy(v3)
const r4 = JSONExt.deepCopy(v4)
const r5 = JSONExt.deepCopy(v5)
const r6 = JSONExt.deepCopy(v6)
const r7 = JSONExt.deepCopy(v7)
expect(v1).toEqual(r1)
expect(v2).toEqual(r2)
expect(v3).toEqual(r3)
expect(v4).toEqual(r4)
expect(v5).toEqual(r5)
expect(v6).toEqual(r6)
expect(v7).toEqual(r7)
expect(v6).toEqual(r6)
expect(v6[3]).not.toBe(r6[3])
expect(v6[4]).not.toBe(r6[4])
expect((v6[4] as JSONObject).b).not.toBe((r6[4] as JSONObject).b)
expect(v7).toEqual(r7)
expect(v7.b).not.toBe(r7.b)
expect((v7.b as JSONArray)[1]).not.toBe((r7.b as JSONArray)[1])
expect(v7.c).not.toBe(r7.c)
})
})
})

@ -1,63 +0,0 @@
export const requestAnimationFrame = (function () {
let raf
const win = window as any
if (win != null) {
raf =
win.requestAnimationFrame ||
win.webkitRequestAnimationFrame ||
win.mozRequestAnimationFrame ||
win.oRequestAnimationFrame ||
win.msRequestAnimationFrame
if (raf != null) {
raf = raf.bind(win)
}
}
if (raf == null) {
let lastTime = 0
raf = (callback: FrameRequestCallback) => {
const currTime = new Date().getTime()
const timeToCall = Math.max(0, 16 - (currTime - lastTime))
const id = setTimeout(() => {
callback(currTime + timeToCall)
}, timeToCall)
lastTime = currTime + timeToCall
return id
}
}
return raf as (callback: FrameRequestCallback) => number
})()
export const cancelAnimationFrame = (function () {
let caf
const win = window as any
if (win != null) {
caf =
win.cancelAnimationFrame ||
win.webkitCancelAnimationFrame ||
win.webkitCancelRequestAnimationFrame ||
win.msCancelAnimationFrame ||
win.msCancelRequestAnimationFrame ||
win.oCancelAnimationFrame ||
win.oCancelRequestAnimationFrame ||
win.mozCancelAnimationFrame ||
win.mozCancelRequestAnimationFrame
if (caf) {
caf = caf.bind(win)
}
}
if (caf == null) {
caf = clearTimeout
}
return caf as (handle: number) => void
})()

@ -1,4 +1,3 @@
export * from './af'
export * from './attr'
export * from './elem'
export * from './class'

@ -144,8 +144,8 @@ function calculateDY(
case 'bottom':
dy = -(0.25 * llMaxFont) - rLineHeights
break
default:
case 'top':
default:
dy = 0.8 * flMaxFont
break
}

@ -1,4 +1,4 @@
export { debounce, defer } from 'lodash-es'
export { debounce } from 'lodash-es'
type Fn = (...args: any[]) => any
@ -46,38 +46,3 @@ export function call<T extends Fn>(
): ReturnType<T> {
return apply(fn, ctx, args)
}
function repush<T>(array: T[], item: T) {
for (let i = 0, ii = array.length; i < ii; i += 1) {
if (array[i] === item) {
return array.push(array.splice(i, 1)[0])
}
}
}
export function cacher<T extends Fn>(
fn: T,
ctx?: ThisParameterType<T>,
postProcessor?: (v: any, hasCache?: boolean) => any,
): T {
const keys: string[] = []
const cache: { [kry: string]: any } = {}
const f = (...args: Parameters<T>) => {
let hasCache = false
const key = args.join('\u2400')
if (key in cache) {
hasCache = true
repush(keys, key)
} else {
if (keys.length >= 1000) {
delete cache[keys.shift()!]
}
keys.push(key)
cache[key] = apply(fn, ctx || (null as ThisParameterType<T>), args)
}
return postProcessor ? postProcessor(cache[key], hasCache) : cache[key]
}
return f as T
}

@ -8,7 +8,6 @@ export * from './number'
export * from './function'
export * from './platform'
export * from './text'
export * from './json'
export * from './datauri'
export * from './unit'
export * from './dom'

@ -1,262 +0,0 @@
/**
* A type alias for a JSON primitive.
*/
export type JSONPrimitive = boolean | number | string | null | undefined
/**
* A type alias for a JSON value.
*/
export type JSONValue = JSONPrimitive | JSONObject | JSONArray
/**
* A type definition for a JSON object.
*/
export interface JSONObject {
[key: string]: JSONValue
}
/**
* A type definition for a JSON array.
*/
export interface JSONArray extends Array<JSONValue> {}
/**
* A type definition for a readonly JSON object.
*/
export interface ReadonlyJSONObject {
readonly [key: string]: ReadonlyJSONValue
}
/**
* A type definition for a readonly JSON array.
*/
export interface ReadonlyJSONArray extends ReadonlyArray<ReadonlyJSONValue> {}
/**
* A type alias for a readonly JSON value.
*/
export type ReadonlyJSONValue =
| JSONPrimitive
| ReadonlyJSONObject
| ReadonlyJSONArray
/**
* The namespace for JSON-specific functions.
*/
export namespace JSONExt {
/**
* A shared frozen empty JSONObject
*/
export const emptyObject = Object.freeze({}) as ReadonlyJSONObject
/**
* A shared frozen empty JSONArray
*/
export const emptyArray = Object.freeze([]) as ReadonlyJSONArray
/**
* Test whether a JSON value is a primitive.
*
* @param value - The JSON value of interest.
*
* @returns `true` if the value is a primitive,`false` otherwise.
*/
export function isPrimitive(
value: ReadonlyJSONValue,
): value is JSONPrimitive {
return (
value === null ||
value === undefined ||
typeof value === 'boolean' ||
typeof value === 'number' ||
typeof value === 'string'
)
}
/**
* Test whether a JSON value is an array.
*
* @param value - The JSON value of interest.
*
* @returns `true` if the value is a an array, `false` otherwise.
*/
export function isArray(value: JSONValue): value is JSONArray
export function isArray(value: ReadonlyJSONValue): value is ReadonlyJSONArray
export function isArray(value: ReadonlyJSONValue): boolean {
return Array.isArray(value)
}
/**
* Test whether a JSON value is an object.
*
* @param value - The JSON value of interest.
*
* @returns `true` if the value is a an object, `false` otherwise.
*/
export function isObject(value: JSONValue): value is JSONObject
export function isObject(
value: ReadonlyJSONValue,
): value is ReadonlyJSONObject
export function isObject(value: ReadonlyJSONValue): boolean {
return !isPrimitive(value) && !isArray(value)
}
/**
* Compare two JSON values for deep equality.
*
* @param first - The first JSON value of interest.
*
* @param second - The second JSON value of interest.
*
* @returns `true` if the values are equivalent, `false` otherwise.
*/
export function deepEqual(
first: ReadonlyJSONValue,
second: ReadonlyJSONValue,
): boolean {
// Check referential and primitive equality first.
if (first === second) {
return true
}
// If one is a primitive, the `===` check ruled out the other.
if (isPrimitive(first) || isPrimitive(second)) {
return false
}
// Test whether they are arrays.
const a1 = isArray(first)
const a2 = isArray(second)
// Bail if the types are different.
if (a1 !== a2) {
return false
}
// If they are both arrays, compare them.
if (a1 && a2) {
return deepArrayEqual(
first as ReadonlyJSONArray,
second as ReadonlyJSONArray,
)
}
// At this point, they must both be objects.
return deepObjectEqual(
first as ReadonlyJSONObject,
second as ReadonlyJSONObject,
)
}
/**
* Create a deep copy of a JSON value.
*
* @param value - The JSON value to copy.
*
* @returns A deep copy of the given JSON value.
*/
export function deepCopy<T extends ReadonlyJSONValue>(value: T): T {
// Do nothing for primitive values.
if (isPrimitive(value)) {
return value
}
// Deep copy an array.
if (isArray(value)) {
return deepArrayCopy(value)
}
// Deep copy an object.
return deepObjectCopy(value)
}
/**
* Compare two JSON arrays for deep equality.
*/
function deepArrayEqual(
first: ReadonlyJSONArray,
second: ReadonlyJSONArray,
): boolean {
// Check referential equality first.
if (first === second) {
return true
}
// Test the arrays for equal length.
if (first.length !== second.length) {
return false
}
// Compare the values for equality.
for (let i = 0, n = first.length; i < n; i += 1) {
if (!deepEqual(first[i], second[i])) {
return false
}
}
// At this point, the arrays are equal.
return true
}
/**
* Compare two JSON objects for deep equality.
*/
function deepObjectEqual(
first: ReadonlyJSONObject,
second: ReadonlyJSONObject,
): boolean {
// Check referential equality first.
if (first === second) {
return true
}
// Check for the first object's keys in the second object.
// eslint-disable-next-line
for (const key in first) {
if (!(key in second)) {
return false
}
}
// Check for the second object's keys in the first object.
// eslint-disable-next-line
for (const key in second) {
if (!(key in first)) {
return false
}
}
// Compare the values for equality.
// eslint-disable-next-line
for (const key in first) {
if (!deepEqual(first[key], second[key])) {
return false
}
}
// At this point, the objects are equal.
return true
}
/**
* Create a deep copy of a JSON array.
*/
function deepArrayCopy(value: any): any {
const result = new Array<any>(value.length) // eslint-disable-line
for (let i = 0, n = value.length; i < n; i += 1) {
result[i] = deepCopy(value[i])
}
return result
}
/**
* Create a deep copy of a JSON object.
*/
function deepObjectCopy(value: any): any {
const result: any = {}
Object.keys(value).forEach((key) => {
result[key] = deepCopy(value[key])
})
return result
}
}

@ -1,4 +1,4 @@
export { template, uniqueId } from 'lodash-es'
export { uniqueId } from 'lodash-es'
export * from './format'
export * from './hashcode'

@ -1,27 +1,75 @@
export type Nilable<T> = T | null | undefined
export interface PointLike {
x: number
y: number
}
export type PointData = [number, number]
export interface Translation {
tx: number
ty: number
}
export interface Rotation {
angle: number
cx?: number
cy?: number
}
export interface Scale {
sx: number
sy: number
}
export interface Size {
width: number
height: number
}
export type Nilable<T> = T | null | undefined
export interface KeyValue<T extends any = any> {
export interface KeyValue<T = any> {
[key: string]: T
}
/**
* A type alias for a JSON primitive.
*/
export type JSONPrimitive = boolean | number | string | null | undefined
/**
* A type alias for a JSON value.
*/
export type JSONValue = JSONPrimitive | JSONObject | JSONArray
/**
* A type definition for a JSON object.
*/
export interface JSONObject {
[key: string]: JSONValue
}
/**
* A type definition for a JSON array.
*/
export interface JSONArray extends Array<JSONValue> {}
/**
* A type definition for a readonly JSON object.
*/
export interface ReadonlyJSONObject {
readonly [key: string]: ReadonlyJSONValue
}
/**
* A type definition for a readonly JSON array.
*/
export interface ReadonlyJSONArray extends ReadonlyArray<ReadonlyJSONValue> {}
/**
* A type alias for a readonly JSON value.
*/
export type ReadonlyJSONValue =
| JSONPrimitive
| ReadonlyJSONObject
| ReadonlyJSONArray

@ -1,11 +1 @@
# @antv/x6-geometry [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-geometry@1.0.1...@antv/x6-geometry@2.0.0) (2022-11-05)
### Documentation
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0
## @antv/x6-geometry [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-geometry@2.0.0...@antv/x6-geometry@2.0.1) (2022-11-24)

@ -1,5 +1,5 @@
{
"version": "2.0.0",
"version": "2.0.1",
"name": "@antv/x6-geometry",
"description": "Geometry operations for X6",
"main": "lib/index.js",

@ -1,11 +1,6 @@
# @antv/x6-plugin-clipboard [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-clipboard@1.0.1...@antv/x6-plugin-clipboard@2.0.0) (2022-11-05)
# @antv/x6-plugin-clipboard [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-clipboard@2.0.0...@antv/x6-plugin-clipboard@2.1.0) (2022-11-24)
### Documentation
### Features
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0
* attach plugin api and events to grpah instance ([#2864](https://github.com/antvis/x6/issues/2864)) ([774f547](https://github.com/antvis/x6/commit/774f547b85522eb2411dca949d36ecfe535503f3))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-clipboard",
"version": "2.0.0",
"version": "2.1.0",
"description": "clipboard plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -40,7 +40,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -0,0 +1,113 @@
import { Graph, Cell } from '@antv/x6'
import { Clipboard } from './index'
declare module '@antv/x6/lib/graph/graph' {
interface Graph {
isClipboardEnabled: () => boolean
enableClipboard: () => Graph
disableClipboard: () => Graph
toggleClipboard: (enabled?: boolean) => Graph
isClipboardEmpty: () => boolean
getCellsInClipboard: () => Cell[]
cleanClipboard: () => Graph
copy: (cells: Cell[], options?: Clipboard.CopyOptions) => Graph
cut: (cells: Cell[], options?: Clipboard.CopyOptions) => Graph
paste: (options?: Clipboard.PasteOptions, graph?: Graph) => Cell[]
}
}
declare module '@antv/x6/lib/graph/events' {
interface EventArgs {
'clipboard:changed': { cells: Cell[] }
}
}
Graph.prototype.isClipboardEnabled = function () {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
return clipboard.isEnabled()
}
return false
}
Graph.prototype.enableClipboard = function () {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
clipboard.enable()
}
return this
}
Graph.prototype.disableClipboard = function () {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
clipboard.disable()
}
return this
}
Graph.prototype.toggleClipboard = function (enabled?: boolean) {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
clipboard.toggleEnabled(enabled)
}
return this
}
Graph.prototype.isClipboardEmpty = function () {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
return clipboard.isEmpty()
}
return true
}
Graph.prototype.getCellsInClipboard = function () {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
return clipboard.getCellsInClipboard()
}
return []
}
Graph.prototype.cleanClipboard = function () {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
clipboard.clean()
}
return this
}
Graph.prototype.copy = function (
cells: Cell[],
options?: Clipboard.CopyOptions,
) {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
clipboard.copy(cells, options)
}
return this
}
Graph.prototype.cut = function (
cells: Cell[],
options?: Clipboard.CopyOptions,
) {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
clipboard.cut(cells, options)
}
return this
}
Graph.prototype.paste = function (
options?: Clipboard.PasteOptions,
graph?: Graph,
) {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
return clipboard.paste(options, graph)
}
return []
}

@ -1,5 +1,6 @@
import { Cell, Graph, IDisablable, Basecoat } from '@antv/x6'
import { ClipboardImpl } from './clipboard'
import './api'
export class Clipboard
extends Basecoat<Clipboard.EventArgs>
@ -7,10 +8,12 @@ export class Clipboard
{
private clipboardImpl: ClipboardImpl
private graph: Graph
public options: Clipboard.Options
public name = 'clipboard'
constructor(public readonly options: Clipboard.Options) {
constructor(options: Clipboard.Options) {
super()
this.options = options
}
init(graph: Graph) {
@ -65,7 +68,7 @@ export class Clipboard
return this.cells
}
private clean(force?: boolean) {
clean(force?: boolean) {
if (!this.disabled || force) {
this.clipboardImpl.clean()
this.notify('clipboard:changed', { cells: [] })
@ -111,12 +114,12 @@ export class Clipboard
return this.options.enabled !== true
}
private get commonOptions() {
protected get commonOptions() {
const { enabled, ...others } = this.options
return others
}
private get cells() {
protected get cells() {
return this.clipboardImpl.cells
}

@ -1,11 +1,6 @@
# @antv/x6-plugin-dnd [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-dnd@1.0.1...@antv/x6-plugin-dnd@2.0.0) (2022-11-05)
## @antv/x6-plugin-dnd [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-dnd@2.0.0...@antv/x6-plugin-dnd@2.0.1) (2022-11-24)
### Documentation
### Bug Fixes
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0
* export snap methods from snapline ([#2904](https://github.com/antvis/x6/issues/2904)) ([826ccdd](https://github.com/antvis/x6/commit/826ccdd9a033486ad5b90d666340e46f6c266af7))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-dnd",
"version": "2.0.0",
"version": "2.0.1",
"description": "dnd plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -41,7 +41,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -104,7 +104,7 @@ export class Dnd extends View {
}
protected isSnaplineEnabled() {
return this.snapline && this.snapline.isSnaplineEnabled()
return this.snapline && this.snapline.isEnabled()
}
protected prepareDragging(

@ -1,11 +1,7 @@
# @antv/x6-plugin-export [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-export@1.0.1...@antv/x6-plugin-export@2.0.0) (2022-11-05)
# @antv/x6-plugin-export [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-export@2.0.0...@antv/x6-plugin-export@2.1.0) (2022-11-24)
### Documentation
### Features
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0
* add exportSVG methods ([#2906](https://github.com/antvis/x6/issues/2906)) ([847f225](https://github.com/antvis/x6/commit/847f2256326db0589ac37f1e1fa185560b61bdb7))
* attach plugin api and events to grpah instance ([#2864](https://github.com/antvis/x6/issues/2864)) ([774f547](https://github.com/antvis/x6/commit/774f547b85522eb2411dca949d36ecfe535503f3))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-export",
"version": "2.0.0",
"version": "2.1.0",
"description": "export plugin for X6.",
"main": "lib/index.js",
"module": "es/index.js",
@ -39,7 +39,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -0,0 +1,40 @@
import { Graph } from '@antv/x6'
import { Export } from './index'
declare module '@antv/x6/lib/graph/graph' {
interface Graph {
exportPNG: (fileName?: string, options?: Export.ToImageOptions) => void
exportJPEG: (fileName?: string, options?: Export.ToImageOptions) => void
exportSVG: (fileName?: string, options?: Export.ToSVGOptions) => void
}
}
Graph.prototype.exportPNG = function (
fileName?: string,
options?: Export.ToImageOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {
instance.exportPNG(fileName, options)
}
}
Graph.prototype.exportJPEG = function (
fileName?: string,
options?: Export.ToImageOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {
instance.exportJPEG(fileName, options)
}
}
Graph.prototype.exportSVG = function (
fileName?: string,
options?: Export.ToSVGOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {
instance.exportSVG(fileName, options)
}
}

@ -10,6 +10,7 @@ import {
Dom,
Graph,
} from '@antv/x6'
import './api'
export class Export extends Basecoat<Export.EventArgs> {
private graph: Graph
@ -39,6 +40,12 @@ export class Export extends Basecoat<Export.EventArgs> {
}, options)
}
exportSVG(fileName = 'chart', options: Export.ToSVGOptions = {}) {
this.toSVG((svg: string) => {
DataUri.downloadDataUri(DataUri.svgToDataUrl(svg), fileName)
}, options)
}
toSVG(callback: Export.ToSVGCallback, options: Export.ToSVGOptions = {}) {
this.notify('before:export', options)

@ -1,11 +1,6 @@
# @antv/x6-plugin-history [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-history@1.0.1...@antv/x6-plugin-history@2.0.0) (2022-11-05)
# @antv/x6-plugin-history [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-history@2.0.0...@antv/x6-plugin-history@2.1.0) (2022-11-24)
### Documentation
### Features
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0
* attach plugin api and events to grpah instance ([#2864](https://github.com/antvis/x6/issues/2864)) ([774f547](https://github.com/antvis/x6/commit/774f547b85522eb2411dca949d36ecfe535503f3))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-history",
"version": "2.0.0",
"version": "2.1.0",
"description": "history plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -40,7 +40,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -0,0 +1,109 @@
import { Graph, KeyValue } from '@antv/x6'
import { History } from './index'
declare module '@antv/x6/lib/graph/graph' {
interface Graph {
isHistoryEnabled: () => boolean
enableHistory: () => Graph
disableHistory: () => Graph
toggleHistory: (enabled?: boolean) => Graph
undo: (options?: KeyValue) => Graph
redo: (options?: KeyValue) => Graph
undoAndCancel: (options?: KeyValue) => Graph
canUndo: () => boolean
canRedo: () => boolean
cleanHistory: (options?: KeyValue) => Graph
}
}
declare module '@antv/x6/lib/graph/events' {
interface EventArgs {
'history:undo': History.Args
'history:redo': History.Args
'history:cancel': History.Args
'history:add': History.Args
'history:clean': History.Args<null>
'history:change': History.Args<null>
'history:batch': { cmd: History.Command; options: KeyValue }
}
}
Graph.prototype.isHistoryEnabled = function () {
const history = this.getPlugin('history') as History
if (history) {
return history.isEnabled()
}
return false
}
Graph.prototype.enableHistory = function () {
const history = this.getPlugin('history') as History
if (history) {
history.enable()
}
return this
}
Graph.prototype.disableHistory = function () {
const history = this.getPlugin('history') as History
if (history) {
history.disable()
}
return this
}
Graph.prototype.toggleHistory = function (enabled?: boolean) {
const history = this.getPlugin('history') as History
if (history) {
history.toggleEnabled(enabled)
}
return this
}
Graph.prototype.undo = function (options?: KeyValue) {
const history = this.getPlugin('history') as History
if (history) {
history.undo(options)
}
return this
}
Graph.prototype.redo = function (options?: KeyValue) {
const history = this.getPlugin('history') as History
if (history) {
history.redo(options)
}
return this
}
Graph.prototype.undoAndCancel = function (options?: KeyValue) {
const history = this.getPlugin('history') as History
if (history) {
history.cancel(options)
}
return this
}
Graph.prototype.canUndo = function () {
const history = this.getPlugin('history') as History
if (history) {
return history.canUndo()
}
return false
}
Graph.prototype.canRedo = function () {
const history = this.getPlugin('history') as History
if (history) {
return history.canRedo()
}
return false
}
Graph.prototype.cleanHistory = function (options?: KeyValue) {
const history = this.getPlugin('history') as History
if (history) {
history.clean(options)
}
return this
}

@ -8,6 +8,7 @@ import {
Model,
Graph,
} from '@antv/x6'
import './api'
export class History
extends Basecoat<History.EventArgs>
@ -643,7 +644,7 @@ export namespace History {
}
export namespace History {
interface Args<T = never> {
export interface Args<T = never> {
cmds: Command[] | T
options: KeyValue
}

@ -1,11 +1,6 @@
# @antv/x6-plugin-keyboard [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-keyboard@1.0.1...@antv/x6-plugin-keyboard@2.0.0) (2022-11-05)
# @antv/x6-plugin-keyboard [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-keyboard@2.0.0...@antv/x6-plugin-keyboard@2.1.0) (2022-11-24)
### Documentation
### Features
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0
* attach plugin api and events to grpah instance ([#2864](https://github.com/antvis/x6/issues/2864)) ([774f547](https://github.com/antvis/x6/commit/774f547b85522eb2411dca949d36ecfe535503f3))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-keyboard",
"version": "2.0.0",
"version": "2.1.0",
"description": "keyboard plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -43,7 +43,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x",
"@antv/x6": "^2.x",
"@types/mousetrap": "^1.6.5"
},
"author": {

@ -0,0 +1,73 @@
import { Graph } from '@antv/x6'
import { Keyboard } from './index'
import { KeyboardImpl } from './keyboard'
declare module '@antv/x6/lib/graph/graph' {
interface Graph {
isKeyboardEnabled: () => boolean
enableKeyboard: () => Graph
disableKeyboard: () => Graph
toggleKeyboard: (enabled?: boolean) => Graph
bindKey: (
keys: string | string[],
callback: KeyboardImpl.Handler,
action?: KeyboardImpl.Action,
) => Graph
unbindKey: (keys: string | string[], action?: KeyboardImpl.Action) => Graph
}
}
Graph.prototype.isKeyboardEnabled = function () {
const keyboard = this.getPlugin('keyboard') as Keyboard
if (keyboard) {
return keyboard.isEnabled()
}
return false
}
Graph.prototype.enableKeyboard = function () {
const keyboard = this.getPlugin('keyboard') as Keyboard
if (keyboard) {
keyboard.enable()
}
return this
}
Graph.prototype.disableKeyboard = function () {
const keyboard = this.getPlugin('keyboard') as Keyboard
if (keyboard) {
keyboard.disable()
}
return this
}
Graph.prototype.toggleKeyboard = function (enabled?: boolean) {
const keyboard = this.getPlugin('keyboard') as Keyboard
if (keyboard) {
keyboard.toggleEnabled(enabled)
}
return this
}
Graph.prototype.bindKey = function (
keys: string | string[],
callback: KeyboardImpl.Handler,
action?: KeyboardImpl.Action,
) {
const keyboard = this.getPlugin('keyboard') as Keyboard
if (keyboard) {
keyboard.bindKey(keys, callback, action)
}
return this
}
Graph.prototype.unbindKey = function (
keys: string | string[],
action?: KeyboardImpl.Action,
) {
const keyboard = this.getPlugin('keyboard') as Keyboard
if (keyboard) {
keyboard.unbindKey(keys, action)
}
return this
}

@ -1,12 +1,15 @@
import { Disposable, Graph } from '@antv/x6'
import { KeyboardImpl } from './keyboard'
import './api'
export class Keyboard extends Disposable {
private keyboardImpl: KeyboardImpl
public name = 'keyboard'
public options: KeyboardImpl.Options
constructor(public readonly options: KeyboardImpl.Options) {
constructor(options: KeyboardImpl.Options) {
super()
this.options = options
}
init(graph: Graph) {

@ -1,11 +1,6 @@
# @antv/x6-plugin-minimap [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-minimap@1.0.1...@antv/x6-plugin-minimap@2.0.0) (2022-11-05)
## @antv/x6-plugin-minimap [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-minimap@2.0.0...@antv/x6-plugin-minimap@2.0.1) (2022-11-24)
### Documentation
### Bug Fixes
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0
* add missing script for building style ([e683155](https://github.com/antvis/x6/commit/e68315528a202cbc5a9ad256d168943e001d7116))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-minimap",
"version": "2.0.0",
"version": "2.0.1",
"description": "minimap plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -27,6 +27,7 @@
"build:cjs": "rss",
"build:umd": "rss",
"build:dev": "rss",
"build:less": "rss",
"build:watch": "rss",
"build:watch:esm": "rss",
"build:watch:cjs": "rss",
@ -40,7 +41,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -1,16 +1,7 @@
# @antv/x6-plugin-scroller [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-scroller@1.0.1...@antv/x6-plugin-scroller@2.0.0) (2022-11-05)
## @antv/x6-plugin-scroller [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-scroller@2.0.0...@antv/x6-plugin-scroller@2.0.1) (2022-11-24)
### Documentation
### Bug Fixes
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### Features
* sync some commit from v1 ([#2851](https://github.com/antvis/x6/issues/2851)) ([a772025](https://github.com/antvis/x6/commit/a7720251ff42f2892bff9c3cd5159932322362b1))
### BREAKING CHANGES
* dump to 2.0
* add missing script for building style ([e683155](https://github.com/antvis/x6/commit/e68315528a202cbc5a9ad256d168943e001d7116))
* resize graph when scale scroller ([#2903](https://github.com/antvis/x6/issues/2903)) ([cee4aa4](https://github.com/antvis/x6/commit/cee4aa4e53b2821ed11d5602fccdb36625957c72))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-scroller",
"version": "2.0.0",
"version": "2.0.1",
"description": "scroller plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -27,6 +27,7 @@
"build:cjs": "rss",
"build:umd": "rss",
"build:dev": "rss",
"build:less": "rss",
"build:watch": "rss",
"build:watch:esm": "rss",
"build:watch:cjs": "rss",
@ -40,7 +41,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -0,0 +1,55 @@
import { Graph } from '@antv/x6'
import { Scroller } from './index'
declare module '@antv/x6/lib/graph/graph' {
interface Graph {
lockScroller: () => Graph
unlockScroller: () => Graph
updateScroller: () => Graph
getScrollbarPosition: () => { left: number; top: number }
setScrollbarPosition: (left?: number, top?: number) => Graph
}
}
Graph.prototype.lockScroller = function () {
const scroller = this.getPlugin('scroller') as Scroller
if (scroller) {
scroller.lockScroller()
}
return this
}
Graph.prototype.unlockScroller = function () {
const scroller = this.getPlugin('scroller') as Scroller
if (scroller) {
scroller.unlockScroller()
}
return this
}
Graph.prototype.updateScroller = function () {
const scroller = this.getPlugin('scroller') as Scroller
if (scroller) {
scroller.updateScroller()
}
return this
}
Graph.prototype.getScrollbarPosition = function () {
const scroller = this.getPlugin('scroller') as Scroller
if (scroller) {
return scroller.getScrollbarPosition()
}
return {
left: 0,
top: 0,
}
}
Graph.prototype.setScrollbarPosition = function (left?: number, top?: number) {
const scroller = this.getPlugin('scroller') as Scroller
if (scroller) {
scroller.setScrollbarPosition(left, top)
}
return this
}

@ -13,6 +13,7 @@ import {
} from '@antv/x6'
import { ScrollerImpl } from './scroller'
import { content } from './style/raw'
import './api'
export class Scroller extends Basecoat<Scroller.EventArgs> {
private graph: Graph
@ -219,14 +220,17 @@ export class Scroller extends Basecoat<Scroller.EventArgs> {
lockScroller() {
this.scrollerImpl.lock()
return this
}
unlockScroller() {
this.scrollerImpl.unlock()
return this
}
updateScroller() {
this.scrollerImpl.update()
return this
}
getScrollbarPosition() {

@ -404,7 +404,7 @@ export class ScrollerImpl extends View<ScrollerImpl.EventArgs> {
this.sy = sy
this.graph.translate(options.x * dx, options.y * dy)
this.graph.resize(options.width * dx, options.height * dy)
this.graph.transform.resize(options.width * dx, options.height * dy)
}
scrollbarPosition(): { left: number; top: number }
@ -1117,7 +1117,7 @@ export class ScrollerImpl extends View<ScrollerImpl.EventArgs> {
@View.dispose()
dispose() {
Dom.before(this.graph.container, this.container)
Dom.before(this.container, this.graph.container)
this.remove()
}
}

@ -1,11 +1,11 @@
# @antv/x6-plugin-selection [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-selection@1.0.1...@antv/x6-plugin-selection@2.0.0) (2022-11-05)
# @antv/x6-plugin-selection [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-selection@2.0.0...@antv/x6-plugin-selection@2.1.0) (2022-11-24)
### Documentation
### Bug Fixes
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
* add missing script for building style ([e683155](https://github.com/antvis/x6/commit/e68315528a202cbc5a9ad256d168943e001d7116))
### BREAKING CHANGES
### Features
* dump to 2.0
* attach plugin api and events to grpah instance ([#2864](https://github.com/antvis/x6/issues/2864)) ([774f547](https://github.com/antvis/x6/commit/774f547b85522eb2411dca949d36ecfe535503f3))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-selection",
"version": "2.0.0",
"version": "2.1.0",
"description": "selection plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -27,6 +27,7 @@
"build:cjs": "rss",
"build:umd": "rss",
"build:dev": "rss",
"build:less": "rss",
"build:watch": "rss",
"build:watch:esm": "rss",
"build:watch:cjs": "rss",
@ -40,7 +41,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -0,0 +1,313 @@
import { Graph, Cell, ModifierKey } from '@antv/x6'
import { Selection } from './index'
import { SelectionImpl } from './selection'
declare module '@antv/x6/lib/graph/graph' {
interface Graph {
isSelectionEnabled: () => boolean
enableSelection: () => Graph
disableSelection: () => Graph
toggleSelection: (enabled?: boolean) => Graph
isMultipleSelection: () => boolean
enableMultipleSelection: () => Graph
disableMultipleSelection: () => Graph
toggleMultipleSelection: (multiple?: boolean) => Graph
isSelectionMovable: () => boolean
enableSelectionMovable: () => Graph
disableSelectionMovable: () => Graph
toggleSelectionMovable: (movable?: boolean) => Graph
isRubberbandEnabled: () => boolean
enableRubberband: () => Graph
disableRubberband: () => Graph
toggleRubberband: (enabled?: boolean) => Graph
isStrictRubberband: () => boolean
enableStrictRubberband: () => Graph
disableStrictRubberband: () => Graph
toggleStrictRubberband: (strict?: boolean) => Graph
setRubberbandModifiers: (modifiers?: string | ModifierKey[] | null) => Graph
setSelectionFilter: (filter?: Selection.Filter) => Graph
setSelectionDisplayContent: (content?: Selection.Content) => Graph
isSelectionEmpty: () => boolean
cleanSelection: (options?: Selection.SetOptions) => Graph
resetSelection: (
cells?: Cell | string | (Cell | string)[],
options?: Selection.SetOptions,
) => Graph
getSelectedCells: () => Cell[]
getSelectedCellCount: () => number
isSelected: (cell: Cell | string) => boolean
select: (
cells: Cell | string | (Cell | string)[],
options?: Selection.AddOptions,
) => Graph
unselect: (
cells: Cell | string | (Cell | string)[],
options?: Selection.RemoveOptions,
) => Graph
}
}
declare module '@antv/x6/lib/graph/events' {
interface EventArgs extends SelectionImpl.SelectionEventArgs {}
}
Graph.prototype.isSelectionEnabled = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.isEnabled()
}
return false
}
Graph.prototype.enableSelection = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.enable()
}
return this
}
Graph.prototype.disableSelection = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.disable()
}
return this
}
Graph.prototype.toggleSelection = function (enabled?: boolean) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.toggleEnabled(enabled)
}
return this
}
Graph.prototype.isMultipleSelection = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.isMultipleSelection()
}
return false
}
Graph.prototype.enableMultipleSelection = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.enableMultipleSelection()
}
return this
}
Graph.prototype.disableMultipleSelection = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.disableMultipleSelection()
}
return this
}
Graph.prototype.toggleMultipleSelection = function (multiple?: boolean) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.toggleMultipleSelection(multiple)
}
return this
}
Graph.prototype.isSelectionMovable = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.isSelectionMovable()
}
return false
}
Graph.prototype.enableSelectionMovable = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.enableSelectionMovable()
}
return this
}
Graph.prototype.disableSelectionMovable = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.disableSelectionMovable()
}
return this
}
Graph.prototype.toggleSelectionMovable = function (movable?: boolean) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.toggleSelectionMovable(movable)
}
return this
}
Graph.prototype.isRubberbandEnabled = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.isRubberbandEnabled()
}
return false
}
Graph.prototype.enableRubberband = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.enableRubberband()
}
return this
}
Graph.prototype.disableRubberband = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.disableRubberband()
}
return this
}
Graph.prototype.toggleRubberband = function (enabled?: boolean) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.toggleRubberband(enabled)
}
return this
}
Graph.prototype.isStrictRubberband = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.isStrictRubberband()
}
return false
}
Graph.prototype.enableStrictRubberband = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.enableStrictRubberband()
}
return this
}
Graph.prototype.disableStrictRubberband = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.disableStrictRubberband()
}
return this
}
Graph.prototype.toggleStrictRubberband = function (strict?: boolean) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.toggleStrictRubberband(strict)
}
return this
}
Graph.prototype.setRubberbandModifiers = function (
modifiers?: string | ModifierKey[] | null,
) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.setRubberbandModifiers(modifiers)
}
return this
}
Graph.prototype.setSelectionFilter = function (filter?: Selection.Filter) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.setSelectionFilter(filter)
}
return this
}
Graph.prototype.setSelectionDisplayContent = function (
content?: Selection.Content,
) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.setSelectionDisplayContent(content)
}
return this
}
Graph.prototype.isSelectionEmpty = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.isEmpty()
}
return true
}
Graph.prototype.cleanSelection = function (options?: Selection.SetOptions) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.clean(options)
}
return this
}
Graph.prototype.resetSelection = function (
cells?: Cell | string | (Cell | string)[],
options?: Selection.SetOptions,
) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.reset(cells, options)
}
return this
}
Graph.prototype.getSelectedCells = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.getSelectedCells()
}
return []
}
Graph.prototype.getSelectedCellCount = function () {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.getSelectedCellCount()
}
return 0
}
Graph.prototype.isSelected = function (cell: Cell | string) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.isSelected(cell)
}
return false
}
Graph.prototype.select = function (
cells: Cell | string | (Cell | string)[],
options?: Selection.AddOptions,
) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
selection.select(cells, options)
}
return this
}
Graph.prototype.unselect = function (
cells: Cell | string | (Cell | string)[],
options?: Selection.RemoveOptions,
) {
const selection = this.getPlugin('selection') as Selection
if (selection) {
return selection.unselect(cells, options)
}
return this
}

@ -10,6 +10,7 @@ import {
} from '@antv/x6'
import { SelectionImpl } from './selection'
import { content } from './style/raw'
import './api'
export class Selection extends Basecoat<SelectionImpl.EventArgs> {
private graph: Graph
@ -244,7 +245,7 @@ export class Selection extends Basecoat<SelectionImpl.EventArgs> {
return this
}
protected reset(
reset(
cells?: Cell | string | (Cell | string)[],
options: Selection.SetOptions = {},
) {

@ -1,11 +1,12 @@
# @antv/x6-plugin-snapline [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-snapline@1.0.1...@antv/x6-plugin-snapline@2.0.0) (2022-11-05)
# @antv/x6-plugin-snapline [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-snapline@2.0.0...@antv/x6-plugin-snapline@2.1.0) (2022-11-24)
### Documentation
### Bug Fixes
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
* add missing script for building style ([e683155](https://github.com/antvis/x6/commit/e68315528a202cbc5a9ad256d168943e001d7116))
* export snap methods from snapline ([#2904](https://github.com/antvis/x6/issues/2904)) ([826ccdd](https://github.com/antvis/x6/commit/826ccdd9a033486ad5b90d666340e46f6c266af7))
### BREAKING CHANGES
### Features
* dump to 2.0
* attach plugin api and events to grpah instance ([#2864](https://github.com/antvis/x6/issues/2864)) ([774f547](https://github.com/antvis/x6/commit/774f547b85522eb2411dca949d36ecfe535503f3))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-snapline",
"version": "2.0.0",
"version": "2.1.0",
"description": "snapline plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -27,6 +27,7 @@
"build:cjs": "rss",
"build:umd": "rss",
"build:dev": "rss",
"build:less": "rss",
"build:watch": "rss",
"build:watch:esm": "rss",
"build:watch:cjs": "rss",
@ -40,7 +41,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -0,0 +1,152 @@
import { Graph } from '@antv/x6'
import { Snapline } from './index'
declare module '@antv/x6/lib/graph/graph' {
interface Graph {
isSnaplineEnabled: () => boolean
enableSnapline: () => Graph
disableSnapline: () => Graph
toggleSnapline: (enabled?: boolean) => Graph
hideSnapline: () => Graph
setSnaplineFilter: (filter?: Snapline.Filter) => Graph
isSnaplineOnResizingEnabled: () => boolean
enableSnaplineOnResizing: () => Graph
disableSnaplineOnResizing: () => Graph
toggleSnaplineOnResizing: (enableOnResizing?: boolean) => Graph
isSharpSnapline: () => boolean
enableSharpSnapline: () => Graph
disableSharpSnapline: () => Graph
toggleSharpSnapline: (sharp?: boolean) => Graph
getSnaplineTolerance: () => number | undefined
setSnaplineTolerance: (tolerance: number) => Graph
}
}
Graph.prototype.isSnaplineEnabled = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
return snapline.isEnabled()
}
return false
}
Graph.prototype.enableSnapline = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.enable()
}
return this
}
Graph.prototype.disableSnapline = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.disable()
}
return this
}
Graph.prototype.toggleSnapline = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.toggleEnabled()
}
return this
}
Graph.prototype.hideSnapline = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.hide()
}
return this
}
Graph.prototype.setSnaplineFilter = function (filter?: Snapline.Filter) {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.setFilter(filter)
}
return this
}
Graph.prototype.isSnaplineOnResizingEnabled = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
return snapline.isOnResizingEnabled()
}
return false
}
Graph.prototype.enableSnaplineOnResizing = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.enableOnResizing()
}
return this
}
Graph.prototype.disableSnaplineOnResizing = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.disableOnResizing()
}
return this
}
Graph.prototype.toggleSnaplineOnResizing = function (
enableOnResizing?: boolean,
) {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.toggleOnResizing(enableOnResizing)
}
return this
}
Graph.prototype.isSharpSnapline = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
return snapline.isSharp()
}
return false
}
Graph.prototype.enableSharpSnapline = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.enableSharp()
}
return this
}
Graph.prototype.disableSharpSnapline = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.disableSharp()
}
return this
}
Graph.prototype.toggleSharpSnapline = function (sharp?: boolean) {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.toggleSharp(sharp)
}
return this
}
Graph.prototype.getSnaplineTolerance = function () {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
return snapline.getTolerance()
}
}
Graph.prototype.setSnaplineTolerance = function (tolerance: number) {
const snapline = this.getPlugin('snapline') as Snapline
if (snapline) {
snapline.setTolerance(tolerance)
}
return this
}

@ -1,6 +1,7 @@
import { Disposable, CssLoader, Graph, EventArgs } from '@antv/x6'
import { SnaplineImpl } from './snapline'
import { content } from './style/raw'
import './api'
export class Snapline extends Disposable {
private snaplineImpl: SnaplineImpl
@ -138,6 +139,10 @@ export class Snapline extends Disposable {
this.snaplineImpl.captureCursorOffset(e)
}
snapOnMoving(args: EventArgs['node:mousemove']) {
this.snaplineImpl.snapOnMoving(args)
}
// #endregion
@Disposable.dispose()
@ -149,4 +154,5 @@ export class Snapline extends Disposable {
export namespace Snapline {
export interface Options extends SnaplineImpl.Options {}
export type Filter = SnaplineImpl.Filter
}

@ -1,11 +1,6 @@
# @antv/x6-plugin-stencil [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-stencil@1.0.1...@antv/x6-plugin-stencil@2.0.0) (2022-11-05)
## @antv/x6-plugin-stencil [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-stencil@2.0.0...@antv/x6-plugin-stencil@2.0.1) (2022-11-24)
### Documentation
### Bug Fixes
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0
* add missing script for building style ([e683155](https://github.com/antvis/x6/commit/e68315528a202cbc5a9ad256d168943e001d7116))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-stencil",
"version": "2.0.0",
"version": "2.0.1",
"description": "stencil plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -27,6 +27,7 @@
"build:cjs": "rss",
"build:umd": "rss",
"build:dev": "rss",
"build:less": "rss",
"build:watch": "rss",
"build:watch:esm": "rss",
"build:watch:cjs": "rss",
@ -41,7 +42,7 @@
"@antv/x6-plugin-dnd": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x",
"@antv/x6": "^2.x",
"@antv/x6-plugin-dnd": "^2.0.x"
},
"author": {

@ -1,11 +1,11 @@
# @antv/x6-plugin-transform [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-transform@1.0.1...@antv/x6-plugin-transform@2.0.0) (2022-11-05)
# @antv/x6-plugin-transform [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-transform@2.0.0...@antv/x6-plugin-transform@2.1.0) (2022-11-24)
### Documentation
### Bug Fixes
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
* add missing script for building style ([e683155](https://github.com/antvis/x6/commit/e68315528a202cbc5a9ad256d168943e001d7116))
### BREAKING CHANGES
### Features
* dump to 2.0
* attach plugin api and events to grpah instance ([#2864](https://github.com/antvis/x6/issues/2864)) ([774f547](https://github.com/antvis/x6/commit/774f547b85522eb2411dca949d36ecfe535503f3))

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-transform",
"version": "2.0.0",
"version": "2.1.0",
"description": "transform plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -27,6 +27,7 @@
"build:cjs": "rss",
"build:umd": "rss",
"build:dev": "rss",
"build:less": "rss",
"build:watch": "rss",
"build:watch:esm": "rss",
"build:watch:cjs": "rss",
@ -40,7 +41,7 @@
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.0.x"
"@antv/x6": "^2.x"
},
"author": {
"name": "bubkoo",

@ -0,0 +1,5 @@
import { TransformImpl } from './transform'
declare module '@antv/x6/lib/graph/events' {
interface EventArgs extends TransformImpl.EventArgs {}
}

@ -1,6 +1,7 @@
import { Basecoat, CssLoader, KeyValue, Node, Graph, EventArgs } from '@antv/x6'
import { TransformImpl } from './transform'
import { content } from './style/raw'
import './api'
export class Transform extends Basecoat<Transform.EventArgs> {
private graph: Graph

@ -1,16 +1 @@
# @antv/x6-react-components [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-react-components@1.0.1...@antv/x6-react-components@2.0.0) (2022-11-05)
### Documentation
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### Features
* sync some commit from v1 ([#2851](https://github.com/antvis/x6/issues/2851)) ([a772025](https://github.com/antvis/x6/commit/a7720251ff42f2892bff9c3cd5159932322362b1))
### BREAKING CHANGES
* dump to 2.0
## @antv/x6-react-components [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-react-components@2.0.0...@antv/x6-react-components@2.0.1) (2022-11-24)

@ -1,6 +1,6 @@
{
"name": "@antv/x6-react-components",
"version": "2.0.0",
"version": "2.0.1",
"description": "React components for building x6 editors",
"main": "lib/index.js",
"module": "es/index.js",
@ -62,14 +62,14 @@
"ua-parser-js": "^0.7.20"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"@types/react": "^18.0.25",
"@types/react-color": "^3.0.1",
"@types/react-dom": "^18.0.0",
"@types/react-resize-detector": "^5.0.0",
"@types/ua-parser-js": "^0.7.33",
"antd": "^4.4.2"
"antd": "^4.4.2",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"author": {
"name": "bubkoo",

@ -1,11 +0,0 @@
# @antv/x6-react-shape [2.0.0](https://github.com/antvis/x6/compare/@antv/x6-react-shape@1.0.1...@antv/x6-react-shape@2.0.0) (2022-11-05)
### Documentation
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### BREAKING CHANGES
* dump to 2.0

@ -43,8 +43,8 @@
"react-dom": "^18.0.0"
},
"devDependencies": {
"@antv/x6": "^2.0.x",
"@types/react": "^18.0.0",
"@antv/x6": "^2.x",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"

@ -3,7 +3,7 @@ import { Graph, Node } from '@antv/x6'
export type ReactShapeConfig = Node.Properties & {
shape: string
component: React.ComponentType
component: React.ComponentType<{ node: Node; graph: Graph }>
effect?: (keyof Node.Properties)[]
inherit?: string
}
@ -11,7 +11,7 @@ export type ReactShapeConfig = Node.Properties & {
export const shapeMaps: Record<
string,
{
component: React.ComponentType
component: React.ComponentType<{ node: Node; graph: Graph }>
effect?: (keyof Node.Properties)[]
}
> = {}

@ -26,7 +26,7 @@ export class ReactShapeView extends NodeView<ReactShape> {
const node = this.cell
if (container) {
const elem = React.createElement(Wrap, { node })
const elem = React.createElement(Wrap, { node, graph: node.model!.graph })
if (Portal.isActive()) {
const portal = createPortal(elem, container) as ReactPortal
Portal.connect(this.cell.id, portal)

@ -1,4 +1,5 @@
import React from 'react'
import { Graph } from '@antv/x6'
import { ReactShape } from './node'
import { shapeMaps } from './registry'
@ -23,10 +24,10 @@ export class Wrap extends React.PureComponent<Wrap.Props, Wrap.State> {
}
clone(elem: React.ReactElement) {
const { node } = this.props
const { node, graph } = this.props
return typeof elem.type === 'string'
? React.cloneElement(elem)
: React.cloneElement(elem, { node })
: React.cloneElement(elem, { node, graph })
}
render() {
@ -42,7 +43,7 @@ export class Wrap extends React.PureComponent<Wrap.Props, Wrap.State> {
return this.clone(component)
}
const FC = component
const FC = component as any
return this.clone(<FC />)
}
}
@ -54,5 +55,6 @@ export namespace Wrap {
export interface Props {
node: ReactShape
graph: Graph
}
}

@ -51,7 +51,7 @@
"vue": "^2.6.12 || ^3.0.0"
},
"devDependencies": {
"@antv/x6": "^2.0.x",
"@antv/x6": "^2.x",
"@vue/composition-api": "^1.0.0-rc.6",
"vue": "^2.6.12"
},

@ -1,16 +1,8 @@
# @antv/x6 [2.0.0](https://github.com/antvis/x6/compare/@antv/x6@1.0.1...@antv/x6@2.0.0) (2022-11-05)
## @antv/x6 [2.0.1](https://github.com/antvis/x6/compare/@antv/x6@2.0.0...@antv/x6@2.0.1) (2022-11-24)
### Documentation
### Bug Fixes
* refresh changelogs ([44f89a1](https://github.com/antvis/x6/commit/44f89a1e1a85513a9bf548be87be38e3cdc82574))
### Features
* sync some commit from v1 ([#2851](https://github.com/antvis/x6/issues/2851)) ([a772025](https://github.com/antvis/x6/commit/a7720251ff42f2892bff9c3cd5159932322362b1))
### BREAKING CHANGES
* dump to 2.0
* Cannot use "this" here: [#2824](https://github.com/antvis/x6/issues/2824) ([#2855](https://github.com/antvis/x6/issues/2855)) ([10347d0](https://github.com/antvis/x6/commit/10347d069b23e4cfaf156138a39e2f5f996f0e29))
* resize graph when scale scroller ([#2903](https://github.com/antvis/x6/issues/2903)) ([cee4aa4](https://github.com/antvis/x6/commit/cee4aa4e53b2821ed11d5602fccdb36625957c72))
* sync render when change position ([#2860](https://github.com/antvis/x6/issues/2860)) ([2194769](https://github.com/antvis/x6/commit/2194769e362ce60d19652b29047a394cac4077d0))

@ -1,6 +1,6 @@
{
"name": "@antv/x6",
"version": "2.0.0",
"version": "2.0.1",
"description": "JavaScript diagramming library that uses SVG and HTML for rendering",
"main": "lib/index.js",
"module": "es/index.js",

Some files were not shown because too many files have changed in this diff Show More