@snowcone-app/canvas 0.37.1 → 0.38.0

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 (69) hide show
  1. package/ERROR_CONTRACT.md +39 -8
  2. package/STYLING_CONTRACT.md +24 -2
  3. package/dist/{CanvasRenderer-CTN4j-uO.js → CanvasRenderer-D-E5WWLm.js} +4 -4
  4. package/dist/{CanvasRenderer-CTN4j-uO.js.map → CanvasRenderer-D-E5WWLm.js.map} +1 -1
  5. package/dist/{CanvasStateV1-DLE5d1-d.js → CanvasStateV1-C9LQt2J0.js} +7 -7
  6. package/dist/{CanvasStateV1-DLE5d1-d.js.map → CanvasStateV1-C9LQt2J0.js.map} +1 -1
  7. package/dist/{ContextualToolbars-CG5Gmv_i.js → ContextualToolbars-C62As-xY.js} +202 -202
  8. package/dist/{ContextualToolbars-CG5Gmv_i.js.map → ContextualToolbars-C62As-xY.js.map} +1 -1
  9. package/dist/EditorCanvasImpl-BnxEbr2p.js +144 -0
  10. package/dist/EditorCanvasImpl-BnxEbr2p.js.map +1 -0
  11. package/dist/{ExportManager-CDX5_up8.js → ExportManager-BbBfO22S.js} +45 -45
  12. package/dist/{ExportManager-CDX5_up8.js.map → ExportManager-BbBfO22S.js.map} +1 -1
  13. package/dist/{FontAnalyzer-CEYA_6fY.js → FontAnalyzer-DWHS41ba.js} +128 -128
  14. package/dist/FontAnalyzer-DWHS41ba.js.map +1 -0
  15. package/dist/{ImagePanel-DLxIDKV-.js → ImagePanel-BaX0UE-L.js} +57 -57
  16. package/dist/{ImagePanel-DLxIDKV-.js.map → ImagePanel-BaX0UE-L.js.map} +1 -1
  17. package/dist/SnowconeCanvas-CWSPyqqj.js +1112 -0
  18. package/dist/SnowconeCanvas-CWSPyqqj.js.map +1 -0
  19. package/dist/advanced.mjs +138 -138
  20. package/dist/api/placement.d.ts +3 -0
  21. package/dist/components/editor/EditorPlacements.d.ts +19 -6
  22. package/dist/components/editor/RootInternals.d.ts +7 -0
  23. package/dist/components/editor/designStateStore.d.ts +18 -0
  24. package/dist/components/editor/index.d.ts +3 -1
  25. package/dist/components/editor/placementLinks.d.ts +52 -0
  26. package/dist/components/editor/usePlacements.d.ts +28 -4
  27. package/dist/components/embed-realtime/context.d.ts +20 -4
  28. package/dist/components/embed-realtime/usePieceGuideBundle.d.ts +1 -0
  29. package/dist/components/embed-realtime/validateEmbed.d.ts +6 -3
  30. package/dist/{custom-icons-D51KIAfz.js → custom-icons-o1U13Vcg.js} +14 -14
  31. package/dist/{custom-icons-D51KIAfz.js.map → custom-icons-o1U13Vcg.js.map} +1 -1
  32. package/dist/{design-builder-CqgTpp9B.js → design-builder-CoCtjIwj.js} +86 -86
  33. package/dist/{design-builder-CqgTpp9B.js.map → design-builder-CoCtjIwj.js.map} +1 -1
  34. package/dist/{embed-CLz3CTcX.js → embed-SOFUZlGB.js} +843 -729
  35. package/dist/embed-SOFUZlGB.js.map +1 -0
  36. package/dist/embed.mjs +28 -28
  37. package/dist/errors/editorError.d.ts +7 -2
  38. package/dist/{guards-DldCuuJq.js → guards-DMmhw_Ow.js} +4 -4
  39. package/dist/{guards-DldCuuJq.js.map → guards-DMmhw_Ow.js.map} +1 -1
  40. package/dist/index.mjs +21 -21
  41. package/dist/internals.mjs +108 -108
  42. package/dist/internals.mjs.map +1 -1
  43. package/dist/placement-Br5jI_-u.js +90 -0
  44. package/dist/placement-Br5jI_-u.js.map +1 -0
  45. package/dist/placement.d.ts +2 -0
  46. package/dist/placement.mjs +5 -0
  47. package/dist/placement.mjs.map +1 -0
  48. package/dist/template-fields-CBLHgW7G.js +556 -0
  49. package/dist/template-fields-CBLHgW7G.js.map +1 -0
  50. package/dist/testing.mjs +24 -24
  51. package/dist/{useCommands-CQi4Pyd2.js → useCommands-x8J7_Mzy.js} +262 -262
  52. package/dist/{useCommands-CQi4Pyd2.js.map → useCommands-x8J7_Mzy.js.map} +1 -1
  53. package/dist/usePieceGuideBundle-C7r06a_x.js +65 -0
  54. package/dist/usePieceGuideBundle-C7r06a_x.js.map +1 -0
  55. package/dist/{validation-THw5W6N_.js → validation-BG-V98h0.js} +846 -846
  56. package/dist/validation-BG-V98h0.js.map +1 -0
  57. package/example/package.json +1 -1
  58. package/package.json +7 -2
  59. package/dist/EditorCanvasImpl-BRdFWZA5.js +0 -81
  60. package/dist/EditorCanvasImpl-BRdFWZA5.js.map +0 -1
  61. package/dist/FontAnalyzer-CEYA_6fY.js.map +0 -1
  62. package/dist/SnowconeCanvas-BaFR8QXs.js +0 -1196
  63. package/dist/SnowconeCanvas-BaFR8QXs.js.map +0 -1
  64. package/dist/embed-CLz3CTcX.js.map +0 -1
  65. package/dist/template-fields-D8uOutD4.js +0 -505
  66. package/dist/template-fields-D8uOutD4.js.map +0 -1
  67. package/dist/usePieceGuideBundle-BUQKb0Ja.js +0 -61
  68. package/dist/usePieceGuideBundle-BUQKb0Ja.js.map +0 -1
  69. package/dist/validation-THw5W6N_.js.map +0 -1
package/dist/embed.mjs CHANGED
@@ -1,53 +1,53 @@
1
- import { C as a, a as t, b as o, A as r, F as i, G as n, H as d, J as u, K as m, u as l, d as E, f as c, g as p, h as g } from "./useCommands-CQi4Pyd2.js";
2
- import { E as x, R as C, a as S, b as T, S as P, c as R, d as b, e as y, f as B, g as F, i as v, h, p as k, s as D, j as I, k as L, l as K, v as w } from "./embed-CLz3CTcX.js";
3
- import { E as G, y as M } from "./FontAnalyzer-CEYA_6fY.js";
4
- import { D as _, d as z, j as H, i as J, u as N } from "./design-builder-CqgTpp9B.js";
5
- import { D as Y, T as q, r as O, u as Q, a as U, b as W, c as X, d as Z, e as $, w as ee } from "./template-fields-D8uOutD4.js";
6
- import { c as ae, e as te, l as oe, r as re } from "./ExportManager-CDX5_up8.js";
7
- import { s as ne } from "./CanvasStateV1-DLE5d1-d.js";
1
+ import { C as a, g as t, h as o, K as r, N as i, O as n, P as d, Q as m, R as u, b as l, a as E, j as c, k as p, l as g } from "./useCommands-x8J7_Mzy.js";
2
+ import { E as C, R as S, a as T, b as f, S as P, c as R, d as b, e as B, f as F, g as v, i as y, h, p as k, s as D, j as I, k as L, l as K, v as w } from "./embed-SOFUZlGB.js";
3
+ import { t as M, V as j } from "./FontAnalyzer-DWHS41ba.js";
4
+ import { D as N, e as V, h as _, i as z, b as H } from "./design-builder-CoCtjIwj.js";
5
+ import { D as O, T as Q, r as Y, u as q, a as U, b as W, c as X, d as Z, e as $, w as ee } from "./template-fields-CBLHgW7G.js";
6
+ import { F as ae, G as te, H as oe, J as re } from "./ExportManager-BbBfO22S.js";
7
+ import { s as ne } from "./CanvasStateV1-C9LQt2J0.js";
8
8
  export {
9
9
  a as CanvasServicesProvider,
10
- _ as DesignBuilder,
11
- Y as DesignStateStore,
12
- x as Editor,
13
- G as EditorError,
14
- C as RealtimeCanvas,
15
- S as RealtimeEmbed,
16
- T as RealtimeMockup,
10
+ N as DesignBuilder,
11
+ O as DesignStateStore,
12
+ C as Editor,
13
+ M as EditorError,
14
+ S as RealtimeCanvas,
15
+ T as RealtimeEmbed,
16
+ f as RealtimeMockup,
17
17
  P as SnowconeEditor,
18
- q as TEMPLATE_FIELDS_KEY,
18
+ Q as TEMPLATE_FIELDS_KEY,
19
19
  R as auditEditor,
20
20
  b as bundleToRenderConfig,
21
- y as bundleVariantToken,
22
- B as collectEmbedIssues,
21
+ B as bundleVariantToken,
22
+ F as collectEmbedIssues,
23
23
  t as createProxyGenerate,
24
24
  o as createProxyImageSearch,
25
25
  ae as customFontRegistry,
26
- z as design,
26
+ V as design,
27
27
  r as editorElementKind,
28
28
  te as ensureCustomFontsLoaded,
29
- F as formatBuyPrice,
30
- v as isBundleProduct,
29
+ v as formatBuyPrice,
30
+ y as isBundleProduct,
31
31
  h as isBundleRenderProduct,
32
- H as isColorToken,
33
- M as isEditorError,
32
+ _ as isColorToken,
33
+ j as isEditorError,
34
34
  i as isGroupElement,
35
35
  n as isImageElement,
36
- J as isLayerToken,
36
+ z as isLayerToken,
37
37
  d as isPathElement,
38
- u as isShapeElement,
39
- m as isTextElement,
38
+ m as isShapeElement,
39
+ u as isTextElement,
40
40
  oe as loadCustomFont,
41
41
  k as productToRenderConfig,
42
- O as readTemplateFields,
42
+ Y as readTemplateFields,
43
43
  re as registerCustomFonts,
44
44
  ne as serializeState,
45
45
  D as splitRoleKey,
46
46
  l as useArtboards,
47
47
  E as useCanvasServices,
48
- Q as useColorBinding,
48
+ q as useColorBinding,
49
49
  c as useCommands,
50
- N as useEditor,
50
+ H as useEditor,
51
51
  U as useElementByName,
52
52
  p as useExport,
53
53
  W as useFontBinding,
@@ -39,9 +39,14 @@ export type EditorErrorCode =
39
39
  /** `design().artboard()`: an artboard with this label already exists in the
40
40
  * design (artboard names are placement labels — unique by contract). */
41
41
  | 'E_DUPLICATE_ARTBOARD'
42
- /** `usePlacements().select()`: the label names no artboard in the design
43
- * (ADR-0088). Lists the valid placement labels. */
42
+ /** `usePlacements().select()` / `.split()`: the label is neither a required
43
+ * product placement nor a design artboard (ADR-0088 / ADR-0101). Lists the
44
+ * valid placement labels. */
44
45
  | 'E_UNKNOWN_PLACEMENT'
46
+ /** `usePlacements().link()`: the label is the BASE artboard — the one every
47
+ * linked placement inherits — so it cannot be re-linked (ADR-0101). Link
48
+ * a split placement instead, or call `linkAll()`. */
49
+ | 'E_LINK_BASE'
45
50
  /** `select()` named an option key/choice that doesn't exist on the product
46
51
  * (Buy-owned selection, ADR-0085 §2 / P2). */
47
52
  | 'E_UNKNOWN_OPTION'
@@ -1,4 +1,4 @@
1
- import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-CEYA_6fY.js";
1
+ import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-DWHS41ba.js";
2
2
  function r(e) {
3
3
  return e instanceof i;
4
4
  }
@@ -15,10 +15,10 @@ function f(e) {
15
15
  return e instanceof a;
16
16
  }
17
17
  export {
18
- m as a,
18
+ u as a,
19
19
  f as b,
20
20
  c,
21
21
  r as d,
22
- u as i
22
+ m as i
23
23
  };
24
- //# sourceMappingURL=guards-DldCuuJq.js.map
24
+ //# sourceMappingURL=guards-DMmhw_Ow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"guards-DldCuuJq.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-DMmhw_Ow.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,30 +1,30 @@
1
- import { e as u } from "./useCommands-CQi4Pyd2.js";
2
- import { C as p, c as x, a as I, b as v, u as A, d as g, f as T, g as B, h as P } from "./useCommands-CQi4Pyd2.js";
3
- import { E as F, S as L, S as _, u as O, a as R } from "./SnowconeCanvas-BaFR8QXs.js";
4
- import { u as m, a as d } from "./design-builder-CqgTpp9B.js";
5
- import { C as z, D as w, d as D, s as K } from "./design-builder-CqgTpp9B.js";
6
- import { T as V, r as b, u as h, a as U, b as Y, c as Z, d as G, e as H, w as j } from "./template-fields-D8uOutD4.js";
7
- import { A as q, C as J, E as Q, M as W, P as X, r as $, v as ee } from "./validation-THw5W6N_.js";
8
- import { c as ae, e as te, l as oe, r as re } from "./ExportManager-CDX5_up8.js";
1
+ import { e as u } from "./useCommands-x8J7_Mzy.js";
2
+ import { C as c, f as x, g as I, h as v, b as A, a as g, j as T, k as B, l as F } from "./useCommands-x8J7_Mzy.js";
3
+ import { E as y, S as L, S as _, u as O, a as R } from "./SnowconeCanvas-CWSPyqqj.js";
4
+ import { b as m, d } from "./design-builder-CoCtjIwj.js";
5
+ import { C as z, D as w, e as D, s as K } from "./design-builder-CoCtjIwj.js";
6
+ import { T as V, r as b, u as h, a as G, b as H, c as U, d as Y, e as Z, w as j } from "./template-fields-CBLHgW7G.js";
7
+ import { A as J, C as q, E as Q, M as W, P as X, r as $, v as ee } from "./validation-BG-V98h0.js";
8
+ import { F as ae, G as te, H as oe, J as re } from "./ExportManager-BbBfO22S.js";
9
9
  import { c as ie, e as ue } from "./compose-DtQL_oit.js";
10
- import { d as de, m as Ce, s as Se, v as Ee } from "./CanvasStateV1-DLE5d1-d.js";
10
+ import { d as de, m as Ce, s as Se, v as Ee } from "./CanvasStateV1-C9LQt2J0.js";
11
11
  function E() {
12
12
  const { isCanvasReady: e } = m();
13
13
  return e;
14
14
  }
15
- function c() {
15
+ function f() {
16
16
  const { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i } = d();
17
17
  return { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i };
18
18
  }
19
19
  u();
20
20
  export {
21
- q as ALL_CAPABILITIES,
21
+ J as ALL_CAPABILITIES,
22
22
  z as CANVAS_STATE_SCHEMA_VERSION,
23
- J as COMPACT_CUSTOMIZER,
24
- p as CanvasServicesProvider,
23
+ q as COMPACT_CUSTOMIZER,
24
+ c as CanvasServicesProvider,
25
25
  w as DesignBuilder,
26
26
  Q as EMBED_ONLY,
27
- F as ErrorBoundary,
27
+ y as ErrorBoundary,
28
28
  W as MINIMAL_CAPABILITIES,
29
29
  X as PRO_STUDIO,
30
30
  L as SnowconeCanvas,
@@ -54,14 +54,14 @@ export {
54
54
  T as useCommands,
55
55
  R as useContentReady,
56
56
  m as useEditor,
57
- U as useElementByName,
57
+ G as useElementByName,
58
58
  B as useExport,
59
- Y as useFontBinding,
60
- Z as useImageBinding,
61
- P as useLayers,
62
- G as useSelectedElement,
63
- H as useTextBinding,
64
- c as useViewport,
59
+ H as useFontBinding,
60
+ U as useImageBinding,
61
+ F as useLayers,
62
+ Y as useSelectedElement,
63
+ Z as useTextBinding,
64
+ f as useViewport,
65
65
  ee as validateKit,
66
66
  Ee as validateState,
67
67
  j as withTemplateFields
@@ -1,25 +1,25 @@
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-CTN4j-uO.js";
2
- import { a as M } from "./ExportManager-CDX5_up8.js";
3
- import { D as hr, E as cr, I as dr, W as fr, b as ur, d as gr, f as lr, h as pr, i as yr, j as Mr, k as vr, m as Tr, n as kr, o as wr, p as Sr, q as br, s as Cr, t as Pr, u as Ir, v as mr, w as Ar, x as Rr, y as Wr, z as Er, A as Or, B as Hr, C as jr, F as Fr, G as Lr, H as Xr, J as Nr } from "./ExportManager-CDX5_up8.js";
4
- import { M as H, N as j, c as F, O as L, Q as X } from "./FontAnalyzer-CEYA_6fY.js";
5
- import { V as zr, W as Br, X as Kr, Y as Ur, Z as Yr, _ as Jr, $ as Vr, a0 as qr, a1 as Gr, a2 as Qr, a3 as Zr, a4 as $r, a5 as xr, a6 as Dr, a7 as ro, a8 as oo, a9 as so, aa as eo, ab as to } from "./FontAnalyzer-CEYA_6fY.js";
6
- import { A as ao, e as io, C as ho, S as co } from "./CanvasStateV1-DLE5d1-d.js";
7
- const N = F("image-adjustments"), v = 1e-3;
8
- function _(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);
1
+ import { A as rr, a as or, C as sr, I as er, R as nr, S as tr, T as ir } from "./CanvasRenderer-D-E5WWLm.js";
2
+ import { r as k } from "./ExportManager-BbBfO22S.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 Mr, k as Tr, l as Cr, 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 } from "./ExportManager-BbBfO22S.js";
4
+ import { i as H, a as j, c as F, r as L, b as X } from "./FontAnalyzer-DWHS41ba.js";
5
+ import { d as _r, e as Br, f as Kr, C as Ur, g as Yr, E as Jr, F as Vr, H as qr, L as Gr, h as Qr, W as Zr, j as $r, k as xr, l as Dr, m as ro, n as oo, o as so, s as eo, w as no } from "./FontAnalyzer-DWHS41ba.js";
6
+ import { A as io, a as ao, C as ho, S as co } from "./CanvasStateV1-C9LQt2J0.js";
7
+ const z = F("image-adjustments"), v = 1e-3;
8
+ function N(r, o) {
9
+ const { brightness: i, contrast: s, saturation: h } = o, e = i * s, n = 127.5 * (1 - s), f = Math.abs(e - 1) > v || Math.abs(n) > v, a = new Uint8ClampedArray(256);
10
10
  if (f)
11
- for (let g = 0; g < 256; g++) i[g] = g * e + t;
12
- const c = Math.abs(h - 1) > v, n = h, d = 0.213 + 0.787 * n, u = 0.715 - 0.715 * n, b = 0.072 - 0.072 * n, C = 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
- for (let g = 0; g < r.length; g += 4) {
14
- let l = r[g], p = r[g + 1], y = r[g + 2];
15
- if (f && (l = i[l], p = i[p], y = i[y]), c) {
16
- const W = d * l + u * p + b * y, E = C * l + P * p + I * y, O = m * l + A * p + R * y;
17
- l = W, p = E, y = O;
11
+ for (let l = 0; l < 256; l++) a[l] = l * e + n;
12
+ const c = Math.abs(h - 1) > v, t = h, d = 0.213 + 0.787 * t, g = 0.715 - 0.715 * t, S = 0.072 - 0.072 * t, b = 0.213 - 0.213 * t, P = 0.715 + 0.285 * t, I = 0.072 - 0.072 * t, m = 0.213 - 0.213 * t, A = 0.715 - 0.715 * t, R = 0.072 + 0.928 * t;
13
+ for (let l = 0; l < r.length; l += 4) {
14
+ let u = r[l], p = r[l + 1], y = r[l + 2];
15
+ if (f && (u = a[u], p = a[p], y = a[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;
17
+ u = W, p = E, y = O;
18
18
  }
19
- r[g] = l, r[g + 1] = p, r[g + 2] = y;
19
+ r[l] = u, r[l + 1] = p, r[l + 2] = y;
20
20
  }
21
21
  }
22
- const k = /* @__PURE__ */ new WeakMap(), z = 4;
22
+ const M = /* @__PURE__ */ new WeakMap(), _ = 4;
23
23
  function B(r) {
24
24
  const o = r.naturalWidth;
25
25
  return typeof o == "number" && o > 0 ? o : r.width;
@@ -32,42 +32,42 @@ function U(r, o) {
32
32
  if (typeof OffscreenCanvas < "u")
33
33
  return new OffscreenCanvas(r, o);
34
34
  if (typeof document < "u") {
35
- const a = document.createElement("canvas");
36
- return a.width = r, a.height = o, a;
35
+ const i = document.createElement("canvas");
36
+ return i.width = r, i.height = o, i;
37
37
  }
38
38
  throw new Error("image-adjustments: no canvas implementation available (no OffscreenCanvas, no DOM)");
39
39
  }
40
40
  function Y(r, o) {
41
- const a = B(r), s = K(r);
42
- if (a <= 0 || s <= 0)
41
+ const i = B(r), s = K(r);
42
+ if (i <= 0 || s <= 0)
43
43
  throw new Error("image-adjustments: source has no pixels (width/height is 0)");
44
- const h = U(a, s), e = h.getContext("2d");
44
+ const h = U(i, s), e = h.getContext("2d");
45
45
  if (!e)
46
46
  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 _(t.data, o), e.putImageData(t, 0, 0), h;
47
+ e.drawImage(r, 0, 0, i, s);
48
+ const n = e.getImageData(0, 0, i, s);
49
+ return N(n.data, o), e.putImageData(n, 0, 0), h;
50
50
  }
51
- function S(r, o) {
51
+ function C(r, o) {
52
52
  if (H(o)) return r;
53
- const a = j(o);
54
- let s = k.get(r);
55
- const h = s == null ? void 0 : s.get(a);
53
+ const i = j(o);
54
+ let s = M.get(r);
55
+ const h = s == null ? void 0 : s.get(i);
56
56
  if (h)
57
- return s.delete(a), s.set(a, h), h;
57
+ return s.delete(i), s.set(i, h), h;
58
58
  let e;
59
59
  try {
60
60
  e = Y(r, o);
61
- } catch (t) {
62
- N.error("adjustment pixel pass failed — rendering UNADJUSTED source:", t), e = r;
61
+ } catch (n) {
62
+ z.error("adjustment pixel pass failed — rendering UNADJUSTED source:", n), e = r;
63
63
  }
64
- for (s || (s = /* @__PURE__ */ new Map(), k.set(r, s)), s.set(a, e); s.size > z; ) {
65
- const t = s.keys().next().value;
66
- s.delete(t);
64
+ for (s || (s = /* @__PURE__ */ new Map(), M.set(r, s)), s.set(i, e); s.size > _; ) {
65
+ const n = s.keys().next().value;
66
+ s.delete(n);
67
67
  }
68
68
  return e;
69
69
  }
70
- L(S);
70
+ L(C);
71
71
  function Q(r, o) {
72
72
  return !r.needsCropPixelConversion || r.cropWidth === void 0 ? r : {
73
73
  ...r,
@@ -78,36 +78,36 @@ function Q(r, o) {
78
78
  needsCropPixelConversion: !1
79
79
  };
80
80
  }
81
- function Z(r, o, a) {
82
- var t, f;
83
- const s = S(
84
- a,
81
+ function Z(r, o, i) {
82
+ var n, f;
83
+ const s = C(
84
+ i,
85
85
  o.adjustments
86
86
  );
87
87
  r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
88
88
  let h = 1, e = 1;
89
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(
90
+ const a = Math.min(
91
91
  o.borderRadius / 100 * Math.min(o.width, o.height),
92
92
  o.width / 2,
93
93
  o.height / 2
94
94
  );
95
95
  r.beginPath();
96
- const c = -o.width / 2, n = -o.height / 2, d = o.width, u = 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 + u - i), r.arcTo(c + d, n + u, c + d - i, n + u, i), r.lineTo(c + i, n + u), r.arcTo(c, n + u, c, n + u - i, i), r.lineTo(c, n + i), r.arcTo(c, n, c + i, n, i), r.closePath(), r.clip();
96
+ const c = -o.width / 2, t = -o.height / 2, d = o.width, g = o.height;
97
+ r.moveTo(c + a, t), r.lineTo(c + d - a, t), r.arcTo(c + d, t, c + d, t + a, a), r.lineTo(c + d, t + g - a), r.arcTo(c + d, t + g, c + d - a, t + g, a), r.lineTo(c + a, t + g), r.arcTo(c, t + g, c, t + g - a, a), r.lineTo(c, t + a), r.arcTo(c, t, c + a, t, a), r.closePath(), r.clip();
98
98
  }
99
99
  if (o.cropX !== void 0 && o.cropWidth !== void 0 ? r.drawImage(
100
100
  s,
101
101
  o.cropX,
102
102
  o.cropY || 0,
103
103
  o.cropWidth,
104
- o.cropHeight || a.height,
104
+ o.cropHeight || i.height,
105
105
  -o.width / 2,
106
106
  -o.height / 2,
107
107
  o.width,
108
108
  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 = {
109
+ ) : r.drawImage(s, -o.width / 2, -o.height / 2, o.width, o.height), r.restore(), (n = o.stroke) != null && n.enabled) {
110
+ const a = ((f = o.knockoutParts) == null ? void 0 : f.stroke) === !0, c = {
111
111
  x: o.x,
112
112
  y: o.y,
113
113
  rotation: o.rotation,
@@ -120,71 +120,71 @@ function Z(r, o, a) {
120
120
  borderRadius: o.borderRadius || 0
121
121
  }
122
122
  };
123
- if (i) {
124
- const n = r.canvas;
123
+ if (a) {
124
+ const t = r.canvas;
125
125
  let d;
126
126
  if (typeof OffscreenCanvas < "u")
127
- d = new OffscreenCanvas(n.width, n.height);
127
+ d = new OffscreenCanvas(t.width, t.height);
128
128
  else if (typeof document < "u")
129
- d = document.createElement("canvas"), d.width = n.width, d.height = n.height;
129
+ d = document.createElement("canvas"), d.width = t.width, d.height = t.height;
130
130
  else {
131
- M(r, c);
131
+ k(r, c);
132
132
  return;
133
133
  }
134
- const u = d.getContext("2d");
135
- if (!u) {
136
- M(r, c);
134
+ const g = d.getContext("2d");
135
+ if (!g) {
136
+ k(r, c);
137
137
  return;
138
138
  }
139
- M(u, c, { isKnockout: !0 }), r.save(), r.globalCompositeOperation = "destination-out", r.drawImage(d, 0, 0), r.restore();
139
+ k(g, c, { isKnockout: !0 }), r.save(), r.globalCompositeOperation = "destination-out", r.drawImage(d, 0, 0), r.restore();
140
140
  } else
141
- M(r, c);
141
+ k(r, c);
142
142
  }
143
143
  }
144
144
  function J(r, o) {
145
145
  if (typeof OffscreenCanvas < "u")
146
146
  return new OffscreenCanvas(r, o);
147
- const a = document.createElement("canvas");
148
- return a.width = r, a.height = o, a;
147
+ const i = document.createElement("canvas");
148
+ return i.width = r, i.height = o, i;
149
149
  }
150
150
  function $(r, o) {
151
151
  var e;
152
- const a = o.opacity ?? 1, s = !!((e = o.stroke) != null && e.enabled);
153
- a < 1 && s ? V(r, o, a) : T(r, o, a);
152
+ const i = o.opacity ?? 1, s = !!((e = o.stroke) != null && e.enabled);
153
+ i < 1 && s ? V(r, o, i) : w(r, o, i);
154
154
  }
155
- function V(r, o, a) {
155
+ function V(r, o, i) {
156
156
  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");
157
+ const s = o.transformData, e = (((d = o.stroke) == null ? void 0 : d.width) || 2) + 2, n = Math.ceil(s.width + e * 2), f = Math.ceil(s.height + e * 2), a = J(n, f), c = a.getContext("2d");
158
158
  if (!c) {
159
- T(r, o, a);
159
+ w(r, o, i);
160
160
  return;
161
161
  }
162
- const n = {
162
+ const t = {
163
163
  ...o,
164
- x: t / 2,
164
+ x: n / 2,
165
165
  y: f / 2
166
166
  };
167
- T(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();
167
+ w(c, t, 1), r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = i, r.drawImage(a, -n / 2, -f / 2), r.restore();
168
168
  }
169
- function T(r, o, a) {
169
+ function w(r, o, i) {
170
170
  var e;
171
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(), w(r, s), r.fill(), r.restore(), (e = o.stroke) != null && e.enabled) {
172
+ if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = i * h, r.fillStyle = X(r, s), r.beginPath(), T(r, s), r.fill(), r.restore(), (e = o.stroke) != null && e.enabled) {
173
173
  r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
174
- 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(), w(r, s), r.stroke(), r.restore();
174
+ const n = o.stroke;
175
+ r.globalAlpha = i * (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(), T(r, s), r.stroke(), r.restore();
176
176
  }
177
177
  }
178
- function w(r, o) {
179
- const { shapeType: a, width: s, height: h } = o;
180
- switch (a) {
178
+ function T(r, o) {
179
+ const { shapeType: i, width: s, height: h } = o;
180
+ switch (i) {
181
181
  case "rectangle": {
182
- const e = o.borderRadius || 0, t = -s / 2, f = -h / 2;
182
+ const e = o.borderRadius || 0, n = -s / 2, f = -h / 2;
183
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);
184
+ const a = Math.min(e / 100 * Math.min(s, h), s / 2, h / 2);
185
+ r.roundRect(n, f, s, h, a);
186
186
  } else
187
- r.rect(t, f, s, h);
187
+ r.rect(n, f, s, h);
188
188
  break;
189
189
  }
190
190
  case "circle": {
@@ -197,31 +197,31 @@ function w(r, o) {
197
197
  break;
198
198
  }
199
199
  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();
200
+ const e = s / 2, n = h / 2;
201
+ r.moveTo(0, -n), r.lineTo(e, n), r.lineTo(-e, n), r.closePath();
202
202
  break;
203
203
  }
204
204
  case "polygon": {
205
- const e = o.sides || 5, t = Math.min(s, h) / 2;
205
+ const e = o.sides || 5, n = Math.min(s, h) / 2;
206
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);
208
- f === 0 ? r.moveTo(c, n) : r.lineTo(c, n);
207
+ const a = f * 2 * Math.PI / e - Math.PI / 2, c = n * Math.cos(a), t = n * Math.sin(a);
208
+ f === 0 ? r.moveTo(c, t) : r.lineTo(c, t);
209
209
  }
210
210
  r.closePath();
211
211
  break;
212
212
  }
213
213
  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), u = n * Math.sin(c);
217
- i === 0 ? r.moveTo(d, u) : r.lineTo(d, u);
214
+ const e = o.points || 5, n = Math.min(s, h) / 2, f = n * (o.innerRadius || 0.4);
215
+ for (let a = 0; a < e * 2; a++) {
216
+ const c = a * Math.PI / e - Math.PI / 2, t = a % 2 === 0 ? n : f, d = t * Math.cos(c), g = t * Math.sin(c);
217
+ a === 0 ? r.moveTo(d, g) : r.lineTo(d, g);
218
218
  }
219
219
  r.closePath();
220
220
  break;
221
221
  }
222
222
  case "line": {
223
- const e = s / 2, t = h / 2;
224
- r.rect(-e, -t, s, h);
223
+ const e = s / 2, n = h / 2;
224
+ r.rect(-e, -n, s, h);
225
225
  break;
226
226
  }
227
227
  default:
@@ -230,9 +230,9 @@ function w(r, o) {
230
230
  }
231
231
  export {
232
232
  rr as AlignmentSnapSystem,
233
- ao as AnyElementConfigSchema,
234
- io as AnyTransformDataSchema,
235
- zr as ArchTransform,
233
+ io as AnyElementConfigSchema,
234
+ ao as AnyTransformDataSchema,
235
+ _r as ArchTransform,
236
236
  Br as ArtboardManager,
237
237
  or as ArtboardRenderer,
238
238
  Kr as AscendTransform,
@@ -249,37 +249,37 @@ export {
249
249
  er as InteractionStateMachine,
250
250
  Gr as LeanTransform,
251
251
  Qr as LogLevel,
252
- tr as ResizePipeline,
252
+ nr as ResizePipeline,
253
253
  co as SerializedArtboardSchema,
254
- nr as SpacingSystem,
255
- ar as TransformHandles,
254
+ tr as SpacingSystem,
255
+ ir as TransformHandles,
256
256
  Zr as WaveTransform,
257
257
  fr as WorkerExportManager,
258
- ur as applySpaceLayoutRules,
259
- gr as applyStrokeStyle,
260
- lr as buildFontString,
258
+ gr as applySpaceLayoutRules,
259
+ lr as applyStrokeStyle,
260
+ ur as buildFontString,
261
261
  $r as calculateFixedCornerPosition,
262
262
  xr as calculateResizeHandles,
263
263
  Dr as calculateRotationHandlePosition,
264
264
  pr as clearImageBitmapCache,
265
265
  yr as clearMaskCache,
266
- Mr as clearRegisteredBitmapKeys,
266
+ kr as clearRegisteredBitmapKeys,
267
267
  vr as createCirclePath,
268
- Tr as createImagePath,
268
+ wr as createImagePath,
269
269
  F as createLogger,
270
- kr as createRectPath,
271
- wr as createTextPath,
272
- Sr as getFontMetrics,
273
- br as getSharedWorkerExportManager,
270
+ Mr as createRectPath,
271
+ Tr as createTextPath,
272
+ Cr as getFontMetrics,
273
+ Sr as getSharedWorkerExportManager,
274
274
  ro as hitTestCircle,
275
275
  oo as hitTestRect,
276
- Cr as invalidateMaskCache,
276
+ br as invalidateMaskCache,
277
277
  so as logger,
278
278
  Pr as measureTextWidth,
279
279
  Ir as removeFromImageBitmapCache,
280
280
  mr as renderCustomTransform,
281
281
  Z as renderImageElement,
282
- M as renderImageStroke,
282
+ k as renderImageStroke,
283
283
  Ar as renderMultilineText,
284
284
  Rr as renderPathStroke,
285
285
  Wr as renderRichTextFillOnly,
@@ -293,7 +293,7 @@ export {
293
293
  eo as splitRichTextIntoLines,
294
294
  Lr as terminateSharedWorkerExportManager,
295
295
  Xr as unregisterElementBitmaps,
296
- to as wrapRichTextSpans,
297
- Nr as wrapText
296
+ no as wrapRichTextSpans,
297
+ zr as wrapText
298
298
  };
299
299
  //# sourceMappingURL=internals.mjs.map