@snowcone-app/canvas 0.1.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 (370) hide show
  1. package/LICENSE.txt +70 -0
  2. package/README.md +357 -0
  3. package/dist/CanvasStateV1-D5GzvmnY.cjs +65 -0
  4. package/dist/CanvasStateV1-D5GzvmnY.cjs.map +1 -0
  5. package/dist/CanvasStateV1-ejb4d_LM.js +3692 -0
  6. package/dist/CanvasStateV1-ejb4d_LM.js.map +1 -0
  7. package/dist/ElementFactory-B7UOaJSD.cjs +23865 -0
  8. package/dist/ElementFactory-B7UOaJSD.cjs.map +1 -0
  9. package/dist/ElementFactory-uJTXU-nP.js +29615 -0
  10. package/dist/ElementFactory-uJTXU-nP.js.map +1 -0
  11. package/dist/HybridHistoryManager-BV6XV0nD.js +8048 -0
  12. package/dist/HybridHistoryManager-BV6XV0nD.js.map +1 -0
  13. package/dist/HybridHistoryManager-BXD93pp8.cjs +8 -0
  14. package/dist/HybridHistoryManager-BXD93pp8.cjs.map +1 -0
  15. package/dist/ImportManager-BYwuK6n4.cjs +2 -0
  16. package/dist/ImportManager-BYwuK6n4.cjs.map +1 -0
  17. package/dist/ImportManager-CxiaRg1N.js +222 -0
  18. package/dist/ImportManager-CxiaRg1N.js.map +1 -0
  19. package/dist/ThemeContext-4mJ_y0Me.cjs +2 -0
  20. package/dist/ThemeContext-4mJ_y0Me.cjs.map +1 -0
  21. package/dist/ThemeContext-H0Z-MqqR.js +1077 -0
  22. package/dist/ThemeContext-H0Z-MqqR.js.map +1 -0
  23. package/dist/advanced.d.ts +2 -0
  24. package/dist/advanced.js +48 -0
  25. package/dist/advanced.js.map +1 -0
  26. package/dist/advanced.mjs +15679 -0
  27. package/dist/advanced.mjs.map +1 -0
  28. package/dist/api/advanced.d.ts +110 -0
  29. package/dist/api/internals.d.ts +39 -0
  30. package/dist/api/stable.d.ts +44 -0
  31. package/dist/api/testing.d.ts +25 -0
  32. package/dist/browser-module-D0gHY9rY.cjs +9 -0
  33. package/dist/browser-module-D0gHY9rY.cjs.map +1 -0
  34. package/dist/browser-module-DFvKXBUE.js +15474 -0
  35. package/dist/browser-module-DFvKXBUE.js.map +1 -0
  36. package/dist/components/ArtboardDistressPanel.d.ts +7 -0
  37. package/dist/components/ArtboardImageMaskPanel.d.ts +7 -0
  38. package/dist/components/ArtboardPropertiesToolbar.d.ts +19 -0
  39. package/dist/components/ArtboardToolbar.d.ts +10 -0
  40. package/dist/components/BackButton.d.ts +7 -0
  41. package/dist/components/BackgroundPickerDropdown.d.ts +11 -0
  42. package/dist/components/BackgroundSwitcher.d.ts +7 -0
  43. package/dist/components/CanvasA11yFallback.d.ts +62 -0
  44. package/dist/components/CanvasEditor/CanvasRendererComponent.d.ts +51 -0
  45. package/dist/components/CanvasEditor/handlers/cropModeHandlers.d.ts +114 -0
  46. package/dist/components/CanvasEditor/handlers/groupChildHandlers.d.ts +65 -0
  47. package/dist/components/CanvasEditor/handlers/index.d.ts +10 -0
  48. package/dist/components/CanvasEditor/handlers/multiSelectionHandlers.d.ts +86 -0
  49. package/dist/components/CanvasEditor/hooks/buildSpreadClipShape.d.ts +20 -0
  50. package/dist/components/CanvasEditor/hooks/index.d.ts +24 -0
  51. package/dist/components/CanvasEditor/hooks/useActiveChild.d.ts +23 -0
  52. package/dist/components/CanvasEditor/hooks/useAnimatedFocusRect.d.ts +17 -0
  53. package/dist/components/CanvasEditor/hooks/useCanvasInteraction.d.ts +284 -0
  54. package/dist/components/CanvasEditor/hooks/useCanvasLayout.d.ts +50 -0
  55. package/dist/components/CanvasEditor/hooks/useCanvasRenderLoop.d.ts +140 -0
  56. package/dist/components/CanvasEditor/hooks/useCropMode.d.ts +4 -0
  57. package/dist/components/CanvasEditor/hooks/useHoverState.d.ts +9 -0
  58. package/dist/components/CanvasEditor/hooks/useInteractionState.d.ts +23 -0
  59. package/dist/components/CanvasEditor/hooks/useKeyboardHandlers.d.ts +16 -0
  60. package/dist/components/CanvasEditor/hooks/useMarqueeSelection.d.ts +22 -0
  61. package/dist/components/CanvasEditor/hooks/useMultiSelection.d.ts +5 -0
  62. package/dist/components/CanvasEditor/hooks/usePenTool.d.ts +10 -0
  63. package/dist/components/CanvasEditor/hooks/useRenderState.d.ts +31 -0
  64. package/dist/components/CanvasEditor/hooks/useSnapAndSpacing.d.ts +42 -0
  65. package/dist/components/CanvasEditor/hooks/useTextEditing.d.ts +56 -0
  66. package/dist/components/CanvasEditor/hooks/useTextEditingHandlers.d.ts +75 -0
  67. package/dist/components/CanvasEditor/renderers/hoverRenderer.d.ts +12 -0
  68. package/dist/components/CanvasEditor/renderers/index.d.ts +10 -0
  69. package/dist/components/CanvasEditor/renderers/marqueeRenderer.d.ts +21 -0
  70. package/dist/components/CanvasEditor/renderers/multiSelectionRenderer.d.ts +52 -0
  71. package/dist/components/CanvasEditor/renderers/renderingConstants.d.ts +59 -0
  72. package/dist/components/CanvasEditor/types/index.d.ts +11 -0
  73. package/dist/components/CanvasEditor.d.ts +102 -0
  74. package/dist/components/ColorPickerDropdown.d.ts +29 -0
  75. package/dist/components/CompositingPanel.d.ts +8 -0
  76. package/dist/components/ContextualToolbars.d.ts +150 -0
  77. package/dist/components/CropPanel.d.ts +20 -0
  78. package/dist/components/DistressPanel.d.ts +7 -0
  79. package/dist/components/DocsPage.d.ts +6 -0
  80. package/dist/components/Drawer.d.ts +39 -0
  81. package/dist/components/EffectsPanel.d.ts +14 -0
  82. package/dist/components/ExportTestPanel.d.ts +16 -0
  83. package/dist/components/FontBrowserDrawer.d.ts +20 -0
  84. package/dist/components/FontSizeDropdown.d.ts +12 -0
  85. package/dist/components/GlyphBrowserDrawer.d.ts +13 -0
  86. package/dist/components/GlyphPicker.d.ts +14 -0
  87. package/dist/components/IconMatchTest.d.ts +3 -0
  88. package/dist/components/IconSizeTest.d.ts +3 -0
  89. package/dist/components/ImageBrowserDrawer.d.ts +27 -0
  90. package/dist/components/ImageToolbar.d.ts +47 -0
  91. package/dist/components/LayerEffects.d.ts +11 -0
  92. package/dist/components/LayerLeadingChip.d.ts +9 -0
  93. package/dist/components/LayersPanel.d.ts +30 -0
  94. package/dist/components/MaskItem.d.ts +12 -0
  95. package/dist/components/MasksPanel.d.ts +7 -0
  96. package/dist/components/MonotypeDemoPage.d.ts +2 -0
  97. package/dist/components/MoreMenu.d.ts +15 -0
  98. package/dist/components/OpenTypeFeaturesPanel.d.ts +12 -0
  99. package/dist/components/PathToolbar.d.ts +10 -0
  100. package/dist/components/PenToolDemo.d.ts +3 -0
  101. package/dist/components/ProgressiveBlur.d.ts +25 -0
  102. package/dist/components/RotationHandle.d.ts +47 -0
  103. package/dist/components/SaveLoadMenu.d.ts +15 -0
  104. package/dist/components/ShapeToolbar.d.ts +71 -0
  105. package/dist/components/ShapeTypeDrawer.d.ts +10 -0
  106. package/dist/components/StrokePanel.d.ts +7 -0
  107. package/dist/components/TailwindDemo.d.ts +3 -0
  108. package/dist/components/TextEffectsDropdown.d.ts +14 -0
  109. package/dist/components/TextToolbar.d.ts +47 -0
  110. package/dist/components/TextTypeDrawer.d.ts +8 -0
  111. package/dist/components/ThemeToggle.d.ts +2 -0
  112. package/dist/components/TransformControlPanel.d.ts +12 -0
  113. package/dist/components/VisualGuideOverlay.d.ts +156 -0
  114. package/dist/components/embed/ArtboardTabs.d.ts +74 -0
  115. package/dist/components/embed/Canvas.d.ts +72 -0
  116. package/dist/components/embed/EffectsPanel.d.ts +76 -0
  117. package/dist/components/embed/ErrorBoundary.d.ts +34 -0
  118. package/dist/components/embed/ExportPanel.d.ts +51 -0
  119. package/dist/components/embed/GlyphPanel.d.ts +70 -0
  120. package/dist/components/embed/ImagePanel.d.ts +58 -0
  121. package/dist/components/embed/LayersPanel.d.ts +13 -0
  122. package/dist/components/embed/LoadingStates.d.ts +32 -0
  123. package/dist/components/embed/MenuButton.d.ts +47 -0
  124. package/dist/components/embed/SnowconeCanvas.d.ts +844 -0
  125. package/dist/components/embed/ZoomControls.d.ts +16 -0
  126. package/dist/components/embed/index.d.ts +129 -0
  127. package/dist/components/embed/primitives/index.d.ts +42 -0
  128. package/dist/components/embed/ui/index.d.ts +52 -0
  129. package/dist/components/embed/utils/index.d.ts +31 -0
  130. package/dist/components/embedded/ArtboardEmbed.d.ts +70 -0
  131. package/dist/components/embedded/MerchifyThemeWrapper.d.ts +30 -0
  132. package/dist/components/embedded/ProductPreviewCard.d.ts +8 -0
  133. package/dist/components/embedded/index.d.ts +7 -0
  134. package/dist/components/primitives/ButtonGroup.d.ts +27 -0
  135. package/dist/components/primitives/ControlGroup.d.ts +15 -0
  136. package/dist/components/primitives/Dropdown.d.ts +27 -0
  137. package/dist/components/primitives/DropdownMenu.d.ts +9 -0
  138. package/dist/components/primitives/MenuItem.d.ts +13 -0
  139. package/dist/components/primitives/Panel.d.ts +25 -0
  140. package/dist/components/primitives/SecondaryToolbar.d.ts +9 -0
  141. package/dist/components/primitives/Switch.d.ts +10 -0
  142. package/dist/components/primitives/Toggle.d.ts +17 -0
  143. package/dist/components/primitives/index.d.ts +22 -0
  144. package/dist/components/stories/utils/MockEditorProvider.d.ts +32 -0
  145. package/dist/components/stories/utils/QACanvasCard.d.ts +41 -0
  146. package/dist/components/stories/utils/VisualQACard.d.ts +24 -0
  147. package/dist/components/stories/utils/element-factories.d.ts +188 -0
  148. package/dist/components/stories/utils/spec-to-elements.d.ts +74 -0
  149. package/dist/components/stories/utils/themeDecorator.d.ts +45 -0
  150. package/dist/components/stories/utils/unified-test-cases.d.ts +27 -0
  151. package/dist/components/text-toolbar/BoldButton.d.ts +5 -0
  152. package/dist/components/text-toolbar/FontColorButton.d.ts +6 -0
  153. package/dist/components/text-toolbar/FontSizeGroup.d.ts +5 -0
  154. package/dist/components/text-toolbar/ItalicButton.d.ts +5 -0
  155. package/dist/components/text-toolbar/TextAlignButton.d.ts +5 -0
  156. package/dist/components/text-toolbar/TextMoreMenu.d.ts +7 -0
  157. package/dist/components/text-toolbar/UnderlineButton.d.ts +5 -0
  158. package/dist/components/text-toolbar/UppercaseButton.d.ts +5 -0
  159. package/dist/components/text-toolbar/index.d.ts +25 -0
  160. package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +49 -0
  161. package/dist/components/toolbars/ExpandedPanelIcon.d.ts +13 -0
  162. package/dist/components/toolbars/FloatingPanels.d.ts +23 -0
  163. package/dist/components/toolbars/GroupElementToolbar.d.ts +35 -0
  164. package/dist/components/toolbars/SecondaryPanels.d.ts +125 -0
  165. package/dist/components/toolbars/index.d.ts +18 -0
  166. package/dist/components/toolbars/shared/ColorPanelWrapper.d.ts +9 -0
  167. package/dist/components/toolbars/shared/SecondaryPanelWrapper.d.ts +9 -0
  168. package/dist/components/ui/PresetCarousel.d.ts +21 -0
  169. package/dist/components/ui/SecondaryPanel.d.ts +28 -0
  170. package/dist/components/ui/SliderRow.d.ts +30 -0
  171. package/dist/components/ui/collapsed-toolbar-header.d.ts +14 -0
  172. package/dist/components/ui/custom-icons.d.ts +25 -0
  173. package/dist/components/ui/icons.d.ts +100 -0
  174. package/dist/components/ui/index.d.ts +48 -0
  175. package/dist/components/ui/normalized-icon.d.ts +63 -0
  176. package/dist/components/ui/toolbar-button.d.ts +24 -0
  177. package/dist/compose-Bo108juW.cjs +33 -0
  178. package/dist/compose-Bo108juW.cjs.map +1 -0
  179. package/dist/compose-DQ1FZS3O.js +7690 -0
  180. package/dist/compose-DQ1FZS3O.js.map +1 -0
  181. package/dist/constants.d.ts +121 -0
  182. package/dist/contexts/CommandContext.d.ts +87 -0
  183. package/dist/contexts/EditorContext.d.ts +190 -0
  184. package/dist/contexts/ElementsContext.d.ts +104 -0
  185. package/dist/contexts/HistoryContext.d.ts +60 -0
  186. package/dist/contexts/KitContext.d.ts +50 -0
  187. package/dist/contexts/SelectionContext.d.ts +51 -0
  188. package/dist/contexts/ThemeContext.d.ts +55 -0
  189. package/dist/contexts/ToolStateContext.d.ts +60 -0
  190. package/dist/contexts/ViewportContext.d.ts +87 -0
  191. package/dist/core/AlignmentSnapSystem.d.ts +270 -0
  192. package/dist/core/ArtboardElement.d.ts +106 -0
  193. package/dist/core/ArtboardManager.d.ts +130 -0
  194. package/dist/core/ArtboardRenderer.d.ts +97 -0
  195. package/dist/core/BaseElement.d.ts +94 -0
  196. package/dist/core/CanvasRenderer.d.ts +237 -0
  197. package/dist/core/CommandHistory.d.ts +173 -0
  198. package/dist/core/CoordinateTransform.d.ts +69 -0
  199. package/dist/core/CropModeController.d.ts +90 -0
  200. package/dist/core/EditModeRenderer.d.ts +51 -0
  201. package/dist/core/ElementFactory.d.ts +73 -0
  202. package/dist/core/ElementStore.d.ts +69 -0
  203. package/dist/core/EventBus.d.ts +163 -0
  204. package/dist/core/GeometryUtils.d.ts +247 -0
  205. package/dist/core/GroupElement.d.ts +134 -0
  206. package/dist/core/HoverRenderer.d.ts +103 -0
  207. package/dist/core/HybridHistoryManager.d.ts +137 -0
  208. package/dist/core/ImageCache.d.ts +63 -0
  209. package/dist/core/ImageElement.d.ts +226 -0
  210. package/dist/core/ImageLoadEvents.d.ts +23 -0
  211. package/dist/core/InteractionFeedbackRenderer.d.ts +15 -0
  212. package/dist/core/InteractionStateMachine.d.ts +199 -0
  213. package/dist/core/PathElement.d.ts +84 -0
  214. package/dist/core/PenToolManager.d.ts +112 -0
  215. package/dist/core/PinchHandler.d.ts +32 -0
  216. package/dist/core/ResizeHandler.d.ts +51 -0
  217. package/dist/core/ResizePipeline.d.ts +83 -0
  218. package/dist/core/ResizeUtils.d.ts +17 -0
  219. package/dist/core/RotationAnchorResolver.d.ts +60 -0
  220. package/dist/core/RotationUtils.d.ts +28 -0
  221. package/dist/core/SelectionRenderer.d.ts +24 -0
  222. package/dist/core/ShapeElement.d.ts +121 -0
  223. package/dist/core/SpacingSystem.d.ts +73 -0
  224. package/dist/core/SpatialGrid.d.ts +53 -0
  225. package/dist/core/TextElement.d.ts +80 -0
  226. package/dist/core/TextMetrics.d.ts +117 -0
  227. package/dist/core/Transform.d.ts +158 -0
  228. package/dist/core/TransformConverter.d.ts +16 -0
  229. package/dist/core/TransformHandles.d.ts +55 -0
  230. package/dist/core/artboardReducer.d.ts +46 -0
  231. package/dist/effects/DistressGenerator.d.ts +26 -0
  232. package/dist/effects/DistressTextureCache.d.ts +49 -0
  233. package/dist/effects/distress-presets.d.ts +86 -0
  234. package/dist/effects/distress-textures.d.ts +34 -0
  235. package/dist/effects/distress-utils.d.ts +39 -0
  236. package/dist/effects/mask-presets.d.ts +36 -0
  237. package/dist/fonts/google-fonts.d.ts +48 -0
  238. package/dist/google-fonts.json +1 -0
  239. package/dist/hooks/index.d.ts +42 -0
  240. package/dist/hooks/useArtboards.d.ts +71 -0
  241. package/dist/hooks/useAutoExport.d.ts +66 -0
  242. package/dist/hooks/useBreakpoint.d.ts +53 -0
  243. package/dist/hooks/useCanvasEvents.d.ts +8 -0
  244. package/dist/hooks/useCanvasReady.d.ts +22 -0
  245. package/dist/hooks/useClickOutside.d.ts +3 -0
  246. package/dist/hooks/useCommandHistory.d.ts +39 -0
  247. package/dist/hooks/useCommands.d.ts +47 -0
  248. package/dist/hooks/useContentReady.d.ts +18 -0
  249. package/dist/hooks/useElementById.d.ts +20 -0
  250. package/dist/hooks/useElementByName.d.ts +10 -0
  251. package/dist/hooks/useElementProperties.d.ts +29 -0
  252. package/dist/hooks/useExport.d.ts +89 -0
  253. package/dist/hooks/useImageBinding.d.ts +34 -0
  254. package/dist/hooks/useKeyboardShortcuts.d.ts +13 -0
  255. package/dist/hooks/useLayerDndKit.d.ts +24 -0
  256. package/dist/hooks/useLayerDragDrop.d.ts +58 -0
  257. package/dist/hooks/useLayerPreview.d.ts +31 -0
  258. package/dist/hooks/useLayerSelection.d.ts +76 -0
  259. package/dist/hooks/useLayers.d.ts +91 -0
  260. package/dist/hooks/usePerformance.d.ts +48 -0
  261. package/dist/hooks/useProjectLoader.d.ts +64 -0
  262. package/dist/hooks/useSelectedElement.d.ts +17 -0
  263. package/dist/hooks/useTextBinding.d.ts +26 -0
  264. package/dist/hooks/useTextToolbar.d.ts +61 -0
  265. package/dist/hooks/useViewport.d.ts +46 -0
  266. package/dist/icons/icon-data.d.ts +2 -0
  267. package/dist/icons/registry.d.ts +28 -0
  268. package/dist/index.d.ts +6 -0
  269. package/dist/index.js +2 -0
  270. package/dist/index.js.map +1 -0
  271. package/dist/index.mjs +1138 -0
  272. package/dist/index.mjs.map +1 -0
  273. package/dist/internals.d.ts +2 -0
  274. package/dist/internals.js +2 -0
  275. package/dist/internals.js.map +1 -0
  276. package/dist/internals.mjs +219 -0
  277. package/dist/internals.mjs.map +1 -0
  278. package/dist/kits/compose.d.ts +69 -0
  279. package/dist/kits/index.d.ts +21 -0
  280. package/dist/kits/presets.d.ts +40 -0
  281. package/dist/kits/registry.d.ts +33 -0
  282. package/dist/kits/sections.d.ts +119 -0
  283. package/dist/kits/serialization.d.ts +78 -0
  284. package/dist/kits/types.d.ts +129 -0
  285. package/dist/kits/validation.d.ts +36 -0
  286. package/dist/lib/utils.d.ts +2 -0
  287. package/dist/plugins/ElementTypePlugin.d.ts +90 -0
  288. package/dist/presets/artboard-color-presets.d.ts +22 -0
  289. package/dist/presets/tshirt-presets.d.ts +60 -0
  290. package/dist/rendering/CompositingRenderer.d.ts +33 -0
  291. package/dist/rendering/DistressTextureRenderer.d.ts +39 -0
  292. package/dist/rendering/ElementRenderUtils.d.ts +17 -0
  293. package/dist/rendering/MaskRenderer.d.ts +41 -0
  294. package/dist/rendering/PieceGuideRenderer.d.ts +177 -0
  295. package/dist/rendering/StrokeRenderer.d.ts +24 -0
  296. package/dist/rendering/canvas-renderer.d.ts +18 -0
  297. package/dist/rendering/element-serializer.d.ts +143 -0
  298. package/dist/rendering/image-renderer.d.ts +6 -0
  299. package/dist/rendering/knockout-utils.d.ts +48 -0
  300. package/dist/rendering/mask-utils.d.ts +65 -0
  301. package/dist/rendering/renderer-types.d.ts +79 -0
  302. package/dist/rendering/rich-text-renderer.d.ts +43 -0
  303. package/dist/rendering/serialize-for-server.d.ts +45 -0
  304. package/dist/rendering/shape-renderer.d.ts +6 -0
  305. package/dist/rendering/stroke-utils.d.ts +18 -0
  306. package/dist/rendering/text-renderer.d.ts +71 -0
  307. package/dist/rendering/transform-renderer.d.ts +33 -0
  308. package/dist/services/AutoExportManager.d.ts +107 -0
  309. package/dist/services/falApi.d.ts +63 -0
  310. package/dist/services/nounProjectApi.d.ts +90 -0
  311. package/dist/services/recraftApi.d.ts +65 -0
  312. package/dist/services/runwareApi.d.ts +69 -0
  313. package/dist/state/CanvasStateV1.d.ts +373 -0
  314. package/dist/state/index.d.ts +10 -0
  315. package/dist/style.css +1 -0
  316. package/dist/taco-reference-cropped.jpg +0 -0
  317. package/dist/testing/MockEditorProvider.d.ts +49 -0
  318. package/dist/testing/index.d.ts +25 -0
  319. package/dist/testing/utils.d.ts +128 -0
  320. package/dist/testing.d.ts +2 -0
  321. package/dist/testing.js +2 -0
  322. package/dist/testing.js.map +1 -0
  323. package/dist/testing.mjs +140 -0
  324. package/dist/testing.mjs.map +1 -0
  325. package/dist/textures/glass-frame.svg +32 -0
  326. package/dist/theme.d.ts +99 -0
  327. package/dist/themes/index.d.ts +23 -0
  328. package/dist/transforms/ArchTransform.d.ts +14 -0
  329. package/dist/transforms/AscendTransform.d.ts +14 -0
  330. package/dist/transforms/CircleTransform.d.ts +51 -0
  331. package/dist/transforms/CustomTransform.d.ts +81 -0
  332. package/dist/transforms/FlagTransform.d.ts +14 -0
  333. package/dist/transforms/LeanTransform.d.ts +14 -0
  334. package/dist/transforms/WaveTransform.d.ts +16 -0
  335. package/dist/transforms/defaults.d.ts +33 -0
  336. package/dist/transforms/index.d.ts +10 -0
  337. package/dist/transforms/registry.d.ts +51 -0
  338. package/dist/types/capabilities.d.ts +50 -0
  339. package/dist/types/guards.d.ts +31 -0
  340. package/dist/types/index.d.ts +765 -0
  341. package/dist/types/public.d.ts +31 -0
  342. package/dist/types/react.d.ts +132 -0
  343. package/dist/utils/ArtworkPlacement.d.ts +97 -0
  344. package/dist/utils/ElementPreviewRenderer.d.ts +19 -0
  345. package/dist/utils/ExportManager.d.ts +208 -0
  346. package/dist/utils/FontAnalyzer.d.ts +137 -0
  347. package/dist/utils/GlyphRenderer.d.ts +55 -0
  348. package/dist/utils/GoogleFontsService.d.ts +37 -0
  349. package/dist/utils/ImageLoader.d.ts +124 -0
  350. package/dist/utils/ImportManager.d.ts +72 -0
  351. package/dist/utils/MonotypeCategoryMapping.d.ts +36 -0
  352. package/dist/utils/MonotypeService.d.ts +148 -0
  353. package/dist/utils/PerformanceMonitor.d.ts +54 -0
  354. package/dist/utils/TextureManager.d.ts +60 -0
  355. package/dist/utils/UnifiedFontService.d.ts +117 -0
  356. package/dist/utils/WorkerExportManager.d.ts +185 -0
  357. package/dist/utils/clickProtection.d.ts +39 -0
  358. package/dist/utils/cn.d.ts +4 -0
  359. package/dist/utils/colorConversion.d.ts +101 -0
  360. package/dist/utils/documentColors.d.ts +108 -0
  361. package/dist/utils/featureApplied.d.ts +14 -0
  362. package/dist/utils/google-fonts-loader.d.ts +67 -0
  363. package/dist/utils/logger.d.ts +66 -0
  364. package/dist/utils/selectionPreservation.d.ts +42 -0
  365. package/dist/utils/textCursorUtils.d.ts +39 -0
  366. package/dist/utils/textUtils.d.ts +11 -0
  367. package/dist/workers/export-protocol.d.ts +119 -0
  368. package/dist/workers/export-worker.bundle.string.d.ts +2 -0
  369. package/dist/workers/export-worker.d.ts +5 -0
  370. package/package.json +201 -0
@@ -0,0 +1,373 @@
1
+ import { z } from 'zod';
2
+ import { ArtboardManager } from '../core/ArtboardManager.js';
3
+ import { ArtboardElement } from '../core/ArtboardElement.js';
4
+ import { BaseElement } from '../core/BaseElement.js';
5
+ declare const StrokeConfigSchema: z.ZodObject<{
6
+ enabled: z.ZodBoolean;
7
+ color: z.ZodString;
8
+ width: z.ZodNumber;
9
+ dashArray: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
10
+ lineCap: z.ZodOptional<z.ZodEnum<{
11
+ butt: "butt";
12
+ round: "round";
13
+ square: "square";
14
+ }>>;
15
+ lineJoin: z.ZodOptional<z.ZodEnum<{
16
+ round: "round";
17
+ miter: "miter";
18
+ bevel: "bevel";
19
+ }>>;
20
+ miterLimit: z.ZodOptional<z.ZodNumber>;
21
+ opacity: z.ZodOptional<z.ZodNumber>;
22
+ feather: z.ZodOptional<z.ZodNumber>;
23
+ }, z.core.$strip>;
24
+ declare const KnockoutConfigSchema: z.ZodObject<{
25
+ fill: z.ZodOptional<z.ZodBoolean>;
26
+ stroke: z.ZodOptional<z.ZodBoolean>;
27
+ scope: z.ZodOptional<z.ZodEnum<{
28
+ group: "group";
29
+ artboard: "artboard";
30
+ }>>;
31
+ }, z.core.$strip>;
32
+ declare const DistressEffectSchema: z.ZodObject<{
33
+ enabled: z.ZodBoolean;
34
+ style: z.ZodEnum<{
35
+ custom: "custom";
36
+ worn: "worn";
37
+ cracked: "cracked";
38
+ grunge: "grunge";
39
+ retro: "retro";
40
+ }>;
41
+ intensity: z.ZodNumber;
42
+ fadeAmount: z.ZodOptional<z.ZodNumber>;
43
+ grainAmount: z.ZodOptional<z.ZodNumber>;
44
+ scratchAmount: z.ZodOptional<z.ZodNumber>;
45
+ edgeWear: z.ZodOptional<z.ZodNumber>;
46
+ textureUrl: z.ZodOptional<z.ZodString>;
47
+ textureOpacity: z.ZodOptional<z.ZodNumber>;
48
+ textureBlendMode: z.ZodOptional<z.ZodEnum<{
49
+ multiply: "multiply";
50
+ screen: "screen";
51
+ overlay: "overlay";
52
+ }>>;
53
+ seed: z.ZodOptional<z.ZodNumber>;
54
+ }, z.core.$strip>;
55
+ declare const MaskDefinitionSchema: z.ZodObject<{
56
+ id: z.ZodString;
57
+ type: z.ZodEnum<{
58
+ clip: "clip";
59
+ alpha: "alpha";
60
+ luma: "luma";
61
+ distress: "distress";
62
+ }>;
63
+ maskElement: z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
64
+ inverted: z.ZodOptional<z.ZodBoolean>;
65
+ feather: z.ZodOptional<z.ZodNumber>;
66
+ opacity: z.ZodOptional<z.ZodNumber>;
67
+ blendMode: z.ZodOptional<z.ZodString>;
68
+ }, z.core.$strip>;
69
+ declare const CharacterStyleSchema: z.ZodObject<{
70
+ color: z.ZodOptional<z.ZodString>;
71
+ fontFamily: z.ZodOptional<z.ZodString>;
72
+ fontSize: z.ZodOptional<z.ZodNumber>;
73
+ bold: z.ZodOptional<z.ZodBoolean>;
74
+ italic: z.ZodOptional<z.ZodBoolean>;
75
+ underline: z.ZodOptional<z.ZodBoolean>;
76
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
77
+ }, z.core.$strip>;
78
+ declare const TextSpanSchema: z.ZodObject<{
79
+ text: z.ZodString;
80
+ style: z.ZodObject<{
81
+ color: z.ZodOptional<z.ZodString>;
82
+ fontFamily: z.ZodOptional<z.ZodString>;
83
+ fontSize: z.ZodOptional<z.ZodNumber>;
84
+ bold: z.ZodOptional<z.ZodBoolean>;
85
+ italic: z.ZodOptional<z.ZodBoolean>;
86
+ underline: z.ZodOptional<z.ZodBoolean>;
87
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
88
+ }, z.core.$strip>;
89
+ }, z.core.$strip>;
90
+ declare const RichTextSchema: z.ZodObject<{
91
+ spans: z.ZodArray<z.ZodObject<{
92
+ text: z.ZodString;
93
+ style: z.ZodObject<{
94
+ color: z.ZodOptional<z.ZodString>;
95
+ fontFamily: z.ZodOptional<z.ZodString>;
96
+ fontSize: z.ZodOptional<z.ZodNumber>;
97
+ bold: z.ZodOptional<z.ZodBoolean>;
98
+ italic: z.ZodOptional<z.ZodBoolean>;
99
+ underline: z.ZodOptional<z.ZodBoolean>;
100
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
101
+ }, z.core.$strip>;
102
+ }, z.core.$strip>>;
103
+ }, z.core.$strip>;
104
+ declare const AnyTransformDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
105
+ type: z.ZodLiteral<"custom">;
106
+ controlPoints: z.ZodArray<z.ZodObject<{
107
+ x: z.ZodNumber;
108
+ y: z.ZodNumber;
109
+ }, z.core.$strip>>;
110
+ }, z.core.$loose>, z.ZodObject<{
111
+ type: z.ZodLiteral<"distort">;
112
+ }, z.core.$loose>, z.ZodObject<{
113
+ type: z.ZodLiteral<"circle">;
114
+ radius: z.ZodNumber;
115
+ scale: z.ZodNumber;
116
+ reverse: z.ZodBoolean;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ type: z.ZodLiteral<"lean">;
119
+ leanAmount: z.ZodNumber;
120
+ }, z.core.$loose>, z.ZodObject<{
121
+ type: z.ZodLiteral<"arch">;
122
+ archHeight: z.ZodNumber;
123
+ }, z.core.$loose>, z.ZodObject<{
124
+ type: z.ZodLiteral<"ascend">;
125
+ ascendAngle: z.ZodNumber;
126
+ }, z.core.$loose>, z.ZodObject<{
127
+ type: z.ZodLiteral<"wave">;
128
+ amplitude: z.ZodNumber;
129
+ frequency: z.ZodNumber;
130
+ }, z.core.$loose>, z.ZodObject<{
131
+ type: z.ZodLiteral<"flag">;
132
+ amplitude: z.ZodNumber;
133
+ frequency: z.ZodNumber;
134
+ }, z.core.$loose>, z.ZodObject<{
135
+ type: z.ZodLiteral<"image">;
136
+ width: z.ZodNumber;
137
+ height: z.ZodNumber;
138
+ cropX: z.ZodNumber;
139
+ cropY: z.ZodNumber;
140
+ cropWidth: z.ZodNumber;
141
+ cropHeight: z.ZodNumber;
142
+ flipHorizontal: z.ZodBoolean;
143
+ flipVertical: z.ZodBoolean;
144
+ borderRadius: z.ZodNumber;
145
+ }, z.core.$strip>, z.ZodObject<{
146
+ type: z.ZodLiteral<"group">;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ type: z.ZodLiteral<"shape">;
149
+ shapeType: z.ZodEnum<{
150
+ circle: "circle";
151
+ rectangle: "rectangle";
152
+ ellipse: "ellipse";
153
+ triangle: "triangle";
154
+ polygon: "polygon";
155
+ star: "star";
156
+ line: "line";
157
+ }>;
158
+ width: z.ZodNumber;
159
+ height: z.ZodNumber;
160
+ borderRadius: z.ZodOptional<z.ZodNumber>;
161
+ radiusX: z.ZodOptional<z.ZodNumber>;
162
+ radiusY: z.ZodOptional<z.ZodNumber>;
163
+ sides: z.ZodOptional<z.ZodNumber>;
164
+ points: z.ZodOptional<z.ZodNumber>;
165
+ innerRadius: z.ZodOptional<z.ZodNumber>;
166
+ fillColor: z.ZodOptional<z.ZodString>;
167
+ fillOpacity: z.ZodOptional<z.ZodNumber>;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ type: z.ZodLiteral<"path">;
170
+ points: z.ZodArray<z.ZodObject<{
171
+ id: z.ZodString;
172
+ x: z.ZodNumber;
173
+ y: z.ZodNumber;
174
+ type: z.ZodEnum<{
175
+ corner: "corner";
176
+ smooth: "smooth";
177
+ bezier: "bezier";
178
+ }>;
179
+ handleIn: z.ZodOptional<z.ZodObject<{
180
+ x: z.ZodNumber;
181
+ y: z.ZodNumber;
182
+ }, z.core.$strip>>;
183
+ handleOut: z.ZodOptional<z.ZodObject<{
184
+ x: z.ZodNumber;
185
+ y: z.ZodNumber;
186
+ }, z.core.$strip>>;
187
+ }, z.core.$strip>>;
188
+ closed: z.ZodBoolean;
189
+ width: z.ZodNumber;
190
+ height: z.ZodNumber;
191
+ fillEnabled: z.ZodOptional<z.ZodBoolean>;
192
+ fillColor: z.ZodOptional<z.ZodString>;
193
+ fillOpacity: z.ZodOptional<z.ZodNumber>;
194
+ strokeEnabled: z.ZodOptional<z.ZodBoolean>;
195
+ strokeColor: z.ZodOptional<z.ZodString>;
196
+ strokeWidth: z.ZodOptional<z.ZodNumber>;
197
+ }, z.core.$strip>], "type">;
198
+ /**
199
+ * Discriminated union of all element config schemas.
200
+ * Discriminant field: `transformType`.
201
+ */
202
+ declare const AnyElementConfigSchema: z.ZodType;
203
+ declare const ClipShapeSchema: z.ZodUnion<readonly [z.ZodLiteral<"rectangle">, z.ZodLiteral<"circle">, z.ZodObject<{
204
+ type: z.ZodLiteral<"rounded">;
205
+ radius: z.ZodNumber;
206
+ }, z.core.$strip>, z.ZodObject<{
207
+ type: z.ZodLiteral<"path">;
208
+ d: z.ZodString;
209
+ }, z.core.$strip>, z.ZodObject<{
210
+ type: z.ZodLiteral<"composite-path">;
211
+ pieces: z.ZodArray<z.ZodObject<{
212
+ d: z.ZodString;
213
+ x: z.ZodNumber;
214
+ y: z.ZodNumber;
215
+ rotation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
216
+ baseWidth: z.ZodOptional<z.ZodNumber>;
217
+ baseHeight: z.ZodOptional<z.ZodNumber>;
218
+ }, z.core.$strip>>;
219
+ }, z.core.$strip>]>;
220
+ declare const SerializedArtboardSchema: z.ZodObject<{
221
+ id: z.ZodString;
222
+ name: z.ZodString;
223
+ x: z.ZodNumber;
224
+ y: z.ZodNumber;
225
+ width: z.ZodNumber;
226
+ height: z.ZodNumber;
227
+ backgroundColor: z.ZodString;
228
+ backgroundType: z.ZodOptional<z.ZodEnum<{
229
+ color: "color";
230
+ transparent: "transparent";
231
+ texture: "texture";
232
+ }>>;
233
+ backgroundTexture: z.ZodOptional<z.ZodString>;
234
+ exportBackground: z.ZodOptional<z.ZodBoolean>;
235
+ clipShape: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"rectangle">, z.ZodLiteral<"circle">, z.ZodObject<{
236
+ type: z.ZodLiteral<"rounded">;
237
+ radius: z.ZodNumber;
238
+ }, z.core.$strip>, z.ZodObject<{
239
+ type: z.ZodLiteral<"path">;
240
+ d: z.ZodString;
241
+ }, z.core.$strip>, z.ZodObject<{
242
+ type: z.ZodLiteral<"composite-path">;
243
+ pieces: z.ZodArray<z.ZodObject<{
244
+ d: z.ZodString;
245
+ x: z.ZodNumber;
246
+ y: z.ZodNumber;
247
+ rotation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
248
+ baseWidth: z.ZodOptional<z.ZodNumber>;
249
+ baseHeight: z.ZodOptional<z.ZodNumber>;
250
+ }, z.core.$strip>>;
251
+ }, z.core.$strip>]>>;
252
+ previewBackgroundColor: z.ZodOptional<z.ZodString>;
253
+ distressTexture: z.ZodOptional<z.ZodObject<{
254
+ enabled: z.ZodBoolean;
255
+ textureUrl: z.ZodString;
256
+ intensity: z.ZodNumber;
257
+ }, z.core.$strip>>;
258
+ elementIds: z.ZodArray<z.ZodString>;
259
+ }, z.core.$strip>;
260
+ /**
261
+ * Top-level CanvasStateV1 schema.
262
+ *
263
+ * - `version` is always `1` (literal).
264
+ * - `artboards` contains serialized artboard configs with `elementIds`.
265
+ * - `elements` is a flat array of all elements across all artboards.
266
+ * - `activeArtboardId` identifies which artboard is currently active.
267
+ */
268
+ declare const CanvasStateV1Schema: z.ZodObject<{
269
+ version: z.ZodLiteral<1>;
270
+ artboards: z.ZodArray<z.ZodObject<{
271
+ id: z.ZodString;
272
+ name: z.ZodString;
273
+ x: z.ZodNumber;
274
+ y: z.ZodNumber;
275
+ width: z.ZodNumber;
276
+ height: z.ZodNumber;
277
+ backgroundColor: z.ZodString;
278
+ backgroundType: z.ZodOptional<z.ZodEnum<{
279
+ color: "color";
280
+ transparent: "transparent";
281
+ texture: "texture";
282
+ }>>;
283
+ backgroundTexture: z.ZodOptional<z.ZodString>;
284
+ exportBackground: z.ZodOptional<z.ZodBoolean>;
285
+ clipShape: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"rectangle">, z.ZodLiteral<"circle">, z.ZodObject<{
286
+ type: z.ZodLiteral<"rounded">;
287
+ radius: z.ZodNumber;
288
+ }, z.core.$strip>, z.ZodObject<{
289
+ type: z.ZodLiteral<"path">;
290
+ d: z.ZodString;
291
+ }, z.core.$strip>, z.ZodObject<{
292
+ type: z.ZodLiteral<"composite-path">;
293
+ pieces: z.ZodArray<z.ZodObject<{
294
+ d: z.ZodString;
295
+ x: z.ZodNumber;
296
+ y: z.ZodNumber;
297
+ rotation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<90>, z.ZodLiteral<180>, z.ZodLiteral<270>]>>;
298
+ baseWidth: z.ZodOptional<z.ZodNumber>;
299
+ baseHeight: z.ZodOptional<z.ZodNumber>;
300
+ }, z.core.$strip>>;
301
+ }, z.core.$strip>]>>;
302
+ previewBackgroundColor: z.ZodOptional<z.ZodString>;
303
+ distressTexture: z.ZodOptional<z.ZodObject<{
304
+ enabled: z.ZodBoolean;
305
+ textureUrl: z.ZodString;
306
+ intensity: z.ZodNumber;
307
+ }, z.core.$strip>>;
308
+ elementIds: z.ZodArray<z.ZodString>;
309
+ }, z.core.$strip>>;
310
+ elements: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
311
+ activeArtboardId: z.ZodString;
312
+ }, z.core.$strip>;
313
+ /** A serialized artboard (artboard config + elementIds, no nested elements). */
314
+ type SerializedArtboard = z.infer<typeof SerializedArtboardSchema>;
315
+ /** A serialized element (discriminated union on `transformType`). */
316
+ type SerializedElement = z.infer<typeof AnyElementConfigSchema>;
317
+ /** The full versioned state document. */
318
+ type CanvasStateV1 = z.infer<typeof CanvasStateV1Schema>;
319
+ /**
320
+ * Serialize the current editor state into a `CanvasStateV1` document.
321
+ *
322
+ * @param artboardManager - The ArtboardManager instance (provides artboard list + active ID).
323
+ * @param elements - All elements currently in the editor (across all artboards).
324
+ * @returns A validated CanvasStateV1 object ready for JSON.stringify().
325
+ */
326
+ declare function serializeState(artboardManager: ArtboardManager, elements: BaseElement[]): CanvasStateV1;
327
+ /** Result of deserializing a CanvasStateV1 document. */
328
+ interface DeserializeResult {
329
+ artboards: ArtboardElement[];
330
+ elements: BaseElement[];
331
+ activeArtboardId: string;
332
+ }
333
+ /**
334
+ * Deserialize a validated `CanvasStateV1` document back into runtime objects.
335
+ *
336
+ * Uses `ArtboardElement.fromJSON()` for artboards and `ElementFactory.createFromJSON()`
337
+ * for elements (preserving the existing factory pattern).
338
+ *
339
+ * @param state - A CanvasStateV1 object (should have been validated already).
340
+ * @returns Deserialized artboards, elements, and active artboard ID.
341
+ */
342
+ declare function deserializeState(state: CanvasStateV1): DeserializeResult;
343
+ /** Validation result with typed error details. */
344
+ type ValidationResult = {
345
+ success: true;
346
+ data: CanvasStateV1;
347
+ } | {
348
+ success: false;
349
+ errors: Array<{
350
+ path: string;
351
+ message: string;
352
+ }>;
353
+ };
354
+ /**
355
+ * Validate an unknown value against the CanvasStateV1 schema.
356
+ *
357
+ * @param data - Unknown data to validate (e.g. parsed JSON).
358
+ * @returns A discriminated result: `{ success: true, data }` or `{ success: false, errors }`.
359
+ */
360
+ declare function validateState(data: unknown): ValidationResult;
361
+ /**
362
+ * Migrate an unknown state payload to the latest version.
363
+ *
364
+ * Currently only version 1 exists. Future versions will add migration logic
365
+ * (e.g. v1 -> v2) here so that older documents can be loaded transparently.
366
+ *
367
+ * @param data - Unknown data (parsed JSON).
368
+ * @returns A validated CanvasStateV1 (or the latest version in the future).
369
+ * @throws Error if the data cannot be migrated.
370
+ */
371
+ declare function migrateState(data: unknown): CanvasStateV1;
372
+ export { CanvasStateV1Schema, SerializedArtboardSchema, AnyElementConfigSchema, AnyTransformDataSchema, StrokeConfigSchema, KnockoutConfigSchema, DistressEffectSchema, MaskDefinitionSchema, CharacterStyleSchema, TextSpanSchema, RichTextSchema, ClipShapeSchema, serializeState, deserializeState, validateState, migrateState, };
373
+ export type { CanvasStateV1, SerializedArtboard, SerializedElement, DeserializeResult, ValidationResult, };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * State serialization module.
3
+ *
4
+ * Provides versioned, Zod-validated serialization/deserialization
5
+ * for the canvas editor state.
6
+ *
7
+ * @module
8
+ */
9
+ export { CanvasStateV1Schema, SerializedArtboardSchema, AnyElementConfigSchema, AnyTransformDataSchema, StrokeConfigSchema, KnockoutConfigSchema, DistressEffectSchema, MaskDefinitionSchema, CharacterStyleSchema, TextSpanSchema, RichTextSchema, ClipShapeSchema, serializeState, deserializeState, validateState, migrateState, } from './CanvasStateV1.js';
10
+ export type { CanvasStateV1, SerializedArtboard, SerializedElement, DeserializeResult, ValidationResult, } from './CanvasStateV1.js';