@elixpo/lixsketch 5.6.5 → 5.6.7

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.
Files changed (161) hide show
  1. package/dist/mcp/index.js +5 -1
  2. package/dist/mcp/index.js.map +2 -2
  3. package/dist/mcp/stdio.js +5 -1
  4. package/dist/mcp/stdio.js.map +2 -2
  5. package/dist/react/{AIRenderer-SRF7LU5K.js → AIRenderer-R5M2CIDO.js} +13 -6
  6. package/dist/react/AIRenderer-R5M2CIDO.js.map +7 -0
  7. package/dist/react/Circle-HMM5PKJ2.js +10 -0
  8. package/dist/react/{CopyPaste-YUDZ6DHY.js → CopyPaste-PPDS3AD6.js} +11 -10
  9. package/dist/react/{CopyPaste-YUDZ6DHY.js.map → CopyPaste-PPDS3AD6.js.map} +1 -1
  10. package/dist/react/{EventDispatcher-7LAK7GQ7.js → EventDispatcher-UV7LFSAS.js} +216 -63
  11. package/dist/react/EventDispatcher-UV7LFSAS.js.map +7 -0
  12. package/dist/react/Frame-DELCMYV6.js +11 -0
  13. package/dist/react/{FreehandStroke-U6GYZOM4.js → FreehandStroke-WXIJKD5I.js} +2 -2
  14. package/dist/react/{GraphEngine-MM6ALA2N.js → GraphEngine-XH3RPYO4.js} +9 -2
  15. package/dist/react/GraphEngine-XH3RPYO4.js.map +7 -0
  16. package/dist/react/IconShape-PZHMZSLR.js +10 -0
  17. package/dist/react/ImageShape-ZMBZARRI.js +10 -0
  18. package/dist/react/Line-VPVPL6ET.js +10 -0
  19. package/dist/react/{LixScriptParser-JYWJX375.js → LixScriptParser-YS3ZOTGS.js} +6 -2
  20. package/dist/react/LixScriptParser-YS3ZOTGS.js.map +7 -0
  21. package/dist/react/{MermaidFlowchartRenderer-PQEC4TMI.js → MermaidFlowchartRenderer-EL3Q2MNW.js} +6 -2
  22. package/dist/react/MermaidFlowchartRenderer-EL3Q2MNW.js.map +7 -0
  23. package/dist/react/MermaidSequenceParser-DBYXW23P.js +8 -0
  24. package/dist/react/{MermaidSequenceRenderer-KCUHO7UI.js → MermaidSequenceRenderer-K4KHHEVC.js} +10 -3
  25. package/dist/react/MermaidSequenceRenderer-K4KHHEVC.js.map +7 -0
  26. package/dist/react/{MermaidStructuredRenderer-W7UKN7BM.js → MermaidStructuredRenderer-6LN3WISP.js} +7 -2
  27. package/dist/react/MermaidStructuredRenderer-6LN3WISP.js.map +7 -0
  28. package/dist/react/Rectangle-4U4CD2ER.js +10 -0
  29. package/dist/react/{SceneSerializer-SG6SJN5X.js → SceneSerializer-H6KMQCO2.js} +120 -46
  30. package/dist/react/SceneSerializer-H6KMQCO2.js.map +7 -0
  31. package/dist/react/{Selection-2TSH3J6P.js → Selection-CFWRGVKH.js} +4 -4
  32. package/dist/react/{SketchEngine-UD2XV2KT.js → SketchEngine-UFLZJQXS.js} +26 -26
  33. package/dist/react/{UndoRedo-IN4SXDG6.js → UndoRedo-RXO7YHA2.js} +12 -2
  34. package/dist/react/{arrowTool-OYDWJGQK.js → arrowTool-DO327FKU.js} +3 -3
  35. package/dist/react/{chunk-EOURRJ55.js → chunk-2ALS5JGS.js} +2 -2
  36. package/dist/react/{chunk-LJR7EVW2.js → chunk-37PF7FG2.js} +3 -3
  37. package/dist/react/chunk-6AIFXYV6.js +31 -0
  38. package/dist/react/chunk-6AIFXYV6.js.map +7 -0
  39. package/dist/react/{chunk-XOWNCYE4.js → chunk-6LWUR7XB.js} +3 -3
  40. package/dist/react/{chunk-ASBC5G35.js → chunk-7DD2JRBC.js} +2 -2
  41. package/dist/react/{chunk-OP56XPWF.js → chunk-BOZEDUAF.js} +2 -2
  42. package/dist/react/{chunk-RGMDWLRJ.js → chunk-CGMUXYPJ.js} +3 -3
  43. package/dist/react/{chunk-M6TMN76K.js → chunk-DODPOWNX.js} +3 -3
  44. package/dist/react/{chunk-LSHZYN77.js → chunk-GQLXUZHQ.js} +2 -2
  45. package/dist/react/{chunk-7CM5XQDN.js → chunk-I7TVGJFF.js} +20 -36
  46. package/dist/react/chunk-I7TVGJFF.js.map +7 -0
  47. package/dist/react/{chunk-K5RY4EV7.js → chunk-KC26KJW4.js} +26 -17
  48. package/dist/react/chunk-KC26KJW4.js.map +7 -0
  49. package/dist/react/{chunk-XFL4R5ZF.js → chunk-KZBKYHZO.js} +16 -35
  50. package/dist/react/chunk-KZBKYHZO.js.map +7 -0
  51. package/dist/react/{chunk-VQVEPJSA.js → chunk-MHV5P6TS.js} +2 -1
  52. package/dist/react/chunk-MHV5P6TS.js.map +7 -0
  53. package/dist/react/{chunk-PXFPPO3R.js → chunk-NH3NVSWT.js} +18 -2
  54. package/dist/react/chunk-NH3NVSWT.js.map +7 -0
  55. package/dist/react/{chunk-APTOPAOY.js → chunk-O7KXLFZN.js} +3 -3
  56. package/dist/react/{chunk-GQUZPON4.js → chunk-RK3NVAER.js} +4 -4
  57. package/dist/react/{chunk-FETTJLCV.js → chunk-VZPH7OAM.js} +14 -22
  58. package/dist/react/chunk-VZPH7OAM.js.map +7 -0
  59. package/dist/react/{chunk-6GPEWDRB.js → chunk-VZX55VQL.js} +115 -6
  60. package/dist/react/chunk-VZX55VQL.js.map +7 -0
  61. package/dist/react/{chunk-TKXKJNTX.js → chunk-W7XUY4GR.js} +16 -19
  62. package/dist/react/chunk-W7XUY4GR.js.map +7 -0
  63. package/dist/react/{chunk-XYUFEIZR.js → chunk-X5ENBMGL.js} +2 -2
  64. package/dist/react/{chunk-K5BG5MHY.js → chunk-ZNZAICWY.js} +36 -60
  65. package/dist/react/chunk-ZNZAICWY.js.map +7 -0
  66. package/dist/react/{circleTool-LDKGZALF.js → circleTool-NK4RVDAR.js} +4 -4
  67. package/dist/react/{codeTool-4YZO5W7J.js → codeTool-3WF4HEOW.js} +4 -4
  68. package/dist/react/{frameTool-MXNJEXQQ.js → frameTool-VCNV2NG2.js} +4 -4
  69. package/dist/react/{freehandTool-26D3FOOX.js → freehandTool-TBAOD46K.js} +4 -4
  70. package/dist/react/{iconTool-46O5VEUX.js → iconTool-65JCAKYF.js} +4 -4
  71. package/dist/react/{imageTool-P2RWZRHO.js → imageTool-UQZUBOK2.js} +4 -4
  72. package/dist/react/index.js +148 -37
  73. package/dist/react/index.js.map +4 -4
  74. package/dist/react/{lineTool-ZMR27U5L.js → lineTool-762KBYOM.js} +4 -4
  75. package/dist/react/{rectangleTool-EJKK6UTX.js → rectangleTool-IQK3HZK6.js} +4 -4
  76. package/dist/react/{textTool-S4XXZHZH.js → textTool-ITG2SBJK.js} +5 -5
  77. package/package.json +5 -2
  78. package/src/core/AIRenderer.js +8 -2
  79. package/src/core/CanvasSpace.js +28 -0
  80. package/src/core/GraphRenderer.js +8 -3
  81. package/src/core/LixScriptParser.js +7 -1
  82. package/src/core/MermaidFlowchartRenderer.js +5 -1
  83. package/src/core/MermaidSequenceParser.js +1 -0
  84. package/src/core/MermaidSequenceRenderer.js +8 -3
  85. package/src/core/MermaidStructuredRenderer.js +6 -1
  86. package/src/core/SceneSerializer.js +121 -38
  87. package/src/core/Selection.js +29 -14
  88. package/src/core/UndoRedo.js +126 -5
  89. package/src/react/components/AppMenu.jsx +20 -19
  90. package/src/react/components/canvas/CanvasRulers.jsx +8 -13
  91. package/src/react/components/canvas/SVGCanvas.jsx +2 -1
  92. package/src/react/components/canvas/rulerUnits.js +28 -0
  93. package/src/react/components/sidebars/PaintBucketSidebar.jsx +1 -1
  94. package/src/react/store/useSketchStore.js +24 -3
  95. package/src/react/store/useUIStore.js +24 -1
  96. package/src/react/utils/canvasBackgrounds.js +29 -0
  97. package/src/shapes/Circle.js +12 -19
  98. package/src/shapes/Frame.js +38 -69
  99. package/src/shapes/FreehandStroke.js +24 -1
  100. package/src/shapes/Rectangle.js +10 -22
  101. package/src/tools/circleTool.js +3 -27
  102. package/src/tools/paintBucketTool.js +72 -15
  103. package/src/tools/rectangleTool.js +7 -23
  104. package/src/tools/shapeRecognition.js +270 -0
  105. package/src/tools/shapeRecognitionTool.js +36 -183
  106. package/dist/react/AIRenderer-SRF7LU5K.js.map +0 -7
  107. package/dist/react/Circle-6POZCUZD.js +0 -9
  108. package/dist/react/EventDispatcher-7LAK7GQ7.js.map +0 -7
  109. package/dist/react/Frame-7D2MXCFF.js +0 -11
  110. package/dist/react/GraphEngine-MM6ALA2N.js.map +0 -7
  111. package/dist/react/IconShape-ZADX7Y33.js +0 -10
  112. package/dist/react/ImageShape-UJQN2HI7.js +0 -10
  113. package/dist/react/Line-APEULMHE.js +0 -10
  114. package/dist/react/LixScriptParser-JYWJX375.js.map +0 -7
  115. package/dist/react/MermaidFlowchartRenderer-PQEC4TMI.js.map +0 -7
  116. package/dist/react/MermaidSequenceParser-UKG2NSZY.js +0 -8
  117. package/dist/react/MermaidSequenceRenderer-KCUHO7UI.js.map +0 -7
  118. package/dist/react/MermaidStructuredRenderer-W7UKN7BM.js.map +0 -7
  119. package/dist/react/Rectangle-S7XUKWYD.js +0 -9
  120. package/dist/react/SceneSerializer-SG6SJN5X.js.map +0 -7
  121. package/dist/react/chunk-6GPEWDRB.js.map +0 -7
  122. package/dist/react/chunk-7CM5XQDN.js.map +0 -7
  123. package/dist/react/chunk-FETTJLCV.js.map +0 -7
  124. package/dist/react/chunk-K5BG5MHY.js.map +0 -7
  125. package/dist/react/chunk-K5RY4EV7.js.map +0 -7
  126. package/dist/react/chunk-PXFPPO3R.js.map +0 -7
  127. package/dist/react/chunk-TKXKJNTX.js.map +0 -7
  128. package/dist/react/chunk-VQVEPJSA.js.map +0 -7
  129. package/dist/react/chunk-XFL4R5ZF.js.map +0 -7
  130. /package/dist/react/{Circle-6POZCUZD.js.map → Circle-HMM5PKJ2.js.map} +0 -0
  131. /package/dist/react/{Frame-7D2MXCFF.js.map → Frame-DELCMYV6.js.map} +0 -0
  132. /package/dist/react/{FreehandStroke-U6GYZOM4.js.map → FreehandStroke-WXIJKD5I.js.map} +0 -0
  133. /package/dist/react/{IconShape-ZADX7Y33.js.map → IconShape-PZHMZSLR.js.map} +0 -0
  134. /package/dist/react/{ImageShape-UJQN2HI7.js.map → ImageShape-ZMBZARRI.js.map} +0 -0
  135. /package/dist/react/{Line-APEULMHE.js.map → Line-VPVPL6ET.js.map} +0 -0
  136. /package/dist/react/{MermaidSequenceParser-UKG2NSZY.js.map → MermaidSequenceParser-DBYXW23P.js.map} +0 -0
  137. /package/dist/react/{Rectangle-S7XUKWYD.js.map → Rectangle-4U4CD2ER.js.map} +0 -0
  138. /package/dist/react/{Selection-2TSH3J6P.js.map → Selection-CFWRGVKH.js.map} +0 -0
  139. /package/dist/react/{SketchEngine-UD2XV2KT.js.map → SketchEngine-UFLZJQXS.js.map} +0 -0
  140. /package/dist/react/{UndoRedo-IN4SXDG6.js.map → UndoRedo-RXO7YHA2.js.map} +0 -0
  141. /package/dist/react/{arrowTool-OYDWJGQK.js.map → arrowTool-DO327FKU.js.map} +0 -0
  142. /package/dist/react/{chunk-EOURRJ55.js.map → chunk-2ALS5JGS.js.map} +0 -0
  143. /package/dist/react/{chunk-LJR7EVW2.js.map → chunk-37PF7FG2.js.map} +0 -0
  144. /package/dist/react/{chunk-XOWNCYE4.js.map → chunk-6LWUR7XB.js.map} +0 -0
  145. /package/dist/react/{chunk-ASBC5G35.js.map → chunk-7DD2JRBC.js.map} +0 -0
  146. /package/dist/react/{chunk-OP56XPWF.js.map → chunk-BOZEDUAF.js.map} +0 -0
  147. /package/dist/react/{chunk-RGMDWLRJ.js.map → chunk-CGMUXYPJ.js.map} +0 -0
  148. /package/dist/react/{chunk-M6TMN76K.js.map → chunk-DODPOWNX.js.map} +0 -0
  149. /package/dist/react/{chunk-LSHZYN77.js.map → chunk-GQLXUZHQ.js.map} +0 -0
  150. /package/dist/react/{chunk-APTOPAOY.js.map → chunk-O7KXLFZN.js.map} +0 -0
  151. /package/dist/react/{chunk-GQUZPON4.js.map → chunk-RK3NVAER.js.map} +0 -0
  152. /package/dist/react/{chunk-XYUFEIZR.js.map → chunk-X5ENBMGL.js.map} +0 -0
  153. /package/dist/react/{circleTool-LDKGZALF.js.map → circleTool-NK4RVDAR.js.map} +0 -0
  154. /package/dist/react/{codeTool-4YZO5W7J.js.map → codeTool-3WF4HEOW.js.map} +0 -0
  155. /package/dist/react/{frameTool-MXNJEXQQ.js.map → frameTool-VCNV2NG2.js.map} +0 -0
  156. /package/dist/react/{freehandTool-26D3FOOX.js.map → freehandTool-TBAOD46K.js.map} +0 -0
  157. /package/dist/react/{iconTool-46O5VEUX.js.map → iconTool-65JCAKYF.js.map} +0 -0
  158. /package/dist/react/{imageTool-P2RWZRHO.js.map → imageTool-UQZUBOK2.js.map} +0 -0
  159. /package/dist/react/{lineTool-ZMR27U5L.js.map → lineTool-762KBYOM.js.map} +0 -0
  160. /package/dist/react/{rectangleTool-EJKK6UTX.js.map → rectangleTool-IQK3HZK6.js.map} +0 -0
  161. /package/dist/react/{textTool-S4XXZHZH.js.map → textTool-ITG2SBJK.js.map} +0 -0
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ // src/core/CanvasSpace.js
4
+ function localToCanvas(point, transform) {
5
+ const rotation = (Number(transform.rotation) || 0) * Math.PI / 180;
6
+ const centerX = Number(transform.centerX) || 0;
7
+ const centerY = Number(transform.centerY) || 0;
8
+ const dx = point.x - centerX;
9
+ const dy = point.y - centerY;
10
+ return {
11
+ x: (Number(transform.x) || 0) + centerX + dx * Math.cos(rotation) - dy * Math.sin(rotation),
12
+ y: (Number(transform.y) || 0) + centerY + dx * Math.sin(rotation) + dy * Math.cos(rotation)
13
+ };
14
+ }
15
+ function canvasToLocal(point, transform) {
16
+ const rotation = -(Number(transform.rotation) || 0) * Math.PI / 180;
17
+ const centerX = Number(transform.centerX) || 0;
18
+ const centerY = Number(transform.centerY) || 0;
19
+ const dx = point.x - (Number(transform.x) || 0) - centerX;
20
+ const dy = point.y - (Number(transform.y) || 0) - centerY;
21
+ return {
22
+ x: centerX + dx * Math.cos(rotation) - dy * Math.sin(rotation),
23
+ y: centerY + dx * Math.sin(rotation) + dy * Math.cos(rotation)
24
+ };
25
+ }
26
+
27
+ export {
28
+ localToCanvas,
29
+ canvasToLocal
30
+ };
31
+ //# sourceMappingURL=chunk-6AIFXYV6.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/core/CanvasSpace.js"],
4
+ "sourcesContent": ["/* eslint-disable */\n\n// Tool pointer coordinates are already in SVG viewBox space. getCTM() also\n// includes viewport pan/zoom, so controls use these helpers for shape-only\n// translation and rotation.\nexport function localToCanvas(point, transform) {\n const rotation = (Number(transform.rotation) || 0) * Math.PI / 180;\n const centerX = Number(transform.centerX) || 0;\n const centerY = Number(transform.centerY) || 0;\n const dx = point.x - centerX;\n const dy = point.y - centerY;\n return {\n x: (Number(transform.x) || 0) + centerX + dx * Math.cos(rotation) - dy * Math.sin(rotation),\n y: (Number(transform.y) || 0) + centerY + dx * Math.sin(rotation) + dy * Math.cos(rotation),\n };\n}\n\nexport function canvasToLocal(point, transform) {\n const rotation = -(Number(transform.rotation) || 0) * Math.PI / 180;\n const centerX = Number(transform.centerX) || 0;\n const centerY = Number(transform.centerY) || 0;\n const dx = point.x - (Number(transform.x) || 0) - centerX;\n const dy = point.y - (Number(transform.y) || 0) - centerY;\n return {\n x: centerX + dx * Math.cos(rotation) - dy * Math.sin(rotation),\n y: centerY + dx * Math.sin(rotation) + dy * Math.cos(rotation),\n };\n}\n"],
5
+ "mappings": ";;;AAKO,SAAS,cAAc,OAAO,WAAW;AAC5C,QAAM,YAAY,OAAO,UAAU,QAAQ,KAAK,KAAK,KAAK,KAAK;AAC/D,QAAM,UAAU,OAAO,UAAU,OAAO,KAAK;AAC7C,QAAM,UAAU,OAAO,UAAU,OAAO,KAAK;AAC7C,QAAM,KAAK,MAAM,IAAI;AACrB,QAAM,KAAK,MAAM,IAAI;AACrB,SAAO;AAAA,IACH,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,UAAU,KAAK,KAAK,IAAI,QAAQ,IAAI,KAAK,KAAK,IAAI,QAAQ;AAAA,IAC1F,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,UAAU,KAAK,KAAK,IAAI,QAAQ,IAAI,KAAK,KAAK,IAAI,QAAQ;AAAA,EAC9F;AACJ;AAEO,SAAS,cAAc,OAAO,WAAW;AAC5C,QAAM,WAAW,EAAE,OAAO,UAAU,QAAQ,KAAK,KAAK,KAAK,KAAK;AAChE,QAAM,UAAU,OAAO,UAAU,OAAO,KAAK;AAC7C,QAAM,UAAU,OAAO,UAAU,OAAO,KAAK;AAC7C,QAAM,KAAK,MAAM,KAAK,OAAO,UAAU,CAAC,KAAK,KAAK;AAClD,QAAM,KAAK,MAAM,KAAK,OAAO,UAAU,CAAC,KAAK,KAAK;AAClD,SAAO;AAAA,IACH,GAAG,UAAU,KAAK,KAAK,IAAI,QAAQ,IAAI,KAAK,KAAK,IAAI,QAAQ;AAAA,IAC7D,GAAG,UAAU,KAAK,KAAK,IAAI,QAAQ,IAAI,KAAK,KAAK,IAAI,QAAQ;AAAA,EACjE;AACJ;",
6
+ "names": []
7
+ }
@@ -3,14 +3,14 @@ import {
3
3
  calculateSnap,
4
4
  clearSnapGuides,
5
5
  updateAttachedArrows
6
- } from "./chunk-XYUFEIZR.js";
6
+ } from "./chunk-X5ENBMGL.js";
7
7
  import {
8
8
  pushCreateAction,
9
9
  pushDeleteAction,
10
10
  pushFrameAttachmentAction,
11
11
  pushOptionsChangeAction,
12
12
  pushTransformAction
13
- } from "./chunk-6GPEWDRB.js";
13
+ } from "./chunk-VZX55VQL.js";
14
14
 
15
15
  // src/tools/freehandTool.js
16
16
  function getThemeStroke() {
@@ -561,4 +561,4 @@ export {
561
561
  handleMouseMove,
562
562
  handleMouseUp
563
563
  };
564
- //# sourceMappingURL=chunk-XOWNCYE4.js.map
564
+ //# sourceMappingURL=chunk-6LWUR7XB.js.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  updateAttachedArrows
4
- } from "./chunk-XYUFEIZR.js";
4
+ } from "./chunk-X5ENBMGL.js";
5
5
 
6
6
  // src/shapes/ImageShape.js
7
7
  var isDragging = false;
@@ -312,4 +312,4 @@ var ImageShape = class {
312
312
  export {
313
313
  ImageShape
314
314
  };
315
- //# sourceMappingURL=chunk-ASBC5G35.js.map
315
+ //# sourceMappingURL=chunk-7DD2JRBC.js.map
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  updateAttachedArrows
4
- } from "./chunk-XYUFEIZR.js";
4
+ } from "./chunk-X5ENBMGL.js";
5
5
 
6
6
  // src/shapes/Line.js
7
7
  var rc = rough.svg(svg);
@@ -625,4 +625,4 @@ var Line = class {
625
625
  export {
626
626
  Line
627
627
  };
628
- //# sourceMappingURL=chunk-OP56XPWF.js.map
628
+ //# sourceMappingURL=chunk-BOZEDUAF.js.map
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  calculateSnap,
4
4
  clearSnapGuides
5
- } from "./chunk-XYUFEIZR.js";
5
+ } from "./chunk-X5ENBMGL.js";
6
6
  import {
7
7
  pushCreateAction,
8
8
  pushDeleteAction,
9
9
  pushFrameAttachmentAction,
10
10
  pushOptionsChangeAction,
11
11
  pushTransformAction
12
- } from "./chunk-6GPEWDRB.js";
12
+ } from "./chunk-VZX55VQL.js";
13
13
 
14
14
  // src/tools/lineTool.js
15
15
  function getThemeStroke() {
@@ -450,4 +450,4 @@ export {
450
450
  handleMouseMove,
451
451
  handleMouseUp
452
452
  };
453
- //# sourceMappingURL=chunk-RGMDWLRJ.js.map
453
+ //# sourceMappingURL=chunk-CGMUXYPJ.js.map
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  cleanupAttachments,
7
7
  updateAttachedArrows
8
- } from "./chunk-XYUFEIZR.js";
8
+ } from "./chunk-X5ENBMGL.js";
9
9
  import {
10
10
  pushCreateAction,
11
11
  pushDeleteActionWithAttachments,
@@ -14,7 +14,7 @@ import {
14
14
  pushTransformAction,
15
15
  setTextReferences,
16
16
  updateSelectedElement
17
- } from "./chunk-6GPEWDRB.js";
17
+ } from "./chunk-VZX55VQL.js";
18
18
 
19
19
  // src/tools/codeTool.js
20
20
  function getThemeStroke() {
@@ -1601,4 +1601,4 @@ export {
1601
1601
  getCodeLanguage,
1602
1602
  getSelectedCodeBlock
1603
1603
  };
1604
- //# sourceMappingURL=chunk-M6TMN76K.js.map
1604
+ //# sourceMappingURL=chunk-DODPOWNX.js.map
@@ -4,7 +4,7 @@ import {
4
4
  pushDeleteAction,
5
5
  pushFrameAttachmentAction,
6
6
  pushTransformAction
7
- } from "./chunk-6GPEWDRB.js";
7
+ } from "./chunk-VZX55VQL.js";
8
8
 
9
9
  // src/tools/frameTool.js
10
10
  var currentFrame = null;
@@ -241,4 +241,4 @@ export {
241
241
  handleMouseMove,
242
242
  handleMouseUp
243
243
  };
244
- //# sourceMappingURL=chunk-LSHZYN77.js.map
244
+ //# sourceMappingURL=chunk-GQLXUZHQ.js.map
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  calculateSnap,
4
4
  clearSnapGuides
5
- } from "./chunk-XYUFEIZR.js";
5
+ } from "./chunk-X5ENBMGL.js";
6
6
  import {
7
7
  pushCreateAction,
8
8
  pushFrameAttachmentAction,
9
9
  pushOptionsChangeAction,
10
10
  pushTransformAction
11
- } from "./chunk-6GPEWDRB.js";
11
+ } from "./chunk-VZX55VQL.js";
12
12
 
13
13
  // src/tools/rectangleTool.js
14
14
  var isDrawingSquare = false;
@@ -84,18 +84,10 @@ var handleMouseDownRect = (e) => {
84
84
  resizingAnchorIndexSquare = anchorInfo.index;
85
85
  } else if (anchorInfo.type === "rotate") {
86
86
  isRotatingShapeSquare = true;
87
- const CTM = currentShape.group.getCTM();
88
- if (CTM) {
89
- const svgPoint = svg.createSVGPoint();
90
- svgPoint.x = currentShape.width / 2;
91
- svgPoint.y = currentShape.height / 2;
92
- const centerSVG = svgPoint.matrixTransform(CTM);
93
- startRotationMouseAngleSquare = Math.atan2(mouseY - centerSVG.y, mouseX - centerSVG.x) * 180 / Math.PI;
94
- startShapeRotationSquare = currentShape.rotation;
95
- } else {
96
- isRotatingShapeSquare = false;
97
- console.warn("Could not get CTM for rotation.");
98
- }
87
+ const centerX = currentShape.x + currentShape.width / 2;
88
+ const centerY = currentShape.y + currentShape.height / 2;
89
+ startRotationMouseAngleSquare = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;
90
+ startShapeRotationSquare = currentShape.rotation;
99
91
  }
100
92
  clickedOnShape = true;
101
93
  } else if (currentShape.contains(mouseX, mouseY)) {
@@ -218,28 +210,20 @@ var handleMouseMoveRect = (e) => {
218
210
  currentShape.draw();
219
211
  currentShape._skipAnchors = false;
220
212
  } else if (isRotatingShapeSquare && currentShape && currentShape.isSelected) {
221
- const CTM = currentShape.group.getCTM();
222
- if (CTM) {
223
- const svgPoint = svg.createSVGPoint();
224
- svgPoint.x = currentShape.width / 2;
225
- svgPoint.y = currentShape.height / 2;
226
- const centerSVG = svgPoint.matrixTransform(CTM);
227
- const currentRotationMouseAngle = Math.atan2(mouseY - centerSVG.y, mouseX - centerSVG.x) * 180 / Math.PI;
228
- const angleDiff = currentRotationMouseAngle - startRotationMouseAngleSquare;
229
- let newRotation = startShapeRotationSquare + angleDiff;
230
- const snapAngle = 15;
231
- if (e.shiftKey) {
232
- newRotation = Math.round(newRotation / snapAngle) * snapAngle;
233
- }
234
- currentShape.rotate(newRotation);
235
- currentShape._skipAnchors = true;
236
- currentShape.draw();
237
- currentShape._skipAnchors = false;
238
- svg.style.cursor = "grabbing";
239
- } else {
240
- isRotatingShapeSquare = false;
241
- svg.style.cursor = "default";
213
+ const centerX = currentShape.x + currentShape.width / 2;
214
+ const centerY = currentShape.y + currentShape.height / 2;
215
+ const currentRotationMouseAngle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;
216
+ const angleDiff = currentRotationMouseAngle - startRotationMouseAngleSquare;
217
+ let newRotation = startShapeRotationSquare + angleDiff;
218
+ const snapAngle = 15;
219
+ if (e.shiftKey) {
220
+ newRotation = Math.round(newRotation / snapAngle) * snapAngle;
242
221
  }
222
+ currentShape.rotate(newRotation);
223
+ currentShape._skipAnchors = true;
224
+ currentShape.draw();
225
+ currentShape._skipAnchors = false;
226
+ svg.style.cursor = "grabbing";
243
227
  } else if (isSelectionToolActive && !isDrawingSquare && currentShape && currentShape.isSelected) {
244
228
  const anchorInfo = currentShape.isNearAnchor(mouseX, mouseY);
245
229
  if (anchorInfo) {
@@ -516,4 +500,4 @@ export {
516
500
  handleMouseMoveRect,
517
501
  handleMouseUpRect
518
502
  };
519
- //# sourceMappingURL=chunk-7CM5XQDN.js.map
503
+ //# sourceMappingURL=chunk-I7TVGJFF.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/tools/rectangleTool.js"],
4
+ "sourcesContent": ["/* eslint-disable */\n// Rectangle tool event handlers - extracted from drawSquare.js\n// Depends on globals: svg, shapes, currentShape, rough, currentZoom, lastMousePos\n// Depends on globals: isSquareToolActive, isSelectionToolActive\n// Depends on globals: squareSideBar, disableAllSideBars\nimport { pushCreateAction, pushDeleteAction, pushOptionsChangeAction, pushTransformAction, pushFrameAttachmentAction } from '../core/UndoRedo.js';\nimport { cleanupAttachments } from './arrowTool.js';\nimport { calculateSnap, clearSnapGuides } from '../core/SnapGuides.js';\n\nlet isDrawingSquare = false;\nlet isDraggingShapeSquare = false;\nlet isResizingShapeSquare = false;\nlet isRotatingShapeSquare = false;\nlet resizingAnchorIndexSquare = null;\nlet startRotationMouseAngleSquare = 0;\nlet startShapeRotationSquare = 0;\nconst rc = rough.svg(svg); \nlet startX, startY;\n// Issue #38 follow-up: null sentinel means \"use theme default at draw\n// time\". The legacy `\"#fff\"` literal was invisible on the light canvas;\n// reading the body's `theme-dark` class lets the same code produce a\n// readable stroke in either mode. As soon as the user picks a colour\n// from the sidebar this var holds that value verbatim.\nfunction getThemeStroke() {\n if (typeof document === 'undefined') return '#fff';\n return document.body && document.body.classList.contains('theme-dark') ? '#fff' : '#1a1a2e';\n}\nlet squareStrokecolor = null;\nlet squareBackgroundColor = \"transparent\";\nlet squareFillStyleValue = \"none\";\nlet squareStrokeThicknes = 2;\nlet squareOutlineStyle = \"solid\";\nlet dragOldPosSquare = null;\nlet draggedShapeInitialFrame = null;\nlet hoveredFrame = null;\n\nlet SquarecolorOptions = document.querySelectorAll(\".squareStrokeSpan\");\nlet backgroundColorOptionsSquare = document.querySelectorAll(\".squareBackgroundSpan\");\nlet fillStyleOptions = document.querySelectorAll(\".squareFillStyleSpan\");\nlet squareStrokeThicknessValue = document.querySelectorAll(\".squareStrokeThickSpan\");\nlet squareOutlineStyleValue = document.querySelectorAll(\".squareOutlineStyle\");\n\n\n\nfunction getSVGCoordsFromMouse(e) {\n // Use the SVG's current viewBox to map mouse to SVG coordinates\n const viewBox = svg.viewBox.baseVal;\n const rect = svg.getBoundingClientRect();\n const mouseX = e.clientX - rect.left;\n const mouseY = e.clientY - rect.top;\n const svgX = viewBox.x + (mouseX / rect.width) * viewBox.width;\n const svgY = viewBox.y + (mouseY / rect.height) * viewBox.height;\n return { x: svgX, y: svgY };\n}\n\nfunction deleteCurrentShape() {\n if (currentShape && currentShape.shapeName === 'rectangle') {\n const idx = shapes.indexOf(currentShape);\n if (idx !== -1) shapes.splice(idx, 1);\n \n // Clean up any arrow attachments before deleting\n cleanupAttachments(currentShape);\n \n if (currentShape.group.parentNode) {\n currentShape.group.parentNode.removeChild(currentShape.group);\n }\n pushDeleteAction(currentShape);\n currentShape = null;\n disableAllSideBars();\n }\n}\n\n// --- Main event handlers ---\nconst handleMouseDownRect = (e) => {\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(e);\n if (isSquareToolActive) {\n startX = mouseX;\n startY = mouseY;\n isDrawingSquare = true;\n\n if (currentShape) {\n currentShape.removeSelection();\n currentShape = null;\n disableAllSideBars();\n }\n\n let initialOptions = {\n stroke: squareStrokecolor ?? getThemeStroke(),\n fill: squareBackgroundColor,\n fillStyle: squareFillStyleValue,\n strokeWidth: squareStrokeThicknes,\n };\n if (squareOutlineStyle === \"dashed\") {\n initialOptions.strokeDasharray = \"10,10\";\n } else if (squareOutlineStyle === \"dotted\") {\n initialOptions.strokeDasharray = \"2,8\";\n } else {\n initialOptions.strokeDasharray = \"\";\n }\n\n currentShape = new Rectangle(startX, startY, 0, 0, initialOptions);\n currentShape.setDrawingState(true);\n\n } else if (isSelectionToolActive) {\n let clickedOnShape = false;\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n const anchorInfo = currentShape.isNearAnchor(mouseX, mouseY);\n if (anchorInfo) {\n dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };\n if (anchorInfo.type === 'resize') {\n isResizingShapeSquare = true;\n resizingAnchorIndexSquare = anchorInfo.index;\n } else if (anchorInfo.type === 'rotate') {\n isRotatingShapeSquare = true;\n\n const centerX = currentShape.x + currentShape.width / 2;\n const centerY = currentShape.y + currentShape.height / 2;\n startRotationMouseAngleSquare = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;\n startShapeRotationSquare = currentShape.rotation;\n }\n clickedOnShape = true;\n } else if (currentShape.contains(mouseX, mouseY)) {\n isDraggingShapeSquare = true;\n dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };\n \n // Store initial frame state\n draggedShapeInitialFrame = currentShape.parentFrame || null;\n \n // Temporarily remove from frame clipping if dragging\n if (currentShape.parentFrame) {\n currentShape.parentFrame.temporarilyRemoveFromFrame(currentShape);\n }\n \n startX = mouseX; \n startY = mouseY;\n clickedOnShape = true;\n }\n }\n\n if (!clickedOnShape) {\n let shapeToSelect = null;\n for (let i = shapes.length - 1; i >= 0; i--) {\n const shape = shapes[i];\n if (shape.shapeName === 'rectangle' && shape.contains(mouseX, mouseY)) {\n shapeToSelect = shape;\n break; \n }\n }\n if (currentShape && currentShape !== shapeToSelect) {\n currentShape.removeSelection();\n currentShape = null;\n disableAllSideBars();\n }\n if (shapeToSelect) {\n currentShape = shapeToSelect;\n currentShape.isSelected = true;\n currentShape.draw(); \n isDraggingShapeSquare = true; \n dragOldPosSquare = { x: currentShape.x, y: currentShape.y, width: currentShape.width, height: currentShape.height, rotation: currentShape.rotation };\n \n // Store initial frame state\n draggedShapeInitialFrame = currentShape.parentFrame || null;\n \n // Temporarily remove from frame clipping if dragging\n if (currentShape.parentFrame) {\n currentShape.parentFrame.temporarilyRemoveFromFrame(currentShape);\n }\n \n startX = mouseX; \n startY = mouseY;\n clickedOnShape = true; \n }\n }\n if (!clickedOnShape && currentShape) {\n currentShape.removeSelection();\n currentShape = null;\n disableAllSideBars();\n }\n }\n};\n\n\nconst handleMouseMoveRect = (e) => {\n const { x: mouseX, y: mouseY } = getSVGCoordsFromMouse(e);\n const svgRect = svg.getBoundingClientRect();\n lastMousePos = {\n x: e.clientX - svgRect.left, \n y: e.clientY - svgRect.top\n };\n\n if (isDrawingSquare && isSquareToolActive && currentShape) {\n let width = mouseX - startX;\n let height = mouseY - startY;\n currentShape.x = width < 0 ? startX + width : startX;\n currentShape.y = height < 0 ? startY + height : startY;\n currentShape.width = Math.abs(width);\n currentShape.height = Math.abs(height);\n \n // Force update the element size while drawing (but use cached rough element)\n if (currentShape.element && currentShape.width > 0 && currentShape.height > 0) {\n // Remove old element\n if (currentShape.element.parentNode === currentShape.group) {\n currentShape.group.removeChild(currentShape.element);\n }\n \n // Create new rough element with current size\n const roughRect = rc.rectangle(0, 0, currentShape.width, currentShape.height, currentShape.options);\n currentShape.element = roughRect;\n currentShape.group.appendChild(roughRect);\n }\n \n // Update transform\n const rotateCenterX = currentShape.width / 2;\n const rotateCenterY = currentShape.height / 2;\n currentShape.group.setAttribute('transform', `translate(${currentShape.x}, ${currentShape.y}) rotate(${currentShape.rotation}, ${rotateCenterX}, ${rotateCenterY})`);\n \n // Check for frame containment while drawing\n shapes.forEach(frame => {\n if (frame.shapeName === 'frame') {\n if (frame.isShapeInFrame(currentShape)) {\n frame.highlightFrame();\n hoveredFrame = frame;\n } else if (hoveredFrame === frame) {\n frame.removeHighlight();\n hoveredFrame = null;\n }\n }\n });\n \n } else if (isDraggingShapeSquare && currentShape && currentShape.isSelected) {\n let dx = mouseX - startX;\n let dy = mouseY - startY;\n currentShape.move(dx, dy);\n startX = mouseX;\n startY = mouseY;\n // Snap guides\n if (window.__sketchStoreApi && window.__sketchStoreApi.getState().snapToObjects) {\n const snap = calculateSnap(currentShape, e.shiftKey, e.clientX, e.clientY);\n if (snap.dx || snap.dy) {\n currentShape.move(snap.dx, snap.dy);\n }\n } else {\n clearSnapGuides();\n }\n\n // Issue #24 bug #4: track the actual containing frame at every\n // move so the mouseUp logic re-parents correctly. Without this\n // hoveredFrame stays at null for existing-shape drags and the\n // shape is detached the moment the user nudges it by 1 px inside\n // its own parent frame.\n let newHover = null;\n for (const f of shapes) {\n if (f.shapeName !== 'frame') continue;\n if (f === currentShape) continue;\n if (typeof f.isShapeInFrame === 'function' && f.isShapeInFrame(currentShape)) {\n newHover = f;\n break;\n }\n }\n if (hoveredFrame && hoveredFrame !== newHover && typeof hoveredFrame.removeHighlight === 'function') {\n hoveredFrame.removeHighlight();\n }\n if (newHover && newHover !== hoveredFrame && typeof newHover.highlightFrame === 'function') {\n newHover.highlightFrame();\n }\n hoveredFrame = newHover;\n } else if (isResizingShapeSquare && currentShape && currentShape.isSelected && resizingAnchorIndexSquare !== null) {\n currentShape.updatePosition(resizingAnchorIndexSquare, mouseX, mouseY);\n currentShape._skipAnchors = true;\n currentShape.draw();\n currentShape._skipAnchors = false;\n } else if (isRotatingShapeSquare && currentShape && currentShape.isSelected) {\n const centerX = currentShape.x + currentShape.width / 2;\n const centerY = currentShape.y + currentShape.height / 2;\n const currentRotationMouseAngle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;\n const angleDiff = currentRotationMouseAngle - startRotationMouseAngleSquare;\n let newRotation = startShapeRotationSquare + angleDiff;\n const snapAngle = 15;\n if (e.shiftKey) {\n newRotation = Math.round(newRotation / snapAngle) * snapAngle;\n }\n currentShape.rotate(newRotation);\n currentShape._skipAnchors = true;\n currentShape.draw();\n currentShape._skipAnchors = false;\n svg.style.cursor = 'grabbing'; \n } else if (isSelectionToolActive && !isDrawingSquare && currentShape && currentShape.isSelected) {\n const anchorInfo = currentShape.isNearAnchor(mouseX, mouseY);\n if (anchorInfo) {\n if (anchorInfo.type === 'resize') {\n const baseDirection = anchorInfo.index; \n const rotatedCursor = currentShape.getRotatedCursor(baseDirection, currentShape.rotation);\n svg.style.cursor = rotatedCursor + '-resize';\n } else if (anchorInfo.type === 'rotate') {\n svg.style.cursor = 'grab';\n }\n } else if (currentShape.contains(mouseX, mouseY)) {\n svg.style.cursor = 'move';\n } else {\n svg.style.cursor = 'default';\n }\n } else if (isSelectionToolActive && !isDrawingSquare && !isDraggingShapeSquare && !isResizingShapeSquare && !isRotatingShapeSquare) {\n let hoveredShape = null;\n for (let i = shapes.length - 1; i >= 0; i--) {\n const shape = shapes[i];\n if (shape.shapeName === 'rectangle' && shape.contains(mouseX, mouseY)) {\n hoveredShape = shape;\n break;\n }\n }\n if (hoveredShape) {\n svg.style.cursor = 'pointer';\n } else {\n svg.style.cursor = 'default'; \n }\n }\n};\n\n \nconst handleMouseUpRect = (e) => {\n if (isDrawingSquare && currentShape) {\n currentShape.setDrawingState(false);\n if (currentShape.width === 0 || currentShape.height === 0) {\n if (currentShape.group.parentNode) {\n currentShape.group.parentNode.removeChild(currentShape.group);\n }\n currentShape = null;\n } else {\n currentShape.draw();\n shapes.push(currentShape);\n pushCreateAction(currentShape);\n\n // Check for frame containment and track attachment\n const finalFrame = hoveredFrame;\n if (finalFrame) {\n finalFrame.addShapeToFrame(currentShape);\n // Track the attachment for undo\n pushFrameAttachmentAction(finalFrame, currentShape, 'attach', null);\n }\n\n // Auto-select the drawn shape and switch to selection tool\n const drawnShape = currentShape;\n if (window.__sketchStoreApi) window.__sketchStoreApi.setActiveTool('select', { afterDraw: true });\n currentShape = drawnShape;\n currentShape.isSelected = true;\n if (typeof currentShape.addAnchors === 'function') {\n currentShape.addAnchors();\n }\n }\n \n // Clear frame highlighting\n if (hoveredFrame) {\n hoveredFrame.removeHighlight();\n hoveredFrame = null;\n }\n }\n\n if ((isDraggingShapeSquare || isResizingShapeSquare || isRotatingShapeSquare) && dragOldPosSquare && currentShape) {\n // Issue #34 bug #2: for drag operations the actual frame transfer\n // happens AFTER this mouseUp block \u2014 so `currentShape.parentFrame`\n // at this point still points at the OLD frame. Use the hovered\n // frame (tracked during mousemove) as the authoritative new\n // destination instead, so the undo action records a real\n // attachment delta and Ctrl+Z re-attaches the shape correctly.\n const newPos = {\n x: currentShape.x,\n y: currentShape.y,\n width: currentShape.width,\n height: currentShape.height,\n rotation: currentShape.rotation,\n parentFrame: isDraggingShapeSquare ? (hoveredFrame || null) : currentShape.parentFrame,\n };\n const oldPos = {\n ...dragOldPosSquare,\n parentFrame: draggedShapeInitialFrame\n };\n \n const stateChanged = oldPos.x !== newPos.x || oldPos.y !== newPos.y ||\n oldPos.width !== newPos.width || oldPos.height !== newPos.height ||\n oldPos.rotation !== newPos.rotation;\n\n const frameChanged = oldPos.parentFrame !== newPos.parentFrame;\n\n if (stateChanged || frameChanged) {\n pushTransformAction(currentShape, oldPos, newPos);\n }\n \n // Handle frame containment changes after drag\n if (isDraggingShapeSquare) {\n const finalFrame = hoveredFrame;\n \n // If shape moved to a different frame\n if (draggedShapeInitialFrame !== finalFrame) {\n // Remove from initial frame\n if (draggedShapeInitialFrame) {\n draggedShapeInitialFrame.removeShapeFromFrame(currentShape);\n }\n \n // Add to new frame\n if (finalFrame) {\n finalFrame.addShapeToFrame(currentShape);\n }\n \n // Track the frame change for undo\n if (frameChanged) {\n pushFrameAttachmentAction(finalFrame || draggedShapeInitialFrame, currentShape, \n finalFrame ? 'attach' : 'detach', draggedShapeInitialFrame);\n }\n } else if (draggedShapeInitialFrame) {\n // Shape stayed in same frame, restore clipping\n draggedShapeInitialFrame.restoreToFrame(currentShape);\n }\n }\n \n dragOldPosSquare = null;\n draggedShapeInitialFrame = null;\n }\n \n // Clear frame highlighting\n if (hoveredFrame) {\n hoveredFrame.removeHighlight();\n hoveredFrame = null;\n }\n\n isDrawingSquare = false;\n isDraggingShapeSquare = false;\n isResizingShapeSquare = false;\n isRotatingShapeSquare = false;\n resizingAnchorIndexSquare = null;\n startRotationMouseAngleSquare = 0;\n startShapeRotationSquare = 0;\n clearSnapGuides();\n svg.style.cursor = 'default';\n};\n\nSquarecolorOptions.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options }); \n squareStrokecolor = span.getAttribute(\"data-id\"); \n currentShape.options.stroke = squareStrokecolor; \n currentShape.draw();\n currentShape.updateSidebar(); \n } else {\n squareStrokecolor = span.getAttribute(\"data-id\");\n }\n SquarecolorOptions.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\"); \n });\n});\n\nbackgroundColorOptionsSquare.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n squareBackgroundColor = span.getAttribute(\"data-id\");\n currentShape.options.fill = squareBackgroundColor;\n currentShape.draw();\n currentShape.updateSidebar();\n } else {\n squareBackgroundColor = span.getAttribute(\"data-id\");\n }\n backgroundColorOptionsSquare.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\");\n });\n});\n\nfillStyleOptions.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation()\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n squareFillStyleValue = span.getAttribute(\"data-id\");\n currentShape.options.fillStyle = squareFillStyleValue;\n currentShape.draw();\n currentShape.updateSidebar();\n } else {\n squareFillStyleValue = span.getAttribute(\"data-id\");\n }\n fillStyleOptions.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\");\n });\n});\n\nsquareStrokeThicknessValue.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation()\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n squareStrokeThicknes = parseInt(span.getAttribute(\"data-id\"));\n currentShape.options.strokeWidth = squareStrokeThicknes;\n currentShape.draw();\n currentShape.updateSidebar();\n } else {\n squareStrokeThicknes = parseInt(span.getAttribute(\"data-id\"));\n }\n squareStrokeThicknessValue.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\");\n });\n});\n\nsquareOutlineStyleValue.forEach((span) => {\n span.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n squareOutlineStyle = span.getAttribute(\"data-id\");\n if (squareOutlineStyle === \"dashed\") {\n currentShape.options.strokeDasharray = \"10,10\";\n } else if (squareOutlineStyle === \"dotted\") {\n currentShape.options.strokeDasharray = \"2,8\";\n } else {\n currentShape.options.strokeDasharray = \"\";\n }\n currentShape.draw();\n currentShape.updateSidebar();\n } else {\n squareOutlineStyle = span.getAttribute(\"data-id\");\n }\n squareOutlineStyleValue.forEach((el) => el.classList.remove(\"selected\"));\n span.classList.add(\"selected\");\n });\n});\n\nwindow.Rectangle = Rectangle;\n\n// Bridge rectangle tool settings to React sidebar\nwindow.rectToolSettings = {\n get strokeColor() { return squareStrokecolor; },\n set strokeColor(v) { squareStrokecolor = v; },\n get bgColor() { return squareBackgroundColor; },\n set bgColor(v) { squareBackgroundColor = v; },\n get fillStyle() { return squareFillStyleValue; },\n set fillStyle(v) { squareFillStyleValue = v; },\n get strokeWidth() { return squareStrokeThicknes; },\n set strokeWidth(v) { squareStrokeThicknes = v; },\n get outlineStyle() { return squareOutlineStyle; },\n set outlineStyle(v) { squareOutlineStyle = v; },\n};\nwindow.updateSelectedRectStyle = function(changes) {\n if (currentShape && currentShape.shapeName === 'rectangle' && currentShape.isSelected) {\n pushOptionsChangeAction(currentShape, { ...currentShape.options });\n if (changes.stroke !== undefined) { squareStrokecolor = changes.stroke; currentShape.options.stroke = changes.stroke; }\n if (changes.fill !== undefined) { squareBackgroundColor = changes.fill; currentShape.options.fill = changes.fill; }\n if (changes.fillStyle !== undefined) { squareFillStyleValue = changes.fillStyle; currentShape.options.fillStyle = changes.fillStyle; }\n if (changes.strokeWidth !== undefined) { squareStrokeThicknes = changes.strokeWidth; currentShape.options.strokeWidth = changes.strokeWidth; }\n if (changes.outlineStyle !== undefined) {\n squareOutlineStyle = changes.outlineStyle;\n if (changes.outlineStyle === \"dashed\") currentShape.options.strokeDasharray = \"10,10\";\n else if (changes.outlineStyle === \"dotted\") currentShape.options.strokeDasharray = \"2,8\";\n else currentShape.options.strokeDasharray = \"\";\n }\n currentShape.draw();\n } else {\n if (changes.stroke !== undefined) squareStrokecolor = changes.stroke;\n if (changes.fill !== undefined) squareBackgroundColor = changes.fill;\n if (changes.fillStyle !== undefined) squareFillStyleValue = changes.fillStyle;\n if (changes.strokeWidth !== undefined) squareStrokeThicknes = changes.strokeWidth;\n if (changes.outlineStyle !== undefined) squareOutlineStyle = changes.outlineStyle;\n }\n};\n\nexport { handleMouseDownRect, handleMouseMoveRect, handleMouseUpRect };\n"],
5
+ "mappings": ";;;;;;;;;;;;;AASA,IAAI,kBAAkB;AACtB,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAC5B,IAAI,4BAA4B;AAChC,IAAI,gCAAgC;AACpC,IAAI,2BAA2B;AAC/B,IAAM,KAAK,MAAM,IAAI,GAAG;AACxB,IAAI;AAAJ,IAAY;AAMZ,SAAS,iBAAiB;AACtB,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,SAAO,SAAS,QAAQ,SAAS,K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rE,QAAQ,iBAAiB,SAAU,cAAa,QAAQ,kBAAkB;AAAA,UAC9E,cAAa,QAAQ,kBAAkB;AAAA,IAChD;AACA,iBAAa,KAAK;AAAA,EACtB,OAAO;AACH,QAAI,QAAQ,WAAW,OAAW,qBAAoB,QAAQ;AAC9D,QAAI,QAAQ,SAAS,OAAW,yBAAwB,QAAQ;AAChE,QAAI,QAAQ,cAAc,OAAW,wBAAuB,QAAQ;AACpE,QAAI,QAAQ,gBAAgB,OAAW,wBAAuB,QAAQ;AACtE,QAAI,QAAQ,iBAAiB,OAAW,sBAAqB,QAAQ;AAAA,EACzE;AACJ;",
6
+ "names": []
7
+ }
@@ -6,13 +6,14 @@ import {
6
6
  calculateSnap,
7
7
  cleanupAttachments,
8
8
  clearSnapGuides
9
- } from "./chunk-XYUFEIZR.js";
9
+ } from "./chunk-X5ENBMGL.js";
10
10
  import {
11
+ beginUndoBatch,
12
+ endUndoBatch,
11
13
  pushCreateAction,
12
14
  pushDeleteAction,
13
- pushFrameAttachmentAction,
14
15
  pushTransformAction
15
- } from "./chunk-6GPEWDRB.js";
16
+ } from "./chunk-VZX55VQL.js";
16
17
 
17
18
  // src/core/Selection.js
18
19
  var isMultiSelecting = false;
@@ -263,18 +264,20 @@ var MultiSelection = class {
263
264
  y: shape.y,
264
265
  width: shape.width || 0,
265
266
  height: shape.height || 0,
266
- rotation: shape.rotation || 0
267
+ rotation: shape.rotation || 0,
268
+ parentFrame: shape.parentFrame || null
267
269
  };
268
270
  case "circle":
269
- return { x: shape.x, y: shape.y, rx: shape.rx, ry: shape.ry, rotation: shape.rotation || 0, width: shape.width, height: shape.height };
271
+ return { x: shape.x, y: shape.y, rx: shape.rx, ry: shape.ry, rotation: shape.rotation || 0, width: shape.width, height: shape.height, parentFrame: shape.parentFrame || null };
270
272
  case "freehandStroke":
271
- return { x: shape.x, y: shape.y, width: shape.width, height: shape.height, rotation: shape.rotation || 0, points: JSON.parse(JSON.stringify(shape.points)) };
273
+ return { x: shape.x, y: shape.y, width: shape.width, height: shape.height, rotation: shape.rotation || 0, points: JSON.parse(JSON.stringify(shape.points)), parentFrame: shape.parentFrame || null };
272
274
  default:
273
- return { x: shape.x || 0, y: shape.y || 0, width: shape.width || 0, height: shape.height || 0, rotation: shape.rotation || 0 };
275
+ return { x: shape.x || 0, y: shape.y || 0, width: shape.width || 0, height: shape.height || 0, rotation: shape.rotation || 0, parentFrame: shape.parentFrame || null };
274
276
  }
275
277
  }
276
278
  // Push undo actions for all shapes that changed
277
- _pushUndoForAll() {
279
+ _pushUndoForAll(existingBatch = null) {
280
+ const batch = existingBatch || beginUndoBatch();
278
281
  this.selectedShapes.forEach((shape) => {
279
282
  const oldState = this._undoSnapshots.get(shape);
280
283
  if (!oldState) return;
@@ -288,6 +291,7 @@ var MultiSelection = class {
288
291
  }
289
292
  });
290
293
  this._undoSnapshots.clear();
294
+ if (!existingBatch) endUndoBatch(batch, "multi-transform");
291
295
  }
292
296
  addShape(shape) {
293
297
  this.selectedShapes.add(shape);
@@ -1203,6 +1207,7 @@ var MultiSelection = class {
1203
1207
  }
1204
1208
  shape.isSelected = true;
1205
1209
  });
1210
+ const undoBatch = beginUndoBatch();
1206
1211
  if (typeof shapes !== "undefined" && Array.isArray(shapes)) {
1207
1212
  this.selectedShapes.forEach((shape) => {
1208
1213
  if (!shape || shape.shapeName === "frame") return;
@@ -1223,16 +1228,12 @@ var MultiSelection = class {
1223
1228
  }
1224
1229
  if (target && typeof target.addShapeToFrame === "function") {
1225
1230
  target.addShapeToFrame(shape);
1226
- if (typeof pushFrameAttachmentAction === "function") {
1227
- pushFrameAttachmentAction(target, shape, "attach", current);
1228
- }
1229
- } else if (current && typeof pushFrameAttachmentAction === "function") {
1230
- pushFrameAttachmentAction(current, shape, "detach", current);
1231
1231
  }
1232
1232
  });
1233
1233
  }
1234
1234
  this.initialPositions.clear();
1235
- this._pushUndoForAll();
1235
+ this._pushUndoForAll(undoBatch);
1236
+ endUndoBatch(undoBatch, "multi-move");
1236
1237
  this.updateControls();
1237
1238
  if (typeof svg !== "undefined") {
1238
1239
  svg.style.cursor = "default";
@@ -1559,12 +1560,19 @@ document.addEventListener("keydown", (e) => {
1559
1560
  });
1560
1561
  function deleteSelectedShapes() {
1561
1562
  if (multiSelection.selectedShapes.size === 0) return;
1563
+ if (Array.isArray(window.shapes) && window.shapes.length > 0 && multiSelection.selectedShapes.size >= window.shapes.length && typeof window.__requestCanvasResetConfirmation === "function") {
1564
+ window.__requestCanvasResetConfirmation();
1565
+ return;
1566
+ }
1562
1567
  const shapesToDelete = Array.from(multiSelection.selectedShapes);
1563
1568
  multiSelection.clearSelection();
1569
+ const undoBatch = beginUndoBatch();
1564
1570
  const releasedChildren = [];
1565
1571
  shapesToDelete.forEach((shape) => {
1566
1572
  const isFrame = shape.shapeName === "frame";
1567
1573
  const isDiagramFrame = isFrame && !!shape._diagramType;
1574
+ const parentFrame = shape.parentFrame || null;
1575
+ const frameIndex = parentFrame?.containedShapes?.indexOf(shape) ?? -1;
1568
1576
  let childSnapshot = null;
1569
1577
  if (isFrame && !isDiagramFrame) {
1570
1578
  childSnapshot = [...shape.containedShapes || []];
@@ -1603,14 +1611,15 @@ function deleteSelectedShapes() {
1603
1611
  if (idx !== -1) shapes.splice(idx, 1);
1604
1612
  try {
1605
1613
  if (childSnapshot) {
1606
- pushDeleteAction(shape, { childSnapshot });
1614
+ pushDeleteAction(shape, { childSnapshot, shapeIndex: idx, parentFrame, frameIndex });
1607
1615
  } else {
1608
- pushDeleteAction(shape);
1616
+ pushDeleteAction(shape, { shapeIndex: idx, parentFrame, frameIndex });
1609
1617
  }
1610
1618
  } catch (err) {
1611
1619
  console.warn("[deleteSelectedShapes] pushDeleteAction failed:", err);
1612
1620
  }
1613
1621
  });
1622
+ endUndoBatch(undoBatch, "multi-delete");
1614
1623
  if (releasedChildren.length > 0) {
1615
1624
  for (const child of releasedChildren) {
1616
1625
  if (shapes.indexOf(child) === -1) continue;
@@ -1687,4 +1696,4 @@ export {
1687
1696
  handleMultiSelectionMouseMove,
1688
1697
  handleMultiSelectionMouseUp
1689
1698
  };
1690
- //# sourceMappingURL=chunk-K5RY4EV7.js.map
1699
+ //# sourceMappingURL=chunk-KC26KJW4.js.map