@elixpo/lixsketch 5.5.9 → 5.5.10

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 (25) hide show
  1. package/dist/react/{CopyPaste-4CKJRHJ3.js → CopyPaste-SA72NDFN.js} +2 -2
  2. package/dist/react/{EventDispatcher-AD2BPPPS.js → EventDispatcher-BZQRHROG.js} +2 -2
  3. package/dist/react/{SceneSerializer-4U4B24JM.js → SceneSerializer-ZPHV6IUP.js} +2 -2
  4. package/dist/react/{SketchEngine-XWWTA2MT.js → SketchEngine-BCRJ62CV.js} +6 -6
  5. package/dist/react/TextShape-U6ZZKB35.js +8 -0
  6. package/dist/react/{chunk-QXFBG7OM.js → chunk-42O6W7DF.js} +18 -1
  7. package/dist/react/chunk-42O6W7DF.js.map +7 -0
  8. package/dist/react/{chunk-YVCENC7J.js → chunk-5QIT2WBE.js} +19 -116
  9. package/dist/react/chunk-5QIT2WBE.js.map +7 -0
  10. package/dist/react/index.js +3 -3
  11. package/dist/react/index.js.map +1 -1
  12. package/dist/react/{textTool-KY4AYUTC.js → textTool-HY5NMM7H.js} +2 -2
  13. package/package.json +1 -1
  14. package/src/react/components/sidebars/TextSidebar.jsx +1 -1
  15. package/src/shapes/TextShape.js +19 -0
  16. package/src/tools/textTool.js +23 -157
  17. package/dist/react/TextShape-54ZJ66E3.js +0 -8
  18. package/dist/react/chunk-QXFBG7OM.js.map +0 -7
  19. package/dist/react/chunk-YVCENC7J.js.map +0 -7
  20. /package/dist/react/{CopyPaste-4CKJRHJ3.js.map → CopyPaste-SA72NDFN.js.map} +0 -0
  21. /package/dist/react/{EventDispatcher-AD2BPPPS.js.map → EventDispatcher-BZQRHROG.js.map} +0 -0
  22. /package/dist/react/{SceneSerializer-4U4B24JM.js.map → SceneSerializer-ZPHV6IUP.js.map} +0 -0
  23. /package/dist/react/{SketchEngine-XWWTA2MT.js.map → SketchEngine-BCRJ62CV.js.map} +0 -0
  24. /package/dist/react/{TextShape-54ZJ66E3.js.map → TextShape-U6ZZKB35.js.map} +0 -0
  25. /package/dist/react/{textTool-KY4AYUTC.js.map → textTool-HY5NMM7H.js.map} +0 -0
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunk-L5OARZJ7.js";
37
37
  import {
38
38
  TextShape
39
- } from "./chunk-QXFBG7OM.js";
39
+ } from "./chunk-42O6W7DF.js";
40
40
 
41
41
  // src/core/CopyPaste.js
42
42
  var clipboard = null;
@@ -566,4 +566,4 @@ export {
566
566
  initCopyPaste,
567
567
  pasteClipboard
568
568
  };
569
- //# sourceMappingURL=CopyPaste-4CKJRHJ3.js.map
569
+ //# sourceMappingURL=CopyPaste-SA72NDFN.js.map
@@ -4,7 +4,7 @@ import {
4
4
  handleTextMouseDown,
5
5
  handleTextMouseMove,
6
6
  handleTextMouseUp
7
- } from "./chunk-YVCENC7J.js";
7
+ } from "./chunk-5QIT2WBE.js";
8
8
  import {
9
9
  handleCodeMouseDown,
10
10
  handleCodeMouseMove,
@@ -460,4 +460,4 @@ export {
460
460
  handleMainMouseUp,
461
461
  initEventDispatcher
462
462
  };
463
- //# sourceMappingURL=EventDispatcher-AD2BPPPS.js.map
463
+ //# sourceMappingURL=EventDispatcher-BZQRHROG.js.map
@@ -30,7 +30,7 @@ import "./chunk-BZE4CEBG.js";
30
30
  import "./chunk-L5OARZJ7.js";
31
31
  import {
32
32
  TextShape
33
- } from "./chunk-QXFBG7OM.js";
33
+ } from "./chunk-42O6W7DF.js";
34
34
 
35
35
  // src/core/SceneSerializer.js
36
36
  var FORMAT_VERSION = 1;
@@ -736,4 +736,4 @@ export {
736
736
  uploadScene,
737
737
  validateScene
738
738
  };
739
- //# sourceMappingURL=SceneSerializer-4U4B24JM.js.map
739
+ //# sourceMappingURL=SceneSerializer-ZPHV6IUP.js.map
@@ -165,7 +165,7 @@ var SketchEngine = class {
165
165
  import("./Circle-KPG7TKIX.js"),
166
166
  import("./Arrow-BJDAXPMH.js"),
167
167
  import("./Line-2KOQEEGA.js"),
168
- import("./TextShape-54ZJ66E3.js"),
168
+ import("./TextShape-U6ZZKB35.js"),
169
169
  import("./CodeShape-K4DIZAIV.js"),
170
170
  import("./ImageShape-CHHGBXUQ.js"),
171
171
  import("./IconShape-KMIA6T2H.js"),
@@ -210,7 +210,7 @@ var SketchEngine = class {
210
210
  import("./circleTool-NUATSEI2.js"),
211
211
  import("./arrowTool-CWEMIRXK.js"),
212
212
  import("./lineTool-WNI5EMZ5.js"),
213
- import("./textTool-KY4AYUTC.js"),
213
+ import("./textTool-HY5NMM7H.js"),
214
214
  import("./codeTool-MHCB2FNB.js"),
215
215
  import("./imageTool-D5R4XGEU.js"),
216
216
  import("./iconTool-GPZ7O7NH.js"),
@@ -239,11 +239,11 @@ var SketchEngine = class {
239
239
  resizeShapes,
240
240
  resizeCode
241
241
  ] = await Promise.all([
242
- import("./EventDispatcher-AD2BPPPS.js"),
242
+ import("./EventDispatcher-BZQRHROG.js"),
243
243
  import("./UndoRedo-M2JZUBKN.js"),
244
244
  import("./Selection-VVUHY5YJ.js"),
245
245
  import("./ZoomPan-NYPDJBD5.js"),
246
- import("./CopyPaste-4CKJRHJ3.js"),
246
+ import("./CopyPaste-SA72NDFN.js"),
247
247
  import("./EraserTrail-PA6IQLQN.js"),
248
248
  import("./ResizeShapes-LKEQTITP.js"),
249
249
  import("./ResizeCode-WAMDTKSW.js")
@@ -262,7 +262,7 @@ var SketchEngine = class {
262
262
  eventDispatcher.initEventDispatcher(this.svg);
263
263
  }
264
264
  window.__sketchInteractionReady = true;
265
- const sceneSerializer = await import("./SceneSerializer-4U4B24JM.js");
265
+ const sceneSerializer = await import("./SceneSerializer-ZPHV6IUP.js");
266
266
  if (sceneSerializer.initSceneSerializer) sceneSerializer.initSceneSerializer();
267
267
  await Promise.all([
268
268
  import("./eraserTool-2GS2LQCS.js"),
@@ -414,4 +414,4 @@ export {
414
414
  SketchEngine,
415
415
  SketchEngine_default as default
416
416
  };
417
- //# sourceMappingURL=SketchEngine-XWWTA2MT.js.map
417
+ //# sourceMappingURL=SketchEngine-BCRJ62CV.js.map
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import {
3
+ TextShape
4
+ } from "./chunk-42O6W7DF.js";
5
+ export {
6
+ TextShape
7
+ };
8
+ //# sourceMappingURL=TextShape-U6ZZKB35.js.map
@@ -27,9 +27,26 @@ function deselectElement() {
27
27
  function selectElement(el) {
28
28
  selectedElement = el;
29
29
  }
30
+ function removeLegacySoftWrap(groupElement) {
31
+ const textElement = groupElement.querySelector("text");
32
+ if (!textElement || !textElement.hasAttribute("data-wrap-width")) return;
33
+ const source = textElement.getAttribute("data-wrap-source");
34
+ if (source === null) return;
35
+ while (textElement.firstChild) textElement.removeChild(textElement.firstChild);
36
+ const x = textElement.getAttribute("x") || 0;
37
+ source.split("\n").forEach((line, index) => {
38
+ const tspan = textElement.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "tspan");
39
+ tspan.setAttribute("x", x);
40
+ tspan.setAttribute("dy", index === 0 ? "0" : "1.2em");
41
+ tspan.textContent = line || " ";
42
+ textElement.appendChild(tspan);
43
+ });
44
+ textElement.removeAttribute("data-wrap-width");
45
+ }
30
46
  var TextShape = class {
31
47
  constructor(groupElement) {
32
48
  this.group = groupElement;
49
+ removeLegacySoftWrap(groupElement);
33
50
  this.shapeName = "text";
34
51
  this.shapeID = groupElement.getAttribute("id") || `text-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 1e4)}`;
35
52
  this.parentFrame = null;
@@ -188,4 +205,4 @@ var TextShape = class {
188
205
  export {
189
206
  TextShape
190
207
  };
191
- //# sourceMappingURL=chunk-QXFBG7OM.js.map
208
+ //# sourceMappingURL=chunk-42O6W7DF.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/shapes/TextShape.js"],
4
+ "sourcesContent": ["/* eslint-disable */\n// TextShape class - extracted from writeText.js\n// Depends on globals: svg, shapes, currentShape\n\nfunction extractRotationFromTransform(el) {\n const t = el.getAttribute(\"transform\") || \"\";\n const m = t.match(/rotate\\(([^,)]+)/);\n return m ? parseFloat(m[1]) : 0;\n}\nfunction updateAttachedArrows(wrapper) {\n if (!wrapper || typeof shapes === \"undefined\") return;\n shapes.forEach(s => {\n if (s && s.shapeName === \"arrow\" && typeof s.updateAttachments === \"function\") {\n if ((s.attachedToStart && s.attachedToStart.shape === wrapper) ||\n (s.attachedToEnd && s.attachedToEnd.shape === wrapper)) {\n s.updateAttachments();\n }\n }\n });\n}\nlet isDragging = false;\nlet hoveredFrameText = null;\nlet selectedElement = null;\nfunction updateSelectionFeedback() {}\nfunction deselectElement() { selectedElement = null; }\nfunction selectElement(el) { selectedElement = el; }\n\nfunction removeLegacySoftWrap(groupElement) {\n const textElement = groupElement.querySelector('text');\n if (!textElement || !textElement.hasAttribute('data-wrap-width')) return;\n const source = textElement.getAttribute('data-wrap-source');\n if (source === null) return;\n\n while (textElement.firstChild) textElement.removeChild(textElement.firstChild);\n const x = textElement.getAttribute('x') || 0;\n source.split('\\n').forEach((line, index) => {\n const tspan = textElement.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'tspan');\n tspan.setAttribute('x', x);\n tspan.setAttribute('dy', index === 0 ? '0' : '1.2em');\n tspan.textContent = line || ' ';\n textElement.appendChild(tspan);\n });\n textElement.removeAttribute('data-wrap-width');\n}\n\nclass TextShape {\n constructor(groupElement) {\n this.group = groupElement;\n removeLegacySoftWrap(groupElement);\n this.shapeName = 'text';\n this.shapeID = groupElement.getAttribute('id') || `text-${String(Date.now()).slice(0, 8)}-${Math.floor(Math.random() * 10000)}`;\n \n // Frame attachment properties\n this.parentFrame = null;\n \n // Update group attributes \u2014 ensure data-type is set for textTool interaction\n this.group.setAttribute('type', 'text');\n this.group.setAttribute('data-type', 'text-group');\n this.group.shapeName = 'text';\n this.group.shapeID = this.shapeID;\n }\n \n // Position and dimension properties for frame compatibility\n get x() {\n const transform = this.group.transform.baseVal.consolidate();\n return transform ? transform.matrix.e : parseFloat(this.group.getAttribute('data-x')) || 0;\n }\n \n set x(value) {\n const transform = this.group.transform.baseVal.consolidate();\n const currentY = transform ? transform.matrix.f : parseFloat(this.group.getAttribute('data-y')) || 0;\n const rotation = extractRotationFromTransform(this.group) || 0;\n const textElement = this.group.querySelector('text');\n if (textElement) {\n const bbox = textElement.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${value}, ${currentY}) rotate(${rotation}, ${centerX}, ${centerY})`);\n } else {\n this.group.setAttribute('transform', `translate(${value}, ${currentY})`);\n }\n this.group.setAttribute('data-x', value);\n }\n \n get y() {\n const transform = this.group.transform.baseVal.consolidate();\n return transform ? transform.matrix.f : parseFloat(this.group.getAttribute('data-y')) || 0;\n }\n \n set y(value) {\n const transform = this.group.transform.baseVal.consolidate();\n const currentX = transform ? transform.matrix.e : parseFloat(this.group.getAttribute('data-x')) || 0;\n const rotation = extractRotationFromTransform(this.group) || 0;\n const textElement = this.group.querySelector('text');\n if (textElement) {\n const bbox = textElement.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${currentX}, ${value}) rotate(${rotation}, ${centerX}, ${centerY})`);\n } else {\n this.group.setAttribute('transform', `translate(${currentX}, ${value})`);\n }\n this.group.setAttribute('data-y', value);\n }\n \n get width() {\n const textElement = this.group.querySelector('text');\n if (textElement) {\n return textElement.getBBox().width;\n }\n return 0;\n }\n \n set width(value) {\n // Text width is determined by content and font size, not directly settable\n // This is here for frame compatibility but doesn't change the text\n }\n \n get height() {\n const textElement = this.group.querySelector('text');\n if (textElement) {\n return textElement.getBBox().height;\n }\n return 0;\n }\n \n set height(value) {\n // Text height is determined by content and font size, not directly settable\n // This is here for frame compatibility but doesn't change the text\n }\n \n get rotation() {\n return extractRotationFromTransform(this.group) || 0;\n }\n \n set rotation(value) {\n const currentTransform = this.group.transform.baseVal.consolidate();\n const currentX = currentTransform ? currentTransform.matrix.e : 0;\n const currentY = currentTransform ? currentTransform.matrix.f : 0;\n const textElement = this.group.querySelector('text');\n if (textElement) {\n const bbox = textElement.getBBox();\n const centerX = bbox.x + bbox.width / 2;\n const centerY = bbox.y + bbox.height / 2;\n this.group.setAttribute('transform', `translate(${currentX}, ${currentY}) rotate(${value}, ${centerX}, ${centerY})`);\n }\n }\n\n move(dx, dy) {\n const currentTransform = this.group.transform.baseVal.consolidate();\n const currentX = currentTransform ? currentTransform.matrix.e : 0;\n const currentY = currentTransform ? currentTransform.matrix.f : 0;\n\n this.x = currentX + dx;\n this.y = currentY + dy;\n\n // Only update frame containment if we're actively dragging the shape itself\n // and not being moved by a parent frame\n if (isDragging && !this.isBeingMovedByFrame) {\n this.updateFrameContainment();\n }\n\n this.updateAttachedArrows();\n }\n\n updateAttachedArrows() {\n updateAttachedArrows(this);\n }\n\n updateFrameContainment() {\n // Don't update if we're being moved by a frame\n if (this.isBeingMovedByFrame) return;\n \n let targetFrame = null;\n \n // Find which frame this shape is over\n if (typeof shapes !== 'undefined' && Array.isArray(shapes)) {\n shapes.forEach(shape => {\n if (shape.shapeName === 'frame' && shape.isShapeInFrame(this)) {\n targetFrame = shape;\n }\n });\n }\n \n // If we have a parent frame and we're being dragged, temporarily remove clipping\n if (this.parentFrame && isDragging) {\n this.parentFrame.temporarilyRemoveFromFrame(this);\n }\n \n // Update frame highlighting\n if (hoveredFrameText && hoveredFrameText !== targetFrame) {\n hoveredFrameText.removeHighlight();\n }\n \n if (targetFrame && targetFrame !== hoveredFrameText) {\n targetFrame.highlightFrame();\n }\n \n hoveredFrameText = targetFrame;\n }\n\n contains(x, y) {\n const textElement = this.group.querySelector('text');\n if (!textElement || typeof textElement.getBBox !== 'function') return false;\n\n let bbox;\n try { bbox = textElement.getBBox(); } catch { return false; }\n const padding = 8; // Selection padding\n\n const CTM = this.group.getCTM();\n if (!CTM) return false;\n \n const inverseCTM = CTM.inverse();\n const svgPoint = svg.createSVGPoint();\n svgPoint.x = x;\n svgPoint.y = y;\n const transformedPoint = svgPoint.matrixTransform(inverseCTM);\n \n return transformedPoint.x >= bbox.x - padding && \n transformedPoint.x <= bbox.x + bbox.width + padding &&\n transformedPoint.y >= bbox.y - padding && \n transformedPoint.y <= bbox.y + bbox.height + padding;\n }\n\n // Add draw method for consistency with other shapes\n draw() {\n // Text doesn't need redrawing like other shapes, but we need this method for consistency\n if (selectedElement === this.group) {\n updateSelectionFeedback();\n }\n }\n\n // Add methods for frame compatibility\n removeSelection() {\n if (selectedElement === this.group) {\n deselectElement();\n }\n }\n\n selectShape() {\n // Use the real textTool selectElement (with selection feedback) if available\n if (typeof window !== 'undefined' && window.__selectTextElement) {\n window.__selectTextElement(this.group);\n } else {\n selectElement(this.group);\n }\n }\n}\n\nexport { TextShape };\n"],
5
+ "mappings": ";;;AAIA,SAAS,6BAA6B,IAAI;AACtC,QAAM,IAAI,GAAG,aAAa,WAAW,KAAK;AAC1C,QAAM,IAAI,EAAE,MAAM,kBAAkB;AACpC,SAAO,IAAI,WAAW,EAAE,CAAC,CAAC,IAAI;AAClC;AACA,SAAS,qBAAqB,SAAS;AACnC,MAAI,CAAC,WAAW,OAAO,WAAW,YAAa;AAC/C,SAAO,QAAQ,OAAK;AAChB,QAAI,KAAK,EAAE,cAAc,WAAW,OAAO,EAAE,sBAAsB,YAAY;AAC3E,UAAK,EAAE,mBAAmB,EAAE,gBAAgB,UAAU,WACjD,EAAE,iBAAiB,EAAE,cAAc,UAAU,SAAU;AACxD,UAAE,kBAAkB;AAAA,MACxB;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;AACA,IAAI,aAAa;AACjB,IAAI,mBAAmB;AACvB,IAAI,kBAAkB;AACtB,SAAS,0BAA0B;AAAC;AACpC,SAAS,kBAAkB;AAAE,oBAAkB;AAAM;AACrD,SAAS,cAAc,IAAI;AAAE,oBAAkB;AAAI;AAEnD,SAAS,qBAAqB,cAAc;AACxC,QAAM,cAAc,aAAa,cAAc,MAA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,SAAS;AAAA,EACxD;AAAA;AAAA,EAGA,OAAO;AAEH,QAAI,oBAAoB,KAAK,OAAO;AAChC,8BAAwB;AAAA,IAC5B;AAAA,EACJ;AAAA;AAAA,EAGA,kBAAkB;AACd,QAAI,oBAAoB,KAAK,OAAO;AAChC,sBAAgB;AAAA,IACpB;AAAA,EACJ;AAAA,EAEA,cAAc;AAEV,QAAI,OAAO,WAAW,eAAe,OAAO,qBAAqB;AAC7D,aAAO,oBAAoB,KAAK,KAAK;AAAA,IACzC,OAAO;AACH,oBAAc,KAAK,KAAK;AAAA,IAC5B;AAAA,EACJ;AACJ;",
6
+ "names": []
7
+ }
@@ -30,7 +30,7 @@ function getThemeStroke() {
30
30
  if (typeof document === "undefined") return "#fff";
31
31
  return document.body && document.body.classList.contains("theme-dark") ? "#fff" : "#1a1a2e";
32
32
  }
33
- var textSize = "30px";
33
+ var textSize = "20px";
34
34
  var textFont = "lixFont";
35
35
  var textColor = null;
36
36
  var textAlign = "left";
@@ -181,10 +181,9 @@ function makeTextEditable(textElement, groupElement) {
181
181
  input.style.boxSizing = "border-box";
182
182
  input.style.overflow = "hidden";
183
183
  input.style.resize = "none";
184
- input.style.whiteSpace = "pre-wrap";
184
+ input.style.whiteSpace = "pre";
185
185
  input.style.minHeight = "1.2em";
186
186
  input.style.zIndex = "10000";
187
- const svgRect = svg.getBoundingClientRect();
188
187
  const textBBox = textElement.getBBox();
189
188
  let pt = svg.createSVGPoint();
190
189
  pt.x = textBBox.x;
@@ -194,58 +193,42 @@ function makeTextEditable(textElement, groupElement) {
194
193
  input.style.left = `${screenPt.x}px`;
195
194
  input.style.top = `${screenPt.y}px`;
196
195
  const svgZoomFactor = svg.getScreenCTM() ? svg.getScreenCTM().a : 1;
197
- const screenWidth = textBBox.width * svgZoomFactor;
198
196
  input.style.width = "auto";
199
197
  input.style.height = "auto";
200
- const currentFontSize = textElement.getAttribute("font-size") || "30px";
198
+ const currentFontSize = textElement.getAttribute("font-size") || "20px";
201
199
  const currentFontFamily = textElement.getAttribute("font-family") || "lixFont";
202
200
  const currentFill = textElement.getAttribute("fill") || "#fff";
203
201
  const currentAnchor = textElement.getAttribute("text-anchor") || "start";
204
- const rawSize = parseFloat(currentFontSize) || 30;
202
+ const rawSize = parseFloat(currentFontSize) || 20;
205
203
  const scaledFontSize = `${rawSize * svgZoomFactor}px`;
206
204
  input.style.minWidth = "150px";
207
205
  input.style.minHeight = "1.5em";
208
206
  input.style.width = "auto";
209
207
  input.style.height = "auto";
210
208
  input.style.overflow = "visible";
211
- input.style.whiteSpace = "pre-wrap";
212
- input.style.wordBreak = "break-word";
209
+ input.style.whiteSpace = "pre";
210
+ input.style.wordBreak = "normal";
211
+ input.style.overflowWrap = "normal";
213
212
  input.style.fontSize = scaledFontSize;
214
213
  input.style.fontFamily = currentFontFamily;
215
214
  input.style.color = currentFill;
216
215
  input.style.lineHeight = "1.2em";
217
216
  input.style.textAlign = currentAnchor === "middle" ? "center" : currentAnchor === "end" ? "right" : "left";
218
217
  input.style.backgroundColor = "transparent";
219
- const _isDark = typeof document !== "undefined" && document.body && document.body.classList.contains("theme-dark");
220
- const editingBorder = _isDark ? "rgba(139,136,232,0.95)" : "rgba(91,87,209,0.92)";
221
- input.style.border = `2px solid ${editingBorder}`;
222
- input.style.backgroundColor = _isDark ? "rgba(91,87,209,0.08)" : "rgba(91,87,209,0.05)";
223
- input.style.boxShadow = `0 0 0 2px ${_isDark ? "rgba(139,136,232,0.18)" : "rgba(91,87,209,0.14)"}`;
224
- input.style.borderRadius = "4px";
218
+ input.style.border = "none";
219
+ input.style.boxShadow = "none";
225
220
  input.style.outline = "none";
226
221
  document.body.appendChild(input);
227
222
  const adjustHeight = () => {
228
223
  input.style.height = "auto";
229
224
  input.style.height = input.scrollHeight + "px";
230
- const maxHeight = svgRect.height - screenPt.y;
231
- if (input.scrollHeight > maxHeight) {
232
- input.style.height = maxHeight + "px";
233
- input.style.overflowY = "auto";
234
- } else {
235
- input.style.overflowY = "hidden";
236
- }
225
+ input.style.overflowY = "hidden";
237
226
  };
238
227
  const adjustWidth = () => {
239
228
  input.style.width = "auto";
240
- const maxWidth = svgRect.width - screenPt.x;
241
229
  const contentWidth = Math.max(input.scrollWidth, 150);
242
- if (contentWidth > maxWidth) {
243
- input.style.width = maxWidth + "px";
244
- input.style.overflowX = "auto";
245
- } else {
246
- input.style.width = contentWidth + "px";
247
- input.style.overflowX = "hidden";
248
- }
230
+ input.style.width = contentWidth + "px";
231
+ input.style.overflowX = "hidden";
249
232
  };
250
233
  adjustHeight();
251
234
  adjustWidth();
@@ -278,45 +261,11 @@ function makeTextEditable(textElement, groupElement) {
278
261
  if (textEl) textEl.setAttribute("cursor", "text");
279
262
  groupElement.style.display = "none";
280
263
  }
281
- function measureSegment(text, refTextElement) {
282
- if (!text) return 0;
283
- const NS = "http://www.w3.org/2000/svg";
284
- const probe = document.createElementNS(NS, "tspan");
285
- probe.textContent = text;
286
- refTextElement.appendChild(probe);
287
- let width = 0;
288
- try {
289
- width = probe.getComputedTextLength();
290
- } catch {
291
- }
292
- refTextElement.removeChild(probe);
293
- return width;
294
- }
295
- function paintTextContent(textElement, source, wrapWidth) {
264
+ function paintTextContent(textElement, source) {
296
265
  while (textElement.firstChild) textElement.removeChild(textElement.firstChild);
297
266
  const x = textElement.getAttribute("x") || 0;
298
267
  const NS = "http://www.w3.org/2000/svg";
299
- const paragraphs = (source || "").split("\n");
300
- const finalLines = [];
301
- for (const paragraph of paragraphs) {
302
- const para = paragraph.replace(/ /g, " ");
303
- if (!wrapWidth || wrapWidth <= 0) {
304
- finalLines.push(para || " ");
305
- continue;
306
- }
307
- const words = para.split(/(\s+)/);
308
- let cur = "";
309
- for (const token of words) {
310
- const candidate = cur + token;
311
- if (measureSegment(candidate, textElement) > wrapWidth && cur.trim().length > 0) {
312
- finalLines.push(cur);
313
- cur = token.replace(/^\s+/, "");
314
- } else {
315
- cur = candidate;
316
- }
317
- }
318
- finalLines.push(cur.length ? cur : " ");
319
- }
268
+ const finalLines = (source || "").split("\n").map((line) => line.replace(/ /g, " "));
320
269
  finalLines.forEach((line, i) => {
321
270
  const tspan = document.createElementNS(NS, "tspan");
322
271
  tspan.setAttribute("x", x);
@@ -325,17 +274,6 @@ function paintTextContent(textElement, source, wrapWidth) {
325
274
  textElement.appendChild(tspan);
326
275
  });
327
276
  }
328
- function getWrapSource(textElement) {
329
- const stored = textElement.getAttribute("data-wrap-source");
330
- if (stored !== null && stored !== "") return stored;
331
- const tspans = textElement.querySelectorAll("tspan");
332
- if (tspans.length === 0) return textElement.textContent || "";
333
- return Array.from(tspans).map((t) => (t.textContent || "").replace(/ /g, " ")).join("\n");
334
- }
335
- function getWrapWidth(textElement) {
336
- const v = parseFloat(textElement.getAttribute("data-wrap-width") || "");
337
- return Number.isFinite(v) && v > 0 ? v : 0;
338
- }
339
277
  function renderText(input, textElement, deleteIfEmpty = false) {
340
278
  if (!input || !document.body.contains(input)) {
341
279
  return;
@@ -381,7 +319,8 @@ function renderText(input, textElement, deleteIfEmpty = false) {
381
319
  } else {
382
320
  const cleanSource = text.replace(/\u00A0/g, " ");
383
321
  textElement.setAttribute("data-wrap-source", cleanSource);
384
- paintTextContent(textElement, cleanSource, getWrapWidth(textElement));
322
+ textElement.removeAttribute("data-wrap-width");
323
+ paintTextContent(textElement, cleanSource);
385
324
  gElement.style.display = "block";
386
325
  updateAttachedArrows(gElement);
387
326
  if (selectedElement === gElement) {
@@ -432,9 +371,7 @@ function createSelectionFeedback(groupElement) {
432
371
  { name: "nw", x: selX, y: selY, cursor: "nwse-resize" },
433
372
  { name: "ne", x: selX + selWidth, y: selY, cursor: "nesw-resize" },
434
373
  { name: "sw", x: selX, y: selY + selHeight, cursor: "nesw-resize" },
435
- { name: "se", x: selX + selWidth, y: selY + selHeight, cursor: "nwse-resize" },
436
- { name: "e", x: selX + selWidth, y: selY + selHeight / 2, cursor: "ew-resize" },
437
- { name: "w", x: selX, y: selY + selHeight / 2, cursor: "ew-resize" }
374
+ { name: "se", x: selX + selWidth, y: selY + selHeight, cursor: "nwse-resize" }
438
375
  ];
439
376
  resizeHandles = {};
440
377
  handlesData.forEach((handle) => {
@@ -521,11 +458,7 @@ function updateSelectionFeedback() {
521
458
  { name: "nw", x: selX, y: selY },
522
459
  { name: "ne", x: selX + selWidth, y: selY },
523
460
  { name: "sw", x: selX, y: selY + selHeight },
524
- { name: "se", x: selX + selWidth, y: selY + selHeight },
525
- // Issue #48 bug #5: keep E/W midpoint handles aligned with the
526
- // resize so they follow the box as it scales.
527
- { name: "e", x: selX + selWidth, y: selY + selHeight / 2 },
528
- { name: "w", x: selX, y: selY + selHeight / 2 }
461
+ { name: "se", x: selX + selWidth, y: selY + selHeight }
529
462
  ];
530
463
  handlesData.forEach((handle) => {
531
464
  const handleRect = resizeHandles[handle.name];
@@ -747,7 +680,6 @@ var handleMouseMove = (event) => {
747
680
  const startWidth = startBBox.width;
748
681
  const startHeight = startBBox.height;
749
682
  let anchorX, anchorY;
750
- const isEdgeWidth = currentResizeHandle === "e" || currentResizeHandle === "w";
751
683
  switch (currentResizeHandle) {
752
684
  case "nw":
753
685
  anchorX = startX + startWidth;
@@ -765,28 +697,7 @@ var handleMouseMove = (event) => {
765
697
  anchorX = startX;
766
698
  anchorY = startY;
767
699
  break;
768
- case "e":
769
- anchorX = startX;
770
- anchorY = startY + startHeight / 2;
771
- break;
772
- case "w":
773
- anchorX = startX + startWidth;
774
- anchorY = startY + startHeight / 2;
775
- break;
776
- }
777
- if (isEdgeWidth) {
778
- const newWrap = Math.abs(currentPoint.x - anchorX);
779
- const minWrap = startFontSize * 2;
780
- const clampedWrap = Math.max(minWrap, newWrap);
781
- textElement.setAttribute("data-wrap-width", String(clampedWrap));
782
- const source = getWrapSource(textElement);
783
- paintTextContent(textElement, source, clampedWrap);
784
- if (typeof updateSelectionFeedback === "function") {
785
- setTimeout(updateSelectionFeedback, 0);
786
- }
787
- return;
788
700
  }
789
- const newWidth = Math.abs(currentPoint.x - anchorX);
790
701
  const newHeight = Math.abs(currentPoint.y - anchorY);
791
702
  const chosenScale = newHeight / startHeight;
792
703
  const minScale = 0.1;
@@ -815,14 +726,6 @@ var handleMouseMove = (event) => {
815
726
  newAnchorX = currentBBox.x;
816
727
  newAnchorY = currentBBox.y;
817
728
  break;
818
- case "e":
819
- newAnchorX = currentBBox.x;
820
- newAnchorY = currentBBox.y + currentBBox.height / 2;
821
- break;
822
- case "w":
823
- newAnchorX = currentBBox.x + currentBBox.width;
824
- newAnchorY = currentBBox.y + currentBBox.height / 2;
825
- break;
826
729
  }
827
730
  const deltaX = anchorX - newAnchorX;
828
731
  const deltaY = anchorY - newAnchorY;
@@ -1577,4 +1480,4 @@ export {
1577
1480
  handleTextMouseUp,
1578
1481
  updateCodeToggleForShape
1579
1482
  };
1580
- //# sourceMappingURL=chunk-YVCENC7J.js.map
1483
+ //# sourceMappingURL=chunk-5QIT2WBE.js.map