@cratis/components 0.1.18 → 0.1.19
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 +83 -0
- package/dist/cjs/Common/ErrorBoundary.js +26 -0
- package/dist/cjs/Common/ErrorBoundary.js.map +1 -0
- package/dist/cjs/Common/FormElement.js +10 -0
- package/dist/cjs/Common/FormElement.js.map +1 -0
- package/dist/cjs/Common/index.js +12 -0
- package/dist/cjs/Common/index.js.map +1 -0
- package/dist/cjs/EventModeling/EventModeling.css +146 -0
- package/dist/cjs/EventModeling/EventModeling.js +209 -0
- package/dist/cjs/EventModeling/EventModeling.js.map +1 -0
- package/dist/cjs/EventModeling/components/Canvas.js +403 -0
- package/dist/cjs/EventModeling/components/Canvas.js.map +1 -0
- package/dist/cjs/EventModeling/components/CanvasControls.js +10 -0
- package/dist/cjs/EventModeling/components/CanvasControls.js.map +1 -0
- package/dist/cjs/EventModeling/components/Toolbox.js +18 -0
- package/dist/cjs/EventModeling/components/Toolbox.js.map +1 -0
- package/dist/cjs/EventModeling/engine/connectorGraphics.js +173 -0
- package/dist/cjs/EventModeling/engine/connectorGraphics.js.map +1 -0
- package/dist/cjs/EventModeling/engine/elementSprites.js +301 -0
- package/dist/cjs/EventModeling/engine/elementSprites.js.map +1 -0
- package/dist/cjs/EventModeling/index.js +12 -0
- package/dist/cjs/EventModeling/index.js.map +1 -0
- package/dist/cjs/EventModeling/types.js +60 -0
- package/dist/cjs/EventModeling/types.js.map +1 -0
- package/dist/cjs/PivotViewer/components/PivotCanvas.js.map +1 -1
- package/dist/cjs/PivotViewer/components/PivotViewerMain.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/groups.js +15 -15
- package/dist/cjs/PivotViewer/components/pivot/groups.js.map +1 -1
- package/dist/cjs/PivotViewer/components/pivot/sprites.js +2 -2
- package/dist/cjs/PivotViewer/components/pivot/sprites.js.map +1 -1
- package/dist/cjs/PivotViewer/types.js.map +1 -1
- package/dist/cjs/TimeMachine/TimeMachine.js +0 -3
- package/dist/cjs/TimeMachine/TimeMachine.js.map +1 -1
- package/dist/cjs/index.js +16 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/package.json +3 -0
- package/dist/esm/Common/ErrorBoundary.js +7 -4
- package/dist/esm/Common/ErrorBoundary.js.map +1 -1
- package/dist/esm/Common/FormElement.js +7 -4
- package/dist/esm/Common/FormElement.js.map +1 -1
- package/dist/esm/Common/index.js +4 -4
- package/dist/esm/Common/index.js.map +1 -1
- package/dist/esm/EventModeling/EventModeling.css +146 -0
- package/dist/esm/EventModeling/EventModeling.d.ts +11 -0
- package/dist/esm/EventModeling/EventModeling.d.ts.map +1 -0
- package/dist/esm/EventModeling/EventModeling.js +207 -0
- package/dist/esm/EventModeling/EventModeling.js.map +1 -0
- package/dist/esm/EventModeling/EventModeling.stories.d.ts +10 -0
- package/dist/esm/EventModeling/EventModeling.stories.d.ts.map +1 -0
- package/dist/esm/EventModeling/EventModeling.stories.js +252 -0
- package/dist/esm/EventModeling/EventModeling.stories.js.map +1 -0
- package/dist/esm/EventModeling/components/Canvas.d.ts +23 -0
- package/dist/esm/EventModeling/components/Canvas.d.ts.map +1 -0
- package/dist/esm/EventModeling/components/Canvas.js +382 -0
- package/dist/esm/EventModeling/components/Canvas.js.map +1 -0
- package/dist/esm/EventModeling/components/CanvasControls.d.ts +10 -0
- package/dist/esm/EventModeling/components/CanvasControls.d.ts.map +1 -0
- package/dist/esm/EventModeling/components/CanvasControls.js +8 -0
- package/dist/esm/EventModeling/components/CanvasControls.js.map +1 -0
- package/dist/esm/EventModeling/components/Toolbox.d.ts +9 -0
- package/dist/esm/EventModeling/components/Toolbox.d.ts.map +1 -0
- package/dist/esm/EventModeling/components/Toolbox.js +16 -0
- package/dist/esm/EventModeling/components/Toolbox.js.map +1 -0
- package/dist/esm/EventModeling/engine/connectorGraphics.d.ts +12 -0
- package/dist/esm/EventModeling/engine/connectorGraphics.d.ts.map +1 -0
- package/dist/esm/EventModeling/engine/connectorGraphics.js +151 -0
- package/dist/esm/EventModeling/engine/connectorGraphics.js.map +1 -0
- package/dist/esm/EventModeling/engine/elementSprites.d.ts +23 -0
- package/dist/esm/EventModeling/engine/elementSprites.d.ts.map +1 -0
- package/dist/esm/EventModeling/engine/elementSprites.js +276 -0
- package/dist/esm/EventModeling/engine/elementSprites.js.map +1 -0
- package/dist/esm/EventModeling/index.d.ts +3 -0
- package/dist/esm/EventModeling/index.d.ts.map +1 -0
- package/dist/esm/EventModeling/index.js +3 -0
- package/dist/esm/EventModeling/index.js.map +1 -0
- package/dist/esm/EventModeling/types.d.ts +79 -0
- package/dist/esm/EventModeling/types.d.ts.map +1 -0
- package/dist/esm/EventModeling/types.js +56 -0
- package/dist/esm/EventModeling/types.js.map +1 -0
- package/dist/esm/PivotViewer/components/PivotCanvas.d.ts +2 -2
- package/dist/esm/PivotViewer/components/PivotCanvas.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/PivotCanvas.js.map +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts +2 -2
- package/dist/esm/PivotViewer/components/PivotViewerMain.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerMain.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/groups.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/groups.js +2 -2
- package/dist/esm/PivotViewer/components/pivot/groups.js.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/sprites.d.ts +4 -4
- package/dist/esm/PivotViewer/components/pivot/sprites.d.ts.map +1 -1
- package/dist/esm/PivotViewer/components/pivot/sprites.js +2 -2
- package/dist/esm/PivotViewer/components/pivot/sprites.js.map +1 -1
- package/dist/esm/PivotViewer/types.d.ts +2 -2
- package/dist/esm/PivotViewer/types.d.ts.map +1 -1
- package/dist/esm/PivotViewer/types.js.map +1 -1
- package/dist/esm/TimeMachine/TimeMachine.js +1 -1
- package/dist/esm/index.d.ts +5 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +16 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +3 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -78
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var PIXI = require('pixi.js');
|
|
6
|
+
var elementSprites = require('../engine/elementSprites.js');
|
|
7
|
+
var connectorGraphics = require('../engine/connectorGraphics.js');
|
|
8
|
+
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var PIXI__namespace = /*#__PURE__*/_interopNamespaceDefault(PIXI);
|
|
27
|
+
|
|
28
|
+
function getComputedBackgroundColor() {
|
|
29
|
+
const style = getComputedStyle(document.documentElement);
|
|
30
|
+
const bgColorStr = style.getPropertyValue('--surface-ground').trim() || '#18181b';
|
|
31
|
+
return parseInt(bgColorStr.replace('#', ''), 16);
|
|
32
|
+
}
|
|
33
|
+
const Canvas = ({ state, selectedTool, zoom, pan, onZoomChange, onPanChange, onAddElement, onUpdateElement, onAddConnector, onSelectElement, onSelectConnector, }) => {
|
|
34
|
+
const containerRef = React.useRef(null);
|
|
35
|
+
const canvasRef = React.useRef(null);
|
|
36
|
+
const appRef = React.useRef(null);
|
|
37
|
+
const worldRef = React.useRef(null);
|
|
38
|
+
const elementsLayerRef = React.useRef(null);
|
|
39
|
+
const connectorsLayerRef = React.useRef(null);
|
|
40
|
+
const spritesRef = React.useRef(new Map());
|
|
41
|
+
const connectorsRef = React.useRef(new Map());
|
|
42
|
+
const [pixiReady, setPixiReady] = React.useState(false);
|
|
43
|
+
const draggingElementRef = React.useRef(null);
|
|
44
|
+
const connectingFromRef = React.useRef(null);
|
|
45
|
+
const tempConnectorLineRef = React.useRef(null);
|
|
46
|
+
const zoomRef = React.useRef(zoom);
|
|
47
|
+
const panRef = React.useRef(pan);
|
|
48
|
+
const selectedToolRef = React.useRef(selectedTool);
|
|
49
|
+
const stateRef = React.useRef(state);
|
|
50
|
+
const onZoomChangeRef = React.useRef(onZoomChange);
|
|
51
|
+
const onPanChangeRef = React.useRef(onPanChange);
|
|
52
|
+
const onAddElementRef = React.useRef(onAddElement);
|
|
53
|
+
const onUpdateElementRef = React.useRef(onUpdateElement);
|
|
54
|
+
const onAddConnectorRef = React.useRef(onAddConnector);
|
|
55
|
+
const onSelectElementRef = React.useRef(onSelectElement);
|
|
56
|
+
React.useEffect(() => { zoomRef.current = zoom; }, [zoom]);
|
|
57
|
+
React.useEffect(() => { panRef.current = pan; }, [pan]);
|
|
58
|
+
React.useEffect(() => { selectedToolRef.current = selectedTool; }, [selectedTool]);
|
|
59
|
+
React.useEffect(() => { stateRef.current = state; }, [state]);
|
|
60
|
+
React.useEffect(() => { onZoomChangeRef.current = onZoomChange; }, [onZoomChange]);
|
|
61
|
+
React.useEffect(() => { onPanChangeRef.current = onPanChange; }, [onPanChange]);
|
|
62
|
+
React.useEffect(() => { onAddElementRef.current = onAddElement; }, [onAddElement]);
|
|
63
|
+
React.useEffect(() => { onUpdateElementRef.current = onUpdateElement; }, [onUpdateElement]);
|
|
64
|
+
React.useEffect(() => { onAddConnectorRef.current = onAddConnector; }, [onAddConnector]);
|
|
65
|
+
React.useEffect(() => { onSelectElementRef.current = onSelectElement; }, [onSelectElement]);
|
|
66
|
+
const screenToWorld = React.useCallback((screenX, screenY) => {
|
|
67
|
+
const rect = containerRef.current?.getBoundingClientRect();
|
|
68
|
+
if (!rect)
|
|
69
|
+
return { x: 0, y: 0 };
|
|
70
|
+
const x = (screenX - rect.left - panRef.current.x) / zoomRef.current;
|
|
71
|
+
const y = (screenY - rect.top - panRef.current.y) / zoomRef.current;
|
|
72
|
+
return { x, y };
|
|
73
|
+
}, []);
|
|
74
|
+
const getEdgePosition = React.useCallback((element, side) => {
|
|
75
|
+
const { position, size } = element;
|
|
76
|
+
switch (side) {
|
|
77
|
+
case 'top': return { x: position.x + size.width / 2, y: position.y };
|
|
78
|
+
case 'right': return { x: position.x + size.width, y: position.y + size.height / 2 };
|
|
79
|
+
case 'bottom': return { x: position.x + size.width / 2, y: position.y + size.height };
|
|
80
|
+
case 'left': return { x: position.x, y: position.y + size.height / 2 };
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
83
|
+
const handleWheel = React.useCallback((e) => {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
if (!containerRef.current)
|
|
86
|
+
return;
|
|
87
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
88
|
+
const mouseX = e.clientX - rect.left;
|
|
89
|
+
const mouseY = e.clientY - rect.top;
|
|
90
|
+
const currentZoom = zoomRef.current;
|
|
91
|
+
const currentPan = panRef.current;
|
|
92
|
+
if (e.ctrlKey) {
|
|
93
|
+
const zoomIntensity = 0.008;
|
|
94
|
+
const delta = Math.exp(-e.deltaY * zoomIntensity);
|
|
95
|
+
const newZoom = Math.max(0.1, Math.min(5, currentZoom * delta));
|
|
96
|
+
const worldX = (mouseX - currentPan.x) / currentZoom;
|
|
97
|
+
const worldY = (mouseY - currentPan.y) / currentZoom;
|
|
98
|
+
const newPanX = mouseX - worldX * newZoom;
|
|
99
|
+
const newPanY = mouseY - worldY * newZoom;
|
|
100
|
+
onZoomChangeRef.current(newZoom);
|
|
101
|
+
onPanChangeRef.current({ x: newPanX, y: newPanY });
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
const newPan = {
|
|
105
|
+
x: currentPan.x - e.deltaX,
|
|
106
|
+
y: currentPan.y - e.deltaY,
|
|
107
|
+
};
|
|
108
|
+
onPanChangeRef.current(newPan);
|
|
109
|
+
}
|
|
110
|
+
}, []);
|
|
111
|
+
const handleCanvasPointerDown = React.useCallback((e) => {
|
|
112
|
+
if (!containerRef.current)
|
|
113
|
+
return;
|
|
114
|
+
const tool = selectedToolRef.current;
|
|
115
|
+
if (tool !== 'select') {
|
|
116
|
+
const worldPos = screenToWorld(e.clientX, e.clientY);
|
|
117
|
+
onAddElementRef.current(tool, worldPos.x, worldPos.y);
|
|
118
|
+
}
|
|
119
|
+
}, [screenToWorld]);
|
|
120
|
+
const handlePointerMove = React.useCallback((e) => {
|
|
121
|
+
if (draggingElementRef.current) {
|
|
122
|
+
const { id, startX, startY, elementStartX, elementStartY } = draggingElementRef.current;
|
|
123
|
+
const dx = (e.clientX - startX) / zoomRef.current;
|
|
124
|
+
const dy = (e.clientY - startY) / zoomRef.current;
|
|
125
|
+
onUpdateElementRef.current(id, {
|
|
126
|
+
position: { x: elementStartX + dx, y: elementStartY + dy }
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (connectingFromRef.current && tempConnectorLineRef.current) {
|
|
130
|
+
const worldPos = screenToWorld(e.clientX, e.clientY);
|
|
131
|
+
const line = tempConnectorLineRef.current;
|
|
132
|
+
line.clear();
|
|
133
|
+
line.moveTo(connectingFromRef.current.startX, connectingFromRef.current.startY);
|
|
134
|
+
line.lineTo(worldPos.x, worldPos.y);
|
|
135
|
+
line.stroke({ color: 0x6b7280, width: 2 });
|
|
136
|
+
}
|
|
137
|
+
}, [screenToWorld]);
|
|
138
|
+
const handlePointerUp = React.useCallback(() => {
|
|
139
|
+
draggingElementRef.current = null;
|
|
140
|
+
if (tempConnectorLineRef.current) {
|
|
141
|
+
tempConnectorLineRef.current.destroy();
|
|
142
|
+
tempConnectorLineRef.current = null;
|
|
143
|
+
}
|
|
144
|
+
connectingFromRef.current = null;
|
|
145
|
+
}, []);
|
|
146
|
+
const handleDragOver = React.useCallback((e) => {
|
|
147
|
+
if (e.dataTransfer?.types.includes('application/x-event-modeling-tool')) {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
150
|
+
}
|
|
151
|
+
}, []);
|
|
152
|
+
const handleDrop = React.useCallback((e) => {
|
|
153
|
+
e.preventDefault();
|
|
154
|
+
const tool = e.dataTransfer?.getData('application/x-event-modeling-tool');
|
|
155
|
+
if (tool && containerRef.current) {
|
|
156
|
+
const worldPos = screenToWorld(e.clientX, e.clientY);
|
|
157
|
+
onAddElementRef.current(tool, worldPos.x, worldPos.y);
|
|
158
|
+
}
|
|
159
|
+
}, [screenToWorld]);
|
|
160
|
+
const handleElementPointerDown = React.useCallback((id, e) => {
|
|
161
|
+
e.stopPropagation();
|
|
162
|
+
const element = stateRef.current.elements.find(el => el.id === id);
|
|
163
|
+
if (!element)
|
|
164
|
+
return;
|
|
165
|
+
draggingElementRef.current = {
|
|
166
|
+
id,
|
|
167
|
+
startX: e.globalX,
|
|
168
|
+
startY: e.globalY,
|
|
169
|
+
elementStartX: element.position.x,
|
|
170
|
+
elementStartY: element.position.y,
|
|
171
|
+
};
|
|
172
|
+
onSelectElementRef.current(id);
|
|
173
|
+
}, []);
|
|
174
|
+
const handleEdgePointerDown = React.useCallback((elementId, side, e) => {
|
|
175
|
+
e.stopPropagation();
|
|
176
|
+
const element = stateRef.current.elements.find(el => el.id === elementId);
|
|
177
|
+
if (!element)
|
|
178
|
+
return;
|
|
179
|
+
const edgePos = getEdgePosition(element, side);
|
|
180
|
+
connectingFromRef.current = {
|
|
181
|
+
elementId,
|
|
182
|
+
side,
|
|
183
|
+
startX: edgePos.x,
|
|
184
|
+
startY: edgePos.y,
|
|
185
|
+
};
|
|
186
|
+
if (worldRef.current) {
|
|
187
|
+
const line = new PIXI__namespace.Graphics();
|
|
188
|
+
worldRef.current.addChild(line);
|
|
189
|
+
tempConnectorLineRef.current = line;
|
|
190
|
+
}
|
|
191
|
+
}, [getEdgePosition]);
|
|
192
|
+
const handleEdgePointerUp = React.useCallback((elementId, side, e) => {
|
|
193
|
+
e.stopPropagation();
|
|
194
|
+
if (connectingFromRef.current && connectingFromRef.current.elementId !== elementId) {
|
|
195
|
+
const connector = {
|
|
196
|
+
id: `conn-${Date.now()}`,
|
|
197
|
+
from: { elementId: connectingFromRef.current.elementId, side: connectingFromRef.current.side },
|
|
198
|
+
to: { elementId, side },
|
|
199
|
+
};
|
|
200
|
+
onAddConnectorRef.current(connector);
|
|
201
|
+
}
|
|
202
|
+
if (tempConnectorLineRef.current) {
|
|
203
|
+
tempConnectorLineRef.current.destroy();
|
|
204
|
+
tempConnectorLineRef.current = null;
|
|
205
|
+
}
|
|
206
|
+
connectingFromRef.current = null;
|
|
207
|
+
}, []);
|
|
208
|
+
const handleConnectorClick = React.useCallback((id) => {
|
|
209
|
+
onSelectConnector(id);
|
|
210
|
+
onSelectElement(undefined);
|
|
211
|
+
}, [onSelectConnector, onSelectElement]);
|
|
212
|
+
React.useEffect(() => {
|
|
213
|
+
if (!containerRef.current || appRef.current)
|
|
214
|
+
return;
|
|
215
|
+
let isMounted = true;
|
|
216
|
+
const initPixi = async () => {
|
|
217
|
+
const container = containerRef.current;
|
|
218
|
+
if (!container)
|
|
219
|
+
return;
|
|
220
|
+
const rect = container.getBoundingClientRect();
|
|
221
|
+
const width = rect.width > 0 ? rect.width : container.clientWidth || 800;
|
|
222
|
+
const height = rect.height > 0 ? rect.height : container.clientHeight || 600;
|
|
223
|
+
const app = new PIXI__namespace.Application();
|
|
224
|
+
const bgColor = getComputedBackgroundColor();
|
|
225
|
+
try {
|
|
226
|
+
await app.init({
|
|
227
|
+
background: bgColor,
|
|
228
|
+
antialias: true,
|
|
229
|
+
autoDensity: true,
|
|
230
|
+
resolution: window.devicePixelRatio || 1,
|
|
231
|
+
width,
|
|
232
|
+
height,
|
|
233
|
+
autoStart: true,
|
|
234
|
+
});
|
|
235
|
+
app.ticker.add(() => {
|
|
236
|
+
app.renderer.render(app.stage);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
catch (e) {
|
|
240
|
+
console.error('PIXI init failed:', e);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (!isMounted || !containerRef.current) {
|
|
244
|
+
app.destroy(true, { children: true });
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
appRef.current = app;
|
|
248
|
+
const world = new PIXI__namespace.Container();
|
|
249
|
+
worldRef.current = world;
|
|
250
|
+
app.stage.addChild(world);
|
|
251
|
+
const connectorsLayer = new PIXI__namespace.Container();
|
|
252
|
+
connectorsLayerRef.current = connectorsLayer;
|
|
253
|
+
world.addChild(connectorsLayer);
|
|
254
|
+
const elementsLayer = new PIXI__namespace.Container();
|
|
255
|
+
elementsLayerRef.current = elementsLayer;
|
|
256
|
+
world.addChild(elementsLayer);
|
|
257
|
+
const canvasEl = app.canvas;
|
|
258
|
+
if (canvasEl && containerRef.current) {
|
|
259
|
+
canvasEl.classList.add('event-modeling-canvas');
|
|
260
|
+
canvasEl.style.touchAction = 'none';
|
|
261
|
+
containerRef.current.appendChild(canvasEl);
|
|
262
|
+
canvasRef.current = canvasEl;
|
|
263
|
+
canvasEl.addEventListener('wheel', handleWheel, { passive: false });
|
|
264
|
+
canvasEl.addEventListener('pointerdown', handleCanvasPointerDown);
|
|
265
|
+
canvasEl.addEventListener('pointermove', handlePointerMove);
|
|
266
|
+
canvasEl.addEventListener('pointerup', handlePointerUp);
|
|
267
|
+
canvasEl.addEventListener('pointerleave', handlePointerUp);
|
|
268
|
+
containerRef.current.addEventListener('dragover', handleDragOver);
|
|
269
|
+
containerRef.current.addEventListener('drop', handleDrop);
|
|
270
|
+
}
|
|
271
|
+
setPixiReady(true);
|
|
272
|
+
};
|
|
273
|
+
initPixi();
|
|
274
|
+
return () => {
|
|
275
|
+
isMounted = false;
|
|
276
|
+
if (canvasRef.current) {
|
|
277
|
+
canvasRef.current.removeEventListener('wheel', handleWheel);
|
|
278
|
+
canvasRef.current.removeEventListener('pointerdown', handleCanvasPointerDown);
|
|
279
|
+
canvasRef.current.removeEventListener('pointermove', handlePointerMove);
|
|
280
|
+
canvasRef.current.removeEventListener('pointerup', handlePointerUp);
|
|
281
|
+
canvasRef.current.removeEventListener('pointerleave', handlePointerUp);
|
|
282
|
+
}
|
|
283
|
+
if (containerRef.current) {
|
|
284
|
+
containerRef.current.removeEventListener('dragover', handleDragOver);
|
|
285
|
+
containerRef.current.removeEventListener('drop', handleDrop);
|
|
286
|
+
}
|
|
287
|
+
if (appRef.current) {
|
|
288
|
+
appRef.current.destroy(true, { children: true });
|
|
289
|
+
appRef.current = null;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}, [handleWheel, handleCanvasPointerDown, handlePointerMove, handlePointerUp, handleDragOver, handleDrop]);
|
|
293
|
+
React.useEffect(() => {
|
|
294
|
+
if (!pixiReady || !worldRef.current)
|
|
295
|
+
return;
|
|
296
|
+
worldRef.current.position.set(pan.x, pan.y);
|
|
297
|
+
worldRef.current.scale.set(zoom);
|
|
298
|
+
}, [pixiReady, zoom, pan]);
|
|
299
|
+
React.useEffect(() => {
|
|
300
|
+
console.log('Sync useEffect running', { pixiReady, hasElementsLayer: !!elementsLayerRef.current, elementCount: state.elements.length });
|
|
301
|
+
if (!pixiReady || !elementsLayerRef.current) {
|
|
302
|
+
console.log('Sync useEffect early return', { pixiReady, hasElementsLayer: !!elementsLayerRef.current });
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const elementsMap = new Map(state.elements.map(el => [el.id, el]));
|
|
306
|
+
spritesRef.current.forEach((sprite, id) => {
|
|
307
|
+
if (!elementsMap.has(id)) {
|
|
308
|
+
elementsLayerRef.current.removeChild(sprite.container);
|
|
309
|
+
sprite.container.destroy({ children: true });
|
|
310
|
+
spritesRef.current.delete(id);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
state.elements.forEach(elementData => {
|
|
314
|
+
const existing = spritesRef.current.get(elementData.id);
|
|
315
|
+
if (existing) {
|
|
316
|
+
elementSprites.updateElementSprite(existing, elementData);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
console.log('Creating sprite for', elementData.id, 'at', elementData.position.x, elementData.position.y);
|
|
320
|
+
const sprite = elementSprites.createElementSprite(elementData, Function.prototype, Function.prototype, Function.prototype, Function.prototype, Function.prototype);
|
|
321
|
+
spritesRef.current.set(elementData.id, sprite);
|
|
322
|
+
elementsLayerRef.current.addChild(sprite.container);
|
|
323
|
+
console.log('Sprite added to layer', {
|
|
324
|
+
spritePos: { x: sprite.container.position.x, y: sprite.container.position.y },
|
|
325
|
+
layerChildren: elementsLayerRef.current.children.length,
|
|
326
|
+
visible: sprite.container.visible,
|
|
327
|
+
alpha: sprite.container.alpha
|
|
328
|
+
});
|
|
329
|
+
sprite.container.eventMode = 'static';
|
|
330
|
+
sprite.container.cursor = 'grab';
|
|
331
|
+
sprite.container.on('pointerdown', (e) => {
|
|
332
|
+
handleElementPointerDown(elementData.id, e);
|
|
333
|
+
});
|
|
334
|
+
sprite.edgePoints.forEach((edgePoint, side) => {
|
|
335
|
+
edgePoint.eventMode = 'static';
|
|
336
|
+
edgePoint.cursor = 'crosshair';
|
|
337
|
+
edgePoint.on('pointerdown', (e) => {
|
|
338
|
+
handleEdgePointerDown(elementData.id, side, e);
|
|
339
|
+
});
|
|
340
|
+
edgePoint.on('pointerup', (e) => {
|
|
341
|
+
handleEdgePointerUp(elementData.id, side, e);
|
|
342
|
+
});
|
|
343
|
+
edgePoint.on('pointerover', () => {
|
|
344
|
+
if (connectingFromRef.current && connectingFromRef.current.elementId !== elementData.id) {
|
|
345
|
+
edgePoint.alpha = 1;
|
|
346
|
+
edgePoint.scale.set(1.5);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
edgePoint.on('pointerout', () => {
|
|
350
|
+
edgePoint.scale.set(1);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
sprite.container.on('pointerover', () => elementSprites.showEdgePoints(sprite));
|
|
354
|
+
sprite.container.on('pointerout', () => {
|
|
355
|
+
if (!connectingFromRef.current || connectingFromRef.current.elementId !== elementData.id) {
|
|
356
|
+
elementSprites.hideEdgePoints(sprite);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}, [pixiReady, state.elements, handleElementPointerDown, handleEdgePointerDown, handleEdgePointerUp]);
|
|
362
|
+
const getElementsMapRef = React.useRef(() => new Map());
|
|
363
|
+
React.useEffect(() => {
|
|
364
|
+
getElementsMapRef.current = () => new Map(stateRef.current.elements.map(el => [el.id, el]));
|
|
365
|
+
}, []);
|
|
366
|
+
React.useEffect(() => {
|
|
367
|
+
if (!pixiReady || !connectorsLayerRef.current)
|
|
368
|
+
return;
|
|
369
|
+
const connectorsMap = new Map(state.connectors.map(conn => [conn.id, conn]));
|
|
370
|
+
const elementsMap = new Map(state.elements.map(el => [el.id, el]));
|
|
371
|
+
connectorsRef.current.forEach((connGraphics, id) => {
|
|
372
|
+
if (!connectorsMap.has(id)) {
|
|
373
|
+
connectorsLayerRef.current.removeChild(connGraphics.graphics);
|
|
374
|
+
connGraphics.graphics.destroy();
|
|
375
|
+
connectorsRef.current.delete(id);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
state.connectors.forEach(connector => {
|
|
379
|
+
const existing = connectorsRef.current.get(connector.id);
|
|
380
|
+
if (existing) {
|
|
381
|
+
existing.connector = connector;
|
|
382
|
+
existing.getElements = getElementsMapRef.current;
|
|
383
|
+
connectorGraphics.updateConnectorGraphics(existing, elementsMap);
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
const connGraphics = connectorGraphics.createConnectorGraphics(connector, getElementsMapRef.current, handleConnectorClick);
|
|
387
|
+
connectorsRef.current.set(connector.id, connGraphics);
|
|
388
|
+
connectorsLayerRef.current.addChild(connGraphics.graphics);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}, [pixiReady, state.connectors, state.elements, handleConnectorClick]);
|
|
392
|
+
React.useEffect(() => {
|
|
393
|
+
if (!pixiReady)
|
|
394
|
+
return;
|
|
395
|
+
spritesRef.current.forEach((sprite, id) => {
|
|
396
|
+
elementSprites.setElementSelected(sprite, id === state.selectedElementId);
|
|
397
|
+
});
|
|
398
|
+
}, [pixiReady, state.selectedElementId]);
|
|
399
|
+
return jsxRuntime.jsx("div", { ref: containerRef, className: "event-modeling-canvas-container" });
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
exports.Canvas = Canvas;
|
|
403
|
+
//# sourceMappingURL=Canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Canvas.js","sources":["../../../../EventModeling/components/Canvas.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React, { useEffect, useRef, useState, useCallback } from 'react';\nimport * as PIXI from 'pixi.js';\nimport { EventModelingState, ElementType, ElementData, Connector, EdgeSide } from '../types';\nimport { createElementSprite, updateElementSprite, showEdgePoints, hideEdgePoints, setElementSelected, ElementSprite } from '../engine/elementSprites';\nimport { createConnectorGraphics, updateConnectorGraphics, ConnectorGraphics } from '../engine/connectorGraphics';\n\nexport interface CanvasProps {\n state: EventModelingState;\n selectedTool: ElementType | 'select';\n zoom: number;\n pan: { x: number; y: number };\n onZoomChange: (zoom: number) => void;\n onPanChange: (pan: { x: number; y: number }) => void;\n onAddElement: (type: ElementType, x: number, y: number) => void;\n onUpdateElement: (id: string, updates: Partial<ElementData>) => void;\n onAddConnector: (connector: Connector) => void;\n onSelectElement: (id: string | undefined) => void;\n onSelectConnector: (id: string | undefined) => void;\n}\n\n// Helper to get background color from CSS custom properties\nfunction getComputedBackgroundColor(): number {\n const style = getComputedStyle(document.documentElement);\n const bgColorStr = style.getPropertyValue('--surface-ground').trim() || '#18181b'; // zinc-900 as fallback\n \n // Convert hex color string to number\n return parseInt(bgColorStr.replace('#', ''), 16);\n}\n\nexport const Canvas: React.FC<CanvasProps> = ({\n state,\n selectedTool,\n zoom,\n pan,\n onZoomChange,\n onPanChange,\n onAddElement,\n onUpdateElement,\n onAddConnector,\n onSelectElement,\n onSelectConnector,\n}) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const appRef = useRef<PIXI.Application | null>(null);\n const worldRef = useRef<PIXI.Container | null>(null);\n const elementsLayerRef = useRef<PIXI.Container | null>(null);\n const connectorsLayerRef = useRef<PIXI.Container | null>(null);\n \n const spritesRef = useRef<Map<string, ElementSprite>>(new Map());\n const connectorsRef = useRef<Map<string, ConnectorGraphics>>(new Map());\n const [pixiReady, setPixiReady] = useState(false);\n \n // Interaction state\n const draggingElementRef = useRef<{ id: string; startX: number; startY: number; elementStartX: number; elementStartY: number } | null>(null);\n const connectingFromRef = useRef<{ elementId: string; side: EdgeSide; startX: number; startY: number } | null>(null);\n const tempConnectorLineRef = useRef<PIXI.Graphics | null>(null);\n \n // Refs to hold current values for event handlers (avoiding stale closures)\n const zoomRef = useRef(zoom);\n const panRef = useRef(pan);\n const selectedToolRef = useRef(selectedTool);\n const stateRef = useRef(state);\n const onZoomChangeRef = useRef(onZoomChange);\n const onPanChangeRef = useRef(onPanChange);\n const onAddElementRef = useRef(onAddElement);\n const onUpdateElementRef = useRef(onUpdateElement);\n const onAddConnectorRef = useRef(onAddConnector);\n const onSelectElementRef = useRef(onSelectElement);\n \n // Keep refs in sync with props\n useEffect(() => { zoomRef.current = zoom; }, [zoom]);\n useEffect(() => { panRef.current = pan; }, [pan]);\n useEffect(() => { selectedToolRef.current = selectedTool; }, [selectedTool]);\n useEffect(() => { stateRef.current = state; }, [state]);\n useEffect(() => { onZoomChangeRef.current = onZoomChange; }, [onZoomChange]);\n useEffect(() => { onPanChangeRef.current = onPanChange; }, [onPanChange]);\n useEffect(() => { onAddElementRef.current = onAddElement; }, [onAddElement]);\n useEffect(() => { onUpdateElementRef.current = onUpdateElement; }, [onUpdateElement]);\n useEffect(() => { onAddConnectorRef.current = onAddConnector; }, [onAddConnector]);\n useEffect(() => { onSelectElementRef.current = onSelectElement; }, [onSelectElement]);\n\n // Convert screen coordinates to world coordinates\n const screenToWorld = useCallback((screenX: number, screenY: number) => {\n const rect = containerRef.current?.getBoundingClientRect();\n if (!rect) return { x: 0, y: 0 };\n const x = (screenX - rect.left - panRef.current.x) / zoomRef.current;\n const y = (screenY - rect.top - panRef.current.y) / zoomRef.current;\n return { x, y };\n }, []);\n\n // Helper to get edge position in world coordinates\n const getEdgePosition = useCallback((element: ElementData, side: EdgeSide) => {\n const { position, size } = element;\n switch (side) {\n case 'top': return { x: position.x + size.width / 2, y: position.y };\n case 'right': return { x: position.x + size.width, y: position.y + size.height / 2 };\n case 'bottom': return { x: position.x + size.width / 2, y: position.y + size.height };\n case 'left': return { x: position.x, y: position.y + size.height / 2 };\n }\n }, []);\n\n // Handle wheel events - trackpad natural scrolling for pan, pinch for zoom\n const handleWheel = useCallback((e: WheelEvent) => {\n e.preventDefault();\n if (!containerRef.current) return;\n \n const rect = containerRef.current.getBoundingClientRect();\n const mouseX = e.clientX - rect.left;\n const mouseY = e.clientY - rect.top;\n \n const currentZoom = zoomRef.current;\n const currentPan = panRef.current;\n \n // Pinch-to-zoom (ctrlKey is true for pinch gestures on trackpad)\n if (e.ctrlKey) {\n // Use smoother zoom calculation based on actual deltaY\n // Trackpad pinch typically gives small deltaY values (-2 to 2)\n // This creates a more proportional zoom response\n const zoomIntensity = 0.008; // Adjust for smoother/faster zoom\n const delta = Math.exp(-e.deltaY * zoomIntensity);\n const newZoom = Math.max(0.1, Math.min(5, currentZoom * delta));\n \n // Keep the point under cursor stationary\n const worldX = (mouseX - currentPan.x) / currentZoom;\n const worldY = (mouseY - currentPan.y) / currentZoom;\n const newPanX = mouseX - worldX * newZoom;\n const newPanY = mouseY - worldY * newZoom;\n \n onZoomChangeRef.current(newZoom);\n onPanChangeRef.current({ x: newPanX, y: newPanY });\n } else {\n // Two-finger scroll = pan (natural scrolling direction)\n const newPan = {\n x: currentPan.x - e.deltaX,\n y: currentPan.y - e.deltaY,\n };\n onPanChangeRef.current(newPan);\n }\n }, []);\n\n // Handle pointer down on canvas background - add element if tool selected\n const handleCanvasPointerDown = useCallback((e: PointerEvent) => {\n if (!containerRef.current) return;\n \n const tool = selectedToolRef.current;\n \n // If using a creation tool, add element at click position\n if (tool !== 'select') {\n const worldPos = screenToWorld(e.clientX, e.clientY);\n onAddElementRef.current(tool, worldPos.x, worldPos.y);\n }\n }, [screenToWorld]);\n\n // Handle pointer move for dragging elements or drawing connectors\n const handlePointerMove = useCallback((e: PointerEvent) => {\n // Handle element dragging\n if (draggingElementRef.current) {\n const { id, startX, startY, elementStartX, elementStartY } = draggingElementRef.current;\n const dx = (e.clientX - startX) / zoomRef.current;\n const dy = (e.clientY - startY) / zoomRef.current;\n onUpdateElementRef.current(id, {\n position: { x: elementStartX + dx, y: elementStartY + dy }\n });\n }\n \n // Handle connector drawing preview line\n if (connectingFromRef.current && tempConnectorLineRef.current) {\n const worldPos = screenToWorld(e.clientX, e.clientY);\n const line = tempConnectorLineRef.current;\n line.clear();\n line.moveTo(connectingFromRef.current.startX, connectingFromRef.current.startY);\n line.lineTo(worldPos.x, worldPos.y);\n line.stroke({ color: 0x6b7280, width: 2 });\n }\n }, [screenToWorld]);\n\n // Handle pointer up - finish dragging or cancel connecting\n const handlePointerUp = useCallback(() => {\n draggingElementRef.current = null;\n \n // Clean up temp connector line if connection wasn't completed\n if (tempConnectorLineRef.current) {\n tempConnectorLineRef.current.destroy();\n tempConnectorLineRef.current = null;\n }\n connectingFromRef.current = null;\n }, []);\n\n // Handle drag over for toolbox drag-and-drop\n const handleDragOver = useCallback((e: DragEvent) => {\n if (e.dataTransfer?.types.includes('application/x-event-modeling-tool')) {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'copy';\n }\n }, []);\n\n // Handle drop for toolbox drag-and-drop\n const handleDrop = useCallback((e: DragEvent) => {\n e.preventDefault();\n const tool = e.dataTransfer?.getData('application/x-event-modeling-tool') as ElementType;\n if (tool && containerRef.current) {\n const worldPos = screenToWorld(e.clientX, e.clientY);\n onAddElementRef.current(tool, worldPos.x, worldPos.y);\n }\n }, [screenToWorld]);\n\n // Element pointer down - start dragging\n const handleElementPointerDown = useCallback((id: string, e: PIXI.FederatedPointerEvent) => {\n e.stopPropagation();\n \n const element = stateRef.current.elements.find(el => el.id === id);\n if (!element) return;\n \n // Start dragging\n draggingElementRef.current = {\n id,\n startX: e.globalX,\n startY: e.globalY,\n elementStartX: element.position.x,\n elementStartY: element.position.y,\n };\n \n // Select element\n onSelectElementRef.current(id);\n }, []);\n\n // Edge point pointer down - start connecting\n const handleEdgePointerDown = useCallback((elementId: string, side: EdgeSide, e: PIXI.FederatedPointerEvent) => {\n e.stopPropagation();\n \n const element = stateRef.current.elements.find(el => el.id === elementId);\n if (!element) return;\n \n // Calculate edge position in world coordinates\n const edgePos = getEdgePosition(element, side);\n \n // Start connecting - create temp line\n connectingFromRef.current = {\n elementId,\n side,\n startX: edgePos.x,\n startY: edgePos.y,\n };\n \n // Create temporary connector line\n if (worldRef.current) {\n const line = new PIXI.Graphics();\n worldRef.current.addChild(line);\n tempConnectorLineRef.current = line;\n }\n }, [getEdgePosition]);\n\n // Edge point pointer up - complete connection\n const handleEdgePointerUp = useCallback((elementId: string, side: EdgeSide, e: PIXI.FederatedPointerEvent) => {\n e.stopPropagation();\n \n if (connectingFromRef.current && connectingFromRef.current.elementId !== elementId) {\n // Complete the connection\n const connector: Connector = {\n id: `conn-${Date.now()}`,\n from: { elementId: connectingFromRef.current.elementId, side: connectingFromRef.current.side },\n to: { elementId, side },\n };\n onAddConnectorRef.current(connector);\n }\n \n // Clean up\n if (tempConnectorLineRef.current) {\n tempConnectorLineRef.current.destroy();\n tempConnectorLineRef.current = null;\n }\n connectingFromRef.current = null;\n }, []);\n\n const handleConnectorClick = useCallback((id: string) => {\n onSelectConnector(id);\n onSelectElement(undefined);\n }, [onSelectConnector, onSelectElement]);\n\n // Initialize PIXI\n useEffect(() => {\n if (!containerRef.current || appRef.current) return;\n\n let isMounted = true;\n\n const initPixi = async () => {\n const container = containerRef.current;\n if (!container) return;\n \n const rect = container.getBoundingClientRect();\n const width = rect.width > 0 ? rect.width : container.clientWidth || 800;\n const height = rect.height > 0 ? rect.height : container.clientHeight || 600;\n \n const app = new PIXI.Application();\n \n // Get background color from CSS variable (dark mode)\n const bgColor = getComputedBackgroundColor();\n \n try {\n await app.init({\n background: bgColor,\n antialias: true,\n autoDensity: true,\n resolution: window.devicePixelRatio || 1,\n width,\n height,\n autoStart: true,\n });\n \n // Ensure ticker is running and rendering (required for PIXI v8)\n app.ticker.add(() => {\n app.renderer.render(app.stage);\n });\n } catch (e) {\n console.error('PIXI init failed:', e);\n return;\n }\n\n if (!isMounted || !containerRef.current) {\n app.destroy(true, { children: true });\n return;\n }\n\n appRef.current = app;\n\n const world = new PIXI.Container();\n worldRef.current = world;\n app.stage.addChild(world);\n\n // Connectors layer (below elements)\n const connectorsLayer = new PIXI.Container();\n connectorsLayerRef.current = connectorsLayer;\n world.addChild(connectorsLayer);\n\n // Elements layer (above connectors)\n const elementsLayer = new PIXI.Container();\n elementsLayerRef.current = elementsLayer;\n world.addChild(elementsLayer);\n\n const canvasEl = app.canvas as HTMLCanvasElement;\n \n if (canvasEl && containerRef.current) {\n canvasEl.classList.add('event-modeling-canvas');\n canvasEl.style.touchAction = 'none'; // Prevent browser handling of touch\n containerRef.current.appendChild(canvasEl);\n canvasRef.current = canvasEl;\n\n // Set up event listeners\n canvasEl.addEventListener('wheel', handleWheel, { passive: false });\n canvasEl.addEventListener('pointerdown', handleCanvasPointerDown);\n canvasEl.addEventListener('pointermove', handlePointerMove);\n canvasEl.addEventListener('pointerup', handlePointerUp);\n canvasEl.addEventListener('pointerleave', handlePointerUp);\n \n // Set up drag-and-drop listeners on the container for toolbox support\n containerRef.current.addEventListener('dragover', handleDragOver);\n containerRef.current.addEventListener('drop', handleDrop);\n }\n\n setPixiReady(true);\n };\n\n initPixi();\n\n return () => {\n isMounted = false;\n if (canvasRef.current) {\n canvasRef.current.removeEventListener('wheel', handleWheel);\n canvasRef.current.removeEventListener('pointerdown', handleCanvasPointerDown);\n canvasRef.current.removeEventListener('pointermove', handlePointerMove);\n canvasRef.current.removeEventListener('pointerup', handlePointerUp);\n canvasRef.current.removeEventListener('pointerleave', handlePointerUp);\n }\n if (containerRef.current) {\n containerRef.current.removeEventListener('dragover', handleDragOver);\n containerRef.current.removeEventListener('drop', handleDrop);\n }\n if (appRef.current) {\n appRef.current.destroy(true, { children: true });\n appRef.current = null;\n }\n };\n }, [handleWheel, handleCanvasPointerDown, handlePointerMove, handlePointerUp, handleDragOver, handleDrop]);\n\n // Update world transform when zoom/pan changes\n useEffect(() => {\n if (!pixiReady || !worldRef.current) return;\n worldRef.current.position.set(pan.x, pan.y);\n worldRef.current.scale.set(zoom);\n }, [pixiReady, zoom, pan]);\n\n // Sync elements to PIXI\n useEffect(() => {\n console.log('Sync useEffect running', { pixiReady, hasElementsLayer: !!elementsLayerRef.current, elementCount: state.elements.length });\n if (!pixiReady || !elementsLayerRef.current) {\n console.log('Sync useEffect early return', { pixiReady, hasElementsLayer: !!elementsLayerRef.current });\n return;\n }\n \n const elementsMap = new Map(state.elements.map(el => [el.id, el]));\n\n // Remove deleted elements\n spritesRef.current.forEach((sprite, id) => {\n if (!elementsMap.has(id)) {\n elementsLayerRef.current!.removeChild(sprite.container);\n sprite.container.destroy({ children: true });\n spritesRef.current.delete(id);\n }\n });\n\n // Add or update elements\n state.elements.forEach(elementData => {\n const existing = spritesRef.current.get(elementData.id);\n if (existing) {\n updateElementSprite(existing, elementData);\n } else {\n console.log('Creating sprite for', elementData.id, 'at', elementData.position.x, elementData.position.y);\n const sprite = createElementSprite(\n elementData,\n // These handlers are no-ops - we handle events globally via the container\n Function.prototype as () => void,\n Function.prototype as () => void,\n Function.prototype as () => void,\n Function.prototype as () => void,\n Function.prototype as () => void\n );\n \n spritesRef.current.set(elementData.id, sprite);\n elementsLayerRef.current!.addChild(sprite.container);\n console.log('Sprite added to layer', { \n spritePos: { x: sprite.container.position.x, y: sprite.container.position.y },\n layerChildren: elementsLayerRef.current!.children.length,\n visible: sprite.container.visible,\n alpha: sprite.container.alpha\n });\n \n // Set up proper pointer events on the element\n sprite.container.eventMode = 'static';\n sprite.container.cursor = 'grab';\n \n sprite.container.on('pointerdown', (e: PIXI.FederatedPointerEvent) => {\n handleElementPointerDown(elementData.id, e);\n });\n \n // Set up edge point events for drag-to-connect\n sprite.edgePoints.forEach((edgePoint, side) => {\n edgePoint.eventMode = 'static';\n edgePoint.cursor = 'crosshair';\n edgePoint.on('pointerdown', (e: PIXI.FederatedPointerEvent) => {\n handleEdgePointerDown(elementData.id, side, e);\n });\n edgePoint.on('pointerup', (e: PIXI.FederatedPointerEvent) => {\n handleEdgePointerUp(elementData.id, side, e);\n });\n // Also listen for global pointer up on edge points to complete connection\n edgePoint.on('pointerover', () => {\n // Show edge is a valid drop target while connecting\n if (connectingFromRef.current && connectingFromRef.current.elementId !== elementData.id) {\n edgePoint.alpha = 1;\n edgePoint.scale.set(1.5);\n }\n });\n edgePoint.on('pointerout', () => {\n edgePoint.scale.set(1);\n });\n });\n\n // Show edge points on hover\n sprite.container.on('pointerover', () => showEdgePoints(sprite));\n sprite.container.on('pointerout', () => {\n // Only hide if not actively connecting from this element\n if (!connectingFromRef.current || connectingFromRef.current.elementId !== elementData.id) {\n hideEdgePoints(sprite);\n }\n });\n }\n });\n }, [pixiReady, state.elements, handleElementPointerDown, handleEdgePointerDown, handleEdgePointerUp]);\n\n // Create a stable getter function for elements that always returns fresh data\n const getElementsMapRef = useRef<() => Map<string, ElementData>>(() => new Map());\n useEffect(() => {\n getElementsMapRef.current = () => new Map(stateRef.current.elements.map(el => [el.id, el]));\n }, []);\n\n // Sync connectors to PIXI\n useEffect(() => {\n if (!pixiReady || !connectorsLayerRef.current) return;\n\n const connectorsMap = new Map(state.connectors.map(conn => [conn.id, conn]));\n const elementsMap = new Map(state.elements.map(el => [el.id, el]));\n\n // Remove deleted connectors\n connectorsRef.current.forEach((connGraphics, id) => {\n if (!connectorsMap.has(id)) {\n connectorsLayerRef.current!.removeChild(connGraphics.graphics);\n connGraphics.graphics.destroy();\n connectorsRef.current.delete(id);\n }\n });\n\n // Add or update connectors\n state.connectors.forEach(connector => {\n const existing = connectorsRef.current.get(connector.id);\n if (existing) {\n // Update the connector data and getElements function to always return fresh data\n existing.connector = connector; // Update to latest connector data with potentially new edge sides\n existing.getElements = getElementsMapRef.current;\n updateConnectorGraphics(existing, elementsMap);\n } else {\n const connGraphics = createConnectorGraphics(\n connector,\n getElementsMapRef.current,\n handleConnectorClick\n );\n connectorsRef.current.set(connector.id, connGraphics);\n connectorsLayerRef.current!.addChild(connGraphics.graphics);\n }\n });\n }, [pixiReady, state.connectors, state.elements, handleConnectorClick]);\n\n // Update selection highlight\n useEffect(() => {\n if (!pixiReady) return;\n \n spritesRef.current.forEach((sprite, id) => {\n setElementSelected(sprite, id === state.selectedElementId);\n });\n }, [pixiReady, state.selectedElementId]);\n\n return <div ref={containerRef} className=\"event-modeling-canvas-container\" />;\n};\n"],"names":["useRef","useState","useEffect","useCallback","PIXI","updateElementSprite","createElementSprite","showEdgePoints","hideEdgePoints","updateConnectorGraphics","createConnectorGraphics","setElementSelected","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,0BAA0B,GAAA;IAC/B,MAAM,KAAK,GAAG,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC;AACxD,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS;AAGjF,IAAA,OAAO,QAAQ,CAAC,UAAU,CAAC,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BAAA,MAAM,YAAY,GAAGC,yCAAuB,CACxC,SAAS,EACT,iBAAiB,CAAC,OAAO,EACzB,oBAAoB,CACvB;gBACD,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,YAAY,CAAC;gBACrD,kBAAkB,CAAC,OAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;YAC/D;AACJ,QAAA,CAAC,CAAC;AACN,IAAA,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAGvER,eAAS,CAAC,MAAK;AACX,QAAA,IAAI,CAAC,SAAS;YAAE;QAEhB,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,KAAI;YACtCS,iCAAkB,CAAC,MAAM,EAAE,EAAE,KAAK,KAAK,CAAC,iBAAiB,CAAC;AAC9D,QAAA,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAExC,OAAOC,cAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAC,iCAAiC,EAAA,CAAG;AACjF;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
const CanvasControls = ({ zoom, onZoomIn, onZoomOut, onZoomReset, onFitToView, }) => {
|
|
6
|
+
return (jsxRuntime.jsxs("div", { className: "event-modeling-controls", children: [jsxRuntime.jsx("button", { className: "event-modeling-control-button", onClick: onZoomIn, title: "Zoom In (+)", children: "+" }), jsxRuntime.jsx("button", { className: "event-modeling-control-button", onClick: onZoomOut, title: "Zoom Out (-)", children: "\u2212" }), jsxRuntime.jsxs("button", { className: "event-modeling-control-button", onClick: onZoomReset, title: "Reset Zoom (0)", children: [Math.round(zoom * 100), "%"] }), jsxRuntime.jsx("button", { className: "event-modeling-control-button", onClick: onFitToView, title: "Fit to View (F)", children: "\u22A1" })] }));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
exports.CanvasControls = CanvasControls;
|
|
10
|
+
//# sourceMappingURL=CanvasControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasControls.js","sources":["../../../../EventModeling/components/CanvasControls.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React from 'react';\n\nexport interface CanvasControlsProps {\n zoom: number;\n onZoomIn: () => void;\n onZoomOut: () => void;\n onZoomReset: () => void;\n onFitToView: () => void;\n}\n\nexport const CanvasControls: React.FC<CanvasControlsProps> = ({\n zoom,\n onZoomIn,\n onZoomOut,\n onZoomReset,\n onFitToView,\n}) => {\n return (\n <div className=\"event-modeling-controls\">\n <button\n className=\"event-modeling-control-button\"\n onClick={onZoomIn}\n title=\"Zoom In (+)\"\n >\n +\n </button>\n <button\n className=\"event-modeling-control-button\"\n onClick={onZoomOut}\n title=\"Zoom Out (-)\"\n >\n −\n </button>\n <button\n className=\"event-modeling-control-button\"\n onClick={onZoomReset}\n title=\"Reset Zoom (0)\"\n >\n {Math.round(zoom * 100)}%\n </button>\n <button\n className=\"event-modeling-control-button\"\n onClick={onFitToView}\n title=\"Fit to View (F)\"\n >\n ⊡\n </button>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAaO,MAAM,cAAc,GAAkC,CAAC,EAC1D,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,GACd,KAAI;AACD,IAAA,QACIA,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,yBAAyB,EAAA,QAAA,EAAA,CACpCC,cAAA,CAAA,QAAA,EAAA,EACI,SAAS,EAAC,+BAA+B,EACzC,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAC,aAAa,EAAA,QAAA,EAAA,GAAA,EAAA,CAGd,EACTA,cAAA,CAAA,QAAA,EAAA,EACI,SAAS,EAAC,+BAA+B,EACzC,OAAO,EAAE,SAAS,EAClB,KAAK,EAAC,cAAc,EAAA,QAAA,EAAA,QAAA,EAAA,CAGf,EACTD,eAAA,CAAA,QAAA,EAAA,EACI,SAAS,EAAC,+BAA+B,EACzC,OAAO,EAAE,WAAW,EACpB,KAAK,EAAC,gBAAgB,EAAA,QAAA,EAAA,CAErB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,EAAA,GAAA,CAAA,EAAA,CAClB,EACTC,cAAA,CAAA,QAAA,EAAA,EACI,SAAS,EAAC,+BAA+B,EACzC,OAAO,EAAE,WAAW,EACpB,KAAK,EAAC,iBAAiB,EAAA,QAAA,EAAA,QAAA,EAAA,CAGlB,CAAA,EAAA,CACP;AAEd;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const Toolbox = ({ selectedTool, onToolSelect, onDragStart }) => {
|
|
7
|
+
const handleDragStart = React.useCallback((tool, e) => {
|
|
8
|
+
e.dataTransfer.setData('application/x-event-modeling-tool', tool);
|
|
9
|
+
e.dataTransfer.effectAllowed = 'copy';
|
|
10
|
+
if (onDragStart) {
|
|
11
|
+
onDragStart(tool, e);
|
|
12
|
+
}
|
|
13
|
+
}, [onDragStart]);
|
|
14
|
+
return (jsxRuntime.jsxs("div", { className: "event-modeling-toolbox", children: [jsxRuntime.jsxs("button", { className: `event-modeling-tool-button select ${selectedTool === 'select' ? 'selected' : ''}`, onClick: () => onToolSelect('select'), title: "Select (V)", children: [jsxRuntime.jsx("div", { className: "event-modeling-tool-icon", children: "\u2B06" }), jsxRuntime.jsx("div", { children: "Select" })] }), jsxRuntime.jsxs("button", { className: `event-modeling-tool-button command ${selectedTool === 'command' ? 'selected' : ''}`, onClick: () => onToolSelect('command'), draggable: true, onDragStart: (e) => handleDragStart('command', e), title: "Command (C) - Click or drag to canvas", children: [jsxRuntime.jsx("div", { className: "event-modeling-tool-icon" }), jsxRuntime.jsx("div", { children: "Command" })] }), jsxRuntime.jsxs("button", { className: `event-modeling-tool-button event ${selectedTool === 'event' ? 'selected' : ''}`, onClick: () => onToolSelect('event'), draggable: true, onDragStart: (e) => handleDragStart('event', e), title: "Event (E) - Click or drag to canvas", children: [jsxRuntime.jsx("div", { className: "event-modeling-tool-icon" }), jsxRuntime.jsx("div", { children: "Event" })] }), jsxRuntime.jsxs("button", { className: `event-modeling-tool-button readmodel ${selectedTool === 'readmodel' ? 'selected' : ''}`, onClick: () => onToolSelect('readmodel'), draggable: true, onDragStart: (e) => handleDragStart('readmodel', e), title: "Read Model (R) - Click or drag to canvas", children: [jsxRuntime.jsx("div", { className: "event-modeling-tool-icon" }), jsxRuntime.jsx("div", { children: "View" })] }), jsxRuntime.jsxs("button", { className: `event-modeling-tool-button process ${selectedTool === 'process' ? 'selected' : ''}`, onClick: () => onToolSelect('process'), draggable: true, onDragStart: (e) => handleDragStart('process', e), title: "Process (P) - Click or drag to canvas", children: [jsxRuntime.jsx("div", { className: "event-modeling-tool-icon", children: jsxRuntime.jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }), jsxRuntime.jsx("path", { d: "M12 6v6l4 2" })] }) }), jsxRuntime.jsx("div", { children: "Process" })] })] }));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.Toolbox = Toolbox;
|
|
18
|
+
//# sourceMappingURL=Toolbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toolbox.js","sources":["../../../../EventModeling/components/Toolbox.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React, { useCallback } from 'react';\nimport { ElementType } from '../types';\n\nexport interface ToolboxProps {\n selectedTool: ElementType | 'select';\n onToolSelect: (tool: ElementType | 'select') => void;\n onDragStart?: (tool: ElementType, e: React.DragEvent) => void;\n}\n\nexport const Toolbox: React.FC<ToolboxProps> = ({ selectedTool, onToolSelect, onDragStart }) => {\n const handleDragStart = useCallback((tool: ElementType, e: React.DragEvent) => {\n e.dataTransfer.setData('application/x-event-modeling-tool', tool);\n e.dataTransfer.effectAllowed = 'copy';\n if (onDragStart) {\n onDragStart(tool, e);\n }\n }, [onDragStart]);\n\n return (\n <div className=\"event-modeling-toolbox\">\n <button\n className={`event-modeling-tool-button select ${selectedTool === 'select' ? 'selected' : ''}`}\n onClick={() => onToolSelect('select')}\n title=\"Select (V)\"\n >\n <div className=\"event-modeling-tool-icon\">⬆</div>\n <div>Select</div>\n </button>\n <button\n className={`event-modeling-tool-button command ${selectedTool === 'command' ? 'selected' : ''}`}\n onClick={() => onToolSelect('command')}\n draggable\n onDragStart={(e) => handleDragStart('command', e)}\n title=\"Command (C) - Click or drag to canvas\"\n >\n <div className=\"event-modeling-tool-icon\"></div>\n <div>Command</div>\n </button>\n <button\n className={`event-modeling-tool-button event ${selectedTool === 'event' ? 'selected' : ''}`}\n onClick={() => onToolSelect('event')}\n draggable\n onDragStart={(e) => handleDragStart('event', e)}\n title=\"Event (E) - Click or drag to canvas\"\n >\n <div className=\"event-modeling-tool-icon\"></div>\n <div>Event</div>\n </button>\n <button\n className={`event-modeling-tool-button readmodel ${selectedTool === 'readmodel' ? 'selected' : ''}`}\n onClick={() => onToolSelect('readmodel')}\n draggable\n onDragStart={(e) => handleDragStart('readmodel', e)}\n title=\"Read Model (R) - Click or drag to canvas\"\n >\n <div className=\"event-modeling-tool-icon\"></div>\n <div>View</div>\n </button>\n <button\n className={`event-modeling-tool-button process ${selectedTool === 'process' ? 'selected' : ''}`}\n onClick={() => onToolSelect('process')}\n draggable\n onDragStart={(e) => handleDragStart('process', e)}\n title=\"Process (P) - Click or drag to canvas\"\n >\n <div className=\"event-modeling-tool-icon\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"10\"/>\n <path d=\"M12 6v6l4 2\"/>\n </svg>\n </div>\n <div>Process</div>\n </button>\n </div>\n );\n};\n"],"names":["useCallback","_jsxs","_jsx"],"mappings":";;;;;AAYO,MAAM,OAAO,GAA2B,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,KAAI;IAC3F,MAAM,eAAe,GAAGA,iBAAW,CAAC,CAAC,IAAiB,EAAE,CAAkB,KAAI;QAC1E,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,mCAAmC,EAAE,IAAI,CAAC;AACjE,QAAA,CAAC,CAAC,YAAY,CAAC,aAAa,GAAG,MAAM;QACrC,IAAI,WAAW,EAAE;AACb,YAAA,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QACxB;AACJ,IAAA,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;AAEjB,IAAA,QACIC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,wBAAwB,EAAA,QAAA,EAAA,CACnCA,eAAA,CAAA,QAAA,EAAA,EACI,SAAS,EAAE,qCAAqC,YAAY,KAAK,QAAQ,GAAG,UAAU,GAAG,EAAE,CAAA,CAAE,EAC7F,OAAO,EAAE,MAAM,YAAY,CAAC,QAAQ,CAAC,EACrC,KAAK,EAAC,YAAY,EAAA,QAAA,EAAA,CAElBC,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,0BAA0B,EAAA,QAAA,EAAA,QAAA,EAAA,CAAQ,EACjDA,6CAAiB,CAAA,EAAA,CACZ,EACTD,eAAA,CAAA,QAAA,EAAA,EACI,SAAS,EAAE,CAAA,mCAAA,EAAsC,YAAY,KAAK,SAAS,GAAG,UAAU,GAAG,E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