@snowcone-app/canvas 0.17.0 → 0.17.2

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 (66) hide show
  1. package/dist/{CanvasStateV1-C6i6vU6p.js → CanvasStateV1-BG2hEc3-.js} +3 -3
  2. package/dist/{CanvasStateV1-C6i6vU6p.js.map → CanvasStateV1-BG2hEc3-.js.map} +1 -1
  3. package/dist/EditorCanvasImpl-DgXvuWXX.js +70 -0
  4. package/dist/EditorCanvasImpl-DgXvuWXX.js.map +1 -0
  5. package/dist/EditorContext-CGkfmbgo.js +1178 -0
  6. package/dist/EditorContext-CGkfmbgo.js.map +1 -0
  7. package/dist/{ElementFactory-C05JJkRp.js → ElementFactory-CuHSAPfg.js} +1469 -710
  8. package/dist/ElementFactory-CuHSAPfg.js.map +1 -0
  9. package/dist/{HybridHistoryManager-Bht98XRv.js → FontAnalyzer-CLv7_msL.js} +2104 -2903
  10. package/dist/FontAnalyzer-CLv7_msL.js.map +1 -0
  11. package/dist/{ImportManager-kRYfIX-D.js → ImportManager-C_wBjWaV.js} +147 -147
  12. package/dist/{ImportManager-kRYfIX-D.js.map → ImportManager-C_wBjWaV.js.map} +1 -1
  13. package/dist/SnowconeCanvas-wdckG-6O.js +1179 -0
  14. package/dist/SnowconeCanvas-wdckG-6O.js.map +1 -0
  15. package/dist/{UnifiedFontService-BAtqqkU4.js → UnifiedFontService-Dsu5cwfT.js} +141 -141
  16. package/dist/UnifiedFontService-Dsu5cwfT.js.map +1 -0
  17. package/dist/advanced.mjs +10 -10
  18. package/dist/components/editor/RootInternals.d.ts +7 -0
  19. package/dist/components/editor/designStateStore.d.ts +1 -1
  20. package/dist/components/embed/EmbedRoot.d.ts +23 -0
  21. package/dist/components/embed/SnowconeCanvas.d.ts +13 -0
  22. package/dist/components/embed/kernel.d.ts +114 -0
  23. package/dist/contexts/BoundLayerGuardContext.d.ts +36 -0
  24. package/dist/core/GroupElement.d.ts +0 -5
  25. package/dist/core/TextElement.d.ts +8 -3
  26. package/dist/core/paint-registry.d.ts +42 -0
  27. package/dist/core/rich-text-layout.d.ts +28 -0
  28. package/dist/{editorErrors-DbIEtCTt.js → editorErrors-BY4Pdg7a.js} +2 -2
  29. package/dist/{editorErrors-DbIEtCTt.js.map → editorErrors-BY4Pdg7a.js.map} +1 -1
  30. package/dist/{embed-Bdj4PKUA.js → embed-32ZVWfmj.js} +209 -200
  31. package/dist/embed-32ZVWfmj.js.map +1 -0
  32. package/dist/embed.mjs +21 -22
  33. package/dist/embed.mjs.map +1 -1
  34. package/dist/index.mjs +7 -7
  35. package/dist/internals.mjs +93 -93
  36. package/dist/rendering/element-painters.d.ts +16 -0
  37. package/dist/rendering/rich-text-renderer.d.ts +3 -28
  38. package/dist/{template-fields-GOM4MNfq.js → template-fields-Z9x13sjM.js} +32 -33
  39. package/dist/{template-fields-GOM4MNfq.js.map → template-fields-Z9x13sjM.js.map} +1 -1
  40. package/dist/testing.mjs +7 -7
  41. package/dist/transforms/ArchTransform.d.ts +0 -1
  42. package/dist/transforms/AscendTransform.d.ts +0 -1
  43. package/dist/transforms/CircleTransform.d.ts +0 -1
  44. package/dist/transforms/FlagTransform.d.ts +0 -1
  45. package/dist/transforms/LeanTransform.d.ts +0 -1
  46. package/dist/transforms/WaveTransform.d.ts +0 -1
  47. package/dist/{usePieceGuideBundle-CGERAQJl.js → usePieceGuideBundle-C1ipFnZd.js} +2 -2
  48. package/dist/{usePieceGuideBundle-CGERAQJl.js.map → usePieceGuideBundle-C1ipFnZd.js.map} +1 -1
  49. package/dist/{validation-DEd6EOCP.js → validation-C795COGQ.js} +4803 -4791
  50. package/dist/validation-C795COGQ.js.map +1 -0
  51. package/dist/vendor/ui/primitives/kbd.d.ts +1 -1
  52. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  53. package/package.json +7 -4
  54. package/dist/EditorCanvasImpl-DkgE5-C2.js +0 -68
  55. package/dist/EditorCanvasImpl-DkgE5-C2.js.map +0 -1
  56. package/dist/EditorContext-CyanYzo2.js +0 -1131
  57. package/dist/EditorContext-CyanYzo2.js.map +0 -1
  58. package/dist/ElementFactory-C05JJkRp.js.map +0 -1
  59. package/dist/HybridHistoryManager-Bht98XRv.js.map +0 -1
  60. package/dist/SnowconeCanvas-C3eZ9PP8.js +0 -1047
  61. package/dist/SnowconeCanvas-C3eZ9PP8.js.map +0 -1
  62. package/dist/UnifiedFontService-BAtqqkU4.js.map +0 -1
  63. package/dist/editorError-DMENTZ-3.js +0 -19
  64. package/dist/editorError-DMENTZ-3.js.map +0 -1
  65. package/dist/embed-Bdj4PKUA.js.map +0 -1
  66. package/dist/validation-DEd6EOCP.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { A as b, e as w, C as I, I as R, f as W, R as A, S as E, T as H } from "./ImportManager-kRYfIX-D.js";
2
- import { D as p } from "./HybridHistoryManager-Bht98XRv.js";
3
- import { E as F, H as L, J as X, K, L as Y, M as z, N as _, O as B, Q as J, U as N, W as V, V as U, X as Q, Y as Z, Z as $, _ as j, $ as q, a0 as G, a1 as m, c as x, a2 as D, a3 as rr, a4 as or, a5 as sr, a6 as ir, a7 as ar, a8 as er, a9 as nr, aa as tr, ab as hr, ac as dr, ad as cr, ae as fr, af as pr, ag as gr, ah as lr, ai as ur } from "./HybridHistoryManager-Bht98XRv.js";
4
- import { D as kr, E as Mr, W as yr, c as Cr, a as vr, b as Sr, g as Pr, i as br, r as wr, d as Ir, e as Rr, t as Wr, u as Ar } from "./ElementFactory-C05JJkRp.js";
5
- import { A as Hr, e as Or, C as Fr, S as Lr } from "./CanvasStateV1-C6i6vU6p.js";
1
+ import { A as w, e as b, C as I, I as R, f as W, R as A, S as E, T as H } from "./ImportManager-C_wBjWaV.js";
2
+ import { r as p } from "./ElementFactory-CuHSAPfg.js";
3
+ import { D as F, E as L, W as X, a as z, b as K, c as Y, d as B, e as _, f as J, g as N, h as V, i as U, j, k as q, l as Q, m as Z, n as $, o as m, p as G, q as x, s as D, t as rr, u as or, v as sr, w as ir, x as er, y as ar, z as nr, A as tr, B as hr } from "./ElementFactory-CuHSAPfg.js";
4
+ import { D as cr, E as fr, H as pr, J as gr, K as lr, L as ur, M as Tr, N as kr, O as Mr, Q as yr, W as vr, U as Cr, V as Sr, X as Pr, c as wr, Y as br, Z as Ir, _ as Rr, $ as Wr, a0 as Ar } from "./FontAnalyzer-CLv7_msL.js";
5
+ import { A as Hr, e as Or, C as Fr, S as Lr } from "./CanvasStateV1-BG2hEc3-.js";
6
6
  function y(r, o) {
7
7
  return !r.needsCropPixelConversion || r.cropWidth === void 0 ? r : {
8
8
  ...r,
@@ -13,11 +13,11 @@ function y(r, o) {
13
13
  needsCropPixelConversion: !1
14
14
  };
15
15
  }
16
- function C(r, o, c) {
17
- var e, n;
16
+ function v(r, o, c) {
17
+ var a, n;
18
18
  r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
19
- let a = 1, h = 1;
20
- if (o.flipHorizontal && (a = -1), o.flipVertical && (h = -1), (a !== 1 || h !== 1) && r.scale(a, h), o.opacity !== void 0 && o.opacity !== 1 && (r.globalAlpha = o.opacity), o.borderRadius && o.borderRadius > 0) {
19
+ let e = 1, h = 1;
20
+ if (o.flipHorizontal && (e = -1), o.flipVertical && (h = -1), (e !== 1 || h !== 1) && r.scale(e, h), o.opacity !== void 0 && o.opacity !== 1 && (r.globalAlpha = o.opacity), o.borderRadius && o.borderRadius > 0) {
21
21
  const i = Math.min(
22
22
  o.borderRadius / 100 * Math.min(o.width, o.height),
23
23
  o.width / 2,
@@ -37,7 +37,7 @@ function C(r, o, c) {
37
37
  -o.height / 2,
38
38
  o.width,
39
39
  o.height
40
- ) : r.drawImage(c, -o.width / 2, -o.height / 2, o.width, o.height), r.restore(), (e = o.stroke) != null && e.enabled) {
40
+ ) : r.drawImage(c, -o.width / 2, -o.height / 2, o.width, o.height), r.restore(), (a = o.stroke) != null && a.enabled) {
41
41
  const i = ((n = o.knockoutParts) == null ? void 0 : n.stroke) === !0, s = {
42
42
  x: o.x,
43
43
  y: o.y,
@@ -78,14 +78,14 @@ function T(r, o) {
78
78
  const c = document.createElement("canvas");
79
79
  return c.width = r, c.height = o, c;
80
80
  }
81
- function v(r, o) {
82
- var e;
83
- const c = o.opacity ?? 1, a = !!((e = o.stroke) != null && e.enabled);
84
- c < 1 && a ? k(r, o, c) : g(r, o, c);
81
+ function C(r, o) {
82
+ var a;
83
+ const c = o.opacity ?? 1, e = !!((a = o.stroke) != null && a.enabled);
84
+ c < 1 && e ? k(r, o, c) : g(r, o, c);
85
85
  }
86
86
  function k(r, o, c) {
87
87
  var f;
88
- const a = o.transformData, e = (((f = o.stroke) == null ? void 0 : f.width) || 2) + 2, n = Math.ceil(a.width + e * 2), i = Math.ceil(a.height + e * 2), s = T(n, i), t = s.getContext("2d");
88
+ const e = o.transformData, a = (((f = o.stroke) == null ? void 0 : f.width) || 2) + 2, n = Math.ceil(e.width + a * 2), i = Math.ceil(e.height + a * 2), s = T(n, i), t = s.getContext("2d");
89
89
  if (!t) {
90
90
  g(r, o, c);
91
91
  return;
@@ -98,133 +98,133 @@ function k(r, o, c) {
98
98
  g(t, d, 1), r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = c, r.drawImage(s, -n / 2, -i / 2), r.restore();
99
99
  }
100
100
  function g(r, o, c) {
101
- var e;
102
- const a = o.transformData, h = a.fillOpacity ?? 1;
103
- if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = c * h, r.fillStyle = a.fillColor || "#3b82f6", r.beginPath(), u(r, a), r.fill(), r.restore(), (e = o.stroke) != null && e.enabled) {
101
+ var a;
102
+ const e = o.transformData, h = e.fillOpacity ?? 1;
103
+ if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = c * h, r.fillStyle = e.fillColor || "#3b82f6", r.beginPath(), u(r, e), r.fill(), r.restore(), (a = o.stroke) != null && a.enabled) {
104
104
  r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
105
105
  const n = o.stroke;
106
- r.globalAlpha = c * (n.opacity ?? 1), r.strokeStyle = n.color || "#000000", r.lineWidth = n.width || 2, r.lineCap = n.lineCap || "round", r.lineJoin = n.lineJoin || "round", r.beginPath(), u(r, a), r.stroke(), r.restore();
106
+ r.globalAlpha = c * (n.opacity ?? 1), r.strokeStyle = n.color || "#000000", r.lineWidth = n.width || 2, r.lineCap = n.lineCap || "round", r.lineJoin = n.lineJoin || "round", r.beginPath(), u(r, e), r.stroke(), r.restore();
107
107
  }
108
108
  }
109
109
  function u(r, o) {
110
- const { shapeType: c, width: a, height: h } = o;
110
+ const { shapeType: c, width: e, height: h } = o;
111
111
  switch (c) {
112
112
  case "rectangle": {
113
- const e = o.borderRadius || 0, n = -a / 2, i = -h / 2;
114
- if (e > 0) {
115
- const s = Math.min(e / 100 * Math.min(a, h), a / 2, h / 2);
116
- r.roundRect(n, i, a, h, s);
113
+ const a = o.borderRadius || 0, n = -e / 2, i = -h / 2;
114
+ if (a > 0) {
115
+ const s = Math.min(a / 100 * Math.min(e, h), e / 2, h / 2);
116
+ r.roundRect(n, i, e, h, s);
117
117
  } else
118
- r.rect(n, i, a, h);
118
+ r.rect(n, i, e, h);
119
119
  break;
120
120
  }
121
121
  case "circle": {
122
- const e = Math.min(a, h) / 2;
123
- r.arc(0, 0, e, 0, Math.PI * 2);
122
+ const a = Math.min(e, h) / 2;
123
+ r.arc(0, 0, a, 0, Math.PI * 2);
124
124
  break;
125
125
  }
126
126
  case "ellipse": {
127
- r.ellipse(0, 0, a / 2, h / 2, 0, 0, Math.PI * 2);
127
+ r.ellipse(0, 0, e / 2, h / 2, 0, 0, Math.PI * 2);
128
128
  break;
129
129
  }
130
130
  case "triangle": {
131
- const e = a / 2, n = h / 2;
132
- r.moveTo(0, -n), r.lineTo(e, n), r.lineTo(-e, n), r.closePath();
131
+ const a = e / 2, n = h / 2;
132
+ r.moveTo(0, -n), r.lineTo(a, n), r.lineTo(-a, n), r.closePath();
133
133
  break;
134
134
  }
135
135
  case "polygon": {
136
- const e = o.sides || 5, n = Math.min(a, h) / 2;
137
- for (let i = 0; i < e; i++) {
138
- const s = i * 2 * Math.PI / e - Math.PI / 2, t = n * Math.cos(s), d = n * Math.sin(s);
136
+ const a = o.sides || 5, n = Math.min(e, h) / 2;
137
+ for (let i = 0; i < a; i++) {
138
+ const s = i * 2 * Math.PI / a - Math.PI / 2, t = n * Math.cos(s), d = n * Math.sin(s);
139
139
  i === 0 ? r.moveTo(t, d) : r.lineTo(t, d);
140
140
  }
141
141
  r.closePath();
142
142
  break;
143
143
  }
144
144
  case "star": {
145
- const e = o.points || 5, n = Math.min(a, h) / 2, i = n * (o.innerRadius || 0.4);
146
- for (let s = 0; s < e * 2; s++) {
147
- const t = s * Math.PI / e - Math.PI / 2, d = s % 2 === 0 ? n : i, f = d * Math.cos(t), l = d * Math.sin(t);
145
+ const a = o.points || 5, n = Math.min(e, h) / 2, i = n * (o.innerRadius || 0.4);
146
+ for (let s = 0; s < a * 2; s++) {
147
+ const t = s * Math.PI / a - Math.PI / 2, d = s % 2 === 0 ? n : i, f = d * Math.cos(t), l = d * Math.sin(t);
148
148
  s === 0 ? r.moveTo(f, l) : r.lineTo(f, l);
149
149
  }
150
150
  r.closePath();
151
151
  break;
152
152
  }
153
153
  case "line": {
154
- const e = a / 2, n = h / 2;
155
- r.rect(-e, -n, a, h);
154
+ const a = e / 2, n = h / 2;
155
+ r.rect(-a, -n, e, h);
156
156
  break;
157
157
  }
158
158
  default:
159
- r.rect(-a / 2, -h / 2, a, h);
159
+ r.rect(-e / 2, -h / 2, e, h);
160
160
  }
161
161
  }
162
162
  export {
163
- b as AlignmentSnapSystem,
163
+ w as AlignmentSnapSystem,
164
164
  Hr as AnyElementConfigSchema,
165
165
  Or as AnyTransformDataSchema,
166
- F as ArchTransform,
167
- L as ArtboardManager,
168
- w as ArtboardRenderer,
169
- X as AscendTransform,
166
+ cr as ArchTransform,
167
+ fr as ArtboardManager,
168
+ b as ArtboardRenderer,
169
+ pr as AscendTransform,
170
170
  I as CanvasRenderer,
171
171
  Fr as CanvasStateV1Schema,
172
- K as CircleTransform,
173
- Y as CustomTransform,
174
- kr as DEFAULT_MAX_BITMAP_DIMENSION,
175
- z as ElementStore,
176
- Mr as ExportManager,
177
- _ as FlagTransform,
178
- B as HybridHistoryManager,
172
+ gr as CircleTransform,
173
+ lr as CustomTransform,
174
+ F as DEFAULT_MAX_BITMAP_DIMENSION,
175
+ ur as ElementStore,
176
+ L as ExportManager,
177
+ Tr as FlagTransform,
178
+ kr as HybridHistoryManager,
179
179
  R as ImportManager,
180
180
  W as InteractionStateMachine,
181
- J as LeanTransform,
182
- N as LogLevel,
181
+ Mr as LeanTransform,
182
+ yr as LogLevel,
183
183
  A as ResizePipeline,
184
184
  Lr as SerializedArtboardSchema,
185
185
  E as SpacingSystem,
186
186
  H as TransformHandles,
187
- V as WaveTransform,
188
- yr as WorkerExportManager,
189
- U as applySpaceLayoutRules,
190
- Q as applyStrokeStyle,
191
- Z as buildFontString,
192
- $ as calculateFixedCornerPosition,
193
- j as calculateResizeHandles,
194
- q as calculateRotationHandlePosition,
195
- Cr as clearImageBitmapCache,
196
- vr as clearMaskCache,
197
- Sr as clearRegisteredBitmapKeys,
198
- G as createCirclePath,
199
- m as createImagePath,
200
- x as createLogger,
201
- D as createRectPath,
202
- rr as createTextPath,
203
- or as getFontMetrics,
204
- Pr as getSharedWorkerExportManager,
205
- sr as hitTestCircle,
206
- ir as hitTestRect,
207
- br as invalidateMaskCache,
208
- ar as logger,
209
- er as measureTextWidth,
210
- wr as removeFromImageBitmapCache,
211
- nr as renderCustomTransform,
212
- C as renderImageElement,
187
+ vr as WaveTransform,
188
+ X as WorkerExportManager,
189
+ z as applySpaceLayoutRules,
190
+ K as applyStrokeStyle,
191
+ Y as buildFontString,
192
+ Cr as calculateFixedCornerPosition,
193
+ Sr as calculateResizeHandles,
194
+ Pr as calculateRotationHandlePosition,
195
+ B as clearImageBitmapCache,
196
+ _ as clearMaskCache,
197
+ J as clearRegisteredBitmapKeys,
198
+ N as createCirclePath,
199
+ V as createImagePath,
200
+ wr as createLogger,
201
+ U as createRectPath,
202
+ j as createTextPath,
203
+ q as getFontMetrics,
204
+ Q as getSharedWorkerExportManager,
205
+ br as hitTestCircle,
206
+ Ir as hitTestRect,
207
+ Z as invalidateMaskCache,
208
+ Rr as logger,
209
+ $ as measureTextWidth,
210
+ m as removeFromImageBitmapCache,
211
+ G as renderCustomTransform,
212
+ v as renderImageElement,
213
213
  p as renderImageStroke,
214
- tr as renderMultilineText,
215
- hr as renderPathStroke,
216
- dr as renderRichTextFillOnly,
217
- v as renderShapeElement,
218
- cr as renderTextElement,
219
- fr as renderTextFillOnly,
220
- pr as renderTextStroke,
221
- Ir as renderWithKnockout,
222
- Rr as renderWithMasks,
214
+ x as renderMultilineText,
215
+ D as renderPathStroke,
216
+ rr as renderRichTextFillOnly,
217
+ C as renderShapeElement,
218
+ or as renderTextElement,
219
+ sr as renderTextFillOnly,
220
+ ir as renderTextStroke,
221
+ er as renderWithKnockout,
222
+ ar as renderWithMasks,
223
223
  y as resolveServerCrop,
224
- gr as splitRichTextIntoLines,
225
- Wr as terminateSharedWorkerExportManager,
226
- Ar as unregisterElementBitmaps,
227
- lr as wrapRichTextSpans,
228
- ur as wrapText
224
+ Wr as splitRichTextIntoLines,
225
+ nr as terminateSharedWorkerExportManager,
226
+ tr as unregisterElementBitmaps,
227
+ Ar as wrapRichTextSpans,
228
+ hr as wrapText
229
229
  };
230
230
  //# sourceMappingURL=internals.mjs.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Element painters — the heavy half of the paint registry
3
+ * (`src/core/paint-registry.ts`, P1 element/renderer split).
4
+ *
5
+ * Registers the shared paint functions the element model delegates to at
6
+ * paint time. This module statically imports the paint pipeline
7
+ * (transform-renderer / canvas-renderer), so it must only ever be reachable
8
+ * through renderer-side code: every paint DRIVER (CanvasRenderer,
9
+ * ExportManager, ElementPreviewRenderer) imports it, which keeps the
10
+ * registration a static guarantee of "the renderer is loaded" without the
11
+ * model graph ever touching `src/rendering/*`. CI-gated by
12
+ * scripts/check-import-graph.mjs.
13
+ */
14
+ /** Idempotent; also runs at module evaluation, so a plain side-effect import
15
+ * (`import './element-painters.js'`) suffices. */
16
+ export declare function installElementPainters(): void;
@@ -1,32 +1,7 @@
1
- import { TextAlign, CharacterStyle, RichText } from '../types/index.js';
1
+ import { TextAlign, RichText } from '../types/index.js';
2
2
  import { RenderContext } from './renderer-types.js';
3
- /**
4
- * Wrap rich text spans to fit within a given width, preserving character-level formatting
5
- *
6
- * This function handles character-level formatting correctly by:
7
- * 1. First merging consecutive spans with the same style
8
- * 2. Finding word boundaries (spaces) across spans
9
- * 3. Wrapping at word boundaries, not at span boundaries
10
- */
11
- export declare function wrapRichTextSpans(spans: Array<{
12
- text: string;
13
- style: CharacterStyle;
14
- }>, maxWidth: number, element: {
15
- fontSize: number;
16
- fontFamily: string;
17
- bold?: boolean;
18
- italic?: boolean;
19
- }): Array<{
20
- text: string;
21
- style: CharacterStyle;
22
- }[]>;
23
- /**
24
- * Split rich text into lines by explicit newlines, preserving span formatting
25
- */
26
- export declare function splitRichTextIntoLines(richText: RichText): Array<{
27
- text: string;
28
- style: CharacterStyle;
29
- }[]>;
3
+ import { splitRichTextIntoLines, wrapRichTextSpans } from '../core/rich-text-layout.js';
4
+ export { splitRichTextIntoLines, wrapRichTextSpans };
30
5
  /**
31
6
  * Render rich text with per-span styling (fill only, no effects)
32
7
  * Supports multi-line text with line breaks and word wrapping
@@ -1,11 +1,10 @@
1
1
  import { useCallback as C, useEffect as et, useMemo as $, useRef as A, useState as _ } from "react";
2
- import { u as G, c as T, b as H } from "./EditorContext-CyanYzo2.js";
3
- import { c as nt, y as z, T as B, I as J, z as ot } from "./HybridHistoryManager-Bht98XRv.js";
4
- import { U as rt } from "./UnifiedFontService-BAtqqkU4.js";
5
- import { E as P } from "./editorError-DMENTZ-3.js";
6
- import { a as it, o as E, b as h, n as at, l as b, u as L, c as st } from "./CanvasStateV1-C6i6vU6p.js";
2
+ import { u as G, c as T, b as H, g as z } from "./EditorContext-CGkfmbgo.js";
3
+ import { c as nt, y as P, T as B, I as J, z as ot } from "./FontAnalyzer-CLv7_msL.js";
4
+ import { U as rt } from "./UnifiedFontService-Dsu5cwfT.js";
5
+ import { a as it, o as E, b as h, n as at, l as b, u as L, c as st } from "./CanvasStateV1-BG2hEc3-.js";
7
6
  const X = nt("useCommands");
8
- function Mt() {
7
+ function Bt() {
9
8
  const t = G(), {
10
9
  undo: e,
11
10
  redo: n,
@@ -45,7 +44,7 @@ function Mt() {
45
44
  executeCommandBatch: c
46
45
  };
47
46
  }
48
- function Ut() {
47
+ function Mt() {
49
48
  const { selectedElement: t } = G();
50
49
  return t ?? null;
51
50
  }
@@ -77,7 +76,7 @@ function ht(t, e, n) {
77
76
  function M(t, e, n, r) {
78
77
  et(() => {
79
78
  var a;
80
- if (r || typeof z > "u" || ((a = z.env) == null ? void 0 : a.NODE_ENV) === "production") return;
79
+ if (r || typeof P > "u" || ((a = P.env) == null ? void 0 : a.NODE_ENV) === "production") return;
81
80
  const i = `${t}:${e}`;
82
81
  if (v.has(i)) return;
83
82
  const o = setTimeout(() => {
@@ -88,7 +87,7 @@ function M(t, e, n, r) {
88
87
  }
89
88
  const dt = () => {
90
89
  }, mt = [];
91
- function Wt(t) {
90
+ function Ut(t) {
92
91
  const { elementStore: e } = T(), { executeElementUpdate: n } = H(), r = $(() => e.getAllByName(t).filter((a) => a instanceof B), [e, t]), i = C(
93
92
  (o) => {
94
93
  for (const a of r) {
@@ -132,7 +131,7 @@ function pt(t, e, n) {
132
131
  };
133
132
  }
134
133
  }
135
- function It(t, e) {
134
+ function Wt(t, e) {
136
135
  const n = (e == null ? void 0 : e.fit) ?? "cover", { elementStore: r, setElements: i } = T(), { executeElementUpdate: o } = H(), a = $(() => r.getAllByName(t).filter((g) => g instanceof J), [r, t]), s = A(/* @__PURE__ */ new Map());
137
136
  for (const d of a)
138
137
  if (!s.current.has(d.id)) {
@@ -194,7 +193,7 @@ function bt(t, e, n) {
194
193
  const r = t.clone(), i = t, o = r;
195
194
  return x(i.color, e) && (typeof o.setColor == "function" ? o.setColor(n) : o.color = n), x((a = i.transformData) == null ? void 0 : a.fillColor, e) && (o.transformData = { ...o.transformData, fillColor: n }), x((s = i.transformData) == null ? void 0 : s.strokeColor, e) && (o.transformData = { ...o.transformData, strokeColor: n }), ((l = i.stroke) == null ? void 0 : l.enabled) === !0 && x(i.stroke.color, e) && (o.stroke = { ...o.stroke, color: n }), r;
196
195
  }
197
- function Yt(t) {
196
+ function It(t) {
198
197
  const { elementStore: e } = T(), { executeElementUpdate: n } = H(), [r, i] = _(() => R(t)), [o, a] = _(t);
199
198
  t !== o && (a(t), i(R(t)));
200
199
  const s = $(
@@ -217,7 +216,7 @@ function Yt(t) {
217
216
  }
218
217
  const xt = () => {
219
218
  }, wt = [];
220
- function _t(t) {
219
+ function Yt(t) {
221
220
  const { elementStore: e } = T(), { executeElementUpdate: n } = H(), r = $(() => e.getAllByName(t).filter((a) => a instanceof B), [e, t]), i = C(
222
221
  (o) => {
223
222
  rt.loadGoogleFontByName(o);
@@ -238,7 +237,7 @@ function _t(t) {
238
237
  isConnected: !0
239
238
  };
240
239
  }
241
- function zt(t) {
240
+ function _t(t) {
242
241
  const { elementStore: e } = T();
243
242
  return t ? e.getByName(t) ?? null : null;
244
243
  }
@@ -310,7 +309,7 @@ function Tt(t) {
310
309
  return !n && (e.cropX !== 0 || e.cropY !== 0 || e.cropWidth !== 1 || e.cropHeight !== 1) && (s.cropX = e.cropX, s.cropY = e.cropY, s.cropWidth = e.cropWidth, s.cropHeight = e.cropHeight, s.needsCropPixelConversion = !0), e.flipHorizontal && (s.flipHorizontal = e.flipHorizontal), e.flipVertical && (s.flipVertical = e.flipVertical), e.borderRadius && (s.borderRadius = e.borderRadius), t.opacity !== void 0 && (s.opacity = t.opacity), t.distressEffect && (s.distressEffect = t.distressEffect), ((c = t.masks) == null ? void 0 : c.length) > 0 && (s.masks = t.masks), t.blendMode && (s.blendMode = t.blendMode), t.knockoutParts && (s.knockoutParts = t.knockoutParts), t.stroke && (s.stroke = t.stroke), Q(s);
311
310
  }
312
311
  const j = "center", Z = Symbol.for("snowcone.canvas.layerToken");
313
- function Pt(t) {
312
+ function zt(t) {
314
313
  return typeof t == "object" && t !== null && t[Z] === !0 && typeof t.name == "string" && (t.kind === "text" || t.kind === "image");
315
314
  }
316
315
  function Nt(t, e) {
@@ -498,7 +497,7 @@ class U {
498
497
  const n = this.els.find((i) => i.name === e);
499
498
  if (!n) {
500
499
  const i = this.layerNamesOfKind("text"), o = this.layerNamesOfKind("image");
501
- throw new P(
500
+ throw new z(
502
501
  "E_LAYER_NOT_FOUND",
503
502
  `no layer "${e}" in this design. Text layers: ${JSON.stringify(i)}; image layers: ${JSON.stringify(o)}. Fix the name, or add the layer first — e.g. design(…).text('…', { name: '${e}' }).`,
504
503
  { layerName: e, validNames: [...i, ...o], textNames: i, imageNames: o, docSlug: "embed-mode" }
@@ -506,7 +505,7 @@ class U {
506
505
  }
507
506
  const r = O(n);
508
507
  if (!r)
509
- throw new P(
508
+ throw new z(
510
509
  "E_LAYER_WRONG_KIND",
511
510
  `layer "${e}" is a ${n.transformType} element — only text and image layers are bindable. Bindable layers: ${JSON.stringify([...this.layerNamesOfKind("text"), ...this.layerNamesOfKind("image")])}.`,
512
511
  { layerName: e, actualType: n.transformType, docSlug: "embed-mode" }
@@ -569,10 +568,10 @@ class U {
569
568
  return kt(this.toJSON());
570
569
  }
571
570
  }
572
- function Lt(t) {
571
+ function Pt(t) {
573
572
  return new U(t);
574
573
  }
575
- function Xt(t) {
574
+ function Lt(t) {
576
575
  return O(t);
577
576
  }
578
577
  const tt = "personalization", $t = it("type", [
@@ -607,7 +606,7 @@ const tt = "personalization", $t = it("type", [
607
606
  group: h().optional()
608
607
  })
609
608
  ]);
610
- function Kt(t) {
609
+ function Xt(t) {
611
610
  if (!t || typeof t != "object") return [];
612
611
  const e = t[tt];
613
612
  if (!Array.isArray(e)) return [];
@@ -619,25 +618,25 @@ function Kt(t) {
619
618
  }
620
619
  return n;
621
620
  }
622
- function Vt(t, e) {
621
+ function Kt(t, e) {
623
622
  return { ...t, [tt]: e };
624
623
  }
625
624
  export {
626
625
  Ct as C,
627
626
  U as D,
628
627
  tt as T,
629
- Mt as a,
630
- zt as b,
631
- _t as c,
632
- Lt as d,
633
- It as e,
634
- Ut as f,
635
- Wt as g,
636
- Pt as i,
637
- Xt as l,
638
- Kt as r,
628
+ Bt as a,
629
+ _t as b,
630
+ Yt as c,
631
+ Pt as d,
632
+ Wt as e,
633
+ Mt as f,
634
+ Ut as g,
635
+ zt as i,
636
+ Lt as l,
637
+ Xt as r,
639
638
  kt as s,
640
- Yt as u,
641
- Vt as w
639
+ It as u,
640
+ Kt as w
642
641
  };
643
- //# sourceMappingURL=template-fields-GOM4MNfq.js.map
642
+ //# sourceMappingURL=template-fields-Z9x13sjM.js.map