@widgetic/canvas 0.5.40 → 0.5.41

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 (120) hide show
  1. package/README.md +7 -3
  2. package/dist/canvas/DomCanvas.svelte +4 -0
  3. package/dist/canvas/DomCanvas.svelte.d.ts +8 -0
  4. package/dist/canvas/autosaveScheduler.js +89 -37
  5. package/dist/canvas/boardFrame.js +1 -1
  6. package/dist/canvas/boardSurface.js +1 -1
  7. package/dist/canvas/canvasLogger.js +19 -7
  8. package/dist/canvas/chromeLayout.js +18 -17
  9. package/dist/canvas/eventScope.js +14 -10
  10. package/dist/canvas/host/CanvasHost.d.ts +6 -0
  11. package/dist/canvas/host/CanvasHost.js +1556 -1267
  12. package/dist/canvas/host/CanvasHostApi.d.ts +2 -2
  13. package/dist/canvas/host/CanvasHostApi.js +25 -4
  14. package/dist/canvas/host/browserServices.js +116 -65
  15. package/dist/canvas/host/conversion.js +170 -82
  16. package/dist/canvas/host/hostObject.js +7 -7
  17. package/dist/canvas/host/pageEvents.js +4 -4
  18. package/dist/canvas/host/screenRects.js +31 -28
  19. package/dist/canvas/host/strokeSnap.js +143 -88
  20. package/dist/canvas/openMarks.js +2 -2
  21. package/dist/canvas/outsideClickDeselect.js +7 -6
  22. package/dist/canvas/panZoomPosition.js +2 -2
  23. package/dist/canvas/preferredTextFont.js +25 -13
  24. package/dist/canvas/shapes/ShapeLibrary.js +148 -138
  25. package/dist/canvas/shapes/shapeImageStore.js +3 -3
  26. package/dist/canvas/shapes/strokeShapeSnap.js +233 -188
  27. package/dist/canvas/toolbarPosition.js +2 -2
  28. package/dist/canvas/ui/CanvasHint.svelte +16 -3
  29. package/dist/canvas/ui/CanvasHint.svelte.d.ts +2 -17
  30. package/dist/canvas/ui/CanvasToolbar.svelte +7 -7
  31. package/dist/canvas/ui/ToolButton.svelte +11 -3
  32. package/dist/canvas/ui/ToolButton.svelte.d.ts +2 -0
  33. package/dist/canvas/ui/colorModel.js +32 -21
  34. package/dist/canvas/ui/colorPickerMessages.js +5 -5
  35. package/dist/canvas/ui/floatingCard.js +18 -18
  36. package/dist/canvas/ui/floatingLayer.js +6 -5
  37. package/dist/canvas/ui/keyHints.js +11 -9
  38. package/dist/canvas/ui/popoverSide.js +3 -2
  39. package/dist/canvas/ui/selectionTraits.js +40 -34
  40. package/dist/canvas/ui/sizeLabelVisibility.d.ts +1 -1
  41. package/dist/canvas/ui/sizeLabelVisibility.js +1 -1
  42. package/dist/canvas/view/SelectionOverlay.svelte +33 -14
  43. package/dist/canvas/view/erasingMarks.js +7 -7
  44. package/dist/canvas/view/geometry.d.ts +14 -4
  45. package/dist/canvas/view/geometry.js +103 -77
  46. package/dist/components/preferenceStorage.js +2 -2
  47. package/dist/engine/EngineCore.d.ts +4 -1
  48. package/dist/engine/EngineCore.js +801 -695
  49. package/dist/engine/codec/canvasDocument.js +173 -173
  50. package/dist/engine/codec/hostReadableKeys.js +1 -1
  51. package/dist/engine/core/arrange.js +38 -26
  52. package/dist/engine/core/arrow.d.ts +10 -3
  53. package/dist/engine/core/arrow.js +96 -75
  54. package/dist/engine/core/arrowBinding.d.ts +69 -0
  55. package/dist/engine/core/arrowBinding.js +344 -0
  56. package/dist/engine/core/arrowBindingRecords.d.ts +43 -0
  57. package/dist/engine/core/arrowBindingRecords.js +141 -0
  58. package/dist/engine/core/brush.js +94 -67
  59. package/dist/engine/core/defaults.js +51 -90
  60. package/dist/engine/core/freehand.js +163 -147
  61. package/dist/engine/core/geometry.js +54 -47
  62. package/dist/engine/core/history.js +50 -33
  63. package/dist/engine/core/hitTest.d.ts +3 -0
  64. package/dist/engine/core/hitTest.js +83 -69
  65. package/dist/engine/core/matrix.js +20 -18
  66. package/dist/engine/core/pathData.js +210 -183
  67. package/dist/engine/core/rotationReset.js +6 -5
  68. package/dist/engine/core/scene.d.ts +3 -0
  69. package/dist/engine/core/scene.js +192 -129
  70. package/dist/engine/core/scribble.js +84 -59
  71. package/dist/engine/core/shapePaths.js +15 -12
  72. package/dist/engine/core/shapeTools.js +63 -72
  73. package/dist/engine/core/snapping.js +117 -65
  74. package/dist/engine/core/style.js +64 -31
  75. package/dist/engine/core/transform.js +94 -83
  76. package/dist/engine/core/types.d.ts +29 -0
  77. package/dist/engine/core/types.js +4 -4
  78. package/dist/engine/core/viewport.js +36 -23
  79. package/dist/engine/input/PointerController.js +476 -447
  80. package/dist/engine/input/arrowHandles.js +12 -12
  81. package/dist/engine/input/gestures.d.ts +12 -1
  82. package/dist/engine/input/gestures.js +342 -251
  83. package/dist/engine/input/hoverCursor.js +1 -1
  84. package/dist/engine/input/keyboard.d.ts +9 -1
  85. package/dist/engine/input/keyboard.js +46 -27
  86. package/dist/engine/input/selectionHandles.js +50 -45
  87. package/dist/engine/input/types.js +1 -1
  88. package/dist/engine/render/rasterize.js +158 -86
  89. package/dist/engine/state.d.ts +6 -1
  90. package/dist/engine/state.js +17 -5
  91. package/dist/engine/text/layoutText.js +62 -43
  92. package/dist/engine/text/textMetrics.js +10 -8
  93. package/dist/engine/widgets.js +137 -101
  94. package/dist/fonts/interFont.js +68 -17
  95. package/dist/fonts/workspaceFonts.js +90 -32
  96. package/dist/i18n/labels.js +4 -4
  97. package/dist/i18n/language.js +4 -4
  98. package/dist/i18n/messages.js +1 -1
  99. package/dist/i18n/shortcuts.d.ts +12 -0
  100. package/dist/i18n/shortcuts.js +32 -18
  101. package/dist/settings/workspaceToolSettings.js +48 -32
  102. package/dist/tools/components/catalog.d.ts +11 -0
  103. package/dist/tools/components/catalog.js +270 -0
  104. package/dist/tools/components/grouping.d.ts +9 -0
  105. package/dist/tools/components/grouping.js +33 -0
  106. package/dist/tools/definitions.d.ts +19 -0
  107. package/dist/tools/definitions.js +147 -0
  108. package/dist/tools/executors.d.ts +7 -0
  109. package/dist/tools/executors.js +324 -0
  110. package/dist/tools/hostAdapter.d.ts +14 -0
  111. package/dist/tools/hostAdapter.js +40 -0
  112. package/dist/tools/index.d.ts +6 -0
  113. package/dist/tools/index.js +6 -0
  114. package/dist/tools/sceneSummary.d.ts +24 -0
  115. package/dist/tools/sceneSummary.js +170 -0
  116. package/dist/tools/sketchIntent.d.ts +17 -0
  117. package/dist/tools/sketchIntent.js +166 -0
  118. package/dist/tools/types.d.ts +54 -0
  119. package/dist/tools/types.js +11 -0
  120. package/package.json +7 -2
@@ -10,17 +10,30 @@
10
10
  * 'strokeRound' – apply round linecap / linejoin (line-only: check, X, +, -)
11
11
  * 'pathRegen' – regenerate sub-shape path data with rounded corners (rects & polygons)
12
12
  */
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
13
22
  // ── Path-regen helpers ────────────────────────────────────────────────────────
14
23
  /** Generate SVG path data for a rounded rectangle. */
15
24
  export function roundedRectPath(x, y, w, h, r) {
16
25
  r = Math.min(r, w / 2, h / 2);
17
- const x2 = x + w, y2 = y + h;
26
+ var x2 = x + w, y2 = y + h;
18
27
  return [
19
- `M ${x + r} ${y}`,
20
- `L ${x2 - r} ${y}`, `Q ${x2} ${y} ${x2} ${y + r}`,
21
- `L ${x2} ${y2 - r}`, `Q ${x2} ${y2} ${x2 - r} ${y2}`,
22
- `L ${x + r} ${y2}`, `Q ${x} ${y2} ${x} ${y2 - r}`,
23
- `L ${x} ${y + r}`, `Q ${x} ${y} ${x + r} ${y}`,
28
+ "M ".concat(x + r, " ").concat(y),
29
+ "L ".concat(x2 - r, " ").concat(y),
30
+ "Q ".concat(x2, " ").concat(y, " ").concat(x2, " ").concat(y + r),
31
+ "L ".concat(x2, " ").concat(y2 - r),
32
+ "Q ".concat(x2, " ").concat(y2, " ").concat(x2 - r, " ").concat(y2),
33
+ "L ".concat(x + r, " ").concat(y2),
34
+ "Q ".concat(x, " ").concat(y2, " ").concat(x, " ").concat(y2 - r),
35
+ "L ".concat(x, " ").concat(y + r),
36
+ "Q ".concat(x, " ").concat(y, " ").concat(x + r, " ").concat(y),
24
37
  'Z',
25
38
  ].join(' ');
26
39
  }
@@ -31,35 +44,35 @@ export function roundedRectPath(x, y, w, h, r) {
31
44
  */
32
45
  export function roundedPolygonPath(points, r) {
33
46
  if (r <= 0) {
34
- return (points.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p[0]} ${p[1]}`).join(' ') + ' Z');
47
+ return (points.map(function (p, i) { return "".concat(i === 0 ? 'M' : 'L', " ").concat(p[0], " ").concat(p[1]); }).join(' ') + ' Z');
35
48
  }
36
- const n = points.length;
49
+ var n = points.length;
37
50
  // Cap r to 45% of the shortest edge to stay inside the polygon
38
- let minEdge = Infinity;
39
- for (let i = 0; i < n; i++) {
40
- const a = points[i], b = points[(i + 1) % n];
41
- const d = Math.sqrt((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2);
42
- if (d < minEdge)
43
- minEdge = d;
51
+ var minEdge = Infinity;
52
+ for (var i = 0; i < n; i++) {
53
+ var a = points[i], b = points[(i + 1) % n];
54
+ var d_1 = Math.sqrt(Math.pow((b[0] - a[0]), 2) + Math.pow((b[1] - a[1]), 2));
55
+ if (d_1 < minEdge)
56
+ minEdge = d_1;
44
57
  }
45
- const rClamped = Math.min(r, minEdge * 0.45);
46
- let d = '';
47
- for (let i = 0; i < n; i++) {
48
- const prev = points[(i - 1 + n) % n];
49
- const curr = points[i];
50
- const next = points[(i + 1) % n];
58
+ var rClamped = Math.min(r, minEdge * 0.45);
59
+ var d = '';
60
+ for (var i = 0; i < n; i++) {
61
+ var prev = points[(i - 1 + n) % n];
62
+ var curr = points[i];
63
+ var next = points[(i + 1) % n];
51
64
  // Unit vectors from corner toward its neighbours
52
- const pLen = Math.sqrt((prev[0] - curr[0]) ** 2 + (prev[1] - curr[1]) ** 2) || 1;
53
- const nLen = Math.sqrt((next[0] - curr[0]) ** 2 + (next[1] - curr[1]) ** 2) || 1;
54
- const pn = [(prev[0] - curr[0]) / pLen, (prev[1] - curr[1]) / pLen];
55
- const nn = [(next[0] - curr[0]) / nLen, (next[1] - curr[1]) / nLen];
65
+ var pLen = Math.sqrt(Math.pow((prev[0] - curr[0]), 2) + Math.pow((prev[1] - curr[1]), 2)) || 1;
66
+ var nLen = Math.sqrt(Math.pow((next[0] - curr[0]), 2) + Math.pow((next[1] - curr[1]), 2)) || 1;
67
+ var pn = [(prev[0] - curr[0]) / pLen, (prev[1] - curr[1]) / pLen];
68
+ var nn = [(next[0] - curr[0]) / nLen, (next[1] - curr[1]) / nLen];
56
69
  // Points along each edge, distance rClamped from the corner vertex
57
- const p1 = [curr[0] + pn[0] * rClamped, curr[1] + pn[1] * rClamped];
58
- const p2 = [curr[0] + nn[0] * rClamped, curr[1] + nn[1] * rClamped];
70
+ var p1 = [curr[0] + pn[0] * rClamped, curr[1] + pn[1] * rClamped];
71
+ var p2 = [curr[0] + nn[0] * rClamped, curr[1] + nn[1] * rClamped];
59
72
  d += i === 0
60
- ? `M ${p1[0].toFixed(2)} ${p1[1].toFixed(2)} `
61
- : `L ${p1[0].toFixed(2)} ${p1[1].toFixed(2)} `;
62
- d += `Q ${curr[0]} ${curr[1]} ${p2[0].toFixed(2)} ${p2[1].toFixed(2)} `;
73
+ ? "M ".concat(p1[0].toFixed(2), " ").concat(p1[1].toFixed(2), " ")
74
+ : "L ".concat(p1[0].toFixed(2), " ").concat(p1[1].toFixed(2), " ");
75
+ d += "Q ".concat(curr[0], " ").concat(curr[1], " ").concat(p2[0].toFixed(2), " ").concat(p2[1].toFixed(2), " ");
63
76
  }
64
77
  return d + 'Z';
65
78
  }
@@ -72,21 +85,21 @@ export function generatePathForShape(shape, roundnessPercent) {
72
85
  // regenData. Each L-command corner and the two C-to-L junctions are rounded individually
73
86
  // using Quadratic Bezier arcs so the entire shape looks smooth at high roundness values.
74
87
  if (shape.key === 'curved-arrow') {
75
- const t = (roundnessPercent / 100) * 8; // max 8-unit radius at 100%
76
- if (t < 0.1)
88
+ var t_1 = (roundnessPercent / 100) * 8; // max 8-unit radius at 100%
89
+ if (t_1 < 0.1)
77
90
  return null;
78
91
  // Round a corner at (cx,cy): px/py is the INCOMING reference point, nx/ny is OUTGOING.
79
92
  // For C commands use the adjacent control point as the reference direction.
80
93
  // Returns { s: arcStart, e: arcEnd } strings for "…s Q cx cy e…" insertion.
81
- const rc = (px, py, cx, cy, nx, ny) => {
82
- const dx1 = px - cx, dy1 = py - cy;
83
- const l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1) || 1;
84
- const dx2 = nx - cx, dy2 = ny - cy;
85
- const l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2) || 1;
86
- const r = Math.min(t, l1 * 0.45, l2 * 0.45);
94
+ var rc = function (px, py, cx, cy, nx, ny) {
95
+ var dx1 = px - cx, dy1 = py - cy;
96
+ var l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1) || 1;
97
+ var dx2 = nx - cx, dy2 = ny - cy;
98
+ var l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2) || 1;
99
+ var r = Math.min(t_1, l1 * 0.45, l2 * 0.45);
87
100
  return {
88
- s: `${(cx + dx1 / l1 * r).toFixed(1)} ${(cy + dy1 / l1 * r).toFixed(1)}`,
89
- e: `${(cx + dx2 / l2 * r).toFixed(1)} ${(cy + dy2 / l2 * r).toFixed(1)}`,
101
+ s: "".concat((cx + dx1 / l1 * r).toFixed(1), " ").concat((cy + dy1 / l1 * r).toFixed(1)),
102
+ e: "".concat((cx + dx2 / l2 * r).toFixed(1), " ").concat((cy + dy2 / l2 * r).toFixed(1)),
90
103
  };
91
104
  };
92
105
  // Corners with reference points for tangent direction:
@@ -110,23 +123,23 @@ export function generatePathForShape(shape, roundnessPercent) {
110
123
  // — c0_e scales with t: at t=0 → M=(80,20) = exact original path; at t=8 → M=(85.7,25.7).
111
124
  // The Q arc from (80,25) Q(80,20) to c0_e smoothly rounds the top corner with up to 8px
112
125
  // effective radius on the outgoing side, while the shape stays correct at any % level.
113
- const r0 = Math.min(t, 21.2 * 0.45); // cap only by first-L edge length (21.2px × 0.45)
114
- const c0_s = '80.0 25.0'; // original C endpoint — Z-line start, never moves
115
- const c0_dirX = 15 / 21.2, c0_dirY = 15 / 21.2; // unit direction (80,20)→(95,35)
116
- const c0_e = `${(80 + c0_dirX * r0).toFixed(1)} ${(20 + c0_dirY * r0).toFixed(1)}`;
117
- const c1 = rc(80, 20, 95, 35, 80, 50); // arrowhead tip
118
- const c2 = rc(95, 35, 80, 50, 80, 40); // outer lower arrowhead wing
119
- const c3 = rc(80, 50, 80, 40, 50, 40); // inner shoulder (L→C, use C cp1 as direction)
120
- const c4 = rc(30, 55, 30, 80, 15, 80); // C-to-L junction (C cp2 as incoming direction)
121
- const c5 = rc(30, 80, 15, 80, 15, 45); // tail end (L→C, use C cp1 as direction)
126
+ var r0 = Math.min(t_1, 21.2 * 0.45); // cap only by first-L edge length (21.2px × 0.45)
127
+ var c0_s = '80.0 25.0'; // original C endpoint — Z-line start, never moves
128
+ var c0_dirX = 15 / 21.2, c0_dirY = 15 / 21.2; // unit direction (80,20)→(95,35)
129
+ var c0_e = "".concat((80 + c0_dirX * r0).toFixed(1), " ").concat((20 + c0_dirY * r0).toFixed(1));
130
+ var c1 = rc(80, 20, 95, 35, 80, 50); // arrowhead tip
131
+ var c2 = rc(95, 35, 80, 50, 80, 40); // outer lower arrowhead wing
132
+ var c3 = rc(80, 50, 80, 40, 50, 40); // inner shoulder (L→C, use C cp1 as direction)
133
+ var c4 = rc(30, 55, 30, 80, 15, 80); // C-to-L junction (C cp2 as incoming direction)
134
+ var c5 = rc(30, 80, 15, 80, 15, 45); // tail end (L→C, use C cp1 as direction)
122
135
  return [
123
- `M ${c0_e}`, // start at c0 arc end (Z closes back here)
124
- `L ${c1.s} Q 95 35 ${c1.e}`, // arrowhead tip
125
- `L ${c2.s} Q 80 50 ${c2.e}`, // outer lower arrowhead wing
126
- `L ${c3.s} Q 80 40 ${c3.e}`, // inner shoulder
127
- `C 50 40 30 55 ${c4.s} Q 30 80 ${c4.e}`, // curve body + C→L junction
128
- `L ${c5.s} Q 15 80 ${c5.e}`, // tail end
129
- `C 15 45 40 25 ${c0_s} Q 80 20 ${c0_e} Z`, // return C (endpoint unchanged) + M arc
136
+ "M ".concat(c0_e), // start at c0 arc end (Z closes back here)
137
+ "L ".concat(c1.s, " Q 95 35 ").concat(c1.e), // arrowhead tip
138
+ "L ".concat(c2.s, " Q 80 50 ").concat(c2.e), // outer lower arrowhead wing
139
+ "L ".concat(c3.s, " Q 80 40 ").concat(c3.e), // inner shoulder
140
+ "C 50 40 30 55 ".concat(c4.s, " Q 30 80 ").concat(c4.e), // curve body + C→L junction
141
+ "L ".concat(c5.s, " Q 15 80 ").concat(c5.e), // tail end
142
+ "C 15 45 40 25 ".concat(c0_s, " Q 80 20 ").concat(c0_e, " Z"),
130
143
  ].join(' ');
131
144
  }
132
145
  // ── Shield: quadratic-arc rounding of 5 angular corners, bezier bottom preserved ──
@@ -134,22 +147,23 @@ export function generatePathForShape(shape, roundnessPercent) {
134
147
  // Corners: P0=(50,5) P1=(90,20) P2=(90,55) P4=(10,55) P5=(10,20)
135
148
  // At 0%, returns null so the original pathData is used exactly (no shape change).
136
149
  if (shape.key === 'shield') {
137
- const maxT = 10; // max arc radius in path units at 100% roundness
138
- const t = (roundnessPercent / 100) * maxT;
139
- if (t < 0.1)
150
+ var maxT = 10; // max arc radius in path units at 100% roundness
151
+ var t_2 = (roundnessPercent / 100) * maxT;
152
+ if (t_2 < 0.1)
140
153
  return null;
141
154
  // rc: quadratic bezier arc at (cx,cy), optional tMax clamps radius for corners
142
155
  // adjacent to bezier curves to limit distortion of the bezier endpoints.
143
- const rc2 = (px, py, cx, cy, nx, ny, tMax = t) => {
144
- const tEff = Math.min(t, tMax);
145
- const dx1 = px - cx, dy1 = py - cy;
146
- const l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1) || 1;
147
- const dx2 = nx - cx, dy2 = ny - cy;
148
- const l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2) || 1;
149
- const r = Math.min(tEff, l1 * 0.45, l2 * 0.45);
156
+ var rc2 = function (px, py, cx, cy, nx, ny, tMax) {
157
+ if (tMax === void 0) { tMax = t_2; }
158
+ var tEff = Math.min(t_2, tMax);
159
+ var dx1 = px - cx, dy1 = py - cy;
160
+ var l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1) || 1;
161
+ var dx2 = nx - cx, dy2 = ny - cy;
162
+ var l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2) || 1;
163
+ var r = Math.min(tEff, l1 * 0.45, l2 * 0.45);
150
164
  return {
151
- s: `${(cx + dx1 / l1 * r).toFixed(1)} ${(cy + dy1 / l1 * r).toFixed(1)}`,
152
- e: `${(cx + dx2 / l2 * r).toFixed(1)} ${(cy + dy2 / l2 * r).toFixed(1)}`,
165
+ s: "".concat((cx + dx1 / l1 * r).toFixed(1), " ").concat((cy + dy1 / l1 * r).toFixed(1)),
166
+ e: "".concat((cx + dx2 / l2 * r).toFixed(1), " ").concat((cy + dy2 / l2 * r).toFixed(1)),
153
167
  };
154
168
  };
155
169
  // c0: top point (50,5) — prev is (10,20) via Z-line, next is (90,20)
@@ -159,59 +173,59 @@ export function generatePathForShape(shape, roundnessPercent) {
159
173
  // the last cp of C1 (70,90) and the first cp of C2 (30,90)
160
174
  // c4: left side base (10,55) — limited tMax=4 to minimize bezier bottom distortion
161
175
  // c5: top-left shoulder (10,20) — prev (10,55), next (50,5)
162
- const c0 = rc2(10, 20, 50, 5, 90, 20);
163
- const c1 = rc2(50, 5, 90, 20, 90, 55);
164
- const c2 = rc2(90, 20, 90, 55, 90, 75, 4); // cap arc size near bezier
165
- const c3 = rc2(70, 90, 50, 95, 30, 90, 6); // bottom point (bezier junction, cap=6)
166
- const c4 = rc2(10, 75, 10, 55, 10, 20, 4); // cap arc size near bezier
167
- const c5 = rc2(10, 55, 10, 20, 50, 5);
176
+ var c0 = rc2(10, 20, 50, 5, 90, 20);
177
+ var c1 = rc2(50, 5, 90, 20, 90, 55);
178
+ var c2 = rc2(90, 20, 90, 55, 90, 75, 4); // cap arc size near bezier
179
+ var c3 = rc2(70, 90, 50, 95, 30, 90, 6); // bottom point (bezier junction, cap=6)
180
+ var c4 = rc2(10, 75, 10, 55, 10, 20, 4); // cap arc size near bezier
181
+ var c5 = rc2(10, 55, 10, 20, 50, 5);
168
182
  // The top corner arc (c0) is placed LAST, just before Z, so the path visits:
169
183
  // M(c0.e) → c1 arc → c2 arc → bezier1 (shortened to c3.s) → c3 Q arc →
170
184
  // bezier2 (from c3.e, shortened) → c4 arc → c5 arc → c0 arc → Z
171
185
  return [
172
- `M ${c0.e}`, // start past top-point toward P1
173
- `L ${c1.s} Q 90 20 ${c1.e}`, // arc at top-right shoulder
174
- `L ${c2.s} Q 90 55 ${c2.e}`, // arc at right base (limited radius)
175
- `C 90 75 70 90 ${c3.s}`, // bottom-right bezier, shortened to c3 arc entry
176
- `Q 50 95 ${c3.e}`, // arc at bottom point
177
- `C 30 90 10 75 ${c4.s}`, // bottom-left bezier, shortened to c4 arc entry
178
- `Q 10 55 ${c4.e}`, // arc at left base (limited radius)
179
- `L ${c5.s} Q 10 20 ${c5.e}`, // arc at top-left shoulder
180
- `L ${c0.s} Q 50 5 ${c0.e}`, // arc at top point
181
- `Z`, // zero-distance close back to M (c0.e)
186
+ "M ".concat(c0.e), // start past top-point toward P1
187
+ "L ".concat(c1.s, " Q 90 20 ").concat(c1.e), // arc at top-right shoulder
188
+ "L ".concat(c2.s, " Q 90 55 ").concat(c2.e), // arc at right base (limited radius)
189
+ "C 90 75 70 90 ".concat(c3.s), // bottom-right bezier, shortened to c3 arc entry
190
+ "Q 50 95 ".concat(c3.e), // arc at bottom point
191
+ "C 30 90 10 75 ".concat(c4.s), // bottom-left bezier, shortened to c4 arc entry
192
+ "Q 10 55 ".concat(c4.e), // arc at left base (limited radius)
193
+ "L ".concat(c5.s, " Q 10 20 ").concat(c5.e), // arc at top-left shoulder
194
+ "L ".concat(c0.s, " Q 50 5 ").concat(c0.e), // arc at top point
195
+ "Z",
182
196
  ].join(' ');
183
197
  }
184
198
  if (shape.cornerRadiusMode !== 'pathRegen' || !shape.regenData)
185
199
  return null;
186
- return shape.regenData.map(sub => {
200
+ return shape.regenData.map(function (sub) {
187
201
  if (sub.type === 'fixed')
188
202
  return sub.path;
189
203
  if (sub.type === 'rect') {
190
- const maxR = Math.min(sub.w, sub.h) / 2;
191
- const r = (roundnessPercent / 100) * maxR;
192
- return roundedRectPath(sub.x, sub.y, sub.w, sub.h, r);
204
+ var maxR_1 = Math.min(sub.w, sub.h) / 2;
205
+ var r_1 = (roundnessPercent / 100) * maxR_1;
206
+ return roundedRectPath(sub.x, sub.y, sub.w, sub.h, r_1);
193
207
  }
194
208
  // polygon
195
- const pts = sub.points;
196
- const n = pts.length;
197
- let minEdge = Infinity;
198
- for (let i = 0; i < n; i++) {
199
- const a = pts[i], b = pts[(i + 1) % n];
200
- minEdge = Math.min(minEdge, Math.sqrt((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2));
209
+ var pts = sub.points;
210
+ var n = pts.length;
211
+ var minEdge = Infinity;
212
+ for (var i = 0; i < n; i++) {
213
+ var a = pts[i], b = pts[(i + 1) % n];
214
+ minEdge = Math.min(minEdge, Math.sqrt(Math.pow((b[0] - a[0]), 2) + Math.pow((b[1] - a[1]), 2)));
201
215
  }
202
- const maxR = minEdge * 0.45;
203
- const r = (roundnessPercent / 100) * maxR;
216
+ var maxR = minEdge * 0.45;
217
+ var r = (roundnessPercent / 100) * maxR;
204
218
  return roundedPolygonPath(pts, r);
205
219
  }).join(' ');
206
220
  }
207
221
  // ── Geometric Shapes (library) ─────────────────────────────────────────────
208
- const GEOMETRIC_SHAPES = [
222
+ var GEOMETRIC_SHAPES = [
209
223
  {
210
224
  key: 'hexagon',
211
225
  labelKey: 'canvas.shape.hexagon',
212
226
  category: 'Geometric Shapes',
213
227
  pathData: 'M 50 3 L 93 27 L 93 73 L 50 97 L 7 73 L 7 27 Z',
214
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><polygon points="12,2 21.5,7 21.5,17 12,22 2.5,17 2.5,7" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
228
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><polygon points=\"12,2 21.5,7 21.5,17 12,22 2.5,17 2.5,7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
215
229
  cornerRadiusMode: 'pathRegen',
216
230
  regenData: [
217
231
  { type: 'polygon', points: [[50, 3], [93, 27], [93, 73], [50, 97], [7, 73], [7, 27]] },
@@ -223,7 +237,7 @@ const GEOMETRIC_SHAPES = [
223
237
  labelKey: 'canvas.shape.pentagon',
224
238
  category: 'Geometric Shapes',
225
239
  pathData: 'M 50 4 L 95.6 37.2 L 78.2 90.8 L 21.8 90.8 L 4.4 37.2 Z',
226
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><polygon points="12,2.5 21.5,9.4 17.9,20.6 6.1,20.6 2.5,9.4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
240
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><polygon points=\"12,2.5 21.5,9.4 17.9,20.6 6.1,20.6 2.5,9.4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
227
241
  cornerRadiusMode: 'pathRegen',
228
242
  regenData: [
229
243
  { type: 'polygon', points: [[50, 4], [95.6, 37.2], [78.2, 90.8], [21.8, 90.8], [4.4, 37.2]] },
@@ -237,19 +251,19 @@ const GEOMETRIC_SHAPES = [
237
251
  // Capsule/stadium shape: wide rounded rect with max corner radius (half the height).
238
252
  // 160×90 content area, corner radius = 45 (half of 90). Produces semicircle caps like a pill.
239
253
  pathData: 'M 50 5 L 110 5 Q 155 5 155 50 L 155 50 Q 155 95 110 95 L 50 95 Q 5 95 5 50 L 5 50 Q 5 5 50 5 Z',
240
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><rect x="3" y="5" width="18" height="14" rx="7" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>`,
254
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"/></svg>",
241
255
  cornerRadiusMode: 'none',
242
256
  lockAspectRatio: false,
243
257
  },
244
258
  ];
245
259
  // ── Media Icons ──────────────────────────────────────────────────────────────
246
- const MEDIA_SHAPES = [
260
+ var MEDIA_SHAPES = [
247
261
  {
248
262
  key: 'play',
249
263
  labelKey: 'canvas.shape.play',
250
264
  category: 'Media Icons',
251
265
  pathData: 'M 10 5 L 10 95 L 90 50 Z',
252
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><polygon points="5,3 5,21 20,12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
266
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><polygon points=\"5,3 5,21 20,12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
253
267
  cornerRadiusMode: 'pathRegen',
254
268
  regenData: [
255
269
  { type: 'polygon', points: [[10, 5], [10, 95], [90, 50]] },
@@ -260,7 +274,7 @@ const MEDIA_SHAPES = [
260
274
  labelKey: 'canvas.shape.pause',
261
275
  category: 'Media Icons',
262
276
  pathData: 'M 15 5 L 15 95 L 35 95 L 35 5 Z M 65 5 L 65 95 L 85 95 L 85 5 Z',
263
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><rect x="6" y="4" width="4" height="16" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/><rect x="14" y="4" width="4" height="16" rx="1" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>`,
277
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><rect x=\"6\" y=\"4\" width=\"4\" height=\"16\" rx=\"1\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"/><rect x=\"14\" y=\"4\" width=\"4\" height=\"16\" rx=\"1\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"/></svg>",
264
278
  cornerRadiusMode: 'pathRegen',
265
279
  regenData: [
266
280
  { type: 'rect', x: 15, y: 5, w: 20, h: 90 },
@@ -272,7 +286,7 @@ const MEDIA_SHAPES = [
272
286
  labelKey: 'canvas.shape.stop',
273
287
  category: 'Media Icons',
274
288
  pathData: 'M 10 10 L 10 90 L 90 90 L 90 10 Z',
275
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><rect x="5" y="5" width="14" height="14" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>`,
289
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><rect x=\"5\" y=\"5\" width=\"14\" height=\"14\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"/></svg>",
276
290
  cornerRadiusMode: 'pathRegen',
277
291
  regenData: [
278
292
  { type: 'rect', x: 10, y: 10, w: 80, h: 80 },
@@ -283,7 +297,7 @@ const MEDIA_SHAPES = [
283
297
  labelKey: 'canvas.shape.rewind',
284
298
  category: 'Media Icons',
285
299
  pathData: 'M 50 5 L 50 95 L 5 50 Z M 95 5 L 95 95 L 50 50 Z',
286
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><polygon points="12,3 12,21 3,12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><polygon points="21,3 21,21 12,12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
300
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><polygon points=\"12,3 12,21 3,12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/><polygon points=\"21,3 21,21 12,12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
287
301
  cornerRadiusMode: 'pathRegen',
288
302
  regenData: [
289
303
  { type: 'polygon', points: [[50, 5], [50, 95], [5, 50]] },
@@ -295,7 +309,7 @@ const MEDIA_SHAPES = [
295
309
  labelKey: 'canvas.shape.fastForward',
296
310
  category: 'Media Icons',
297
311
  pathData: 'M 5 5 L 5 95 L 50 50 Z M 50 5 L 50 95 L 95 50 Z',
298
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><polygon points="3,3 3,21 12,12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><polygon points="12,3 12,21 21,12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
312
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><polygon points=\"3,3 3,21 12,12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/><polygon points=\"12,3 12,21 21,12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
299
313
  cornerRadiusMode: 'pathRegen',
300
314
  regenData: [
301
315
  { type: 'polygon', points: [[5, 5], [5, 95], [50, 50]] },
@@ -308,18 +322,18 @@ const MEDIA_SHAPES = [
308
322
  category: 'Media Icons',
309
323
  // Already a circle — no corner rounding needed
310
324
  pathData: 'M 50 5 A 45 45 0 1 1 49.999 5 Z',
311
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><circle cx="12" cy="12" r="7" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>`,
325
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"/></svg>",
312
326
  cornerRadiusMode: 'none',
313
327
  },
314
328
  ];
315
329
  // ── Arrow Shapes ─────────────────────────────────────────────────────────────
316
- const ARROW_SHAPES = [
330
+ var ARROW_SHAPES = [
317
331
  {
318
332
  key: 'arrow-right',
319
333
  labelKey: 'canvas.shape.arrowRight',
320
334
  category: 'Arrow Shapes',
321
335
  pathData: 'M 5 40 L 65 40 L 65 20 L 95 50 L 65 80 L 65 60 L 5 60 Z',
322
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M5 12 H19 M13 6 L19 12 L13 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
336
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M5 12 H19 M13 6 L19 12 L13 18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
323
337
  cornerRadiusMode: 'pathRegen',
324
338
  regenData: [{ type: 'polygon', points: [[5, 40], [65, 40], [65, 20], [95, 50], [65, 80], [65, 60], [5, 60]] }],
325
339
  },
@@ -328,7 +342,7 @@ const ARROW_SHAPES = [
328
342
  labelKey: 'canvas.shape.arrowLeft',
329
343
  category: 'Arrow Shapes',
330
344
  pathData: 'M 95 40 L 35 40 L 35 20 L 5 50 L 35 80 L 35 60 L 95 60 Z',
331
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M19 12 H5 M11 6 L5 12 L11 18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
345
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M19 12 H5 M11 6 L5 12 L11 18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
332
346
  cornerRadiusMode: 'pathRegen',
333
347
  regenData: [{ type: 'polygon', points: [[95, 40], [35, 40], [35, 20], [5, 50], [35, 80], [35, 60], [95, 60]] }],
334
348
  },
@@ -337,7 +351,7 @@ const ARROW_SHAPES = [
337
351
  labelKey: 'canvas.shape.arrowUp',
338
352
  category: 'Arrow Shapes',
339
353
  pathData: 'M 40 95 L 40 35 L 20 35 L 50 5 L 80 35 L 60 35 L 60 95 Z',
340
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M12 19 V5 M6 11 L12 5 L18 11" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
354
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M12 19 V5 M6 11 L12 5 L18 11\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
341
355
  cornerRadiusMode: 'pathRegen',
342
356
  regenData: [{ type: 'polygon', points: [[40, 95], [40, 35], [20, 35], [50, 5], [80, 35], [60, 35], [60, 95]] }],
343
357
  },
@@ -346,7 +360,7 @@ const ARROW_SHAPES = [
346
360
  labelKey: 'canvas.shape.arrowDown',
347
361
  category: 'Arrow Shapes',
348
362
  pathData: 'M 60 5 L 60 65 L 80 65 L 50 95 L 20 65 L 40 65 L 40 5 Z',
349
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M12 5 V19 M6 13 L12 19 L18 13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
363
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M12 5 V19 M6 13 L12 19 L18 13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
350
364
  cornerRadiusMode: 'pathRegen',
351
365
  regenData: [{ type: 'polygon', points: [[60, 5], [60, 65], [80, 65], [50, 95], [20, 65], [40, 65], [40, 5]] }],
352
366
  },
@@ -355,7 +369,7 @@ const ARROW_SHAPES = [
355
369
  labelKey: 'canvas.shape.doubleArrow',
356
370
  category: 'Arrow Shapes',
357
371
  pathData: 'M 30 20 L 5 50 L 30 80 L 30 62 L 70 62 L 70 80 L 95 50 L 70 20 L 70 38 L 30 38 Z',
358
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M7 12 H17 M5 8 L1 12 L5 16 M19 8 L23 12 L19 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
372
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M7 12 H17 M5 8 L1 12 L5 16 M19 8 L23 12 L19 16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
359
373
  cornerRadiusMode: 'pathRegen',
360
374
  regenData: [{ type: 'polygon', points: [[30, 20], [5, 50], [30, 80], [30, 62], [70, 62], [70, 80], [95, 50], [70, 20], [70, 38], [30, 38]] }],
361
375
  },
@@ -368,20 +382,20 @@ const ARROW_SHAPES = [
368
382
  // because it clips the bounding box, cutting off arrowhead tips at high roundness.
369
383
  // strokeRound was avoided because it only affects the stroke outline, not the fill corners.
370
384
  pathData: 'M 80 20 L 95 35 L 80 50 L 80 40 C 50 40 30 55 30 80 L 15 80 C 15 45 40 25 80 25 Z',
371
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M17 4 L21 8 L17 12 M21 8 C15 8 9 11 9 20" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
385
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M17 4 L21 8 L17 12 M21 8 C15 8 9 11 9 20\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
372
386
  cornerRadiusMode: 'pathRegen',
373
387
  // regenData is intentionally omitted — generatePathForShape handles this shape directly.
374
388
  },
375
389
  ];
376
390
  // ── UI Icons ─────────────────────────────────────────────────────────────────
377
- const UI_ICON_SHAPES = [
391
+ var UI_ICON_SHAPES = [
378
392
  {
379
393
  key: 'check',
380
394
  labelKey: 'canvas.shape.checkMark',
381
395
  category: 'UI Icons',
382
396
  // Open path — round by setting strokeLineCap/strokeLineJoin
383
397
  pathData: 'M 5 55 L 35 85 L 95 15',
384
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M4 13 L9 18 L20 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,
398
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M4 13 L9 18 L20 6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>",
385
399
  cornerRadiusMode: 'strokeRound',
386
400
  },
387
401
  {
@@ -389,7 +403,7 @@ const UI_ICON_SHAPES = [
389
403
  labelKey: 'canvas.shape.cross',
390
404
  category: 'UI Icons',
391
405
  pathData: 'M 10 10 L 90 90 M 90 10 L 10 90',
392
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M5 5 L19 19 M19 5 L5 19" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`,
406
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M5 5 L19 19 M19 5 L5 19\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>",
393
407
  cornerRadiusMode: 'strokeRound',
394
408
  },
395
409
  {
@@ -397,7 +411,7 @@ const UI_ICON_SHAPES = [
397
411
  labelKey: 'canvas.shape.plus',
398
412
  category: 'UI Icons',
399
413
  pathData: 'M 50 10 L 50 90 M 10 50 L 90 50',
400
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M12 5 V19 M5 12 H19" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`,
414
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M12 5 V19 M5 12 H19\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>",
401
415
  cornerRadiusMode: 'strokeRound',
402
416
  },
403
417
  {
@@ -405,7 +419,7 @@ const UI_ICON_SHAPES = [
405
419
  labelKey: 'canvas.shape.minus',
406
420
  category: 'UI Icons',
407
421
  pathData: 'M 10 50 L 90 50',
408
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M5 12 H19" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`,
422
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M5 12 H19\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>",
409
423
  cornerRadiusMode: 'strokeRound',
410
424
  },
411
425
  {
@@ -414,7 +428,7 @@ const UI_ICON_SHAPES = [
414
428
  category: 'UI Icons',
415
429
  // Outer circle is already curved — no corner rounding
416
430
  pathData: 'M 50 5 A 45 45 0 1 1 49.999 5 Z M 50 30 L 50 32 M 50 42 L 50 72',
417
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M12 8 V8.5 M12 11 V16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`,
431
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"/><path d=\"M12 8 V8.5 M12 11 V16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>",
418
432
  cornerRadiusMode: 'none',
419
433
  },
420
434
  {
@@ -423,7 +437,7 @@ const UI_ICON_SHAPES = [
423
437
  category: 'UI Icons',
424
438
  // Outer triangle + inner ! lines (inner lines kept fixed)
425
439
  pathData: 'M 50 5 L 95 90 L 5 90 Z M 50 40 L 50 60 M 50 70 L 50 72',
426
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M12 3 L22 20 H2 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><path d="M12 10 V14 M12 17 V17.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`,
440
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M12 3 L22 20 H2 Z\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/><path d=\"M12 10 V14 M12 17 V17.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>",
427
441
  cornerRadiusMode: 'pathRegen',
428
442
  regenData: [
429
443
  { type: 'polygon', points: [[50, 5], [95, 90], [5, 90]] },
@@ -432,13 +446,13 @@ const UI_ICON_SHAPES = [
432
446
  },
433
447
  ];
434
448
  // ── Symbol Shapes ─────────────────────────────────────────────────────────────
435
- const SYMBOL_SHAPES = [
449
+ var SYMBOL_SHAPES = [
436
450
  {
437
451
  key: 'star',
438
452
  labelKey: 'canvas.shape.star',
439
453
  category: 'Symbol Shapes',
440
454
  pathData: 'M 50 5 L 61 35 L 95 35 L 68 57 L 79 91 L 50 70 L 21 91 L 32 57 L 5 35 L 39 35 Z',
441
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><polygon points="12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
455
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><polygon points=\"12,2 15.09,8.26 22,9.27 17,14.14 18.18,21.02 12,17.77 5.82,21.02 7,14.14 2,9.27 8.91,8.26\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
442
456
  // pathRegen rounds each polygon corner individually (outer tips + inner concave vertices)
443
457
  cornerRadiusMode: 'pathRegen',
444
458
  regenData: [
@@ -451,7 +465,7 @@ const SYMBOL_SHAPES = [
451
465
  category: 'Symbol Shapes',
452
466
  // Already curved — no corner rounding
453
467
  pathData: 'M 50 85 C 5 55 5 20 25 15 C 35 12 45 17 50 25 C 55 17 65 12 75 15 C 95 20 95 55 50 85 Z',
454
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M12 21C12 21 3 14 3 8.5A4.5 4.5 0 0 1 12 6.5 4.5 4.5 0 0 1 21 8.5C21 14 12 21 12 21Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
468
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M12 21C12 21 3 14 3 8.5A4.5 4.5 0 0 1 12 6.5 4.5 4.5 0 0 1 21 8.5C21 14 12 21 12 21Z\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
455
469
  cornerRadiusMode: 'none',
456
470
  },
457
471
  {
@@ -459,7 +473,7 @@ const SYMBOL_SHAPES = [
459
473
  labelKey: 'canvas.shape.speechBubble',
460
474
  category: 'Symbol Shapes',
461
475
  pathData: 'M 10 10 L 10 65 L 35 65 L 50 90 L 65 65 L 90 65 L 90 10 Z',
462
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M4 4 H20 A2 2 0 0 1 22 6 V15 A2 2 0 0 1 20 17 H9 L4 21 V17 A2 2 0 0 1 2 15 V6 A2 2 0 0 1 4 4 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
476
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M4 4 H20 A2 2 0 0 1 22 6 V15 A2 2 0 0 1 20 17 H9 L4 21 V17 A2 2 0 0 1 2 15 V6 A2 2 0 0 1 4 4 Z\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
463
477
  // pathRegen rounds box corners; the tail corner also softens slightly
464
478
  cornerRadiusMode: 'pathRegen',
465
479
  regenData: [
@@ -473,7 +487,7 @@ const SYMBOL_SHAPES = [
473
487
  labelKey: 'canvas.shape.rhombus',
474
488
  category: 'Symbol Shapes',
475
489
  pathData: 'M 50 5 L 95 50 L 50 95 L 5 50 Z',
476
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><polygon points="12,2 22,12 12,22 2,12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
490
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><polygon points=\"12,2 22,12 12,22 2,12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
477
491
  cornerRadiusMode: 'pathRegen',
478
492
  regenData: [
479
493
  { type: 'polygon', points: [[50, 5], [95, 50], [50, 95], [5, 50]] },
@@ -485,7 +499,7 @@ const SYMBOL_SHAPES = [
485
499
  labelKey: 'canvas.shape.lightning',
486
500
  category: 'Symbol Shapes',
487
501
  pathData: 'M 55 5 L 20 52 L 45 52 L 38 95 L 80 42 L 55 42 Z',
488
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M13 2 L5 13 H11 L9 22 L19 9 H13 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
502
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M13 2 L5 13 H11 L9 22 L19 9 H13 Z\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
489
503
  cornerRadiusMode: 'pathRegen',
490
504
  regenData: [
491
505
  { type: 'polygon', points: [[55, 5], [20, 52], [45, 52], [38, 95], [80, 42], [55, 42]] },
@@ -497,26 +511,20 @@ const SYMBOL_SHAPES = [
497
511
  labelKey: 'canvas.shape.shield',
498
512
  category: 'Symbol Shapes',
499
513
  pathData: 'M 50 5 L 90 20 L 90 55 C 90 75 70 90 50 95 C 30 90 10 75 10 55 L 10 20 Z',
500
- iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path d="M12 3 L20 7 V13 C20 17.5 16.5 21 12 22 C7.5 21 4 17.5 4 13 V7 Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`,
514
+ iconSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\"><path d=\"M12 3 L20 7 V13 C20 17.5 16.5 21 12 22 C7.5 21 4 17.5 4 13 V7 Z\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linejoin=\"round\"/></svg>",
501
515
  cornerRadiusMode: 'pathRegen',
502
516
  lockAspectRatio: false,
503
517
  },
504
518
  ];
505
519
  /** All library shapes, grouped by category (Geometric first, then Arrows) */
506
- export const SHAPE_LIBRARY = [
507
- ...GEOMETRIC_SHAPES,
508
- ...ARROW_SHAPES,
509
- ...MEDIA_SHAPES,
510
- ...UI_ICON_SHAPES,
511
- ...SYMBOL_SHAPES,
512
- ];
520
+ export var SHAPE_LIBRARY = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], GEOMETRIC_SHAPES, true), ARROW_SHAPES, true), MEDIA_SHAPES, true), UI_ICON_SHAPES, true), SYMBOL_SHAPES, true);
513
521
  /**
514
522
  * Keyed shape index: single canonical id→shape lookup, built once at module
515
523
  * load. Replaces the repeated `SHAPE_LIBRARY.find(s => s.key === ...)`
516
524
  * linear scans across Canvas.svelte. Keys are unique by construction
517
525
  * (categories partition the array); a duplicate would be an authoring bug.
518
526
  */
519
- const SHAPE_LIBRARY_BY_KEY = new Map(SHAPE_LIBRARY.map(shape => [shape.key, shape]));
527
+ var SHAPE_LIBRARY_BY_KEY = new Map(SHAPE_LIBRARY.map(function (shape) { return [shape.key, shape]; }));
520
528
  /**
521
529
  * Look up a library shape definition by its stable key.
522
530
  * Returns undefined for unknown keys (dynamic/legacy shape keys).
@@ -528,9 +536,11 @@ export function getShapeByKey(key) {
528
536
  }
529
537
  /** Shapes grouped by category for rendering in the UI */
530
538
  export function getShapesByCategory() {
531
- const map = new Map();
532
- for (const shape of SHAPE_LIBRARY) {
533
- const existing = map.get(shape.category) ?? [];
539
+ var _a;
540
+ var map = new Map();
541
+ for (var _i = 0, SHAPE_LIBRARY_1 = SHAPE_LIBRARY; _i < SHAPE_LIBRARY_1.length; _i++) {
542
+ var shape = SHAPE_LIBRARY_1[_i];
543
+ var existing = (_a = map.get(shape.category)) !== null && _a !== void 0 ? _a : [];
534
544
  existing.push(shape);
535
545
  map.set(shape.category, existing);
536
546
  }