@bpmnkit/editor 0.0.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/README.md +121 -0
- package/dist/command-stack.d.ts +23 -0
- package/dist/command-stack.js +48 -0
- package/dist/css.d.ts +15 -0
- package/dist/css.js +722 -0
- package/dist/dock.d.ts +35 -0
- package/dist/dock.js +406 -0
- package/dist/editor.d.ts +165 -0
- package/dist/editor.js +1977 -0
- package/dist/element-groups.d.ts +14 -0
- package/dist/element-groups.js +195 -0
- package/dist/geometry.d.ts +89 -0
- package/dist/geometry.js +450 -0
- package/dist/hud.d.ts +85 -0
- package/dist/hud.js +1631 -0
- package/dist/icons.d.ts +61 -0
- package/dist/icons.js +75 -0
- package/dist/id.d.ts +2 -0
- package/dist/id.js +4 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +6 -0
- package/dist/label-editor.d.ts +23 -0
- package/dist/label-editor.js +94 -0
- package/dist/modal.d.ts +6 -0
- package/dist/modal.js +141 -0
- package/dist/modeling.d.ts +91 -0
- package/dist/modeling.js +1473 -0
- package/dist/overlay.d.ts +59 -0
- package/dist/overlay.js +455 -0
- package/dist/rules.d.ts +10 -0
- package/dist/rules.js +17 -0
- package/dist/state-machine.d.ts +174 -0
- package/dist/state-machine.js +588 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.js +17 -0
- package/package.json +31 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { RenderedShape, ViewportState } from "@bpmnkit/canvas";
|
|
2
|
+
import type { BpmnBounds } from "@bpmnkit/core";
|
|
3
|
+
import type { CreateShapeType, DiagPoint, HandleDir, HitResult, PortDir, Tool } from "./types.js";
|
|
4
|
+
type SelectSub = {
|
|
5
|
+
name: "idle";
|
|
6
|
+
hoveredId: string | null;
|
|
7
|
+
} | {
|
|
8
|
+
name: "pointing-canvas";
|
|
9
|
+
origin: DiagPoint;
|
|
10
|
+
screenX: number;
|
|
11
|
+
screenY: number;
|
|
12
|
+
} | {
|
|
13
|
+
name: "rubber-band";
|
|
14
|
+
origin: DiagPoint;
|
|
15
|
+
current: DiagPoint;
|
|
16
|
+
} | {
|
|
17
|
+
name: "pointing-shape";
|
|
18
|
+
origin: DiagPoint;
|
|
19
|
+
id: string;
|
|
20
|
+
screenX: number;
|
|
21
|
+
screenY: number;
|
|
22
|
+
} | {
|
|
23
|
+
name: "translating";
|
|
24
|
+
origin: DiagPoint;
|
|
25
|
+
last: DiagPoint;
|
|
26
|
+
} | {
|
|
27
|
+
name: "pointing-handle";
|
|
28
|
+
origin: DiagPoint;
|
|
29
|
+
id: string;
|
|
30
|
+
handle: HandleDir;
|
|
31
|
+
screenX: number;
|
|
32
|
+
screenY: number;
|
|
33
|
+
} | {
|
|
34
|
+
name: "resizing";
|
|
35
|
+
id: string;
|
|
36
|
+
handle: HandleDir;
|
|
37
|
+
original: BpmnBounds;
|
|
38
|
+
current: DiagPoint;
|
|
39
|
+
} | {
|
|
40
|
+
name: "pointing-port";
|
|
41
|
+
origin: DiagPoint;
|
|
42
|
+
sourceId: string;
|
|
43
|
+
port: PortDir;
|
|
44
|
+
screenX: number;
|
|
45
|
+
screenY: number;
|
|
46
|
+
} | {
|
|
47
|
+
name: "connecting";
|
|
48
|
+
sourceId: string;
|
|
49
|
+
ghostEnd: DiagPoint;
|
|
50
|
+
} | {
|
|
51
|
+
name: "editing-label";
|
|
52
|
+
id: string;
|
|
53
|
+
} | {
|
|
54
|
+
name: "pointing-edge-endpoint";
|
|
55
|
+
edgeId: string;
|
|
56
|
+
isStart: boolean;
|
|
57
|
+
origin: DiagPoint;
|
|
58
|
+
screenX: number;
|
|
59
|
+
screenY: number;
|
|
60
|
+
} | {
|
|
61
|
+
name: "dragging-edge-endpoint";
|
|
62
|
+
edgeId: string;
|
|
63
|
+
isStart: boolean;
|
|
64
|
+
origin: DiagPoint;
|
|
65
|
+
} | {
|
|
66
|
+
name: "pointing-edge-segment";
|
|
67
|
+
edgeId: string;
|
|
68
|
+
segIdx: number;
|
|
69
|
+
isHoriz: boolean;
|
|
70
|
+
projPt: DiagPoint;
|
|
71
|
+
origin: DiagPoint;
|
|
72
|
+
screenX: number;
|
|
73
|
+
screenY: number;
|
|
74
|
+
} | {
|
|
75
|
+
name: "dragging-edge-waypoint-new";
|
|
76
|
+
edgeId: string;
|
|
77
|
+
segIdx: number;
|
|
78
|
+
origin: DiagPoint;
|
|
79
|
+
} | {
|
|
80
|
+
name: "pointing-edge-waypoint";
|
|
81
|
+
edgeId: string;
|
|
82
|
+
wpIdx: number;
|
|
83
|
+
pt: DiagPoint;
|
|
84
|
+
screenX: number;
|
|
85
|
+
screenY: number;
|
|
86
|
+
} | {
|
|
87
|
+
name: "dragging-edge-waypoint";
|
|
88
|
+
edgeId: string;
|
|
89
|
+
wpIdx: number;
|
|
90
|
+
origin: DiagPoint;
|
|
91
|
+
};
|
|
92
|
+
type SpaceSub = {
|
|
93
|
+
name: "idle";
|
|
94
|
+
} | {
|
|
95
|
+
name: "dragging";
|
|
96
|
+
origin: DiagPoint;
|
|
97
|
+
last: DiagPoint;
|
|
98
|
+
axis: "h" | "v" | null;
|
|
99
|
+
};
|
|
100
|
+
export type EditorMode = {
|
|
101
|
+
mode: "select";
|
|
102
|
+
sub: SelectSub;
|
|
103
|
+
} | {
|
|
104
|
+
mode: "create";
|
|
105
|
+
elementType: CreateShapeType;
|
|
106
|
+
} | {
|
|
107
|
+
mode: "pan";
|
|
108
|
+
} | {
|
|
109
|
+
mode: "space";
|
|
110
|
+
sub: SpaceSub;
|
|
111
|
+
};
|
|
112
|
+
export interface Callbacks {
|
|
113
|
+
getShapes(): RenderedShape[];
|
|
114
|
+
getSelectedIds(): string[];
|
|
115
|
+
getSelectedEdgeId(): string | null;
|
|
116
|
+
getViewport(): ViewportState;
|
|
117
|
+
viewportDidPan(): boolean;
|
|
118
|
+
isResizable(id: string): boolean;
|
|
119
|
+
lockViewport(lock: boolean): void;
|
|
120
|
+
setSelection(ids: string[]): void;
|
|
121
|
+
setEdgeSelected(edgeId: string | null): void;
|
|
122
|
+
previewTranslate(dx: number, dy: number): void;
|
|
123
|
+
commitTranslate(dx: number, dy: number): void;
|
|
124
|
+
cancelTranslate(): void;
|
|
125
|
+
previewResize(bounds: BpmnBounds): void;
|
|
126
|
+
commitResize(id: string, bounds: BpmnBounds): void;
|
|
127
|
+
previewConnect(ghostEnd: DiagPoint): void;
|
|
128
|
+
cancelConnect(): void;
|
|
129
|
+
commitConnect(sourceId: string, targetId: string): void;
|
|
130
|
+
previewRubberBand(origin: DiagPoint, current: DiagPoint): void;
|
|
131
|
+
cancelRubberBand(): void;
|
|
132
|
+
commitCreate(type: CreateShapeType, diagPoint: DiagPoint): void;
|
|
133
|
+
startLabelEdit(id: string): void;
|
|
134
|
+
setHovered(id: string | null): void;
|
|
135
|
+
executeDelete(ids: string[]): void;
|
|
136
|
+
executeCopy(): void;
|
|
137
|
+
executePaste(): void;
|
|
138
|
+
setTool(tool: Tool): void;
|
|
139
|
+
previewEndpointMove(edgeId: string, isStart: boolean, diagPoint: DiagPoint): void;
|
|
140
|
+
commitEndpointMove(edgeId: string, isStart: boolean, diagPoint: DiagPoint): void;
|
|
141
|
+
cancelEndpointMove(): void;
|
|
142
|
+
previewWaypointInsert(edgeId: string, segIdx: number, pt: DiagPoint): void;
|
|
143
|
+
commitWaypointInsert(edgeId: string, segIdx: number, pt: DiagPoint): void;
|
|
144
|
+
cancelWaypointInsert(): void;
|
|
145
|
+
previewWaypointMove(edgeId: string, wpIdx: number, pt: DiagPoint): void;
|
|
146
|
+
commitWaypointMove(edgeId: string, wpIdx: number, pt: DiagPoint): void;
|
|
147
|
+
cancelWaypointMove(): void;
|
|
148
|
+
showEdgeHoverDot(pt: DiagPoint): void;
|
|
149
|
+
hideEdgeHoverDot(): void;
|
|
150
|
+
showEdgeWaypointBalls(edgeId: string): void;
|
|
151
|
+
hideEdgeWaypointBalls(): void;
|
|
152
|
+
previewSpace(origin: DiagPoint, current: DiagPoint, axis: "h" | "v" | null): void;
|
|
153
|
+
commitSpace(origin: DiagPoint, current: DiagPoint, axis: "h" | "v" | null): void;
|
|
154
|
+
cancelSpace(): void;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Discriminated-union state machine for the BPMN editor.
|
|
158
|
+
* Receives pointer + keyboard events from the editor and notifies the editor
|
|
159
|
+
* via injected `Callbacks`.
|
|
160
|
+
*/
|
|
161
|
+
export declare class EditorStateMachine {
|
|
162
|
+
private readonly _cb;
|
|
163
|
+
private _mode;
|
|
164
|
+
constructor(_cb: Callbacks);
|
|
165
|
+
get mode(): EditorMode;
|
|
166
|
+
setMode(mode: EditorMode): void;
|
|
167
|
+
onPointerDown(e: PointerEvent, diag: DiagPoint, hit: HitResult): void;
|
|
168
|
+
onPointerMove(e: PointerEvent, diag: DiagPoint, hit: HitResult): void;
|
|
169
|
+
onPointerUp(_e: PointerEvent, diag: DiagPoint, hit: HitResult): void;
|
|
170
|
+
onDblClick(_e: MouseEvent, _diag: DiagPoint, hit: HitResult): void;
|
|
171
|
+
onKeyDown(e: KeyboardEvent): void;
|
|
172
|
+
}
|
|
173
|
+
export {};
|
|
174
|
+
//# sourceMappingURL=state-machine.d.ts.map
|