@blueking/flow-canvas 0.0.1-beta.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.
Files changed (46) hide show
  1. package/README.md +725 -0
  2. package/dist/core/apply-command.d.ts +11 -0
  3. package/dist/core/editor.d.ts +50 -0
  4. package/dist/core/errors.d.ts +6 -0
  5. package/dist/core/history.d.ts +15 -0
  6. package/dist/core/plugin-manager.d.ts +58 -0
  7. package/dist/index-BAAMFT_J.js +236 -0
  8. package/dist/index-CleU3x1v.cjs +1 -0
  9. package/dist/index-DD3pv5ZZ.cjs +21 -0
  10. package/dist/index-siYsjzl4.js +181 -0
  11. package/dist/index.cjs.js +1 -0
  12. package/dist/index.d.ts +33 -0
  13. package/dist/index.esm.js +2709 -0
  14. package/dist/plugins/clipboard.d.ts +9 -0
  15. package/dist/plugins/connection-validator.d.ts +3 -0
  16. package/dist/plugins/minimap.d.ts +7 -0
  17. package/dist/plugins/selection.d.ts +7 -0
  18. package/dist/plugins/snapline.d.ts +6 -0
  19. package/dist/runtime/canvas-api.d.ts +25 -0
  20. package/dist/runtime/canvas-runtime-core.vue.d.ts +36 -0
  21. package/dist/runtime/event-bridge.d.ts +28 -0
  22. package/dist/runtime/graph-bridge.d.ts +127 -0
  23. package/dist/runtime/overlay-manager.d.ts +4 -0
  24. package/dist/runtime/shape-registry.d.ts +8 -0
  25. package/dist/runtime/use-edge-delete-tool.d.ts +11 -0
  26. package/dist/runtime/use-node-hover.d.ts +8 -0
  27. package/dist/runtime/use-port-visibility.d.ts +15 -0
  28. package/dist/shell/canvas-layout.vue.d.ts +35 -0
  29. package/dist/shell/canvas-node-palette.vue.d.ts +10 -0
  30. package/dist/shell/canvas-toolbar.vue.d.ts +11 -0
  31. package/dist/shell/default-node.vue.d.ts +4 -0
  32. package/dist/shell/default-schema.d.ts +39 -0
  33. package/dist/shell/node-actions-toolbar.vue.d.ts +18 -0
  34. package/dist/shell/node-quick-add-popover.vue.d.ts +36 -0
  35. package/dist/shell/toolbar-items.d.ts +13 -0
  36. package/dist/style.css +1 -0
  37. package/dist/types/api.d.ts +104 -0
  38. package/dist/types/command.d.ts +160 -0
  39. package/dist/types/flow-model.d.ts +46 -0
  40. package/dist/types/history.d.ts +18 -0
  41. package/dist/types/overlay.d.ts +17 -0
  42. package/dist/types/plugin.d.ts +64 -0
  43. package/dist/types/schema.d.ts +77 -0
  44. package/dist/utils/path.d.ts +7 -0
  45. package/dist/utils/uuid.d.ts +1 -0
  46. package/package.json +55 -0
@@ -0,0 +1,77 @@
1
+ import type { Component } from 'vue';
2
+ import type { FlowNodeModel, FlowEdgeModel, FlowPortModel } from './flow-model';
3
+ import type { CanvasApi } from './api';
4
+ import type { FlowModel } from './flow-model';
5
+ import type { CanvasHistory } from './history';
6
+ import type { NodeOverlayAnchors } from './overlay';
7
+ export type CanvasMode = 'edit' | 'readonly' | 'thumbnail';
8
+ export interface CanvasSchema {
9
+ nodeTypes: Record<string, CanvasNodeDefinition>;
10
+ edgeTypes?: Record<string, CanvasEdgeDefinition>;
11
+ defaultEdgeType?: string;
12
+ }
13
+ export interface NodeBehaviorConfig {
14
+ showActions?: boolean;
15
+ showPorts?: boolean;
16
+ draggable?: boolean;
17
+ selectable?: boolean;
18
+ deletable?: boolean;
19
+ connectable?: boolean;
20
+ copyable?: boolean;
21
+ disconnectable?: boolean;
22
+ debuggable?: boolean;
23
+ deleteDisabled?: boolean;
24
+ copyDisabled?: boolean;
25
+ copyInsertDisabled?: boolean;
26
+ disconnectDisabled?: boolean;
27
+ debugDisabled?: boolean;
28
+ /** 逐节点控制右侧"+"快捷添加按钮是否显示,默认跟随全局配置 */
29
+ quickAddEnabled?: boolean;
30
+ }
31
+ export interface CanvasNodeDefinition {
32
+ component: Component;
33
+ getSize: (node: FlowNodeModel) => {
34
+ width: number;
35
+ height: number;
36
+ };
37
+ getPorts?: (node: FlowNodeModel) => FlowPortModel[];
38
+ getBehavior?: (node: FlowNodeModel, ctx: CanvasCallbackContext) => NodeBehaviorConfig;
39
+ getOverlayAnchors?: (node: FlowNodeModel, ctx?: CanvasCallbackContext) => NodeOverlayAnchors;
40
+ x6CellConfig?: Record<string, unknown>;
41
+ }
42
+ export interface EdgeRenderState {
43
+ selected: boolean;
44
+ highlighted: boolean;
45
+ hovered: boolean;
46
+ }
47
+ export interface EdgeStyle {
48
+ stroke?: string;
49
+ strokeWidth?: number;
50
+ strokeDasharray?: string;
51
+ }
52
+ export interface CanvasEdgeDefinition {
53
+ router?: string | {
54
+ name: string;
55
+ args?: Record<string, unknown>;
56
+ };
57
+ connector?: string | {
58
+ name: string;
59
+ args?: Record<string, unknown>;
60
+ };
61
+ /** 根据边模型和渲染状态(selected/highlighted/hovered)返回边的视觉样式 */
62
+ style?: (edge: FlowEdgeModel, state: EdgeRenderState) => EdgeStyle;
63
+ /**
64
+ * @experimental 边标签的自定义渲染组件。
65
+ * 当前版本尚未完整实现(X6 边标签基于 SVG,集成 Vue 组件需要 HTML overlay 方案)。
66
+ * 如需自定义标签样式,建议通过 x6EdgeConfig.defaultLabel 配置 X6 原生标签 markup。
67
+ */
68
+ labelRenderer?: Component;
69
+ labelDraggable?: boolean;
70
+ x6EdgeConfig?: Record<string, unknown>;
71
+ }
72
+ export interface CanvasCallbackContext {
73
+ api: CanvasApi;
74
+ flowModel: FlowModel;
75
+ history: CanvasHistory;
76
+ mode: CanvasMode;
77
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Immutable path-based set on a plain object.
3
+ * - Empty path replaces the root value (must be object or undefined).
4
+ * - Auto-creates intermediate objects for missing keys.
5
+ * - `undefined` value deletes the leaf key.
6
+ */
7
+ export declare function setByPath(root: Record<string, unknown> | undefined, path: string[], value: unknown): Record<string, unknown> | undefined;
@@ -0,0 +1 @@
1
+ export declare function generateId(): string;
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@blueking/flow-canvas",
3
+ "version": "0.0.1-beta.1",
4
+ "description": "通用流程画布编辑引擎",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs.js",
7
+ "module": "./dist/index.esm.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.esm.js",
13
+ "require": "./dist/index.cjs.js"
14
+ },
15
+ "./style": "./dist/style.css"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "dev": "vite",
22
+ "build:lib": "vite build --mode lib",
23
+ "build:types": "vue-tsc -p tsconfig.build.json",
24
+ "prepublishOnly": "npm run build:lib && npm run build:types",
25
+ "type-check": "vue-tsc --noEmit"
26
+ },
27
+ "peerDependencies": {
28
+ "@antv/x6": "^2.18.0",
29
+ "@antv/x6-plugin-dnd": "^2.1.1",
30
+ "@antv/x6-plugin-export": "^2.1.6",
31
+ "@antv/x6-plugin-minimap": "^2.0.7",
32
+ "@antv/x6-plugin-selection": "^2.2.2",
33
+ "@antv/x6-plugin-snapline": "^2.1.7",
34
+ "@antv/x6-vue-shape": "^2.1.2",
35
+ "vue": "^3.5.0"
36
+ },
37
+ "peerDependenciesMeta": {
38
+ "@antv/x6-plugin-dnd": {
39
+ "optional": true
40
+ },
41
+ "@antv/x6-plugin-export": {
42
+ "optional": true
43
+ }
44
+ },
45
+ "devDependencies": {
46
+ "@vitejs/plugin-vue": "^6.0.1",
47
+ "@vitejs/plugin-vue-jsx": "^5.1.1",
48
+ "typescript": "^5.9.2",
49
+ "vite": "^7.1.2",
50
+ "vue-tsc": "^3.0.7"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ }
55
+ }