@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,173 @@
1
+ import { BaseElement } from './BaseElement.js';
2
+ import { Command as CommandInterface } from '../types/index.js';
3
+ import { ArtboardElement } from './ArtboardElement.js';
4
+ import { ArtboardManager } from './ArtboardManager.js';
5
+ /**
6
+ * Base Command class
7
+ * All commands must implement execute() and undo()
8
+ */
9
+ export declare class Command implements CommandInterface {
10
+ /**
11
+ * Execute the command
12
+ */
13
+ execute(): void;
14
+ /**
15
+ * Undo the command
16
+ */
17
+ undo(): void;
18
+ }
19
+ /**
20
+ * UpdateElementCommand - Command to update an element's properties
21
+ */
22
+ export declare class UpdateElementCommand extends Command {
23
+ elementId: string;
24
+ oldElement: BaseElement | null;
25
+ newElement: BaseElement | null;
26
+ onUpdate: (element: BaseElement) => void;
27
+ constructor(elementId: string, oldElement: BaseElement | null, newElement: BaseElement | null, onUpdate: (element: BaseElement) => void);
28
+ execute(): void;
29
+ undo(): void;
30
+ }
31
+ /**
32
+ * AddElementCommand - Command to add a new element
33
+ */
34
+ export declare class AddElementCommand extends Command {
35
+ element: BaseElement;
36
+ onAdd: (element: BaseElement) => void;
37
+ onRemove: (id: string) => void;
38
+ constructor(element: BaseElement, onAdd: (element: BaseElement) => void, onRemove: (id: string) => void);
39
+ execute(): void;
40
+ undo(): void;
41
+ }
42
+ /**
43
+ * RemoveElementCommand - Command to remove an element
44
+ */
45
+ export declare class RemoveElementCommand extends Command {
46
+ element: BaseElement;
47
+ onAdd: (element: BaseElement) => void;
48
+ onRemove: (id: string) => void;
49
+ constructor(element: BaseElement, onAdd: (element: BaseElement) => void, onRemove: (id: string) => void);
50
+ execute(): void;
51
+ undo(): void;
52
+ }
53
+ /**
54
+ * BatchCommand - Execute multiple commands as one atomic operation
55
+ */
56
+ export declare class BatchCommand extends Command {
57
+ commands: Command[];
58
+ constructor(commands?: Command[]);
59
+ execute(): void;
60
+ undo(): void;
61
+ }
62
+ /**
63
+ * CompoundCommand - Wraps an array of commands into a single undo entry.
64
+ * Used by executeBatch() to group multiple operations atomically.
65
+ *
66
+ * - execute(): runs all commands in order
67
+ * - undo(): reverts all commands in reverse order
68
+ */
69
+ export declare class CompoundCommand extends Command {
70
+ private commands;
71
+ constructor(commands: Command[]);
72
+ execute(): void;
73
+ undo(): void;
74
+ }
75
+ /**
76
+ * CommandHistory - Manages undo/redo history
77
+ */
78
+ export declare class CommandHistory {
79
+ history: Command[];
80
+ currentIndex: number;
81
+ maxSize: number;
82
+ constructor(maxSize?: number);
83
+ /**
84
+ * Execute a command and add it to history
85
+ */
86
+ execute(command: Command): void;
87
+ /**
88
+ * Execute multiple commands as a single atomic undo entry.
89
+ * All commands are wrapped in a CompoundCommand so that
90
+ * undo/redo treats the entire batch as one operation.
91
+ *
92
+ * No-op if commands array is empty.
93
+ */
94
+ executeBatch(commands: Command[]): void;
95
+ /**
96
+ * Undo the last command
97
+ */
98
+ undo(): boolean;
99
+ /**
100
+ * Redo the next command
101
+ */
102
+ redo(): boolean;
103
+ /**
104
+ * Check if undo is available
105
+ */
106
+ canUndo(): boolean;
107
+ /**
108
+ * Check if redo is available
109
+ */
110
+ canRedo(): boolean;
111
+ /**
112
+ * Clear all history
113
+ */
114
+ clear(): void;
115
+ /**
116
+ * Get current state info
117
+ */
118
+ getState(): {
119
+ canUndo: boolean;
120
+ canRedo: boolean;
121
+ historySize: number;
122
+ currentIndex: number;
123
+ };
124
+ }
125
+ /**
126
+ * CreateArtboardCommand - Command to create a new artboard
127
+ */
128
+ export declare class CreateArtboardCommand extends Command {
129
+ artboard: ArtboardElement;
130
+ artboardManager: ArtboardManager;
131
+ constructor(artboard: ArtboardElement, artboardManager: ArtboardManager);
132
+ execute(): void;
133
+ undo(): void;
134
+ }
135
+ /**
136
+ * DeleteArtboardCommand - Command to delete an artboard
137
+ */
138
+ export declare class DeleteArtboardCommand extends Command {
139
+ artboard: ArtboardElement;
140
+ artboardManager: ArtboardManager;
141
+ elementsOnArtboard: string[];
142
+ constructor(artboard: ArtboardElement, artboardManager: ArtboardManager);
143
+ execute(): void;
144
+ undo(): void;
145
+ }
146
+ /**
147
+ * UpdateArtboardCommand - Command to update artboard properties
148
+ */
149
+ export declare class UpdateArtboardCommand extends Command {
150
+ artboardId: string;
151
+ oldProperties: Partial<ArtboardElement>;
152
+ newProperties: Partial<ArtboardElement>;
153
+ artboardManager: ArtboardManager;
154
+ constructor(artboardId: string, oldProperties: Partial<ArtboardElement>, newProperties: Partial<ArtboardElement>, artboardManager: ArtboardManager);
155
+ execute(): void;
156
+ undo(): void;
157
+ }
158
+ /**
159
+ * ReorderElementCommand - Command to reorder elements in the list
160
+ */
161
+ export declare class ReorderElementCommand extends Command {
162
+ draggedId: string;
163
+ targetId: string;
164
+ position: 'before' | 'after';
165
+ oldOrder: string[];
166
+ newOrder: string[];
167
+ onReorder: (elementIds: string[]) => void;
168
+ constructor(draggedId: string, targetId: string, position: 'before' | 'after', currentOrder: string[], onReorder: (elementIds: string[]) => void);
169
+ private calculateNewOrder;
170
+ execute(): void;
171
+ undo(): void;
172
+ }
173
+ export default CommandHistory;
@@ -0,0 +1,69 @@
1
+ /** Minimal interface for objects that can be used with CoordinateTransform */
2
+ interface TransformableElement {
3
+ x: number;
4
+ y: number;
5
+ rotation?: number;
6
+ flipH?: boolean;
7
+ flipV?: boolean;
8
+ }
9
+ /**
10
+ * CoordinateTransform - Handles coordinate transformations between world and local space
11
+ *
12
+ * Manages transformations including:
13
+ * - Translation (x, y position)
14
+ * - Rotation
15
+ * - Horizontal and vertical flips
16
+ */
17
+ export declare class CoordinateTransform {
18
+ x: number;
19
+ y: number;
20
+ rotation: number;
21
+ flipH: boolean;
22
+ flipV: boolean;
23
+ /**
24
+ * @param x - Center X position in world space
25
+ * @param y - Center Y position in world space
26
+ * @param rotation - Rotation in degrees (positive = clockwise)
27
+ * @param flipH - Horizontal flip
28
+ * @param flipV - Vertical flip
29
+ */
30
+ constructor(x: number, y: number, rotation: number, flipH: boolean, flipV: boolean);
31
+ /**
32
+ * Convert world coordinates to local coordinates
33
+ * @param worldX - X coordinate in world space
34
+ * @param worldY - Y coordinate in world space
35
+ * @returns Local coordinates
36
+ */
37
+ worldToLocal(worldX: number, worldY: number): {
38
+ x: number;
39
+ y: number;
40
+ };
41
+ /**
42
+ * Convert local coordinates to world coordinates
43
+ * @param localX - X coordinate in local space
44
+ * @param localY - Y coordinate in local space
45
+ * @returns World coordinates
46
+ */
47
+ localToWorld(localX: number, localY: number): {
48
+ x: number;
49
+ y: number;
50
+ };
51
+ /**
52
+ * Transform a vector (direction/offset) without translation
53
+ * @param dx - X component of vector
54
+ * @param dy - Y component of vector
55
+ * @param inverse - If true, apply inverse transform
56
+ * @returns Transformed vector
57
+ */
58
+ transformVector(dx: number, dy: number, inverse?: boolean): {
59
+ dx: number;
60
+ dy: number;
61
+ };
62
+ /**
63
+ * Create a CoordinateTransform from an element object
64
+ * @param element - Element with x, y, rotation, flipH, flipV properties
65
+ * @returns CoordinateTransform
66
+ */
67
+ static fromElement(element: TransformableElement): CoordinateTransform;
68
+ }
69
+ export {};
@@ -0,0 +1,90 @@
1
+ import { BaseElement } from './BaseElement.js';
2
+ import { TransformStartData } from '../types/index.js';
3
+ /** Shape of the context object from the interaction state machine */
4
+ interface DragContext {
5
+ startX: number;
6
+ startY: number;
7
+ startData: TransformStartData;
8
+ }
9
+ /** Shape of the resize context from the interaction state machine */
10
+ interface ResizeContext {
11
+ startData: TransformStartData;
12
+ }
13
+ /** Result of a crop image drag operation */
14
+ interface CropDragResult {
15
+ cropX: number;
16
+ cropY: number;
17
+ cropWidth: number;
18
+ cropHeight: number;
19
+ x: number;
20
+ y: number;
21
+ }
22
+ /** Result of a crop box resize operation */
23
+ interface CropResizeResult {
24
+ cropX: number;
25
+ cropY: number;
26
+ cropWidth: number;
27
+ cropHeight: number;
28
+ x: number;
29
+ y: number;
30
+ rotation: number;
31
+ width: number;
32
+ height: number;
33
+ cursor: string;
34
+ }
35
+ /** Result of constrained crop values */
36
+ interface CropValues {
37
+ cropX: number;
38
+ cropY: number;
39
+ cropWidth: number;
40
+ cropHeight: number;
41
+ }
42
+ /**
43
+ * CropModeController - Handles all crop mode interactions
44
+ *
45
+ * Manages:
46
+ * - Dragging the image behind the crop window
47
+ * - Resizing the crop box
48
+ * - Coordinate transformations for crop operations
49
+ */
50
+ export declare class CropModeController {
51
+ /**
52
+ * Handle dragging the image in crop mode
53
+ */
54
+ handleCropImageDrag(_element: BaseElement, context: DragContext, currentX: number, currentY: number): CropDragResult;
55
+ /**
56
+ * Handle resizing the crop box
57
+ */
58
+ handleCropBoxResize(_element: BaseElement, anchor: string, resizeContext: ResizeContext, stateMachineContext: DragContext, currentX: number, currentY: number): CropResizeResult;
59
+ /**
60
+ * Get cursor for crop resize handle
61
+ * @private
62
+ */
63
+ _getCropResizeCursor(anchor: string, flipH: boolean, flipV: boolean): string;
64
+ /**
65
+ * Calculate new crop values based on anchor and delta
66
+ * @private
67
+ */
68
+ _calculateNewCropValues(anchor: string, startCropX: number, startCropY: number, startCropWidth: number, startCropHeight: number, normalizedDx: number, normalizedDy: number): CropValues;
69
+ /**
70
+ * Constrain crop values to valid bounds
71
+ * @private
72
+ */
73
+ _constrainCropValues(anchor: string, cropX: number, cropY: number, cropWidth: number, cropHeight: number, startCropX: number, startCropY: number, startCropWidth: number, startCropHeight: number, minSize: number): CropValues;
74
+ /**
75
+ * Calculate offset to keep crop center at same world position
76
+ * @private
77
+ */
78
+ _calculateCropCenterOffset(oldCropX: number, oldCropY: number, oldCropWidth: number, oldCropHeight: number, newCropX: number, newCropY: number, newCropWidth: number, newCropHeight: number, width: number, height: number, rotation: number, flipHMult: number, flipVMult: number): {
79
+ worldOffsetX: number;
80
+ worldOffsetY: number;
81
+ };
82
+ /**
83
+ * Get the world position of a crop box handle
84
+ */
85
+ getCropBoxHandlePosition(element: BaseElement, anchor: string): {
86
+ x: number;
87
+ y: number;
88
+ };
89
+ }
90
+ export {};
@@ -0,0 +1,51 @@
1
+ import { default as React } from 'react';
2
+ import { BaseElement } from './BaseElement.js';
3
+ import { TransformHandles } from './TransformHandles.js';
4
+ import { RichText } from '../types/index.js';
5
+ export declare class EditModeRenderer {
6
+ /**
7
+ * Render edit mode features: cursor and text selection highlight
8
+ * This renders on the main canvas at world coordinates (same as the element)
9
+ */
10
+ static renderEditModeLayer(ctx: CanvasRenderingContext2D, element: BaseElement | null, editModeData: {
11
+ cursorPosition: number;
12
+ selectionStart: number;
13
+ selectionEnd: number;
14
+ editText: string;
15
+ editRichText: RichText | null;
16
+ cursorOpacity: number;
17
+ isTouchDevice?: boolean;
18
+ selectionHandlePositionsRef?: React.MutableRefObject<{
19
+ start: {
20
+ center: {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ textEdge: {
25
+ x: number;
26
+ y: number;
27
+ };
28
+ } | null;
29
+ end: {
30
+ center: {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ textEdge: {
35
+ x: number;
36
+ y: number;
37
+ };
38
+ } | null;
39
+ }>;
40
+ }, zoom: number): void;
41
+ /**
42
+ * Render edit mode features for transformed text (circle, wave, arch, etc.)
43
+ * Renders cursor along the transform path
44
+ */
45
+ private static renderTransformEditModeLayer;
46
+ /**
47
+ * Render crop box layer (for images in crop mode)
48
+ * Shows both image resize handles and crop handles
49
+ */
50
+ static renderCropBoxLayer(ctx: CanvasRenderingContext2D, selectedElement: BaseElement, transformHandles: TransformHandles, zoom?: number): void;
51
+ }
@@ -0,0 +1,73 @@
1
+ import { AnyElementConfig, TransformType } from '../types';
2
+ import { BaseElement } from './BaseElement';
3
+ import { TextElement } from './TextElement';
4
+ /**
5
+ * ElementFactory provides type-safe element creation from JSON configurations
6
+ *
7
+ * Benefits:
8
+ * - Type-safe deserialization from database
9
+ * - Exhaustive compile-time checking (TypeScript ensures all cases are covered)
10
+ * - Single source of truth for element construction
11
+ * - Safe undo/redo operations
12
+ *
13
+ * Usage:
14
+ * ```typescript
15
+ * // From database
16
+ * const config = JSON.parse(dbRecord);
17
+ * const element = ElementFactory.createFromJSON(config);
18
+ *
19
+ * // For undo/redo
20
+ * const cloned = ElementFactory.createFromJSON(element.toJSON());
21
+ * ```
22
+ */
23
+ export declare class ElementFactory {
24
+ /**
25
+ * Create an element instance from a JSON configuration
26
+ * TypeScript ensures all transform types are handled
27
+ *
28
+ * @param config - Element configuration object
29
+ * @returns BaseElement instance (TextElement, ImageElement, GroupElement, ShapeElement, or PathElement)
30
+ * @throws Error if transform type is unknown
31
+ */
32
+ static createFromJSON(config: AnyElementConfig): BaseElement;
33
+ /**
34
+ * Create multiple elements from an array of JSON configurations
35
+ * Useful for bulk deserialization (e.g., loading a document from DB)
36
+ *
37
+ * @param configs - Array of element configurations
38
+ * @returns Array of BaseElement instances
39
+ */
40
+ static createManyFromJSON(configs: AnyElementConfig[]): BaseElement[];
41
+ /**
42
+ * Type guard to check if an object is a valid TextElement instance
43
+ * Useful for runtime validation
44
+ *
45
+ * @param obj - Object to check
46
+ * @returns true if obj is a TextElement
47
+ */
48
+ static isTextElement(obj: unknown): obj is TextElement;
49
+ /**
50
+ * Validate an element configuration object
51
+ * Returns true if the config has all required properties
52
+ *
53
+ * @param config - Configuration to validate
54
+ * @returns true if valid
55
+ */
56
+ static isValidConfig(config: unknown): config is AnyElementConfig;
57
+ /**
58
+ * Create a default element of a given type
59
+ * Useful for UI "Add Element" buttons
60
+ *
61
+ * @param transformType - Type of transform to create
62
+ * @returns Default element configuration
63
+ */
64
+ static createDefaultConfig(transformType: TransformType): AnyElementConfig;
65
+ /**
66
+ * Clone an element by serializing and deserializing
67
+ * Ensures a deep copy with proper class instance
68
+ *
69
+ * @param element - Element to clone
70
+ * @returns Cloned element instance
71
+ */
72
+ static clone(element: BaseElement): BaseElement;
73
+ }
@@ -0,0 +1,69 @@
1
+ import { TextElement } from './TextElement.js';
2
+ import { ImageElement } from './ImageElement.js';
3
+ import { GroupElement } from './GroupElement.js';
4
+ import { ShapeElement } from './ShapeElement.js';
5
+ import { PathElement } from './PathElement.js';
6
+ /** Union of all element types that can be stored. */
7
+ export type StoreElement = TextElement | ImageElement | GroupElement | ShapeElement | PathElement;
8
+ export declare class ElementStore {
9
+ private byId;
10
+ private order;
11
+ private _cachedArray;
12
+ constructor(elements?: StoreElement[]);
13
+ /** O(1) lookup by ID. */
14
+ get(id: string): StoreElement | undefined;
15
+ /** Check whether the store contains an element with the given ID. */
16
+ has(id: string): boolean;
17
+ /** Get all elements in render order. */
18
+ getAll(): StoreElement[];
19
+ /** Number of elements in the store. */
20
+ get size(): number;
21
+ /** Get the ordered ID list (read-only copy). */
22
+ getOrder(): readonly string[];
23
+ /** O(n) lookup by name. Returns the first element with the given name, or undefined. */
24
+ getByName(name: string): StoreElement | undefined;
25
+ /** O(n) lookup by name. Returns all elements with the given name in render order. */
26
+ getAllByName(name: string): StoreElement[];
27
+ /** Replace an element in-place (preserves order). */
28
+ update(element: StoreElement): ElementStore;
29
+ /**
30
+ * Replace an element found by a predicate with a new element.
31
+ * This mirrors `setElements(prev => prev.map(el => el.id === id ? newEl : el))`.
32
+ */
33
+ updateById(id: string, element: StoreElement): ElementStore;
34
+ /** Add an element at the end of the render order. */
35
+ add(element: StoreElement): ElementStore;
36
+ /** Insert an element after a specific element ID. */
37
+ insertAfter(element: StoreElement, afterId: string): ElementStore;
38
+ /** Remove an element by ID. */
39
+ remove(id: string): ElementStore;
40
+ /** Reorder element to a new index in the render order. */
41
+ reorder(id: string, newIndex: number): ElementStore;
42
+ /**
43
+ * Apply a batch update: replace elements whose IDs match.
44
+ * Returns a new store. Useful for applying multiple updates at once
45
+ * (e.g., reordering by an ID array from undo/redo).
46
+ */
47
+ replaceAll(elements: StoreElement[]): ElementStore;
48
+ /**
49
+ * Filter elements by predicate while preserving order.
50
+ * Returns a new store containing only elements that match.
51
+ */
52
+ filter(predicate: (el: StoreElement) => boolean): ElementStore;
53
+ /**
54
+ * Map over elements in render order, returning a new store.
55
+ * The mapping function receives each element and returns a (possibly modified) element.
56
+ */
57
+ map(fn: (el: StoreElement) => StoreElement): ElementStore;
58
+ /**
59
+ * Set a completely new ordering for all elements.
60
+ * IDs not in the new order are dropped; new IDs not in the store are ignored.
61
+ */
62
+ setOrder(newOrder: string[]): ElementStore;
63
+ /** Convert to a plain array (backwards-compatible with `EditorElement[]`). Cached since the store is immutable. */
64
+ toArray(): StoreElement[];
65
+ /** Create from a plain array. */
66
+ static fromArray(elements: StoreElement[]): ElementStore;
67
+ /** Create a shallow clone (new Map/Array, same element references). */
68
+ private clone;
69
+ }
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Canvas Event Bus
3
+ *
4
+ * A typed publish/subscribe event system for cross-component communication
5
+ * within the canvas editor. Components can emit and listen for events without
6
+ * direct coupling, enabling loose coordination between panels, tools, and
7
+ * the canvas itself.
8
+ *
9
+ * All event types are defined in {@link CanvasEventMap} for compile-time
10
+ * type safety -- subscribers receive correctly-typed payloads and emitters
11
+ * are checked against the event map at compile time.
12
+ *
13
+ * A singleton instance is available via {@link canvasEventBus} for use
14
+ * across the editor. The {@link useCanvasEvents} hook provides React
15
+ * integration.
16
+ *
17
+ * @example Subscribe to element creation
18
+ * ```ts
19
+ * import { canvasEventBus } from '@snowcone-app/canvas/advanced';
20
+ *
21
+ * const unsub = canvasEventBus.on('element:created', ({ elementId, type }) => {
22
+ * console.log(`Created ${type} element: ${elementId}`);
23
+ * });
24
+ *
25
+ * // Later: clean up
26
+ * unsub();
27
+ * ```
28
+ *
29
+ * @example One-shot listener
30
+ * ```ts
31
+ * canvasEventBus.once('export:completed', ({ durationMs }) => {
32
+ * console.log(`Export finished in ${durationMs}ms`);
33
+ * });
34
+ * ```
35
+ */
36
+ /**
37
+ * Map of all canvas event names to their payload types.
38
+ *
39
+ * Extend this interface (via module augmentation) to add custom events:
40
+ * ```ts
41
+ * declare module '@snowcone-app/canvas/advanced' {
42
+ * interface CanvasEventMap {
43
+ * 'my-plugin:action': { value: number };
44
+ * }
45
+ * }
46
+ * ```
47
+ */
48
+ export interface CanvasEventMap {
49
+ /** Fired after a new element is added to the canvas */
50
+ 'element:created': {
51
+ elementId: string;
52
+ type: string;
53
+ };
54
+ /** Fired after one or more properties of an element change */
55
+ 'element:updated': {
56
+ elementId: string;
57
+ changes: string[];
58
+ };
59
+ /** Fired after an element is removed from the canvas */
60
+ 'element:deleted': {
61
+ elementId: string;
62
+ };
63
+ /** Fired when the selected element changes (null = deselected) */
64
+ 'element:selected': {
65
+ elementId: string | null;
66
+ };
67
+ /** Fired when the active artboard changes */
68
+ 'artboard:changed': {
69
+ artboardId: string;
70
+ artboardName: string;
71
+ };
72
+ /** Fired when an export operation begins */
73
+ 'export:started': {
74
+ artboardId: string;
75
+ };
76
+ /** Fired when an export operation completes successfully */
77
+ 'export:completed': {
78
+ artboardId: string;
79
+ durationMs: number;
80
+ };
81
+ /** Fired when an export operation fails */
82
+ 'export:error': {
83
+ artboardId: string;
84
+ error: Error;
85
+ };
86
+ /** Fired after an undo operation */
87
+ 'undo': {
88
+ commandDescription?: string;
89
+ };
90
+ /** Fired after a redo operation */
91
+ 'redo': {
92
+ commandDescription?: string;
93
+ };
94
+ }
95
+ /** Strongly-typed event handler for a specific event name */
96
+ export type CanvasEventHandler<K extends keyof CanvasEventMap> = (event: CanvasEventMap[K]) => void;
97
+ /**
98
+ * A typed event bus for the canvas editor.
99
+ *
100
+ * Provides subscribe ({@link on}, {@link once}), publish ({@link emit}),
101
+ * and unsubscribe ({@link off}) operations with full type safety.
102
+ *
103
+ * Listeners for a given event are called in the order they were registered.
104
+ * Errors thrown inside a handler are caught and logged to `console.error`
105
+ * so that one failing handler does not prevent others from executing.
106
+ */
107
+ export declare class CanvasEventBus {
108
+ /** Map of event name to the set of registered handler functions */
109
+ private listeners;
110
+ /**
111
+ * Subscribe to an event.
112
+ *
113
+ * @param event - The event name to listen for
114
+ * @param handler - Callback invoked with the event payload
115
+ * @returns An unsubscribe function -- call it to remove this handler
116
+ */
117
+ on<K extends keyof CanvasEventMap>(event: K, handler: CanvasEventHandler<K>): () => void;
118
+ /**
119
+ * Subscribe to an event for a single invocation.
120
+ *
121
+ * The handler is automatically removed after the first time the event
122
+ * fires. The returned unsubscribe function can also be used to cancel
123
+ * before the event fires.
124
+ *
125
+ * @param event - The event name to listen for
126
+ * @param handler - Callback invoked once with the event payload
127
+ * @returns An unsubscribe function
128
+ */
129
+ once<K extends keyof CanvasEventMap>(event: K, handler: CanvasEventHandler<K>): () => void;
130
+ /**
131
+ * Emit an event, invoking all registered handlers for that event name.
132
+ *
133
+ * Handlers are called synchronously in registration order. If a handler
134
+ * throws, the error is logged and remaining handlers still execute.
135
+ *
136
+ * @param event - The event name to emit
137
+ * @param data - The payload to pass to each handler
138
+ */
139
+ emit<K extends keyof CanvasEventMap>(event: K, data: CanvasEventMap[K]): void;
140
+ /**
141
+ * Remove listeners.
142
+ *
143
+ * - If called with an event name, removes all handlers for that event.
144
+ * - If called with no arguments, removes all handlers for all events.
145
+ *
146
+ * @param event - Optional event name to clear. Omit to clear everything.
147
+ */
148
+ off<K extends keyof CanvasEventMap>(event?: K): void;
149
+ /**
150
+ * Get the number of registered listeners for a specific event.
151
+ *
152
+ * @param event - The event name to query
153
+ * @returns The number of handlers currently registered
154
+ */
155
+ listenerCount(event: keyof CanvasEventMap): number;
156
+ }
157
+ /**
158
+ * The singleton CanvasEventBus instance shared across the editor.
159
+ *
160
+ * Use this directly or via the {@link useCanvasEvents} hook in React
161
+ * components.
162
+ */
163
+ export declare const canvasEventBus: CanvasEventBus;