@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.
@@ -0,0 +1,61 @@
1
+ export declare const IC: {
2
+ select: string;
3
+ hand: string;
4
+ undo: string;
5
+ redo: string;
6
+ trash: string;
7
+ duplicate: string;
8
+ dots: string;
9
+ arrow: string;
10
+ search: string;
11
+ keyboard: string;
12
+ labelPos: string;
13
+ zoomIn: string;
14
+ zoomOut: string;
15
+ space: string;
16
+ startEvent: string;
17
+ endEvent: string;
18
+ intermediateThrowEvent: string;
19
+ intermediateCatchEvent: string;
20
+ task: string;
21
+ manualTask: string;
22
+ callActivity: string;
23
+ subProcess: string;
24
+ adHocSubProcess: string;
25
+ transaction: string;
26
+ serviceTask: string;
27
+ userTask: string;
28
+ scriptTask: string;
29
+ sendTask: string;
30
+ receiveTask: string;
31
+ businessRuleTask: string;
32
+ exclusiveGateway: string;
33
+ parallelGateway: string;
34
+ inclusiveGateway: string;
35
+ eventBasedGateway: string;
36
+ complexGateway: string;
37
+ openProcess: string;
38
+ textAnnotation: string;
39
+ messageStartEvent: string;
40
+ timerStartEvent: string;
41
+ conditionalStartEvent: string;
42
+ signalStartEvent: string;
43
+ messageEndEvent: string;
44
+ escalationEndEvent: string;
45
+ errorEndEvent: string;
46
+ compensationEndEvent: string;
47
+ signalEndEvent: string;
48
+ terminateEndEvent: string;
49
+ messageCatchEvent: string;
50
+ messageThrowEvent: string;
51
+ timerCatchEvent: string;
52
+ escalationThrowEvent: string;
53
+ conditionalCatchEvent: string;
54
+ linkCatchEvent: string;
55
+ linkThrowEvent: string;
56
+ compensationThrowEvent: string;
57
+ signalCatchEvent: string;
58
+ signalThrowEvent: string;
59
+ sparkle: string;
60
+ };
61
+ //# sourceMappingURL=icons.d.ts.map
package/dist/icons.js ADDED
@@ -0,0 +1,75 @@
1
+ // Internal SVG icon strings — not exported from index.ts
2
+ export const IC = {
3
+ // ── Navigation tools ───────────────────────────────────────────────────
4
+ select: `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M3 2 3 12.5 5.5 9.5 7.5 14 9.5 13.2 7.5 8.8 12 8.8z"/></svg>`,
5
+ hand: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><path d="M9 2v6M11.5 3v5M14 5.5V8.5a5.5 5.5 0 01-11 0V5a1.5 1.5 0 013 0v3"/></svg>`,
6
+ // ── History (U-shape curved arrows) ────────────────────────────────────
7
+ undo: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 4H9.5a4.5 4.5 0 0 1 0 9H5"/><polyline points="8,1.5 5,4 8,6.5"/></svg>`,
8
+ redo: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H6.5a4.5 4.5 0 0 0 0 9H11"/><polyline points="8,1.5 11,4 8,6.5"/></svg>`,
9
+ // ── Edit actions ────────────────────────────────────────────────────────
10
+ trash: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="3" y1="4" x2="13" y2="4"/><path d="M5.5 4V2.5h5V4M5 4l.5 9.5h5.1L11 4"/><line x1="6.5" y1="7" x2="6.5" y2="11.5"/><line x1="9.5" y1="7" x2="9.5" y2="11.5"/></svg>`,
11
+ duplicate: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><rect x="5.5" y="5.5" width="8" height="8" rx="1.5"/><path d="M4 10.5V3.5A1.5 1.5 0 0 1 5.5 2H12"/></svg>`,
12
+ dots: `<svg viewBox="0 0 16 16" fill="currentColor"><circle cx="3.5" cy="8" r="1.3"/><circle cx="8" cy="8" r="1.3"/><circle cx="12.5" cy="8" r="1.3"/></svg>`,
13
+ arrow: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><line x1="2" y1="8" x2="11" y2="8"/><polyline points="8,5 12,8 8,11"/></svg>`,
14
+ search: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="6.5" cy="6.5" r="4.5"/><line x1="10" y1="10" x2="14" y2="14"/></svg>`,
15
+ keyboard: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><rect x="1" y="4" width="14" height="8" rx="1.5"/><line x1="4" y1="7.5" x2="4" y2="7.5" stroke-width="2"/><line x1="7" y1="7.5" x2="7" y2="7.5" stroke-width="2"/><line x1="10" y1="7.5" x2="10" y2="7.5" stroke-width="2"/><line x1="4" y1="10" x2="12" y2="10"/></svg>`,
16
+ labelPos: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M3 4h10M8 4v7"/><line x1="2" y1="13" x2="14" y2="13" stroke-dasharray="2 2"/></svg>`,
17
+ zoomIn: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="8" y1="3" x2="8" y2="13"/><line x1="3" y1="8" x2="13" y2="8"/></svg>`,
18
+ zoomOut: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="3" y1="8" x2="13" y2="8"/></svg>`,
19
+ // ── Space tool (two vertical bars with outward arrows) ─────────────────
20
+ space: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="4" width="2.5" height="8" rx="0.8"/><rect x="12.5" y="4" width="2.5" height="8" rx="0.8"/><path d="M4 8h8"/><path d="M5.5 6.5 4 8 5.5 9.5"/><path d="M10.5 6.5 12 8 10.5 9.5"/></svg>`,
21
+ // ── BPMN Events (circles: thin=start, thick=end, double-ring=intermediate) ─
22
+ startEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/></svg>`,
23
+ endEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="3"><circle cx="8" cy="8" r="5.5"/></svg>`,
24
+ intermediateThrowEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/></svg>`,
25
+ intermediateCatchEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/></svg>`,
26
+ // ── BPMN Activities (rounded rect + type marker top-left) ──────────────
27
+ task: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/></svg>`,
28
+ manualTask: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><path d="M3 9V6.5a1 1 0 012 0V9M5 8V5a1 1 0 012 0v3M7 7a1 1 0 012 0v1M9 8a1 1 0 012 0v1c0 2-1.5 3-4 3H5c-2 0-3.5-1-3.5-3V9" stroke-linecap="round"/></svg>`,
29
+ callActivity: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2" stroke-width="2.5"/><path d="M6 8h4M8 6v4" stroke-linecap="round"/></svg>`,
30
+ subProcess: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><rect x="5.5" y="9.5" width="5" height="4" rx="0.5"/><path d="M8 10.5v2M7 11.5h2" stroke-linecap="round"/></svg>`,
31
+ adHocSubProcess: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><path d="M5 11Q6 9 8 11Q10 13 11 11" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
32
+ transaction: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><rect x="2" y="4" width="12" height="8" rx="1.5"/></svg>`,
33
+ serviceTask: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><circle cx="4" cy="6" r="2.2" stroke-width="1.1"/><circle cx="4" cy="6" r="0.9" fill="currentColor" stroke="none"/><path d="M4 3.5v1M4 7.5v1M1.5 6h1M5.5 6h1" stroke-linecap="round" stroke-width="1.1"/></svg>`,
34
+ userTask: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><circle cx="4" cy="5.5" r="1.5" stroke-width="1.1"/><path d="M1 10Q1 7.5 4 7.5Q7 7.5 7 10" stroke-linecap="round" stroke-width="1.1"/></svg>`,
35
+ scriptTask: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><rect x="1" y="3.5" width="4.5" height="6" rx="0.5" stroke-width="1.1"/><path d="M2 5h2.5M2 6.5h2.5M2 8h1.5" stroke-linecap="round" stroke-width="1"/></svg>`,
36
+ sendTask: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><rect x="1" y="3.5" width="5.5" height="4" fill="currentColor" rx="0.3" stroke-width="1.1"/></svg>`,
37
+ receiveTask: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><rect x="1" y="3.5" width="5.5" height="4" rx="0.3" stroke-width="1.1"/><path d="M1 3.5l2.75 2 2.75-2" stroke-width="1.1"/></svg>`,
38
+ businessRuleTask: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="0.5" y="2.5" width="15" height="11" rx="2"/><rect x="1" y="3.5" width="6" height="4.5" stroke-width="1.1"/><path d="M1 5.3h6M3 3.5v4.5" stroke-width="1.1"/></svg>`,
39
+ // ── BPMN Gateways (diamond + type marker) ──────────────────────────────
40
+ exclusiveGateway: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="8,1.5 14.5,8 8,14.5 1.5,8"/><path d="M5.5 5.5l5 5M10.5 5.5l-5 5" stroke-linecap="round" stroke-width="1.5"/></svg>`,
41
+ parallelGateway: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="8,1.5 14.5,8 8,14.5 1.5,8"/><path d="M8 4.5v7M4.5 8h7" stroke-linecap="round" stroke-width="1.5"/></svg>`,
42
+ inclusiveGateway: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="8,1.5 14.5,8 8,14.5 1.5,8"/><circle cx="8" cy="8" r="3" stroke-width="1.5"/></svg>`,
43
+ eventBasedGateway: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="8,1.5 14.5,8 8,14.5 1.5,8"/><circle cx="8" cy="8" r="3.5" stroke-width="1"/><circle cx="8" cy="8" r="2" stroke-width="1"/></svg>`,
44
+ complexGateway: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><polygon points="8,1.5 14.5,8 8,14.5 1.5,8"/><path d="M8 5v6M5 8h6M5.5 5.5l5 5M10.5 5.5l-5 5" stroke-linecap="round" stroke-width="1.5"/></svg>`,
45
+ // ── Navigation ─────────────────────────────────────────────────────────
46
+ openProcess: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9 3h4v4M13 3l-6 6"/><path d="M7 5H3v8h8V9"/></svg>`,
47
+ // ── BPMN Annotation ────────────────────────────────────────────────────
48
+ textAnnotation: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M6 3L3 3L3 13L6 13"/><line x1="7" y1="6" x2="13" y2="6"/><line x1="7" y1="9" x2="12" y2="9"/><line x1="7" y1="12" x2="10" y2="12"/></svg>`,
49
+ // ── BPMN Start Event variants ───────────────────────────────────────────
50
+ messageStartEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><rect x="5" y="6" width="6" height="4" fill="currentColor" stroke="none"/><path d="M5 6l3 2.5L11 6" stroke="white" stroke-width="1" fill="none"/></svg>`,
51
+ timerStartEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="3.5" stroke-width="1"/><path d="M8 5.5V8l1.5 1.5" stroke-linecap="round" stroke-width="1"/></svg>`,
52
+ conditionalStartEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><rect x="5.5" y="5.5" width="5" height="5" stroke-width="1"/><line x1="6.5" y1="7" x2="9.5" y2="7" stroke-width="1"/><line x1="6.5" y1="8.5" x2="9.5" y2="8.5" stroke-width="1"/><line x1="6.5" y1="10" x2="8.5" y2="10" stroke-width="1"/></svg>`,
53
+ signalStartEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><polygon points="8,5 11.5,11 4.5,11" fill="currentColor" stroke="none"/></svg>`,
54
+ // ── BPMN End Event variants ─────────────────────────────────────────────
55
+ messageEndEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="3"><circle cx="8" cy="8" r="5.5"/><rect x="5" y="6" width="6" height="4" fill="currentColor" stroke="none"/><path d="M5 6l3 2.5L11 6" stroke="white" stroke-width="1" fill="none"/></svg>`,
56
+ escalationEndEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="3"><circle cx="8" cy="8" r="5.5"/><polygon points="8,5 10.5,11 8,9.5 5.5,11" fill="currentColor" stroke="none"/></svg>`,
57
+ errorEndEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="3"><circle cx="8" cy="8" r="5.5"/><path d="M9.5 5.5l-3.5 4h2.5L5 11.5l3.5-4H6z" fill="currentColor" stroke="none"/></svg>`,
58
+ compensationEndEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="3"><circle cx="8" cy="8" r="5.5"/><polygon points="8,6 5,8 8,10" fill="currentColor" stroke="none"/><polygon points="11,6 8,8 11,10" fill="currentColor" stroke="none"/></svg>`,
59
+ signalEndEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="3"><circle cx="8" cy="8" r="5.5"/><polygon points="8,5 11.5,11 4.5,11" fill="currentColor" stroke="none"/></svg>`,
60
+ terminateEndEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="3"><circle cx="8" cy="8" r="5.5"/><circle cx="8" cy="8" r="3" fill="currentColor" stroke="none"/></svg>`,
61
+ // ── BPMN Intermediate Event variants ────────────────────────────────────
62
+ messageCatchEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><rect x="5" y="6" width="6" height="4" stroke-width="1"/><path d="M5 6l3 2.5L11 6" stroke-width="1"/></svg>`,
63
+ messageThrowEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><rect x="5" y="6" width="6" height="4" fill="currentColor" stroke="none"/><path d="M5 6l3 2.5L11 6" stroke="white" stroke-width="1" fill="none"/></svg>`,
64
+ timerCatchEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><circle cx="8" cy="8" r="3" stroke-width="1"/><path d="M8 6V8l1.5 1.5" stroke-linecap="round" stroke-width="1"/></svg>`,
65
+ escalationThrowEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><polygon points="8,5 10.5,11 8,9.5 5.5,11" fill="currentColor" stroke="none"/></svg>`,
66
+ conditionalCatchEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><rect x="5.5" y="5.5" width="5" height="5" stroke-width="1"/><line x1="6.5" y1="7" x2="9.5" y2="7" stroke-width="1"/><line x1="6.5" y1="8.5" x2="9.5" y2="8.5" stroke-width="1"/><line x1="6.5" y1="10" x2="8.5" y2="10" stroke-width="1"/></svg>`,
67
+ linkCatchEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><polygon points="7,5.5 11,8 7,10.5 7,9 5,9 5,7 7,7" stroke-width="1"/></svg>`,
68
+ linkThrowEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><polygon points="7,5.5 11,8 7,10.5 7,9 5,9 5,7 7,7" fill="currentColor" stroke="none"/></svg>`,
69
+ compensationThrowEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><polygon points="8,6 5,8 8,10" fill="currentColor" stroke="none"/><polygon points="11,6 8,8 11,10" fill="currentColor" stroke="none"/></svg>`,
70
+ signalCatchEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><polygon points="8,5 11.5,11 4.5,11" stroke-width="1"/></svg>`,
71
+ signalThrowEvent: `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="8" cy="8" r="6.5"/><circle cx="8" cy="8" r="4.5"/><polygon points="8,5 11.5,11 4.5,11" fill="currentColor" stroke="none"/></svg>`,
72
+ // ── AI / assistant ──────────────────────────────────────────────────
73
+ sparkle: `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 2L9.1 5.9 13 7l-3.9 1.1L8 12 6.9 8.1 3 7l3.9-1.1L8 2z"/><circle cx="12.5" cy="3" r="1" opacity="0.5"/><circle cx="3.5" cy="12.5" r="0.75" opacity="0.4"/></svg>`,
74
+ };
75
+ //# sourceMappingURL=icons.js.map
package/dist/id.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function genId(prefix: string): string;
2
+ //# sourceMappingURL=id.d.ts.map
package/dist/id.js ADDED
@@ -0,0 +1,4 @@
1
+ export function genId(prefix) {
2
+ return `${prefix}_${Math.random().toString(36).slice(2, 9)}`;
3
+ }
4
+ //# sourceMappingURL=id.js.map
@@ -0,0 +1,10 @@
1
+ export { BpmnEditor } from "./editor.js";
2
+ export { createEmptyDefinitions } from "./modeling.js";
3
+ export type { EditorEvents, EditorOptions, LabelPosition, Tool, CreateShapeType, HandleDir, PortDir, } from "./types.js";
4
+ export { ELEMENT_GROUPS, ELEMENT_TYPE_LABELS, EXTERNAL_LABEL_TYPES, CONTEXTUAL_ADD_TYPES, getElementGroup, getValidLabelPositions, } from "./element-groups.js";
5
+ export type { ElementGroup } from "./element-groups.js";
6
+ export { initEditorHud } from "./hud.js";
7
+ export type { HudOptions } from "./hud.js";
8
+ export { createSideDock } from "./dock.js";
9
+ export type { SideDock } from "./dock.js";
10
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { BpmnEditor } from "./editor.js";
2
+ export { createEmptyDefinitions } from "./modeling.js";
3
+ export { ELEMENT_GROUPS, ELEMENT_TYPE_LABELS, EXTERNAL_LABEL_TYPES, CONTEXTUAL_ADD_TYPES, getElementGroup, getValidLabelPositions, } from "./element-groups.js";
4
+ export { initEditorHud } from "./hud.js";
5
+ export { createSideDock } from "./dock.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,23 @@
1
+ import type { ViewportState } from "@bpmnkit/canvas";
2
+ import type { BpmnBounds } from "@bpmnkit/core";
3
+ /**
4
+ * HTML `contenteditable` label editor positioned over the diagram element.
5
+ * Commits on blur or Enter; cancels on Escape.
6
+ */
7
+ export declare class LabelEditor {
8
+ private readonly _container;
9
+ private readonly _onCommit;
10
+ private readonly _onCancel;
11
+ private _div;
12
+ private _activeId;
13
+ constructor(_container: HTMLElement, _onCommit: (id: string, text: string) => void, _onCancel: () => void);
14
+ get isActive(): boolean;
15
+ start(id: string, currentText: string, bounds: BpmnBounds, viewport: ViewportState, svgRect: DOMRect): void;
16
+ stop(): void;
17
+ destroy(): void;
18
+ private readonly _onKeyDown;
19
+ private readonly _onBlur;
20
+ private _commit;
21
+ private _cancel;
22
+ }
23
+ //# sourceMappingURL=label-editor.d.ts.map
@@ -0,0 +1,94 @@
1
+ /**
2
+ * HTML `contenteditable` label editor positioned over the diagram element.
3
+ * Commits on blur or Enter; cancels on Escape.
4
+ */
5
+ export class LabelEditor {
6
+ _container;
7
+ _onCommit;
8
+ _onCancel;
9
+ _div = null;
10
+ _activeId = null;
11
+ constructor(_container, _onCommit, _onCancel) {
12
+ this._container = _container;
13
+ this._onCommit = _onCommit;
14
+ this._onCancel = _onCancel;
15
+ }
16
+ get isActive() {
17
+ return this._activeId !== null;
18
+ }
19
+ start(id, currentText, bounds, viewport, svgRect) {
20
+ this.stop();
21
+ this._activeId = id;
22
+ const div = document.createElement("div");
23
+ div.className = "bpmnkit-label-editor";
24
+ div.contentEditable = "true";
25
+ div.textContent = currentText;
26
+ // Position in screen coordinates
27
+ const screenX = bounds.x * viewport.scale + viewport.tx + svgRect.left;
28
+ const screenY = bounds.y * viewport.scale + viewport.ty + svgRect.top;
29
+ const screenW = bounds.width * viewport.scale;
30
+ const screenH = bounds.height * viewport.scale;
31
+ // Relative to container
32
+ const containerRect = this._container.getBoundingClientRect();
33
+ div.style.left = `${screenX - containerRect.left}px`;
34
+ div.style.top = `${screenY - containerRect.top}px`;
35
+ div.style.width = `${Math.max(screenW, 60)}px`;
36
+ div.style.minHeight = `${Math.max(screenH, 16)}px`;
37
+ div.addEventListener("keydown", this._onKeyDown);
38
+ div.addEventListener("blur", this._onBlur);
39
+ this._container.appendChild(div);
40
+ this._div = div;
41
+ // Select all text
42
+ requestAnimationFrame(() => {
43
+ div.focus();
44
+ const range = document.createRange();
45
+ range.selectNodeContents(div);
46
+ const sel = window.getSelection();
47
+ if (sel) {
48
+ sel.removeAllRanges();
49
+ sel.addRange(range);
50
+ }
51
+ });
52
+ }
53
+ stop() {
54
+ if (!this._div)
55
+ return;
56
+ this._div.removeEventListener("keydown", this._onKeyDown);
57
+ this._div.removeEventListener("blur", this._onBlur);
58
+ this._div.remove();
59
+ this._div = null;
60
+ this._activeId = null;
61
+ }
62
+ destroy() {
63
+ this.stop();
64
+ }
65
+ // ── Event handlers ────────────────────────────────────────────────
66
+ _onKeyDown = (e) => {
67
+ if (e.key === "Enter" && !e.shiftKey) {
68
+ e.preventDefault();
69
+ this._commit();
70
+ }
71
+ else if (e.key === "Escape") {
72
+ e.preventDefault();
73
+ this._cancel();
74
+ }
75
+ };
76
+ _onBlur = () => {
77
+ if (this._activeId !== null) {
78
+ this._commit();
79
+ }
80
+ };
81
+ _commit() {
82
+ if (!this._div || !this._activeId)
83
+ return;
84
+ const text = this._div.textContent ?? "";
85
+ const id = this._activeId;
86
+ this.stop();
87
+ this._onCommit(id, text);
88
+ }
89
+ _cancel() {
90
+ this.stop();
91
+ this._onCancel();
92
+ }
93
+ }
94
+ //# sourceMappingURL=label-editor.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shows a simple input modal with a title, pre-filled input, and Cancel/Confirm buttons.
3
+ * Calls `onConfirm` with the trimmed input value when confirmed (empty values are ignored).
4
+ */
5
+ export declare function showHudInputModal(title: string, defaultValue: string, onConfirm: (value: string) => void): void;
6
+ //# sourceMappingURL=modal.d.ts.map
package/dist/modal.js ADDED
@@ -0,0 +1,141 @@
1
+ const MODAL_STYLE_ID = "bpmnkit-hud-modal-styles";
2
+ function injectModalStyles() {
3
+ if (document.getElementById(MODAL_STYLE_ID))
4
+ return;
5
+ const style = document.createElement("style");
6
+ style.id = MODAL_STYLE_ID;
7
+ style.textContent = `
8
+ .bpmnkit-hud-modal-overlay {
9
+ position: fixed; inset: 0; z-index: 300;
10
+ background: rgba(0,0,0,0.5);
11
+ display: flex; align-items: center; justify-content: center;
12
+ }
13
+ .bpmnkit-hud-modal {
14
+ background: rgba(22, 22, 30, 0.97);
15
+ border: 1px solid rgba(255,255,255,0.12);
16
+ border-radius: 10px;
17
+ padding: 20px;
18
+ min-width: 300px; max-width: 90vw;
19
+ color: rgba(255,255,255,0.85);
20
+ font-family: system-ui, -apple-system, sans-serif;
21
+ box-shadow: 0 16px 48px rgba(0,0,0,0.6);
22
+ display: flex; flex-direction: column; gap: 12px;
23
+ }
24
+ .bpmnkit-hud-modal-title {
25
+ font-size: 14px; font-weight: 600;
26
+ color: rgba(255,255,255,0.95);
27
+ }
28
+ .bpmnkit-hud-modal-input {
29
+ width: 100%; padding: 6px 10px;
30
+ background: rgba(255,255,255,0.08);
31
+ border: 1px solid rgba(255,255,255,0.15);
32
+ border-radius: 6px;
33
+ color: rgba(255,255,255,0.9);
34
+ font-size: 13px;
35
+ outline: none;
36
+ box-sizing: border-box;
37
+ }
38
+ .bpmnkit-hud-modal-input:focus { border-color: rgba(60,120,220,0.6); }
39
+ .bpmnkit-hud-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
40
+ .bpmnkit-hud-modal-btn {
41
+ font-size: 13px; padding: 6px 14px; border-radius: 6px;
42
+ cursor: pointer; font-weight: 500;
43
+ border: 1px solid rgba(255,255,255,0.12);
44
+ background: rgba(255,255,255,0.06);
45
+ color: rgba(255,255,255,0.8);
46
+ }
47
+ .bpmnkit-hud-modal-btn:hover { background: rgba(255,255,255,0.1); }
48
+ .bpmnkit-hud-modal-btn--primary {
49
+ background: rgba(60,120,220,0.5);
50
+ border-color: rgba(60,120,220,0.7);
51
+ color: #fff;
52
+ }
53
+ .bpmnkit-hud-modal-btn--primary:hover { background: rgba(60,120,220,0.65); }
54
+ /* Light theme */
55
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-hud-modal {
56
+ background: rgba(252,252,254,0.98);
57
+ border-color: rgba(0,0,0,0.1);
58
+ color: rgba(0,0,0,0.8);
59
+ box-shadow: 0 8px 32px rgba(0,0,0,0.15);
60
+ }
61
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-hud-modal-title { color: rgba(0,0,0,0.88); }
62
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-hud-modal-input {
63
+ background: rgba(0,0,0,0.04);
64
+ border-color: rgba(0,0,0,0.15);
65
+ color: rgba(0,0,0,0.9);
66
+ }
67
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-hud-modal-input:focus { border-color: rgba(0,80,200,0.4); }
68
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-hud-modal-btn {
69
+ border-color: rgba(0,0,0,0.12);
70
+ background: rgba(0,0,0,0.04);
71
+ color: rgba(0,0,0,0.7);
72
+ }
73
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-hud-modal-btn:hover { background: rgba(0,0,0,0.08); }
74
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-hud-modal-btn--primary {
75
+ background: rgba(0,80,200,0.85);
76
+ border-color: rgba(0,80,200,0.9);
77
+ color: #fff;
78
+ }
79
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-hud-modal-btn--primary:hover { background: rgba(0,80,200,1); }
80
+ `;
81
+ document.head.appendChild(style);
82
+ }
83
+ /**
84
+ * Shows a simple input modal with a title, pre-filled input, and Cancel/Confirm buttons.
85
+ * Calls `onConfirm` with the trimmed input value when confirmed (empty values are ignored).
86
+ */
87
+ export function showHudInputModal(title, defaultValue, onConfirm) {
88
+ injectModalStyles();
89
+ const overlay = document.createElement("div");
90
+ overlay.className = "bpmnkit-hud-modal-overlay";
91
+ const dialog = document.createElement("div");
92
+ dialog.className = "bpmnkit-hud-modal";
93
+ const titleEl = document.createElement("div");
94
+ titleEl.className = "bpmnkit-hud-modal-title";
95
+ titleEl.textContent = title;
96
+ const input = document.createElement("input");
97
+ input.type = "text";
98
+ input.className = "bpmnkit-hud-modal-input";
99
+ input.value = defaultValue;
100
+ const actions = document.createElement("div");
101
+ actions.className = "bpmnkit-hud-modal-actions";
102
+ const cancelBtn = document.createElement("button");
103
+ cancelBtn.className = "bpmnkit-hud-modal-btn";
104
+ cancelBtn.textContent = "Cancel";
105
+ const confirmBtn = document.createElement("button");
106
+ confirmBtn.className = "bpmnkit-hud-modal-btn bpmnkit-hud-modal-btn--primary";
107
+ confirmBtn.textContent = "Confirm";
108
+ function close() {
109
+ overlay.remove();
110
+ document.removeEventListener("keydown", handleKey);
111
+ }
112
+ function confirm() {
113
+ const value = input.value.trim();
114
+ if (!value)
115
+ return;
116
+ close();
117
+ onConfirm(value);
118
+ }
119
+ cancelBtn.addEventListener("click", close);
120
+ confirmBtn.addEventListener("click", confirm);
121
+ function handleKey(e) {
122
+ if (e.key === "Escape")
123
+ close();
124
+ else if (e.key === "Enter")
125
+ confirm();
126
+ }
127
+ document.addEventListener("keydown", handleKey);
128
+ overlay.addEventListener("click", (e) => {
129
+ if (e.target === overlay)
130
+ close();
131
+ });
132
+ actions.append(cancelBtn, confirmBtn);
133
+ dialog.append(titleEl, input, actions);
134
+ overlay.append(dialog);
135
+ document.body.append(overlay);
136
+ requestAnimationFrame(() => {
137
+ input.select();
138
+ input.focus();
139
+ });
140
+ }
141
+ //# sourceMappingURL=modal.js.map
@@ -0,0 +1,91 @@
1
+ import type { BpmnBounds, BpmnDefinitions, BpmnDiEdge, BpmnDiShape, BpmnFlowElement, BpmnSequenceFlow, BpmnWaypoint, DiColor } from "@bpmnkit/core";
2
+ import type { CreateShapeType, PortDir } from "./types.js";
3
+ /** Creates a minimal valid BpmnDefinitions with one process and one diagram. */
4
+ export declare function createEmptyDefinitions(): BpmnDefinitions;
5
+ export declare function createShape(defs: BpmnDefinitions, type: CreateShapeType, bounds: BpmnBounds, name?: string): {
6
+ defs: BpmnDefinitions;
7
+ id: string;
8
+ };
9
+ export declare function createBoundaryEvent(defs: BpmnDefinitions, hostId: string, eventDefType: string | null, bounds: BpmnBounds, cancelActivity?: boolean): {
10
+ defs: BpmnDefinitions;
11
+ id: string;
12
+ };
13
+ export declare function createConnection(defs: BpmnDefinitions, sourceId: string, targetId: string, waypoints: BpmnWaypoint[]): {
14
+ defs: BpmnDefinitions;
15
+ id: string;
16
+ };
17
+ export declare function moveShapes(defs: BpmnDefinitions, moves: Array<{
18
+ id: string;
19
+ dx: number;
20
+ dy: number;
21
+ }>): BpmnDefinitions;
22
+ export declare function resizeShape(defs: BpmnDefinitions, id: string, newBounds: BpmnBounds): BpmnDefinitions;
23
+ export declare function deleteElements(defs: BpmnDefinitions, ids: string[]): BpmnDefinitions;
24
+ export declare function updateLabel(defs: BpmnDefinitions, id: string, name: string): BpmnDefinitions;
25
+ /** Updates the DI label bounds for a shape (sets explicit external label position). */
26
+ export declare function updateLabelPosition(defs: BpmnDefinitions, shapeId: string, labelBounds: BpmnBounds): BpmnDefinitions;
27
+ /**
28
+ * Reconnects one endpoint of an edge to a different port on the same
29
+ * source or target shape, recomputing the orthogonal route.
30
+ */
31
+ export declare function updateEdgeEndpoint(defs: BpmnDefinitions, edgeId: string, isStart: boolean, newPort: PortDir): BpmnDefinitions;
32
+ /**
33
+ * Moves an orthogonal edge segment perpendicularly by `delta` units.
34
+ * For horizontal segments delta shifts Y; for vertical segments delta shifts X.
35
+ * Both waypoints of the segment move together, stretching adjacent segments.
36
+ */
37
+ export declare function moveEdgeSegment(defs: BpmnDefinitions, edgeId: string, segIdx: number, isHoriz: boolean, delta: number): BpmnDefinitions;
38
+ /**
39
+ * Inserts a new waypoint between waypoints[segIdx] and waypoints[segIdx+1].
40
+ * Used for free-form bend creation (diagonal movement allowed).
41
+ */
42
+ export declare function insertEdgeWaypoint(defs: BpmnDefinitions, edgeId: string, segIdx: number, pt: {
43
+ x: number;
44
+ y: number;
45
+ }): BpmnDefinitions;
46
+ /**
47
+ * Moves a single intermediate waypoint (by index) to a new position.
48
+ * Start (0) and end (last) waypoints are not moveable via this function.
49
+ */
50
+ export declare function moveEdgeWaypoint(defs: BpmnDefinitions, edgeId: string, wpIdx: number, pt: {
51
+ x: number;
52
+ y: number;
53
+ }): BpmnDefinitions;
54
+ /**
55
+ * Removes intermediate waypoints that lie exactly on the straight line between
56
+ * their neighbours. Runs iteratively until no more collinear waypoints remain.
57
+ */
58
+ export declare function removeCollinearWaypoints(defs: BpmnDefinitions, edgeId: string): BpmnDefinitions;
59
+ /**
60
+ * Replaces a flow element's type while preserving its id, name, and connections.
61
+ * Use this for gateway type-switching (exclusive ↔ parallel) and task type-switching.
62
+ */
63
+ export declare function changeElementType(defs: BpmnDefinitions, id: string, newType: CreateShapeType): BpmnDefinitions;
64
+ /**
65
+ * Splits an existing sequence flow by inserting a shape between its source and
66
+ * target: removes the original edge and creates two new connections
67
+ * (source → shapeId and shapeId → target).
68
+ */
69
+ export declare function insertShapeOnEdge(defs: BpmnDefinitions, edgeId: string, shapeId: string): BpmnDefinitions;
70
+ export interface Clipboard {
71
+ elements: BpmnFlowElement[];
72
+ flows: BpmnSequenceFlow[];
73
+ shapes: BpmnDiShape[];
74
+ edges: BpmnDiEdge[];
75
+ }
76
+ export declare function copyElements(defs: BpmnDefinitions, ids: string[]): Clipboard;
77
+ export declare function pasteElements(defs: BpmnDefinitions, clipboard: Clipboard, offsetX: number, offsetY: number): {
78
+ defs: BpmnDefinitions;
79
+ newIds: Map<string, string>;
80
+ };
81
+ export declare function createAnnotation(defs: BpmnDefinitions, bounds: BpmnBounds, text?: string): {
82
+ defs: BpmnDefinitions;
83
+ id: string;
84
+ };
85
+ export declare function createAnnotationWithLink(defs: BpmnDefinitions, bounds: BpmnBounds, sourceId: string, sourceBounds: BpmnBounds, text?: string): {
86
+ defs: BpmnDefinitions;
87
+ annotationId: string;
88
+ associationId: string;
89
+ };
90
+ export declare function updateShapeColor(defs: BpmnDefinitions, id: string, color: DiColor): BpmnDefinitions;
91
+ //# sourceMappingURL=modeling.d.ts.map