@snowcone-app/canvas 0.21.1 → 0.21.3

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 (54) hide show
  1. package/STYLING_CONTRACT.md +14 -0
  2. package/dist/{CanvasRenderer-CwiYq8qg.js → CanvasRenderer-6_HhR4-q.js} +170 -188
  3. package/dist/CanvasRenderer-6_HhR4-q.js.map +1 -0
  4. package/dist/{CanvasStateV1-BFabcAKC.js → CanvasStateV1-DmZ1Qvvn.js} +38 -38
  5. package/dist/{CanvasStateV1-BFabcAKC.js.map → CanvasStateV1-DmZ1Qvvn.js.map} +1 -1
  6. package/dist/{ContextualToolbars--vTtorNg.js → ContextualToolbars-BDEt9ND0.js} +2047 -2324
  7. package/dist/ContextualToolbars-BDEt9ND0.js.map +1 -0
  8. package/dist/{EditorCanvasImpl-2ZgIUVpK.js → EditorCanvasImpl-M7rw1c1k.js} +8 -8
  9. package/dist/{EditorCanvasImpl-2ZgIUVpK.js.map → EditorCanvasImpl-M7rw1c1k.js.map} +1 -1
  10. package/dist/{ExportManager-DK7CdI-G.js → ExportManager-DoU4VK6h.js} +603 -498
  11. package/dist/ExportManager-DoU4VK6h.js.map +1 -0
  12. package/dist/{FontAnalyzer-BpsTYowD.js → FontAnalyzer-CwIpgTGd.js} +309 -299
  13. package/dist/{FontAnalyzer-BpsTYowD.js.map → FontAnalyzer-CwIpgTGd.js.map} +1 -1
  14. package/dist/ImagePanel-BwqFDKvW.js +951 -0
  15. package/dist/ImagePanel-BwqFDKvW.js.map +1 -0
  16. package/dist/{SnowconeCanvas-DqZicdxK.js → SnowconeCanvas-Cx7nXlBI.js} +22 -21
  17. package/dist/{SnowconeCanvas-DqZicdxK.js.map → SnowconeCanvas-Cx7nXlBI.js.map} +1 -1
  18. package/dist/{UnifiedFontService-B1PGVu8O.js → UnifiedFontService-CC3CSmH5.js} +1242 -1188
  19. package/dist/UnifiedFontService-CC3CSmH5.js.map +1 -0
  20. package/dist/advanced.mjs +100 -99
  21. package/dist/advanced.mjs.map +1 -1
  22. package/dist/components/editor/LazyImageBrowser.d.ts +7 -0
  23. package/dist/components/editor/commerceStore.d.ts +13 -0
  24. package/dist/custom-icons-BW6hqmkL.js +236 -0
  25. package/dist/custom-icons-BW6hqmkL.js.map +1 -0
  26. package/dist/{design-builder-CPF60RU2.js → design-builder-CT4DHIPe.js} +2 -2
  27. package/dist/{design-builder-CPF60RU2.js.map → design-builder-CT4DHIPe.js.map} +1 -1
  28. package/dist/{editorErrors-CK1RISFa.js → editorErrors-B2mb1sVN.js} +2 -2
  29. package/dist/{editorErrors-CK1RISFa.js.map → editorErrors-B2mb1sVN.js.map} +1 -1
  30. package/dist/{embed-2tp6Ue90.js → embed-QBZkgWDr.js} +288 -273
  31. package/dist/{embed-2tp6Ue90.js.map → embed-QBZkgWDr.js.map} +1 -1
  32. package/dist/embed.mjs +6 -6
  33. package/dist/guards-8rkFAMBs.js +24 -0
  34. package/dist/guards-8rkFAMBs.js.map +1 -0
  35. package/dist/index.mjs +8 -8
  36. package/dist/internals.mjs +11 -11
  37. package/dist/rendering/element-painters.d.ts +4 -2
  38. package/dist/style.css +1 -1
  39. package/dist/{template-fields-FgImixyv.js → template-fields-C2pSfMBh.js} +59 -41
  40. package/dist/template-fields-C2pSfMBh.js.map +1 -0
  41. package/dist/testing.mjs +4 -4
  42. package/dist/{usePieceGuideBundle-Ctnu5k2D.js → usePieceGuideBundle-CbJJg66S.js} +2 -2
  43. package/dist/{usePieceGuideBundle-Ctnu5k2D.js.map → usePieceGuideBundle-CbJJg66S.js.map} +1 -1
  44. package/dist/validation-C9Fe9ahK.js +8367 -0
  45. package/dist/validation-C9Fe9ahK.js.map +1 -0
  46. package/example/package.json +1 -1
  47. package/package.json +3 -2
  48. package/dist/CanvasRenderer-CwiYq8qg.js.map +0 -1
  49. package/dist/ContextualToolbars--vTtorNg.js.map +0 -1
  50. package/dist/ExportManager-DK7CdI-G.js.map +0 -1
  51. package/dist/UnifiedFontService-B1PGVu8O.js.map +0 -1
  52. package/dist/template-fields-FgImixyv.js.map +0 -1
  53. package/dist/validation-3YEMnKLB.js +0 -9308
  54. package/dist/validation-3YEMnKLB.js.map +0 -1
package/dist/embed.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { C as a, a as r, b as o, u as t, d as i, f as d, g as m } from "./UnifiedFontService-B1PGVu8O.js";
2
- import { E as u, R as l, a as E, b as c, S as g, c as p, f as S, d as f, e as x, v } from "./embed-2tp6Ue90.js";
3
- import { g as B, i as T, u as y } from "./editorErrors-CK1RISFa.js";
4
- import { D as P, d as D, i as R } from "./design-builder-CPF60RU2.js";
5
- import { D as I, T as L, r as k, u as w, a as M, b as h, c as A, d as _, e as z, f as G, w as K } from "./template-fields-FgImixyv.js";
6
- import { s as Y } from "./CanvasStateV1-BFabcAKC.js";
1
+ import { C as a, a as r, b as o, u as t, d as i, f as d, g as m } from "./UnifiedFontService-CC3CSmH5.js";
2
+ import { E as u, R as l, a as E, b as c, S as g, c as p, f as S, d as f, e as x, v } from "./embed-QBZkgWDr.js";
3
+ import { g as B, i as T, u as y } from "./editorErrors-B2mb1sVN.js";
4
+ import { D as P, d as D, i as R } from "./design-builder-CT4DHIPe.js";
5
+ import { D as I, T as L, r as k, u as w, a as M, b as h, c as A, d as _, e as z, f as G, w as K } from "./template-fields-C2pSfMBh.js";
6
+ import { s as Y } from "./CanvasStateV1-DmZ1Qvvn.js";
7
7
  export {
8
8
  a as CanvasServicesProvider,
9
9
  P as DesignBuilder,
@@ -0,0 +1,24 @@
1
+ import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-CwIpgTGd.js";
2
+ function r(e) {
3
+ return e instanceof i;
4
+ }
5
+ function m(e) {
6
+ return e instanceof t;
7
+ }
8
+ function u(e) {
9
+ return e instanceof n;
10
+ }
11
+ function c(e) {
12
+ return e instanceof s;
13
+ }
14
+ function f(e) {
15
+ return e instanceof a;
16
+ }
17
+ export {
18
+ m as a,
19
+ f as b,
20
+ c,
21
+ r as d,
22
+ u as i
23
+ };
24
+ //# sourceMappingURL=guards-8rkFAMBs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards-8rkFAMBs.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,12 +1,12 @@
1
- import { e as u } from "./UnifiedFontService-B1PGVu8O.js";
2
- import { C as l, c as x, a as I, b as v, u as A, d as T, f as g, g as B } from "./UnifiedFontService-B1PGVu8O.js";
3
- import { E as _, S as y, S as L, u as O, a as M } from "./SnowconeCanvas-DqZicdxK.js";
4
- import { u as d, a as m } from "./editorErrors-CK1RISFa.js";
5
- import { T as z, r as w, u as F, a as D, b as K, c as N, d as V, e as b, f as h, w as U } from "./template-fields-FgImixyv.js";
6
- import { A as Z, C as G, E as H, M as j, P as k, r as q, v as J } from "./validation-3YEMnKLB.js";
7
- import { C as W, D as X, d as $, s as ee } from "./design-builder-CPF60RU2.js";
1
+ import { e as u } from "./UnifiedFontService-CC3CSmH5.js";
2
+ import { C as l, c as x, a as I, b as v, u as A, d as T, f as g, g as B } from "./UnifiedFontService-CC3CSmH5.js";
3
+ import { E as _, S as y, S as L, u as O, a as M } from "./SnowconeCanvas-Cx7nXlBI.js";
4
+ import { u as d, a as m } from "./editorErrors-B2mb1sVN.js";
5
+ import { T as z, r as w, u as F, a as D, b as K, c as N, d as V, e as b, f as h, w as U } from "./template-fields-C2pSfMBh.js";
6
+ import { A as Z, C as G, E as H, M as j, P as k, r as q, v as J } from "./validation-C9Fe9ahK.js";
7
+ import { C as W, D as X, d as $, s as ee } from "./design-builder-CT4DHIPe.js";
8
8
  import { c as se, e as te } from "./compose-DtQL_oit.js";
9
- import { d as oe, m as ie, s as ne, v as ue } from "./CanvasStateV1-BFabcAKC.js";
9
+ import { d as oe, m as ie, s as ne, v as ue } from "./CanvasStateV1-DmZ1Qvvn.js";
10
10
  function C() {
11
11
  const { isCanvasReady: e } = d();
12
12
  return e;
@@ -1,8 +1,8 @@
1
- import { A as w, e as b, C as I, I as R, R as W, S as A, T as E } from "./CanvasRenderer-CwiYq8qg.js";
2
- import { r as p } from "./ExportManager-DK7CdI-G.js";
3
- import { D as O, E as F, I 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 "./ExportManager-DK7CdI-G.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-BpsTYowD.js";
5
- import { A as Hr, e as Or, C as Fr, S as Lr } from "./CanvasStateV1-BFabcAKC.js";
1
+ import { A as w, a as b, C as I, I as R, R as W, S as A, T as E } from "./CanvasRenderer-6_HhR4-q.js";
2
+ import { r as p } from "./ExportManager-DoU4VK6h.js";
3
+ import { D as O, E as F, I as L, W as X, a as z, b as K, c as Y, d as B, e as _, f as J, h as N, i as V, j as U, k as j, l as q, m as Q, n as Z, o as $, p as m, q as G, s as x, t as D, u as rr, v as or, w as sr, x as ir, y as er, z as ar, A as nr, B as tr, C as hr } from "./ExportManager-DoU4VK6h.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 Cr, U as vr, V as Sr, X as Pr, c as wr, Y as br, Z as Ir, _ as Rr, $ as Wr, a0 as Ar } from "./FontAnalyzer-CwIpgTGd.js";
5
+ import { A as Hr, e as Or, C as Fr, S as Lr } from "./CanvasStateV1-DmZ1Qvvn.js";
6
6
  function y(r, o) {
7
7
  return !r.needsCropPixelConversion || r.cropWidth === void 0 ? r : {
8
8
  ...r,
@@ -13,7 +13,7 @@ function y(r, o) {
13
13
  needsCropPixelConversion: !1
14
14
  };
15
15
  }
16
- function v(r, o, c) {
16
+ function C(r, o, c) {
17
17
  var a, n;
18
18
  r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
19
19
  let e = 1, h = 1;
@@ -78,7 +78,7 @@ 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 C(r, o) {
81
+ function v(r, o) {
82
82
  var a;
83
83
  const c = o.opacity ?? 1, e = !!((a = o.stroke) != null && a.enabled);
84
84
  c < 1 && e ? k(r, o, c) : g(r, o, c);
@@ -184,12 +184,12 @@ export {
184
184
  Lr as SerializedArtboardSchema,
185
185
  A as SpacingSystem,
186
186
  E as TransformHandles,
187
- vr as WaveTransform,
187
+ Cr as WaveTransform,
188
188
  X as WorkerExportManager,
189
189
  z as applySpaceLayoutRules,
190
190
  K as applyStrokeStyle,
191
191
  Y as buildFontString,
192
- Cr as calculateFixedCornerPosition,
192
+ vr as calculateFixedCornerPosition,
193
193
  Sr as calculateResizeHandles,
194
194
  Pr as calculateRotationHandlePosition,
195
195
  B as clearImageBitmapCache,
@@ -209,12 +209,12 @@ export {
209
209
  $ as measureTextWidth,
210
210
  m as removeFromImageBitmapCache,
211
211
  G as renderCustomTransform,
212
- v as renderImageElement,
212
+ C as renderImageElement,
213
213
  p as renderImageStroke,
214
214
  x as renderMultilineText,
215
215
  D as renderPathStroke,
216
216
  rr as renderRichTextFillOnly,
217
- C as renderShapeElement,
217
+ v as renderShapeElement,
218
218
  or as renderTextElement,
219
219
  sr as renderTextFillOnly,
220
220
  ir as renderTextStroke,
@@ -11,6 +11,8 @@
11
11
  * model graph ever touching `src/rendering/*`. CI-gated by
12
12
  * scripts/check-import-graph.mjs.
13
13
  */
14
- /** Idempotent; also runs at module evaluation, so a plain side-effect import
15
- * (`import './element-painters.js'`) suffices. */
14
+ /** Idempotent; also runs at module evaluation — but do NOT rely on a plain
15
+ * side-effect import (`import './element-painters.js'`) reaching it:
16
+ * bundlers honoring the package `sideEffects` allowlist prune bare imports.
17
+ * Paint drivers must CALL this (see core/CanvasRenderer.ts). */
16
18
  export declare function installElementPainters(): void;