@elixpo/lixsketch 5.6.5 → 5.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp/index.js +5 -1
- package/dist/mcp/index.js.map +2 -2
- package/dist/mcp/stdio.js +5 -1
- package/dist/mcp/stdio.js.map +2 -2
- package/dist/react/{AIRenderer-SRF7LU5K.js → AIRenderer-R5M2CIDO.js} +13 -6
- package/dist/react/AIRenderer-R5M2CIDO.js.map +7 -0
- package/dist/react/Circle-HMM5PKJ2.js +10 -0
- package/dist/react/{CopyPaste-YUDZ6DHY.js → CopyPaste-P6G35CXO.js} +11 -10
- package/dist/react/{CopyPaste-YUDZ6DHY.js.map → CopyPaste-P6G35CXO.js.map} +1 -1
- package/dist/react/{EventDispatcher-7LAK7GQ7.js → EventDispatcher-M5B4EWHJ.js} +216 -63
- package/dist/react/EventDispatcher-M5B4EWHJ.js.map +7 -0
- package/dist/react/Frame-QEUEYITT.js +11 -0
- package/dist/react/{FreehandStroke-U6GYZOM4.js → FreehandStroke-WXIJKD5I.js} +2 -2
- package/dist/react/{GraphEngine-MM6ALA2N.js → GraphEngine-XH3RPYO4.js} +9 -2
- package/dist/react/GraphEngine-XH3RPYO4.js.map +7 -0
- package/dist/react/IconShape-NHJE4YBY.js +10 -0
- package/dist/react/ImageShape-33VCMSDP.js +10 -0
- package/dist/react/Line-A6FE232Q.js +10 -0
- package/dist/react/{LixScriptParser-JYWJX375.js → LixScriptParser-YS3ZOTGS.js} +6 -2
- package/dist/react/LixScriptParser-YS3ZOTGS.js.map +7 -0
- package/dist/react/{MermaidFlowchartRenderer-PQEC4TMI.js → MermaidFlowchartRenderer-EL3Q2MNW.js} +6 -2
- package/dist/react/MermaidFlowchartRenderer-EL3Q2MNW.js.map +7 -0
- package/dist/react/MermaidSequenceParser-DBYXW23P.js +8 -0
- package/dist/react/{MermaidSequenceRenderer-KCUHO7UI.js → MermaidSequenceRenderer-K4KHHEVC.js} +10 -3
- package/dist/react/MermaidSequenceRenderer-K4KHHEVC.js.map +7 -0
- package/dist/react/{MermaidStructuredRenderer-W7UKN7BM.js → MermaidStructuredRenderer-6LN3WISP.js} +7 -2
- package/dist/react/MermaidStructuredRenderer-6LN3WISP.js.map +7 -0
- package/dist/react/Rectangle-4U4CD2ER.js +10 -0
- package/dist/react/{SceneSerializer-SG6SJN5X.js → SceneSerializer-JEYTYXZQ.js} +120 -46
- package/dist/react/SceneSerializer-JEYTYXZQ.js.map +7 -0
- package/dist/react/{Selection-2TSH3J6P.js → Selection-23MOLHEI.js} +4 -4
- package/dist/react/{SketchEngine-UD2XV2KT.js → SketchEngine-OPJON7TD.js} +26 -26
- package/dist/react/{UndoRedo-IN4SXDG6.js → UndoRedo-QVNRI5OB.js} +8 -2
- package/dist/react/{arrowTool-OYDWJGQK.js → arrowTool-VH3PJPDM.js} +3 -3
- package/dist/react/{chunk-LSHZYN77.js → chunk-2DZHO67H.js} +2 -2
- package/dist/react/{chunk-XOWNCYE4.js → chunk-5NHJJJBZ.js} +3 -3
- package/dist/react/chunk-6AIFXYV6.js +31 -0
- package/dist/react/chunk-6AIFXYV6.js.map +7 -0
- package/dist/react/{chunk-K5RY4EV7.js → chunk-6GPWSPJF.js} +9 -5
- package/dist/react/{chunk-K5RY4EV7.js.map → chunk-6GPWSPJF.js.map} +2 -2
- package/dist/react/{chunk-ASBC5G35.js → chunk-B6CYUZC4.js} +2 -2
- package/dist/react/{chunk-OP56XPWF.js → chunk-DNFPTVIP.js} +2 -2
- package/dist/react/{chunk-XYUFEIZR.js → chunk-DWEFPKDO.js} +2 -2
- package/dist/react/{chunk-GQUZPON4.js → chunk-F56XUE5S.js} +4 -4
- package/dist/react/{chunk-7CM5XQDN.js → chunk-G3DJQY65.js} +20 -36
- package/dist/react/chunk-G3DJQY65.js.map +7 -0
- package/dist/react/{chunk-LJR7EVW2.js → chunk-JEGLUNBC.js} +3 -3
- package/dist/react/{chunk-6GPEWDRB.js → chunk-M7GAB24F.js} +52 -6
- package/dist/react/chunk-M7GAB24F.js.map +7 -0
- package/dist/react/{chunk-VQVEPJSA.js → chunk-MHV5P6TS.js} +2 -1
- package/dist/react/chunk-MHV5P6TS.js.map +7 -0
- package/dist/react/{chunk-PXFPPO3R.js → chunk-NH3NVSWT.js} +18 -2
- package/dist/react/chunk-NH3NVSWT.js.map +7 -0
- package/dist/react/{chunk-XFL4R5ZF.js → chunk-OK4ROGMM.js} +16 -35
- package/dist/react/chunk-OK4ROGMM.js.map +7 -0
- package/dist/react/{chunk-APTOPAOY.js → chunk-SSFEN5CY.js} +3 -3
- package/dist/react/{chunk-RGMDWLRJ.js → chunk-UEL2G6D2.js} +3 -3
- package/dist/react/{chunk-M6TMN76K.js → chunk-ULPIHUVC.js} +3 -3
- package/dist/react/{chunk-FETTJLCV.js → chunk-VZPH7OAM.js} +14 -22
- package/dist/react/chunk-VZPH7OAM.js.map +7 -0
- package/dist/react/{chunk-TKXKJNTX.js → chunk-W7XUY4GR.js} +16 -19
- package/dist/react/chunk-W7XUY4GR.js.map +7 -0
- package/dist/react/{chunk-EOURRJ55.js → chunk-XSE4HQ2D.js} +2 -2
- package/dist/react/{chunk-K5BG5MHY.js → chunk-ZNZAICWY.js} +36 -60
- package/dist/react/chunk-ZNZAICWY.js.map +7 -0
- package/dist/react/{circleTool-LDKGZALF.js → circleTool-2UODOBCV.js} +4 -4
- package/dist/react/{codeTool-4YZO5W7J.js → codeTool-F4RV7SAI.js} +4 -4
- package/dist/react/{frameTool-MXNJEXQQ.js → frameTool-NTGA5BI6.js} +4 -4
- package/dist/react/{freehandTool-26D3FOOX.js → freehandTool-L55EUB5C.js} +4 -4
- package/dist/react/{iconTool-46O5VEUX.js → iconTool-KQQBLGR3.js} +4 -4
- package/dist/react/{imageTool-P2RWZRHO.js → imageTool-LDJ45AD7.js} +4 -4
- package/dist/react/index.js +148 -37
- package/dist/react/index.js.map +4 -4
- package/dist/react/{lineTool-ZMR27U5L.js → lineTool-CSAFD7PW.js} +4 -4
- package/dist/react/{rectangleTool-EJKK6UTX.js → rectangleTool-YPD2SIIZ.js} +4 -4
- package/dist/react/{textTool-S4XXZHZH.js → textTool-VQHMWEFJ.js} +5 -5
- package/package.json +5 -2
- package/src/core/AIRenderer.js +8 -2
- package/src/core/CanvasSpace.js +28 -0
- package/src/core/GraphRenderer.js +8 -3
- package/src/core/LixScriptParser.js +7 -1
- package/src/core/MermaidFlowchartRenderer.js +5 -1
- package/src/core/MermaidSequenceParser.js +1 -0
- package/src/core/MermaidSequenceRenderer.js +8 -3
- package/src/core/MermaidStructuredRenderer.js +6 -1
- package/src/core/SceneSerializer.js +121 -38
- package/src/core/Selection.js +12 -2
- package/src/core/UndoRedo.js +59 -5
- package/src/react/components/AppMenu.jsx +20 -19
- package/src/react/components/canvas/CanvasRulers.jsx +8 -13
- package/src/react/components/canvas/SVGCanvas.jsx +2 -1
- package/src/react/components/canvas/rulerUnits.js +28 -0
- package/src/react/components/sidebars/PaintBucketSidebar.jsx +1 -1
- package/src/react/store/useSketchStore.js +24 -3
- package/src/react/store/useUIStore.js +24 -1
- package/src/react/utils/canvasBackgrounds.js +29 -0
- package/src/shapes/Circle.js +12 -19
- package/src/shapes/Frame.js +38 -69
- package/src/shapes/FreehandStroke.js +24 -1
- package/src/shapes/Rectangle.js +10 -22
- package/src/tools/circleTool.js +3 -27
- package/src/tools/paintBucketTool.js +72 -15
- package/src/tools/rectangleTool.js +7 -23
- package/src/tools/shapeRecognition.js +270 -0
- package/src/tools/shapeRecognitionTool.js +36 -183
- package/dist/react/AIRenderer-SRF7LU5K.js.map +0 -7
- package/dist/react/Circle-6POZCUZD.js +0 -9
- package/dist/react/EventDispatcher-7LAK7GQ7.js.map +0 -7
- package/dist/react/Frame-7D2MXCFF.js +0 -11
- package/dist/react/GraphEngine-MM6ALA2N.js.map +0 -7
- package/dist/react/IconShape-ZADX7Y33.js +0 -10
- package/dist/react/ImageShape-UJQN2HI7.js +0 -10
- package/dist/react/Line-APEULMHE.js +0 -10
- package/dist/react/LixScriptParser-JYWJX375.js.map +0 -7
- package/dist/react/MermaidFlowchartRenderer-PQEC4TMI.js.map +0 -7
- package/dist/react/MermaidSequenceParser-UKG2NSZY.js +0 -8
- package/dist/react/MermaidSequenceRenderer-KCUHO7UI.js.map +0 -7
- package/dist/react/MermaidStructuredRenderer-W7UKN7BM.js.map +0 -7
- package/dist/react/Rectangle-S7XUKWYD.js +0 -9
- package/dist/react/SceneSerializer-SG6SJN5X.js.map +0 -7
- package/dist/react/chunk-6GPEWDRB.js.map +0 -7
- package/dist/react/chunk-7CM5XQDN.js.map +0 -7
- package/dist/react/chunk-FETTJLCV.js.map +0 -7
- package/dist/react/chunk-K5BG5MHY.js.map +0 -7
- package/dist/react/chunk-PXFPPO3R.js.map +0 -7
- package/dist/react/chunk-TKXKJNTX.js.map +0 -7
- package/dist/react/chunk-VQVEPJSA.js.map +0 -7
- package/dist/react/chunk-XFL4R5ZF.js.map +0 -7
- /package/dist/react/{Circle-6POZCUZD.js.map → Circle-HMM5PKJ2.js.map} +0 -0
- /package/dist/react/{Frame-7D2MXCFF.js.map → Frame-QEUEYITT.js.map} +0 -0
- /package/dist/react/{FreehandStroke-U6GYZOM4.js.map → FreehandStroke-WXIJKD5I.js.map} +0 -0
- /package/dist/react/{IconShape-ZADX7Y33.js.map → IconShape-NHJE4YBY.js.map} +0 -0
- /package/dist/react/{ImageShape-UJQN2HI7.js.map → ImageShape-33VCMSDP.js.map} +0 -0
- /package/dist/react/{Line-APEULMHE.js.map → Line-A6FE232Q.js.map} +0 -0
- /package/dist/react/{MermaidSequenceParser-UKG2NSZY.js.map → MermaidSequenceParser-DBYXW23P.js.map} +0 -0
- /package/dist/react/{Rectangle-S7XUKWYD.js.map → Rectangle-4U4CD2ER.js.map} +0 -0
- /package/dist/react/{Selection-2TSH3J6P.js.map → Selection-23MOLHEI.js.map} +0 -0
- /package/dist/react/{SketchEngine-UD2XV2KT.js.map → SketchEngine-OPJON7TD.js.map} +0 -0
- /package/dist/react/{UndoRedo-IN4SXDG6.js.map → UndoRedo-QVNRI5OB.js.map} +0 -0
- /package/dist/react/{arrowTool-OYDWJGQK.js.map → arrowTool-VH3PJPDM.js.map} +0 -0
- /package/dist/react/{chunk-LSHZYN77.js.map → chunk-2DZHO67H.js.map} +0 -0
- /package/dist/react/{chunk-XOWNCYE4.js.map → chunk-5NHJJJBZ.js.map} +0 -0
- /package/dist/react/{chunk-ASBC5G35.js.map → chunk-B6CYUZC4.js.map} +0 -0
- /package/dist/react/{chunk-OP56XPWF.js.map → chunk-DNFPTVIP.js.map} +0 -0
- /package/dist/react/{chunk-XYUFEIZR.js.map → chunk-DWEFPKDO.js.map} +0 -0
- /package/dist/react/{chunk-GQUZPON4.js.map → chunk-F56XUE5S.js.map} +0 -0
- /package/dist/react/{chunk-LJR7EVW2.js.map → chunk-JEGLUNBC.js.map} +0 -0
- /package/dist/react/{chunk-APTOPAOY.js.map → chunk-SSFEN5CY.js.map} +0 -0
- /package/dist/react/{chunk-RGMDWLRJ.js.map → chunk-UEL2G6D2.js.map} +0 -0
- /package/dist/react/{chunk-M6TMN76K.js.map → chunk-ULPIHUVC.js.map} +0 -0
- /package/dist/react/{chunk-EOURRJ55.js.map → chunk-XSE4HQ2D.js.map} +0 -0
- /package/dist/react/{circleTool-LDKGZALF.js.map → circleTool-2UODOBCV.js.map} +0 -0
- /package/dist/react/{codeTool-4YZO5W7J.js.map → codeTool-F4RV7SAI.js.map} +0 -0
- /package/dist/react/{frameTool-MXNJEXQQ.js.map → frameTool-NTGA5BI6.js.map} +0 -0
- /package/dist/react/{freehandTool-26D3FOOX.js.map → freehandTool-L55EUB5C.js.map} +0 -0
- /package/dist/react/{iconTool-46O5VEUX.js.map → iconTool-KQQBLGR3.js.map} +0 -0
- /package/dist/react/{imageTool-P2RWZRHO.js.map → imageTool-LDJ45AD7.js.map} +0 -0
- /package/dist/react/{lineTool-ZMR27U5L.js.map → lineTool-CSAFD7PW.js.map} +0 -0
- /package/dist/react/{rectangleTool-EJKK6UTX.js.map → rectangleTool-YPD2SIIZ.js.map} +0 -0
- /package/dist/react/{textTool-S4XXZHZH.js.map → textTool-VQHMWEFJ.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/UndoRedo.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n// Undo/Redo system - copied from undoAndRedo.js\n\n// Stacks for undo/redo\nconst undoStack = [];\nconst redoStack = [];\n\n// Import references to text-related variables and functions\nlet selectedElement = null;\nlet updateSelectionFeedback = null;\nlet svg = null;\n\nfunction notifyCollaboration() {\n if (typeof window !== 'undefined' && typeof window.__collabSceneChanged === 'function') {\n window.__collabSceneChanged();\n }\n}\n\n// Function to set references from other modules\nexport function setTextReferences(element, updateFn, svgElement) {\n selectedElement = element;\n updateSelectionFeedback = updateFn;\n svg = svgElement;\n}\n\n// Function to get current selectedElement (called from other modules)\nexport function getCurrentSelectedElement() {\n return selectedElement;\n}\n\n// Function to update selectedElement reference (called from other modules)\nexport function updateSelectedElement(element) {\n selectedElement = element;\n}\n\n// Call this after creating a new shape (e.g., Rectangle)\nexport function pushCreateAction(shape, meta = null) {\n const action = {\n type: 'create',\n shape: shape\n };\n if (meta?.frameCreation && shape?.shapeName === 'frame') {\n action.frameCreation = true;\n action.containedShapes = [...(meta.containedShapes || shape.containedShapes || [])];\n action.shapeIndex = Array.isArray(shapes) ? shapes.indexOf(shape) : -1;\n }\n undoStack.push(action);\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushDeleteAction(shape, meta = null) {\n // Issue #24 bug #7: when the deleted shape is a frame, the caller may\n // pass `meta.childSnapshot` \u2014 the contained shape REFERENCES at the\n // time of delete. The undo branch uses this to re-attach the children\n // when the frame is restored, instead of leaving an empty box.\n const action = { type: 'delete', shape };\n if (meta && meta.childSnapshot) action.childSnapshot = meta.childSnapshot;\n if (Number.isInteger(meta?.shapeIndex)) action.shapeIndex = meta.shapeIndex;\n undoStack.push(action);\n\n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushCanvasResetAction(snapshot, restore, reset) {\n if (!snapshot || typeof restore !== 'function' || typeof reset !== 'function') return;\n // A reset is a new history boundary. Older per-shape actions reference\n // objects that the scene loader will replace, so only the atomic reset\n // snapshot remains undoable.\n undoStack.length = 0;\n redoStack.length = 0;\n undoStack.push({ type: 'canvasReset', snapshot, restore, reset });\n}\n\nexport function invalidateCanvasResetUndo() {\n for (let index = undoStack.length - 1; index >= 0; index -= 1) {\n if (undoStack[index]?.type === 'canvasReset') undoStack.splice(index, 1);\n }\n for (let index = redoStack.length - 1; index >= 0; index -= 1) {\n if (redoStack[index]?.type === 'canvasReset') redoStack.splice(index, 1);\n }\n}\n\nexport function clearUndoHistory() {\n undoStack.length = 0;\n redoStack.length = 0;\n}\n\n// Enhanced delete action to clean up attached arrows\nexport function pushDeleteActionWithAttachments(shape) {\n let affectedArrows = [];\n \n // If deleting a text element, find all attached arrows\n if (shape.type === 'text' || shape.shapeName === 'text') {\n affectedArrows = shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }));\n }\n \n undoStack.push({\n type: 'delete',\n shape: shape,\n affectedArrows: affectedArrows\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushFrameAttachmentAction(frame, shape, action, oldFrame = null) {\n undoStack.push({\n type: 'frameAttachment',\n frame: frame,\n shape: shape,\n action: action, // 'attach' or 'detach'\n oldFrame: oldFrame, // Previous frame if shape was moved between frames\n // Store shape position for potential restoration\n shapeState: {\n x: shape.x,\n y: shape.y,\n width: shape.width || 0,\n height: shape.height || 0,\n rotation: shape.rotation || 0\n }\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushCreateActionWithAttachments(shape) {\n undoStack.push({\n type: 'create',\n shape: shape,\n // Store any arrows that might need to reattach when this is undone\n potentialAttachments: []\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushTransformAction(shape, oldPos, newPos) {\n if (shape.shapeName === 'frame') {\n // Handle frame transformation with contained shapes\n const containedShapesStates = shape.containedShapes.map(containedShape => ({\n shape: containedShape,\n oldState: {\n x: containedShape.x - (newPos.x - oldPos.x),\n y: containedShape.y - (newPos.y - oldPos.y),\n width: containedShape.width || 0,\n height: containedShape.height || 0,\n rotation: containedShape.rotation || 0\n },\n newState: {\n x: containedShape.x,\n y: containedShape.y,\n width: containedShape.width || 0,\n height: containedShape.height || 0,\n rotation: containedShape.rotation || 0\n }\n }));\n\n undoStack.push({\n type: 'frameTransform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation,\n frameName: oldPos.frameName || shape.frameName\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation,\n frameName: newPos.frameName || shape.frameName\n },\n containedShapes: containedShapesStates\n });\n } else if (shape.type === 'text') {\n // Enhanced text handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n rotation: oldPos.rotation,\n fontSize: oldPos.fontSize\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n rotation: newPos.rotation,\n fontSize: newPos.fontSize\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.type === 'image') {\n // Enhanced image handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.shapeName === 'circle') {\n // Enhanced circle handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n rx: oldPos.rx,\n ry: oldPos.ry,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n rx: newPos.rx,\n ry: newPos.ry,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } else if (shape.shapeName === \"rectangle\") {\n // Enhanced rectangle handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: { \n x: oldPos.x, \n y: oldPos.y, \n width: oldPos.width, \n height: oldPos.height, \n rotation: oldPos.rotation\n },\n newPos: { \n x: newPos.x, \n y: newPos.y, \n width: newPos.width, \n height: newPos.height, \n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n } \n else if (shape.shapeName === 'line') {\n // Enhanced line handling with curve support\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n startPoint: { x: oldPos.startPoint.x, y: oldPos.startPoint.y },\n endPoint: { x: oldPos.endPoint.x, y: oldPos.endPoint.y },\n controlPoint: oldPos.controlPoint ? { x: oldPos.controlPoint.x, y: oldPos.controlPoint.y } : null,\n isCurved: oldPos.isCurved || false\n },\n newPos: {\n startPoint: { x: newPos.startPoint.x, y: newPos.startPoint.y },\n endPoint: { x: newPos.endPoint.x, y: newPos.endPoint.y },\n controlPoint: newPos.controlPoint ? { x: newPos.controlPoint.x, y: newPos.controlPoint.y } : null,\n isCurved: newPos.isCurved || false\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n }\n });\n }\n else if (shape.shapeName === 'arrow') {\n // Handle arrow transform with attachment state\n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n startPoint: { x: oldPos.startPoint.x, y: oldPos.startPoint.y },\n endPoint: { x: oldPos.endPoint.x, y: oldPos.endPoint.y },\n controlPoint1: oldPos.controlPoint1 ? { x: oldPos.controlPoint1.x, y: oldPos.controlPoint1.y } : null,\n controlPoint2: oldPos.controlPoint2 ? { x: oldPos.controlPoint2.x, y: oldPos.controlPoint2.y } : null,\n attachments: oldPos.attachments || shape.getAttachmentState()\n },\n newPos: {\n startPoint: { x: newPos.startPoint.x, y: newPos.startPoint.y },\n endPoint: { x: newPos.endPoint.x, y: newPos.endPoint.y },\n controlPoint1: newPos.controlPoint1 ? { x: newPos.controlPoint1.x, y: newPos.controlPoint1.y } : null,\n controlPoint2: newPos.controlPoint2 ? { x: newPos.controlPoint2.x, y: newPos.controlPoint2.y } : null,\n attachments: newPos.attachments || shape.getAttachmentState()\n }\n });\n } \n else if (shape.type === 'icon') {\n // Enhanced icon handling - also track frame attachment changes\n const currentFrame = shape.parentFrame || null;\n \n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n x: oldPos.x,\n y: oldPos.y,\n width: oldPos.width,\n height: oldPos.height,\n rotation: oldPos.rotation\n },\n newPos: {\n x: newPos.x,\n y: newPos.y,\n width: newPos.width,\n height: newPos.height,\n rotation: newPos.rotation\n },\n // Track frame attachment state\n frameAttachment: {\n oldFrame: oldPos.parentFrame || null,\n newFrame: currentFrame\n },\n // Store affected arrows with their attachment states\n affectedArrows: shapes.filter(s => s.shapeName === 'arrow' && \n (s.attachedToStart?.shape === shape || s.attachedToEnd?.shape === shape))\n .map(arrow => ({\n arrow: arrow,\n oldAttachments: arrow.getAttachmentState(),\n oldPoints: {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n }\n }))\n });\n}\n else if (shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform\n undoStack.push({\n type: 'transform',\n shape: shape,\n oldPos: {\n points: JSON.parse(JSON.stringify(oldPos.points)),\n rotation: oldPos.rotation\n },\n newPos: {\n points: JSON.parse(JSON.stringify(newPos.points)),\n rotation: newPos.rotation\n }\n });\n }\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nexport function pushOptionsChangeAction(shape, oldOptions, newOptions = null) {\n undoStack.push({\n type: 'optionsChange',\n shape: shape,\n oldOptions: oldOptions,\n newOptions: newOptions\n });\n \n // Clear redo stack when new action is performed\n redoStack.length = 0;\n notifyCollaboration();\n}\n\nfunction applyOptionsSnapshot(shape, options) {\n shape.options = { ...options };\n if (shape.shapeName === 'frame') {\n shape.fillColor = options.fillColor;\n shape.fillStyle = options.fillStyle;\n }\n shape.draw();\n}\n\n// Issue #34 bug #4: refresh the multi-selection outline + handles so it\n// follows the reverted geometry. Without this the selection rect stays\n// pinned to the pre-undo coordinates and the user sees a ghost rect\n// floating away from the shapes it claims to wrap.\nfunction refreshSelectionAfterAction() {\n const ms = (typeof window !== 'undefined') ? window.multiSelection : null;\n if (!ms) return;\n if (typeof ms.updateControls !== 'function') return;\n if (!ms.selectedShapes || ms.selectedShapes.size === 0) return;\n try { ms.updateControls(); } catch (err) { console.warn('[UndoRedo] selection refresh failed:', err); }\n}\n\nexport function undo() {\n if (undoStack.length === 0) return;\n const action = undoStack.pop();\n try {\n if (action.type === 'canvasReset') {\n action.restore(action.snapshot);\n redoStack.push(action);\n notifyCollaboration();\n return;\n }\n\n if (action.type === 'frameTransform') {\n // Handle frame transformation undo\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.width = action.oldPos.width;\n action.shape.height = action.oldPos.height;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.frameName = action.oldPos.frameName;\n \n // Restore contained shapes to their old positions\n action.containedShapes.forEach(shapeData => {\n const shape = shapeData.shape;\n shape.x = shapeData.oldState.x;\n shape.y = shapeData.oldState.y;\n shape.width = shapeData.oldState.width;\n shape.height = shapeData.oldState.height;\n shape.rotation = shapeData.oldState.rotation;\n \n if (typeof shape.draw === 'function') {\n shape.draw();\n }\n });\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n action.shape.updateClipPath();\n \n redoStack.push(action);\n return;\n }\n \n if (action.type === 'frameAttachment') {\n // Handle frame attachment/detachment undo WITHOUT calling the methods that track undo\n if (action.action === 'attach') {\n // Undo attach: manually remove shape from frame\n const frameIndex = action.frame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frame.containedShapes.splice(frameIndex, 1);\n action.shape.parentFrame = null;\n \n // Move shape back to main SVG\n if (action.shape.group && action.shape.group.parentNode === action.frame.clipGroup) {\n action.frame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n \n // If shape was moved from another frame, restore it there\n if (action.oldFrame) {\n action.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.oldFrame;\n \n // Move to old frame's clipped group\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else if (action.action === 'detach') {\n // Undo detach: manually add shape back to frame\n if (!action.frame.containedShapes.includes(action.shape)) {\n action.frame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frame;\n \n // Move to frame's clipped group\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frame.clipGroup.appendChild(action.shape.group);\n }\n }\n }\n \n // Restore shape state\n action.shape.x = action.shapeState.x;\n action.shape.y = action.shapeState.y;\n action.shape.width = action.shapeState.width;\n action.shape.height = action.shapeState.height;\n action.shape.rotation = action.shapeState.rotation;\n \n if (typeof action.shape.draw === 'function') {\n action.shape.draw();\n }\n \n redoStack.push(action);\n return;\n }\n\n // Handle mode conversion undo (code \u2194 text)\n if (action.type === 'create' && action.shape.type === 'modeConvert') {\n // Undo: remove the new shape, restore the old shape\n const newShape = action.shape.newShape;\n const newElement = action.shape.newElement;\n const oldShape = action.shape.oldShape;\n const oldElement = action.shape.oldElement;\n\n // Remove new shape from DOM and shapes array\n if (newElement && newElement.parentNode) {\n newElement.parentNode.removeChild(newElement);\n }\n const newIdx = shapes.indexOf(newShape);\n if (newIdx !== -1) shapes.splice(newIdx, 1);\n\n // Restore old shape to DOM and shapes array\n if (svg && oldElement) {\n svg.appendChild(oldElement);\n }\n if (oldShape) {\n shapes.push(oldShape);\n }\n\n redoStack.push(action);\n return;\n }\n\n if (action.type === 'create') {\n if (action.frameCreation && action.shape.shapeName === 'frame') {\n // Treat a manually-created frame and its initial membership as one\n // atomic action. Children remain on the canvas when the frame is\n // undone and are clipped back into it on redo.\n for (const child of action.containedShapes || []) {\n if (child?.parentFrame === action.shape) action.shape.removeShapeFromFrame(child);\n }\n if (currentShape === action.shape) {\n action.shape.removeSelection?.();\n currentShape = null;\n }\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n action.shape.group?.remove();\n action.shape.clipGroup?.remove();\n action.shape.clipPath?.remove();\n } else\n if (action.shape.type === 'text') {\n // Handle text creation undo\n if (action.shape.element && action.shape.element.parentNode) {\n action.shape.element.parentNode.removeChild(action.shape.element);\n } else if (action.shape.parentNode) {\n action.shape.parentNode.removeChild(action.shape);\n }\n\n // Remove from shapes array\n const idx = shapes.indexOf(action.shape.element || action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n\n // Clean up any arrow attachments to this text\n if (typeof cleanupAttachments === 'function') {\n cleanupAttachments(action.shape.element || action.shape);\n }\n } else if (action.shape.type === 'image') {\n // Handle image creation undo\n action.shape.remove();\n } else if (action.shape.type === 'icon') {\n // Handle icon creation undo - call the remove method\n action.shape.remove();\n } else {\n // Handle other shape creation undo\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n if (action.shape.group && action.shape.group.parentNode) {\n action.shape.group.parentNode.removeChild(action.shape.group);\n }\n \n // Handle frame cleanup\n if (action.shape.shapeName === 'frame') {\n action.shape.destroy();\n }\n }\n redoStack.push(action);\n return;\n}\n \n if (action.type === 'delete') {\n if (action.shape.type === 'text') {\n // Handle text deletion undo\n if (svg) {\n svg.appendChild(action.shape.element || action.shape);\n // Add back to shapes array\n shapes.push(action.shape.element || action.shape);\n }\n \n // Restore arrow attachments if any existed\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore the old attachment state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n });\n }\n } else if (action.shape.type === 'image') {\n // Handle image deletion undo\n action.shape.restore();\n } else {\n // Handle other shape deletion undo\n if (shapes.indexOf(action.shape) === -1) {\n const index = Number.isInteger(action.shapeIndex)\n ? Math.min(Math.max(action.shapeIndex, 0), shapes.length)\n : shapes.length;\n shapes.splice(index, 0, action.shape);\n }\n if (svg) {\n svg.appendChild(action.shape.group);\n }\n\n // Issue #24 bug #7: rehydrate frame state. The delete path\n // orphaned the frame (removed <g>, clipGroup, clipPath from\n // DOM) but kept the JS object intact. Re-attach clipGroup +\n // clipPath, then re-parent every child from the snapshot via\n // addShapeToFrame. Skip children that were subsequently\n // deleted (they'll get re-added when their own delete action\n // is undone in turn).\n if (action.shape.shapeName === 'frame' && svg) {\n if (action.shape.clipGroup && !action.shape.clipGroup.parentNode) {\n svg.appendChild(action.shape.clipGroup);\n }\n if (action.shape.clipPath && !action.shape.clipPath.parentNode) {\n const defs = svg.querySelector('defs');\n if (defs) defs.appendChild(action.shape.clipPath);\n else svg.insertBefore(action.shape.clipPath, svg.firstChild);\n }\n if (action.childSnapshot && Array.isArray(action.childSnapshot)) {\n for (const child of action.childSnapshot) {\n if (!child) continue;\n if (shapes.indexOf(child) === -1) continue;\n if (typeof action.shape.addShapeToFrame === 'function') {\n action.shape.addShapeToFrame(child);\n }\n }\n }\n }\n }\n redoStack.push(action);\n return;\n }\n \n if (action.type === 'transform') {\n // Handle frame attachment changes first\n if (action.frameAttachment) {\n // Use manual frame operations to avoid undo recursion\n if (action.frameAttachment.newFrame) {\n const frameIndex = action.frameAttachment.newFrame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frameAttachment.newFrame.containedShapes.splice(frameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.newFrame.clipGroup) {\n action.frameAttachment.newFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n if (action.frameAttachment.oldFrame) {\n if (!action.frameAttachment.oldFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.oldFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n if (action.shape.type === 'text') {\n // Enhanced text transform undo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement && action.oldPos.fontSize !== undefined) {\n textElement.setAttribute('font-size', action.oldPos.fontSize + 'px');\n }\n \n // Restore position and rotation\n const centerX = textElement ? textElement.getBBox().x + textElement.getBBox().width / 2 : 0;\n const centerY = textElement ? textElement.getBBox().y + textElement.getBBox().height / 2 : 0;\n \n (action.shape.element || action.shape).setAttribute('transform', \n `translate(${action.oldPos.x}, ${action.oldPos.y}) rotate(${action.oldPos.rotation}, ${centerX}, ${centerY})`\n );\n \n (action.shape.element || action.shape).setAttribute('data-x', action.oldPos.x);\n (action.shape.element || action.shape).setAttribute('data-y', action.oldPos.y);\n \n // Update attached arrows after text undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n } else if (action.shape.type === 'image') {\n // Enhanced image transform undo\n action.shape.restore(action.oldPos);\n \n // Update attached arrows after image undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n } else if (action.shape.shapeName === 'circle') {\n // Enhanced circle transform undo\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.rx = action.oldPos.rx;\n action.shape.ry = action.oldPos.ry;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after circle undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n } else if (action.shape.shapeName === 'line') {\n // Enhanced line transform undo with curve support\n action.shape.startPoint = { x: action.oldPos.startPoint.x, y: action.oldPos.startPoint.y };\n action.shape.endPoint = { x: action.oldPos.endPoint.x, y: action.oldPos.endPoint.y };\n \n // Restore curve state\n action.shape.isCurved = action.oldPos.isCurved || false;\n if (action.oldPos.controlPoint) {\n action.shape.controlPoint = { x: action.oldPos.controlPoint.x, y: action.oldPos.controlPoint.y };\n } else {\n action.shape.controlPoint = null;\n }\n \n // Handle frame attachment changes\n if (action.frameAttachment) {\n // Remove from new frame if it exists\n if (action.frameAttachment.newFrame) {\n const frameIndex = action.frameAttachment.newFrame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frameAttachment.newFrame.containedShapes.splice(frameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.newFrame.clipGroup) {\n action.frameAttachment.newFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add back to old frame if it exists\n if (action.frameAttachment.oldFrame) {\n if (!action.frameAttachment.oldFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.oldFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.oldFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.oldFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n }\n else if (action.shape.shapeName === 'arrow') {\n // Enhanced arrow transform undo with attachment restoration\n action.shape.startPoint = { x: action.oldPos.startPoint.x, y: action.oldPos.startPoint.y };\n action.shape.endPoint = { x: action.oldPos.endPoint.x, y: action.oldPos.endPoint.y };\n action.shape.controlPoint1 = action.oldPos.controlPoint1 ? \n { x: action.oldPos.controlPoint1.x, y: action.oldPos.controlPoint1.y } : null;\n action.shape.controlPoint2 = action.oldPos.controlPoint2 ? \n { x: action.oldPos.controlPoint2.x, y: action.oldPos.controlPoint2.y } : null;\n \n // Restore attachment state\n if (action.oldPos.attachments) {\n action.shape.restoreAttachmentState(action.oldPos.attachments);\n } else {\n // Clear attachments if none existed before\n action.shape.attachedToStart = null;\n action.shape.attachedToEnd = null;\n }\n \n action.shape.isSelected = false;\n action.shape.draw();\n \n\n \n } \n else if (action.shape.type === 'icon') {\n \n action.shape.restore(action.oldPos);\n \n // Update attached arrows after icon undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to old state\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n \n // Store current state for redo\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n }\n else if (action.shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform undo\n action.shape.points = JSON.parse(JSON.stringify(action.oldPos.points));\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n } else if (action.shape.shapeName === \"rectangle\") {\n action.shape.x = action.oldPos.x;\n action.shape.y = action.oldPos.y;\n action.shape.height = action.oldPos.height;\n action.shape.width = action.oldPos.width;\n action.shape.rotation = action.oldPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after rectangle undo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n arrow.restoreAttachmentState(arrowData.oldAttachments);\n arrowData.newPoints = {\n startPoint: { ...arrow.startPoint },\n endPoint: { ...arrow.endPoint }\n };\n arrowData.newAttachments = arrow.getAttachmentState();\n });\n }\n }\n redoStack.push(action);\n return;\n }\n \n if (action.type === 'optionsChange') {\n if (!action.newOptions && action.shape?.options) {\n action.newOptions = action.shape.shapeName === 'arrow'\n ? {\n ...action.shape.options,\n arrowOutlineStyle: action.shape.arrowOutlineStyle,\n arrowHeadStyle: action.shape.arrowHeadStyle,\n arrowCurved: action.shape.arrowCurved,\n arrowCurveAmount: action.shape.arrowCurveAmount,\n }\n : { ...action.shape.options };\n }\n if (action.shape.type === 'text') {\n // Handle text options change undo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement) {\n if (action.oldOptions.color) textElement.setAttribute('fill', action.oldOptions.color);\n if (action.oldOptions.font) textElement.setAttribute('font-family', action.oldOptions.font);\n if (action.oldOptions.size) textElement.setAttribute('font-size', action.oldOptions.size);\n if (action.oldOptions.align) textElement.setAttribute('text-anchor', action.oldOptions.align);\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n }\n } else if (action.shape.shapeName === 'arrow') {\n // Handle arrow options change undo\n action.shape.options = { ...action.oldOptions };\n action.shape.arrowOutlineStyle = action.oldOptions.arrowOutlineStyle;\n action.shape.arrowHeadStyle = action.oldOptions.arrowHeadStyle;\n action.shape.arrowCurved = action.oldOptions.arrowCurved;\n action.shape.arrowCurveAmount = action.oldOptions.arrowCurveAmount;\n action.shape.draw();\n } else {\n // Handle other shape options change undo\n applyOptionsSnapshot(action.shape, action.oldOptions);\n }\n redoStack.push(action);\n return;\n }\n } finally {\n refreshSelectionAfterAction();\n notifyCollaboration();\n }\n}\n\nexport function redo() {\n if (redoStack.length === 0) return;\n const action = redoStack.pop();\n try {\n if (action.type === 'canvasReset') {\n action.reset();\n undoStack.push(action);\n notifyCollaboration();\n return;\n }\n\n if (action.type === 'frameTransform') {\n // Handle frame transformation redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.width = action.newPos.width;\n action.shape.height = action.newPos.height;\n action.shape.rotation = action.newPos.rotation;\n action.shape.frameName = action.newPos.frameName;\n \n // Restore contained shapes to their new positions\n action.containedShapes.forEach(shapeData => {\n const shape = shapeData.shape;\n shape.x = shapeData.newState.x;\n shape.y = shapeData.newState.y;\n shape.width = shapeData.newState.width;\n shape.height = shapeData.newState.height;\n shape.rotation = shapeData.newState.rotation;\n \n if (typeof shape.draw === 'function') {\n shape.draw();\n }\n });\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n action.shape.updateClipPath();\n \n undoStack.push(action);\n return;\n }\n\n \n if (action.type === 'frameAttachment') {\n // Handle frame attachment/detachment redo WITHOUT calling the methods that track undo\n if (action.action === 'attach') {\n // Redo attach: manually add shape to frame\n if (action.oldFrame) {\n // Remove from old frame\n const oldFrameIndex = action.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.oldFrame.clipGroup) {\n action.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add to new frame\n if (!action.frame.containedShapes.includes(action.shape)) {\n action.frame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frame;\n \n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else if (action.action === 'detach') {\n // Redo detach: manually remove shape from frame\n const frameIndex = action.frame.containedShapes.indexOf(action.shape);\n if (frameIndex > -1) {\n action.frame.containedShapes.splice(frameIndex, 1);\n action.shape.parentFrame = null;\n \n if (action.shape.group && action.shape.group.parentNode === action.frame.clipGroup) {\n action.frame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n if (typeof action.shape.draw === 'function') {\n action.shape.draw();\n }\n \n undoStack.push(action);\n return;\n }\n\n // Handle mode conversion redo (code \u2194 text)\n if (action.type === 'create' && action.shape.type === 'modeConvert') {\n // Redo: remove the old shape, restore the new shape\n const newShape = action.shape.newShape;\n const newElement = action.shape.newElement;\n const oldShape = action.shape.oldShape;\n const oldElement = action.shape.oldElement;\n\n // Remove old shape from DOM and shapes array\n if (oldElement && oldElement.parentNode) {\n oldElement.parentNode.removeChild(oldElement);\n }\n const oldIdx = shapes.indexOf(oldShape);\n if (oldIdx !== -1) shapes.splice(oldIdx, 1);\n\n // Restore new shape to DOM and shapes array\n if (svg && newElement) {\n svg.appendChild(newElement);\n }\n if (newShape) {\n shapes.push(newShape);\n }\n\n undoStack.push(action);\n return;\n }\n\n if (action.type === 'create') {\n if (action.frameCreation && action.shape.shapeName === 'frame') {\n const frame = action.shape;\n let defs = svg?.querySelector('defs');\n if (!defs && svg) {\n defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');\n svg.appendChild(defs);\n }\n if (defs && frame.clipPath && !frame.clipPath.parentNode) defs.appendChild(frame.clipPath);\n if (svg && frame.group && !frame.group.parentNode) svg.appendChild(frame.group);\n if (svg && frame.clipGroup && !frame.clipGroup.parentNode) svg.appendChild(frame.clipGroup);\n if (shapes.indexOf(frame) === -1) {\n const index = action.shapeIndex >= 0 ? Math.min(action.shapeIndex, shapes.length) : shapes.length;\n shapes.splice(index, 0, frame);\n }\n frame.containedShapes = [];\n frame.draw();\n frame.updateClipPath();\n for (const child of action.containedShapes || []) {\n if (child && shapes.includes(child)) frame.addShapeToFrame(child);\n }\n } else\n if (action.shape.type === 'text') {\n // Handle text creation redo\n if (svg) {\n svg.appendChild(action.shape.element || action.shape);\n // Add back to shapes array\n shapes.push(action.shape.element || action.shape);\n }\n }\n else if (action.shape.type === 'image') {\n // Handle image creation redo\n action.shape.restore();\n } else if (action.shape.type === 'icon') {\n // Handle icon creation redo - append the group, not the shape object\n if (svg && action.shape.group) {\n svg.appendChild(action.shape.group);\n }\n // Add back to shapes array\n if (shapes.indexOf(action.shape) === -1) {\n shapes.push(action.shape);\n }\n } else {\n // Handle other shape creation redo\n shapes.push(action.shape);\n if (svg) {\n svg.appendChild(action.shape.group);\n }\n }\n undoStack.push(action);\n return;\n}\n \n if (action.type === 'delete') {\n if (action.shape.type === 'text') {\n // Handle text deletion redo\n if ((action.shape.element || action.shape).parentNode) {\n (action.shape.element || action.shape).parentNode.removeChild(action.shape.element || action.shape);\n }\n // Remove from shapes array\n const idx = shapes.indexOf(action.shape.element || action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n \n // Clean up arrow attachments again\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Detach from the deleted text\n if (arrow.attachedToStart && arrow.attachedToStart.shape === (action.shape.element || action.shape)) {\n arrow.detachFromShape(true);\n }\n if (arrow.attachedToEnd && arrow.attachedToEnd.shape === (action.shape.element || action.shape)) {\n arrow.detachFromShape(false);\n }\n arrow.draw();\n });\n }\n }\n else if (action.shape.type === 'image') {\n // Handle image deletion redo\n action.shape.remove();\n } else {\n // Handle other shape deletion redo\n const idx = shapes.indexOf(action.shape);\n if (idx !== -1) shapes.splice(idx, 1);\n\n // Issue #24 bug #7: for a regular frame, re-orphan instead of\n // destroy() \u2014 releases children visually, detaches the frame's\n // own DOM bits, but keeps the JS object and child references\n // intact so a subsequent undo can rehydrate again.\n if (action.shape.shapeName === 'frame' && !action.shape._diagramType && action.childSnapshot) {\n for (const child of action.childSnapshot) {\n if (!child) continue;\n const el = child.group || child.element;\n if (el && svg) {\n if (action.shape.clipGroup && el.parentNode === action.shape.clipGroup) {\n action.shape.clipGroup.removeChild(el);\n }\n if (el.parentNode !== svg) svg.appendChild(el);\n }\n child.parentFrame = null;\n delete child.isBeingMovedByFrame;\n }\n action.shape.containedShapes = [];\n if (action.shape.group && action.shape.group.parentNode) action.shape.group.parentNode.removeChild(action.shape.group);\n if (action.shape.clipGroup && action.shape.clipGroup.parentNode) action.shape.clipGroup.parentNode.removeChild(action.shape.clipGroup);\n if (action.shape.clipPath && action.shape.clipPath.parentNode) action.shape.clipPath.parentNode.removeChild(action.shape.clipPath);\n } else {\n if (action.shape.group && action.shape.group.parentNode) {\n action.shape.group.parentNode.removeChild(action.shape.group);\n }\n // Diagram frame OR no snapshot \u2192 fall back to destroy().\n if (action.shape.shapeName === 'frame' && typeof action.shape.destroy === 'function') {\n action.shape.destroy();\n }\n }\n }\n undoStack.push(action);\n return;\n }\n \n if (action.type === 'transform') {\n // Handle frame attachment changes first\n if (action.frameAttachment) {\n // Use manual frame operations to avoid undo recursion\n if (action.frameAttachment.oldFrame) {\n const oldFrameIndex = action.frameAttachment.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.frameAttachment.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.oldFrame.clipGroup) {\n action.frameAttachment.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n if (action.frameAttachment.newFrame) {\n if (!action.frameAttachment.newFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.newFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.newFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.newFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n if (action.shape.type === 'text') {\n // Enhanced text transform redo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement && action.newPos.fontSize !== undefined) {\n textElement.setAttribute('font-size', action.newPos.fontSize + 'px');\n }\n \n // Restore position and rotation\n const centerX = textElement ? textElement.getBBox().x + textElement.getBBox().width / 2 : 0;\n const centerY = textElement ? textElement.getBBox().y + textElement.getBBox().height / 2 : 0;\n \n (action.shape.element || action.shape).setAttribute('transform', \n `translate(${action.newPos.x}, ${action.newPos.y}) rotate(${action.newPos.rotation}, ${centerX}, ${centerY})`\n );\n \n (action.shape.element || action.shape).setAttribute('data-x', action.newPos.x);\n (action.shape.element || action.shape).setAttribute('data-y', action.newPos.y);\n \n // Update attached arrows after text redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current text position\n arrow.updateAttachments();\n }\n });\n }\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n } else if (action.shape.type === 'image') {\n // Enhanced image transform redo\n action.shape.restore(action.newPos);\n \n // Update attached arrows after image redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current image position\n arrow.updateAttachments();\n }\n });\n }\n } else if (action.shape.shapeName === 'circle') {\n // Enhanced circle transform redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.rx = action.newPos.rx;\n action.shape.ry = action.newPos.ry;\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after circle redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current circle position\n arrow.updateAttachments();\n }\n });\n }\n } else if (action.shape.shapeName === 'line') {\n // Enhanced line transform redo with curve support\n action.shape.startPoint = { x: action.newPos.startPoint.x, y: action.newPos.startPoint.y };\n action.shape.endPoint = { x: action.newPos.endPoint.x, y: action.newPos.endPoint.y };\n \n // Restore curve state\n action.shape.isCurved = action.newPos.isCurved || false;\n if (action.newPos.controlPoint) {\n action.shape.controlPoint = { x: action.newPos.controlPoint.x, y: action.newPos.controlPoint.y };\n } else {\n action.shape.controlPoint = null;\n }\n \n // Handle frame attachment changes\n if (action.frameAttachment) {\n // Remove from old frame if it exists\n if (action.frameAttachment.oldFrame) {\n const oldFrameIndex = action.frameAttachment.oldFrame.containedShapes.indexOf(action.shape);\n if (oldFrameIndex > -1) {\n action.frameAttachment.oldFrame.containedShapes.splice(oldFrameIndex, 1);\n if (action.shape.group && action.shape.group.parentNode === action.frameAttachment.oldFrame.clipGroup) {\n action.frameAttachment.oldFrame.clipGroup.removeChild(action.shape.group);\n svg.appendChild(action.shape.group);\n }\n }\n }\n \n // Add to new frame if it exists\n if (action.frameAttachment.newFrame) {\n if (!action.frameAttachment.newFrame.containedShapes.includes(action.shape)) {\n action.frameAttachment.newFrame.containedShapes.push(action.shape);\n action.shape.parentFrame = action.frameAttachment.newFrame;\n if (action.shape.group && action.shape.group.parentNode === svg) {\n svg.removeChild(action.shape.group);\n action.frameAttachment.newFrame.clipGroup.appendChild(action.shape.group);\n }\n }\n } else {\n action.shape.parentFrame = null;\n }\n }\n \n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n }\n else if (action.shape.shapeName === 'arrow') {\n // Enhanced arrow transform redo with attachment restoration\n action.shape.startPoint = { x: action.newPos.startPoint.x, y: action.newPos.startPoint.y };\n action.shape.endPoint = { x: action.newPos.endPoint.x, y: action.newPos.endPoint.y };\n action.shape.controlPoint1 = action.newPos.controlPoint1 ? \n { x: action.newPos.controlPoint1.x, y: action.newPos.controlPoint1.y } : null;\n action.shape.controlPoint2 = action.newPos.controlPoint2 ? \n { x: action.newPos.controlPoint2.x, y: action.newPos.controlPoint2.y } : null;\n \n // Restore attachment state\n if (action.newPos.attachments) {\n action.shape.restoreAttachmentState(action.newPos.attachments);\n } else {\n // Clear attachments if none should exist\n action.shape.attachedToStart = null;\n action.shape.attachedToEnd = null;\n }\n \n action.shape.isSelected = false;\n action.shape.draw();\n \n } \n else if (action.shape.type === 'icon') {\n action.shape.restore(action.newPos);\n \n // Update attached arrows after icon redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current icon position\n arrow.updateAttachments();\n }\n });\n }\n }\n else if (action.shape.shapeName === 'freehandStroke') {\n // Handle freehand stroke transform redo\n action.shape.points = JSON.parse(JSON.stringify(action.newPos.points));\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n } else if (action.shape.shapeName === \"rectangle\") {\n // Enhanced rectangle transform redo\n action.shape.x = action.newPos.x;\n action.shape.y = action.newPos.y;\n action.shape.height = action.newPos.height;\n action.shape.width = action.newPos.width;\n action.shape.rotation = action.newPos.rotation;\n action.shape.isSelected = false;\n if (typeof action.shape.removeSelection === 'function') action.shape.removeSelection();\n action.shape.draw();\n\n // Update attached arrows after rectangle redo\n if (action.affectedArrows) {\n action.affectedArrows.forEach(arrowData => {\n const arrow = arrowData.arrow;\n // Restore arrow attachments to new state\n if (arrowData.newAttachments) {\n arrow.restoreAttachmentState(arrowData.newAttachments);\n } else {\n // If no new attachments stored, recalculate based on current rectangle position\n arrow.updateAttachments();\n }\n });\n }\n }\n undoStack.push(action);\n return;\n }\n \n if (action.type === 'optionsChange') {\n if (action.shape.type === 'text') {\n // Handle text options change redo\n const textElement = (action.shape.element || action.shape).querySelector('text');\n if (textElement) {\n if (action.newOptions.color) textElement.setAttribute('fill', action.newOptions.color);\n if (action.newOptions.font) textElement.setAttribute('font-family', action.newOptions.font);\n if (action.newOptions.size) textElement.setAttribute('font-size', action.newOptions.size);\n if (action.newOptions.align) textElement.setAttribute('text-anchor', action.newOptions.align);\n \n // Update feedback if selected\n if (selectedElement === (action.shape.element || action.shape) && updateSelectionFeedback) {\n setTimeout(updateSelectionFeedback, 0);\n }\n }\n } else if (action.shape.shapeName === 'arrow') {\n action.shape.options = { ...action.newOptions };\n action.shape.arrowOutlineStyle = action.newOptions.arrowOutlineStyle;\n action.shape.arrowHeadStyle = action.newOptions.arrowHeadStyle;\n action.shape.arrowCurved = action.newOptions.arrowCurved;\n action.shape.arrowCurveAmount = action.newOptions.arrowCurveAmount;\n action.shape.draw();\n } else {\n applyOptionsSnapshot(action.shape, action.newOptions);\n }\n undoStack.push(action);\n return;\n }\n } finally {\n refreshSelectionAfterAction();\n notifyCollaboration();\n }\n}\n\n// Optional: Keyboard shortcuts\ndocument.addEventListener('keydown', (e) => {\n if ((e.ctrlKey || e.metaKey) && e.key === 'z') {\n e.preventDefault();\n undo();\n }\n if ((e.ctrlKey || e.metaKey) && (e.key === 'y' || (e.shiftKey && e.key === 'z'))) {\n e.preventDefault();\n redo();\n }\n});\n\n// Attach to buttons\ndocument.getElementById('undo')?.addEventListener('click', undo);\ndocument.getElementById('redo')?.addEventListener('click', redo);\n\n// Expose globally for plain scripts\nwindow.pushCreateAction = pushCreateAction;\nwindow.pushDeleteAction = pushDeleteAction;\nwindow.pushCanvasResetAction = pushCanvasResetAction;\nwindow.invalidateCanvasResetUndo = invalidateCanvasResetUndo;\nwindow.clearUndoHistory = clearUndoHistory;\nwindow.pushDeleteActionWithAttachments = pushDeleteActionWithAttachments;\nwindow.pushTransformAction = pushTransformAction;\nwindow.pushOptionsChangeAction = pushOptionsChangeAction;\nwindow.pushCreateActionWithAttachments = pushCreateActionWithAttachments;\nwindow.undo = undo;\nwindow.redo = redo;\n"],
|
|
5
|
+
"mappings": ";;;AAIA,IAAM,YAAY,CAAC;AACnB,IAAM,YAAY,CAAC;AAGnB,IAAI,kBAAkB;AACtB,IAAI,0BAA0B;AAC9B,IAAI,MAAM;AAEV,SAAS,sBAAsB;AAC3B,MAAI,OAAO,WAAW,eAAe,OAAO,OAAO,yBAAyB,YAAY;AACpF,WAAO,qBAAqB;AAAA,EAChC;AACJ;AAGO,SAAS,kBAAkB,SAAS,UAAU,YAAY;AAC7D,oBAAkB;AAClB,4BAA0B;AAC1B,QAAM;AACV;AAGO,SAAS,4BAA4B;AACxC,SAAO;AACX;AAGO,SAAS,sBAAsB,SAAS;AAC3C,oBAAkB;AACtB;AAGO,SAAS,iBAAiB,OAAO,OAAO,MAAM;AACjD,QAAM,SAAS;AAAA,IACX,MAAM;AAAA,IACN;AAAA,EACJ;AACA,MAAI,MAAM,iBAAiB,OAAO,cAAc,SAAS;AACrD,WAAO,gBAAgB;AACvB,WAAO,kBAAkB,CAAC,GAAI,KAAK,mBAAmB,MAAM,mB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AAkC;AACzC,OAAO,OAAO;AACd,OAAO,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -13,6 +13,7 @@ var ARROW_TYPES = {
|
|
|
13
13
|
};
|
|
14
14
|
var ARROW_PATTERNS = Object.keys(ARROW_TYPES).sort((a, b) => b.length - a.length);
|
|
15
15
|
function parseSequenceDiagram(src) {
|
|
16
|
+
if (typeof src !== "string") return null;
|
|
16
17
|
const lines = src.trim().split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("%%"));
|
|
17
18
|
if (lines.length === 0) return null;
|
|
18
19
|
if (lines[0].toLowerCase() !== "sequencediagram") return null;
|
|
@@ -155,4 +156,4 @@ function parseSequenceDiagram(src) {
|
|
|
155
156
|
export {
|
|
156
157
|
parseSequenceDiagram
|
|
157
158
|
};
|
|
158
|
-
//# sourceMappingURL=chunk-
|
|
159
|
+
//# sourceMappingURL=chunk-MHV5P6TS.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/MermaidSequenceParser.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\n/**\n * MermaidSequenceParser - Parses Mermaid sequenceDiagram syntax.\n *\n * Supports:\n * - participant/actor declarations\n * - Message types: ->>, -->>,->>x, -->>x, ->, -->, -x, --x\n * - Notes: Note left of, Note right of, Note over\n * - Activations: activate/deactivate\n * - Alt/else/opt/loop/par/critical/break blocks\n * - Auto-numbering (autonumber)\n * - Title\n */\n\n// Message arrow types\nconst ARROW_TYPES = {\n '->>': { solid: true, arrowHead: 'open', cross: false },\n '-->>': { solid: false, arrowHead: 'open', cross: false },\n '->>x': { solid: true, arrowHead: 'open', cross: true },\n '-->>x':{ solid: false, arrowHead: 'open', cross: true },\n '->': { solid: true, arrowHead: 'filled', cross: false },\n '-->': { solid: false, arrowHead: 'filled', cross: false },\n '-x': { solid: true, arrowHead: 'cross', cross: true },\n '--x': { solid: false, arrowHead: 'cross', cross: true },\n};\n\n// Sorted by length descending so longest match wins\nconst ARROW_PATTERNS = Object.keys(ARROW_TYPES).sort((a, b) => b.length - a.length);\n\nexport function parseSequenceDiagram(src) {\n if (typeof src !== 'string') return null;\n const lines = src.trim().split('\\n').map(l => l.trim()).filter(l => l && !l.startsWith('%%'));\n if (lines.length === 0) return null;\n\n // Check header\n if (lines[0].toLowerCase() !== 'sequencediagram') return null;\n\n const participants = [];\n const participantSet = new Set();\n const messages = [];\n const notes = [];\n const blocks = []; // alt/loop/opt etc\n const blockStack = []; // nesting stack\n let title = '';\n let autoNumber = false;\n let msgIndex = 0;\n\n function ensureParticipant(name) {\n if (!name) return;\n const trimmed = name.trim();\n if (!trimmed) return;\n if (!participantSet.has(trimmed)) {\n participantSet.add(trimmed);\n participants.push({ name: trimmed, type: 'participant' });\n }\n }\n\n for (let i = 1; i < lines.length; i++) {\n const line = lines[i];\n\n // Title\n if (line.match(/^title\\s*:/i)) {\n title = line.replace(/^title\\s*:\\s*/i, '').trim();\n continue;\n }\n\n // Autonumber\n if (line.toLowerCase() === 'autonumber') {\n autoNumber = true;\n continue;\n }\n\n // Participant / Actor declaration\n const partMatch = line.match(/^(participant|actor)\\s+(.+?)(?:\\s+as\\s+(.+))?$/i);\n if (partMatch) {\n const type = partMatch[1].toLowerCase();\n const rawName = partMatch[3] || partMatch[2];\n const name = rawName.trim();\n if (!participantSet.has(name)) {\n participantSet.add(name);\n participants.push({ name, type });\n }\n continue;\n }\n\n // Note\n const noteMatch = line.match(/^Note\\s+(left of|right of|over)\\s+([^:]+?):\\s*(.+)$/i);\n if (noteMatch) {\n const position = noteMatch[1].toLowerCase();\n const targets = noteMatch[2].split(',').map(s => s.trim());\n const text = noteMatch[3].trim();\n targets.forEach(t => ensureParticipant(t));\n notes.push({\n position,\n targets,\n text,\n atMessage: messages.length, // placed after this many messages\n });\n continue;\n }\n\n // Block start: alt, else, opt, loop, par, critical, break\n const blockStartMatch = line.match(/^(alt|else|opt|loop|par|critical|break)\\s*(.*)?$/i);\n if (blockStartMatch) {\n const blockType = blockStartMatch[1].toLowerCase();\n const label = (blockStartMatch[2] || '').trim();\n\n if (blockType === 'else') {\n // 'else' adds a section to current alt block\n if (blockStack.length > 0) {\n const current = blockStack[blockStack.length - 1];\n current.sections.push({ label, startMsg: messages.length });\n }\n } else {\n const block = {\n type: blockType,\n label,\n startMsg: messages.length,\n sections: [{ label, startMsg: messages.length }],\n endMsg: messages.length,\n };\n blockStack.push(block);\n }\n continue;\n }\n\n // Block end\n if (line.toLowerCase() === 'end') {\n if (blockStack.length > 0) {\n const block = blockStack.pop();\n block.endMsg = messages.length;\n blocks.push(block);\n }\n continue;\n }\n\n // Activate / Deactivate\n const actMatch = line.match(/^(activate|deactivate)\\s+(.+)$/i);\n if (actMatch) {\n ensureParticipant(actMatch[2].trim());\n continue;\n }\n\n // Message: From ARROW To: Text\n let foundArrow = null;\n let arrowPos = -1;\n for (const pattern of ARROW_PATTERNS) {\n const idx = line.indexOf(pattern);\n if (idx > 0) {\n // Make sure it's not part of a longer pattern\n foundArrow = pattern;\n arrowPos = idx;\n break;\n }\n }\n\n if (foundArrow && arrowPos > 0) {\n const from = line.substring(0, arrowPos).trim();\n const rest = line.substring(arrowPos + foundArrow.length);\n const colonIdx = rest.indexOf(':');\n let to, text;\n if (colonIdx >= 0) {\n to = rest.substring(0, colonIdx).trim();\n text = rest.substring(colonIdx + 1).trim();\n } else {\n to = rest.trim();\n text = '';\n }\n\n ensureParticipant(from);\n ensureParticipant(to);\n\n const arrowType = ARROW_TYPES[foundArrow];\n msgIndex++;\n\n messages.push({\n from,\n to,\n text,\n number: autoNumber ? msgIndex : null,\n ...arrowType,\n });\n continue;\n }\n }\n\n if (participants.length === 0) return null;\n\n return {\n type: 'sequenceDiagram',\n title,\n participants,\n messages,\n notes,\n blocks,\n autoNumber,\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;AAeA,IAAM,cAAc;AAAA,EAChB,OAAQ,EAAE,OAAO,MAAO,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O;AAAA,MACX;AAEA,wBAAkB,IAAI;AACtB,wBAAkB,EAAE;AAEpB,YAAM,YAAY,YAAY,UAAU;AACxC;AAEA,eAAS,KAAK;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ,aAAa,WAAW;AAAA,QAChC,GAAG;AAAA,MACP,CAAC;AACD;AAAA,IACJ;AAAA,EACJ;AAEA,MAAI,aAAa,WAAW,EAAG,QAAO;AAEtC,SAAO;AAAA,IACH,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -49,6 +49,8 @@ var FreehandStroke = class {
|
|
|
49
49
|
this.selectionOutline = null;
|
|
50
50
|
this.boundingBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
51
51
|
this.shapeName = "freehandStroke";
|
|
52
|
+
this.shapeID = `freehand-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 1e4)}`;
|
|
53
|
+
this.group.setAttribute("id", this.shapeID);
|
|
52
54
|
this._moveOffsetX = 0;
|
|
53
55
|
this._moveOffsetY = 0;
|
|
54
56
|
this.parentFrame = null;
|
|
@@ -237,7 +239,10 @@ var FreehandStroke = class {
|
|
|
237
239
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
238
240
|
const pathData = this.getPathData();
|
|
239
241
|
path.setAttribute("d", pathData);
|
|
240
|
-
|
|
242
|
+
const closedFillStyle = this.options.fillStyle || "solid";
|
|
243
|
+
const closedFill = closedFillStyle === "none" ? "transparent" : this.options.fill || this.options.stroke;
|
|
244
|
+
const patternedFill = this.options.closedFill && !["none", "solid"].includes(closedFillStyle) && typeof rough !== "undefined";
|
|
245
|
+
path.setAttribute("fill", this.options.closedFill ? patternedFill ? "transparent" : closedFill : this.options.stroke);
|
|
241
246
|
path.setAttribute("fill-opacity", this.options.strokeOpacity);
|
|
242
247
|
path.setAttribute("stroke", this.options.closedFill ? this.options.outlineStroke || "none" : "none");
|
|
243
248
|
if (this.options.closedFill) {
|
|
@@ -258,6 +263,17 @@ var FreehandStroke = class {
|
|
|
258
263
|
overlay.setAttribute("stroke-opacity", this.options.strokeOpacity);
|
|
259
264
|
this.group.appendChild(overlay);
|
|
260
265
|
}
|
|
266
|
+
if (patternedFill) {
|
|
267
|
+
const fillGroup = rough.svg(svg).path(pathData, {
|
|
268
|
+
stroke: "none",
|
|
269
|
+
fill: closedFill,
|
|
270
|
+
fillStyle: closedFillStyle,
|
|
271
|
+
fillWeight: Math.max(1, (this.options.strokeWidth || 2) / 2),
|
|
272
|
+
roughness: 0.8
|
|
273
|
+
});
|
|
274
|
+
fillGroup.setAttribute("data-freehand-fill-pattern", closedFillStyle);
|
|
275
|
+
this.group.appendChild(fillGroup);
|
|
276
|
+
}
|
|
261
277
|
this.element = path;
|
|
262
278
|
this.group.appendChild(path);
|
|
263
279
|
this.boundingBox = this.calculateBoundingBox();
|
|
@@ -608,4 +624,4 @@ var FreehandStroke = class {
|
|
|
608
624
|
export {
|
|
609
625
|
FreehandStroke
|
|
610
626
|
};
|
|
611
|
-
//# sourceMappingURL=chunk-
|
|
627
|
+
//# sourceMappingURL=chunk-NH3NVSWT.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/shapes/FreehandStroke.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable */\nimport { getStroke } from \"perfect-freehand\";\nimport { registerRotationAnchor } from '../core/ScreenSpaceControls.js';\n// FreehandStroke shape class - extracted from canvasStroke.js\n// Depends on globals: svg, shapes, currentShape, currentZoom, currentViewBox\n\nfunction getSvgCoordinates(event) {\n const rect = svg.getBoundingClientRect();\n const scaleX = currentViewBox.width / rect.width;\n const scaleY = currentViewBox.height / rect.height;\n\n const svgX = currentViewBox.x + (event.clientX - rect.left) * scaleX;\n const svgY = currentViewBox.y + (event.clientY - rect.top) * scaleY;\n\n return { x: svgX, y: svgY };\n}\n\nfunction getSvgPathFromStroke(stroke) {\n if (!stroke.length) return '';\n \n // Use more sophisticated curve fitting\n const pathData = [];\n pathData.push('M', stroke[0][0], stroke[0][1]);\n \n for (let i = 1; i < stroke.length - 1; i++) {\n const curr = stroke[i];\n const next = stroke[i + 1];\n \n // Calculate control points for smoother curves\n const cpX = curr[0] + (next[0] - curr[0]) * 0.5;\n const cpY = curr[1] + (next[1] - curr[1]) * 0.5;\n \n pathData.push('Q', curr[0], curr[1], cpX, cpY);\n }\n \n // Add final point\n if (stroke.length > 1) {\n const lastPoint = stroke[stroke.length - 1];\n pathData.push('L', lastPoint[0], lastPoint[1]);\n }\n \n return pathData.join(' ');\n}\n\nclass FreehandStroke {\n constructor(points = [], options = {}) {\n this.points = points;\n this.rawPoints = []; \n this.options = {\n stroke: \"#fff\",\n strokeWidth: 3,\n fill: \"none\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n strokeOpacity: 1,\n thinning: 0.5,\n roughness: 0,\n strokeStyle: \"solid\",\n ...options\n };\n this.element = null;\n this.isSelected = false;\n this.rotation = 0;\n this.group = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n this.anchors = [];\n this.rotationAnchor = null;\n this.rotationLine = null;\n this.selectionPadding = 8;\n this.selectionOutline = null;\n this.boundingBox = { x: 0, y: 0, width: 0, height: 0 };\n this.shapeName = \"freehandStroke\";\n this.shapeID = `freehand-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n this.group.setAttribute('id', this.shapeID);\n this._moveOffsetX = 0;\n this._moveOffsetY = 0;\n\n // Frame attachment properties\n this.parentFrame = null;\n \n svg.appendChild(this.group);\n this.draw();\n }\n\n // Add position and dimension properties for frame compatibility\n // Getters include pending move offset so callers see the visual position\n get x() {\n return this.boundingBox.x + (this._moveOffsetX || 0);\n }\n\n set x(value) {\n const dx = value - this.boundingBox.x - (this._moveOffsetX || 0);\n this.points = this.points.map(point => [point[0] + dx, point[1], point[2] || 0.5]);\n this.boundingBox.x = value - (this._moveOffsetX || 0);\n }\n\n get y() {\n return this.boundingBox.y + (this._moveOffsetY || 0);\n }\n\n set y(value) {\n const dy = value - this.boundingBox.y - (this._moveOffsetY || 0);\n this.points = this.points.map(point => [point[0], point[1] + dy, point[2] || 0.5]);\n this.boundingBox.y = value - (this._moveOffsetY || 0);\n }\n \n get width() {\n return this.boundingBox.width;\n }\n \n set width(value) {\n if (this.boundingBox.width === 0) return;\n const scaleX = value / this.boundingBox.width;\n const centerX = this.boundingBox.x + this.boundingBox.width / 2;\n this.points = this.points.map(point => [\n centerX + (point[0] - centerX) * scaleX,\n point[1],\n point[2] || 0.5\n ]);\n this.boundingBox.width = value;\n }\n \n get height() {\n return this.boundingBox.height;\n }\n \n set height(value) {\n if (this.boundingBox.height === 0) return;\n const scaleY = value / this.boundingBox.height;\n const centerY = this.boundingBox.y + this.boundingBox.height / 2;\n this.points = this.points.map(point => [\n point[0],\n centerY + (point[1] - centerY) * scaleY,\n point[2] || 0.5\n ]);\n this.boundingBox.height = value;\n }\n\n // Enhanced smoothing algorithm\n smoothPoints(points, factor = 0.8) {\n if (points.length < 3) return points;\n \n const smoothed = [points[0]]; // Keep first point\n \n for (let i = 1; i < points.length - 1; i++) {\n const prev = points[i - 1];\n const curr = points[i];\n const next = points[i + 1];\n \n // Apply weighted average smoothing\n const smoothedX = curr[0] * (1 - factor) + (prev[0] + next[0]) * factor * 0.5;\n const smoothedY = curr[1] * (1 - factor) + (prev[1] + next[1]) * factor * 0.5;\n const pressure = curr[2] || 0.5;\n \n smoothed.push([smoothedX, smoothedY, pressure]);\n }\n \n smoothed.push(points[points.length - 1]); // Keep last point\n return smoothed;\n }\n\n // Interpolate points for smoother curves\n interpolatePoints(points, steps = 2) {\n if (points.length < 2) return points;\n \n const interpolated = [points[0]];\n \n for (let i = 0; i < points.length - 1; i++) {\n const curr = points[i];\n const next = points[i + 1];\n \n for (let j = 1; j <= steps; j++) {\n const t = j / (steps + 1);\n const x = curr[0] + (next[0] - curr[0]) * t;\n const y = curr[1] + (next[1] - curr[1]) * t;\n const pressure = curr[2] + (next[2] - curr[2]) * t;\n interpolated.push([x, y, pressure]);\n }\n \n if (i < points.length - 2) {\n interpolated.push(next);\n }\n }\n \n interpolated.push(points[points.length - 1]);\n return interpolated;\n }\n\n // Enhanced path generation with better curve fitting\n getPathData() {\n if (this.points.length < 2) return '';\n\n if (this.options.closedFill) {\n const [first, ...rest] = this.points;\n return [`M ${first[0]} ${first[1]}`, ...rest.map(point => `L ${point[0]} ${point[1]}`), 'Z'].join(' ');\n }\n\n const isRough = this.options.roughness === \"rough\";\n const isMedium = this.options.roughness === \"medium\";\n\n // Roughness: jitter points before smoothing\n let pts = this.points;\n if (isRough || isMedium) {\n const jitter = isRough ? 3.5 : 1.5;\n pts = pts.map((p, i) => {\n if (i === 0 || i === pts.length - 1) return p;\n return [\n p[0] + (Math.random() - 0.5) * jitter,\n p[1] + (Math.random() - 0.5) * jitter,\n p[2] || 0.5\n ];\n });\n }\n\n let smoothedPoints = this.interpolatePoints(pts, 1);\n if (!isRough) {\n smoothedPoints = this.smoothPoints(smoothedPoints, 0.6);\n smoothedPoints = this.smoothPoints(smoothedPoints, 0.4);\n }\n\n const thinning = this.options.thinning !== undefined ? this.options.thinning : 0;\n const smoothing = isRough ? 0.3 : isMedium ? 0.6 : 0.9;\n const streamline = isRough ? 0.1 : isMedium ? 0.25 : 0.4;\n\n const stroke = getStroke(smoothedPoints, {\n size: this.options.strokeWidth,\n thinning: thinning,\n smoothing: smoothing,\n streamline: streamline,\n easing: (t) => Math.sin(t * Math.PI * 0.5),\n start: {\n taper: thinning > 0 ? this.options.strokeWidth * 2 : 0,\n easing: (t) => t * t,\n cap: thinning === 0\n },\n end: {\n taper: thinning > 0 ? this.options.strokeWidth * 2 : 0,\n easing: (t) => --t * t * t + 1,\n cap: thinning === 0\n },\n simulatePressure: thinning > 0\n });\n\n return getSvgPathFromStroke(stroke);\n }\n\n // Simple centerline path used for dashed/dotted overlays\n getCenterlinePathData() {\n if (this.points.length < 2) return '';\n const d = [`M ${this.points[0][0]} ${this.points[0][1]}`];\n for (let i = 1; i < this.points.length - 1; i++) {\n const curr = this.points[i];\n const next = this.points[i + 1];\n const cpX = curr[0] + (next[0] - curr[0]) * 0.5;\n const cpY = curr[1] + (next[1] - curr[1]) * 0.5;\n d.push(`Q ${curr[0]} ${curr[1]} ${cpX} ${cpY}`);\n }\n const last = this.points[this.points.length - 1];\n d.push(`L ${last[0]} ${last[1]}`);\n return d.join(' ');\n }\n\n // Calculate the bounding box of the stroke\n calculateBoundingBox() {\n if (this.points.length === 0) {\n return { x: 0, y: 0, width: 0, height: 0 };\n }\n \n let minX = Infinity, minY = Infinity;\n let maxX = -Infinity, maxY = -Infinity;\n \n this.points.forEach(point => {\n minX = Math.min(minX, point[0]);\n minY = Math.min(minY, point[1]);\n maxX = Math.max(maxX, point[0]);\n maxY = Math.max(maxY, point[1]);\n });\n \n // Ensure we have valid dimensions\n if (minX === Infinity || minY === Infinity) {\n return { x: 0, y: 0, width: 0, height: 0 };\n }\n \n // Add padding for stroke width\n const padding = this.options.strokeWidth / 2;\n return {\n x: minX - padding,\n y: minY - padding,\n width: Math.max(0, (maxX - minX) + padding * 2),\n height: Math.max(0, (maxY - minY) + padding * 2)\n };\n }\n\n draw() {\n while (this.group.firstChild) {\n this.group.removeChild(this.group.firstChild);\n }\n\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n this.selectionOutline = null;\n }\n\n // Normal freehand paths use the filled outline from perfect-freehand.\n // Closed-fill paths (pie sectors, polygons) use their actual polygon\n // geometry with a separate outline, preserving sharp radial edges.\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n const pathData = this.getPathData();\n path.setAttribute('d', pathData);\n const closedFillStyle = this.options.fillStyle || 'solid';\n const closedFill = closedFillStyle === 'none'\n ? 'transparent'\n : (this.options.fill || this.options.stroke);\n const patternedFill = this.options.closedFill\n && !['none', 'solid'].includes(closedFillStyle)\n && typeof rough !== 'undefined';\n path.setAttribute('fill', this.options.closedFill\n ? (patternedFill ? 'transparent' : closedFill)\n : this.options.stroke);\n path.setAttribute('fill-opacity', this.options.strokeOpacity);\n path.setAttribute('stroke', this.options.closedFill ? (this.options.outlineStroke || 'none') : 'none');\n if (this.options.closedFill) {\n path.setAttribute('stroke-width', this.options.outlineWidth || this.options.strokeWidth || 1);\n path.setAttribute('stroke-linejoin', 'round');\n path.setAttribute('vector-effect', 'non-scaling-stroke');\n }\n\n // Overlay a dashed/dotted centerline if needed\n if (this.options.strokeStyle === \"dashed\" || this.options.strokeStyle === \"dotted\") {\n const dashArray = this.options.strokeStyle === \"dashed\"\n ? `${this.options.strokeWidth * 3} ${this.options.strokeWidth * 2}`\n : `${this.options.strokeWidth * 0.5} ${this.options.strokeWidth * 2}`;\n const overlay = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n overlay.setAttribute('d', this.getCenterlinePathData());\n overlay.setAttribute('fill', 'none');\n overlay.setAttribute('stroke', this.options.stroke);\n overlay.setAttribute('stroke-width', this.options.strokeWidth);\n overlay.setAttribute('stroke-linecap', 'round');\n overlay.setAttribute('stroke-linejoin', 'round');\n overlay.setAttribute('stroke-dasharray', dashArray);\n overlay.setAttribute('stroke-opacity', this.options.strokeOpacity);\n this.group.appendChild(overlay);\n }\n\n if (patternedFill) {\n const fillGroup = rough.svg(svg).path(pathData, {\n stroke: 'none',\n fill: closedFill,\n fillStyle: closedFillStyle,\n fillWeight: Math.max(1, (this.options.strokeWidth || 2) / 2),\n roughness: 0.8,\n });\n fillGroup.setAttribute('data-freehand-fill-pattern', closedFillStyle);\n this.group.appendChild(fillGroup);\n }\n\n this.element = path;\n this.group.appendChild(path);\n\n // Calculate and store bounding box\n this.boundingBox = this.calculateBoundingBox();\n\n // Apply rotation\n const centerX = this.boundingBox.x + this.boundingBox.width / 2;\n const centerY = this.boundingBox.y + this.boundingBox.height / 2;\n\n // Ensure centerX and centerY are valid numbers\n if (!isNaN(centerX) && !isNaN(centerY)) {\n this.group.setAttribute('transform', `rotate(${this.rotation} ${centerX} ${centerY})`);\n }\n\n if (this.isSelected) {\n this.addAnchors();\n }\n }\n\n move(dx, dy) {\n // Diagram polygons (currently pie sectors) are redrawn by their parent\n // frame after every movement step. Moving them with a deferred SVG\n // transform therefore loses the visible transform on that redraw while\n // leaving a hidden offset behind, which makes sectors detach from the\n // frame and jump the next time they are selected. Keep their geometry\n // authoritative instead.\n if (this.options.closedFill) {\n this.points = this.points.map(point => [\n point[0] + dx,\n point[1] + dy,\n point[2] || 0.5\n ]);\n this._moveOffsetX = 0;\n this._moveOffsetY = 0;\n this.draw();\n return;\n }\n\n // Accumulate offset for transform-based movement (avoids full path rebuild)\n this._moveOffsetX = (this._moveOffsetX || 0) + dx;\n this._moveOffsetY = (this._moveOffsetY || 0) + dy;\n const centerX = this.boundingBox.x + this.boundingBox.width / 2;\n const centerY = this.boundingBox.y + this.boundingBox.height / 2;\n const rot = this.rotation ? `rotate(${this.rotation} ${centerX} ${centerY})` : '';\n this.group.setAttribute('transform', `translate(${this._moveOffsetX}, ${this._moveOffsetY}) ${rot}`);\n }\n\n // Call after drag ends to bake the offset into actual point coordinates\n finalizeMove() {\n if (this._moveOffsetX || this._moveOffsetY) {\n const ox = this._moveOffsetX || 0;\n const oy = this._moveOffsetY || 0;\n this.points = this.points.map(point => [point[0] + ox, point[1] + oy, point[2] || 0.5]);\n this._moveOffsetX = 0;\n this._moveOffsetY = 0;\n this.draw();\n }\n }\n\n updateAttachedArrows() {\n if (typeof window.__updateArrowsForShape === 'function') {\n window.__updateArrowsForShape(this);\n }\n }\n\n selectStroke() {\n this.isSelected = true;\n this.draw();\n // Show sidebar and update it with current stroke properties\n disableAllSideBars();\n paintBrushSideBar.classList.remove(\"hidden\");\n if (window.__showSidebarForShape) window.__showSidebarForShape('freehandStroke');\n this.updateSidebar();\n }\n\n deselectStroke() {\n this.isSelected = false;\n this.anchors = [];\n this.rotationAnchor = null;\n this.draw();\n }\n\n removeSelection() {\n this.anchors.forEach(anchor => {\n if (anchor.parentNode === this.group) {\n this.group.removeChild(anchor);\n }\n });\n if (this.rotationAnchor && this.rotationAnchor.parentNode === this.group) {\n this.group.removeChild(this.rotationAnchor);\n }\n if (this.rotationLine && this.rotationLine.parentNode === this.group) {\n this.group.removeChild(this.rotationLine);\n }\n if (this.selectionOutline && this.selectionOutline.parentNode === this.group) {\n this.group.removeChild(this.selectionOutline);\n }\n this.anchors = [];\n this.rotationAnchor = null;\n this.rotationLine = null;\n this.selectionOutline = null;\n this.isSelected = false;\n }\n\n // No-op: React sidebar handles UI updates via Zustand store\n updateSidebar() {}\n\n contains(x, y) {\n // Account for pending move offset (during drag, points aren't updated yet)\n const ox = this._moveOffsetX || 0;\n const oy = this._moveOffsetY || 0;\n const bbX = this.boundingBox.x + ox;\n const bbY = this.boundingBox.y + oy;\n const centerX = bbX + this.boundingBox.width / 2;\n const centerY = bbY + this.boundingBox.height / 2;\n\n // Adjust for rotation\n const dx = x - centerX;\n const dy = y - centerY;\n\n const angleRad = -this.rotation * Math.PI / 180;\n const rotatedX = dx * Math.cos(angleRad) - dy * Math.sin(angleRad) + centerX;\n const rotatedY = dx * Math.sin(angleRad) + dy * Math.cos(angleRad) + centerY;\n\n if (this.options.closedFill && this.points.length >= 3) {\n const localX = rotatedX - ox;\n const localY = rotatedY - oy;\n let inside = false;\n for (let i = 0, j = this.points.length - 1; i < this.points.length; j = i++) {\n const xi = this.points[i][0], yi = this.points[i][1];\n const xj = this.points[j][0], yj = this.points[j][1];\n const crosses = ((yi > localY) !== (yj > localY))\n && (localX < (xj - xi) * (localY - yi) / ((yj - yi) || Number.EPSILON) + xi);\n if (crosses) inside = !inside;\n }\n return inside;\n }\n\n return rotatedX >= bbX &&\n rotatedX <= bbX + this.boundingBox.width &&\n rotatedY >= bbY &&\n rotatedY <= bbY + this.boundingBox.height;\n }\n\n isNearAnchor(x, y) {\n if (!this.isSelected) return null;\n const buffer = 10;\n const anchorSize = 10 / currentZoom;\n\n // Account for pending move offset\n const ox = this._moveOffsetX || 0;\n const oy = this._moveOffsetY || 0;\n\n // Transform the input coordinates to account for rotation\n const centerX = this.boundingBox.x + ox + this.boundingBox.width / 2;\n const centerY = this.boundingBox.y + oy + this.boundingBox.height / 2;\n\n // Rotate the mouse coordinates to the shape's local coordinate system\n const angleRad = -this.rotation * Math.PI / 180;\n const dx = x - centerX;\n const dy = y - centerY;\n const localX = dx * Math.cos(angleRad) - dy * Math.sin(angleRad) + centerX;\n const localY = dx * Math.sin(angleRad) + dy * Math.cos(angleRad) + centerY;\n\n // Check resize anchors in local space\n const expandedX = this.boundingBox.x + ox - this.selectionPadding;\n const expandedY = this.boundingBox.y + oy - this.selectionPadding;\n const expandedWidth = this.boundingBox.width + 2 * this.selectionPadding;\n const expandedHeight = this.boundingBox.height + 2 * this.selectionPadding;\n \n const anchorPositions = [\n { x: expandedX, y: expandedY }, // top-left\n { x: expandedX + expandedWidth, y: expandedY }, // top-right\n { x: expandedX, y: expandedY + expandedHeight }, // bottom-left\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight }, // bottom-right\n { x: expandedX + expandedWidth / 2, y: expandedY }, // top-center\n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight }, // bottom-center\n { x: expandedX, y: expandedY + expandedHeight / 2 }, // left-center\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight / 2 } // right-center\n ];\n\n for (let i = 0; i < anchorPositions.length; i++) {\n const anchor = anchorPositions[i];\n const distance = Math.sqrt(Math.pow(localX - anchor.x, 2) + Math.pow(localY - anchor.y, 2));\n if (distance <= anchorSize / 2 + buffer) {\n return { type: 'resize', index: i };\n }\n }\n \n // Check rotation anchor (this one stays in world coordinates)\n if (this.rotationAnchor) {\n const rotationX = parseFloat(this.rotationAnchor.getAttribute('cx'));\n const rotationY = parseFloat(this.rotationAnchor.getAttribute('cy'));\n const distance = Math.sqrt(Math.pow(x - rotationX, 2) + Math.pow(y - rotationY, 2));\n if (distance <= anchorSize / 2 + buffer) {\n return { type: 'rotate' };\n }\n }\n \n return null;\n}\n\n rotate(angle) {\n this.rotation = angle;\n // If anchors exist, update their cursors for the new rotation\n if (this.isSelected && this.anchors.length > 0) {\n const cursors = ['nw-resize', 'ne-resize', 'sw-resize', 'se-resize', 'n-resize', 's-resize', 'w-resize', 'e-resize'];\n this.anchors.forEach((anchor, i) => {\n if (anchor) {\n const originalCursor = cursors[i];\n const rotatedCursor = this.getRotatedCursor(originalCursor, this.rotation);\n anchor.style.cursor = rotatedCursor;\n }\n });\n }\n}\n\n addAnchors() {\n const anchorSize = 10 / currentZoom;\n const anchorStrokeWidth = 2 / currentZoom;\n \n const expandedX = this.boundingBox.x - this.selectionPadding;\n const expandedY = this.boundingBox.y - this.selectionPadding;\n const expandedWidth = this.boundingBox.width + 2 * this.selectionPadding;\n const expandedHeight = this.boundingBox.height + 2 * this.selectionPadding;\n \n const positions = [\n { x: expandedX, y: expandedY, cursor: 'nw-resize' }, // top-left\n { x: expandedX + expandedWidth, y: expandedY, cursor: 'ne-resize' }, // top-right\n { x: expandedX, y: expandedY + expandedHeight, cursor: 'sw-resize' }, // bottom-left\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight, cursor: 'se-resize' }, // bottom-right\n { x: expandedX + expandedWidth / 2, y: expandedY, cursor: 'n-resize' }, // top-center\n { x: expandedX + expandedWidth / 2, y: expandedY + expandedHeight, cursor: 's-resize' }, // bottom-center\n { x: expandedX, y: expandedY + expandedHeight / 2, cursor: 'w-resize' }, // left-center\n { x: expandedX + expandedWidth, y: expandedY + expandedHeight / 2, cursor: 'e-resize' } // right-center\n ];\n \n // Create resize anchors\n positions.forEach((pos, i) => {\n const anchor = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n anchor.setAttribute('x', pos.x - anchorSize / 2);\n anchor.setAttribute('y', pos.y - anchorSize / 2);\n anchor.setAttribute('width', anchorSize);\n anchor.setAttribute('height', anchorSize);\n anchor.setAttribute('class', 'anchor');\n anchor.setAttribute('data-index', i);\n anchor.setAttribute('fill', '#121212');\n anchor.setAttribute('stroke', '#5B57D1');\n anchor.setAttribute('stroke-width', anchorStrokeWidth);\n anchor.setAttribute('vector-effect', 'non-scaling-stroke');\n\n // Set proper cursor for each anchor direction, accounting for rotation\n const rotatedCursor = this.getRotatedCursor(pos.cursor, this.rotation);\n anchor.style.cursor = rotatedCursor;\n anchor.style.pointerEvents = 'all';\n \n this.group.appendChild(anchor);\n this.anchors[i] = anchor;\n });\n\n // Create rotation anchor\n const rotationAnchorDistance = 30 / currentZoom;\n const rotationX = expandedX + expandedWidth / 2;\n const rotationY = expandedY - rotationAnchorDistance;\n \n const rotationAnchor = document.createElementNS('http://www.w3.org/2000/svg', 'circle');\n rotationAnchor.setAttribute('cx', rotationX);\n rotationAnchor.setAttribute('cy', rotationY);\n rotationAnchor.setAttribute('r', anchorSize / 2);\n rotationAnchor.setAttribute('fill', '#121212');\n rotationAnchor.setAttribute('stroke', '#5B57D1');\n rotationAnchor.setAttribute('stroke-width', anchorStrokeWidth);\n rotationAnchor.setAttribute('vector-effect', 'non-scaling-stroke');\n rotationAnchor.setAttribute('class', 'rotation-anchor');\n rotationAnchor.style.cursor = 'grab';\n rotationAnchor.style.pointerEvents = 'all';\n \n this.group.appendChild(rotationAnchor);\n registerRotationAnchor(rotationAnchor, { radius: 5, edgeY: expandedY });\n this.rotationAnchor = rotationAnchor;\n\n // Create selection outline\n const outlinePoints = [\n [expandedX, expandedY],\n [expandedX + expandedWidth, expandedY],\n [expandedX + expandedWidth, expandedY + expandedHeight],\n [expandedX, expandedY + expandedHeight],\n [expandedX, expandedY]\n ];\n \n const outline = document.createElementNS('http://www.w3.org/2000/svg', 'polyline');\n outline.setAttribute('points', outlinePoints.map(p => p.join(',')).join(' '));\n outline.setAttribute('fill', 'none');\n outline.setAttribute('stroke', '#5B57D1');\n outline.setAttribute('stroke-width', 1.5);\n outline.setAttribute('vector-effect', 'non-scaling-stroke');\n outline.setAttribute('stroke-dasharray', '4 2');\n outline.setAttribute('style', 'pointer-events: none;');\n this.group.appendChild(outline);\n this.selectionOutline = outline;\n\n // Add line from rotation anchor to shape\n const rotationLine = document.createElementNS('http://www.w3.org/2000/svg', 'line');\n rotationLine.setAttribute('x1', rotationX);\n rotationLine.setAttribute('y1', rotationY);\n rotationLine.setAttribute('x2', expandedX + expandedWidth / 2);\n rotationLine.setAttribute('y2', expandedY);\n rotationLine.setAttribute('stroke', '#5B57D1');\n rotationLine.setAttribute('stroke-width', 1);\n rotationLine.setAttribute('vector-effect', 'non-scaling-stroke');\n rotationLine.setAttribute('stroke-dasharray', '2 2');\n rotationLine.setAttribute('style', 'pointer-events: none;');\n this.group.appendChild(rotationLine);\n this.rotationLine = rotationLine;\n\n // Show sidebar when anchors are added (when shape is selected)\n disableAllSideBars();\n paintBrushSideBar.classList.remove(\"hidden\");\n if (window.__showSidebarForShape) window.__showSidebarForShape('freehandStroke');\n this.updateSidebar();\n}\n\ngetRotatedCursor(direction, angle) {\n // Normalize angle to 0-360\n const normalizedAngle = ((angle % 360) + 360) % 360;\n \n // Map of cursor directions\n const cursors = ['n-resize', 'ne-resize', 'e-resize', 'se-resize', 's-resize', 'sw-resize', 'w-resize', 'nw-resize'];\n const directionMap = {\n 'n-resize': 0,\n 'ne-resize': 1,\n 'e-resize': 2,\n 'se-resize': 3,\n 's-resize': 4,\n 'sw-resize': 5,\n 'w-resize': 6,\n 'nw-resize': 7\n };\n \n if (!(direction in directionMap)) return direction;\n \n // Calculate how many 45-degree increments to rotate\n const rotationSteps = Math.round(normalizedAngle / 45);\n const currentIndex = directionMap[direction];\n const newIndex = (currentIndex + rotationSteps) % 8;\n \n return cursors[newIndex];\n}\n\n updatePosition(anchorIndex, newX, newY) {\n const centerX = this.boundingBox.x + this.boundingBox.width / 2;\n const centerY = this.boundingBox.y + this.boundingBox.height / 2;\n \n // Transform new coordinates to local space (accounting for rotation)\n const angleRad = -this.rotation * Math.PI / 180;\n const dx = newX - centerX;\n const dy = newY - centerY;\n const localX = dx * Math.cos(angleRad) - dy * Math.sin(angleRad) + centerX;\n const localY = dx * Math.sin(angleRad) + dy * Math.cos(angleRad) + centerY;\n \n // Calculate scale factors based on anchor movement in local space\n const expandedX = this.boundingBox.x - this.selectionPadding;\n const expandedY = this.boundingBox.y - this.selectionPadding;\n const expandedWidth = this.boundingBox.width + 2 * this.selectionPadding;\n const expandedHeight = this.boundingBox.height + 2 * this.selectionPadding;\n \n let scaleX = 1, scaleY = 1;\n switch(anchorIndex) {\n case 0: // top-left\n scaleX = (centerX - localX) / (centerX - expandedX);\n scaleY = (centerY - localY) / (centerY - expandedY);\n break;\n case 1: // top-right\n scaleX = (localX - centerX) / (expandedX + expandedWidth - centerX);\n scaleY = (centerY - localY) / (centerY - expandedY);\n break;\n case 2: // bottom-left\n scaleX = (centerX - localX) / (centerX - expandedX);\n scaleY = (localY - centerY) / (expandedY + expandedHeight - centerY);\n break;\n case 3: // bottom-right\n scaleX = (localX - centerX) / (expandedX + expandedWidth - centerX);\n scaleY = (localY - centerY) / (expandedY + expandedHeight - centerY);\n break;\n case 4: // top-center\n scaleY = (centerY - localY) / (centerY - expandedY);\n break;\n case 5: // bottom-center\n scaleY = (localY - centerY) / (expandedY + expandedHeight - centerY);\n break;\n case 6: // left-center\n scaleX = (centerX - localX) / (centerX - expandedX);\n break;\n case 7: // right-center\n scaleX = (localX - centerX) / (expandedX + expandedWidth - centerX);\n break;\n }\n \n // Prevent negative scaling\n scaleX = Math.max(0.1, Math.abs(scaleX));\n scaleY = Math.max(0.1, Math.abs(scaleY));\n \n // Apply scaling to all points relative to center\n this.points = this.points.map(point => {\n const relX = point[0] - centerX;\n const relY = point[1] - centerY;\n return [\n centerX + relX * scaleX,\n centerY + relY * scaleY,\n point[2] || 0.5\n ];\n });\n \n this.draw();\n}\n}\n\nexport { FreehandStroke };\n"],
|
|
5
|
+
"mappings": ";;;;;;AACA,SAAS,iBAAiB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,CAAC;AAED,SAAK,KAAK;AAAA,EACd;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
calculateSnap,
|
|
4
4
|
cleanupAttachments,
|
|
5
5
|
clearSnapGuides
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DWEFPKDO.js";
|
|
7
7
|
import {
|
|
8
8
|
pushCreateAction,
|
|
9
9
|
pushDeleteAction,
|
|
10
10
|
pushFrameAttachmentAction,
|
|
11
11
|
pushOptionsChangeAction,
|
|
12
12
|
pushTransformAction
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-M7GAB24F.js";
|
|
14
14
|
|
|
15
15
|
// src/tools/circleTool.js
|
|
16
16
|
function getThemeStroke() {
|
|
@@ -109,17 +109,8 @@ var handleMouseDown = (e) => {
|
|
|
109
109
|
resizingAnchorIndexCircle = anchorInfo.index;
|
|
110
110
|
} else if (anchorInfo.type === "rotate") {
|
|
111
111
|
isRotatingShapeCircle = true;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const svgPoint = svg.createSVGPoint();
|
|
115
|
-
svgPoint.x = currentShape.x;
|
|
116
|
-
svgPoint.y = currentShape.y;
|
|
117
|
-
const centerSVGPoint = svgPoint.matrixTransform(CTM);
|
|
118
|
-
startRotationMouseAngleCircle = Math.atan2(svgMouseY - centerSVGPoint.y, svgMouseX - centerSVGPoint.x) * (180 / Math.PI);
|
|
119
|
-
startShapeRotationCircle = currentShape.rotation;
|
|
120
|
-
} else {
|
|
121
|
-
isRotatingShapeCircle = false;
|
|
122
|
-
}
|
|
112
|
+
startRotationMouseAngleCircle = Math.atan2(svgMouseY - currentShape.y, svgMouseX - currentShape.x) * (180 / Math.PI);
|
|
113
|
+
startShapeRotationCircle = currentShape.rotation;
|
|
123
114
|
}
|
|
124
115
|
clickedOnShape = true;
|
|
125
116
|
} else if (currentShape.contains(svgMouseX, svgMouseY)) {
|
|
@@ -242,28 +233,18 @@ var handleMouseMove = (e) => {
|
|
|
242
233
|
currentShape.draw();
|
|
243
234
|
currentShape._skipAnchors = false;
|
|
244
235
|
} else if (isRotatingShapeCircle && currentShape && currentShape.isSelected) {
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const currentMouseAngle = Math.atan2(svgMouseY - centerSVGPoint.y, svgMouseX - centerSVGPoint.x) * (180 / Math.PI);
|
|
252
|
-
const angleDiff = currentMouseAngle - startRotationMouseAngleCircle;
|
|
253
|
-
let newRotation = startShapeRotationCircle + angleDiff;
|
|
254
|
-
const snapAngle = 15;
|
|
255
|
-
if (e.shiftKey) {
|
|
256
|
-
newRotation = Math.round(newRotation / snapAngle) * snapAngle;
|
|
257
|
-
}
|
|
258
|
-
currentShape.rotate(newRotation);
|
|
259
|
-
currentShape._skipAnchors = true;
|
|
260
|
-
currentShape.draw();
|
|
261
|
-
currentShape._skipAnchors = false;
|
|
262
|
-
svg.style.cursor = "grabbing";
|
|
263
|
-
} else {
|
|
264
|
-
isRotatingShapeCircle = false;
|
|
265
|
-
svg.style.cursor = "default";
|
|
236
|
+
const currentMouseAngle = Math.atan2(svgMouseY - currentShape.y, svgMouseX - currentShape.x) * (180 / Math.PI);
|
|
237
|
+
const angleDiff = currentMouseAngle - startRotationMouseAngleCircle;
|
|
238
|
+
let newRotation = startShapeRotationCircle + angleDiff;
|
|
239
|
+
const snapAngle = 15;
|
|
240
|
+
if (e.shiftKey) {
|
|
241
|
+
newRotation = Math.round(newRotation / snapAngle) * snapAngle;
|
|
266
242
|
}
|
|
243
|
+
currentShape.rotate(newRotation);
|
|
244
|
+
currentShape._skipAnchors = true;
|
|
245
|
+
currentShape.draw();
|
|
246
|
+
currentShape._skipAnchors = false;
|
|
247
|
+
svg.style.cursor = "grabbing";
|
|
267
248
|
} else if (isSelectionToolActive && !isDrawingCircle && currentShape && currentShape.isSelected) {
|
|
268
249
|
const anchorInfo = currentShape.isNearAnchor(svgMouseX, svgMouseY);
|
|
269
250
|
if (anchorInfo) {
|
|
@@ -569,4 +550,4 @@ export {
|
|
|
569
550
|
handleMouseMove,
|
|
570
551
|
handleMouseUp
|
|
571
552
|
};
|
|
572
|
-
//# sourceMappingURL=chunk-
|
|
553
|
+
//# sourceMappingURL=chunk-OK4ROGMM.js.map
|