@snowcone-app/canvas 0.46.2 → 0.46.5

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 (55) hide show
  1. package/dist/{CanvasRenderer-B8BADU_r.js → CanvasRenderer-CmIQSVCK.js} +4 -4
  2. package/dist/{CanvasRenderer-B8BADU_r.js.map → CanvasRenderer-CmIQSVCK.js.map} +1 -1
  3. package/dist/{ContextualToolbars-5tHC6s0Y.js → ContextualToolbars-Dmo86Wd2.js} +323 -322
  4. package/dist/{ContextualToolbars-5tHC6s0Y.js.map → ContextualToolbars-Dmo86Wd2.js.map} +1 -1
  5. package/dist/{EditorCanvasImpl-Cd_umlTI.js → EditorCanvasImpl-BHa8q4iO.js} +16 -15
  6. package/dist/{EditorCanvasImpl-Cd_umlTI.js.map → EditorCanvasImpl-BHa8q4iO.js.map} +1 -1
  7. package/dist/{ExportManager-xRsXgyNo.js → ExportManager-DEJgxB0S.js} +79 -78
  8. package/dist/{ExportManager-xRsXgyNo.js.map → ExportManager-DEJgxB0S.js.map} +1 -1
  9. package/dist/{FontAnalyzer-Ds3Wdba7.js → FontAnalyzer-CLMJi2Sw.js} +374 -409
  10. package/dist/FontAnalyzer-CLMJi2Sw.js.map +1 -0
  11. package/dist/{ImagePanel-bW3yr6Ac.js → ImagePanel-4fHABjNT.js} +6 -6
  12. package/dist/{ImagePanel-bW3yr6Ac.js.map → ImagePanel-4fHABjNT.js.map} +1 -1
  13. package/dist/{SnowconeCanvas-crxPwbib.js → SnowconeCanvas-GPag5BXG.js} +10 -10
  14. package/dist/{SnowconeCanvas-crxPwbib.js.map → SnowconeCanvas-GPag5BXG.js.map} +1 -1
  15. package/dist/advanced.mjs +54 -54
  16. package/dist/core/image-adjustments.d.ts +2 -4
  17. package/dist/core/masked-crop.d.ts +3 -55
  18. package/dist/{custom-icons-DQRp8GhF.js → custom-icons-Dt0Y4VSn.js} +2 -2
  19. package/dist/{custom-icons-DQRp8GhF.js.map → custom-icons-Dt0Y4VSn.js.map} +1 -1
  20. package/dist/design-builder-HKRo18WT.js +1798 -0
  21. package/dist/design-builder-HKRo18WT.js.map +1 -0
  22. package/dist/{embed-DvN5BVmQ.js → embed-DhjsJ3ni.js} +698 -688
  23. package/dist/embed-DhjsJ3ni.js.map +1 -0
  24. package/dist/embed.mjs +35 -36
  25. package/dist/embed.mjs.map +1 -1
  26. package/dist/{export-worker.bundle.string-BL30CYzH.js → export-worker.bundle.string-CyMb_XjB.js} +27 -25
  27. package/dist/{export-worker.bundle.string-BL30CYzH.js.map → export-worker.bundle.string-CyMb_XjB.js.map} +1 -1
  28. package/dist/{guards-DwYEoqcn.js → guards-Dk86a-kH.js} +2 -2
  29. package/dist/{guards-DwYEoqcn.js.map → guards-Dk86a-kH.js.map} +1 -1
  30. package/dist/index.mjs +43 -43
  31. package/dist/internals.mjs +150 -149
  32. package/dist/internals.mjs.map +1 -1
  33. package/dist/rendering/serialize-for-server.d.ts +4 -91
  34. package/dist/state/CanvasStateV1.d.ts +1 -363
  35. package/dist/{CanvasStateV1-BlDWgOzV.js → template-fields-CKEuUmTM.js} +1997 -1835
  36. package/dist/template-fields-CKEuUmTM.js.map +1 -0
  37. package/dist/testing.mjs +61 -60
  38. package/dist/testing.mjs.map +1 -1
  39. package/dist/{useCommands-F-b_SwW-.js → useCommands-BI7O5Lf0.js} +225 -225
  40. package/dist/{useCommands-F-b_SwW-.js.map → useCommands-BI7O5Lf0.js.map} +1 -1
  41. package/dist/{usePieceGuideBundle-BWdobHQE.js → usePieceGuideBundle-DJfjOVEd.js} +2 -2
  42. package/dist/{usePieceGuideBundle-BWdobHQE.js.map → usePieceGuideBundle-DJfjOVEd.js.map} +1 -1
  43. package/dist/utils/custom-fonts.d.ts +2 -16
  44. package/dist/{validation-hn5ZX8Po.js → validation-au_-Sj-A.js} +11 -11
  45. package/dist/{validation-hn5ZX8Po.js.map → validation-au_-Sj-A.js.map} +1 -1
  46. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  47. package/example/package.json +1 -1
  48. package/package.json +5 -4
  49. package/dist/CanvasStateV1-BlDWgOzV.js.map +0 -1
  50. package/dist/FontAnalyzer-Ds3Wdba7.js.map +0 -1
  51. package/dist/design-builder-sH53Og6j.js +0 -1870
  52. package/dist/design-builder-sH53Og6j.js.map +0 -1
  53. package/dist/embed-DvN5BVmQ.js.map +0 -1
  54. package/dist/template-fields-BaQG0CJY.js +0 -559
  55. package/dist/template-fields-BaQG0CJY.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-Ds3Wdba7.js";
1
+ import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-CLMJi2Sw.js";
2
2
  function r(e) {
3
3
  return e instanceof i;
4
4
  }
@@ -21,4 +21,4 @@ export {
21
21
  r as d,
22
22
  m as i
23
23
  };
24
- //# sourceMappingURL=guards-DwYEoqcn.js.map
24
+ //# sourceMappingURL=guards-Dk86a-kH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"guards-DwYEoqcn.js","sources":["../src/types/guards.ts"],"sourcesContent":["/**\n * Type guards for EditorElement discrimination\n *\n * These guards use instanceof checks against the concrete element classes,\n * matching the pattern established in EditorContext.tsx. They accept\n * BaseElement | EditorElement | undefined | null for maximum flexibility\n * at call sites.\n */\n\nimport { BaseElement } from '../core/BaseElement.js';\nimport { TextElement } from '../core/TextElement.js';\nimport { ImageElement } from '../core/ImageElement.js';\nimport { GroupElement } from '../core/GroupElement.js';\nimport { ShapeElement } from '../core/ShapeElement.js';\nimport { PathElement } from '../core/PathElement.js';\n\ntype Narrowable = BaseElement | TextElement | ImageElement | GroupElement | ShapeElement | PathElement | undefined | null;\n\n/**\n * Type guard: checks if an element is a TextElement (or any text-based transform subclass).\n *\n * TextElement is the base class for all text transforms (custom, circle, arch, wave, etc.),\n * so this returns true for any text-based element regardless of its specific transformType.\n */\nexport function isTextElement(element: Narrowable): element is TextElement {\n return element instanceof TextElement;\n}\n\n/**\n * Type guard: checks if an element is an ImageElement.\n */\nexport function isImageElement(element: Narrowable): element is ImageElement {\n return element instanceof ImageElement;\n}\n\n/**\n * Type guard: checks if an element is a GroupElement.\n */\nexport function isGroupElement(element: Narrowable): element is GroupElement {\n return element instanceof GroupElement;\n}\n\n/**\n * Type guard: checks if an element is a ShapeElement.\n */\nexport function isShapeElement(element: Narrowable): element is ShapeElement {\n return element instanceof ShapeElement;\n}\n\n/**\n * Type guard: checks if an element is a PathElement.\n */\nexport function isPathElement(element: Narrowable): element is PathElement {\n return element instanceof PathElement;\n}\n"],"names":["isTextElement","element","TextElement","isImageElement","ImageElement","isGroupElement","GroupElement","isShapeElement","ShapeElement","isPathElement","PathElement"],"mappings":";AAwBO,SAASA,EAAcC,GAA6C;AACzE,SAAOA,aAAmBC;AAC5B;AAKO,SAASC,EAAeF,GAA8C;AAC3E,SAAOA,aAAmBG;AAC5B;AAKO,SAASC,EAAeJ,GAA8C;AAC3E,SAAOA,aAAmBK;AAC5B;AAKO,SAASC,EAAeN,GAA8C;AAC3E,SAAOA,aAAmBO;AAC5B;AAKO,SAASC,EAAcR,GAA6C;AACzE,SAAOA,aAAmBS;AAC5B;"}
1
+ {"version":3,"file":"guards-Dk86a-kH.js","sources":["../src/types/guards.ts"],"sourcesContent":["/**\n * Type guards for EditorElement discrimination\n *\n * These guards use instanceof checks against the concrete element classes,\n * matching the pattern established in EditorContext.tsx. They accept\n * BaseElement | EditorElement | undefined | null for maximum flexibility\n * at call sites.\n */\n\nimport { BaseElement } from '../core/BaseElement.js';\nimport { TextElement } from '../core/TextElement.js';\nimport { ImageElement } from '../core/ImageElement.js';\nimport { GroupElement } from '../core/GroupElement.js';\nimport { ShapeElement } from '../core/ShapeElement.js';\nimport { PathElement } from '../core/PathElement.js';\n\ntype Narrowable = BaseElement | TextElement | ImageElement | GroupElement | ShapeElement | PathElement | undefined | null;\n\n/**\n * Type guard: checks if an element is a TextElement (or any text-based transform subclass).\n *\n * TextElement is the base class for all text transforms (custom, circle, arch, wave, etc.),\n * so this returns true for any text-based element regardless of its specific transformType.\n */\nexport function isTextElement(element: Narrowable): element is TextElement {\n return element instanceof TextElement;\n}\n\n/**\n * Type guard: checks if an element is an ImageElement.\n */\nexport function isImageElement(element: Narrowable): element is ImageElement {\n return element instanceof ImageElement;\n}\n\n/**\n * Type guard: checks if an element is a GroupElement.\n */\nexport function isGroupElement(element: Narrowable): element is GroupElement {\n return element instanceof GroupElement;\n}\n\n/**\n * Type guard: checks if an element is a ShapeElement.\n */\nexport function isShapeElement(element: Narrowable): element is ShapeElement {\n return element instanceof ShapeElement;\n}\n\n/**\n * Type guard: checks if an element is a PathElement.\n */\nexport function isPathElement(element: Narrowable): element is PathElement {\n return element instanceof PathElement;\n}\n"],"names":["isTextElement","element","TextElement","isImageElement","ImageElement","isGroupElement","GroupElement","isShapeElement","ShapeElement","isPathElement","PathElement"],"mappings":";AAwBO,SAASA,EAAcC,GAA6C;AACzE,SAAOA,aAAmBC;AAC5B;AAKO,SAASC,EAAeF,GAA8C;AAC3E,SAAOA,aAAmBG;AAC5B;AAKO,SAASC,EAAeJ,GAA8C;AAC3E,SAAOA,aAAmBK;AAC5B;AAKO,SAASC,EAAeN,GAA8C;AAC3E,SAAOA,aAAmBO;AAC5B;AAKO,SAASC,EAAcR,GAA6C;AACzE,SAAOA,aAAmBS;AAC5B;"}
package/dist/index.mjs CHANGED
@@ -1,72 +1,72 @@
1
- import { e as u } from "./useCommands-F-b_SwW-.js";
2
- import { C as l, f as x, g as A, h as I, b as g, a as v, j as T, k as L, l as B } from "./useCommands-F-b_SwW-.js";
3
- import { E as P, S as _, S as y, u as R, a as O } from "./SnowconeCanvas-crxPwbib.js";
1
+ import { e as u } from "./useCommands-BI7O5Lf0.js";
2
+ import { C as l, f as x, g as A, h as I, b as g, a as v, j as T, k as L, l as B } from "./useCommands-BI7O5Lf0.js";
3
+ import { E as P, S as _, S as y, u as R, a as O } from "./SnowconeCanvas-GPag5BXG.js";
4
4
  import { E as z, c as w } from "./adjust-CDVzlVBY.js";
5
- import { b as m, e as d } from "./design-builder-sH53Og6j.js";
6
- import { C as N, D as V, f as D, s as b } from "./design-builder-sH53Og6j.js";
7
- import { T as G, r as H, u as U, a as Y, b as Z, c as j, d as k, e as J, w as q } from "./template-fields-BaQG0CJY.js";
8
- import { A as W, C as X, E as $, M as ee, P as se, r as ae, v as te } from "./validation-hn5ZX8Po.js";
9
- import { G as re, H as ne, J as ie, K as ue } from "./ExportManager-xRsXgyNo.js";
10
- import { c as de, e as Ee } from "./compose-DtQL_oit.js";
11
- import { d as Ce, m as fe, s as ce, v as pe } from "./CanvasStateV1-BlDWgOzV.js";
12
- function C() {
5
+ import { b as m, e as d } from "./design-builder-HKRo18WT.js";
6
+ import { D as N, f as V } from "./design-builder-HKRo18WT.js";
7
+ import { T as b, d as h, m as G, r as H, s as U, u as Y, a as Z, b as j, c as k, e as J, f as q, v as Q, w as W } from "./template-fields-CKEuUmTM.js";
8
+ import { A as $, C as ee, E as se, M as ae, P as te, r as oe, v as re } from "./validation-au_-Sj-A.js";
9
+ import { G as ie, H as ue, J as me, K as de } from "./ExportManager-DEJgxB0S.js";
10
+ import { CANVAS_STATE_SCHEMA_VERSION as Se, serializeStateForServer as fe } from "@snowcone-app/design/wire";
11
+ import { c as ce, e as pe } from "./compose-DtQL_oit.js";
12
+ function f() {
13
13
  const { isCanvasReady: e } = m();
14
14
  return e;
15
15
  }
16
- function f() {
16
+ function C() {
17
17
  const { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i } = d();
18
18
  return { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i };
19
19
  }
20
20
  u();
21
21
  export {
22
- W as ALL_CAPABILITIES,
23
- N as CANVAS_STATE_SCHEMA_VERSION,
24
- X as COMPACT_CUSTOMIZER,
22
+ $ as ALL_CAPABILITIES,
23
+ Se as CANVAS_STATE_SCHEMA_VERSION,
24
+ ee as COMPACT_CUSTOMIZER,
25
25
  l as CanvasServicesProvider,
26
- V as DesignBuilder,
27
- $ as EMBED_ONLY,
26
+ N as DesignBuilder,
27
+ se as EMBED_ONLY,
28
28
  z as ENGRAVE_STEEL,
29
29
  P as ErrorBoundary,
30
- ee as MINIMAL_CAPABILITIES,
31
- se as PRO_STUDIO,
30
+ ae as MINIMAL_CAPABILITIES,
31
+ te as PRO_STUDIO,
32
32
  _ as SnowconeCanvas,
33
- G as TEMPLATE_FIELDS_KEY,
34
- de as createKit,
33
+ b as TEMPLATE_FIELDS_KEY,
34
+ ce as createKit,
35
35
  x as createProxyBgRemove,
36
36
  A as createProxyGenerate,
37
37
  I as createProxyImageSearch,
38
- re as customFontRegistry,
38
+ ie as customFontRegistry,
39
39
  w as cutLightFor,
40
40
  y as default,
41
- Ce as deserializeState,
42
- D as design,
43
- ne as ensureCustomFontsLoaded,
44
- Ee as extendKit,
45
- ie as loadCustomFont,
46
- fe as migrateState,
41
+ h as deserializeState,
42
+ V as design,
43
+ ue as ensureCustomFontsLoaded,
44
+ pe as extendKit,
45
+ me as loadCustomFont,
46
+ G as migrateState,
47
47
  H as readTemplateFields,
48
- ue as registerCustomFonts,
49
- ae as resolveKit,
50
- ce as serializeState,
51
- b as serializeStateForServer,
48
+ de as registerCustomFonts,
49
+ oe as resolveKit,
50
+ U as serializeState,
51
+ fe as serializeStateForServer,
52
52
  g as useArtboards,
53
53
  R as useAutoExport,
54
- C as useCanvasReady,
54
+ f as useCanvasReady,
55
55
  v as useCanvasServices,
56
- U as useColorBinding,
56
+ Y as useColorBinding,
57
57
  T as useCommands,
58
58
  O as useContentReady,
59
59
  m as useEditor,
60
- Y as useElementByName,
60
+ Z as useElementByName,
61
61
  L as useExport,
62
- Z as useFontBinding,
63
- j as useImageBinding,
62
+ j as useFontBinding,
63
+ k as useImageBinding,
64
64
  B as useLayers,
65
- k as useSelectedElement,
66
- J as useTextBinding,
67
- f as useViewport,
68
- te as validateKit,
69
- pe as validateState,
70
- q as withTemplateFields
65
+ J as useSelectedElement,
66
+ q as useTextBinding,
67
+ C as useViewport,
68
+ re as validateKit,
69
+ Q as validateState,
70
+ W as withTemplateFields
71
71
  };
72
72
  //# sourceMappingURL=index.mjs.map
@@ -1,25 +1,26 @@
1
- import { A as rr, a as or, C as sr, I as er, R as tr, S as nr, T as ar } from "./CanvasRenderer-B8BADU_r.js";
2
- import { r as k } from "./ExportManager-xRsXgyNo.js";
3
- import { D as hr, a as cr, I as dr, W as fr, b as gr, c as lr, d as ur, e as pr, f as yr, g as kr, h as vr, i as wr, j as Cr, k as Mr, l as Tr, m as Sr, n as br, o as Pr, p as Ir, q as mr, s as Ar, t as Rr, u as Wr, v as Er, w as Or, x as Hr, y as jr, z as Fr, A as Lr, B as Xr, C as zr, F as Nr } from "./ExportManager-xRsXgyNo.js";
4
- import { i as H, a as j, c as F, r as L, b as X } from "./FontAnalyzer-Ds3Wdba7.js";
5
- import { d as Br, e as Kr, f as Ur, C as Yr, g as Jr, E as Vr, F as qr, H as Gr, L as Qr, h as Zr, W as $r, j as xr, k as Dr, l as ro, m as oo, n as so, o as eo, s as to, w as no } from "./FontAnalyzer-Ds3Wdba7.js";
6
- import { A as io, a as ho, C as co, S as fo } from "./CanvasStateV1-BlDWgOzV.js";
7
- const z = F("image-adjustments"), v = 1e-3;
1
+ import { A as or, a as er, C as sr, I as tr, R as nr, S as ir, T as ar } from "./CanvasRenderer-CmIQSVCK.js";
2
+ import { r as k } from "./ExportManager-DEJgxB0S.js";
3
+ import { D as cr, a as dr, I as fr, W as gr, b as lr, c as ur, d as pr, e as yr, f as kr, g as vr, h as wr, i as Mr, j as Tr, k as Cr, l as br, m as Sr, n as Pr, o as Ir, p as mr, q as Ar, s as Rr, t as Wr, u as Er, v as Or, w as Hr, x as jr, y as Fr, z as Lr, A as Xr, B as zr, C as Nr, F as _r } from "./ExportManager-DEJgxB0S.js";
4
+ import { a as H, c as j, r as F, b as L } from "./FontAnalyzer-CLMJi2Sw.js";
5
+ import { d as Kr, e as Ur, f as Yr, C as Jr, g as Vr, E as qr, F as Gr, H as Qr, L as Zr, h as $r, W as xr, i as Dr, j as ro, k as oo, l as eo, m as so, n as to, s as no, w as io } from "./FontAnalyzer-CLMJi2Sw.js";
6
+ import { AnyElementConfigSchema as ho, AnyTransformDataSchema as co, CanvasStateV1Schema as fo, SerializedArtboardSchema as go } from "@snowcone-app/design";
7
+ import { isNeutralAdjustments as X } from "@snowcone-app/design/wire";
8
+ const z = j("image-adjustments"), v = 1e-3;
8
9
  function N(r, o) {
9
- const { brightness: a, contrast: s, saturation: h } = o, e = a * s, t = 127.5 * (1 - s), f = Math.abs(e - 1) > v || Math.abs(t) > v, i = new Uint8ClampedArray(256);
10
+ const { brightness: i, contrast: e, saturation: h } = o, s = i * e, t = 127.5 * (1 - e), f = Math.abs(s - 1) > v || Math.abs(t) > v, a = new Uint8ClampedArray(256);
10
11
  if (f)
11
- for (let l = 0; l < 256; l++) i[l] = l * e + t;
12
- const c = Math.abs(h - 1) > v, n = h, d = 0.213 + 0.787 * n, g = 0.715 - 0.715 * n, S = 0.072 - 0.072 * n, b = 0.213 - 0.213 * n, P = 0.715 + 0.285 * n, I = 0.072 - 0.072 * n, m = 0.213 - 0.213 * n, A = 0.715 - 0.715 * n, R = 0.072 + 0.928 * n;
12
+ for (let l = 0; l < 256; l++) a[l] = l * s + t;
13
+ const c = Math.abs(h - 1) > v, n = h, d = 0.213 + 0.787 * n, g = 0.715 - 0.715 * n, b = 0.072 - 0.072 * n, S = 0.213 - 0.213 * n, P = 0.715 + 0.285 * n, I = 0.072 - 0.072 * n, m = 0.213 - 0.213 * n, A = 0.715 - 0.715 * n, R = 0.072 + 0.928 * n;
13
14
  for (let l = 0; l < r.length; l += 4) {
14
15
  let u = r[l], p = r[l + 1], y = r[l + 2];
15
- if (f && (u = i[u], p = i[p], y = i[y]), c) {
16
- const W = d * u + g * p + S * y, E = b * u + P * p + I * y, O = m * u + A * p + R * y;
16
+ if (f && (u = a[u], p = a[p], y = a[y]), c) {
17
+ const W = d * u + g * p + b * y, E = S * u + P * p + I * y, O = m * u + A * p + R * y;
17
18
  u = W, p = E, y = O;
18
19
  }
19
20
  r[l] = u, r[l + 1] = p, r[l + 2] = y;
20
21
  }
21
22
  }
22
- const C = /* @__PURE__ */ new WeakMap(), _ = 4;
23
+ const M = /* @__PURE__ */ new WeakMap(), _ = 4;
23
24
  function B(r) {
24
25
  const o = r.naturalWidth;
25
26
  return typeof o == "number" && o > 0 ? o : r.width;
@@ -32,43 +33,43 @@ function U(r, o) {
32
33
  if (typeof OffscreenCanvas < "u")
33
34
  return new OffscreenCanvas(r, o);
34
35
  if (typeof document < "u") {
35
- const a = document.createElement("canvas");
36
- return a.width = r, a.height = o, a;
36
+ const i = document.createElement("canvas");
37
+ return i.width = r, i.height = o, i;
37
38
  }
38
39
  throw new Error("image-adjustments: no canvas implementation available (no OffscreenCanvas, no DOM)");
39
40
  }
40
41
  function Y(r, o) {
41
- const a = B(r), s = K(r);
42
- if (a <= 0 || s <= 0)
42
+ const i = B(r), e = K(r);
43
+ if (i <= 0 || e <= 0)
43
44
  throw new Error("image-adjustments: source has no pixels (width/height is 0)");
44
- const h = U(a, s), e = h.getContext("2d");
45
- if (!e)
45
+ const h = U(i, e), s = h.getContext("2d");
46
+ if (!s)
46
47
  throw new Error("image-adjustments: could not acquire a 2d context");
47
- e.drawImage(r, 0, 0, a, s);
48
- const t = e.getImageData(0, 0, a, s);
49
- return N(t.data, o), e.putImageData(t, 0, 0), h;
48
+ s.drawImage(r, 0, 0, i, e);
49
+ const t = s.getImageData(0, 0, i, e);
50
+ return N(t.data, o), s.putImageData(t, 0, 0), h;
50
51
  }
51
- function T(r, o) {
52
- if (H(o)) return r;
53
- const a = j(o);
54
- let s = C.get(r);
55
- const h = s == null ? void 0 : s.get(a);
52
+ function C(r, o) {
53
+ if (X(o)) return r;
54
+ const i = H(o);
55
+ let e = M.get(r);
56
+ const h = e == null ? void 0 : e.get(i);
56
57
  if (h)
57
- return s.delete(a), s.set(a, h), h;
58
- let e;
58
+ return e.delete(i), e.set(i, h), h;
59
+ let s;
59
60
  try {
60
- e = Y(r, o);
61
+ s = Y(r, o);
61
62
  } catch (t) {
62
- z.error("adjustment pixel pass failed — rendering UNADJUSTED source:", t), e = r;
63
+ z.error("adjustment pixel pass failed — rendering UNADJUSTED source:", t), s = r;
63
64
  }
64
- for (s || (s = /* @__PURE__ */ new Map(), C.set(r, s)), s.set(a, e); s.size > _; ) {
65
- const t = s.keys().next().value;
66
- s.delete(t);
65
+ for (e || (e = /* @__PURE__ */ new Map(), M.set(r, e)), e.set(i, s); e.size > _; ) {
66
+ const t = e.keys().next().value;
67
+ e.delete(t);
67
68
  }
68
- return e;
69
+ return s;
69
70
  }
70
- L(T);
71
- function Q(r, o) {
71
+ F(C);
72
+ function Z(r, o) {
72
73
  return !r.needsCropPixelConversion || r.cropWidth === void 0 ? r : {
73
74
  ...r,
74
75
  cropX: (r.cropX ?? 0) * o.width,
@@ -78,36 +79,36 @@ function Q(r, o) {
78
79
  needsCropPixelConversion: !1
79
80
  };
80
81
  }
81
- function Z(r, o, a) {
82
+ function $(r, o, i) {
82
83
  var t, f;
83
- const s = T(
84
- a,
84
+ const e = C(
85
+ i,
85
86
  o.adjustments
86
87
  );
87
88
  r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
88
- let h = 1, e = 1;
89
- if (o.flipHorizontal && (h = -1), o.flipVertical && (e = -1), (h !== 1 || e !== 1) && r.scale(h, e), o.opacity !== void 0 && o.opacity !== 1 && (r.globalAlpha = o.opacity), o.borderRadius && o.borderRadius > 0) {
90
- const i = Math.min(
89
+ let h = 1, s = 1;
90
+ if (o.flipHorizontal && (h = -1), o.flipVertical && (s = -1), (h !== 1 || s !== 1) && r.scale(h, s), o.opacity !== void 0 && o.opacity !== 1 && (r.globalAlpha = o.opacity), o.borderRadius && o.borderRadius > 0) {
91
+ const a = Math.min(
91
92
  o.borderRadius / 100 * Math.min(o.width, o.height),
92
93
  o.width / 2,
93
94
  o.height / 2
94
95
  );
95
96
  r.beginPath();
96
97
  const c = -o.width / 2, n = -o.height / 2, d = o.width, g = o.height;
97
- r.moveTo(c + i, n), r.lineTo(c + d - i, n), r.arcTo(c + d, n, c + d, n + i, i), r.lineTo(c + d, n + g - i), r.arcTo(c + d, n + g, c + d - i, n + g, i), r.lineTo(c + i, n + g), r.arcTo(c, n + g, c, n + g - i, i), r.lineTo(c, n + i), r.arcTo(c, n, c + i, n, i), r.closePath(), r.clip();
98
+ r.moveTo(c + a, n), r.lineTo(c + d - a, n), r.arcTo(c + d, n, c + d, n + a, a), r.lineTo(c + d, n + g - a), r.arcTo(c + d, n + g, c + d - a, n + g, a), r.lineTo(c + a, n + g), r.arcTo(c, n + g, c, n + g - a, a), r.lineTo(c, n + a), r.arcTo(c, n, c + a, n, a), r.closePath(), r.clip();
98
99
  }
99
100
  if (o.cropX !== void 0 && o.cropWidth !== void 0 ? r.drawImage(
100
- s,
101
+ e,
101
102
  o.cropX,
102
103
  o.cropY || 0,
103
104
  o.cropWidth,
104
- o.cropHeight || a.height,
105
+ o.cropHeight || i.height,
105
106
  -o.width / 2,
106
107
  -o.height / 2,
107
108
  o.width,
108
109
  o.height
109
- ) : r.drawImage(s, -o.width / 2, -o.height / 2, o.width, o.height), r.restore(), (t = o.stroke) != null && t.enabled) {
110
- const i = ((f = o.knockoutParts) == null ? void 0 : f.stroke) === !0, c = {
110
+ ) : r.drawImage(e, -o.width / 2, -o.height / 2, o.width, o.height), r.restore(), (t = o.stroke) != null && t.enabled) {
111
+ const a = ((f = o.knockoutParts) == null ? void 0 : f.stroke) === !0, c = {
111
112
  x: o.x,
112
113
  y: o.y,
113
114
  rotation: o.rotation,
@@ -120,7 +121,7 @@ function Z(r, o, a) {
120
121
  borderRadius: o.borderRadius || 0
121
122
  }
122
123
  };
123
- if (i) {
124
+ if (a) {
124
125
  const n = r.canvas;
125
126
  let d;
126
127
  if (typeof OffscreenCanvas < "u")
@@ -144,19 +145,19 @@ function Z(r, o, a) {
144
145
  function J(r, o) {
145
146
  if (typeof OffscreenCanvas < "u")
146
147
  return new OffscreenCanvas(r, o);
147
- const a = document.createElement("canvas");
148
- return a.width = r, a.height = o, a;
148
+ const i = document.createElement("canvas");
149
+ return i.width = r, i.height = o, i;
149
150
  }
150
- function $(r, o) {
151
- var e;
152
- const a = o.opacity ?? 1, s = !!((e = o.stroke) != null && e.enabled);
153
- a < 1 && s ? V(r, o, a) : w(r, o, a);
151
+ function x(r, o) {
152
+ var s;
153
+ const i = o.opacity ?? 1, e = !!((s = o.stroke) != null && s.enabled);
154
+ i < 1 && e ? V(r, o, i) : w(r, o, i);
154
155
  }
155
- function V(r, o, a) {
156
+ function V(r, o, i) {
156
157
  var d;
157
- const s = o.transformData, e = (((d = o.stroke) == null ? void 0 : d.width) || 2) + 2, t = Math.ceil(s.width + e * 2), f = Math.ceil(s.height + e * 2), i = J(t, f), c = i.getContext("2d");
158
+ const e = o.transformData, s = (((d = o.stroke) == null ? void 0 : d.width) || 2) + 2, t = Math.ceil(e.width + s * 2), f = Math.ceil(e.height + s * 2), a = J(t, f), c = a.getContext("2d");
158
159
  if (!c) {
159
- w(r, o, a);
160
+ w(r, o, i);
160
161
  return;
161
162
  }
162
163
  const n = {
@@ -164,137 +165,137 @@ function V(r, o, a) {
164
165
  x: t / 2,
165
166
  y: f / 2
166
167
  };
167
- w(c, n, 1), r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = a, r.drawImage(i, -t / 2, -f / 2), r.restore();
168
+ w(c, n, 1), r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = i, r.drawImage(a, -t / 2, -f / 2), r.restore();
168
169
  }
169
- function w(r, o, a) {
170
- var e;
171
- const s = o.transformData, h = s.fillOpacity ?? 1;
172
- if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = a * h, r.fillStyle = X(r, s), r.beginPath(), M(r, s), r.fill(), r.restore(), (e = o.stroke) != null && e.enabled) {
170
+ function w(r, o, i) {
171
+ var s;
172
+ const e = o.transformData, h = e.fillOpacity ?? 1;
173
+ if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = i * h, r.fillStyle = L(r, e), r.beginPath(), T(r, e), r.fill(), r.restore(), (s = o.stroke) != null && s.enabled) {
173
174
  r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
174
175
  const t = o.stroke;
175
- r.globalAlpha = a * (t.opacity ?? 1), r.strokeStyle = t.color || "#000000", r.lineWidth = t.width || 2, r.lineCap = t.lineCap || "round", r.lineJoin = t.lineJoin || "round", r.beginPath(), M(r, s), r.stroke(), r.restore();
176
+ r.globalAlpha = i * (t.opacity ?? 1), r.strokeStyle = t.color || "#000000", r.lineWidth = t.width || 2, r.lineCap = t.lineCap || "round", r.lineJoin = t.lineJoin || "round", r.beginPath(), T(r, e), r.stroke(), r.restore();
176
177
  }
177
178
  }
178
- function M(r, o) {
179
- const { shapeType: a, width: s, height: h } = o;
180
- switch (a) {
179
+ function T(r, o) {
180
+ const { shapeType: i, width: e, height: h } = o;
181
+ switch (i) {
181
182
  case "rectangle": {
182
- const e = o.borderRadius || 0, t = -s / 2, f = -h / 2;
183
- if (e > 0) {
184
- const i = Math.min(e / 100 * Math.min(s, h), s / 2, h / 2);
185
- r.roundRect(t, f, s, h, i);
183
+ const s = o.borderRadius || 0, t = -e / 2, f = -h / 2;
184
+ if (s > 0) {
185
+ const a = Math.min(s / 100 * Math.min(e, h), e / 2, h / 2);
186
+ r.roundRect(t, f, e, h, a);
186
187
  } else
187
- r.rect(t, f, s, h);
188
+ r.rect(t, f, e, h);
188
189
  break;
189
190
  }
190
191
  case "circle": {
191
- const e = Math.min(s, h) / 2;
192
- r.arc(0, 0, e, 0, Math.PI * 2);
192
+ const s = Math.min(e, h) / 2;
193
+ r.arc(0, 0, s, 0, Math.PI * 2);
193
194
  break;
194
195
  }
195
196
  case "ellipse": {
196
- r.ellipse(0, 0, s / 2, h / 2, 0, 0, Math.PI * 2);
197
+ r.ellipse(0, 0, e / 2, h / 2, 0, 0, Math.PI * 2);
197
198
  break;
198
199
  }
199
200
  case "triangle": {
200
- const e = s / 2, t = h / 2;
201
- r.moveTo(0, -t), r.lineTo(e, t), r.lineTo(-e, t), r.closePath();
201
+ const s = e / 2, t = h / 2;
202
+ r.moveTo(0, -t), r.lineTo(s, t), r.lineTo(-s, t), r.closePath();
202
203
  break;
203
204
  }
204
205
  case "polygon": {
205
- const e = o.sides || 5, t = Math.min(s, h) / 2;
206
- for (let f = 0; f < e; f++) {
207
- const i = f * 2 * Math.PI / e - Math.PI / 2, c = t * Math.cos(i), n = t * Math.sin(i);
206
+ const s = o.sides || 5, t = Math.min(e, h) / 2;
207
+ for (let f = 0; f < s; f++) {
208
+ const a = f * 2 * Math.PI / s - Math.PI / 2, c = t * Math.cos(a), n = t * Math.sin(a);
208
209
  f === 0 ? r.moveTo(c, n) : r.lineTo(c, n);
209
210
  }
210
211
  r.closePath();
211
212
  break;
212
213
  }
213
214
  case "star": {
214
- const e = o.points || 5, t = Math.min(s, h) / 2, f = t * (o.innerRadius || 0.4);
215
- for (let i = 0; i < e * 2; i++) {
216
- const c = i * Math.PI / e - Math.PI / 2, n = i % 2 === 0 ? t : f, d = n * Math.cos(c), g = n * Math.sin(c);
217
- i === 0 ? r.moveTo(d, g) : r.lineTo(d, g);
215
+ const s = o.points || 5, t = Math.min(e, h) / 2, f = t * (o.innerRadius || 0.4);
216
+ for (let a = 0; a < s * 2; a++) {
217
+ const c = a * Math.PI / s - Math.PI / 2, n = a % 2 === 0 ? t : f, d = n * Math.cos(c), g = n * Math.sin(c);
218
+ a === 0 ? r.moveTo(d, g) : r.lineTo(d, g);
218
219
  }
219
220
  r.closePath();
220
221
  break;
221
222
  }
222
223
  case "line": {
223
- const e = s / 2, t = h / 2;
224
- r.rect(-e, -t, s, h);
224
+ const s = e / 2, t = h / 2;
225
+ r.rect(-s, -t, e, h);
225
226
  break;
226
227
  }
227
228
  default:
228
- r.rect(-s / 2, -h / 2, s, h);
229
+ r.rect(-e / 2, -h / 2, e, h);
229
230
  }
230
231
  }
231
232
  export {
232
- rr as AlignmentSnapSystem,
233
- io as AnyElementConfigSchema,
234
- ho as AnyTransformDataSchema,
235
- Br as ArchTransform,
236
- Kr as ArtboardManager,
237
- or as ArtboardRenderer,
238
- Ur as AscendTransform,
233
+ or as AlignmentSnapSystem,
234
+ ho as AnyElementConfigSchema,
235
+ co as AnyTransformDataSchema,
236
+ Kr as ArchTransform,
237
+ Ur as ArtboardManager,
238
+ er as ArtboardRenderer,
239
+ Yr as AscendTransform,
239
240
  sr as CanvasRenderer,
240
- co as CanvasStateV1Schema,
241
- Yr as CircleTransform,
242
- Jr as CustomTransform,
243
- hr as DEFAULT_MAX_BITMAP_DIMENSION,
244
- Vr as ElementStore,
245
- cr as ExportManager,
246
- qr as FlagTransform,
247
- Gr as HybridHistoryManager,
248
- dr as ImportManager,
249
- er as InteractionStateMachine,
250
- Qr as LeanTransform,
251
- Zr as LogLevel,
252
- tr as ResizePipeline,
253
- fo as SerializedArtboardSchema,
254
- nr as SpacingSystem,
241
+ fo as CanvasStateV1Schema,
242
+ Jr as CircleTransform,
243
+ Vr as CustomTransform,
244
+ cr as DEFAULT_MAX_BITMAP_DIMENSION,
245
+ qr as ElementStore,
246
+ dr as ExportManager,
247
+ Gr as FlagTransform,
248
+ Qr as HybridHistoryManager,
249
+ fr as ImportManager,
250
+ tr as InteractionStateMachine,
251
+ Zr as LeanTransform,
252
+ $r as LogLevel,
253
+ nr as ResizePipeline,
254
+ go as SerializedArtboardSchema,
255
+ ir as SpacingSystem,
255
256
  ar as TransformHandles,
256
- $r as WaveTransform,
257
- fr as WorkerExportManager,
258
- gr as applySpaceLayoutRules,
259
- lr as applyStrokeStyle,
260
- ur as buildFontString,
261
- xr as calculateFixedCornerPosition,
262
- Dr as calculateResizeHandles,
263
- ro as calculateRotationHandlePosition,
264
- pr as clearImageBitmapCache,
265
- yr as clearMaskCache,
266
- kr as clearRegisteredBitmapKeys,
267
- vr as createCirclePath,
268
- wr as createImagePath,
269
- F as createLogger,
270
- Cr as createRectPath,
271
- Mr as createTextPath,
272
- Tr as getFontMetrics,
257
+ xr as WaveTransform,
258
+ gr as WorkerExportManager,
259
+ lr as applySpaceLayoutRules,
260
+ ur as applyStrokeStyle,
261
+ pr as buildFontString,
262
+ Dr as calculateFixedCornerPosition,
263
+ ro as calculateResizeHandles,
264
+ oo as calculateRotationHandlePosition,
265
+ yr as clearImageBitmapCache,
266
+ kr as clearMaskCache,
267
+ vr as clearRegisteredBitmapKeys,
268
+ wr as createCirclePath,
269
+ Mr as createImagePath,
270
+ j as createLogger,
271
+ Tr as createRectPath,
272
+ Cr as createTextPath,
273
+ br as getFontMetrics,
273
274
  Sr as getSharedWorkerExportManager,
274
- oo as hitTestCircle,
275
+ eo as hitTestCircle,
275
276
  so as hitTestRect,
276
- br as invalidateMaskCache,
277
- Pr as loadExportWorkerCode,
278
- eo as logger,
279
- Ir as measureTextWidth,
280
- mr as removeFromImageBitmapCache,
281
- Ar as renderCustomTransform,
282
- Z as renderImageElement,
277
+ Pr as invalidateMaskCache,
278
+ Ir as loadExportWorkerCode,
279
+ to as logger,
280
+ mr as measureTextWidth,
281
+ Ar as removeFromImageBitmapCache,
282
+ Rr as renderCustomTransform,
283
+ $ as renderImageElement,
283
284
  k as renderImageStroke,
284
- Rr as renderMultilineText,
285
- Wr as renderPathStroke,
286
- Er as renderRichTextFillOnly,
287
- $ as renderShapeElement,
288
- Or as renderTextElement,
289
- Hr as renderTextFillOnly,
290
- jr as renderTextStroke,
291
- Fr as renderWithKnockout,
292
- Lr as renderWithMasks,
293
- Q as resolveServerCrop,
294
- to as splitRichTextIntoLines,
295
- Xr as terminateSharedWorkerExportManager,
296
- zr as unregisterElementBitmaps,
297
- no as wrapRichTextSpans,
298
- Nr as wrapText
285
+ Wr as renderMultilineText,
286
+ Er as renderPathStroke,
287
+ Or as renderRichTextFillOnly,
288
+ x as renderShapeElement,
289
+ Hr as renderTextElement,
290
+ jr as renderTextFillOnly,
291
+ Fr as renderTextStroke,
292
+ Lr as renderWithKnockout,
293
+ Xr as renderWithMasks,
294
+ Z as resolveServerCrop,
295
+ no as splitRichTextIntoLines,
296
+ zr as terminateSharedWorkerExportManager,
297
+ Nr as unregisterElementBitmaps,
298
+ io as wrapRichTextSpans,
299
+ _r as wrapText
299
300
  };
300
301
  //# sourceMappingURL=internals.mjs.map