y-mxgraph 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -0
- package/README.zh-CN.md +69 -0
- package/binding/collaborator/cursor.d.ts +19 -0
- package/binding/collaborator/cursor.d.ts.map +1 -0
- package/binding/collaborator/index.d.ts +32 -0
- package/binding/collaborator/index.d.ts.map +1 -0
- package/binding/collaborator/selection.d.ts +18 -0
- package/binding/collaborator/selection.d.ts.map +1 -0
- package/binding/index.d.ts +44 -0
- package/binding/index.d.ts.map +1 -0
- package/binding/patch.d.ts +35 -0
- package/binding/patch.d.ts.map +1 -0
- package/binding/undoManager.d.ts +8 -0
- package/binding/undoManager.d.ts.map +1 -0
- package/helper/awarenessStateValue.d.ts +4 -0
- package/helper/awarenessStateValue.d.ts.map +1 -0
- package/helper/cursor.d.ts +2 -0
- package/helper/cursor.d.ts.map +1 -0
- package/helper/getId.d.ts +4 -0
- package/helper/getId.d.ts.map +1 -0
- package/helper/origin.d.ts +7 -0
- package/helper/origin.d.ts.map +1 -0
- package/helper/random.d.ts +4 -0
- package/helper/random.d.ts.map +1 -0
- package/helper/xml.d.ts +4 -0
- package/helper/xml.d.ts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/models/diagram.d.ts +22 -0
- package/models/diagram.d.ts.map +1 -0
- package/models/mxCell.d.ts +11 -0
- package/models/mxCell.d.ts.map +1 -0
- package/models/mxGraphModel.d.ts +19 -0
- package/models/mxGraphModel.d.ts.map +1 -0
- package/models/mxfile.d.ts +12 -0
- package/models/mxfile.d.ts.map +1 -0
- package/package.json +23 -0
- package/transformer/index.d.ts +4 -0
- package/transformer/index.d.ts.map +1 -0
- package/types/drawio.d.ts +80 -0
- package/types/drawio.d.ts.map +1 -0
- package/y-mxgraph.cjs.js +1526 -0
- package/y-mxgraph.cjs.js.map +1 -0
- package/y-mxgraph.es.js +1509 -0
- package/y-mxgraph.es.js.map +1 -0
- package/y-mxgraph.iife.js +1525 -0
- package/y-mxgraph.iife.js.map +1 -0
- package/y-mxgraph.umd.js +1526 -0
- package/y-mxgraph.umd.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# y-mxgraph
|
|
2
|
+
|
|
3
|
+
[中文文档](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Yjs binding for draw.io (mxGraph) documents, enabling real-time collaborative editing.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Bidirectional binding** between draw.io files and Y.Doc
|
|
10
|
+
- **Real-time collaboration** via y-webrtc, y-websocket, or any Yjs provider
|
|
11
|
+
- **Undo/Redo support** with Y.UndoManager
|
|
12
|
+
- **Collaborative cursors** via y-protocols Awareness
|
|
13
|
+
- **Full TypeScript** support
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add y-mxgraph yjs y-protocols
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`yjs` and `y-protocols` are peer dependencies.
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import * as Y from 'yjs';
|
|
27
|
+
import { Binding, LOCAL_ORIGIN } from 'y-mxgraph';
|
|
28
|
+
|
|
29
|
+
const doc = new Y.Doc();
|
|
30
|
+
|
|
31
|
+
App.main((app) => {
|
|
32
|
+
const binding = new Binding(app.currentFile, { doc });
|
|
33
|
+
|
|
34
|
+
window.addEventListener('beforeunload', () => binding.destroy());
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
- [Getting Started](https://mizuka-wu.github.io/y-mxgraph/en/guide/getting-started)
|
|
41
|
+
- [API Reference](https://mizuka-wu.github.io/y-mxgraph/en/api/)
|
|
42
|
+
- [Architecture](https://mizuka-wu.github.io/y-mxgraph/en/guide/architecture)
|
|
43
|
+
|
|
44
|
+
## Development
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Clone
|
|
48
|
+
git clone https://github.com/mizuka-wu/y-mxgraph.git
|
|
49
|
+
cd y-mxgraph
|
|
50
|
+
|
|
51
|
+
# Install
|
|
52
|
+
pnpm install
|
|
53
|
+
|
|
54
|
+
# Build
|
|
55
|
+
pnpm --filter y-mxgraph build
|
|
56
|
+
|
|
57
|
+
# Test
|
|
58
|
+
pnpm --filter y-mxgraph test
|
|
59
|
+
|
|
60
|
+
# Demo
|
|
61
|
+
pnpm --filter @y-mxgraph/demo dev
|
|
62
|
+
|
|
63
|
+
# Docs
|
|
64
|
+
pnpm --filter @y-mxgraph/docs dev
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# y-mxgraph
|
|
2
|
+
|
|
3
|
+
[English](./README.md)
|
|
4
|
+
|
|
5
|
+
Yjs 与 draw.io (mxGraph) 文档的双向绑定库,让 draw.io 支持实时多人协同编辑。
|
|
6
|
+
|
|
7
|
+
## 特性
|
|
8
|
+
|
|
9
|
+
- **双向绑定** draw.io 文件与 Y.Doc
|
|
10
|
+
- **实时协作** 支持 y-webrtc、y-websocket 及任意 Yjs Provider
|
|
11
|
+
- **撤销/重做** 集成 Y.UndoManager
|
|
12
|
+
- **协同光标** 基于 y-protocols Awareness 渲染远端光标与选区
|
|
13
|
+
- **完整 TypeScript** 类型支持
|
|
14
|
+
|
|
15
|
+
## 安装
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add y-mxgraph yjs y-protocols
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`yjs` 和 `y-protocols` 为 peer dependencies,需单独安装。
|
|
22
|
+
|
|
23
|
+
## 快速开始
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import * as Y from 'yjs';
|
|
27
|
+
import { Binding, LOCAL_ORIGIN } from 'y-mxgraph';
|
|
28
|
+
|
|
29
|
+
const doc = new Y.Doc();
|
|
30
|
+
|
|
31
|
+
App.main((app) => {
|
|
32
|
+
const binding = new Binding(app.currentFile, { doc });
|
|
33
|
+
|
|
34
|
+
window.addEventListener('beforeunload', () => binding.destroy());
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 文档
|
|
39
|
+
|
|
40
|
+
- [快速开始](https://mizuka-wu.github.io/y-mxgraph/guide/getting-started)
|
|
41
|
+
- [API 参考](https://mizuka-wu.github.io/y-mxgraph/api/)
|
|
42
|
+
- [实现原理](https://mizuka-wu.github.io/y-mxgraph/guide/architecture)
|
|
43
|
+
|
|
44
|
+
## 本地开发
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 克隆仓库
|
|
48
|
+
git clone https://github.com/mizuka-wu/y-mxgraph.git
|
|
49
|
+
cd y-mxgraph
|
|
50
|
+
|
|
51
|
+
# 安装依赖
|
|
52
|
+
pnpm install
|
|
53
|
+
|
|
54
|
+
# 构建
|
|
55
|
+
pnpm --filter y-mxgraph build
|
|
56
|
+
|
|
57
|
+
# 测试
|
|
58
|
+
pnpm --filter y-mxgraph test
|
|
59
|
+
|
|
60
|
+
# 启动 Demo
|
|
61
|
+
pnpm --filter @y-mxgraph/demo dev
|
|
62
|
+
|
|
63
|
+
# 启动文档
|
|
64
|
+
pnpm --filter @y-mxgraph/docs dev
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Awareness } from "y-protocols/awareness";
|
|
2
|
+
import { type RemoteCursor } from "./index";
|
|
3
|
+
import type { DrawioFile, MxGraph } from "../../types/drawio";
|
|
4
|
+
export declare const CacheKey = "__remoteCursor__";
|
|
5
|
+
export declare function bindCursor(file: DrawioFile, options: {
|
|
6
|
+
awareness: Awareness;
|
|
7
|
+
graph?: MxGraph;
|
|
8
|
+
mouseMoveThrottle?: number;
|
|
9
|
+
}): () => void;
|
|
10
|
+
export declare function renderRemoteCursors(ui: {
|
|
11
|
+
editor: {
|
|
12
|
+
graph: MxGraph;
|
|
13
|
+
};
|
|
14
|
+
currentPage?: {
|
|
15
|
+
getId(): string;
|
|
16
|
+
} | null;
|
|
17
|
+
diagramContainer: HTMLElement;
|
|
18
|
+
}, remotes: Map<number, RemoteCursor>): void;
|
|
19
|
+
//# sourceMappingURL=cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/binding/collaborator/cursor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE9D,eAAO,MAAM,QAAQ,qBAAqB,CAAC;AAgC3C,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE;IACP,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,cAwDF;AAED,wBAAgB,mBAAmB,CACjC,EAAE,EAAE;IAAE,MAAM,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAAC,WAAW,CAAC,EAAE;QAAE,KAAK,IAAI,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAAC,gBAAgB,EAAE,WAAW,CAAA;CAAE,EAC3G,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,QAgGnC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Awareness } from "y-protocols/awareness";
|
|
2
|
+
import type { DrawioFile, MxGraph } from "../../types/drawio";
|
|
3
|
+
export declare const DEFAULT_USER_NAME_KEY = "user.name";
|
|
4
|
+
export declare const DEFAULT_USER_COLOR_KEY = "user.color";
|
|
5
|
+
type CursorState = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
pageId?: string | null;
|
|
9
|
+
hide?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type SelectionState = {
|
|
12
|
+
ids: string[];
|
|
13
|
+
pageId?: string | null;
|
|
14
|
+
};
|
|
15
|
+
export type RemoteCursor = {
|
|
16
|
+
clientId: number;
|
|
17
|
+
cursorState: CursorState | null;
|
|
18
|
+
selectionState: SelectionState | null;
|
|
19
|
+
userColor: string;
|
|
20
|
+
userName: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function bindCollaborator(file: DrawioFile, options: {
|
|
23
|
+
awareness: Awareness;
|
|
24
|
+
graph?: MxGraph;
|
|
25
|
+
cursor?: boolean | {
|
|
26
|
+
userNameKey?: string;
|
|
27
|
+
userColorKey?: string;
|
|
28
|
+
};
|
|
29
|
+
mouseMoveThrottle?: number;
|
|
30
|
+
}): () => void;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/binding/collaborator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQvD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE9D,eAAO,MAAM,qBAAqB,cAAc,CAAC;AACjD,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAEnD,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE;IACP,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,GAAG;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,cA0FF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Awareness } from "y-protocols/awareness";
|
|
2
|
+
import { type RemoteCursor } from "./index";
|
|
3
|
+
import type { DrawioFile, MxGraph } from "../../types/drawio";
|
|
4
|
+
export declare const SELECTION_OPACITY = 70;
|
|
5
|
+
export declare const CacheKey = "__remoteSelection__";
|
|
6
|
+
export declare function bindSelection(file: DrawioFile, options: {
|
|
7
|
+
awareness: Awareness;
|
|
8
|
+
graph?: MxGraph;
|
|
9
|
+
}): () => void;
|
|
10
|
+
export declare function renderRemoteSelections(ui: {
|
|
11
|
+
editor: {
|
|
12
|
+
graph: MxGraph;
|
|
13
|
+
};
|
|
14
|
+
currentPage?: {
|
|
15
|
+
getId(): string;
|
|
16
|
+
} | null;
|
|
17
|
+
}, remotes: Map<number, RemoteCursor>): void;
|
|
18
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/binding/collaborator/selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE9D,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,QAAQ,wBAAwB,CAAC;AAE9C,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,cAuBnD;AAED,wBAAgB,sBAAsB,CACpC,EAAE,EAAE;IAAE,MAAM,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAAC,WAAW,CAAC,EAAE;QAAE,KAAK,IAAI,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,EAC5E,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,QAyFnC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import { type Awareness } from "y-protocols/awareness";
|
|
3
|
+
import type { DrawioFile } from "../types/drawio";
|
|
4
|
+
export interface BindDrawioFileOptions {
|
|
5
|
+
doc: Y.Doc;
|
|
6
|
+
awareness?: Awareness;
|
|
7
|
+
undoManager?: Y.UndoManager;
|
|
8
|
+
mouseMoveThrottle?: number;
|
|
9
|
+
cursor?: boolean | {
|
|
10
|
+
userNameKey?: string;
|
|
11
|
+
userColorKey?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Y-MXGraph 绑定类,管理 draw.io 文件与 Y.Doc 的双向同步
|
|
16
|
+
*/
|
|
17
|
+
export declare class Binding {
|
|
18
|
+
/** Y.Doc 实例,用于协同数据存储 */
|
|
19
|
+
readonly doc: Y.Doc;
|
|
20
|
+
/** mxGraph 的数据模型,用于监听本地变更 */
|
|
21
|
+
private mxGraphModel;
|
|
22
|
+
/** 本地变更抑制标志,防止循环同步 */
|
|
23
|
+
private suppressLocalApply;
|
|
24
|
+
/** mxGraph change 事件监听器 */
|
|
25
|
+
private mxListener;
|
|
26
|
+
/** Yjs 文档深度变更监听器 */
|
|
27
|
+
private docObserver;
|
|
28
|
+
/** 协作功能清理函数(awareness 光标/选区) */
|
|
29
|
+
private cleanupCollaborator?;
|
|
30
|
+
/** UndoManager 绑定清理函数 */
|
|
31
|
+
private cleanupUndoManager?;
|
|
32
|
+
constructor(file: DrawioFile, options: BindDrawioFileOptions);
|
|
33
|
+
/**
|
|
34
|
+
* 销毁绑定,解除所有监听器
|
|
35
|
+
* @param deep - 是否深度清理(包括 awareness/undoManager),默认 false
|
|
36
|
+
*/
|
|
37
|
+
destroy(deep?: boolean): void;
|
|
38
|
+
/**
|
|
39
|
+
* 静态工厂方法,创建 Binding 实例
|
|
40
|
+
* 与 `new Binding()` 等价
|
|
41
|
+
*/
|
|
42
|
+
static create(file: DrawioFile, options: BindDrawioFileOptions): Binding;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/binding/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAOvD,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,iBAAiB,CAAC;AAEhE,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EACH,OAAO,GACP;QACE,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACP;AAED;;GAEG;AACH,qBAAa,OAAO;IAClB,wBAAwB;IACxB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC;IACpB,6BAA6B;IAC7B,OAAO,CAAC,YAAY,CAAe;IACnC,sBAAsB;IACtB,OAAO,CAAC,kBAAkB,CAAS;IACnC,2BAA2B;IAC3B,OAAO,CAAC,UAAU,CAAa;IAC/B,oBAAoB;IACpB,OAAO,CAAC,WAAW,CAKT;IACV,gCAAgC;IAChC,OAAO,CAAC,mBAAmB,CAAC,CAAa;IACzC,yBAAyB;IACzB,OAAO,CAAC,kBAAkB,CAAC,CAAa;gBAE5B,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB;IAkF5D;;;OAGG;IACH,OAAO,CAAC,IAAI,UAAQ,GAAG,IAAI;IAS3B;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO;CAGzE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type YDiagram } from "../models/diagram";
|
|
2
|
+
import { type YMxFile } from "../models/mxfile";
|
|
3
|
+
import * as Y from "yjs";
|
|
4
|
+
declare const DIFF_INSERT = "i";
|
|
5
|
+
declare const DIFF_REMOVE = "r";
|
|
6
|
+
declare const DIFF_UPDATE = "u";
|
|
7
|
+
export interface DiagramInsert {
|
|
8
|
+
data: string;
|
|
9
|
+
id: string;
|
|
10
|
+
previous: string;
|
|
11
|
+
}
|
|
12
|
+
export interface FilePatch {
|
|
13
|
+
[DIFF_REMOVE]?: string[];
|
|
14
|
+
[DIFF_INSERT]?: DiagramInsert[];
|
|
15
|
+
[DIFF_UPDATE]?: {
|
|
16
|
+
[key: string]: {
|
|
17
|
+
name?: string;
|
|
18
|
+
previous?: string;
|
|
19
|
+
cells?: {
|
|
20
|
+
[DIFF_REMOVE]?: string[];
|
|
21
|
+
[DIFF_INSERT]?: Record<string, string>[];
|
|
22
|
+
[DIFF_UPDATE]?: {
|
|
23
|
+
[key: string]: Record<string, string>;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare function applyFilePatch(doc: Y.Doc, patch: FilePatch, options?: {
|
|
30
|
+
origin?: unknown;
|
|
31
|
+
}): void;
|
|
32
|
+
export declare function initDocSnapshot(doc: Y.Doc, resetSnapshot?: boolean): void;
|
|
33
|
+
export declare function generatePatch(events: Y.YEvent<Y.XmlElement | Y.Array<string> | Y.Map<Y.XmlElement> | YMxFile | YDiagram>[], explicitDoc?: Y.Doc): FilePatch;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../src/binding/patch.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,QAAQ,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAC;AAO1B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,QAAA,MAAM,WAAW,MAAM,CAAC;AACxB,QAAA,MAAM,WAAW,MAAM,CAAC;AACxB,QAAA,MAAM,WAAW,MAAM,CAAC;AAgDxB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,CAAC,WAAW,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;IAChC,CAAC,WAAW,CAAC,CAAC,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,KAAK,CAAC,EAAE;gBACN,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;gBACzB,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;gBACzC,CAAC,WAAW,CAAC,CAAC,EAAE;oBACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;iBACvC,CAAC;aACH,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,CAAC,CAAC,GAAG,EACV,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,QAqR/B;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,aAAa,UAAQ,QAsDhE;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,CACd,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,OAAO,GAAG,QAAQ,CAC1E,EAAE,EACH,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,GAClB,SAAS,CAgSX"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 绑定 Y.UndoManager 到 draw.io 的 editor.undoManager,提供 mxUndoManager 兼容层。
|
|
3
|
+
* 仅在外部传入 undoManager 时调用。
|
|
4
|
+
*/
|
|
5
|
+
import * as Y from "yjs";
|
|
6
|
+
import type { DrawioFile } from "../types/drawio";
|
|
7
|
+
export declare function bindUndoManager(doc: Y.Doc, file: DrawioFile, yUndo: Y.UndoManager): () => void;
|
|
8
|
+
//# sourceMappingURL=undoManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undoManager.d.ts","sourceRoot":"","sources":["../../src/binding/undoManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAalD,wBAAgB,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,cAqLjF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Awareness } from "y-protocols/awareness";
|
|
2
|
+
export declare function getAwarenessStateValue<T>(awareness: Awareness, key: string, clientId?: string | number): T | null;
|
|
3
|
+
export declare function setAwarenessStateValue(awareness: Awareness, key: string, value: unknown, clientId?: string | number): boolean;
|
|
4
|
+
//# sourceMappingURL=awarenessStateValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"awarenessStateValue.d.ts","sourceRoot":"","sources":["../../src/helper/awarenessStateValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GACzB,CAAC,GAAG,IAAI,CAOV;AAcD,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GACzB,OAAO,CAWT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/helper/cursor.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,UA2B9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getId.d.ts","sourceRoot":"","sources":["../../src/helper/getId.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,IAAI,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,0BAGnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../src/helper/origin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,MAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/helper/random.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,UAMnD;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAmB3C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
package/helper/xml.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../src/helper/xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAuC7D,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,2BAIhC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,SAAI,UAKzD"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Binding } from "./binding";
|
|
2
|
+
export type { BindDrawioFileOptions } from "./binding";
|
|
3
|
+
export { xml2doc, doc2xml } from "./transformer";
|
|
4
|
+
export { LOCAL_ORIGIN } from "./helper/origin";
|
|
5
|
+
export { DEFAULT_USER_NAME_KEY, DEFAULT_USER_COLOR_KEY, } from "./binding/collaborator";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import { type MxGraphModel } from "./mxGraphModel";
|
|
3
|
+
import type { ElementCompact } from "xml-js";
|
|
4
|
+
export declare const key = "diagram";
|
|
5
|
+
export interface Diagram extends ElementCompact {
|
|
6
|
+
mxGraphModel: MxGraphModel;
|
|
7
|
+
}
|
|
8
|
+
export type YDiagram = Y.Map<unknown>;
|
|
9
|
+
export declare function parse(object: Diagram): YDiagram;
|
|
10
|
+
export declare function serialize(yDiagram: YDiagram): {
|
|
11
|
+
_attributes: {
|
|
12
|
+
name: string;
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
mxGraphModel: {
|
|
16
|
+
_attributes: {};
|
|
17
|
+
root: {
|
|
18
|
+
mxCell: Record<string, unknown>[];
|
|
19
|
+
};
|
|
20
|
+
} | undefined;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=diagram.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagram.d.ts","sourceRoot":"","sources":["../../src/models/diagram.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,eAAO,MAAM,GAAG,YAAY,CAAC;AAE7B,MAAM,WAAW,OAAQ,SAAQ,cAAc;IAC7C,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAEtC,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,CAS/C;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ;;cAOG,MAAM;YACV,MAAM;;;;;;;;EAMhD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import type { ElementCompact } from "xml-js";
|
|
3
|
+
export declare const key = "mxCell";
|
|
4
|
+
declare const mxGeometryKey = "mxGeometry";
|
|
5
|
+
export interface MxCellModel extends ElementCompact {
|
|
6
|
+
[mxGeometryKey]?: ElementCompact;
|
|
7
|
+
}
|
|
8
|
+
export declare function parse(object: MxCellModel): Y.XmlElement;
|
|
9
|
+
export declare function serialize(xmlElement: Y.XmlElement): Record<string, unknown>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=mxCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mxCell.d.ts","sourceRoot":"","sources":["../../src/models/mxCell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,eAAO,MAAM,GAAG,WAAW,CAAC;AAE5B,QAAA,MAAM,aAAa,eAAe,CAAC;AAGnC,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,CAAC,aAAa,CAAC,CAAC,EAAE,cAAc,CAAC;CAClC;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,CAAC,CAAC,UAAU,CAoBvD;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,2BA8BjD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import { type MxCellModel } from "./mxCell";
|
|
3
|
+
import type { ElementCompact } from "xml-js";
|
|
4
|
+
export declare const key = "mxGraphModel";
|
|
5
|
+
export declare const mxCellOrderKey: string;
|
|
6
|
+
export interface MxGraphModel extends ElementCompact {
|
|
7
|
+
root: {
|
|
8
|
+
mxCell: MxCellModel[];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export type YMxGraphModel = Y.Map<unknown>;
|
|
12
|
+
export declare function parse(object: MxGraphModel, doc?: Y.Doc): YMxGraphModel;
|
|
13
|
+
export declare function serialize(map: YMxGraphModel): {
|
|
14
|
+
_attributes: {};
|
|
15
|
+
root: {
|
|
16
|
+
mxCell: Record<string, unknown>[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=mxGraphModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mxGraphModel.d.ts","sourceRoot":"","sources":["../../src/models/mxGraphModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,eAAO,MAAM,GAAG,iBAAiB,CAAC;AAClC,eAAO,MAAM,cAAc,QAAsB,CAAC;AAElD,MAAM,WAAW,YAAa,SAAQ,cAAc;IAClD,IAAI,EAAE;QACJ,MAAM,EAAE,WAAW,EAAE,CAAC;KACvB,CAAC;CACH;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAE3C,wBAAgB,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,GAsB5B,aAAa,CACvC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa;;;;;EAW3C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import type { Diagram } from "./diagram";
|
|
3
|
+
import type { ElementCompact } from "xml-js";
|
|
4
|
+
export declare const key = "mxfile";
|
|
5
|
+
export declare const diagramOrderKey: string;
|
|
6
|
+
export type YMxFile = Y.Map<unknown>;
|
|
7
|
+
export interface MxFile extends ElementCompact {
|
|
8
|
+
diagram: Diagram[];
|
|
9
|
+
}
|
|
10
|
+
export declare function parse(object: MxFile, doc: Y.Doc): Y.Map<unknown>;
|
|
11
|
+
export declare function serializer(yMxFile: YMxFile): ElementCompact;
|
|
12
|
+
//# sourceMappingURL=mxfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mxfile.d.ts","sourceRoot":"","sources":["../../src/models/mxfile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAMzB,OAAO,KAAK,EAAE,OAAO,EAAY,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE7C,eAAO,MAAM,GAAG,WAAW,CAAC;AAC5B,eAAO,MAAM,eAAe,QAAuB,CAAC;AAEpD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAErC,MAAM,WAAW,MAAO,SAAQ,cAAc;IAC5C,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,kBAkB/C;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,CAgB3D"}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "y-mxgraph",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Yjs binding for draw.io (mxGraph) documents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./y-mxgraph.cjs.js",
|
|
7
|
+
"module": "./y-mxgraph.es.js",
|
|
8
|
+
"browser": "./y-mxgraph.umd.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./y-mxgraph.es.js",
|
|
13
|
+
"require": "./y-mxgraph.cjs.js",
|
|
14
|
+
"browser": "./y-mxgraph.umd.js",
|
|
15
|
+
"types": "./index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"y-protocols": "^1.0.0",
|
|
20
|
+
"yjs": "^13.6.0"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transformer/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAezB,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAkBtD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,SAAI,GAAG,MAAM,CAsBtD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* draw.io / mxGraph 核心类型声明
|
|
3
|
+
* 基于代码中实际使用到的 API 进行最小化类型定义
|
|
4
|
+
*/
|
|
5
|
+
/** mxGraph 页面 */
|
|
6
|
+
export interface DrawioPage {
|
|
7
|
+
getId(): string;
|
|
8
|
+
}
|
|
9
|
+
/** mxGraph 视图 */
|
|
10
|
+
export interface GraphView {
|
|
11
|
+
translate: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
scale: number;
|
|
16
|
+
}
|
|
17
|
+
/** mxGraph 模型 */
|
|
18
|
+
export interface MxGraphModel {
|
|
19
|
+
addListener(event: string, fn: (...args: unknown[]) => void): void;
|
|
20
|
+
removeListener(event: string, fn: (...args: unknown[]) => void): void;
|
|
21
|
+
getCell(id: string): unknown | null;
|
|
22
|
+
}
|
|
23
|
+
/** mxGraph 选区模型 */
|
|
24
|
+
export interface SelectionModel {
|
|
25
|
+
cells: Record<string, unknown>;
|
|
26
|
+
addListener(event: string, fn: (...args: unknown[]) => void): void;
|
|
27
|
+
removeListener(event: string, fn: (...args: unknown[]) => void): void;
|
|
28
|
+
}
|
|
29
|
+
/** mxGraph 实例 */
|
|
30
|
+
export interface MxGraph {
|
|
31
|
+
model: MxGraphModel;
|
|
32
|
+
container: HTMLElement;
|
|
33
|
+
view: GraphView;
|
|
34
|
+
addMouseListener(listener: unknown): void;
|
|
35
|
+
removeMouseListener(listener: unknown): void;
|
|
36
|
+
getSelectionModel(): SelectionModel;
|
|
37
|
+
highlightCell(cell: unknown, color: string, timeout: number, opacity: number, width: number): {
|
|
38
|
+
destroy(): void;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** draw.io 编辑器 */
|
|
42
|
+
export interface DrawioEditor {
|
|
43
|
+
graph: MxGraph;
|
|
44
|
+
undoManager?: {
|
|
45
|
+
eventListeners?: unknown[];
|
|
46
|
+
undoListener?: (...args: unknown[]) => void;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
undoListener?: (...args: unknown[]) => void;
|
|
50
|
+
}
|
|
51
|
+
/** draw.io UI */
|
|
52
|
+
export interface DrawioUi {
|
|
53
|
+
editor: DrawioEditor;
|
|
54
|
+
currentPage?: DrawioPage | null;
|
|
55
|
+
diagramContainer: HTMLElement;
|
|
56
|
+
pages: unknown[];
|
|
57
|
+
diffPages(oldPages: unknown[], newPages: unknown[]): unknown;
|
|
58
|
+
clonePages(pages: unknown[]): unknown[];
|
|
59
|
+
}
|
|
60
|
+
/** mxGraph 事件对象 */
|
|
61
|
+
export interface MxEventObject {
|
|
62
|
+
name: string;
|
|
63
|
+
getName(): string;
|
|
64
|
+
getProperty(key: string): unknown;
|
|
65
|
+
}
|
|
66
|
+
/** draw.io 文件对象 */
|
|
67
|
+
export interface DrawioFile {
|
|
68
|
+
data: string;
|
|
69
|
+
shadowPages: unknown[];
|
|
70
|
+
ui: DrawioUi;
|
|
71
|
+
getUi(): DrawioUi;
|
|
72
|
+
setShadowPages(pages: unknown[]): void;
|
|
73
|
+
patch(patches: unknown[]): void;
|
|
74
|
+
}
|
|
75
|
+
/** draw.io App(demo 中通过 iframe 访问) */
|
|
76
|
+
export interface DrawioApp {
|
|
77
|
+
currentFile: DrawioFile | null;
|
|
78
|
+
editor: DrawioEditor;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=drawio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawio.d.ts","sourceRoot":"","sources":["../../src/types/drawio.ts"],"names":[],"mappings":"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"}
|