@snowcone-app/canvas 0.46.10 → 0.46.13

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 (52) hide show
  1. package/ERROR_CONTRACT.md +13 -0
  2. package/dist/{CanvasRenderer-CmIQSVCK.js → CanvasRenderer-CV8fDS6m.js} +4 -4
  3. package/dist/{CanvasRenderer-CmIQSVCK.js.map → CanvasRenderer-CV8fDS6m.js.map} +1 -1
  4. package/dist/{ContextualToolbars-BG90V6-s.js → ContextualToolbars-DsQ83_VR.js} +138 -137
  5. package/dist/ContextualToolbars-DsQ83_VR.js.map +1 -0
  6. package/dist/{EditorCanvasImpl-C7y7UNl1.js → EditorCanvasImpl-CbKLAe8P.js} +8 -8
  7. package/dist/{EditorCanvasImpl-C7y7UNl1.js.map → EditorCanvasImpl-CbKLAe8P.js.map} +1 -1
  8. package/dist/ExportManager-Q4GQE68T.js +5584 -0
  9. package/dist/ExportManager-Q4GQE68T.js.map +1 -0
  10. package/dist/{ImagePanel-BaEJnUvS.js → ImagePanel-DNgvLouH.js} +6 -6
  11. package/dist/{ImagePanel-BaEJnUvS.js.map → ImagePanel-DNgvLouH.js.map} +1 -1
  12. package/dist/{SnowconeCanvas-C6FmL0pj.js → SnowconeCanvas-Cu3IuAhp.js} +10 -10
  13. package/dist/{SnowconeCanvas-C6FmL0pj.js.map → SnowconeCanvas-Cu3IuAhp.js.map} +1 -1
  14. package/dist/advanced.mjs +16 -16
  15. package/dist/{compose-Ce53EW1v.js → compose-CatWJeVf.js} +3 -3
  16. package/dist/{compose-Ce53EW1v.js.map → compose-CatWJeVf.js.map} +1 -1
  17. package/dist/constants.d.ts +0 -1
  18. package/dist/{custom-icons-BA-MX7Y2.js → custom-icons-DP6uSyX-.js} +2 -2
  19. package/dist/{custom-icons-BA-MX7Y2.js.map → custom-icons-DP6uSyX-.js.map} +1 -1
  20. package/dist/{design-builder-HKRo18WT.js → design-builder-CCPB3WRx.js} +4 -4
  21. package/dist/design-builder-CCPB3WRx.js.map +1 -0
  22. package/dist/{embed-CYlEe_Xv.js → embed-DobFUit8.js} +9 -9
  23. package/dist/{embed-CYlEe_Xv.js.map → embed-DobFUit8.js.map} +1 -1
  24. package/dist/embed.mjs +6 -6
  25. package/dist/errors/editorError.d.ts +3 -0
  26. package/dist/{export-worker.bundle.string-CyMb_XjB.js → export-worker.bundle.string-DG2f-C1t.js} +1490 -1487
  27. package/dist/{export-worker.bundle.string-CyMb_XjB.js.map → export-worker.bundle.string-DG2f-C1t.js.map} +1 -1
  28. package/dist/{FontAnalyzer-CLMJi2Sw.js → fontAnalysisCache-B2lh7X-_.js} +1408 -3329
  29. package/dist/fontAnalysisCache-B2lh7X-_.js.map +1 -0
  30. package/dist/{guards-Dk86a-kH.js → guards-2oykBUel.js} +2 -2
  31. package/dist/{guards-Dk86a-kH.js.map → guards-2oykBUel.js.map} +1 -1
  32. package/dist/index.mjs +9 -9
  33. package/dist/internals.mjs +5 -5
  34. package/dist/{template-fields-3CH15MFC.js → template-fields-BqGWVbJo.js} +6 -6
  35. package/dist/template-fields-BqGWVbJo.js.map +1 -0
  36. package/dist/testing.mjs +3 -3
  37. package/dist/{useCommands-C6nE770t.js → useCommands-DHwYOhSp.js} +17 -17
  38. package/dist/{useCommands-C6nE770t.js.map → useCommands-DHwYOhSp.js.map} +1 -1
  39. package/dist/{usePieceGuideBundle-DJfjOVEd.js → usePieceGuideBundle-BuxwVcb5.js} +2 -2
  40. package/dist/{usePieceGuideBundle-DJfjOVEd.js.map → usePieceGuideBundle-BuxwVcb5.js.map} +1 -1
  41. package/dist/utils/fontAnalysisCache.d.ts +14 -0
  42. package/dist/{validation-C3FHoCbQ.js → validation-EoPS9fDC.js} +11 -11
  43. package/dist/{validation-C3FHoCbQ.js.map → validation-EoPS9fDC.js.map} +1 -1
  44. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  45. package/example/package.json +1 -1
  46. package/package.json +4 -4
  47. package/dist/ContextualToolbars-BG90V6-s.js.map +0 -1
  48. package/dist/ExportManager-DEJgxB0S.js +0 -3647
  49. package/dist/ExportManager-DEJgxB0S.js.map +0 -1
  50. package/dist/FontAnalyzer-CLMJi2Sw.js.map +0 -1
  51. package/dist/design-builder-HKRo18WT.js.map +0 -1
  52. package/dist/template-fields-3CH15MFC.js.map +0 -1
package/dist/testing.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { E as A, f as y } from "./design-builder-HKRo18WT.js";
2
- import { g as ie, h as oe, r as ae } from "./design-builder-HKRo18WT.js";
1
+ import { E as A, f as y } from "./design-builder-CCPB3WRx.js";
2
+ import { g as ie, h as oe, r as ae } from "./design-builder-CCPB3WRx.js";
3
3
  import { fetchMockupImage as S, isSnowconeSdkError as b, RenderSession as _, mintRealtimeGrant as R } from "@snowcone-app/sdk";
4
- import { e as I, A as D, o as T, I as k, q as m } from "./FontAnalyzer-CLMJi2Sw.js";
4
+ import { e as I, A as D, o as T, I as k, q as m } from "./fontAnalysisCache-B2lh7X-_.js";
5
5
  import { serializeStateForServer as F } from "@snowcone-app/design/wire";
6
6
  import { jsx as u } from "react/jsx-runtime";
7
7
  import { useState as x } from "react";
@@ -1,9 +1,9 @@
1
1
  import { jsx as f, jsxs as j, Fragment as an } from "react/jsx-runtime";
2
2
  import * as F from "react";
3
3
  import ne, { useRef as V, useState as B, useCallback as N, useMemo as X, useEffect as q, forwardRef as Pn, createElement as Sn, useLayoutEffect as $n, memo as Qo, useReducer as Zo, useContext as Be, createContext as Je, cloneElement as ei, useId as Pr, useSyncExternalStore as $r } from "react";
4
- import { b as Yt, w as ti, o as ni, x as Hr, m as ri, q as oi } from "./design-builder-HKRo18WT.js";
5
- import { G as Ie, c as Qe, q as rt, Z as ii, aV as ln, I as si, P as ai, S as li, T as ci, aW as di, K as ui, aX as fi, aY as hi, U as sr } from "./FontAnalyzer-CLMJi2Sw.js";
6
- import { R as gi, I as cn, a as dn } from "./ExportManager-DEJgxB0S.js";
4
+ import { b as Yt, w as ti, o as ni, x as Hr, m as ri, q as oi } from "./design-builder-CCPB3WRx.js";
5
+ import { G as Ie, c as Qe, q as rt, Z as ii, I as si, P as ai, S as li, T as ci, aX as di, N as ui, aY as fi, aZ as hi, U as sr } from "./fontAnalysisCache-B2lh7X-_.js";
6
+ import { R as gi, I as ln, a as cn, S as dn } from "./ExportManager-Q4GQE68T.js";
7
7
  import { createPortal as Hn, unstable_batchedUpdates as Ft } from "react-dom";
8
8
  import { clsx as Br } from "clsx";
9
9
  import { extendTailwindMerge as Vr } from "tailwind-merge";
@@ -7036,7 +7036,7 @@ const Dl = ({
7036
7036
  var E;
7037
7037
  const { get: a } = Hr(), [l, c] = B(!1), [u, d] = B(!1), [h, p] = B(!1), k = V(null), y = async () => {
7038
7038
  try {
7039
- const { ExportManager: v } = await import("./ExportManager-DEJgxB0S.js").then((T) => T._), { artboardManager: D, elements: w } = a(), A = D.getAllArtboards();
7039
+ const { ExportManager: v } = await import("./ExportManager-Q4GQE68T.js").then((T) => T.a2), { artboardManager: D, elements: w } = a(), A = D.getAllArtboards();
7040
7040
  v.exportToJSON(A, w, D), c(!1);
7041
7041
  } catch (v) {
7042
7042
  bn.error("Failed to save workspace:", v), alert("Failed to save workspace. Please try again.");
@@ -7049,9 +7049,9 @@ const Dl = ({
7049
7049
  const D = (w = v.target.files) == null ? void 0 : w[0];
7050
7050
  if (D) {
7051
7051
  try {
7052
- const A = await cn.importFromJSON(D);
7052
+ const A = await ln.importFromJSON(D);
7053
7053
  if (A.success && A.artboards && A.elements) {
7054
- const T = cn.validateImportedData(A.artboards, A.elements);
7054
+ const T = ln.validateImportedData(A.artboards, A.elements);
7055
7055
  if (!T.valid && !confirm(
7056
7056
  `Found ${T.errors.length} issue(s) in the file:
7057
7057
 
@@ -7062,7 +7062,7 @@ const Dl = ({
7062
7062
  Do you want to load anyway?`
7063
7063
  ))
7064
7064
  return;
7065
- const O = cn.getImportSummary(A.artboards, A.elements);
7065
+ const O = ln.getImportSummary(A.artboards, A.elements);
7066
7066
  confirm(
7067
7067
  `Load workspace with:
7068
7068
 
@@ -7090,7 +7090,7 @@ This will replace your current workspace. Continue?`
7090
7090
  return;
7091
7091
  }
7092
7092
  try {
7093
- const { ExportManager: T } = await import("./ExportManager-DEJgxB0S.js").then((O) => O._);
7093
+ const { ExportManager: T } = await import("./ExportManager-Q4GQE68T.js").then((O) => O.a2);
7094
7094
  await T.exportArtboardToImage(A, D, w.current, {
7095
7095
  format: "png",
7096
7096
  scale: 2,
@@ -7226,7 +7226,7 @@ function Go({
7226
7226
  return q(() => {
7227
7227
  if (!t || o) return;
7228
7228
  let s = !1;
7229
- return import("./ImagePanel-BaEJnUvS.js").then(
7229
+ return import("./ImagePanel-DNgvLouH.js").then(
7230
7230
  (a) => {
7231
7231
  s || i(() => a.ImagePanel);
7232
7232
  },
@@ -7354,7 +7354,7 @@ function yc() {
7354
7354
  totalExports: 0,
7355
7355
  avgExportTime: 0,
7356
7356
  isWorkerActive: !1
7357
- }), k = V(0), y = V(null), g = dn.supportsWorkerExport(), m = N(async (v, D = {}) => {
7357
+ }), k = V(0), y = V(null), g = cn.supportsWorkerExport(), m = N(async (v, D = {}) => {
7358
7358
  const w = e.find((T) => T.id === v);
7359
7359
  if (!w)
7360
7360
  throw new Error(`[useExport] Artboard ${v} not found`);
@@ -7370,7 +7370,7 @@ function yc() {
7370
7370
  };
7371
7371
  c((T) => [...T, A]);
7372
7372
  try {
7373
- const T = Date.now(), O = M.current, W = t.getElementsOnArtboard(v), ae = O.filter((Y) => W.includes(Y.id)), _ = await dn.exportArtboardToDataURL(
7373
+ const T = Date.now(), O = M.current, W = t.getElementsOnArtboard(v), ae = O.filter((Y) => W.includes(Y.id)), _ = await cn.exportArtboardToDataURL(
7374
7374
  w,
7375
7375
  ae,
7376
7376
  r.current,
@@ -7419,7 +7419,7 @@ function yc() {
7419
7419
  i(!0);
7420
7420
  try {
7421
7421
  const A = M.current, T = t.getElementsOnArtboard(v), O = A.filter((ae) => T.includes(ae.id));
7422
- return await dn.exportArtboardToBlob(
7422
+ return await cn.exportArtboardToBlob(
7423
7423
  w,
7424
7424
  O,
7425
7425
  r.current,
@@ -7683,14 +7683,14 @@ class Vl {
7683
7683
  * Returns system fonts + Google Fonts (deduplicated)
7684
7684
  */
7685
7685
  getAllFonts() {
7686
- const t = ln.filter((r) => !r.googleFont), n = this.mapGoogleFonts(wn());
7686
+ const t = dn.filter((r) => !r.googleFont), n = this.mapGoogleFonts(wn());
7687
7687
  return this.mergeFonts([...t, ...n]);
7688
7688
  }
7689
7689
  /**
7690
7690
  * Get recommended fonts (TSHIRT_FONTS curated list)
7691
7691
  */
7692
7692
  getRecommendedFonts() {
7693
- return ln;
7693
+ return dn;
7694
7694
  }
7695
7695
  // ========================================
7696
7696
  // Dual Search Strategy
@@ -7712,7 +7712,7 @@ class Vl {
7712
7712
  */
7713
7713
  async filterFontsByCategory(t) {
7714
7714
  if (t === "system")
7715
- return ln.filter((i) => !i.googleFont);
7715
+ return dn.filter((i) => !i.googleFont);
7716
7716
  const n = `category:${t}`;
7717
7717
  if (this.searchCache.has(n))
7718
7718
  return this.searchCache.get(n);
@@ -8000,7 +8000,7 @@ function Zl(e, t) {
8000
8000
  function ec(e, t) {
8001
8001
  let n = !1;
8002
8002
  if (t.x !== void 0 && (e.x = t.x), t.y !== void 0 && (e.y = t.y), t.rotation !== void 0 && e.setRotation(t.rotation), t.opacity !== void 0 && (e.opacity = t.opacity), t.name !== void 0 && (e.name = t.name), t.visible !== void 0 && (e.visible = t.visible), t.locked !== void 0 && (e.locked = t.locked), Yo(e))
8003
- return t.text !== void 0 && e.setText(t.text), t.fontSize !== void 0 && e.setFontSize(t.fontSize), t.color !== void 0 && e.setColor(t.color), t.fontFamily !== void 0 && t.fontFamily !== e.fontFamily && (ui.clearCache(e.fontFamily), e.fontFamily = t.fontFamily), t.bold !== void 0 && (e.bold = t.bold), t.italic !== void 0 && (e.italic = t.italic), t.textAlign !== void 0 && (e.textAlign = t.textAlign), { needsImageLoad: n };
8003
+ return t.text !== void 0 && e.setText(t.text), t.fontSize !== void 0 && e.setFontSize(t.fontSize), t.color !== void 0 && e.setColor(t.color), t.fontFamily !== void 0 && t.fontFamily !== e.fontFamily && (ui(e.fontFamily), e.fontFamily = t.fontFamily), t.bold !== void 0 && (e.bold = t.bold), t.italic !== void 0 && (e.italic = t.italic), t.textAlign !== void 0 && (e.textAlign = t.textAlign), { needsImageLoad: n };
8004
8004
  const r = e;
8005
8005
  if (t.width !== void 0 && (r.transformData.width = t.width), t.height !== void 0 && (r.transformData.height = t.height), t.fillColor !== void 0) {
8006
8006
  const o = e.transformData;
@@ -8150,4 +8150,4 @@ export {
8150
8150
  or as y,
8151
8151
  rn as z
8152
8152
  };
8153
- //# sourceMappingURL=useCommands-C6nE770t.js.map
8153
+ //# sourceMappingURL=useCommands-DHwYOhSp.js.map