Compare commits

..

17 Commits

Author SHA1 Message Date
8e2616dfe1 feat: init vite 2022-12-19 22:21:22 +08:00
07f4739979 chore(release): release 1 package [skip ci]
[@antv/x6@2.1.0](https://www.npmjs.com/package/@antv/x6/v/2.1.0)
[@antv/x6@2.1.0](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.1.0)
2022-12-19 01:46:51 +00:00
824560ddda feat: add snapToGrid options for manhattan router (#3062)
* docs: update github url

* fix: debounce update to improve performance

* feat: add snapToGrid options for manhattan router
2022-12-19 09:36:17 +08:00
9e37ea9f78 fix: debounce update to improve performance (#3061)
* docs: update github url

* fix: debounce update to improve performance
2022-12-18 21:44:03 +08:00
610349d924 chore(release): release 3 packages [skip ci]
[@antv/x6@2.0.9](https://www.npmjs.com/package/@antv/x6/v/2.0.9)
[@antv/x6@2.0.9](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.0.9)

[@antv/x6-example-features@2.0.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-example-features%402.0.1)

[@antv/x6-sites@1.2.0](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.2.0)
2022-12-16 10:44:52 +00:00
2f92e33d0e fix: remove useless repo url 2022-12-16 18:33:03 +08:00
df540d9b79 chore: rename dir 2022-12-16 18:19:58 +08:00
3bc37971f8 chore: update deprecated terser plugin
Co-authored-by: NewByVector <vectorse@126.com>
2022-12-16 18:07:58 +08:00
50284c2d51 chore: update contributors [skip ci] 2022-12-16 08:44:49 +00:00
15284e778a fix: 🐛 char ghosting when edit text (#2560) (#3043)
* fix: 🐛 char ghosting when edit text (#2560)

* fix: 🐛 grammar style improvement
2022-12-16 16:44:28 +08:00
1a0e8cf969 docs: fix broken CI status badge 2022-12-16 15:44:05 +08:00
1089109b08 chore: update build:watch script (#3035) 2022-12-12 21:26:40 +08:00
faf294a5ec chore: only support react18 in 2.1.x (#3034) 2022-12-12 21:21:41 +08:00
25461fd985 docs: update vue demo (#3033)
* chore: refactor x6-site

* docs: update vue demo
2022-12-12 16:38:16 +08:00
35f2966219 chore: refactor x6-site (#3032)
* chore: refactor x6-site

* chore: fix ts lint and style lint error
2022-12-12 16:21:09 +08:00
26df790b8c chore: remove sites files (#3029) 2022-12-12 10:25:03 +08:00
bc7efe8db9 chore: update package version (#3028) 2022-12-11 20:15:16 +08:00
1500 changed files with 46525 additions and 93458 deletions

View File

@ -1,5 +1,5 @@
paths-ignore:
- sites/x6-sites/static
- sites/public
query-filters:
- exclude:
id: js/use-before-declaration

View File

@ -12,5 +12,5 @@ es/
lib/
dist/
coverage/
sites/x6-sites/static/demos
sites/public
csstype.ts

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 12 MiB

After

Width:  |  Height:  |  Size: 12 MiB

View File

@ -6,7 +6,7 @@
<p align="center"><strong>提供简单易用的节点定制能力和开箱即用的交互组件方便我们快速搭建流程图、DAG 图、ER 图等图应用</strong></p>
<p align="center">
<a href="https://github.com/antvis/X6/actions/workflows/ci.yml"><img alt="build" src="https://img.shields.io/github/workflow/status/antvis/x6/%F0%9F%91%B7%E3%80%80CI/master?logo=github&style=flat-square"></a>
<a href="https://github.com/antvis/X6/actions/workflows/ci.yml"><img alt="build" src="https://img.shields.io/github/actions/workflow/status/antvis/x6/ci.yml?branch=master&logo=github&style=flat-square"></a>
<!-- <a href="https://app.codecov.io/gh/antvis/X6"><img alt="coverage" src="https://img.shields.io/codecov/c/gh/antvis/x6?logo=codecov&style=flat-square&token=15CO54WYUV"></a> -->
<a href="https://lgtm.com/projects/g/antvis/x6/context:javascript"><img alt="Language grade: JavaScript" src="https://img.shields.io/lgtm/grade/javascript/g/antvis/x6.svg?logo=lgtm&style=flat-square"></a>
<a href="https://www.npmjs.com/package/@antv/x6"><img alt="NPM Package" src="https://img.shields.io/npm/v/@antv/x6.svg?style=flat-square"></a>

24
examples/vite-example/.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/antv.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>s</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>

View File

@ -0,0 +1,30 @@
{
"name": "@antv/vite-project",
"private": true,
"version": "2.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"prebuild": "rimraf dist",
"preview": "vite preview"
},
"dependencies": {
"lodash-es": "^4.17.15",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.0.0",
"react-router": "^6.5.0",
"react-router-dom": "^6.5.0"
},
"devDependencies": {
"@types/lodash-es": "^4.17.4",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@types/react-helmet": "^6.0.0",
"@vitejs/plugin-react-swc": "^3.0.0",
"less": "^4.1.1",
"typescript": "^4.9.3",
"vite": "^4.0.0"
}
}

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="28"><defs><linearGradient id="a" x1=".004%" x2="100.131%" y1="49.993%" y2="49.993%"><stop offset="0%" stop-color="#6500FF"/><stop offset="16%" stop-color="#6A09FF"/><stop offset="43%" stop-color="#7623FF"/><stop offset="77%" stop-color="#8A4CFF"/><stop offset="99%" stop-color="#996BFF"/></linearGradient><linearGradient id="b" x1="50.004%" x2="50.004%" y1="100.012%" y2="0%"><stop offset="0%" stop-color="#6500FF"/><stop offset="16%" stop-color="#6909FF"/><stop offset="43%" stop-color="#7523FF"/><stop offset="77%" stop-color="#894CFF"/><stop offset="99%" stop-color="#976BFF"/></linearGradient><linearGradient id="c" x1="49.854%" x2="49.854%" y1="100.255%" y2="0%"><stop offset="0%" stop-color="#FF6E06"/><stop offset="28%" stop-color="#FF770C"/><stop offset="75%" stop-color="#FF911C"/><stop offset="100%" stop-color="#FFA126"/></linearGradient><linearGradient id="d" x1="57351%" x2="57351%" y1="59860%" y2="35023%"><stop offset="0%" stop-color="#FF6E06"/><stop offset="28%" stop-color="#FF770C"/><stop offset="75%" stop-color="#FF911C"/><stop offset="100%" stop-color="#FFA126"/></linearGradient></defs><g fill="none" fill-rule="nonzero"><path fill="url(#a)" d="M1.955.004c-.029 0-.057 0-.088.002a1.41 1.41 0 0 0-.197.017A2.312 2.312 0 0 0 1.4.08a3.479 3.479 0 0 0-.179.061 3.768 3.768 0 0 0-.075.032l-.029.013-.057.028-.031.016L.98.257.95.275.91.298.883.317.825.355.79.381l-.03.022L.728.43.7.453C.68.468.662.483.645.5L.621.521.588.553l-.02.02A1.898 1.898 0 0 0 .46.691L.446.709.414.75A2.707 2.707 0 0 0 .348.84L.337.857.308.9l-.01.017L.29.931l3.784 2.214.801.855a.406.406 0 0 1-.019-.42.446.446 0 0 1 .37-.227H18.12c.045.003.09.005.137.005.961-.014 1.734-.758 1.737-1.674.002-.916-.765-1.664-1.726-1.683L1.955.004Z" transform="translate(.006)"/><path fill="url(#b)" d="m22.737 11.315-6.392 11.01a.438.438 0 0 1-.74.025l-4.063-6.995a1.724 1.724 0 0 0-.117-.23L4.667 3.459a2.32 2.32 0 0 1-.005-2.248A2.345 2.345 0 0 1 6.57.005L1.981.001A1.899 1.899 0 0 0 .908.294l-.1.068a2.405 2.405 0 0 0-.15.12A1.7 1.7 0 0 0 .462.69a1.797 1.797 0 0 0-.17.243 1.767 1.767 0 0 0-.028 1.9l.166.289 13.874 23.895a1.882 1.882 0 0 0 .793.776l.108.05a2.537 2.537 0 0 0 .18.069 2.14 2.14 0 0 0 .28.066 2.148 2.148 0 0 0 .19.02l.106.002c.04 0 .063 0 .086-.002a1.206 1.206 0 0 0 .19-.016 2.065 2.065 0 0 0 .27-.06 1.927 1.927 0 0 0 .168-.06l.089-.038.07-.036c.058-.03.073-.04.088-.048a2.596 2.596 0 0 0 .207-.142 1.851 1.851 0 0 0 .464-.537l.376-.64.081-.14 7.68-13.225a1.716 1.716 0 0 0 .047-1.75 1.74 1.74 0 0 0-3.039.01Z" transform="translate(.006)"/><path fill="url(#c)" d="M30.137 0h-6.459c-.935.018-1.684.847-1.684 1.863s.75 1.845 1.684 1.864c.046 0 .09-.003.134-.006h2.925c.214.032.374.23.374.465a.501.501 0 0 1-.025.157l-1.542 2.9c-.454.904-.147 2.036.685 2.53.832.492 1.874.159 2.328-.745l3.19-6c.029-.055.056-.111.08-.17l.003-.007c.015-.036.03-.072.043-.11l.002-.005.017-.052.008-.027c.008-.024.015-.048.021-.073l.012-.042.01-.04a2.826 2.826 0 0 0 .033-.191 2.31 2.31 0 0 0 .01-.077v-.011l.005-.09v-.022l.003-.091c0-1.115-.83-2.019-1.857-2.02Z" transform="translate(.006)"/><path fill="url(#d)" d="M19.881 7.41a.84.84 0 0 0-.725-.41h-6.325a.84.84 0 0 0-.725.41.804.804 0 0 0 0 .82l3.163 5.36a.84.84 0 0 0 .725.41.84.84 0 0 0 .725-.41l3.162-5.36a.804.804 0 0 0 0-.82Z" transform="translate(.006)"/></g></svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,72 @@
:root {
color: rgb(255 255 255 / 87%);
font-weight: 400;
font-size: 16px;
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
line-height: 24px;
background-color: #242424;
color-scheme: light dark;
font-synthesis: none;
text-rendering: optimizelegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-size-adjust: 100%;
}
a {
color: #646cff;
font-weight: 500;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
}
html,
body,
#root {
height: 100%;
}
button {
padding: 0.6em 1.2em;
font-weight: 500;
font-size: 1em;
font-family: inherit;
background-color: #1a1a1a;
border: 1px solid transparent;
border-radius: 8px;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #fff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

View File

@ -0,0 +1,14 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import { getRoutes } from './routes'
import './index.less'
const routes = getRoutes()
const router = createBrowserRouter(routes)
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<RouterProvider router={router} />
</React.StrictMode>,
)

View File

@ -0,0 +1,43 @@
.wrap {
position: relative;
display: flex;
flex-direction: row;
height: 100%;
}
.nav {
display: flex;
flex-direction: column;
width: 220px;
padding: 0 16px;
border-right: 1px solid #e9e9e9;
section {
flex: 1;
overflow-x: hidden;
overflow-y: auto;
> ul {
margin: 0;
padding: 0;
}
ul {
padding-left: 16px;
li {
line-height: 1.6;
list-style: none;
}
}
}
}
.content {
flex: 1;
box-sizing: border-box;
padding: 24px;
overflow-x: hidden;
overflow-y: auto;
background: #fff;
}

View File

@ -0,0 +1,57 @@
import React from 'react'
import { RouteObject } from 'react-router'
import { Outlet, NavLink } from 'react-router-dom'
import style from './_layout.module.less'
function renderLink(route: RouteObject, parentPath: string) {
let children = route.children
let indexRoute: RouteObject | null = null
if (children) {
children = children.slice()
const idx = children.findIndex((r) => r.index)
if (idx >= 0) {
indexRoute = children[idx]
children.splice(idx, 1)
}
}
const routeName = route.path
const routePath = `${parentPath}/${routeName}`
const element = indexRoute ? indexRoute.element : route.element
return (
<React.Fragment key={routePath}>
<li>
{element ? (
<NavLink
to={routePath}
className={({ isActive }) => (isActive ? 'active' : undefined)}
>
{routeName}
</NavLink>
) : (
routeName
)}
</li>
{children && <li>{renderLinks(children, routePath)}</li>}
</React.Fragment>
)
}
function renderLinks(routes: RouteObject[], parentPath = '') {
return <ul>{routes.map((route) => renderLink(route, parentPath))}</ul>
}
export default function Layout(props: { routes: RouteObject[] }) {
return (
<div className={style.wrap}>
<div className={style.nav}>
<h2>Examples</h2>
<section>{renderLinks(props.routes)}</section>
</div>
<div className={style.content}>
<Outlet />
</div>
</div>
)
}

View File

@ -0,0 +1,5 @@
import React from 'react'
export default function transition() {
return <div>transition</div>
}

View File

@ -0,0 +1,5 @@
import React from 'react'
export default function transition() {
return <div>auto-size</div>
}

View File

@ -0,0 +1,87 @@
import React from 'react'
import { set } from 'lodash-es'
import { RouteObject } from 'react-router'
import { Helmet } from 'react-helmet'
function parseRouteConfig() {
const modules = import.meta.glob(`/src/pages/**/*.tsx`)
const config: Record<string, any> = {}
Object.keys(modules).forEach((filePath) => {
const routeParts = filePath
.replace(/^\/src\/pages\//, '') // 去除 /src/pages
.replace(/.tsx$/, '') // 去除文件名后缀
.replace(/\[([\w-]+)]/, ':$1') // 转换动态路由 [foo].tsx => :foo
.split('/')
set(config, routeParts, modules[filePath])
})
return config
}
function wrapSuspense(
mod: () => Promise<{
default: React.ComponentType<{ routes?: RouteObject[] }>
}>,
routes?: RouteObject[],
title?: string,
) {
if (!mod) {
return undefined
}
const Component = React.lazy(mod)
// 结合 Suspense ,这里可以自定义 loading 组件
return (
<React.Suspense fallback={null}>
{title && (
<Helmet>
<title>{title}</title>
</Helmet>
)}
{title ? <Component /> : <Component routes={routes} />}
</React.Suspense>
)
}
function wrapLayout(
routePath: string,
routeConfig: Record<string, any>,
): RouteObject {
const { _layout, ...rest } = routeConfig
const routes = routeConfigToRoute(rest, routePath)
return {
path: routePath,
element: wrapSuspense(_layout, routes),
children: routes,
}
}
function routeConfigToRoute(
config: Record<string, any>,
parentPath: string,
): RouteObject[] {
return Object.entries(config).map(([routePath, child]) => {
// () => import() 语法判断
if (typeof child === 'function') {
// 等于 index 则映射为当前根路由
const isIndex = routePath === 'index'
return {
index: isIndex,
path: isIndex ? undefined : routePath,
// 转换为组件
element: wrapSuspense(
child,
undefined,
isIndex ? parentPath : `${parentPath}/${routePath}`,
),
}
}
// 否则为目录,则查找下一层级
return wrapLayout(routePath, child)
})
}
export function getRoutes(): RouteObject[] {
const routeConfig = parseRouteConfig()
return [wrapLayout('/', routeConfig)]
}

View File

@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})

View File

@ -1,3 +1,10 @@
## @antv/x6-example-features [2.0.1](https://github.com/antvis/X6/compare/@antv/x6-example-features@2.0.0...@antv/x6-example-features@2.0.1) (2022-12-16)
### Bug Fixes
* make resizing options take effect ([#3014](https://github.com/antvis/X6/issues/3014)) ([604c024](https://github.com/antvis/X6/commit/604c0244cd71ec8e911754dfe524f12c04e4e9ad))
# @antv/x6-example-features [2.0.0](https://github.com/antvis/X6/compare/@antv/x6-example-features@1.1.2...@antv/x6-example-features@2.0.0) (2022-11-24)

View File

@ -1,17 +1,18 @@
{
"private": true,
"name": "@antv/x6-example-features",
"version": "2.0.0",
"version": "2.0.1",
"scripts": {
"start": "umi dev",
"build": "umi build",
"lint": "eslint 'src/**/*.{js,ts}?(x)' --fix",
"precommit": "lint-staged"
"lint": "eslint 'src/**/*.{js,ts}?(x)' --fix"
},
"dependencies": {
"@antv/hierarchy": "^0.6.8",
"@antv/x6": "^2.x",
"@antv/x6-plugin-clipboard": "^2.x",
"@antv/x6-plugin-dnd": "^2.x",
"@antv/x6-plugin-export": "^2.x",
"@antv/x6-plugin-history": "^2.x",
"@antv/x6-plugin-keyboard": "^2.x",
"@antv/x6-plugin-minimap": "^2.x",
@ -20,42 +21,34 @@
"@antv/x6-plugin-snapline": "^2.x",
"@antv/x6-plugin-stencil": "^2.x",
"@antv/x6-plugin-transform": "^2.x",
"@antv/x6-plugin-export": "^2.x",
"@antv/x6-react-components": "^2.x",
"@antv/x6-react-shape": "^2.x",
"antd": "^4.4.2",
"classnames": "^2.2.6",
"dagre": "^0.8.5",
"elkjs": "^0.7.1",
"elkjs": "^0.8.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-helmet": "^6.0.0",
"@antv/hierarchy": "^0.6.8"
"react-helmet": "^6.0.0"
},
"devDependencies": {
"@ant-design/icons": "^4.2.2",
"@types/jest": "^25.2.1",
"@types/jest": "^29.2.4",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-helmet": "^6.0.0",
"@types/react-test-renderer": "^16.0.3",
"eslint": "^7.16.0",
"@types/react-test-renderer": "^18.0.0",
"babel-plugin-import": "^1.13.5",
"eslint": "^8.29.0",
"eslint-config-umi": "^1.4.0",
"eslint-plugin-flowtype": "^4.7.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.11.1",
"lint-staged": "^10.5.3",
"react-test-renderer": "^16.7.0",
"umi": "^2.9.0",
"umi-plugin-react": "^1.8.0",
"umi-types": "^0.3.0",
"babel-plugin-import": "^1.13.5"
},
"lint-staged": {
"src/**/*.ts": [
"eslint --fix"
]
"umi-types": "^0.3.0"
},
"engines": {
"node": ">=8.0.0"

View File

@ -15,7 +15,6 @@
"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",
"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",
@ -37,8 +36,8 @@
"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: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": {
@ -52,7 +51,7 @@
"prettier --write --ignore-unknown"
],
"*.less": [
"stylelint --syntax less --fix"
"stylelint --custom-syntax postcss-less --fix"
],
"*.js": [
"prettier --write"
@ -93,35 +92,35 @@
"@babel/plugin-syntax-flow": "^7.18.6",
"@babel/plugin-transform-react-jsx": "^7.19.0",
"@commitlint/config-conventional": "^17.3.0",
"@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-commonjs": "^23.0.5",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@rollup/plugin-typescript": "^8.2.5",
"@rollup/plugin-typescript": "^10.0.1",
"@semantic-release-monorepo/cli": "^2.1.2",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"@types/jasmine": "^4.3.0",
"@types/jest": "^29.2.3",
"@types/node": "^18.11.10",
"@types/jest": "^29.2.4",
"@types/node": "^18.11.15",
"@types/sinon": "^10.0.2",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"boxen": "^7.0.0",
"colors": "^1.4.0",
"coveralls": "^3.1.1",
"eslint": "^8.28.0",
"eslint": "^8.29.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^27.1.6",
"eslint-plugin-jest": "^27.1.7",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-unicorn": "^45.0.1",
"eslint-plugin-unicorn": "^45.0.2",
"fs-extra": "^11.1.0",
"husky": "^8.0.1",
"is-ci": "^3.0.0",
@ -131,26 +130,24 @@
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-jasmine": "^5.1.0",
"karma-spec-reporter": "^0.0.34",
"karma-spec-reporter": "^0.0.36",
"karma-typescript": "5.5.3",
"karma-typescript-es6-transform": "5.5.3",
"less": "^4.1.1",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.19",
"postcss-less": "^6.0.0",
"postcss": "^8.4.20",
"prettier": "^2.8.0",
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
"rollup": "^3.5.0",
"rollup": "^3.7.4",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-terser": "^7.0.2",
"run-shared-scripts": "^1.1.4",
"run-shared-scripts": "^1.1.5",
"semantic-release": "^19.0.5",
"sinon": "^15.0.0",
"sinon": "^15.0.1",
"stylelint": "^14.15.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-rational-order": "^0.1.2",
@ -162,5 +159,9 @@
"tslib": "^2.4.1",
"turbo": "^1.6.3",
"typescript": "^4.9.3"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.2.0",
"postcss-less": "^6.0.0"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-export",
"version": "2.1.4",
"version": "2.1.5",
"description": "export plugin for X6.",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -5,15 +5,15 @@ declare module '@antv/x6/lib/graph/graph' {
interface Graph {
toSVG: (
callback: Export.ToSVGCallback,
options: Export.ToSVGOptions,
options?: Export.ToSVGOptions,
) => void
toPNG: (
callback: Export.ToSVGCallback,
options: Export.ToImageOptions,
options?: Export.ToImageOptions,
) => void
toJPEG: (
callback: Export.ToSVGCallback,
options: Export.ToImageOptions,
options?: Export.ToImageOptions,
) => void
exportPNG: (fileName?: string, options?: Export.ToImageOptions) => void
exportJPEG: (fileName?: string, options?: Export.ToImageOptions) => void
@ -23,7 +23,7 @@ declare module '@antv/x6/lib/graph/graph' {
Graph.prototype.toSVG = function (
callback: Export.ToSVGCallback,
options: Export.ToSVGOptions,
options?: Export.ToSVGOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {
@ -33,7 +33,7 @@ Graph.prototype.toSVG = function (
Graph.prototype.toPNG = function (
callback: Export.ToSVGCallback,
options: Export.ToImageOptions,
options?: Export.ToImageOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {
@ -43,7 +43,7 @@ Graph.prototype.toPNG = function (
Graph.prototype.toJPEG = function (
callback: Export.ToSVGCallback,
options: Export.ToImageOptions,
options?: Export.ToImageOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {

View File

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-scroller",
"version": "2.0.5",
"version": "2.0.7",
"description": "scroller plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",

View File

@ -47,6 +47,7 @@ export class ScrollerImpl extends View<ScrollerImpl.EventArgs> {
super()
this.options = ScrollerImpl.getOptions(options)
this.onUpdate = FunctionExt.debounce(this.onUpdate, 200)
const scale = this.graph.transform.getScale()
this.sx = scale.sx

View File

@ -1,6 +1,6 @@
{
"name": "@antv/x6-react-shape",
"version": "2.0.7",
"version": "2.1.0",
"description": "X6 shape for rendering react components.",
"main": "lib/index.js",
"module": "es/index.js",
@ -39,8 +39,8 @@
},
"peerDependencies": {
"@antv/x6": "^2.x",
"react": ">=16.8.6 || >=17.0.0 || >=18.0.0",
"react-dom": ">=16.8.6 || >=17.0.0 || >= 18.0.0"
"react": ">=18.0.0",
"react-dom": ">= 18.0.0"
},
"devDependencies": {
"@antv/x6": "^2.x",

View File

@ -1,14 +1,11 @@
import React, { ReactPortal, version as reactVersion } from 'react'
import ReactDOM, { createPortal } from 'react-dom'
import type { Root, createRoot as CreateRoot } from 'react-dom/client'
import React, { ReactPortal } from 'react'
import { createPortal } from 'react-dom'
import { createRoot, Root } from 'react-dom/client'
import { Dom, NodeView } from '@antv/x6'
import { ReactShape } from './node'
import { Portal } from './portal'
import { Wrap } from './wrap'
const [, major] = /^(\d+)\.\d+\.\d+$/.exec(reactVersion)!
const reactMajor = Number(major)
const isPreEighteen = reactMajor < 18
export class ReactShapeView extends NodeView<ReactShape> {
root?: Root
@ -37,28 +34,17 @@ export class ReactShapeView extends NodeView<ReactShape> {
const portal = createPortal(elem, container) as ReactPortal
Portal.connect(this.cell.id, portal)
} else {
if (isPreEighteen) {
ReactDOM.render(elem, container)
} else {
// eslint-disable-next-line
const createRoot = require('react-dom/client')
.createRoot as typeof CreateRoot
this.root = createRoot(container)
this.root.render(elem)
}
this.root = createRoot(container)
this.root.render(elem)
}
}
}
protected unmountReactComponent() {
const container = this.getComponentContainer()
if (container) {
if (isPreEighteen) {
ReactDOM.unmountComponentAtNode(container)
} else if (this.root) {
this.root.unmount()
this.root = undefined
}
if (container && this.root) {
this.root.unmount()
this.root = undefined
}
}

View File

@ -1,3 +1,17 @@
# @antv/x6 [2.1.0](https://github.com/antvis/x6/compare/@antv/x6@2.0.9...@antv/x6@2.1.0) (2022-12-19)
### Features
* add snapToGrid options for manhattan router ([#3062](https://github.com/antvis/x6/issues/3062)) ([824560d](https://github.com/antvis/x6/commit/824560ddda7016158cce3166773e1af009bfe498))
## @antv/x6 [2.0.9](https://github.com/antvis/x6/compare/@antv/x6@2.0.8...@antv/x6@2.0.9) (2022-12-16)
### Bug Fixes
* :bug: char ghosting when edit text ([#2560](https://github.com/antvis/x6/issues/2560)) ([#3043](https://github.com/antvis/x6/issues/3043)) ([15284e7](https://github.com/antvis/x6/commit/15284e778a09f4f2e5a8f777330744b0cfe88e9e))
## @antv/x6 [2.0.8](https://github.com/antvis/x6/compare/@antv/x6@2.0.7...@antv/x6@2.0.8) (2022-12-08)

View File

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

View File

@ -12,3 +12,5 @@ export * from './edge-anchor'
export * from './connection-point'
export * from './router'
export * from './connector'
export * from './registry'

View File

@ -71,15 +71,17 @@ export class ObstacleMap {
const mapGridSize = this.mapGridSize
model.getNodes().reduce((map, node) => {
const shape = node.shape
const excludeShapes = options.excludeShapes
const excType = shape ? excludeShapes.includes(shape) : false
const excTerminal = excludedTerminals.some((cell) => cell.id === node.id)
const excNode = options.excludeNodes.includes(node)
const excAncestor = excludedAncestors.includes(node.id)
const excHidden = options.excludeHiddenNodes && !node.isVisible()
const excluded =
excType || excTerminal || excNode || excAncestor || excHidden
const excludedTerminal = excludedTerminals.some(
(cell) => cell.id === node.id,
)
const excludedNode = options.excludeNodes.some((item) => {
if (typeof item === 'string') {
return node.id === item
}
return item === node
})
const excludedAncestor = excludedAncestors.includes(node.id)
const excluded = excludedTerminal || excludedNode || excludedAncestor
if (!excluded) {
const bbox = node.getBBox().moveAndExpand(options.paddingBox)

View File

@ -41,20 +41,10 @@ export interface ResolvedOptions {
*/
excludeTerminals: Edge.TerminalType[]
/**
* Should certain types of nodes not be considered as obstacles?
*/
excludeShapes: string[]
/**
* Should certain hidden nodes not be considered as obstacles?
*/
excludeHiddenNodes: boolean
/**
* Should certain nodes not be considered as obstacles?
*/
excludeNodes: Node[]
excludeNodes: (Node | string)[]
/**
* Possible starting directions from a node.
@ -132,6 +122,9 @@ export interface ResolvedOptions {
) => Point[] | null
previousDirectionAngle?: number | null
// Whether the calculation results are aligned with the grid
snapToGrid?: boolean
}
export type ManhattanRouterOptions = {
@ -145,9 +138,7 @@ export const defaults: ManhattanRouterOptions = {
maxDirectionChange: 90,
perpendicular: true,
excludeTerminals: [],
excludeShapes: [], // ['text']
excludeNodes: [],
excludeHiddenNodes: false,
startDirections: ['top', 'right', 'bottom', 'left'],
endDirections: ['top', 'right', 'bottom', 'left'],
directionMap: {
@ -195,6 +186,7 @@ export const defaults: ManhattanRouterOptions = {
fallbackRouter: orth,
draggingRouter: null,
snapToGrid: true,
}
export function resolve<T>(

View File

@ -282,7 +282,7 @@ export const router: Router.Definition<ManhattanRouterOptions> = function (
)
const oldVertices = vertices.map((p) => Point.create(p))
const newVertices: Point[] = []
let newVertices: Point[] = []
// The origin of first route's grid, does not need snapping
let tailPoint = sourceEndpoint
@ -350,5 +350,12 @@ export const router: Router.Definition<ManhattanRouterOptions> = function (
newVertices.push(...partialRoute)
}
if (options.snapToGrid) {
newVertices = newVertices.map((vertice) => {
const gridSize = edgeView.graph.grid.getGridSize()
return vertice.snapToGrid(gridSize)
})
}
return newVertices
}

View File

@ -94,6 +94,9 @@ export class CellEditor extends ToolsView.ToolItem<
}
editor.innerText = text || ''
// clear display value when edit status because char ghosting.
this.setCellText('')
return this
}
@ -102,15 +105,7 @@ export class CellEditor extends ToolsView.ToolItem<
const cell = this.cell
const value = this.editor.innerText.replace(/\n$/, '') || ''
// set value
const setText = this.options.setText
if (typeof setText === 'function') {
FunctionExt.call(setText, this.cellView, {
cell: this.cell,
value,
index: this.labelIndex,
distance: this.distance,
})
}
this.setCellText(value)
// remove tool
cell.removeTool(cell.isEdge() ? 'edge-editor' : 'node-editor')
this.undelegateDocumentEvents()
@ -141,6 +136,18 @@ export class CellEditor extends ToolsView.ToolItem<
selection.addRange(range)
}
}
setCellText(value: string) {
const setText = this.options.setText
if (typeof setText === 'function') {
FunctionExt.call(setText, this.cellView, {
cell: this.cell,
value,
index: this.labelIndex,
distance: this.distance,
})
}
}
}
export namespace CellEditor {

45518
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
packages:
- packages/*
# - examples/*
# - 'sites/*'
- examples/*
- 'sites/*'

View File

@ -2,7 +2,7 @@ import fs from 'fs'
import path from 'path'
import _ from 'lodash'
import colors from 'colors/safe.js'
import { terser } from 'rollup-plugin-terser'
import terser from '@rollup/plugin-terser'
import replace from '@rollup/plugin-replace'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
@ -37,8 +37,8 @@ function makeOutput() {
return output
}
export function config(config) {
let { plugins = [], output, external = [], ...others } = config || {}
export function config(config = {}) {
let { plugins = [], output, external = [], ...others } = config
if (output == null) {
output = makeOutput()
}
@ -74,10 +74,10 @@ export function config(config) {
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('production'),
}),
terser(),
terser({ sourceMap: true }),
filesize({
reporter: [
function (options, bundle, result) {
async (options, bundle, result) => {
return import('boxen').then((mod) => {
const boxen = mod.default
const primaryColor = options.theme === 'dark' ? 'green' : 'black'

View File

@ -1,3 +0,0 @@
#!/bin/sh
(cd sites/x6-sites && yarn build)

View File

@ -0,0 +1,88 @@
---
title: Quickstart
order: 1
redirect_from:
- /en/docs
- /en/docs/tutorial
---
## Installation
X6 is published on npm as @antv/x6.
```shell
# npm
$ npm install @antv/x6 --save
# yarn
$ yarn add @antv/x6
```
If using the umd package, you can use any of the following CDN.
- https://unpkg.com/@antv/x6/dist/index.js
- https://cdn.jsdelivr.net/npm/@antv/x6/dist/index.js
- https://cdnjs.cloudflare.com/ajax/libs/antv-x6/2.0.0/index.js
## Basic Usage
It's recommended to learn [SVG Basics](https://codepen.io/HunorMarton/full/PoGbgqj) before you begin, and with some basic SVG knowledge in mind, let's start with a simple example to play with X6.
### 1. Init Graph
Creating a graph container on the page and then initializing the graph object, then you can set the graph style through configuration, such as the background color.
```html
<div id="container"></div>
```
```ts
import { Graph } from "@antv/x6";
const graph = new Graph({
container: document.getElementById("container"),
width: 800,
height: 600,
background: {
color: "#F2F7FA",
},
});
```
### 2. Render nodes and edges
X6 supports json data, you can also use the `attrs` attribute to customize the styles of nodes and edges (like `CSS`).
<code id="helloworld" src="@/src/tutorial/getting-started/helloworld/index.tsx"></code>
### 3. Using the React Node
X6 supports using `SVG` and `HTML` to render node content. On this basis, we can also use `React` and `Vue` components to render nodes, which will be very convenient in the development process.
For example, we have a new requirement: add a right-click menu to the node. It would be more complicated to implement using `SVG`, We can easily implement it with react node. We can use the React render package `@antv/x6-react-shape` that comes with X6.
<code id="react-shape" src="@/src/tutorial/getting-started/react-shape/index.tsx"></code>
### 4. Using the Plugins
In addition to the basic element rendering capabilities, X6 also comes with a large number of built-in plugins for graph editing. Using these mature plugins, we can improve the development efficiency. For example, we add a snapline plugin to the graph, when a moving node is aligned with other nodes, the snapline will automatically appear.
```ts
import { Snapline } from "@antv/x6-plugin-snapline";
graph.use(
new Snapline({
enabled: true,
})
);
```
<code id="use-plugin" src="@/src/tutorial/getting-started/use-plugin/index.tsx"></code>
### 5. Export the Data
In addition to using `fromJSON` to render JSON data to the graph, of course, there is also support for exporting the data from the graph width `toJSON`, so that we can serialize the graph data and store it to the server.
```ts
graph.toJSON();
```

View File

@ -1,728 +0,0 @@
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-21)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([31f8960](https://github.com/antvis/x6/commit/31f8960e72b0567bb13683e51db8b97207604c0b))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-08)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-08)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-07)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-05)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-03)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-01)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-22)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-19)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-12)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-12)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-08)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-02)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-02)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-01)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-01)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-01)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-01)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-09-30)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.3](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.2...@antv/x6-sites-demos-helper@1.2.3) (2021-09-23)
### Bug Fixes
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-09-22)
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-09-13)
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-17)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-16)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-15)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-15)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-11)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-09)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-09)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-07)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-07)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-02)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-02)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-01)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-31)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-31)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-31)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-30)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-30)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-30)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-27)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-18)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-18)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-12)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-08)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-07)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-07)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-06)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-04)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-01)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-01)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-30)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-30)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-30)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-28)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-28)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-28)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-26)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-21)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-17)
### Bug Fixes
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-13)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-01)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-30)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-30)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-29)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-28)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-25)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-24)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-24)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-24)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-24)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-23)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-23)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-23)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-23)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-20)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-19)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-19)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-16)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-15)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-15)
### Bug Fixes
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-03-02)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-23)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-23)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-22)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-20)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-09)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-07)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-07)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-05)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-05)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-04)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-03)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-03)
### Features
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
## @antv/x6-sites-demos-helper [0.11.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.11.0...@antv/x6-sites-demos-helper@0.11.1) (2021-01-13)
# @antv/x6-sites-demos-helper [0.11.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.80...@antv/x6-sites-demos-helper@0.11.0) (2021-01-12)
### Features
* ✨ auto update dependencies in workspace ([c255b41](https://github.com/antvis/x6/commit/c255b410099c607f535fa359d66f61b4ddaf59d9))
# @antv/x6-sites-demos-helper [0.11.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.80...@antv/x6-sites-demos-helper@0.11.0) (2021-01-11)
### Features
* ✨ auto update dependencies in workspace ([c255b41](https://github.com/antvis/x6/commit/c255b410099c607f535fa359d66f61b4ddaf59d9))
## @antv/x6-sites-demos-helper [0.11.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.11.0...@antv/x6-sites-demos-helper@0.11.1) (2021-01-11)
# @antv/x6-sites-demos-helper [0.11.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.82...@antv/x6-sites-demos-helper@0.11.0) (2020-12-25)
### Features
* ✨ auto update dependencies in workspace ([c255b41](https://github.com/antvis/x6/commit/c255b410099c607f535fa359d66f61b4ddaf59d9))
## @antv/x6-sites-demos-helper [0.10.82](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.81...@antv/x6-sites-demos-helper@0.10.82) (2020-12-21)
## @antv/x6-sites-demos-helper [0.10.81](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.80...@antv/x6-sites-demos-helper@0.10.81) (2020-12-07)
## @antv/x6-sites-demos-helper [0.10.80](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.79...@antv/x6-sites-demos-helper@0.10.80) (2020-11-20)
### chore
* 🛠️ init changelog ([6c38b3c](https://github.com/antvis/x6/commit/6c38b3c74c0d603b4e8a50c7ad32e38292d2639b))
### BREAKING CHANGES
* force release 1.0

View File

@ -1,128 +0,0 @@
const fs = require('fs')
const path = require('path')
const fse = require('fs-extra')
module.exports = () => {
if (this.cacheable) {
this.cacheable()
}
const repo = fs.realpathSync(process.cwd())
const parts = repo.split('/')
const index = parts.indexOf('sites')
const dirname = parts.slice(index).join('/')
const host = `https://github.com/antvis/X6/tree/master/${dirname}`
const pkg = fse.readJsonSync(path.join(repo, 'package.json'))
const excluedDeps = ['codesandbox', '@antv/x6-sites-demos-helper']
const excludeDirs = ['node_modules']
const excludeFiles = [
'.env',
'.DS_Store',
'package.json',
'yarn-error.log',
'src/react-app-env.d.ts',
'src/data.ts',
'src/toolbar.css',
'src/toolbar.tsx',
]
const result = { files: {} }
function updatePackageJson() {
delete pkg.name
delete pkg.version
delete pkg.private
excluedDeps.forEach((dep) => {
delete pkg.dependencies[dep]
delete pkg.devDependencies[dep]
})
pkg.scripts = {
start: 'react-scripts start',
build: 'react-scripts build',
test: 'react-scripts test',
eject: 'react-scripts eject',
}
result.files['package.json'] = {
isBinary: false,
content: JSON.stringify(pkg, null, 2),
}
}
function getEntry() {
return `import React from 'react'
import ReactDOM from 'react-dom'
import App from './app'
ReactDOM.render(<App />, document.getElementById('root'))`
}
function readFiles(dir, parent) {
const files = fs.readdirSync(dir)
if (files) {
files.forEach((filename) => {
const filepath = path.join(dir, filename)
const child = path.join(parent || '', filename)
const stats = fs.statSync(filepath)
if (stats) {
if (stats.isDirectory() && !excludeDirs.includes(child)) {
readFiles(filepath, child)
} else if (stats.isFile() && !excludeFiles.includes(child)) {
const key = path.relative(repo, filepath)
let content = fs.readFileSync(filepath, { encoding: 'utf8' })
if (child === 'src/index.tsx') {
content = getEntry()
}
result.files[key] = { content, isBinary: false }
}
}
})
}
}
// stackblitz
// ----------
function getStackblitzPrefillConfig() {
const idx = parts.indexOf('packages')
const title = parts.slice(idx + 1).join('/')
const config = {
title: title || '',
description: '',
template: 'create-react-app',
dependencies: pkg.dependencies,
files: {},
}
Object.keys(result.files).forEach((name) => {
const item = result.files[name]
config.files[name] = item.content
})
return config
}
// return
// ------
updatePackageJson()
readFiles(repo)
return `
export const host = '${host}'
export function getCodeSandboxParams () {
return ${JSON.stringify(result)}
}
export function getStackblitzPrefillConfig () {
return ${JSON.stringify(getStackblitzPrefillConfig())}
}
`
}

View File

@ -1,65 +0,0 @@
{
"private": true,
"name": "@antv/x6-sites-demos-helper",
"version": "2.0.0",
"main": "lib/index.js",
"module": "es/index.js",
"types": "lib/index.d.ts",
"bin": {
"config": "./scripts/config.js",
"static": "./scripts/static.js",
"prepare": "./scripts/prepare.js",
"speedup": "./scripts/speedup.js"
},
"scripts": {
"clean": "rimraf es lib",
"lint": "run-s lint:ts lint:style",
"lint:ts": "eslint 'src/**/*.{js,ts}?(x)' --fix",
"lint:style": "stylelint 'src/**/*.less' --syntax less --fix",
"build:esm": "tsc --module esnext --target es2015 --outDir ./es",
"build:cjs": "tsc --module commonjs --target es5 --outDir ./lib",
"build:less": "node ./scripts/style",
"build:watch": "run-s 'build:esm --w'",
"build:watch:esm": "run-s 'build:esm --w'",
"build:watch:cjs": "run-s 'build:cjs --w'",
"build:dev": "run-p build:cjs build:esm build:less",
"build": "run-p build:cjs build:esm build:less",
"prebuild": "run-s lint clean"
},
"lint-staged": {
"src/**/*.ts": [
"eslint --fix"
],
"src/**/*.less": [
"stylelint --syntax less --fix"
]
},
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@stackblitz/sdk": "^1.4.0",
"antd": "^5.0.0",
"chalk": "^4.1.0",
"codesandbox": "^2.2.1",
"folder-hash": "^3.3.2",
"ora": "^5.0.0",
"react-helmet": "^6.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-helmet": "^6.0.0",
"@types/node": "^16.9.1",
"fs-extra": "^10.0.0",
"less": "^4.1.1",
"lint-staged": "^11.1.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.4.0",
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
"ts-node": "^10.2.1",
"typescript": "^4.4.3"
},
"license": "MIT"
}

View File

@ -1,288 +0,0 @@
<div
id="loading"
style="
position: absolute;
left: 0;
top: 0;
z-index: 9999;
width: 100%;
height: 100%;
background-color: #fff;
border: 1px solid #f0f0f0;
"
>
<style>
.loader {
--duration: 3s;
width: 44px;
height: 44px;
position: relative;
display: inline-block;
margin: 0 16px;
}
.loader:before {
content: ' ';
width: 6px;
height: 6px;
border-radius: 50%;
position: absolute;
display: block;
background: #ff700a;
top: 37px;
left: 19px;
-webkit-transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
-webkit-animation: dotRect var(--duration)
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
animation: dotRect var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86)
infinite;
}
.loader svg {
display: block;
width: 100%;
height: 100%;
}
.loader svg rect,
.loader svg polygon,
.loader svg circle {
fill: none;
stroke-width: 10px;
stroke-linejoin: round;
stroke-linecap: round;
}
.loader svg polygon {
stroke-dasharray: 145 76 145 76;
stroke-dashoffset: 0;
-webkit-animation: pathTriangle var(--duration)
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
animation: pathTriangle var(--duration)
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}
.loader svg rect {
stroke-dasharray: 192 64 192 64;
stroke-dashoffset: 0;
-webkit-animation: pathRect 3s cubic-bezier(0.785, 0.135, 0.15, 0.86)
infinite;
animation: pathRect 3s cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}
.loader svg circle {
stroke-dasharray: 150 50 150 50;
stroke-dashoffset: 75;
-webkit-animation: pathCircle var(--duration)
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
animation: pathCircle var(--duration)
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}
.loader.triangle {
width: 48px;
}
.loader.triangle:before {
left: 21px;
-webkit-transform: translate(-10px, -18px);
transform: translate(-10px, -18px);
-webkit-animation: dotTriangle var(--duration)
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
animation: dotTriangle var(--duration)
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
}
@-webkit-keyframes pathTriangle {
33% {
stroke-dashoffset: 74;
}
66% {
stroke-dashoffset: 147;
}
100% {
stroke-dashoffset: 221;
}
}
@keyframes pathTriangle {
33% {
stroke-dashoffset: 74;
}
66% {
stroke-dashoffset: 147;
}
100% {
stroke-dashoffset: 221;
}
}
@-webkit-keyframes dotTriangle {
33% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
66% {
-webkit-transform: translate(10px, -18px);
transform: translate(10px, -18px);
}
100% {
-webkit-transform: translate(-10px, -18px);
transform: translate(-10px, -18px);
}
}
@keyframes dotTriangle {
33% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
66% {
-webkit-transform: translate(10px, -18px);
transform: translate(10px, -18px);
}
100% {
-webkit-transform: translate(-10px, -18px);
transform: translate(-10px, -18px);
}
}
@-webkit-keyframes pathRect {
25% {
stroke-dashoffset: 64;
}
50% {
stroke-dashoffset: 128;
}
75% {
stroke-dashoffset: 192;
}
100% {
stroke-dashoffset: 256;
}
}
@keyframes pathRect {
25% {
stroke-dashoffset: 64;
}
50% {
stroke-dashoffset: 128;
}
75% {
stroke-dashoffset: 192;
}
100% {
stroke-dashoffset: 256;
}
}
@-webkit-keyframes dotRect {
25% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
50% {
-webkit-transform: translate(18px, -18px);
transform: translate(18px, -18px);
}
75% {
-webkit-transform: translate(0, -36px);
transform: translate(0, -36px);
}
100% {
-webkit-transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
}
}
@keyframes dotRect {
25% {
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
}
50% {
-webkit-transform: translate(18px, -18px);
transform: translate(18px, -18px);
}
75% {
-webkit-transform: translate(0, -36px);
transform: translate(0, -36px);
}
100% {
-webkit-transform: translate(-18px, -18px);
transform: translate(-18px, -18px);
}
}
@-webkit-keyframes pathCircle {
25% {
stroke-dashoffset: 125;
}
50% {
stroke-dashoffset: 175;
}
75% {
stroke-dashoffset: 225;
}
100% {
stroke-dashoffset: 275;
}
}
@keyframes pathCircle {
25% {
stroke-dashoffset: 125;
}
50% {
stroke-dashoffset: 175;
}
75% {
stroke-dashoffset: 225;
}
100% {
stroke-dashoffset: 275;
}
}
.loading-text {
text-align: center;
height: 40px;
line-height: 40px;
font-size: 12px;
letter-spacing: 0.1em;
color: #666;
}
</style>
<div
style="
display: inline-block;
position: absolute;
left: 50%;
top: 50%;
margin: -50px 0 0 -120px;
"
>
<div class="loader">
<svg viewBox="0 0 80 80">
<defs>
<linearGradient
id="gradient"
x1=".004%"
x2="100.131%"
y1="49.993%"
y2="49.993%"
>
<stop offset="0%" stop-color="#6500FF"></stop>
<stop offset="16%" stop-color="#6A09FF"></stop>
<stop offset="43%" stop-color="#7623FF"></stop>
<stop offset="77%" stop-color="#8A4CFF"></stop>
<stop offset="99%" stop-color="#996BFF"></stop>
</linearGradient>
</defs>
<circle
id="test"
cx="40"
cy="40"
r="32"
stroke="url(#gradient)"
></circle>
</svg>
</div>
<div class="loader triangle">
<svg viewBox="0 0 86 80">
<polygon points="43 8 79 72 7 72" stroke="url(#gradient)"></polygon>
</svg>
</div>
<div class="loader">
<svg viewBox="0 0 80 80">
<rect x="8" y="8" width="64" height="64" stroke="url(#gradient)"></rect>
</svg>
</div>
<div class="loading-text">
<p>Loading...</p>
</div>
</div>
</div>

View File

@ -1,49 +0,0 @@
#!/usr/bin/env node
const path = require('path')
const fse = require('fs-extra')
const cwd = process.cwd()
const parts = cwd.split('/')
const index = parts.indexOf('packages')
if (index > 0) {
// rename
const name = parts.slice(index + 1).join('.')
const pkgpath = path.join(cwd, 'package.json')
const pkg = fse.readJsonSync(pkgpath)
if (pkg) {
pkg.name = `@antv/x6-sites-demos-${name}`
}
fse.writeJsonSync(pkgpath, pkg, { spaces: 2 })
// add dependencies to root package.json
const root = parts.slice(0, index).join('/')
const wspath = path.join(root, 'package.json')
const workspace = fse.readJsonSync(wspath)
const dependencies = workspace.dependencies || {}
let updated = false
function updateWorkspace(deps) {
if (deps != null) {
Object.keys(deps).forEach((name) => {
if (!dependencies[name]) {
dependencies[name] = deps[name]
updated = true
}
})
}
}
updateWorkspace(pkg.dependencies)
updateWorkspace(pkg.devDependencies)
updateWorkspace(pkg.peerDependencies)
updateWorkspace(pkg.optionalDependencies)
if (updated) {
workspace.dependencies = {}
Object.keys(dependencies)
.sort()
.forEach((name) => (workspace.dependencies[name] = dependencies[name]))
fse.writeJsonSync(wspath, workspace, { spaces: 2 })
}
}

View File

@ -1,55 +0,0 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const repo = fs.realpathSync(process.cwd())
const parts = repo.split('/')
const index = parts.indexOf('packages')
const root = index >= 0 ? parts.slice(0, index).join('/') : repo
const configDir = 'node_modules/react-scripts/config'
const configFile = path.join(root, configDir, 'webpack.config.js')
let content = fs.readFileSync(configFile, { encoding: 'utf8' })
const esbuild = `const ESBuildPlugin = require('esbuild-webpack-plugin').default;`
// 修改 node_modules 下 react-scripts 的配置文件来提升 DEMO 的构建速度
if (content.indexOf(esbuild) === -1) {
content =
esbuild +
content
// optimization
.replace(
/(new\s+TerserPlugin[\s\S]*)(new\s+OptimizeCSSAssetsPlugin)/gm,
`new ESBuildPlugin(),\n $2`,
)
// 禁止生成 manifest
.replace('new ManifestPlugin({', 'false && new ManifestPlugin({')
// 禁止生成 worker
.replace(
'new WorkboxWebpackPlugin.GenerateSW({',
`false && new WorkboxWebpackPlugin.GenerateSW({`,
)
if (process.env.CI !== 'true') {
// 本地构建时,将 node_modules/.cache 缓存文件保存为全局缓存。
content = content
.replace(
'module.exports =',
`
const appName = paths.appPath.replace(/\\//g, '.');
const webpackCacheDir = path.join(process.env['HOME'], '.webpack/cache', appName);
module.exports =`,
)
.replace(
/cacheDirectory:\s*true,/g,
`cacheDirectory: path.join(webpackCacheDir, 'babel-loader'),`,
)
.replace(
'eslintPath: ',
`cache: path.join(webpackCacheDir, 'eslint-loader'),
eslintPath: `,
)
}
fs.writeFileSync(configFile, content, { encoding: 'utf8' })
}

View File

@ -1,87 +0,0 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const fse = require('fs-extra')
const ora = require('ora')
const cp = require('child_process')
const chalk = require('chalk')
const { hashElement } = require('folder-hash')
const repo = fs.realpathSync(process.cwd())
const parts = repo.split('/')
const index = parts.indexOf('packages')
const dir = parts.slice(index + 1).join('/')
const name = parts.slice(index + 1).join('.')
const root = parts.slice(0, index).join('/')
const home = path.resolve(root, '../../')
const staticDir = path.join(root, '../../sites/x6-sites/static/demos')
const sourceDir = path.join(repo, 'build')
const targetDir = path.join(staticDir, dir)
const indexFile = path.join(targetDir, 'index.html')
const regex = /<meta\s+name="hash"\s+content="(.*?)"\s*\/>/
const readfile = (file) => fs.readFileSync(file, { encoding: 'utf8' })
const writefile = (file, content) =>
fs.writeFileSync(file, content, { encoding: 'utf8' })
const loading = readfile(path.join(__dirname, './loading.html'))
function getHash() {
return Promise.all([
hashElement(repo, {
folders: {
include: ['src'],
exclude: ['.*', 'node_modules', 'build'],
},
}),
hashElement(path.join(home, 'sites/x6-sites-demos-helper'), {
folders: {
include: ['src', 'loaders'],
exclude: ['.*', 'node_modules', 'es', 'lib', 'scripts'],
},
}),
hashElement(path.join(home, 'packages/x6/package.json')),
])
.then((arr) => arr.map((item) => item.hash).join(' '))
.then((hash) => Buffer.from(hash).toString('base64'))
}
function exec(hashcode) {
let changed = true
if (fs.existsSync(indexFile)) {
const content = readfile(indexFile)
const match = content.match(regex)
const previous = match && match[1]
changed = previous !== hashcode
}
const pkg = `@antv/x6-sites-demos-${name}`
const msg = `${chalk.green('✔')} Deployed "${pkg}"`
if (changed) {
const spinner = ora(`Deploying "${pkg}"`).start()
cp.exec('yarn build', { cwd: repo }, (err, stdout) => {
if (err) {
spinner.stop()
console.error(stdout)
} else {
fse.emptyDirSync(targetDir)
fse.moveSync(sourceDir, targetDir, { overwrite: true })
const raw = readfile(indexFile)
const title = `<meta name="hash" content="${hashcode}"/><title>${dir}</title>`
const wrap = '<div id="root"></div>'
const html = raw
.replace(/<title>(.*)<\/title>/, title)
.replace(wrap, `${wrap}\n${loading}`)
writefile(indexFile, html)
spinner.stop()
console.log(msg)
}
})
} else {
console.log(msg)
}
}
getHash().then(exec)

View File

@ -1,59 +0,0 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const fse = require('fs-extra')
const cp = require('child_process')
const os = require('os')
function compile(source, target) {
let cmd = './node_modules/.bin/lessc'
if (os.type() === 'Windows_NT') {
const cwd = process.cwd()
cmd = path.join(cwd, './node_modules/.bin/lessc.cmd')
}
cp.execFileSync(cmd, [source, target])
}
const cwd = process.cwd()
const es = path.join(cwd, 'es')
const lib = path.join(cwd, 'lib')
const src = path.join(cwd, 'src')
function toCSSPath(source) {
const dir = path.dirname(source)
const file = path.basename(source, '.less') + '.css'
return path.join(dir, file)
}
// Copy less files
function readdir(dir) {
const stat = fs.statSync(dir)
if (stat) {
if (stat.isDirectory()) {
fs.readdir(dir, (err, files) => {
files.forEach((file) => {
readdir(path.join(dir, file))
})
})
} else {
const ext = path.extname(dir)
if (ext === '.less' || ext === '.css') {
fse.copySync(dir, path.join(es, path.relative(src, dir)))
fse.copySync(dir, path.join(lib, path.relative(src, dir)))
}
if (ext === '.less') {
let source = path.join(es, path.relative(src, dir))
let target = toCSSPath(source)
compile(dir, target)
source = path.join(lib, path.relative(src, dir))
target = toCSSPath(source)
compile(dir, target)
}
}
}
}
readdir(src)

View File

@ -1,2 +0,0 @@
export * from './toolbar'
export * from './wrap'

View File

@ -1,47 +0,0 @@
.demo-toolbar {
display: block;
padding: 12px 8px;
border-bottom: 1px dashed #f0f0f0;
opacity: 0.7;
transition: opacity 0.3s;
&:hover {
opacity: 1;
}
& > * {
display: inline-block;
}
a {
color: inherit;
}
form {
display: inline-block;
}
form:active,
form:focus,
button:active,
button:focus {
outline: none;
}
button {
padding: 0;
background: none;
border: 0;
cursor: pointer;
}
.anticon {
margin: 0 8px;
cursor: pointer;
transition: all 0.3s;
}
.anticon:hover {
transform: scale(1.25);
}
}

View File

@ -1,117 +0,0 @@
import React from 'react'
import Icon, {
ReloadOutlined,
GithubOutlined,
CodeSandboxOutlined,
} from '@ant-design/icons'
import { Tooltip } from 'antd'
// import stackblitzSdk from '@stackblitz/sdk'
import { getParameters } from 'codesandbox/lib/api/define'
import './index.css'
// eslint-disable-next-line
const repo = require('../../loaders/repo.js!./data.js')
const iconOpenInNewWindow: React.FC = () => (
<svg
width="15"
height="12"
viewBox="0 0 15 12"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M14.4545 0H10.5C10.1988 0 10 0.198754 10 0.5C10 0.801246 10.1988 1 10.5 1H13L9.5 4.5L10.5 5.5L14 2V4.5C14 4.80125 14.1988 5 14.5 5C14.8012 5 15 4.80125 15 4.5V0.545455C15 0.244208 14.7558 0 14.4545 0ZM1.73333 1H8.00001V1.86667H1.73333C1.25469 1.86667 0.866667 2.25469 0.866667 2.73333V9.32003C0.866667 9.79868 1.25469 10.1867 1.73333 10.1867H12.1333C12.612 10.1867 13 9.79868 13 9.32004V7.00003H13.8667V9.32004C13.8667 10.2773 13.0906 11.0534 12.1333 11.0534H1.73333C0.776041 11.0534 0 10.2773 0 9.32003V2.73333C0 1.77604 0.77604 1 1.73333 1Z"
fill="currentcolor"
/>
</svg>
)
// eslint-disable-next-line react/prefer-stateless-function
export class Toolbar extends React.Component {
render() {
return (
<div className="demo-toolbar">
<Tooltip
placement="bottomLeft"
arrowPointAtCenter
title="重新加载"
mouseEnterDelay={0.5}
>
<ReloadOutlined
onClick={() => {
window.location.reload()
}}
/>
</Tooltip>
{window.frameElement && (
<Tooltip
placement="bottomLeft"
arrowPointAtCenter
title="在新窗口打开"
mouseEnterDelay={0.5}
>
<a
href={`${window.location.href}`}
rel="noopener noreferrer"
target="_blank"
>
<Icon component={iconOpenInNewWindow} />
</a>
</Tooltip>
)}
<Tooltip
placement="bottomLeft"
arrowPointAtCenter
title="在 Github 中查看"
mouseEnterDelay={0.5}
>
<a href={`${repo.host}`} rel="noopener noreferrer" target="_blank">
<GithubOutlined />
</a>
</Tooltip>
<Tooltip
arrowPointAtCenter
placement="bottomLeft"
title="在 CodeSandbox 中打开"
mouseEnterDelay={0.5}
>
<form
action="https://codesandbox.io/api/v1/sandboxes/define"
method="POST"
target="_blank"
>
<input
type="hidden"
name="parameters"
value={getParameters(repo.getCodeSandboxParams())}
/>
<button type="submit">
<CodeSandboxOutlined />
</button>
</form>
</Tooltip>
{/* <Tooltip
placement="bottomLeft"
arrowPointAtCenter
title="在 StackBlitz 中打开"
mouseEnterDelay={0.5}
>
<ThunderboltOutlined
onClick={() => {
stackblitzSdk.openProject(repo.getStackblitzPrefillConfig(), {
openFile: 'src/app.tsx',
})
}}
/>
</Tooltip> */}
</div>
)
}
}

View File

@ -1,3 +0,0 @@
interface Window {
ResizeObserver: any
}

View File

@ -1,5 +0,0 @@
.demo-wrap {
display: flex;
flex-direction: column;
border: 1px solid #f0f0f0;
}

View File

@ -1,109 +0,0 @@
import React, { PropsWithChildren } from 'react'
import { Toolbar } from '../toolbar'
import './content.css'
export class Content extends React.Component<
PropsWithChildren<Content.Props>,
Content.State
> {
private container: HTMLDivElement
constructor(props: Content.Props) {
super(props)
Content.restoreIframeSize()
}
componentDidMount() {
this.updateIframeSize()
if (window.ResizeObserver) {
const ro = new window.ResizeObserver(() => {
this.updateIframeSize()
})
ro.observe(this.container)
} else {
window.addEventListener('resize', () => this.updateIframeSize())
}
setTimeout(() => {
const loading = document.getElementById('loading')
if (loading && loading.parentNode) {
loading.parentNode.removeChild(loading)
}
}, 1000)
}
updateIframeSize() {
const iframe = window.frameElement as HTMLIFrameElement
if (iframe) {
const height = this.container.scrollHeight || this.container.clientHeight
iframe.style.width = '100%'
iframe.style.height = `${height + 16}px`
iframe.style.border = '0'
iframe.style.overflow = 'hidden'
Content.saveIframeSize()
}
}
refContainer = (container: HTMLDivElement) => {
this.container = container
}
render() {
return (
<div className="demo-wrap" ref={this.refContainer}>
<Toolbar />
{this.props.children}
</div>
)
}
}
export namespace Content {
export interface Props {}
export interface State {}
}
export namespace Content {
const STORE_KEY = window.location.pathname
const STORE_ROOT = 'x6-iframe-size'
function getData() {
const raw = localStorage.getItem(STORE_ROOT)
let data
if (raw) {
try {
data = JSON.parse(raw)
} catch (error) {
// pass
}
} else {
data = {}
}
return data
}
export function saveIframeSize() {
const iframe = window.frameElement as HTMLIFrameElement
if (iframe) {
const style = iframe.style
const size = { width: style.width, height: style.height }
const data = getData()
data[STORE_KEY] = size
localStorage.setItem(STORE_ROOT, JSON.stringify(data))
}
}
export function restoreIframeSize() {
const iframe = window.frameElement as HTMLIFrameElement
if (iframe) {
const data = getData()
const size = data[STORE_KEY]
if (size) {
iframe.style.width = size.width || '100%'
iframe.style.height = size.height || 'auto'
}
}
}
}

View File

@ -1,58 +0,0 @@
import React, { PropsWithChildren } from 'react'
import { Alert } from 'antd'
import { Helmet } from 'react-helmet'
import { Content } from './content'
export const Wrap: React.FC<PropsWithChildren> = ({ children }) => (
<Alert.ErrorBoundary>
{process.env.NODE_ENV !== 'development' && (
<Helmet>
<link rel="icon" href="/favicon-32x32.png" type="image/png" />
<link
rel="apple-touch-icon"
sizes="48x48"
href="/icons/icon-48x48.png"
/>
<link
rel="apple-touch-icon"
sizes="72x72"
href="/icons/icon-72x72.png"
/>
<link
rel="apple-touch-icon"
sizes="96x96"
href="/icons/icon-96x96.png"
/>
<link
rel="apple-touch-icon"
sizes="144x144"
href="/icons/icon-144x144.png"
/>
<link
rel="apple-touch-icon"
sizes="192x192"
href="/icons/icon-192x192.png"
/>
<link
rel="apple-touch-icon"
sizes="256x256"
href="/icons/icon-256x256.png"
/>
<link
rel="apple-touch-icon"
sizes="384x384"
href="/icons/icon-384x384.png"
/>
<link
rel="apple-touch-icon"
sizes="512x512"
href="/icons/icon-512x512.png"
/>
<link rel="manifest" href="/manifest.webmanifest" />
<link rel="sitemap" type="application/xml" href="/sitemap.xml" />
</Helmet>
)}
<Content>{children}</Content>
</Alert.ErrorBoundary>
)

View File

@ -1,3 +0,0 @@
{
"extends": "../../tsconfig.json"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
{
"private": true,
"name": "@antv/x6-sites-demos",
"version": "2.0.0",
"workspaces": [
"packages/**/*"
],
"scripts": {
"build": "yarn workspaces run build",
"deploy": "yarn speedup && yarn workspaces run deploy",
"deploy1": "yarn speedup && wsrun -y=3 -c deploy",
"deploy2": "yarn speedup && ultra -r --concurrency '3' --silent deploy",
"clean": "rimraf **/node_modules"
},
"dependencies": {
"@antv/x6": "2.0.0-beta.3",
"@antv/x6-sites-demos-helper": "2.x",
"@antv/x6-vue-shape": "2.0.0-beta.1",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@vue/cli-plugin-babel": "~4.5.11",
"@vue/cli-plugin-eslint": "~4.5.11",
"@vue/cli-plugin-typescript": "~4.5.11",
"@vue/cli-service": "~4.5.11",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"core-js": "^3.6.5",
"element-plus": "^2.2.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0",
"typescript": "~4.1.5",
"vue": "^3.0.0"
}
}

View File

@ -1,3 +0,0 @@
GENERATE_SOURCEMAP=false
SKIP_PREFLIGHT_CHECK=true
PUBLIC_URL='./'

View File

@ -1,24 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
react-app-env.d.ts
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -1,41 +0,0 @@
{
"name": "@antv/x6-sites-demos-api.graph.async",
"version": "0.1.0",
"private": true,
"dependencies": {
"@antv/x6": "^2.x",
"@antv/x6-sites-demos-helper": "2.x",
"antd": "^4.4.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-scripts": "^3.4.1"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"typescript": "^4.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy": "yarn -s prepare && yarn -s static",
"prestart": "yarn prepare"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title></title>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
</body>
</html>

View File

@ -1,56 +0,0 @@
.app {
font-family: sans-serif;
padding: 0;
display: flex;
padding: 16px 8px;
}
.app-left {
width: 336px;
bottom: 0;
padding: 0 8px;
}
.app-content {
flex: 1;
margin-left: 8px;
margin-right: 8px;
box-shadow: 0 0 10px 1px #e9e9e9;
overflow: auto;
}
.ant-card {
box-shadow: 0 0 10px 1px #e9e9e9;
}
.ant-card-head-title {
text-align: center;
}
.ant-row {
margin: 16px 0;
text-align: left;
}
.slider-value {
background: #eee;
color: #333333;
padding: 3px 7px;
border-radius: 10px;
display: inline-block;
font-size: 12px;
margin-left: 8px;
line-height: 1.25;
}
#elapsed {
color: #52c41a;
background: #f6ffed;
border-color: #b7eb8f;
font-variant: tabular-nums;
padding: 0 7px;
font-size: 12px;
line-height: 20px;
white-space: nowrap;
border-radius: 2px;
}

View File

@ -1,76 +0,0 @@
import * as React from 'react'
import { Graph, Cell } from '@antv/x6'
import { Settings, State, defaults } from './settings'
import './shapes'
import './app.css'
export default class Example extends React.Component {
private container: HTMLDivElement
private graph: Graph
componentDidMount() {
this.graph = new Graph({
container: this.container,
height: 200,
grid: {
visible: true,
},
})
this.onChanged(defaults)
}
onChanged = (settgins: State) => {
const node = this.graph.createNode({ shape: 'performance_node' })
const edge = this.graph.createEdge({ shape: 'performance_edge' })
const cells: Cell[] = []
Array.from({ length: settgins.count / 2 }).forEach((_, n) => {
const a = node
.clone()
.position(n * 110 + 20, 20)
.attr('label/text', n + 1)
const b = node
.clone()
.position(n * 100 + 20, 150)
.attr('label/text', n + 1 + settgins.count / 2)
const ab = edge.clone().setSource(a).setTarget(b)
cells.push(a, b, ab)
})
const startTime = new Date().getTime()
const showResult = () => {
const duration = (new Date().getTime() - startTime) / 1000
const elapsed = document.getElementById('elapsed')!
elapsed.innerText = `render ${settgins.count} nodes and ${
settgins.count / 2
} edges in ${duration}s`
}
this.graph.resize((settgins.count / 2) * 110)
this.graph.setAsync(settgins.async)
this.graph.resetCells(cells)
if (settgins.async) {
this.graph.on('render:done', showResult)
} else {
showResult()
}
}
refContainer = (container: HTMLDivElement) => {
this.container = container
}
render() {
return (
<div className="app">
<div className="app-left">
<Settings onChange={this.onChanged} />
</div>
<div className="app-content">
<div ref={this.refContainer} />
</div>
</div>
)
}
}

View File

@ -1,14 +0,0 @@
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View File

@ -1,11 +0,0 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { Wrap } from '@antv/x6-sites-demos-helper'
import App from './app'
ReactDOM.render(
<Wrap>
<App />
</Wrap>,
document.getElementById('root'),
)

View File

@ -1,72 +0,0 @@
import React from 'react'
import { Switch, Slider, Card, Row, Col } from 'antd'
export interface Props {
onChange: (state: State) => void
}
export interface State {
count: number
async: boolean
}
export const defaults: State = {
count: 500,
async: true,
}
export class Settings extends React.Component<Props, State> {
state: State = defaults
notifyChange() {
this.props.onChange(this.state)
}
onCountChanged = (count: number) => {
this.setState({ count }, () => {
this.notifyChange()
})
}
onAsyncChanged = (async: boolean) => {
this.setState({ async }, () => {
this.notifyChange()
})
}
render() {
return (
<Card
title="Settings"
size="small"
bordered={false}
style={{ width: 320 }}
>
<Row align="middle">
<Col span={5}>count</Col>
<Col span={14}>
<Slider
min={10}
max={5000}
step={1}
value={this.state.count}
onChange={this.onCountChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.count}</div>
</Col>
</Row>
<Row align="middle">
<Col span={5}>async</Col>
<Col span={14}>
<Switch checked={this.state.async} onChange={this.onAsyncChanged} />
</Col>
</Row>
<Row align="middle">
<Col span={24} id="elapsed"></Col>
</Row>
</Card>
)
}
}

View File

@ -1,86 +0,0 @@
import { Graph, Color } from '@antv/x6'
const color1 = Color.randomHex()
const color2 = Color.randomHex()
Graph.registerNode(
'performance_node',
{
width: 80,
height: 30,
zIndex: 2,
markup: [
{
tagName: 'rect',
selector: 'body',
// 在 Markup 中定义生命周期中不变的原生属性,不能定义特殊属性
attrs: {
stroke: color1,
strokeWidth: 2,
fill: Color.darken(color1, 40),
},
},
{
tagName: 'text',
selector: 'label',
attrs: {
fill: Color.invert(color1, true),
},
},
],
attrs: {
body: {
// 使用 ref-xxx 属性时,只要没有同时定义 ref 属性,所有计算都是纯 JavaScript 计算,
// 因此计算非常快;一旦定义了 ref 属性,就需要先基于浏览器的包围盒计算拿到 ref 指代
// 元素的包围盒,计算开销相对较大。
refWidth: '100%',
refHeight: '100%',
},
label: {
refX: '50%',
refY: '50%',
fontSize: 12,
// 尽量避免使用 `xAlign` 和 `yAlign` 属性,因为这两个属性的计算首先需要计算
// <SVGText> 元素的包围盒,通常浏览器的包围盒计算都不是那么快。
textAnchor: 'middle',
textVerticalAnchor: 'middle',
},
},
},
true,
)
Graph.registerEdge(
'performance_edge',
{
zIndex: 1,
markup: [
{
tagName: 'path',
selector: 'wrap',
attrs: {
fill: 'none',
cursor: 'pointer',
stroke: 'transparent',
strokeWidth: 10,
strokeLinecap: 'round',
},
},
{
tagName: 'path',
selector: 'line',
},
],
attrs: {
wrap: {
connection: true,
},
line: {
connection: true,
stroke: color2,
strokeWidth: 1,
targetMarker: 'classic',
},
},
},
true,
)

View File

@ -1,27 +0,0 @@
{
"compilerOptions": {
"allowJs": true,
"strict": true,
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strictPropertyInitialization": false,
"noEmit": true,
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"noImplicitAny": true,
"noEmitOnError": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"jsx": "react",
"target": "es5",
"lib": ["dom", "es2015"]
},
"include": ["src"]
}

View File

@ -1,3 +0,0 @@
GENERATE_SOURCEMAP=false
SKIP_PREFLIGHT_CHECK=true
PUBLIC_URL='./'

View File

@ -1,24 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
react-app-env.d.ts
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -1,42 +0,0 @@
{
"name": "@antv/x6-sites-demos-api.graph.auto-resize",
"version": "0.1.0",
"private": true,
"dependencies": {
"@antv/x6-react-components": "^2.x",
"@antv/x6": "^2.x",
"@antv/x6-sites-demos-helper": "2.x",
"antd": "^4.4.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-scripts": "^3.4.1"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"typescript": "^4.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy": "yarn -s prepare && yarn -s static",
"prestart": "yarn prepare"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title></title>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
</body>
</html>

View File

@ -1,19 +0,0 @@
.app {
font-family: sans-serif;
padding: 0;
display: flex;
padding: 16px 8px;
}
.app-content {
flex: 1;
height: 240px;
margin-left: 8px;
margin-right: 8px;
box-shadow: 0 0 10px 1px #e9e9e9;
}
.x6-split-box-horizontal > .x6-split-box-resizer,
.x6-split-box-vertical > .x6-split-box-resizer {
background: #ffe58f;
}

View File

@ -1,104 +0,0 @@
import * as React from 'react'
import { Graph } from '@antv/x6'
import { SplitBox } from '@antv/x6-react-components'
import '@antv/x6-react-components/es/split-box/style/index.css'
import './app.css'
export default class Example extends React.Component {
private graphContainer1: HTMLDivElement
private graphContainer2: HTMLDivElement
componentDidMount() {
const graph1 = new Graph({
container: this.graphContainer1,
background: {
color: '#f5f5f5',
},
grid: true,
scroller: true,
autoResize: true,
})
const rect = graph1.addNode({
x: 300,
y: 300,
width: 90,
height: 60,
})
const circle = graph1.addNode({
x: 400,
y: 400,
width: 40,
height: 40,
})
graph1.addEdge({
source: rect,
target: circle,
})
graph1.centerContent()
const graph2 = new Graph({
container: this.graphContainer2,
background: {
color: '#f5f5f5',
},
grid: true,
autoResize: true,
})
const source = graph2.addNode({
x: 40,
y: 40,
width: 80,
height: 40,
})
const target = graph2.addNode({
x: 120,
y: 100,
width: 80,
height: 40,
})
graph2.addEdge({
source,
target,
})
}
refContainer1 = (container: HTMLDivElement) => {
this.graphContainer1 = container
}
refContainer2 = (container: HTMLDivElement) => {
this.graphContainer2 = container
}
render() {
return (
<div className="app">
<div className="app-content">
<SplitBox>
<div style={{ width: '100%', height: '100%', display: 'flex' }}>
<div
ref={this.refContainer1}
style={{ flex: 1, margin: 24 }}
className="x6-graph"
/>
</div>
<div style={{ width: '100%', height: '100%', display: 'flex' }}>
<div
ref={this.refContainer2}
style={{ flex: 1, margin: 24 }}
className="x6-graph"
/>
</div>
</SplitBox>
</div>
</div>
)
}
}

View File

@ -1,9 +0,0 @@
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

View File

@ -1,12 +0,0 @@
import React from 'react'
import ReactDOM from 'react-dom'
import App from './app'
import { Wrap } from '@antv/x6-sites-demos-helper'
ReactDOM.render(
<Wrap>
<div className="bar" />
<App />
</Wrap>,
document.getElementById('root'),
)

View File

@ -1,27 +0,0 @@
{
"compilerOptions": {
"allowJs": true,
"strict": true,
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strictPropertyInitialization": false,
"noEmit": true,
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"noImplicitAny": true,
"noEmitOnError": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"jsx": "react",
"target": "es5",
"lib": ["dom", "es2015"]
},
"include": ["src"]
}

View File

@ -1,3 +0,0 @@
GENERATE_SOURCEMAP=false
SKIP_PREFLIGHT_CHECK=true
PUBLIC_URL='./'

View File

@ -1,24 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
react-app-env.d.ts
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -1,41 +0,0 @@
{
"name": "@antv/x6-sites-demos-api.graph.checkview",
"version": "0.1.0",
"private": true,
"dependencies": {
"@antv/x6": "^2.x",
"@antv/x6-sites-demos-helper": "2.x",
"antd": "^4.4.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-scripts": "^3.4.1"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"typescript": "^4.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy": "yarn -s prepare && yarn -s static",
"prestart": "yarn prepare"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title></title>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
</body>
</html>

View File

@ -1,57 +0,0 @@
.app {
font-family: sans-serif;
padding: 0;
display: flex;
padding: 16px 8px;
}
.app-left {
width: 336px;
bottom: 0;
padding: 0 8px;
}
.app-content {
flex: 1;
height: 444px;
margin-left: 8px;
margin-right: 8px;
box-shadow: 0 0 10px 1px #e9e9e9;
overflow: auto;
}
.ant-card {
box-shadow: 0 0 10px 1px #e9e9e9;
}
.ant-card-head-title {
text-align: center;
}
.ant-row {
margin: 16px 0;
text-align: left;
}
.slider-value {
background: #eee;
color: #333333;
padding: 3px 7px;
border-radius: 10px;
display: inline-block;
font-size: 12px;
margin-left: 8px;
line-height: 1.25;
}
#elapsed {
color: #52c41a;
background: #f6ffed;
border-color: #b7eb8f;
font-variant: tabular-nums;
padding: 0 7px;
font-size: 12px;
line-height: 20px;
white-space: nowrap;
border-radius: 2px;
}

View File

@ -1,210 +0,0 @@
import * as React from 'react'
import { Graph, Cell, Node, Edge, Color, Rectangle } from '@antv/x6'
import { Settings, State, defaults } from './settings'
import './app.css'
export default class Example extends React.Component {
private container: HTMLDivElement
private count: number
private columns: number
private graph: Graph
private viewport: Node
private padding: number
private keepDragged: boolean
private keepRendered: boolean
private customViewport: boolean
private windowBBox: Rectangle
private draggedId: string[] = []
componentDidMount() {
this.graph = new Graph({
container: this.container,
sorting: 'approx',
async: true,
frozen: true,
grid: {
size: 1,
visible: true,
},
checkView: ({ view, unmounted }) => {
const cell = view.cell
if (cell.isNode()) {
return this.shouldRenderNode(cell, unmounted)
}
if (cell.isEdge()) {
return this.shouldRenderEdge(cell)
}
return false
},
})
this.graph.on('render:done', ({ stats }) => {
console.table(stats)
})
this.graph.on('node:change:position', ({ node }) => {
this.draggedId.push(node.id)
})
window.onscroll = () => this.setWindowBBox()
window.onresize = () => this.setWindowBBox()
this.setWindowBBox()
this.onChanged(defaults)
}
shouldRenderNode(node: Node, unmounted: boolean) {
if (this.keepDragged && this.draggedId.includes(node.id)) {
return true
}
if (this.keepRendered && unmounted) {
return true
}
if (this.customViewport) {
const viewportBBox = this.viewport.getBBox()
return viewportBBox.isIntersectWithRect(
node.getBBox().inflate(this.padding),
)
}
if (node === this.viewport) {
return false
}
return this.windowBBox.isIntersectWithRect(
node.getBBox().inflate(this.padding),
)
}
shouldRenderEdge(edge: Edge) {
const sourceNode = edge.getSourceNode()
const targetNode = edge.getTargetNode()
return (
this.shouldRenderNode(sourceNode as Node, false) ||
this.shouldRenderNode(targetNode as Node, false)
)
}
setWindowBBox() {
this.windowBBox = this.graph.pageToLocal(
window.scrollX,
window.scrollY,
window.innerWidth,
window.innerHeight,
)
}
onChanged = (settgins: State) => {
console.time('perf-all')
this.padding = settgins.padding
this.customViewport = settgins.customViewport
this.keepRendered = settgins.keepRendered
this.keepDragged = settgins.keepDragged
this.draggedId = []
if (this.count === settgins.count && this.columns === settgins.columns) {
return
}
this.count = settgins.count
this.columns = settgins.columns
const count = settgins.count
const columns = settgins.columns
const rows = Math.ceil(count / columns)
const baseColor = Color.randomHex()
const nodes = Array.from({ length: count }, (_, index) => {
const row = Math.floor(index / columns)
const column = index % columns
const fill = Color.lighten(baseColor, ((row + column) % 8) * 10)
return this.graph.createNode({
zIndex: 2,
width: 30,
height: 20,
x: column * 50 + 30,
y: row * 50 + 30,
attrs: {
body: { fill },
label: { text: index, fill: Color.invert(fill, true) },
},
})
})
const edges = nodes.map((target, index) => {
if (index === 0) {
return null
}
const source = nodes[index - 1]
return this.graph.createEdge({
zIndex: 1,
source: { cell: source.id },
target: { cell: target.id },
})
})
edges.shift()
this.viewport = this.graph.createNode({
zIndex: 3,
width: 200,
height: 200,
x: 100,
y: 100,
label: 'Drag me',
attrs: {
body: {
fill: 'rgba(255,0,0,0.6)',
stroke: 'rgba(255,0,0,0.8)',
strokeWidth: 8,
},
label: {
text: 'Drag me!!',
fill: '#fff',
},
},
})
console.time('perf-reset')
this.graph.freeze()
this.graph.resize(columns * 50 + 30, rows * 50 + 30)
this.graph.model.resetCells([...nodes, ...edges, this.viewport] as Cell[])
console.timeEnd('perf-reset')
console.time('perf-dump')
this.graph.unfreeze({
batchSize: settgins.batch,
progress: ({ done, current, total }) => {
const progress = current / total
console.log(`${Math.round(progress * 100)}%`)
if (done) {
console.timeEnd('perf-dump')
console.timeEnd('perf-all')
this.graph.unfreeze()
}
},
})
}
refContainer = (container: HTMLDivElement) => {
this.container = container
}
render() {
return (
<div className="app">
<div className="app-left">
<Settings onChange={this.onChanged} />
</div>
<div className="app-content">
<div ref={this.refContainer} />
</div>
</div>
)
}
}

View File

@ -1,14 +0,0 @@
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View File

@ -1,11 +0,0 @@
import React from 'react'
import ReactDOM from 'react-dom'
import App from './app'
import { Wrap } from '@antv/x6-sites-demos-helper'
ReactDOM.render(
<Wrap>
<App />
</Wrap>,
document.getElementById('root'),
)

View File

@ -1,187 +0,0 @@
import React from 'react'
import { Switch, Slider, Card, Row, Col } from 'antd'
export interface Props {
onChange: (state: State) => void
}
export interface State {
count: number
columns: number
batch: number
padding: number
customViewport: boolean
keepRendered: boolean
keepDragged: boolean
}
export const defaults: State = {
count: 1000,
columns: 40,
batch: 400,
padding: 60,
customViewport: true,
keepRendered: false,
keepDragged: false,
}
export class Settings extends React.Component<Props, State> {
state: State = defaults
notifyChange() {
this.props.onChange(this.state)
}
onCountChanged = (count: number) => {
this.setState({ count }, () => {
this.notifyChange()
})
}
onColumnsChanged = (columns: number) => {
this.setState({ columns }, () => {
this.notifyChange()
})
}
onBatchChanged = (batch: number) => {
this.setState({ batch }, () => {
this.notifyChange()
})
}
onPaddingChanged = (padding: number) => {
this.setState({ padding }, () => {
this.notifyChange()
})
}
onCustomViewportChanged = (customViewport: boolean) => {
this.setState({ customViewport }, () => {
this.notifyChange()
})
}
onKeepRenderedChanged = (keepRendered: boolean) => {
this.setState({ keepRendered }, () => {
this.notifyChange()
})
}
onKeepDraggedChanged = (keepDragged: boolean) => {
this.setState({ keepDragged }, () => {
this.notifyChange()
})
}
render() {
return (
<Card
title="Settings"
size="small"
bordered={false}
style={{ width: 320 }}
>
<Row align="middle">
<Col span={7}>node count</Col>
<Col span={12}>
<Slider
min={10}
max={5000}
step={1}
value={this.state.count}
onChange={this.onCountChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.count}</div>
</Col>
</Row>
<Row align="middle">
<Col span={7}>batch size</Col>
<Col span={12}>
<Slider
min={10}
max={1000}
step={1}
value={this.state.batch}
onChange={this.onBatchChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.batch}</div>
</Col>
</Row>
<Row align="middle">
<Col span={7}>columns</Col>
<Col span={12}>
<Slider
min={20}
max={100}
step={1}
value={this.state.columns}
onChange={this.onColumnsChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.columns}</div>
</Col>
</Row>
<Row align="middle">
<Col span={7}>rows</Col>
<Col span={12}></Col>
<Col span={1} offset={1}>
<div className="slider-value">
{Math.ceil(this.state.count / this.state.columns)}
</div>
</Col>
</Row>
<Row align="middle">
<Col span={7}>padding</Col>
<Col span={12}>
<Slider
min={20}
max={120}
step={1}
value={this.state.padding}
onChange={this.onPaddingChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.padding}</div>
</Col>
</Row>
<Row align="middle">
<Col span={10}>custom viewport</Col>
<Col span={14}>
<Switch
checked={this.state.customViewport}
onChange={this.onCustomViewportChanged}
/>
</Col>
</Row>
<Row align="middle">
<Col span={10}>keep rendered</Col>
<Col span={14}>
<Switch
checked={this.state.keepRendered}
onChange={this.onKeepRenderedChanged}
/>
</Col>
</Row>
<Row align="middle">
<Col span={10}>keep dragged</Col>
<Col span={14}>
<Switch
checked={this.state.keepDragged}
onChange={this.onKeepDraggedChanged}
/>
</Col>
</Row>
<Row align="middle">
<Col span={24} id="elapsed"></Col>
</Row>
</Card>
)
}
}

View File

@ -1,27 +0,0 @@
{
"compilerOptions": {
"allowJs": true,
"strict": true,
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strictPropertyInitialization": false,
"noEmit": true,
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"noImplicitAny": true,
"noEmitOnError": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"jsx": "react",
"target": "es5",
"lib": ["dom", "es2015"]
},
"include": ["src"]
}

View File

@ -1,3 +0,0 @@
GENERATE_SOURCEMAP=false
SKIP_PREFLIGHT_CHECK=true
PUBLIC_URL='./'

View File

@ -1,24 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
react-app-env.d.ts
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -1,41 +0,0 @@
{
"name": "@antv/x6-sites-demos-api.graph.coord",
"version": "0.1.0",
"private": true,
"dependencies": {
"@antv/x6": "^2.x",
"@antv/x6-sites-demos-helper": "2.x",
"antd": "^4.4.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-scripts": "^3.4.1"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"typescript": "^4.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy": "yarn -s prepare && yarn -s static",
"prestart": "yarn prepare"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title></title>
</head>
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
</body>
</html>

View File

@ -1,74 +0,0 @@
#root {
width: 5000px;
height: 5000px;
position: relative;
}
.bar {
position: absolute;
height: 2px;
top: 48px;
left: 0;
right: 0;
background: linear-gradient(to right, #9198e5, #e66465);
}
.app {
font-family: sans-serif;
padding: 0;
display: flex;
padding: 16px 8px;
}
.app-left {
width: 336px;
top: 64px;
padding: 0 8px;
position: fixed;
z-index: 10;
}
.app-content {
flex: 1;
height: 318px;
margin-left: 344px;
margin-right: 8px;
box-shadow: 0 0 10px 1px #e9e9e9;
overflow: auto;
}
.ant-card {
box-shadow: 0 0 10px 1px #e9e9e9;
}
.ant-card-head-title {
text-align: center;
}
.ant-row {
margin: 16px 0;
text-align: left;
}
.slider-value {
background: #eee;
color: #333333;
padding: 3px 7px;
border-radius: 10px;
display: inline-block;
font-size: 12px;
margin-left: 8px;
line-height: 1.25;
}
#elapsed {
color: #52c41a;
background: #f6ffed;
border-color: #b7eb8f;
font-variant: tabular-nums;
padding: 0 7px;
font-size: 12px;
line-height: 20px;
white-space: nowrap;
border-radius: 2px;
}

View File

@ -1,135 +0,0 @@
import * as React from 'react'
import { Graph } from '@antv/x6'
import { Settings, State, defaults } from './settings'
import './app.css'
export default class Example extends React.Component {
private container: HTMLDivElement
private graph: Graph
componentDidMount() {
this.graph = new Graph({
container: this.container,
grid: true,
})
const source = this.graph.addNode({
x: 100,
y: 100,
width: 80,
height: 40,
label: 'hello',
})
const target = this.graph.addNode({
x: 240,
y: 300,
width: 80,
height: 40,
label: 'world',
})
this.graph.addEdge({ source, target })
this.onChanged(defaults)
this.start()
}
start() {
const root = document.getElementById('root')!
const v = document.createElement('div')
const h = document.createElement('div')
const c = document.createElement('div')
v.style.position = 'absolute'
v.style.width = '1px'
v.style.top = '0'
v.style.bottom = '0'
v.style.left = '-100px'
v.style.zIndex = `99`
v.style.borderLeft = '1px dashed red'
h.style.position = 'absolute'
h.style.height = '1px'
h.style.left = '0'
h.style.right = '0'
h.style.top = '-100px'
h.style.zIndex = `99`
h.style.borderTop = '1px dashed red'
c.style.position = 'absolute'
c.style.display = 'inline-block'
c.style.fontSize = '12px'
c.style.zIndex = `99`
c.style.padding = '4px 8px'
c.style.borderRadius = '2px'
c.style.lineHeight = '20px'
c.style.background = '#f6ffed'
c.style.border = '1px solid #b7eb8f'
root.appendChild(v)
root.appendChild(h)
root.appendChild(c)
document.addEventListener('mousemove', (e) => {
const target = e.target as HTMLElement
if (
this.container.contains(target) ||
this.container === target ||
target === v ||
target === h ||
target === c
) {
const pageX = e.pageX
const pageY = e.pageY
const clientX = e.clientX
const clientY = e.clientY
v.style.left = `${pageX + 2}px`
h.style.top = `${pageY + 2}px`
c.style.left = `${pageX + 10}px`
c.style.top = `${pageY + 10}px`
const p1 = this.graph.pageToLocal(pageX, pageY)
const p2 = this.graph.localToPage(p1)
const p3 = this.graph.localToClient(p1)
const p4 = this.graph.localToGraph(p1)
c.innerHTML = `
<div>Mouse Page Position(e.pageX, e.pageY): ${pageX} x ${pageY}</div>
<div>Mouse Client Position(e.clientX, e.clientY): ${clientX} x ${clientY}</div>
<div>Local Position: ${p1.x} x ${p1.y}</div>
<div>Local to Page: ${p2.x} x ${p2.y}</div>
<div>Local to Client: ${p3.x} x ${p3.y}</div>
<div>Local to Graph: ${p4.x} x ${p4.y}</div>
`
} else {
v.style.left = `${-1000}px`
h.style.top = `${-1000}px`
c.style.left = `${-10000}px`
c.style.top = `${-10000}px`
}
})
}
onChanged = (settgins: State) => {
this.graph.scale(settgins.scale)
this.graph.translate(settgins.tx, settgins.ty)
document.documentElement.scrollLeft = settgins.scrollLeft
document.documentElement.scrollTop = settgins.scrollTop
}
refContainer = (container: HTMLDivElement) => {
this.container = container
}
render() {
return (
<div className="app">
<div className="app-left">
<Settings onChange={this.onChanged} />
</div>
<div className="app-content" ref={this.refContainer} />
</div>
)
}
}

View File

@ -1,9 +0,0 @@
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

View File

@ -1,12 +0,0 @@
import React from 'react'
import ReactDOM from 'react-dom'
import App from './app'
import { Wrap } from '@antv/x6-sites-demos-helper'
ReactDOM.render(
<Wrap>
<div className="bar" />
<App />
</Wrap>,
document.getElementById('root'),
)

View File

@ -1,156 +0,0 @@
import React from 'react'
import { Slider, Card, Row, Col } from 'antd'
export interface Props {
onChange: (state: State) => void
}
export interface State {
scale: number
tx: number
ty: number
scrollLeft: number
scrollTop: number
}
export const defaults: State = {
scale: 0.5,
tx: 20,
ty: 20,
scrollLeft: 50,
scrollTop: 0,
}
export class Settings extends React.Component<Props, State> {
state: State = defaults
componentDidMount() {
document.addEventListener('scroll', () => {
this.setState({
scrollLeft: window.scrollX,
scrollTop: window.scrollY,
})
})
}
notifyChange() {
this.props.onChange(this.state)
}
onScaleChanged = (scale: number) => {
this.setState({ scale }, () => {
this.notifyChange()
})
}
onTxChanged = (tx: number) => {
this.setState({ tx }, () => {
this.notifyChange()
})
}
onTyChanged = (ty: number) => {
this.setState({ ty }, () => {
this.notifyChange()
})
}
onScrollLeftChanged = (scrollX: number) => {
this.setState({ scrollLeft: scrollX }, () => {
this.notifyChange()
})
}
onScrollTopChanged = (scrollY: number) => {
this.setState({ scrollTop: scrollY }, () => {
this.notifyChange()
})
}
render() {
return (
<Card
title="Settings"
size="small"
bordered={false}
style={{ width: 320 }}
>
<Row align="middle">
<Col span={7}>scale</Col>
<Col span={12}>
<Slider
min={0.1}
max={2}
step={0.1}
value={this.state.scale}
onChange={this.onScaleChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.scale}</div>
</Col>
</Row>
<Row align="middle">
<Col span={7}>translateX</Col>
<Col span={12}>
<Slider
min={-50}
max={50}
step={1}
value={this.state.tx}
onChange={this.onTxChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.tx}</div>
</Col>
</Row>
<Row align="middle">
<Col span={7}>translateY</Col>
<Col span={12}>
<Slider
min={-50}
max={50}
step={1}
value={this.state.ty}
onChange={this.onTyChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.ty}</div>
</Col>
</Row>
<Row align="middle">
<Col span={7}>scrollLeft</Col>
<Col span={12}>
<Slider
min={0}
max={document.body.scrollWidth - document.body.clientWidth}
step={1}
value={this.state.scrollLeft}
onChange={this.onScrollLeftChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.scrollLeft}</div>
</Col>
</Row>
<Row align="middle">
<Col span={7}>scrollTop</Col>
<Col span={12}>
<Slider
min={0}
max={document.body.scrollHeight - document.body.clientHeight}
step={1}
value={this.state.scrollTop}
onChange={this.onScrollTopChanged}
/>
</Col>
<Col span={1} offset={1}>
<div className="slider-value">{this.state.scrollTop}</div>
</Col>
</Row>
</Card>
)
}
}

View File

@ -1,27 +0,0 @@
{
"compilerOptions": {
"allowJs": true,
"strict": true,
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strictPropertyInitialization": false,
"noEmit": true,
"module": "esnext",
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"noImplicitAny": true,
"noEmitOnError": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"jsx": "react",
"target": "es5",
"lib": ["dom", "es2015"]
},
"include": ["src"]
}

View File

@ -1,3 +0,0 @@
GENERATE_SOURCEMAP=false
SKIP_PREFLIGHT_CHECK=true
PUBLIC_URL='./'

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