@mx-sose-front/mx-sose-graph 1.2.7 → 1.2.8
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/dist/index.d.ts +3 -5259
- package/dist/index.esm.js +18 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/src/components/Common/index.d.ts +3 -0
- package/dist/src/components/Common/index.d.ts.map +1 -0
- package/dist/src/components/ContextMenu/ContextMenu.vue.d.ts +55 -0
- package/dist/src/components/ContextMenu/ContextMenu.vue.d.ts.map +1 -0
- package/dist/src/components/Diagram/StrategicTaxonomyDiagram.vue.d.ts +21 -0
- package/dist/src/components/Diagram/StrategicTaxonomyDiagram.vue.d.ts.map +1 -0
- package/dist/src/components/DiagramListTooltip/DiagramListTooltip.vue.d.ts +32 -0
- package/dist/src/components/DiagramListTooltip/DiagramListTooltip.vue.d.ts.map +1 -0
- package/dist/src/components/Edge/Edge.vue.d.ts +36 -0
- package/dist/src/components/Edge/Edge.vue.d.ts.map +1 -0
- package/dist/src/components/Gantt/Gantt.vue.d.ts +17 -0
- package/dist/src/components/Gantt/Gantt.vue.d.ts.map +1 -0
- package/dist/src/components/GanttContextMenu/GanttContextMenu.vue.d.ts +37 -0
- package/dist/src/components/GanttContextMenu/GanttContextMenu.vue.d.ts.map +1 -0
- package/dist/src/components/InteractionLayer.vue.d.ts +28 -0
- package/dist/src/components/InteractionLayer.vue.d.ts.map +1 -0
- package/dist/src/components/LineStyle/ConnectionLine.vue.d.ts +30 -0
- package/dist/src/components/LineStyle/ConnectionLine.vue.d.ts.map +1 -0
- package/dist/src/components/LineStyle/LineStyleMarker.vue.d.ts +15 -0
- package/dist/src/components/LineStyle/LineStyleMarker.vue.d.ts.map +1 -0
- package/dist/src/components/Matrix/Matrix.vue.d.ts +9 -0
- package/dist/src/components/Matrix/Matrix.vue.d.ts.map +1 -0
- package/dist/src/components/Matrix/index.d.ts +34 -0
- package/dist/src/components/Matrix/index.d.ts.map +1 -0
- package/dist/src/components/MatrixContextMenu/MatrixContextMenu.vue.d.ts +31 -0
- package/dist/src/components/MatrixContextMenu/MatrixContextMenu.vue.d.ts.map +1 -0
- package/dist/src/components/NameEditor/NameEditor.vue.d.ts +30 -0
- package/dist/src/components/NameEditor/NameEditor.vue.d.ts.map +1 -0
- package/dist/src/components/Pin/Pin.vue.d.ts +25 -0
- package/dist/src/components/Pin/Pin.vue.d.ts.map +1 -0
- package/dist/src/components/Pin/Port.vue.d.ts +23 -0
- package/dist/src/components/Pin/Port.vue.d.ts.map +1 -0
- package/dist/src/components/SelectionBox/SelectionBox.vue.d.ts +30 -0
- package/dist/src/components/SelectionBox/SelectionBox.vue.d.ts.map +1 -0
- package/dist/src/components/Shape/Action.vue.d.ts +25 -0
- package/dist/src/components/Shape/Action.vue.d.ts.map +1 -0
- package/dist/src/components/Shape/ActivityAction.vue.d.ts +25 -0
- package/dist/src/components/Shape/ActivityAction.vue.d.ts.map +1 -0
- package/dist/src/components/Shape/Block.vue.d.ts +25 -0
- package/dist/src/components/Shape/Block.vue.d.ts.map +1 -0
- package/dist/src/components/Shape/ConceptualRole.vue.d.ts +25 -0
- package/dist/src/components/Shape/ConceptualRole.vue.d.ts.map +1 -0
- package/dist/src/components/Shape/Diagram.vue.d.ts +25 -0
- package/dist/src/components/Shape/Diagram.vue.d.ts.map +1 -0
- package/dist/src/components/Shape/DividingLine.vue.d.ts +36 -0
- package/dist/src/components/Shape/DividingLine.vue.d.ts.map +1 -0
- package/dist/src/components/Shape/DogEar.vue.d.ts +25 -0
- package/dist/src/components/Shape/DogEar.vue.d.ts.map +1 -0
- package/dist/src/components/Shape/Package.vue.d.ts +25 -0
- package/dist/src/components/Shape/Package.vue.d.ts.map +1 -0
- package/dist/src/components/Table/Table.vue.d.ts +20 -0
- package/dist/src/components/Table/Table.vue.d.ts.map +1 -0
- package/dist/src/constants/edgeShapeKeys.d.ts +46 -0
- package/dist/src/constants/edgeShapeKeys.d.ts.map +1 -0
- package/dist/src/constants/index.d.ts +668 -0
- package/dist/src/constants/index.d.ts.map +1 -0
- package/dist/src/hooks/index.d.ts +6 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/useChartRowSelection.d.ts +89 -0
- package/dist/src/hooks/useChartRowSelection.d.ts.map +1 -0
- package/dist/src/hooks/useHighlight.d.ts +82 -0
- package/dist/src/hooks/useHighlight.d.ts.map +1 -0
- package/dist/src/hooks/useNameEdit.d.ts +76 -0
- package/dist/src/hooks/useNameEdit.d.ts.map +1 -0
- package/dist/src/hooks/useResize.d.ts +65 -0
- package/dist/src/hooks/useResize.d.ts.map +1 -0
- package/dist/src/hooks/useVirtualScroll.d.ts +110 -0
- package/dist/src/hooks/useVirtualScroll.d.ts.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/render/shape-registry.d.ts +9 -0
- package/dist/src/render/shape-registry.d.ts.map +1 -0
- package/dist/src/render/shape-renderer.d.ts +12 -0
- package/dist/src/render/shape-renderer.d.ts.map +1 -0
- package/dist/src/store/eventBus.d.ts +10 -0
- package/dist/src/store/eventBus.d.ts.map +1 -0
- package/dist/src/store/graphStore.d.ts +4644 -0
- package/dist/src/store/graphStore.d.ts.map +1 -0
- package/dist/src/store/index.d.ts +3 -0
- package/dist/src/store/index.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +279 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/interactionLayer.d.ts +23 -0
- package/dist/src/types/interactionLayer.d.ts.map +1 -0
- package/dist/src/utils/autoExpandParent.d.ts +38 -0
- package/dist/src/utils/autoExpandParent.d.ts.map +1 -0
- package/dist/src/utils/batchAutoExpand.d.ts +12 -0
- package/dist/src/utils/batchAutoExpand.d.ts.map +1 -0
- package/dist/src/utils/colorUtils.d.ts +38 -0
- package/dist/src/utils/colorUtils.d.ts.map +1 -0
- package/dist/src/utils/compartment.d.ts +92 -0
- package/dist/src/utils/compartment.d.ts.map +1 -0
- package/dist/src/utils/containers.d.ts +119 -0
- package/dist/src/utils/containers.d.ts.map +1 -0
- package/dist/src/utils/contextMenuUtils.d.ts +108 -0
- package/dist/src/utils/contextMenuUtils.d.ts.map +1 -0
- package/dist/src/utils/dateUtils.d.ts +77 -0
- package/dist/src/utils/dateUtils.d.ts.map +1 -0
- package/dist/src/utils/diagram.d.ts +289 -0
- package/dist/src/utils/diagram.d.ts.map +1 -0
- package/dist/src/utils/dom.d.ts +2 -0
- package/dist/src/utils/dom.d.ts.map +1 -0
- package/dist/src/utils/drag.d.ts +65 -0
- package/dist/src/utils/drag.d.ts.map +1 -0
- package/dist/src/utils/edgeUtils.d.ts +326 -0
- package/dist/src/utils/edgeUtils.d.ts.map +1 -0
- package/dist/src/utils/edgeWorker.d.ts +182 -0
- package/dist/src/utils/edgeWorker.d.ts.map +1 -0
- package/dist/src/utils/geom.d.ts +103 -0
- package/dist/src/utils/geom.d.ts.map +1 -0
- package/dist/src/utils/graphDragService.d.ts +62 -0
- package/dist/src/utils/graphDragService.d.ts.map +1 -0
- package/dist/src/utils/hittest.d.ts +27 -0
- package/dist/src/utils/hittest.d.ts.map +1 -0
- package/dist/src/utils/iconLoader.d.ts +16 -0
- package/dist/src/utils/iconLoader.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +8 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/keyboardUtils.d.ts +25 -0
- package/dist/src/utils/keyboardUtils.d.ts.map +1 -0
- package/dist/src/utils/license-guard.d.ts +10 -0
- package/dist/src/utils/license-guard.d.ts.map +1 -0
- package/dist/src/utils/packageOutline.d.ts +32 -0
- package/dist/src/utils/packageOutline.d.ts.map +1 -0
- package/dist/src/utils/pinUtils.d.ts +79 -0
- package/dist/src/utils/pinUtils.d.ts.map +1 -0
- package/dist/src/utils/policy.d.ts +44 -0
- package/dist/src/utils/policy.d.ts.map +1 -0
- package/dist/src/utils/rafThrottle.d.ts +63 -0
- package/dist/src/utils/rafThrottle.d.ts.map +1 -0
- package/dist/src/utils/shapeOps/shapeOps.d.ts +21 -0
- package/dist/src/utils/shapeOps/shapeOps.d.ts.map +1 -0
- package/dist/src/utils/viewportCulling.d.ts +73 -0
- package/dist/src/utils/viewportCulling.d.ts.map +1 -0
- package/dist/src/utils/workerManager.d.ts +86 -0
- package/dist/src/utils/workerManager.d.ts.map +1 -0
- package/dist/src/utils/zorder.d.ts +4 -0
- package/dist/src/utils/zorder.d.ts.map +1 -0
- package/dist/src/view/graph.vue.d.ts +180 -0
- package/dist/src/view/graph.vue.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ContextMenu/ContextMenu.vue +2 -2
- package/src/utils/workerManager.ts +4 -1
- package/src/vite-env.d.ts +2 -2
- package/dist/assets/edgeWorker-b57ca007.js +0 -2
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export declare const clamp: (v: number, min: number, max: number) => number;
|
|
2
|
+
export declare const toLocalPoint: (evt: MouseEvent, el: HTMLElement | null) => {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const clientToLocalPoint: (clientX: number, clientY: number, el: HTMLElement | null) => {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const localToClientPoint: (x: number, y: number, el: HTMLElement | null) => {
|
|
11
|
+
clientX: number;
|
|
12
|
+
clientY: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const isInsideCanvasClient: (clientX: number, clientY: number, el: HTMLElement | null) => boolean;
|
|
15
|
+
export declare const inBounds: (pt: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}, b?: {
|
|
19
|
+
x?: number;
|
|
20
|
+
y?: number;
|
|
21
|
+
width?: number;
|
|
22
|
+
height?: number;
|
|
23
|
+
}) => boolean;
|
|
24
|
+
export type Point = {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
};
|
|
28
|
+
export type Rect = {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
};
|
|
34
|
+
export type Bounds = {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
};
|
|
40
|
+
export type ContainerRect = {
|
|
41
|
+
left: number;
|
|
42
|
+
top: number;
|
|
43
|
+
right: number;
|
|
44
|
+
bottom: number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* 从 Shape(或包含 bounds 的对象)中取出完整的矩形,缺省值补 0
|
|
48
|
+
*/
|
|
49
|
+
export declare const getBounds: (s?: {
|
|
50
|
+
bounds?: Partial<Rect>;
|
|
51
|
+
} | null) => Rect;
|
|
52
|
+
export declare function getDiagramRect(shapes: any[]): ContainerRect;
|
|
53
|
+
export type EdgeFlags = {
|
|
54
|
+
left?: boolean;
|
|
55
|
+
top?: boolean;
|
|
56
|
+
right?: boolean;
|
|
57
|
+
bottom?: boolean;
|
|
58
|
+
};
|
|
59
|
+
export declare function clampPointToRect(pt: {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
}, elem: Bounds, container: ContainerRect, edges: EdgeFlags): {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
};
|
|
66
|
+
/** 缩放手柄方向 */
|
|
67
|
+
export type Handle = "nw" | "ne" | "sw" | "se";
|
|
68
|
+
export declare function clampRectToContainer(r: Rect, container: ContainerRect, edges: EdgeFlags, minW: number, minH: number): Rect;
|
|
69
|
+
/**
|
|
70
|
+
* 计算拖动预览:基于按下点与当前点的位移,得到下一帧矩形,
|
|
71
|
+
* 仅改变位置(x/y),并按容器与 edges 做位置约束。
|
|
72
|
+
*/
|
|
73
|
+
export declare function ghostDragStep(base: Rect, // 按下时的元素矩形
|
|
74
|
+
anchor: Point, // 按下时指针(本地坐标)
|
|
75
|
+
curr: Point, // 当前指针(本地坐标)
|
|
76
|
+
container: ContainerRect, // 画布容器(left/top/right/bottom)
|
|
77
|
+
edges: EdgeFlags): Rect;
|
|
78
|
+
/**
|
|
79
|
+
* 计算缩放预览:基于手柄方向与指针位移得到下一帧矩形,
|
|
80
|
+
* 保持对角锚点不动,应用最小尺寸与容器约束。
|
|
81
|
+
*/
|
|
82
|
+
export declare function ghostResizeStep(base: Rect, // 按下时的元素矩形
|
|
83
|
+
handle: Handle, // 手柄方向:"nw" | "ne" | "sw" | "se"
|
|
84
|
+
anchor: Point, // 按下时指针(本地坐标)
|
|
85
|
+
curr: Point, // 当前指针(本地坐标)
|
|
86
|
+
container: ContainerRect, // 画布容器
|
|
87
|
+
edges: EdgeFlags, // 限制哪几条边
|
|
88
|
+
minW: number, // 最小宽
|
|
89
|
+
minH: number): Rect;
|
|
90
|
+
export declare function rectFromPoints(a: {
|
|
91
|
+
x: number;
|
|
92
|
+
y: number;
|
|
93
|
+
}, b: {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
}): {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
width: number;
|
|
100
|
+
height: number;
|
|
101
|
+
};
|
|
102
|
+
export declare function rectContainsRect(outer: Rect, inner: Rect): boolean;
|
|
103
|
+
//# sourceMappingURL=geom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geom.d.ts","sourceRoot":"","sources":["../../../src/utils/geom.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,MAAO,MAAM,OAAO,MAAM,OAAO,MAAM,WACxB,CAAA;AAGjC,eAAO,MAAM,YAAY,QAAS,UAAU,MAAM,WAAW,GAAG,IAAI;;;CAWnE,CAAA;AAGD,eAAO,MAAM,kBAAkB,YAAa,MAAM,WAAW,MAAM,MAAM,WAAW,GAAG,IAAI;;;CAQ1F,CAAA;AAGD,eAAO,MAAM,kBAAk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,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,EAAE,CAAC,EAAC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC;;;;;EAM3E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,WAOxD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { OwnerPayload, Shape } from '../types';
|
|
2
|
+
import { Rect } from './containers';
|
|
3
|
+
|
|
4
|
+
type PrevParentMap = Record<string, string | null>;
|
|
5
|
+
/**
|
|
6
|
+
* 根据 changedIds 记录“拖动前”的父 id 映射
|
|
7
|
+
*/
|
|
8
|
+
export declare const buildPrevParentMap: (shapes: Shape[], changedIds: string[]) => PrevParentMap;
|
|
9
|
+
/**
|
|
10
|
+
* 处理“换父 + 克隆 + comparents”的业务
|
|
11
|
+
* - 负责 finalCheckCanNest
|
|
12
|
+
* - 负责克隆 & emit('addShape')
|
|
13
|
+
* - 负责 comparents add/remove
|
|
14
|
+
* - 产生 ownerPayload / clonedIds
|
|
15
|
+
* - 若嵌套不通过,会返回 { cancelled: true }
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyReparentAndClone(options: {
|
|
18
|
+
shapes: Shape[];
|
|
19
|
+
changedIds: string[];
|
|
20
|
+
prevParentById: PrevParentMap;
|
|
21
|
+
source?: string;
|
|
22
|
+
dragBase: Record<string, Rect>;
|
|
23
|
+
updateShape: (id: string, updates: Partial<Shape>) => void;
|
|
24
|
+
pendingNestedIds: {
|
|
25
|
+
value: string[];
|
|
26
|
+
};
|
|
27
|
+
addShape: (s: Shape) => void;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
ownerPayload: OwnerPayload | null;
|
|
30
|
+
clonedIds: string[];
|
|
31
|
+
cancelled: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* 对“本次被拖动的隔间组件”做一次自动扩容检查
|
|
35
|
+
* - 用于你现在说的:父已经贴到画布顶部了,之后拖下来有空间,要再扩一次把子从头部/内容区顶出来
|
|
36
|
+
*/
|
|
37
|
+
export declare const autoExpandMovedCompartmentsAfterDrag: (shapes: Shape[], changedIds: string[], updateShape: (id: string, updates: Partial<Shape>) => void) => void;
|
|
38
|
+
/**
|
|
39
|
+
* 收集拖动影响到的所有 shape id
|
|
40
|
+
* - changedIds / clonedIds 本身
|
|
41
|
+
* - 这些节点的父节点 + 子树
|
|
42
|
+
* - 所有这些节点的祖先链
|
|
43
|
+
*/
|
|
44
|
+
export declare const collectAffectedShapeIds: (shapes: Shape[], changedIds: string[], clonedIds: string[]) => Set<string>;
|
|
45
|
+
/**
|
|
46
|
+
* 根据 affectedIds 生成 deep 拷贝后的 payloads
|
|
47
|
+
* (发给 shape-drag-end 用)
|
|
48
|
+
*/
|
|
49
|
+
export declare const buildDragEndPayloads: (affectedIds: Set<string>, shapes: Shape[]) => Shape[];
|
|
50
|
+
/**
|
|
51
|
+
* 创建 onNestDone 回调
|
|
52
|
+
* - 只在嵌套接口成功时,再进行“按子扩父 + shape-size-update”
|
|
53
|
+
*/
|
|
54
|
+
export declare const createOnNestDoneCallback: (options: {
|
|
55
|
+
shapesRef: {
|
|
56
|
+
value: Shape[];
|
|
57
|
+
};
|
|
58
|
+
ownerPayload: OwnerPayload | null;
|
|
59
|
+
updateShape: (id: string, updates: Partial<Shape>) => void;
|
|
60
|
+
}) => (ok: boolean) => void;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=graphDragService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphDragService.d.ts","sourceRoot":"","sources":["../../../src/utils/graphDragService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAA0B,MAAM,SAAS,CAAA;AAC1E,OAAO,EAAsD,KAAK,IAAI,EAAE,MAAM,cAAc,CAAA;AAS5F,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,E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kBACf,YAAY,GAAG,IAAI;sBACf,MAAM,WAAW,QAAQ,KAAK,CAAC,KAAK,IAAI;WACrD,OAAO,KAAK,IA8BpB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Shape } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const isDiagram: (s: any) => boolean;
|
|
4
|
+
export declare const isShape: (s: any) => boolean;
|
|
5
|
+
export declare const isEdge: (s: any) => boolean;
|
|
6
|
+
export declare const isPin: (s: any) => boolean;
|
|
7
|
+
export type HitResult = {
|
|
8
|
+
kind: 'shape';
|
|
9
|
+
shape: Shape;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'edge';
|
|
12
|
+
shape: Shape;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'pin';
|
|
15
|
+
shape: Shape;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'diagram';
|
|
18
|
+
shape: Shape;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'none';
|
|
21
|
+
shape: null;
|
|
22
|
+
};
|
|
23
|
+
export declare function pickTarget(shapes: readonly Shape[], pt: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}): HitResult;
|
|
27
|
+
//# sourceMappingURL=hittest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hittest.d.ts","sourceRoot":"","sources":["../../../src/utils/hittest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC,eAAO,MAAM,SAAS,MAAO,GAAG,YAC2B,CAAA;AAC3D,eAAO,MAAM,OAAO,MAAO,GAAG,YAC2B,CAAA;AACzD,eAAO,MAAM,MAAM,MAAO,GAAG,YAC2B,CAAA;AACxD,eAAO,MAAM,KAAK,MAAO,GAAG,YAC2B,CAAA;AAMvD,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAAA;AAmEjC,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,EAAE,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA4C5F"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 全局图标加载工具
|
|
3
|
+
*/
|
|
4
|
+
export interface IconMap {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class IconLoader {
|
|
8
|
+
private static iconMaps;
|
|
9
|
+
static loadIcons(iconPath: string): IconMap;
|
|
10
|
+
static getMenuIcon(iconName: string, isDisabled?: boolean, disabledIconName?: string): string;
|
|
11
|
+
static getIcon(iconPath: string, iconName: string): string;
|
|
12
|
+
static clearCache(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare const getMenuIcon: (iconName: string, isDisabled?: boolean, disabledIconName?: string) => string;
|
|
15
|
+
export declare const getIcon: (iconPath: string, iconName: string) => string;
|
|
16
|
+
//# sourceMappingURL=iconLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconLoader.d.ts","sourceRoot":"","sources":["../../../src/utils/iconLoader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,OAAO;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmC;IAE1D,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAgE3C,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;IAgBpG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAK1D,MAAM,CAAC,UAAU,IAAI,IAAI;CAG1B;AAED,eAAO,MAAM,WAAW,aAAc,MAAM,eAAe,OAAO,qBAAqB,MAAM,WAC7B,CAAC;AACjE,eAAO,MAAM,OAAO,aAAc,MAAM,YAAY,MAAM,WAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAchC;AAGD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type KeyboardEventHandler = (e: KeyboardEvent) => void;
|
|
2
|
+
interface KeyboardConfig {
|
|
3
|
+
onDelete?: () => void;
|
|
4
|
+
onEditProperty?: () => void;
|
|
5
|
+
onCancelConnection?: () => void;
|
|
6
|
+
onShapesRemove?: (items: Array<{
|
|
7
|
+
modelId: string;
|
|
8
|
+
shapeId: string;
|
|
9
|
+
shapeType: string;
|
|
10
|
+
isRemoveModelTree: boolean;
|
|
11
|
+
}>) => void;
|
|
12
|
+
isEditingName?: () => boolean;
|
|
13
|
+
onCopy?: () => void;
|
|
14
|
+
onCut?: () => void;
|
|
15
|
+
onPaste?: () => void;
|
|
16
|
+
isTextareaDialogOpen?: () => boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 创建键盘事件处理器
|
|
20
|
+
* @param config 快捷键配置
|
|
21
|
+
* @returns 键盘事件处理函数
|
|
22
|
+
*/
|
|
23
|
+
export declare const createKeyboardHandler: (config: KeyboardConfig) => KeyboardEventHandler | any;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=keyboardUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboardUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/keyboardUtils.ts"],"names":[],"mappings":"AAQA,KAAK,oBAAoB,GAAG,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;AAGvD,UAAU,cAAc;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,OAAO,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC7H,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC;CACtC;AAsFD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,WAAY,cAAc,KAAG,oBAAoB,GAAG,GAgUrF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 操作拦截器:
|
|
3
|
+
* - canOperate=false 时:提示并阻止执行(warning 同一时间只显示一个)
|
|
4
|
+
* - canOperate=true 时:执行传入的函数
|
|
5
|
+
*/
|
|
6
|
+
export declare function guardOperate<T>(fn: () => T | Promise<T>, options?: {
|
|
7
|
+
message?: string;
|
|
8
|
+
silent?: boolean;
|
|
9
|
+
}): Promise<T | undefined>;
|
|
10
|
+
//# sourceMappingURL=license-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-guard.d.ts","sourceRoot":"","sources":["../../../src/utils/license-guard.ts"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/C,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAYxB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue';
|
|
2
|
+
import { Rect } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 描述包轮廓覆盖层所需的几何输入。
|
|
6
|
+
*/
|
|
7
|
+
export interface PackageOutlineOverlayOptions {
|
|
8
|
+
bounds: Rect | null | undefined;
|
|
9
|
+
strokeWidth: number;
|
|
10
|
+
padding?: number;
|
|
11
|
+
zIndex: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 供交互层直接消费的包轮廓覆盖层结果。
|
|
15
|
+
*/
|
|
16
|
+
export interface PackageOutlineOverlay {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
path: string;
|
|
20
|
+
style: CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
export declare const PACKAGE_OUTLINE_TAB_HEIGHT = 18;
|
|
23
|
+
export declare const PACKAGE_OUTLINE_PADDING = 5;
|
|
24
|
+
/**
|
|
25
|
+
* 根据给定宽高生成包形状的 SVG 外轮廓路径。
|
|
26
|
+
*/
|
|
27
|
+
export declare const buildPackageOutlinePath: (width: number, height: number, strokeWidth: number) => string;
|
|
28
|
+
/**
|
|
29
|
+
* 一次性计算包轮廓覆盖层需要的尺寸、路径和绝对定位样式。
|
|
30
|
+
*/
|
|
31
|
+
export declare const buildPackageOutlineOverlay: ({ bounds, strokeWidth, padding, zIndex, }: PackageOutlineOverlayOptions) => PackageOutlineOverlay;
|
|
32
|
+
//# sourceMappingURL=packageOutline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageOutline.d.ts","sourceRoot":"","sources":["../../../src/utils/packageOutline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC;CACtB;AAGD,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAG7C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,uBAAuB,UAC3B,MAAM,UACL,MAAM,eACD,MAAM,WAsBpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,8CAKpC,4BAA4B,KAAG,qBA4BjC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Shape, Bounds } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 找到距离鼠标点最近的边
|
|
5
|
+
*/
|
|
6
|
+
export declare function findNearestEdge(mousePoint: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}, blockBounds: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}): 'top' | 'right' | 'bottom' | 'left';
|
|
15
|
+
/**
|
|
16
|
+
* 计算 pin 附着在 block 边缘上的位置(完全贴边,且 pin 在父外侧露出)
|
|
17
|
+
* 不改变父元素的高宽
|
|
18
|
+
*
|
|
19
|
+
* 规则:
|
|
20
|
+
* - 右边:x = 父.x + 父.width,y 使用当前 pin 的 y(再按父高做约束)
|
|
21
|
+
* - 左边:x = 父.x - pin.width,y 使用当前 pin 的 y(再按父高做约束)
|
|
22
|
+
* - 上边:y = 父.y - pin.height,x 使用当前 pin 的 x(再按父宽做约束)
|
|
23
|
+
* - 下边:y = 父.y + 父.height,x 使用当前 pin 的 x(再按父宽做约束)
|
|
24
|
+
*
|
|
25
|
+
* @param pinBounds - pin 的 bounds
|
|
26
|
+
* @param blockBounds - block 的 bounds
|
|
27
|
+
* @param mousePoint - 鼠标位置(仅用于判定最近的边)
|
|
28
|
+
* @returns 计算后的 pin bounds(左上角坐标 + 宽高)
|
|
29
|
+
*/
|
|
30
|
+
export declare function calculatePinAttachmentPosition(pinShape: Shape, blockBounds: Bounds, mousePoint: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}, _opts?: {
|
|
34
|
+
overlap?: number;
|
|
35
|
+
}): Bounds;
|
|
36
|
+
/**
|
|
37
|
+
* 当拖动 pin 到 block 上时,计算附着位置
|
|
38
|
+
*
|
|
39
|
+
* @param pinShape - pin 的 shape 对象
|
|
40
|
+
* @param parentBlock - 父 block 的 shape 对象
|
|
41
|
+
* @param mousePoint - 鼠标位置(本地坐标)
|
|
42
|
+
* @returns 计算后的 pin bounds
|
|
43
|
+
*/
|
|
44
|
+
export declare function attachPinToBlock(pinShape: Shape, parentBlock: Shape, mousePoint: {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}): Bounds;
|
|
48
|
+
/**
|
|
49
|
+
* 吸附 pin 到父图元最近的边上,返回调整后的坐标
|
|
50
|
+
* 保持“完全贴边且在外侧露出”,不再做向内重叠缝隙处理
|
|
51
|
+
* @param dropPoint 落点坐标
|
|
52
|
+
* @param parentShape 父 shape
|
|
53
|
+
* @param pinShape pin shape
|
|
54
|
+
* @returns 调整后的 x, y 坐标
|
|
55
|
+
*/
|
|
56
|
+
export declare function snapPinToParentEdge(dropPoint: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
}, parentShape: Shape, pinShape: Shape): {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* 仅用于“移动时”的吸附:
|
|
65
|
+
* - 计算 pin 应贴边后的目标左上角
|
|
66
|
+
* - 再加上拖拽偏移 dragOffset,返回“应当传给 moveDraggedShape 的指针坐标”
|
|
67
|
+
* 这样可避免直接把左上角传入导致的位移误差(产生你看到的缝隙)
|
|
68
|
+
*/
|
|
69
|
+
export declare function snapPinPointerOnMove(pointer: {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
}, parentShape: Shape, pinShape: Shape, dragOffset?: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
}): {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=pinUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pinUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/pinUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AA8B7C;;GAEG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACp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AAA;CAAE,CAuI1B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CheckNested, NestingConfig, Shape } from '../types';
|
|
2
|
+
import { EdgeFlags } from './geom';
|
|
3
|
+
|
|
4
|
+
export type ElementPolicy = {
|
|
5
|
+
draggable: boolean;
|
|
6
|
+
resizable: boolean;
|
|
7
|
+
constrainToDiagram: EdgeFlags;
|
|
8
|
+
};
|
|
9
|
+
export declare const DEFAULT_POLICY: ElementPolicy;
|
|
10
|
+
export declare const POLICY_BY_TYPE: Record<string, Partial<ElementPolicy>>;
|
|
11
|
+
export declare function getPolicy(s: any): ElementPolicy;
|
|
12
|
+
export declare const nestingConfig: NestingConfig;
|
|
13
|
+
export declare function canNest(child: Shape | null, parent: Shape | null, all: Shape[], cfg?: NestingConfig): boolean;
|
|
14
|
+
/** ==================统一的“远端校验工具” ================== */
|
|
15
|
+
/** 画布的类型 key,作为“落到画布”的 parentType */
|
|
16
|
+
export declare const DIAGRAM_TYPE_KEY = "diagram";
|
|
17
|
+
/** 解析 hover 目标:返回目标 id 与类型(shape 或 diagram) */
|
|
18
|
+
export type NestTarget = {
|
|
19
|
+
kind: 'diagram';
|
|
20
|
+
parentId: null;
|
|
21
|
+
parentType: typeof DIAGRAM_TYPE_KEY;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'shape';
|
|
24
|
+
parentId: string;
|
|
25
|
+
parentType: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function resolveNestTarget(hoverId: string | null, shapes: Shape[]): NestTarget;
|
|
28
|
+
/**
|
|
29
|
+
* 统一入口:先做本地 canNest,再做远端校验。
|
|
30
|
+
* - hoverId 为空 => 落在画布(parentType = 'diagram')
|
|
31
|
+
* - 返回 true 表示“可以放”;返回 false 表示“不能放”(外部直接把 hoverNestable 置 false 即可)
|
|
32
|
+
*/
|
|
33
|
+
export interface CheckNestedResult {
|
|
34
|
+
ok: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** 组装后端需要的校验参数 */
|
|
37
|
+
export declare const buildCheckNestedPayload: (dragged: Shape | null, parent: Shape | null, diagram: Shape | null) => CheckNested | null;
|
|
38
|
+
/**
|
|
39
|
+
* front 去调后端进行“是否允许嵌套/放置”的校验。
|
|
40
|
+
* - front 侧约定:收到 'check-nest:req' 后调接口,回 'check-nest:ok' 时携带 { reqId, ok: boolean }
|
|
41
|
+
* - 若发生异常,front 回 'check-nest:err';若 front 没回,则超时返回 { ok:false }
|
|
42
|
+
*/
|
|
43
|
+
export declare const checkNestViaFront: (dragged: Shape | null, parent: Shape | null, diagram: Shape | null, timeout?: number) => Promise<CheckNestedResult>;
|
|
44
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/utils/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAIvC,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,kBAAkB,EAAE,SAAS,CAAA;CAC9B,CAAA;AAGD,eAAO,MAAM,cAAc,EAAE,aAK5B,CAAA;AAGD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAKjE,CAAA;AAGD,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,aAAa,CAQ/C;AAGD,eAAO,MAAM,aAAa,EAAE,aAM3B,CAAA;AAGD,wBAAgB,OAAO,CACrB,KAAK,EAAE,KAAK,GAAG,IAAI,EACnB,MAAM,EAAE,KAAK,GAAG,IAAI,EACpB,GAAG,EAAE,KAAK,EAAE,EACZ,GAAG,GAAE,aAA6B,GACjC,OAAO,CAoDT;AACD,uDAAuD;AACvD,qCAAqC;AACrC,eAAO,MAAM,gBAAgB,YAAY,CAAA;AAEzC,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,OAAO,gBAAgB,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAKrF;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;CACb;AACD,kBAAkB;AAElB,eAAO,MAAM,uBAAuB,YACzB,KAAK,GAAG,IAAI,UACb,KAAK,GAAG,IAAI,WACX,KAAK,GAAG,IAAI,KACpB,WAAW,GAAG,IAsChB,CAAA;AACD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,YACnB,KAAK,GAAG,IAAI,UACb,KAAK,GAAG,IAAI,WACX,KAAK,GAAG,IAAI,uBAEpB,QAAQ,iBAAiB,CA0B3B,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RAF (requestAnimationFrame) 节流工具类
|
|
3
|
+
* 用于优化高频事件(如 mousemove、scroll 等)的性能
|
|
4
|
+
* 确保在浏览器重绘前只执行一次回调,避免不必要的计算
|
|
5
|
+
*/
|
|
6
|
+
export declare class RAFThrottle {
|
|
7
|
+
private rafId;
|
|
8
|
+
private lastArgs;
|
|
9
|
+
private isPending;
|
|
10
|
+
/**
|
|
11
|
+
* 节流执行函数
|
|
12
|
+
* @param fn 要执行的函数
|
|
13
|
+
* @returns 节流后的函数
|
|
14
|
+
*/
|
|
15
|
+
throttle<T extends (...args: any[]) => any>(fn: T): T;
|
|
16
|
+
/**
|
|
17
|
+
* 取消待执行的 RAF
|
|
18
|
+
*/
|
|
19
|
+
cancel(): void;
|
|
20
|
+
/**
|
|
21
|
+
* 立即执行待处理的回调(如果有)
|
|
22
|
+
*/
|
|
23
|
+
flush(): void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 创建 RAF 节流实例
|
|
27
|
+
* @returns RAFThrottle 实例
|
|
28
|
+
*/
|
|
29
|
+
export declare function createRAFThrottle(): RAFThrottle;
|
|
30
|
+
/**
|
|
31
|
+
* RAF 防抖工具类
|
|
32
|
+
* 延迟执行函数,但在延迟期间如果有新调用,则重新计时
|
|
33
|
+
* 使用 requestAnimationFrame 确保在浏览器重绘前执行
|
|
34
|
+
*/
|
|
35
|
+
export declare class RAFDebounce {
|
|
36
|
+
private rafId;
|
|
37
|
+
private delay;
|
|
38
|
+
private timer;
|
|
39
|
+
private lastArgs;
|
|
40
|
+
private isPending;
|
|
41
|
+
constructor(delay?: number);
|
|
42
|
+
/**
|
|
43
|
+
* 防抖执行函数
|
|
44
|
+
* @param fn 要执行的函数
|
|
45
|
+
* @returns 防抖后的函数
|
|
46
|
+
*/
|
|
47
|
+
debounce<T extends (...args: any[]) => any>(fn: T): T;
|
|
48
|
+
/**
|
|
49
|
+
* 取消待执行的 RAF 和定时器
|
|
50
|
+
*/
|
|
51
|
+
cancel(): void;
|
|
52
|
+
/**
|
|
53
|
+
* 立即执行待处理的回调(如果有)
|
|
54
|
+
*/
|
|
55
|
+
flush(): void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 创建 RAF 防抖实例
|
|
59
|
+
* @param delay 延迟时间(毫秒)
|
|
60
|
+
* @returns RAFDebounce 实例
|
|
61
|
+
*/
|
|
62
|
+
export declare function createRAFDebounce(delay?: number): RAFDebounce;
|
|
63
|
+
//# sourceMappingURL=rafThrottle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rafThrottle.d.ts","sourceRoot":"","sources":["../../../src/utils/rafThrottle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,SAAS,CAAQ;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;IAuBrD;;OAEG;IACH,MAAM,IAAI,IAAI;IAQd;;OAEG;IACH,KAAK,IAAI,IAAI;CAOd;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAE/C;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,SAAS,CAAQ;gBAEb,KAAK,GAAE,MAAU;IAI7B;;;;OAIG;IACH,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;IAiCrD;;OAEG;IACH,MAAM,IAAI,IAAI;IAYd;;OAEG;IACH,KAAK,IAAI,IAAI;CAWd;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,MAAU,GAAG,WAAW,CAEhE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图元批量操作工具(新增/更新/删除/upsert)
|
|
3
|
+
*/
|
|
4
|
+
export type ShapeId = string | number;
|
|
5
|
+
export type ShapeOp = "add" | "update" | "delete" | "upsert" | "replace";
|
|
6
|
+
/**
|
|
7
|
+
* 创建一个图元操作器(每个操作器维护自己的 indexMap)
|
|
8
|
+
* 推荐在每个 store 实例里创建一次并复用(不要每次调用都 new)
|
|
9
|
+
*/
|
|
10
|
+
export declare function createShapeOperator<Shape extends {
|
|
11
|
+
id: ShapeId;
|
|
12
|
+
}>(): {
|
|
13
|
+
applyShapeOp: (args: {
|
|
14
|
+
list: Shape[];
|
|
15
|
+
payload: Shape[] | ShapeId[];
|
|
16
|
+
op: ShapeOp;
|
|
17
|
+
}) => {
|
|
18
|
+
changedShapes: Shape[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=shapeOps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapeOps.d.ts","sourceRoot":"","sources":["../../../../src/utils/shapeOps/shapeOps.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;AACrC,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AAExE;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,SAAS;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE;yBAgIjC;QACxB,IAAI,EAAE,KAAK,EAAE,CAAA;QACb,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAA;QAC5B,EAAE,EAAE,OAAO,CAAA;KACd;;;EAqDJ"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { Shape } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 视口边界类型
|
|
6
|
+
*/
|
|
7
|
+
export interface ViewportBounds {
|
|
8
|
+
left: number;
|
|
9
|
+
top: number;
|
|
10
|
+
right: number;
|
|
11
|
+
bottom: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 视口裁剪配置
|
|
15
|
+
*/
|
|
16
|
+
export interface ViewportCullingOptions {
|
|
17
|
+
/** 缓冲区大小(像素),默认200 */
|
|
18
|
+
bufferSize?: number;
|
|
19
|
+
/** 是否启用连线完整性保证,默认true */
|
|
20
|
+
ensureEdgeIntegrity?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 视口裁剪工具类
|
|
24
|
+
* 用于优化大数据量场景下的渲染性能,只渲染可见区域内的图元
|
|
25
|
+
*/
|
|
26
|
+
export declare class ViewportCulling {
|
|
27
|
+
private viewportBounds;
|
|
28
|
+
private bufferSize;
|
|
29
|
+
private ensureEdgeIntegrity;
|
|
30
|
+
constructor(options?: ViewportCullingOptions);
|
|
31
|
+
/**
|
|
32
|
+
* 更新视口边界
|
|
33
|
+
* @param container 画布容器元素
|
|
34
|
+
* @param scale 当前缩放比例
|
|
35
|
+
*/
|
|
36
|
+
updateViewport(container: HTMLElement | null, scale: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* 判断图元是否在视口内(AABB碰撞检测)
|
|
39
|
+
* @param shape 图元对象
|
|
40
|
+
* @returns 是否在视口内
|
|
41
|
+
*/
|
|
42
|
+
isShapeInViewport(shape: Shape): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 过滤出可见的图元
|
|
45
|
+
* @param shapes 所有图元数组
|
|
46
|
+
* @returns 可见图元数组
|
|
47
|
+
*/
|
|
48
|
+
filterVisibleShapes(shapes: Shape[]): Shape[];
|
|
49
|
+
/**
|
|
50
|
+
* 创建可见图元的计算属性
|
|
51
|
+
* @param allShapes 所有图元的Ref
|
|
52
|
+
* @returns 可见图元的ComputedRef
|
|
53
|
+
*/
|
|
54
|
+
createVisibleShapesComputed(allShapes: Ref<Shape[]>): ComputedRef<Shape[]>;
|
|
55
|
+
/**
|
|
56
|
+
* 获取当前视口边界
|
|
57
|
+
*/
|
|
58
|
+
getViewportBounds(): ViewportBounds;
|
|
59
|
+
/**
|
|
60
|
+
* 计算性能提升百分比
|
|
61
|
+
* @param totalCount 总图元数量
|
|
62
|
+
* @param visibleCount 可见图元数量
|
|
63
|
+
* @returns 性能提升百分比
|
|
64
|
+
*/
|
|
65
|
+
static calculatePerformanceImprovement(totalCount: number, visibleCount: number): number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 创建视口裁剪实例的便捷函数
|
|
69
|
+
* @param options 配置选项
|
|
70
|
+
* @returns ViewportCulling实例
|
|
71
|
+
*/
|
|
72
|
+
export declare function useViewportCulling(options?: ViewportCullingOptions): ViewportCulling;
|
|
73
|
+
//# sourceMappingURL=viewportCulling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewportCulling.d.ts","sourceRoot":"","sources":["../../../src/utils/viewportCulling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAA;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAErC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,sBAAsB;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yBAAyB;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAED;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,mBAAmB,CAAS;gBAExB,OAAO,GAAE,sBAA2B;IAahD;;;;OAIG;IACH,cAAc,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAgBlE;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAoBxC;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,E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