@elixpo/lixsketch 5.5.19 → 5.5.21

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 (137) hide show
  1. package/dist/react/Circle-6POZCUZD.js +9 -0
  2. package/dist/react/{CopyPaste-JMIXWUUO.js → CopyPaste-FJN7K5LS.js} +43 -14
  3. package/dist/react/CopyPaste-FJN7K5LS.js.map +7 -0
  4. package/dist/react/{EventDispatcher-H5EA4KZN.js → EventDispatcher-O7HCQQNM.js} +14 -13
  5. package/dist/react/{EventDispatcher-H5EA4KZN.js.map → EventDispatcher-O7HCQQNM.js.map} +1 -1
  6. package/dist/react/Frame-RLSMJJSK.js +11 -0
  7. package/dist/react/FreehandStroke-U6GYZOM4.js +9 -0
  8. package/dist/react/{GraphEngine-KQXHNTZQ.js → GraphEngine-MM6ALA2N.js} +105 -148
  9. package/dist/react/{GraphEngine-KQXHNTZQ.js.map → GraphEngine-MM6ALA2N.js.map} +2 -2
  10. package/dist/react/IconShape-7OPXAKLK.js +10 -0
  11. package/dist/react/ImageShape-LRNJQCF3.js +10 -0
  12. package/dist/react/Line-WWQFBNX5.js +10 -0
  13. package/dist/react/Rectangle-S7XUKWYD.js +9 -0
  14. package/dist/react/{SceneSerializer-ARTKPZVR.js → SceneSerializer-GSJR7ZHC.js} +36 -11
  15. package/dist/react/SceneSerializer-GSJR7ZHC.js.map +7 -0
  16. package/dist/react/{Selection-YJNZRBON.js → Selection-ZL3G6IAO.js} +5 -4
  17. package/dist/react/{SketchEngine-ZGYBIZG7.js → SketchEngine-BFLHJPCG.js} +25 -25
  18. package/dist/react/{UndoRedo-BZ6W4QTV.js → UndoRedo-NL7KLR5B.js} +2 -2
  19. package/dist/react/{ZoomPan-NYPDJBD5.js → ZoomPan-FAWA5OPS.js} +5 -1
  20. package/dist/react/ZoomPan-FAWA5OPS.js.map +7 -0
  21. package/dist/react/{arrowTool-LKFSZKXC.js → arrowTool-CNVGM6RX.js} +3 -3
  22. package/dist/react/{chunk-RFHMFWVR.js → chunk-2FMFOPGW.js} +5 -6
  23. package/dist/react/{chunk-RFHMFWVR.js.map → chunk-2FMFOPGW.js.map} +2 -2
  24. package/dist/react/{chunk-QYNTPZON.js → chunk-2THKDSWW.js} +9 -5
  25. package/dist/react/chunk-2THKDSWW.js.map +7 -0
  26. package/dist/react/{chunk-JOPQ27YH.js → chunk-4BLMNGTR.js} +3 -3
  27. package/dist/react/{chunk-C62SXFBL.js → chunk-4TAS67SL.js} +23 -22
  28. package/dist/react/chunk-4TAS67SL.js.map +7 -0
  29. package/dist/react/{chunk-FV3EPR4L.js → chunk-AH4PWNEB.js} +19 -11
  30. package/dist/react/chunk-AH4PWNEB.js.map +7 -0
  31. package/dist/react/{chunk-XCJOF6BM.js → chunk-FETTJLCV.js} +5 -1
  32. package/dist/react/chunk-FETTJLCV.js.map +7 -0
  33. package/dist/react/{chunk-JJTII2UQ.js → chunk-GC3KTQDA.js} +78 -15
  34. package/dist/react/chunk-GC3KTQDA.js.map +7 -0
  35. package/dist/react/{chunk-2V7G2PLX.js → chunk-GPIYXREE.js} +3 -3
  36. package/dist/react/{chunk-3VSGFP6U.js → chunk-HFQZYCHJ.js} +8 -4
  37. package/dist/react/chunk-HFQZYCHJ.js.map +7 -0
  38. package/dist/react/{chunk-C72OHQLE.js → chunk-ILGAFR56.js} +3 -3
  39. package/dist/react/{chunk-CF7AK4ES.js → chunk-KVAQPCUH.js} +26 -3
  40. package/dist/react/chunk-KVAQPCUH.js.map +7 -0
  41. package/dist/react/{chunk-WEWMB35W.js → chunk-OFGJJKPH.js} +3 -3
  42. package/dist/react/chunk-PAKA6HUX.js +59 -0
  43. package/dist/react/chunk-PAKA6HUX.js.map +7 -0
  44. package/dist/react/{chunk-HKYUJUD7.js → chunk-PXFPPO3R.js} +5 -1
  45. package/dist/react/chunk-PXFPPO3R.js.map +7 -0
  46. package/dist/react/{chunk-6G3ITAS5.js → chunk-SZD7DKYJ.js} +18 -9
  47. package/dist/react/chunk-SZD7DKYJ.js.map +7 -0
  48. package/dist/react/{chunk-N7NZLF6P.js → chunk-TKXKJNTX.js} +5 -1
  49. package/dist/react/chunk-TKXKJNTX.js.map +7 -0
  50. package/dist/react/{chunk-MYYBFZD3.js → chunk-U3TB4KRS.js} +45 -6
  51. package/dist/react/chunk-U3TB4KRS.js.map +7 -0
  52. package/dist/react/{chunk-UQBT7F4K.js → chunk-V2QTYSBK.js} +2 -2
  53. package/dist/react/{chunk-73VA5ALZ.js → chunk-XFQECTTF.js} +48 -19
  54. package/dist/react/chunk-XFQECTTF.js.map +7 -0
  55. package/dist/react/{chunk-O64N5JPO.js → chunk-YF3TK7SC.js} +2 -2
  56. package/dist/react/{circleTool-RDOIMKKV.js → circleTool-KICNRQCI.js} +4 -4
  57. package/dist/react/{codeTool-O2Z7ZXGP.js → codeTool-NCQ73R6M.js} +5 -4
  58. package/dist/react/{frameTool-Z5ZDCX6H.js → frameTool-Y6KB67DO.js} +4 -4
  59. package/dist/react/{freehandTool-AAQCTMVM.js → freehandTool-MMULHCQ7.js} +4 -4
  60. package/dist/react/{iconTool-AUHRLOO2.js → iconTool-LSW2DYGB.js} +5 -4
  61. package/dist/react/{imageTool-DRKDCPUV.js → imageTool-2DSR32RX.js} +5 -4
  62. package/dist/react/index.js +141 -66
  63. package/dist/react/index.js.map +3 -3
  64. package/dist/react/{lineTool-XLOOZE3E.js → lineTool-N5I7IGT7.js} +4 -4
  65. package/dist/react/{rectangleTool-AEYDDJCA.js → rectangleTool-YUT7ZK2E.js} +4 -4
  66. package/dist/react/{textTool-UORBAAJE.js → textTool-IQOYPELP.js} +6 -5
  67. package/package.json +1 -1
  68. package/src/core/CopyPaste.js +34 -4
  69. package/src/core/GraphEngine.js +129 -185
  70. package/src/core/SceneSerializer.js +26 -0
  71. package/src/core/ScreenSpaceControls.js +60 -0
  72. package/src/core/Selection.js +19 -11
  73. package/src/core/UndoRedo.js +47 -3
  74. package/src/core/ZoomPan.js +3 -0
  75. package/src/react/components/canvas/MultiSelectActions.jsx +4 -1
  76. package/src/react/components/sidebars/IconSidebar.jsx +14 -23
  77. package/src/react/components/sidebars/ImageSidebar.jsx +47 -24
  78. package/src/react/store/useUIStore.js +71 -14
  79. package/src/shapes/Circle.js +2 -0
  80. package/src/shapes/Frame.js +26 -2
  81. package/src/shapes/FreehandStroke.js +2 -0
  82. package/src/shapes/IconShape.js +23 -25
  83. package/src/shapes/ImageShape.js +6 -2
  84. package/src/shapes/Rectangle.js +2 -0
  85. package/src/tools/codeTool.js +3 -2
  86. package/src/tools/frameTool.js +19 -9
  87. package/src/tools/iconTool.js +63 -26
  88. package/src/tools/imageTool.js +80 -14
  89. package/src/tools/textTool.js +3 -1
  90. package/dist/react/Circle-QQMKCKFR.js +0 -8
  91. package/dist/react/CopyPaste-JMIXWUUO.js.map +0 -7
  92. package/dist/react/Frame-VADA625S.js +0 -10
  93. package/dist/react/FreehandStroke-BOWDNAVC.js +0 -8
  94. package/dist/react/IconShape-32EYI2MA.js +0 -10
  95. package/dist/react/ImageShape-MYP2DVVH.js +0 -10
  96. package/dist/react/Line-FCCF2BOB.js +0 -10
  97. package/dist/react/Rectangle-MZ6ZB6KM.js +0 -8
  98. package/dist/react/SceneSerializer-ARTKPZVR.js.map +0 -7
  99. package/dist/react/ZoomPan-NYPDJBD5.js.map +0 -7
  100. package/dist/react/chunk-3VSGFP6U.js.map +0 -7
  101. package/dist/react/chunk-6G3ITAS5.js.map +0 -7
  102. package/dist/react/chunk-73VA5ALZ.js.map +0 -7
  103. package/dist/react/chunk-C62SXFBL.js.map +0 -7
  104. package/dist/react/chunk-CF7AK4ES.js.map +0 -7
  105. package/dist/react/chunk-FV3EPR4L.js.map +0 -7
  106. package/dist/react/chunk-HKYUJUD7.js.map +0 -7
  107. package/dist/react/chunk-JJTII2UQ.js.map +0 -7
  108. package/dist/react/chunk-MYYBFZD3.js.map +0 -7
  109. package/dist/react/chunk-N7NZLF6P.js.map +0 -7
  110. package/dist/react/chunk-QYNTPZON.js.map +0 -7
  111. package/dist/react/chunk-XCJOF6BM.js.map +0 -7
  112. /package/dist/react/{Circle-QQMKCKFR.js.map → Circle-6POZCUZD.js.map} +0 -0
  113. /package/dist/react/{Frame-VADA625S.js.map → Frame-RLSMJJSK.js.map} +0 -0
  114. /package/dist/react/{FreehandStroke-BOWDNAVC.js.map → FreehandStroke-U6GYZOM4.js.map} +0 -0
  115. /package/dist/react/{IconShape-32EYI2MA.js.map → IconShape-7OPXAKLK.js.map} +0 -0
  116. /package/dist/react/{ImageShape-MYP2DVVH.js.map → ImageShape-LRNJQCF3.js.map} +0 -0
  117. /package/dist/react/{Line-FCCF2BOB.js.map → Line-WWQFBNX5.js.map} +0 -0
  118. /package/dist/react/{Rectangle-MZ6ZB6KM.js.map → Rectangle-S7XUKWYD.js.map} +0 -0
  119. /package/dist/react/{Selection-YJNZRBON.js.map → Selection-ZL3G6IAO.js.map} +0 -0
  120. /package/dist/react/{SketchEngine-ZGYBIZG7.js.map → SketchEngine-BFLHJPCG.js.map} +0 -0
  121. /package/dist/react/{UndoRedo-BZ6W4QTV.js.map → UndoRedo-NL7KLR5B.js.map} +0 -0
  122. /package/dist/react/{arrowTool-LKFSZKXC.js.map → arrowTool-CNVGM6RX.js.map} +0 -0
  123. /package/dist/react/{chunk-JOPQ27YH.js.map → chunk-4BLMNGTR.js.map} +0 -0
  124. /package/dist/react/{chunk-2V7G2PLX.js.map → chunk-GPIYXREE.js.map} +0 -0
  125. /package/dist/react/{chunk-C72OHQLE.js.map → chunk-ILGAFR56.js.map} +0 -0
  126. /package/dist/react/{chunk-WEWMB35W.js.map → chunk-OFGJJKPH.js.map} +0 -0
  127. /package/dist/react/{chunk-UQBT7F4K.js.map → chunk-V2QTYSBK.js.map} +0 -0
  128. /package/dist/react/{chunk-O64N5JPO.js.map → chunk-YF3TK7SC.js.map} +0 -0
  129. /package/dist/react/{circleTool-RDOIMKKV.js.map → circleTool-KICNRQCI.js.map} +0 -0
  130. /package/dist/react/{codeTool-O2Z7ZXGP.js.map → codeTool-NCQ73R6M.js.map} +0 -0
  131. /package/dist/react/{frameTool-Z5ZDCX6H.js.map → frameTool-Y6KB67DO.js.map} +0 -0
  132. /package/dist/react/{freehandTool-AAQCTMVM.js.map → freehandTool-MMULHCQ7.js.map} +0 -0
  133. /package/dist/react/{iconTool-AUHRLOO2.js.map → iconTool-LSW2DYGB.js.map} +0 -0
  134. /package/dist/react/{imageTool-DRKDCPUV.js.map → imageTool-2DSR32RX.js.map} +0 -0
  135. /package/dist/react/{lineTool-XLOOZE3E.js.map → lineTool-N5I7IGT7.js.map} +0 -0
  136. /package/dist/react/{rectangleTool-AEYDDJCA.js.map → rectangleTool-YUT7ZK2E.js.map} +0 -0
  137. /package/dist/react/{textTool-UORBAAJE.js.map → textTool-IQOYPELP.js.map} +0 -0
@@ -230,171 +230,128 @@ function escapeXml(str) {
230
230
  var NS = "http://www.w3.org/2000/svg";
231
231
  var GRAPH_WIDTH = 600;
232
232
  var GRAPH_HEIGHT = 420;
233
- function renderGraphOnCanvas(equations, settings) {
234
- if (!equations || equations.length === 0) return false;
235
- if (!window.svg || !window.Frame) {
236
- console.error("[GraphEngine] Engine not initialized");
237
- return false;
238
- }
239
- const svgMarkup = renderGraphSVG(equations, {
240
- ...settings,
233
+ var MAX_PLACED_SCREEN_WIDTH = 480;
234
+ var MAX_VIEWPORT_WIDTH_RATIO = 0.68;
235
+ var MAX_VIEWPORT_HEIGHT_RATIO = 0.58;
236
+ function cloneGraphData(equations, settings) {
237
+ return {
238
+ equations: (equations || []).map((equation) => ({
239
+ expression: equation.expression,
240
+ color: equation.color
241
+ })),
242
+ settings: { ...settings || {} }
243
+ };
244
+ }
245
+ function graphSvgDataUrl(svgMarkup) {
246
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgMarkup)}`;
247
+ }
248
+ function refreshGraphImage(shape) {
249
+ if (!shape?._graphData || !shape.element) return false;
250
+ const svgMarkup = renderGraphSVG(shape._graphData.equations, {
251
+ ...shape._graphData.settings,
241
252
  width: GRAPH_WIDTH,
242
253
  height: GRAPH_HEIGHT
243
254
  });
244
255
  if (!svgMarkup) return false;
245
- const vb = window.currentViewBox || { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight };
246
- const vcx = vb.x + vb.width / 2;
247
- const vcy = vb.y + vb.height / 2;
248
- const frameW = GRAPH_WIDTH + 40;
249
- const frameH = GRAPH_HEIGHT + 40;
250
- const frameX = vcx - frameW / 2;
251
- const frameY = vcy - frameH / 2;
252
- const eqLabels = equations.filter((eq) => eq.expression && eq.expression.trim()).map((eq) => eq.expression.trim()).slice(0, 3);
253
- const title = eqLabels.length > 0 ? "Graph: " + eqLabels.join(", ") : "Graph";
256
+ const href = graphSvgDataUrl(svgMarkup);
257
+ shape.element.setAttribute("href", href);
258
+ shape.element.setAttribute("data-href", href);
259
+ return true;
260
+ }
261
+ function hydrateGraphShape(shape, graphData) {
262
+ if (!shape?.element || !graphData) return shape;
263
+ shape._frameType = "graph";
264
+ shape._graphData = cloneGraphData(graphData.equations, graphData.settings);
265
+ shape.uploadStatus = "done";
266
+ shape.element.setAttribute("data-graph-shape", "true");
267
+ shape.element.setAttribute("preserveAspectRatio", "none");
268
+ shape.element.style.cursor = "move";
269
+ shape._refreshGraphImage = () => refreshGraphImage(shape);
270
+ shape.adaptToBackground = () => refreshGraphImage(shape);
271
+ return shape;
272
+ }
273
+ function selectOnlyGraph(shape) {
274
+ if (!shape) return;
275
+ if (window.multiSelection?.selectedShapes?.size) {
276
+ window.multiSelection.clearSelection();
277
+ }
278
+ if (window.currentShape && window.currentShape !== shape && typeof window.currentShape.removeSelection === "function") {
279
+ window.currentShape.removeSelection();
280
+ }
281
+ window.__sketchStoreApi?.setActiveTool?.("select");
282
+ window.currentShape = shape;
283
+ shape.selectShape?.();
284
+ }
285
+ function placedGraphSize(viewBox) {
286
+ const zoom = Math.max(1e-3, Number(window.currentZoom) || 1);
287
+ const byScreen = MAX_PLACED_SCREEN_WIDTH / zoom;
288
+ const byViewportWidth = viewBox.width * MAX_VIEWPORT_WIDTH_RATIO;
289
+ const byViewportHeight = viewBox.height * MAX_VIEWPORT_HEIGHT_RATIO * (GRAPH_WIDTH / GRAPH_HEIGHT);
290
+ const width = Math.max(80 / zoom, Math.min(GRAPH_WIDTH, byScreen, byViewportWidth, byViewportHeight));
291
+ return { width, height: width * (GRAPH_HEIGHT / GRAPH_WIDTH) };
292
+ }
293
+ function renderGraphOnCanvas(equations, settings, existingShape = null) {
294
+ const validEquations = (equations || []).filter((equation) => equation?.expression?.trim());
295
+ if (validEquations.length === 0) return false;
296
+ if (!window.svg || !window.ImageShape) {
297
+ console.error("[GraphEngine] Engine not initialized");
298
+ return false;
299
+ }
300
+ const graphData = cloneGraphData(validEquations, settings);
301
+ if (existingShape?._frameType === "graph" && existingShape.element) {
302
+ hydrateGraphShape(existingShape, graphData);
303
+ if (!refreshGraphImage(existingShape)) return false;
304
+ selectOnlyGraph(existingShape);
305
+ window.__adaptCanvasContrast?.(
306
+ window.getComputedStyle(window.svg).backgroundColor || "#15111f"
307
+ );
308
+ return true;
309
+ }
310
+ const viewBox = window.currentViewBox || {
311
+ x: 0,
312
+ y: 0,
313
+ width: window.innerWidth,
314
+ height: window.innerHeight
315
+ };
316
+ const size = placedGraphSize(viewBox);
317
+ const x = viewBox.x + (viewBox.width - size.width) / 2;
318
+ const y = viewBox.y + (viewBox.height - size.height) / 2;
254
319
  try {
255
- const parser = new DOMParser();
256
- const doc = parser.parseFromString(svgMarkup, "image/svg+xml");
257
- const svgEl = doc.querySelector("svg");
258
- if (!svgEl) return false;
259
- const graphGroup = document.createElementNS(NS, "g");
260
- graphGroup.setAttribute("data-type", "graph-group");
261
- graphGroup.setAttribute("transform", `translate(${frameX + 20}, ${frameY + 20})`);
262
- const defs = svgEl.querySelector("defs");
263
- if (defs) {
264
- const defsClone = defs.cloneNode(true);
265
- window.svg.querySelector("defs")?.appendChild(defsClone.firstChild) || window.svg.insertBefore(defsClone, window.svg.firstChild);
320
+ const image = document.createElementNS(NS, "image");
321
+ image.setAttribute("x", x);
322
+ image.setAttribute("y", y);
323
+ image.setAttribute("width", size.width);
324
+ image.setAttribute("height", size.height);
325
+ image.setAttribute("data-shape-x", x);
326
+ image.setAttribute("data-shape-y", y);
327
+ image.setAttribute("data-shape-width", size.width);
328
+ image.setAttribute("data-shape-height", size.height);
329
+ const graphShape = hydrateGraphShape(new window.ImageShape(image), graphData);
330
+ if (!refreshGraphImage(graphShape)) {
331
+ graphShape.group?.remove();
332
+ return false;
266
333
  }
267
- while (svgEl.childNodes.length > 0) {
268
- const child = svgEl.childNodes[0];
269
- if (child.nodeName === "defs") {
270
- svgEl.removeChild(child);
271
- continue;
272
- }
273
- graphGroup.appendChild(child);
274
- }
275
- window.svg.appendChild(graphGroup);
276
- const graphShape = {
277
- shapeName: "graph",
278
- // first-class shapeName
279
- shapeID: `graph-${Date.now().toString(36)}-${Math.floor(Math.random() * 1e4)}`,
280
- group: graphGroup,
281
- element: graphGroup,
282
- x: frameX + 20,
283
- y: frameY + 20,
284
- width: GRAPH_WIDTH,
285
- height: GRAPH_HEIGHT,
286
- rotation: 0,
287
- isSelected: false,
288
- _selectionRect: null,
289
- _graphData: {
290
- equations: equations.map((eq) => ({ expression: eq.expression, color: eq.color })),
291
- settings: { ...settings }
292
- },
293
- // ── Shape API the engine relies on ────────────────────────
294
- contains(px, py) {
295
- return px >= this.x && px <= this.x + this.width && py >= this.y && py <= this.y + this.height;
296
- },
297
- move(dx, dy) {
298
- this.x += dx;
299
- this.y += dy;
300
- this.group.setAttribute("transform", `translate(${this.x}, ${this.y})`);
301
- this._updateSelectionRect();
302
- },
303
- selectShape() {
304
- this.isSelected = true;
305
- if (this._selectionRect) return;
306
- const r = document.createElementNS(NS, "rect");
307
- r.setAttribute("fill", "none");
308
- r.setAttribute("stroke", "#9b7bf7");
309
- r.setAttribute("stroke-width", "1.5");
310
- r.setAttribute("stroke-dasharray", "4 3");
311
- r.setAttribute("pointer-events", "none");
312
- window.svg.appendChild(r);
313
- this._selectionRect = r;
314
- this._updateSelectionRect();
315
- },
316
- removeSelection() {
317
- this.isSelected = false;
318
- if (this._selectionRect && this._selectionRect.parentNode) {
319
- this._selectionRect.parentNode.removeChild(this._selectionRect);
320
- }
321
- this._selectionRect = null;
322
- },
323
- _updateSelectionRect() {
324
- if (!this._selectionRect) return;
325
- const pad = 4;
326
- this._selectionRect.setAttribute("x", this.x - pad);
327
- this._selectionRect.setAttribute("y", this.y - pad);
328
- this._selectionRect.setAttribute("width", this.width + pad * 2);
329
- this._selectionRect.setAttribute("height", this.height + pad * 2);
330
- },
331
- updateAttachedArrows() {
332
- if (typeof window.updateAttachedArrows === "function") {
333
- window.updateAttachedArrows(this);
334
- }
335
- },
336
- adaptToBackground(background, foreground, muted) {
337
- const ensureContrast = window.__ensureCanvasContrast || ((color) => color);
338
- this.group.querySelectorAll("rect").forEach((rect) => {
339
- const fill = rect.getAttribute("fill");
340
- const stroke = rect.getAttribute("stroke");
341
- if (fill && fill !== "none") rect.setAttribute("fill", background);
342
- if (stroke && stroke !== "none") {
343
- rect.setAttribute("stroke", muted);
344
- rect.setAttribute("stroke-opacity", "0.45");
345
- }
346
- });
347
- this.group.querySelectorAll("line").forEach((line) => {
348
- const width = Number.parseFloat(line.getAttribute("stroke-width") || "1");
349
- line.setAttribute("stroke", foreground);
350
- line.setAttribute("stroke-opacity", width <= 0.5 ? "0.18" : "0.5");
351
- });
352
- this.group.querySelectorAll("path[stroke]").forEach((path) => {
353
- const original = path.dataset.graphColor || path.getAttribute("stroke");
354
- if (!original || original === "none") return;
355
- path.dataset.graphColor = original;
356
- path.setAttribute("stroke", ensureContrast(original, background, 3));
357
- });
358
- this.group.querySelectorAll("circle[fill]").forEach((circle) => {
359
- const original = circle.dataset.graphColor || circle.getAttribute("fill");
360
- if (!original || original === "none") return;
361
- circle.dataset.graphColor = original;
362
- circle.setAttribute("fill", ensureContrast(original, background, 3));
363
- });
364
- this.group.querySelectorAll("text").forEach((text) => {
365
- const original = text.dataset.graphColor || text.getAttribute("fill");
366
- if (original) text.dataset.graphColor = original;
367
- const isAxisLabel = !original || ["#8b949e", "#62627a"].includes(original.toLowerCase());
368
- text.setAttribute("fill", isAxisLabel ? muted : ensureContrast(original, background, 4.5));
369
- });
370
- }
371
- };
372
334
  window.shapes.push(graphShape);
373
- if (window.pushCreateAction) window.pushCreateAction(graphShape);
374
- window.currentShape = graphShape;
375
- graphShape.selectShape();
335
+ window.pushCreateAction?.(graphShape);
336
+ selectOnlyGraph(graphShape);
376
337
  window.__adaptCanvasContrast?.(
377
- window.getComputedStyle(window.svg).backgroundColor || "#13171C"
338
+ window.getComputedStyle(window.svg).backgroundColor || "#15111f"
378
339
  );
379
- } catch (err) {
380
- console.error("[GraphEngine] SVG insertion failed:", err);
340
+ return true;
341
+ } catch (error) {
342
+ console.error("[GraphEngine] SVG insertion failed:", error);
381
343
  return false;
382
344
  }
383
- return true;
384
345
  }
385
346
  function initGraphEngine() {
386
- window.__graphPreview = (equations, settings) => {
387
- return renderGraphPreviewSVG(equations, settings);
388
- };
347
+ window.__graphPreview = (equations, settings) => renderGraphPreviewSVG(equations, settings);
389
348
  window.__graphRenderer = renderGraphOnCanvas;
390
- window.__graphParser = (expr) => {
391
- const fn = parseExpression(expr);
392
- return fn ? true : false;
393
- };
349
+ window.__hydrateGraphShape = hydrateGraphShape;
350
+ window.__graphParser = (expression) => Boolean(parseExpression(expression));
394
351
  window.__graphValidate = isValidExpression;
395
352
  window.__graphColors = GRAPH_COLORS;
396
353
  }
397
354
  export {
398
355
  initGraphEngine
399
356
  };
400
- //# sourceMappingURL=GraphEngine-KQXHNTZQ.js.map
357
+ //# sourceMappingURL=GraphEngine-MM6ALA2N.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/core/GraphRenderer.js", "../../src/core/GraphEngine.js"],
4
- "sourcesContent": ["/* eslint-disable */\n/**\n * GraphRenderer - Renders mathematical equations as SVG graphs.\n * Produces axes, grid, tick labels, and equation curves.\n */\n\nimport { parseExpression } from './GraphMathParser.js';\n\nconst GRAPH_COLORS = [\n '#4A90D9', '#E74C3C', '#2ECC71', '#F39C12', '#9B59B6',\n '#1ABC9C', '#E67E22', '#3498DB', '#E91E63', '#00BCD4',\n];\n\n// Issue #38 follow-up: theme-aware graph chrome. Light mode flips every\n// hardcoded `rgba(255,255,255,X)` token (designed for dark canvas) to a\n// matching `rgba(60,60,80,X)` so the grid, axes, plot border, and tick\n// labels stay readable on the warm off-white canvas. The equation\n// curves themselves keep their colours from GRAPH_COLORS.\nfunction graphThemeTokens() {\n const isDark = typeof document !== 'undefined'\n && document.body\n && document.body.classList.contains('theme-dark');\n if (isDark) {\n return {\n outerBg: '#0d1117',\n plotBg: '#111822',\n gridStroke:'rgba(255,255,255,0.06)',\n axisStroke:'rgba(255,255,255,0.25)',\n borderStroke:'rgba(255,255,255,0.1)',\n tickLabel: '#8b949e',\n };\n }\n return {\n outerBg: '#fbfaf6',\n plotBg: '#ffffff',\n gridStroke:'rgba(60,60,80,0.08)',\n axisStroke:'rgba(60,60,80,0.35)',\n borderStroke:'rgba(60,60,80,0.16)',\n tickLabel: '#62627a',\n };\n}\n\n/**\n * Calculate nice tick intervals for a given range.\n */\nfunction niceInterval(range) {\n const rough = range / 8;\n const mag = Math.pow(10, Math.floor(Math.log10(rough)));\n const residual = rough / mag;\n let nice;\n if (residual <= 1.5) nice = 1;\n else if (residual <= 3) nice = 2;\n else if (residual <= 7) nice = 5;\n else nice = 10;\n return nice * mag;\n}\n\n/**\n * Render graph as SVG markup string.\n * @param {Array} equations - [{expression: string, color: string}]\n * @param {Object} settings - {xMin, xMax, yMin, yMax, showGrid, width, height}\n * @returns {string} SVG markup\n */\nexport function renderGraphSVG(equations, settings) {\n const {\n xMin = -10, xMax = 10,\n yMin = -10, yMax = 10,\n showGrid = true,\n width = 600, height = 400,\n } = settings || {};\n\n const pad = { top: 20, right: 20, bottom: 35, left: 45 };\n const plotW = width - pad.left - pad.right;\n const plotH = height - pad.top - pad.bottom;\n const xRange = xMax - xMin || 1;\n const yRange = yMax - yMin || 1;\n\n // Coordinate transforms\n const toSvgX = (x) => pad.left + ((x - xMin) / xRange) * plotW;\n const toSvgY = (y) => pad.top + ((yMax - y) / yRange) * plotH;\n\n let svg = '';\n const tk = graphThemeTokens();\n\n // Background\n svg += `<rect x=\"0\" y=\"0\" width=\"${width}\" height=\"${height}\" fill=\"${tk.outerBg}\" rx=\"8\" />`;\n svg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"${tk.plotBg}\" />`;\n\n // Grid & ticks\n const xTick = niceInterval(xRange);\n const yTick = niceInterval(yRange);\n\n // Vertical grid lines + x labels\n const xStart = Math.ceil(xMin / xTick) * xTick;\n for (let x = xStart; x <= xMax; x += xTick) {\n const sx = toSvgX(x);\n if (sx < pad.left || sx > pad.left + plotW) continue;\n if (showGrid) {\n svg += `<line x1=\"${sx}\" y1=\"${pad.top}\" x2=\"${sx}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(x) < 1e-10 ? '0' : (Number.isInteger(x) ? x : x.toFixed(1));\n svg += `<text x=\"${sx}\" y=\"${pad.top + plotH + 16}\" text-anchor=\"middle\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n\n // Horizontal grid lines + y labels\n const yStart = Math.ceil(yMin / yTick) * yTick;\n for (let y = yStart; y <= yMax; y += yTick) {\n const sy = toSvgY(y);\n if (sy < pad.top || sy > pad.top + plotH) continue;\n if (showGrid) {\n svg += `<line x1=\"${pad.left}\" y1=\"${sy}\" x2=\"${pad.left + plotW}\" y2=\"${sy}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(y) < 1e-10 ? '0' : (Number.isInteger(y) ? y : y.toFixed(1));\n svg += `<text x=\"${pad.left - 8}\" y=\"${sy + 3}\" text-anchor=\"end\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n\n // Axes\n if (xMin <= 0 && xMax >= 0) {\n const ax = toSvgX(0);\n svg += `<line x1=\"${ax}\" y1=\"${pad.top}\" x2=\"${ax}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n if (yMin <= 0 && yMax >= 0) {\n const ay = toSvgY(0);\n svg += `<line x1=\"${pad.left}\" y1=\"${ay}\" x2=\"${pad.left + plotW}\" y2=\"${ay}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n\n // Plot border\n svg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"none\" stroke=\"${tk.borderStroke}\" stroke-width=\"1\" />`;\n\n // Equations\n const samplesPerPixel = 2;\n const totalSamples = plotW * samplesPerPixel;\n const dx = xRange / totalSamples;\n\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n\n const fn = parseExpression(eq.expression);\n if (!fn) return;\n\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n let pathData = '';\n let drawing = false;\n\n for (let i = 0; i <= totalSamples; i++) {\n const x = xMin + i * dx;\n let y;\n try { y = fn(x); } catch { y = NaN; }\n\n if (!isFinite(y) || isNaN(y) || y < yMin - yRange * 5 || y > yMax + yRange * 5) {\n drawing = false;\n continue;\n }\n\n // Clamp to plot area for rendering\n const clampedY = Math.max(yMin - yRange * 0.5, Math.min(yMax + yRange * 0.5, y));\n const sx = toSvgX(x);\n const sy = toSvgY(clampedY);\n\n if (!drawing) {\n pathData += `M ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n drawing = true;\n } else {\n pathData += `L ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n }\n }\n\n if (pathData) {\n svg += `<path d=\"${pathData.trim()}\" fill=\"none\" stroke=\"${color}\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />`;\n }\n });\n\n // Clip path for plot area\n const clipId = 'graph-clip-' + Date.now();\n const defs = `<defs><clipPath id=\"${clipId}\"><rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" /></clipPath></defs>`;\n\n // Re-wrap: curves should be clipped\n // Rebuild with clip group\n let curves = '';\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n const fn = parseExpression(eq.expression);\n if (!fn) return;\n\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n let pathData = '';\n let drawing = false;\n\n for (let i = 0; i <= totalSamples; i++) {\n const x = xMin + i * dx;\n let y;\n try { y = fn(x); } catch { y = NaN; }\n\n if (!isFinite(y) || isNaN(y)) { drawing = false; continue; }\n\n const sx = toSvgX(x);\n const sy = toSvgY(y);\n\n if (!drawing) {\n pathData += `M ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n drawing = true;\n } else {\n pathData += `L ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n }\n }\n\n if (pathData) {\n curves += `<path d=\"${pathData.trim()}\" fill=\"none\" stroke=\"${color}\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />`;\n }\n });\n\n // Equation legend\n let legendY = pad.top + 12;\n let legend = '';\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n legend += `<circle cx=\"${pad.left + 12}\" cy=\"${legendY}\" r=\"4\" fill=\"${color}\" />`;\n legend += `<text x=\"${pad.left + 22}\" y=\"${legendY + 3}\" fill=\"${color}\" font-size=\"11\" font-family=\"lixCode, monospace\">${escapeXml(eq.expression)}</text>`;\n legendY += 18;\n });\n\n // Remove the non-clipped curves from svg (we added them above for building)\n // Rebuild cleanly\n let cleanSvg = '';\n cleanSvg += `<rect x=\"0\" y=\"0\" width=\"${width}\" height=\"${height}\" fill=\"${tk.outerBg}\" rx=\"8\" />`;\n cleanSvg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"${tk.plotBg}\" />`;\n\n // Grid + ticks (re-add)\n for (let x = xStart; x <= xMax; x += xTick) {\n const sx = toSvgX(x);\n if (sx < pad.left || sx > pad.left + plotW) continue;\n if (showGrid) {\n cleanSvg += `<line x1=\"${sx}\" y1=\"${pad.top}\" x2=\"${sx}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(x) < 1e-10 ? '0' : (Number.isInteger(x) ? x : x.toFixed(1));\n cleanSvg += `<text x=\"${sx}\" y=\"${pad.top + plotH + 16}\" text-anchor=\"middle\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n for (let y = yStart; y <= yMax; y += yTick) {\n const sy = toSvgY(y);\n if (sy < pad.top || sy > pad.top + plotH) continue;\n if (showGrid) {\n cleanSvg += `<line x1=\"${pad.left}\" y1=\"${sy}\" x2=\"${pad.left + plotW}\" y2=\"${sy}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(y) < 1e-10 ? '0' : (Number.isInteger(y) ? y : y.toFixed(1));\n cleanSvg += `<text x=\"${pad.left - 8}\" y=\"${sy + 3}\" text-anchor=\"end\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n // Axes\n if (xMin <= 0 && xMax >= 0) {\n const ax = toSvgX(0);\n cleanSvg += `<line x1=\"${ax}\" y1=\"${pad.top}\" x2=\"${ax}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n if (yMin <= 0 && yMax >= 0) {\n const ay = toSvgY(0);\n cleanSvg += `<line x1=\"${pad.left}\" y1=\"${ay}\" x2=\"${pad.left + plotW}\" y2=\"${ay}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n // Plot border\n cleanSvg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"none\" stroke=\"${tk.borderStroke}\" stroke-width=\"1\" />`;\n\n // Clipped curves\n cleanSvg += `<g clip-path=\"url(#${clipId})\">${curves}</g>`;\n\n // Legend\n cleanSvg += legend;\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${width}\" height=\"${height}\" viewBox=\"0 0 ${width} ${height}\">${defs}${cleanSvg}</svg>`;\n}\n\n/**\n * Generate a preview SVG for the modal.\n */\nexport function renderGraphPreviewSVG(equations, settings) {\n return renderGraphSVG(equations, {\n ...settings,\n width: 520,\n height: 380,\n });\n}\n\nfunction escapeXml(str) {\n return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\n}\n\nexport { GRAPH_COLORS };\n", "/* eslint-disable */\n/**\n * GraphEngine - Bridge between graph rendering and the sketch canvas.\n * Creates Frames containing rendered graph SVG elements.\n */\n\nimport { parseExpression, isValidExpression } from './GraphMathParser.js';\nimport { renderGraphSVG, renderGraphPreviewSVG, GRAPH_COLORS } from './GraphRenderer.js';\n\nconst NS = 'http://www.w3.org/2000/svg';\nconst GRAPH_WIDTH = 600;\nconst GRAPH_HEIGHT = 420;\n\n/**\n * Place a graph on the canvas inside a Frame.\n */\nfunction renderGraphOnCanvas(equations, settings) {\n if (!equations || equations.length === 0) return false;\n if (!window.svg || !window.Frame) {\n console.error('[GraphEngine] Engine not initialized');\n return false;\n }\n\n // Generate full-size SVG\n const svgMarkup = renderGraphSVG(equations, {\n ...settings,\n width: GRAPH_WIDTH,\n height: GRAPH_HEIGHT,\n });\n if (!svgMarkup) return false;\n\n // Viewport center\n const vb = window.currentViewBox || { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight };\n const vcx = vb.x + vb.width / 2;\n const vcy = vb.y + vb.height / 2;\n\n const frameW = GRAPH_WIDTH + 40;\n const frameH = GRAPH_HEIGHT + 40;\n const frameX = vcx - frameW / 2;\n const frameY = vcy - frameH / 2;\n\n // Build title from equations\n const eqLabels = equations\n .filter(eq => eq.expression && eq.expression.trim())\n .map(eq => eq.expression.trim())\n .slice(0, 3);\n const title = eqLabels.length > 0\n ? 'Graph: ' + eqLabels.join(', ')\n : 'Graph';\n\n // Phase 5 (issue #22): no wrapper frame. The graph is conceptually a\n // single rendering \u2014 axes, grid, curves all interlocked \u2014 so we don't\n // split it into per-curve shapes. Instead the graph becomes ONE\n // first-class shape on the canvas: a `graphShape` that implements the\n // shape API the engine relies on (contains / selectShape / etc.) so\n // it can be selected, dragged, attached to by arrows, picked up by\n // the rect-drag \u2014 exactly like a user-drawn shape.\n try {\n const parser = new DOMParser();\n const doc = parser.parseFromString(svgMarkup, 'image/svg+xml');\n const svgEl = doc.querySelector('svg');\n if (!svgEl) return false;\n\n const graphGroup = document.createElementNS(NS, 'g');\n graphGroup.setAttribute('data-type', 'graph-group');\n graphGroup.setAttribute('transform', `translate(${frameX + 20}, ${frameY + 20})`);\n\n // Copy defs (clip paths)\n const defs = svgEl.querySelector('defs');\n if (defs) {\n const defsClone = defs.cloneNode(true);\n window.svg.querySelector('defs')?.appendChild(defsClone.firstChild) ||\n window.svg.insertBefore(defsClone, window.svg.firstChild);\n }\n\n while (svgEl.childNodes.length > 0) {\n const child = svgEl.childNodes[0];\n if (child.nodeName === 'defs') { svgEl.removeChild(child); continue; }\n graphGroup.appendChild(child);\n }\n window.svg.appendChild(graphGroup);\n\n const graphShape = {\n shapeName: 'graph', // first-class shapeName\n shapeID: `graph-${Date.now().toString(36)}-${Math.floor(Math.random() * 10000)}`,\n group: graphGroup,\n element: graphGroup,\n x: frameX + 20,\n y: frameY + 20,\n width: GRAPH_WIDTH,\n height: GRAPH_HEIGHT,\n rotation: 0,\n isSelected: false,\n _selectionRect: null,\n _graphData: {\n equations: equations.map(eq => ({ expression: eq.expression, color: eq.color })),\n settings: { ...settings },\n },\n\n // \u2500\u2500 Shape API the engine relies on \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n contains(px, py) {\n return px >= this.x && px <= this.x + this.width\n && py >= this.y && py <= this.y + this.height;\n },\n move(dx, dy) {\n this.x += dx; this.y += dy;\n this.group.setAttribute('transform', `translate(${this.x}, ${this.y})`);\n this._updateSelectionRect();\n },\n selectShape() {\n this.isSelected = true;\n if (this._selectionRect) return;\n const r = document.createElementNS(NS, 'rect');\n r.setAttribute('fill', 'none');\n r.setAttribute('stroke', '#9b7bf7');\n r.setAttribute('stroke-width', '1.5');\n r.setAttribute('stroke-dasharray', '4 3');\n r.setAttribute('pointer-events', 'none');\n window.svg.appendChild(r);\n this._selectionRect = r;\n this._updateSelectionRect();\n },\n removeSelection() {\n this.isSelected = false;\n if (this._selectionRect && this._selectionRect.parentNode) {\n this._selectionRect.parentNode.removeChild(this._selectionRect);\n }\n this._selectionRect = null;\n },\n _updateSelectionRect() {\n if (!this._selectionRect) return;\n const pad = 4;\n this._selectionRect.setAttribute('x', this.x - pad);\n this._selectionRect.setAttribute('y', this.y - pad);\n this._selectionRect.setAttribute('width', this.width + pad * 2);\n this._selectionRect.setAttribute('height', this.height + pad * 2);\n },\n updateAttachedArrows() {\n if (typeof window.updateAttachedArrows === 'function') {\n window.updateAttachedArrows(this);\n }\n },\n adaptToBackground(background, foreground, muted) {\n const ensureContrast = window.__ensureCanvasContrast || ((color) => color);\n\n this.group.querySelectorAll('rect').forEach((rect) => {\n const fill = rect.getAttribute('fill');\n const stroke = rect.getAttribute('stroke');\n if (fill && fill !== 'none') rect.setAttribute('fill', background);\n if (stroke && stroke !== 'none') {\n rect.setAttribute('stroke', muted);\n rect.setAttribute('stroke-opacity', '0.45');\n }\n });\n\n this.group.querySelectorAll('line').forEach((line) => {\n const width = Number.parseFloat(line.getAttribute('stroke-width') || '1');\n line.setAttribute('stroke', foreground);\n line.setAttribute('stroke-opacity', width <= 0.5 ? '0.18' : '0.5');\n });\n\n this.group.querySelectorAll('path[stroke]').forEach((path) => {\n const original = path.dataset.graphColor || path.getAttribute('stroke');\n if (!original || original === 'none') return;\n path.dataset.graphColor = original;\n path.setAttribute('stroke', ensureContrast(original, background, 3));\n });\n\n this.group.querySelectorAll('circle[fill]').forEach((circle) => {\n const original = circle.dataset.graphColor || circle.getAttribute('fill');\n if (!original || original === 'none') return;\n circle.dataset.graphColor = original;\n circle.setAttribute('fill', ensureContrast(original, background, 3));\n });\n\n this.group.querySelectorAll('text').forEach((text) => {\n const original = text.dataset.graphColor || text.getAttribute('fill');\n if (original) text.dataset.graphColor = original;\n const isAxisLabel = !original || ['#8b949e', '#62627a'].includes(original.toLowerCase());\n text.setAttribute('fill', isAxisLabel\n ? muted\n : ensureContrast(original, background, 4.5));\n });\n },\n };\n\n window.shapes.push(graphShape);\n if (window.pushCreateAction) window.pushCreateAction(graphShape);\n\n // Auto-select so the user sees something landed.\n window.currentShape = graphShape;\n graphShape.selectShape();\n window.__adaptCanvasContrast?.(\n window.getComputedStyle(window.svg).backgroundColor || '#13171C'\n );\n } catch (err) {\n console.error('[GraphEngine] SVG insertion failed:', err);\n return false;\n }\n\n return true;\n}\n\n/**\n * Initialize the graph engine \u2014 expose bridge functions on window.\n */\nexport function initGraphEngine() {\n window.__graphPreview = (equations, settings) => {\n return renderGraphPreviewSVG(equations, settings);\n };\n window.__graphRenderer = renderGraphOnCanvas;\n window.__graphParser = (expr) => {\n const fn = parseExpression(expr);\n return fn ? true : false;\n };\n window.__graphValidate = isValidExpression;\n window.__graphColors = GRAPH_COLORS;\n}\n"],
5
- "mappings": ";;;;;;;AAQA,IAAM,eAAe;AAAA,EACjB;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAC5C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MACL;AAAA,IACJ;AAEA,WAAO,OAAO,KAAK,UAAU;AAC7B,QAAI,OAAO,iBAAkB,QAAO,iBAAiB,UAAU;AAG/D,WAAO,eAAe;AACtB,eAAW,YAAY;AACvB,WAAO;AAAA,MACH,OAAO,iBAAiB,OAAO,GAAG,EAAE,mBAAmB;AAAA,IAC3D;AAAA,EACJ,SAAS,KAAK;AACV,YAAQ,MAAM,uCAAuC,GAAG;AACxD,WAAO;AAAA,EACX;AAEA,SAAO;AACX;AAKO,SAAS,kBAAkB;AAC9B,SAAO,iBAAiB,CAAC,WAAW,aAAa;AAC7C,WAAO,sBAAsB,WAAW,QAAQ;AAAA,EACpD;AACA,SAAO,kBAAkB;AACzB,SAAO,gBAAgB,CAAC,SAAS;AAC7B,UAAM,KAAK,gBAAgB,IAAI;AAC/B,WAAO,KAAK,OAAO;AAAA,EACvB;AACA,SAAO,kBAAkB;AACzB,SAAO,gBAAgB;AAC3B;",
4
+ "sourcesContent": ["/* eslint-disable */\n/**\n * GraphRenderer - Renders mathematical equations as SVG graphs.\n * Produces axes, grid, tick labels, and equation curves.\n */\n\nimport { parseExpression } from './GraphMathParser.js';\n\nconst GRAPH_COLORS = [\n '#4A90D9', '#E74C3C', '#2ECC71', '#F39C12', '#9B59B6',\n '#1ABC9C', '#E67E22', '#3498DB', '#E91E63', '#00BCD4',\n];\n\n// Issue #38 follow-up: theme-aware graph chrome. Light mode flips every\n// hardcoded `rgba(255,255,255,X)` token (designed for dark canvas) to a\n// matching `rgba(60,60,80,X)` so the grid, axes, plot border, and tick\n// labels stay readable on the warm off-white canvas. The equation\n// curves themselves keep their colours from GRAPH_COLORS.\nfunction graphThemeTokens() {\n const isDark = typeof document !== 'undefined'\n && document.body\n && document.body.classList.contains('theme-dark');\n if (isDark) {\n return {\n outerBg: '#0d1117',\n plotBg: '#111822',\n gridStroke:'rgba(255,255,255,0.06)',\n axisStroke:'rgba(255,255,255,0.25)',\n borderStroke:'rgba(255,255,255,0.1)',\n tickLabel: '#8b949e',\n };\n }\n return {\n outerBg: '#fbfaf6',\n plotBg: '#ffffff',\n gridStroke:'rgba(60,60,80,0.08)',\n axisStroke:'rgba(60,60,80,0.35)',\n borderStroke:'rgba(60,60,80,0.16)',\n tickLabel: '#62627a',\n };\n}\n\n/**\n * Calculate nice tick intervals for a given range.\n */\nfunction niceInterval(range) {\n const rough = range / 8;\n const mag = Math.pow(10, Math.floor(Math.log10(rough)));\n const residual = rough / mag;\n let nice;\n if (residual <= 1.5) nice = 1;\n else if (residual <= 3) nice = 2;\n else if (residual <= 7) nice = 5;\n else nice = 10;\n return nice * mag;\n}\n\n/**\n * Render graph as SVG markup string.\n * @param {Array} equations - [{expression: string, color: string}]\n * @param {Object} settings - {xMin, xMax, yMin, yMax, showGrid, width, height}\n * @returns {string} SVG markup\n */\nexport function renderGraphSVG(equations, settings) {\n const {\n xMin = -10, xMax = 10,\n yMin = -10, yMax = 10,\n showGrid = true,\n width = 600, height = 400,\n } = settings || {};\n\n const pad = { top: 20, right: 20, bottom: 35, left: 45 };\n const plotW = width - pad.left - pad.right;\n const plotH = height - pad.top - pad.bottom;\n const xRange = xMax - xMin || 1;\n const yRange = yMax - yMin || 1;\n\n // Coordinate transforms\n const toSvgX = (x) => pad.left + ((x - xMin) / xRange) * plotW;\n const toSvgY = (y) => pad.top + ((yMax - y) / yRange) * plotH;\n\n let svg = '';\n const tk = graphThemeTokens();\n\n // Background\n svg += `<rect x=\"0\" y=\"0\" width=\"${width}\" height=\"${height}\" fill=\"${tk.outerBg}\" rx=\"8\" />`;\n svg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"${tk.plotBg}\" />`;\n\n // Grid & ticks\n const xTick = niceInterval(xRange);\n const yTick = niceInterval(yRange);\n\n // Vertical grid lines + x labels\n const xStart = Math.ceil(xMin / xTick) * xTick;\n for (let x = xStart; x <= xMax; x += xTick) {\n const sx = toSvgX(x);\n if (sx < pad.left || sx > pad.left + plotW) continue;\n if (showGrid) {\n svg += `<line x1=\"${sx}\" y1=\"${pad.top}\" x2=\"${sx}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(x) < 1e-10 ? '0' : (Number.isInteger(x) ? x : x.toFixed(1));\n svg += `<text x=\"${sx}\" y=\"${pad.top + plotH + 16}\" text-anchor=\"middle\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n\n // Horizontal grid lines + y labels\n const yStart = Math.ceil(yMin / yTick) * yTick;\n for (let y = yStart; y <= yMax; y += yTick) {\n const sy = toSvgY(y);\n if (sy < pad.top || sy > pad.top + plotH) continue;\n if (showGrid) {\n svg += `<line x1=\"${pad.left}\" y1=\"${sy}\" x2=\"${pad.left + plotW}\" y2=\"${sy}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(y) < 1e-10 ? '0' : (Number.isInteger(y) ? y : y.toFixed(1));\n svg += `<text x=\"${pad.left - 8}\" y=\"${sy + 3}\" text-anchor=\"end\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n\n // Axes\n if (xMin <= 0 && xMax >= 0) {\n const ax = toSvgX(0);\n svg += `<line x1=\"${ax}\" y1=\"${pad.top}\" x2=\"${ax}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n if (yMin <= 0 && yMax >= 0) {\n const ay = toSvgY(0);\n svg += `<line x1=\"${pad.left}\" y1=\"${ay}\" x2=\"${pad.left + plotW}\" y2=\"${ay}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n\n // Plot border\n svg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"none\" stroke=\"${tk.borderStroke}\" stroke-width=\"1\" />`;\n\n // Equations\n const samplesPerPixel = 2;\n const totalSamples = plotW * samplesPerPixel;\n const dx = xRange / totalSamples;\n\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n\n const fn = parseExpression(eq.expression);\n if (!fn) return;\n\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n let pathData = '';\n let drawing = false;\n\n for (let i = 0; i <= totalSamples; i++) {\n const x = xMin + i * dx;\n let y;\n try { y = fn(x); } catch { y = NaN; }\n\n if (!isFinite(y) || isNaN(y) || y < yMin - yRange * 5 || y > yMax + yRange * 5) {\n drawing = false;\n continue;\n }\n\n // Clamp to plot area for rendering\n const clampedY = Math.max(yMin - yRange * 0.5, Math.min(yMax + yRange * 0.5, y));\n const sx = toSvgX(x);\n const sy = toSvgY(clampedY);\n\n if (!drawing) {\n pathData += `M ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n drawing = true;\n } else {\n pathData += `L ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n }\n }\n\n if (pathData) {\n svg += `<path d=\"${pathData.trim()}\" fill=\"none\" stroke=\"${color}\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />`;\n }\n });\n\n // Clip path for plot area\n const clipId = 'graph-clip-' + Date.now();\n const defs = `<defs><clipPath id=\"${clipId}\"><rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" /></clipPath></defs>`;\n\n // Re-wrap: curves should be clipped\n // Rebuild with clip group\n let curves = '';\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n const fn = parseExpression(eq.expression);\n if (!fn) return;\n\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n let pathData = '';\n let drawing = false;\n\n for (let i = 0; i <= totalSamples; i++) {\n const x = xMin + i * dx;\n let y;\n try { y = fn(x); } catch { y = NaN; }\n\n if (!isFinite(y) || isNaN(y)) { drawing = false; continue; }\n\n const sx = toSvgX(x);\n const sy = toSvgY(y);\n\n if (!drawing) {\n pathData += `M ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n drawing = true;\n } else {\n pathData += `L ${sx.toFixed(1)} ${sy.toFixed(1)} `;\n }\n }\n\n if (pathData) {\n curves += `<path d=\"${pathData.trim()}\" fill=\"none\" stroke=\"${color}\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />`;\n }\n });\n\n // Equation legend\n let legendY = pad.top + 12;\n let legend = '';\n equations.forEach((eq, eqIdx) => {\n if (!eq.expression || !eq.expression.trim()) return;\n const color = eq.color || GRAPH_COLORS[eqIdx % GRAPH_COLORS.length];\n legend += `<circle cx=\"${pad.left + 12}\" cy=\"${legendY}\" r=\"4\" fill=\"${color}\" />`;\n legend += `<text x=\"${pad.left + 22}\" y=\"${legendY + 3}\" fill=\"${color}\" font-size=\"11\" font-family=\"lixCode, monospace\">${escapeXml(eq.expression)}</text>`;\n legendY += 18;\n });\n\n // Remove the non-clipped curves from svg (we added them above for building)\n // Rebuild cleanly\n let cleanSvg = '';\n cleanSvg += `<rect x=\"0\" y=\"0\" width=\"${width}\" height=\"${height}\" fill=\"${tk.outerBg}\" rx=\"8\" />`;\n cleanSvg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"${tk.plotBg}\" />`;\n\n // Grid + ticks (re-add)\n for (let x = xStart; x <= xMax; x += xTick) {\n const sx = toSvgX(x);\n if (sx < pad.left || sx > pad.left + plotW) continue;\n if (showGrid) {\n cleanSvg += `<line x1=\"${sx}\" y1=\"${pad.top}\" x2=\"${sx}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(x) < 1e-10 ? '0' : (Number.isInteger(x) ? x : x.toFixed(1));\n cleanSvg += `<text x=\"${sx}\" y=\"${pad.top + plotH + 16}\" text-anchor=\"middle\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n for (let y = yStart; y <= yMax; y += yTick) {\n const sy = toSvgY(y);\n if (sy < pad.top || sy > pad.top + plotH) continue;\n if (showGrid) {\n cleanSvg += `<line x1=\"${pad.left}\" y1=\"${sy}\" x2=\"${pad.left + plotW}\" y2=\"${sy}\" stroke=\"${tk.gridStroke}\" stroke-width=\"0.5\" />`;\n }\n const label = Math.abs(y) < 1e-10 ? '0' : (Number.isInteger(y) ? y : y.toFixed(1));\n cleanSvg += `<text x=\"${pad.left - 8}\" y=\"${sy + 3}\" text-anchor=\"end\" fill=\"${tk.tickLabel}\" font-size=\"10\" font-family=\"lixCode, monospace\">${label}</text>`;\n }\n // Axes\n if (xMin <= 0 && xMax >= 0) {\n const ax = toSvgX(0);\n cleanSvg += `<line x1=\"${ax}\" y1=\"${pad.top}\" x2=\"${ax}\" y2=\"${pad.top + plotH}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n if (yMin <= 0 && yMax >= 0) {\n const ay = toSvgY(0);\n cleanSvg += `<line x1=\"${pad.left}\" y1=\"${ay}\" x2=\"${pad.left + plotW}\" y2=\"${ay}\" stroke=\"${tk.axisStroke}\" stroke-width=\"1\" />`;\n }\n // Plot border\n cleanSvg += `<rect x=\"${pad.left}\" y=\"${pad.top}\" width=\"${plotW}\" height=\"${plotH}\" fill=\"none\" stroke=\"${tk.borderStroke}\" stroke-width=\"1\" />`;\n\n // Clipped curves\n cleanSvg += `<g clip-path=\"url(#${clipId})\">${curves}</g>`;\n\n // Legend\n cleanSvg += legend;\n\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${width}\" height=\"${height}\" viewBox=\"0 0 ${width} ${height}\">${defs}${cleanSvg}</svg>`;\n}\n\n/**\n * Generate a preview SVG for the modal.\n */\nexport function renderGraphPreviewSVG(equations, settings) {\n return renderGraphSVG(equations, {\n ...settings,\n width: 520,\n height: 380,\n });\n}\n\nfunction escapeXml(str) {\n return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;');\n}\n\nexport { GRAPH_COLORS };\n", "/* eslint-disable */\n/**\n * GraphEngine - bridge between graph rendering and the sketch canvas.\n *\n * Canvas graphs use ImageShape with an SVG data URL. This keeps the graph a\n * single crisp vector element while reusing the engine's established select,\n * translate, resize, rotate, copy/paste, and frame-containment behaviour.\n */\n\nimport { parseExpression, isValidExpression } from './GraphMathParser.js';\nimport { renderGraphSVG, renderGraphPreviewSVG, GRAPH_COLORS } from './GraphRenderer.js';\n\nconst NS = 'http://www.w3.org/2000/svg';\nconst GRAPH_WIDTH = 600;\nconst GRAPH_HEIGHT = 420;\nconst MAX_PLACED_SCREEN_WIDTH = 480;\nconst MAX_VIEWPORT_WIDTH_RATIO = 0.68;\nconst MAX_VIEWPORT_HEIGHT_RATIO = 0.58;\n\nfunction cloneGraphData(equations, settings) {\n return {\n equations: (equations || []).map((equation) => ({\n expression: equation.expression,\n color: equation.color,\n })),\n settings: { ...(settings || {}) },\n };\n}\n\nfunction graphSvgDataUrl(svgMarkup) {\n return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgMarkup)}`;\n}\n\nfunction refreshGraphImage(shape) {\n if (!shape?._graphData || !shape.element) return false;\n const svgMarkup = renderGraphSVG(shape._graphData.equations, {\n ...shape._graphData.settings,\n width: GRAPH_WIDTH,\n height: GRAPH_HEIGHT,\n });\n if (!svgMarkup) return false;\n const href = graphSvgDataUrl(svgMarkup);\n shape.element.setAttribute('href', href);\n shape.element.setAttribute('data-href', href);\n return true;\n}\n\n/** Attach graph behaviour to a regular ImageShape, including restored and\n * pasted graphs. The function is intentionally idempotent. */\nfunction hydrateGraphShape(shape, graphData) {\n if (!shape?.element || !graphData) return shape;\n shape._frameType = 'graph';\n shape._graphData = cloneGraphData(graphData.equations, graphData.settings);\n shape.uploadStatus = 'done';\n shape.element.setAttribute('data-graph-shape', 'true');\n shape.element.setAttribute('preserveAspectRatio', 'none');\n shape.element.style.cursor = 'move';\n shape._refreshGraphImage = () => refreshGraphImage(shape);\n shape.adaptToBackground = () => refreshGraphImage(shape);\n return shape;\n}\n\nfunction selectOnlyGraph(shape) {\n if (!shape) return;\n\n if (window.multiSelection?.selectedShapes?.size) {\n window.multiSelection.clearSelection();\n }\n if (window.currentShape && window.currentShape !== shape\n && typeof window.currentShape.removeSelection === 'function') {\n window.currentShape.removeSelection();\n }\n\n // Generated content always lands ready to manipulate. Use the store bridge\n // so the toolbar and legacy engine flags change together.\n window.__sketchStoreApi?.setActiveTool?.('select');\n window.currentShape = shape;\n shape.selectShape?.();\n}\n\nfunction placedGraphSize(viewBox) {\n const zoom = Math.max(0.001, Number(window.currentZoom) || 1);\n const byScreen = MAX_PLACED_SCREEN_WIDTH / zoom;\n const byViewportWidth = viewBox.width * MAX_VIEWPORT_WIDTH_RATIO;\n const byViewportHeight = viewBox.height * MAX_VIEWPORT_HEIGHT_RATIO * (GRAPH_WIDTH / GRAPH_HEIGHT);\n const width = Math.max(80 / zoom, Math.min(GRAPH_WIDTH, byScreen, byViewportWidth, byViewportHeight));\n return { width, height: width * (GRAPH_HEIGHT / GRAPH_WIDTH) };\n}\n\n/**\n * Place a graph as one editable vector-image shape, or update an existing\n * graph in place without losing its canvas position, size, or rotation.\n */\nfunction renderGraphOnCanvas(equations, settings, existingShape = null) {\n const validEquations = (equations || []).filter((equation) => equation?.expression?.trim());\n if (validEquations.length === 0) return false;\n if (!window.svg || !window.ImageShape) {\n console.error('[GraphEngine] Engine not initialized');\n return false;\n }\n\n const graphData = cloneGraphData(validEquations, settings);\n\n if (existingShape?._frameType === 'graph' && existingShape.element) {\n hydrateGraphShape(existingShape, graphData);\n if (!refreshGraphImage(existingShape)) return false;\n selectOnlyGraph(existingShape);\n window.__adaptCanvasContrast?.(\n window.getComputedStyle(window.svg).backgroundColor || '#15111f'\n );\n return true;\n }\n\n const viewBox = window.currentViewBox || {\n x: 0,\n y: 0,\n width: window.innerWidth,\n height: window.innerHeight,\n };\n const size = placedGraphSize(viewBox);\n const x = viewBox.x + (viewBox.width - size.width) / 2;\n const y = viewBox.y + (viewBox.height - size.height) / 2;\n\n try {\n const image = document.createElementNS(NS, 'image');\n image.setAttribute('x', x);\n image.setAttribute('y', y);\n image.setAttribute('width', size.width);\n image.setAttribute('height', size.height);\n image.setAttribute('data-shape-x', x);\n image.setAttribute('data-shape-y', y);\n image.setAttribute('data-shape-width', size.width);\n image.setAttribute('data-shape-height', size.height);\n\n const graphShape = hydrateGraphShape(new window.ImageShape(image), graphData);\n if (!refreshGraphImage(graphShape)) {\n graphShape.group?.remove();\n return false;\n }\n\n window.shapes.push(graphShape);\n window.pushCreateAction?.(graphShape);\n selectOnlyGraph(graphShape);\n window.__adaptCanvasContrast?.(\n window.getComputedStyle(window.svg).backgroundColor || '#15111f'\n );\n return true;\n } catch (error) {\n console.error('[GraphEngine] SVG insertion failed:', error);\n return false;\n }\n}\n\n/** Initialize graph bridges used by the modal and scene restoration. */\nexport function initGraphEngine() {\n window.__graphPreview = (equations, settings) => renderGraphPreviewSVG(equations, settings);\n window.__graphRenderer = renderGraphOnCanvas;\n window.__hydrateGraphShape = hydrateGraphShape;\n window.__graphParser = (expression) => Boolean(parseExpression(expression));\n window.__graphValidate = isValidExpression;\n window.__graphColors = GRAPH_COLORS;\n}\n"],
5
+ "mappings": ";;;;;;;AAQA,IAAM,eAAe;AAAA,EACjB;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAC5C;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAChD;AAOA,SAAS,mBAAmB;AACxB,QAAM,SAAS,OAAO,aAAa,eAC5B,SAAS,QACT,SAAS,KAAK,UAAU,SAAS,YAAY;AACpD,MAAI,QAAQ;AACR,WAAO;AAAA,MACH,SAAW;AAAA,MACX,QAAW;AAAA,MACX,YAAW;AAAA,MACX,YAAW;AAAA,MACX,cAAa;AAAA,MACb,WAAW;AAAA,IACf;AAAA,EACJ;AACA,SAAO;A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,IAAI,QAAQ,KAAK,QAAQ,SAAS,KAAK,UAAU;AAEvD,MAAI;AACA,UAAM,QAAQ,SAAS,gBAAgB,IAAI,OAAO;AAClD,UAAM,aAAa,KAAK,CAAC;AACzB,UAAM,aAAa,KAAK,CAAC;AACzB,UAAM,aAAa,SAAS,KAAK,KAAK;AACtC,UAAM,aAAa,UAAU,KAAK,MAAM;AACxC,UAAM,aAAa,gBAAgB,CAAC;AACpC,UAAM,aAAa,gBAAgB,CAAC;AACpC,UAAM,aAAa,oBAAoB,KAAK,KAAK;AACjD,UAAM,aAAa,qBAAqB,KAAK,MAAM;AAEnD,UAAM,aAAa,kBAAkB,IAAI,OAAO,WAAW,KAAK,GAAG,SAAS;AAC5E,QAAI,CAAC,kBAAkB,UAAU,GAAG;AAChC,iBAAW,OAAO,OAAO;AACzB,aAAO;AAAA,IACX;AAEA,WAAO,OAAO,KAAK,UAAU;AAC7B,WAAO,mBAAmB,UAAU;AACpC,oBAAgB,UAAU;AAC1B,WAAO;AAAA,MACH,OAAO,iBAAiB,OAAO,GAAG,EAAE,mBAAmB;AAAA,IAC3D;AACA,WAAO;AAAA,EACX,SAAS,OAAO;AACZ,YAAQ,MAAM,uCAAuC,KAAK;AAC1D,WAAO;AAAA,EACX;AACJ;AAGO,SAAS,kBAAkB;AAC9B,SAAO,iBAAiB,CAAC,WAAW,aAAa,sBAAsB,WAAW,QAAQ;AAC1F,SAAO,kBAAkB;AACzB,SAAO,sBAAsB;AAC7B,SAAO,gBAAgB,CAAC,eAAe,QAAQ,gBAAgB,UAAU,CAAC;AAC1E,SAAO,kBAAkB;AACzB,SAAO,gBAAgB;AAC3B;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ IconShape
4
+ } from "./chunk-4TAS67SL.js";
5
+ import "./chunk-YF3TK7SC.js";
6
+ import "./chunk-U3TB4KRS.js";
7
+ export {
8
+ IconShape
9
+ };
10
+ //# sourceMappingURL=IconShape-7OPXAKLK.js.map
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ ImageShape
4
+ } from "./chunk-2FMFOPGW.js";
5
+ import "./chunk-YF3TK7SC.js";
6
+ import "./chunk-U3TB4KRS.js";
7
+ export {
8
+ ImageShape
9
+ };
10
+ //# sourceMappingURL=ImageShape-LRNJQCF3.js.map
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ Line
4
+ } from "./chunk-V2QTYSBK.js";
5
+ import "./chunk-YF3TK7SC.js";
6
+ import "./chunk-U3TB4KRS.js";
7
+ export {
8
+ Line
9
+ };
10
+ //# sourceMappingURL=Line-WWQFBNX5.js.map
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import {
3
+ Rectangle
4
+ } from "./chunk-FETTJLCV.js";
5
+ import "./chunk-PAKA6HUX.js";
6
+ export {
7
+ Rectangle
8
+ };
9
+ //# sourceMappingURL=Rectangle-S7XUKWYD.js.map
@@ -4,30 +4,31 @@ import {
4
4
  } from "./chunk-MB7VS6MK.js";
5
5
  import {
6
6
  ImageShape
7
- } from "./chunk-RFHMFWVR.js";
7
+ } from "./chunk-2FMFOPGW.js";
8
8
  import {
9
9
  IconShape
10
- } from "./chunk-C62SXFBL.js";
10
+ } from "./chunk-4TAS67SL.js";
11
11
  import {
12
12
  Frame
13
- } from "./chunk-CF7AK4ES.js";
13
+ } from "./chunk-KVAQPCUH.js";
14
14
  import {
15
15
  FreehandStroke
16
- } from "./chunk-HKYUJUD7.js";
16
+ } from "./chunk-PXFPPO3R.js";
17
17
  import {
18
18
  Rectangle
19
- } from "./chunk-XCJOF6BM.js";
19
+ } from "./chunk-FETTJLCV.js";
20
20
  import {
21
21
  Circle
22
- } from "./chunk-N7NZLF6P.js";
22
+ } from "./chunk-TKXKJNTX.js";
23
+ import "./chunk-PAKA6HUX.js";
23
24
  import {
24
25
  Arrow
25
26
  } from "./chunk-BT2EIJD4.js";
26
27
  import {
27
28
  Line
28
- } from "./chunk-UQBT7F4K.js";
29
- import "./chunk-O64N5JPO.js";
30
- import "./chunk-MYYBFZD3.js";
29
+ } from "./chunk-V2QTYSBK.js";
30
+ import "./chunk-YF3TK7SC.js";
31
+ import "./chunk-U3TB4KRS.js";
31
32
  import {
32
33
  TextShape
33
34
  } from "./chunk-PGT3TJOW.js";
@@ -179,7 +180,13 @@ function serializeShape(shape) {
179
180
  width: shape.width,
180
181
  height: shape.height,
181
182
  rotation: shape.rotation,
182
- href: el.getAttribute("href") || el.getAttributeNS("http://www.w3.org/1999/xlink", "href") || ""
183
+ href: el.getAttribute("href") || el.getAttributeNS("http://www.w3.org/1999/xlink", "href") || "",
184
+ sizeBytes: Number(el.__fileSize || el.getAttribute("data-file-size")) || 0,
185
+ cloudinaryId: el.getAttribute("data-cloudinary-id") || null,
186
+ storageProvider: el.getAttribute("data-storage-provider") || "platform_cloudinary",
187
+ storageCloudName: el.getAttribute("data-storage-cloud-name") || null,
188
+ frameType: shape._frameType || null,
189
+ graphData: shape._frameType === "graph" && shape._graphData ? cloneOptions(shape._graphData) : null
183
190
  };
184
191
  }
185
192
  case "icon": {
@@ -287,10 +294,27 @@ function deserializeShape(data) {
287
294
  imgEl.setAttribute("height", data.height);
288
295
  imgEl.setAttribute("href", data.href);
289
296
  imgEl.setAttribute("preserveAspectRatio", "none");
297
+ if (data.sizeBytes) {
298
+ imgEl.__fileSize = Number(data.sizeBytes) || 0;
299
+ imgEl.setAttribute("data-file-size", String(imgEl.__fileSize));
300
+ window.__roomImageBytesUsed = (window.__roomImageBytesUsed || 0) + imgEl.__fileSize;
301
+ }
302
+ if (data.cloudinaryId) imgEl.setAttribute("data-cloudinary-id", data.cloudinaryId);
303
+ if (data.storageProvider) imgEl.setAttribute("data-storage-provider", data.storageProvider);
304
+ if (data.storageCloudName) imgEl.setAttribute("data-storage-cloud-name", data.storageCloudName);
290
305
  svgEl.appendChild(imgEl);
291
306
  const shape = new ImageShape(imgEl);
292
307
  if (data.rotation) shape.rotation = data.rotation;
293
308
  if (data.shapeID) shape.shapeID = data.shapeID;
309
+ if (data.frameType === "graph" && data.graphData) {
310
+ if (typeof window.__hydrateGraphShape === "function") {
311
+ window.__hydrateGraphShape(shape, data.graphData);
312
+ } else {
313
+ shape._frameType = "graph";
314
+ shape._graphData = cloneOptions(data.graphData);
315
+ shape.element.setAttribute("data-graph-shape", "true");
316
+ }
317
+ }
294
318
  return shape;
295
319
  }
296
320
  case "icon": {
@@ -350,6 +374,7 @@ function loadScene(sceneData) {
350
374
  }
351
375
  const svgEl = window.svg;
352
376
  if (!svgEl) return false;
377
+ window.__roomImageBytesUsed = 0;
353
378
  const existingShapes = window.shapes || [];
354
379
  existingShapes.forEach((shape) => {
355
380
  if (shape.shapeName === "frame") {
@@ -753,4 +778,4 @@ export {
753
778
  uploadScene,
754
779
  validateScene
755
780
  };
756
- //# sourceMappingURL=SceneSerializer-ARTKPZVR.js.map
781
+ //# sourceMappingURL=SceneSerializer-GSJR7ZHC.js.map