@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,247 @@
1
+ import { BoundingBox, Point, ResizeAnchor } from '../types/index.js';
2
+ /**
3
+ * Calculate position to keep opposite corner fixed during resize
4
+ * This is the core algorithm that makes corner dragging feel natural
5
+ *
6
+ * @param {Object} startData - Transform start state {x, y, width, height}
7
+ * @param {Object} newDimensions - New dimensions {width, height}
8
+ * @param {string} activeAnchor - Which corner is being dragged
9
+ * @param {number} rotation - Rotation in degrees
10
+ * @returns {Object} New position {x, y}
11
+ */
12
+ export declare function calculateFixedCornerPosition(startData: {
13
+ x: number;
14
+ y: number;
15
+ width: number;
16
+ height: number;
17
+ }, newDimensions: {
18
+ width: number;
19
+ height: number;
20
+ }, activeAnchor: string, rotation: number): {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ /**
25
+ * Calculate rotation handle position
26
+ * Positioned below the bottom edge, centered horizontally
27
+ * Distance scales inversely with zoom to maintain consistent screen space distance
28
+ *
29
+ * @param {Object} bbox - Bounding box {x, y, width, height}
30
+ * @param {number} rotation - Rotation in DEGREES (not radians - function converts internally)
31
+ * @param {Object} rotationAnchor - Point to rotate around {x, y}
32
+ * @param {number} zoom - Current zoom level (default 1.0)
33
+ * @returns {Object} Handle position {x, y}
34
+ *
35
+ * IMPORTANT: This function expects rotation in DEGREES and converts to radians internally.
36
+ * Do NOT pass radians to this function or you'll get incorrect positioning.
37
+ * Example: Pass 30 for 30°, NOT 0.524 radians
38
+ */
39
+ export declare function calculateRotationHandlePosition(bbox: BoundingBox, rotation: number, rotationAnchor: Point, zoom?: number): {
40
+ x: number;
41
+ y: number;
42
+ };
43
+ /**
44
+ * Calculate all 8 resize handle positions
45
+ *
46
+ * @param {Object} bbox - Bounding box {x, y, width, height}
47
+ * @param {number} rotation - Rotation in degrees
48
+ * @param {Object} rotationAnchor - Point to rotate around {x, y}
49
+ * @returns {Object[]} Array of handles with {type, anchor, x, y, cursor}
50
+ */
51
+ export declare function calculateResizeHandles(bbox: BoundingBox, rotation: number, rotationAnchor: Point): {
52
+ cursor: string;
53
+ x: number;
54
+ y: number;
55
+ type: string;
56
+ anchor: ResizeAnchor;
57
+ }[];
58
+ /**
59
+ * Test if a point is inside a circle
60
+ */
61
+ export declare function hitTestCircle(px: number, py: number, cx: number, cy: number, radius: number): boolean;
62
+ /**
63
+ * Test if a point is inside a rotated rectangle
64
+ */
65
+ export declare function hitTestRect(px: number, py: number, rect: BoundingBox, rotation: number): boolean;
66
+ /**
67
+ * Measure text width using canvas API
68
+ * @deprecated Use TextMetrics.measureTextWidth instead
69
+ */
70
+ export declare function measureTextWidth(text: string, fontSize: number, fontFamily?: string, bold?: boolean, italic?: boolean): number;
71
+ /**
72
+ * Calculate bounding box center
73
+ */
74
+ export declare function getBoundingBoxCenter(bbox: BoundingBox): {
75
+ x: number;
76
+ y: number;
77
+ };
78
+ /**
79
+ * Calculate angle between two points
80
+ */
81
+ export declare function calculateAngle(centerX: number, centerY: number, pointX: number, pointY: number): number;
82
+ /**
83
+ * Rotate a point around a center
84
+ */
85
+ export declare function rotatePoint(px: number, py: number, cx: number, cy: number, angle: number): {
86
+ x: number;
87
+ y: number;
88
+ };
89
+ /**
90
+ * Calculate distance between two points
91
+ */
92
+ export declare function distance(x1: number, y1: number, x2: number, y2: number): number;
93
+ /**
94
+ * Calculate distance from a point to a horizontal line
95
+ */
96
+ export declare function distanceToHorizontalLine(_px: number, py: number, lineY: number): number;
97
+ /**
98
+ * Calculate distance from a point to a vertical line
99
+ */
100
+ export declare function distanceToVerticalLine(px: number, _py: number, lineX: number): number;
101
+ /**
102
+ * Calculate distance from a point to a line segment
103
+ * @param {number} px - Point X
104
+ * @param {number} py - Point Y
105
+ * @param {number} x1 - Line start X
106
+ * @param {number} y1 - Line start Y
107
+ * @param {number} x2 - Line end X
108
+ * @param {number} y2 - Line end Y
109
+ * @returns {number} Distance to line segment
110
+ */
111
+ export declare function distanceToLineSegment(px: number, py: number, x1: number, y1: number, x2: number, y2: number): number;
112
+ /**
113
+ * Check if two values are within a threshold
114
+ * Useful for snapping detection
115
+ */
116
+ export declare function isNear(value1: number, value2: number, threshold: number): boolean;
117
+ /**
118
+ * Get the correct resize cursor accounting for rotation
119
+ * @param {string} anchor - Handle anchor position (e.g., 'top-left', 'top', 'right')
120
+ * @param {number} rotation - Rotation in degrees
121
+ * @returns {string} CSS cursor value
122
+ */
123
+ export declare function getRotatedResizeCursor(anchor: string, rotation: number): string;
124
+ /**
125
+ * Get cursor for a handle based on its world position relative to a center point
126
+ * @param {number} handleWorldX - Handle X position in world coordinates
127
+ * @param {number} handleWorldY - Handle Y position in world coordinates
128
+ * @param {number} centerWorldX - Center X position in world coordinates
129
+ * @param {number} centerWorldY - Center Y position in world coordinates
130
+ * @param {string} handleType - 'corner' or 'edge'
131
+ * @param {number} rotation - Element rotation in degrees
132
+ * @param {string} anchor - Handle anchor position (e.g., 'top-left', 'bottom-right')
133
+ * @returns {string} CSS cursor value
134
+ */
135
+ export declare function getCursorForWorldPosition(handleWorldX: number, handleWorldY: number, centerWorldX: number, centerWorldY: number, handleType: string, rotation?: number, anchor?: string): string;
136
+ /**
137
+ * Canvas Zoom Utilities
138
+ *
139
+ * CRITICAL: Canvas transforms affect visual properties differently:
140
+ * - Line widths ARE affected by canvas transforms (scale with zoom)
141
+ * - Font sizes in ctx.font are NOT affected by canvas transforms
142
+ * - Dash patterns ARE affected by canvas transforms
143
+ *
144
+ * Use these utilities to maintain consistent visual appearance at all zoom levels.
145
+ */
146
+ /**
147
+ * Extract the current canvas scale factor from the transform matrix.
148
+ * This accounts for zoom, DPR (device pixel ratio), and any other scaling.
149
+ *
150
+ * @param ctx - Canvas rendering context
151
+ * @returns Current scale factor (e.g., 0.33 for 33% zoom, 1.0 for 100%)
152
+ *
153
+ * @example
154
+ * const scale = getCanvasScale(ctx); // 0.33 at 33% zoom
155
+ * ctx.lineWidth = 3 / scale; // Renders as 3px visually at any zoom
156
+ */
157
+ export declare function getCanvasScale(ctx: CanvasRenderingContext2D): number;
158
+ /**
159
+ * Set a line width that maintains consistent visual thickness at all zoom levels.
160
+ *
161
+ * Canvas transforms affect line widths, so a 3px line at 33% zoom appears as 1px.
162
+ * This function applies inverse scaling to counteract the zoom effect.
163
+ *
164
+ * @param ctx - Canvas rendering context
165
+ * @param desiredWidth - The visual width you want (in screen pixels)
166
+ *
167
+ * @example
168
+ * // Selection border that's always 3px thick on screen
169
+ * setZoomInvariantLineWidth(ctx, 3);
170
+ * ctx.stroke();
171
+ */
172
+ export declare function setZoomInvariantLineWidth(ctx: CanvasRenderingContext2D, desiredWidth: number): void;
173
+ /**
174
+ * Set a line dash pattern that maintains consistent visual appearance at all zoom levels.
175
+ *
176
+ * Canvas transforms affect dash patterns, so [8, 8] at 33% zoom appears as [2.64, 2.64].
177
+ * This function applies inverse scaling to counteract the zoom effect.
178
+ *
179
+ * @param ctx - Canvas rendering context
180
+ * @param pattern - The dash pattern you want (in screen pixels), e.g., [8, 8] for "8px dash, 8px gap"
181
+ *
182
+ * @example
183
+ * // Dotted guide line that's always [8, 8] pattern on screen
184
+ * setZoomInvariantLineWidth(ctx, 3);
185
+ * setZoomInvariantDash(ctx, [8, 8]);
186
+ * ctx.stroke();
187
+ */
188
+ export declare function setZoomInvariantDash(ctx: CanvasRenderingContext2D, pattern: number[]): void;
189
+ /**
190
+ * Helper to set both line width and dash pattern with zoom-invariant values.
191
+ * Commonly used for selection visualization and guide lines.
192
+ *
193
+ * @param ctx - Canvas rendering context
194
+ * @param width - Desired line width (in screen pixels)
195
+ * @param dashPattern - Desired dash pattern (in screen pixels)
196
+ *
197
+ * @example
198
+ * // Dotted guide line for selected arch text
199
+ * ctx.strokeStyle = getThemeAccentColor();
200
+ * setZoomInvariantStroke(ctx, 3, [8, 8]);
201
+ * ctx.beginPath();
202
+ * // ... draw path ...
203
+ * ctx.stroke();
204
+ * ctx.setLineDash([]); // Reset to solid
205
+ */
206
+ export declare function setZoomInvariantStroke(ctx: CanvasRenderingContext2D, width: number, dashPattern?: number[]): void;
207
+ /**
208
+ * Set a dash pattern that scales with viewport size (appears longer when zoomed out).
209
+ *
210
+ * This creates viewport-adaptive dashes that maintain better visibility when viewing
211
+ * a larger area of the canvas. The dashes are specified in world-space, so they scale
212
+ * naturally with the zoom level:
213
+ * - At 100% zoom: dashes appear at base size
214
+ * - At 33% zoom (larger viewport): dashes appear smaller on screen but proportional to viewport
215
+ * - At 300% zoom (zoomed in): dashes appear larger on screen but proportional to viewport
216
+ *
217
+ * @param ctx - Canvas rendering context
218
+ * @param basePattern - Dash pattern in world-space pixels
219
+ *
220
+ * @example
221
+ * // Guide line with world-space dashes (use larger values than screen-space)
222
+ * setZoomInvariantLineWidth(ctx, 3); // Keep line width consistent
223
+ * setViewportProportionalDash(ctx, [30, 15]); // Use larger values for visibility
224
+ * ctx.stroke();
225
+ */
226
+ export declare function setViewportProportionalDash(ctx: CanvasRenderingContext2D, basePattern: number[]): void;
227
+ /**
228
+ * Set both line width and dash pattern with hybrid scaling.
229
+ * Line width stays zoom-invariant (consistent screen thickness).
230
+ * Dash pattern uses world-space values (scales with viewport).
231
+ *
232
+ * This is the recommended approach for guide lines and selection visualization,
233
+ * providing consistent visual thickness while maintaining proportional dash spacing.
234
+ *
235
+ * @param ctx - Canvas rendering context
236
+ * @param width - Desired line width (in screen pixels, zoom-invariant)
237
+ * @param basePattern - Dash pattern in world-space pixels (use larger values than screen-space)
238
+ *
239
+ * @example
240
+ * // Circle transform guide: consistent thickness, viewport-proportional dashes
241
+ * ctx.strokeStyle = getThemeAccentColor();
242
+ * setViewportProportionalStroke(ctx, 3, [30, 15]); // 30px dashes in world-space
243
+ * ctx.arc(0, 0, radius, 0, Math.PI * 2);
244
+ * ctx.stroke();
245
+ * ctx.setLineDash([]); // Reset
246
+ */
247
+ export declare function setViewportProportionalStroke(ctx: CanvasRenderingContext2D, width: number, basePattern?: number[]): void;
@@ -0,0 +1,134 @@
1
+ import { BaseElement } from './BaseElement.js';
2
+ import { TextElement } from './TextElement.js';
3
+ import { ImageElement } from './ImageElement.js';
4
+ import { ShapeElement } from './ShapeElement.js';
5
+ import { PathElement } from './PathElement.js';
6
+ import { GroupElementConfig, GroupTransformData, BoundingBox, Point, ResizeAnchor, TransformStartData } from '../types/index.js';
7
+ /** Child element types that can be contained in a group */
8
+ type ChildElement = TextElement | ImageElement | GroupElement | ShapeElement | PathElement;
9
+ export declare class GroupElement extends BaseElement {
10
+ transformType: 'group';
11
+ transformData: GroupTransformData;
12
+ children: ChildElement[];
13
+ isGroup: boolean;
14
+ private _baseBBoxWidth;
15
+ private _baseBBoxHeight;
16
+ private _rotationCenterX;
17
+ private _rotationCenterY;
18
+ constructor(config?: Partial<GroupElementConfig>);
19
+ /**
20
+ * Reconstruct a child element from JSON using the transform registry.
21
+ * Looks up the Component class by transformType and constructs it.
22
+ * Adding new element types only requires updating the registry, not this file.
23
+ */
24
+ private _reconstructChildFromJSON;
25
+ /**
26
+ * Calculate group bounds from all children
27
+ * Returns axis-aligned bounding box containing all children
28
+ */
29
+ getBoundingBox(): BoundingBox;
30
+ /**
31
+ * Visual bounding box uses the oriented bounding box for groups
32
+ * This ensures handles and hover effects stay aligned with the dotted border during rotation
33
+ */
34
+ getVisualBoundingBox(): BoundingBox;
35
+ /**
36
+ * Get rotation anchor - returns the cached rotation center
37
+ * This ensures consistent rotation behavior even if this.x/this.y change
38
+ */
39
+ getRotationAnchor(): Point;
40
+ /**
41
+ * Get the four corners of an element's bounding box in world space
42
+ */
43
+ private _getRotatedCorners;
44
+ /**
45
+ * Update group center and size from children
46
+ * @param forceRecalcDimensions - Force recalculation of base dimensions (use when children are modified, not during rotation)
47
+ */
48
+ updateBoundsFromChildren(forceRecalcDimensions?: boolean): void;
49
+ /**
50
+ * Calculate the axis-aligned bounding box dimensions at current state
51
+ * This should only be called when the group is created or when children change (not during rotation)
52
+ *
53
+ * Like multi-selection, we simply cache the current axis-aligned bbox dimensions
54
+ * and use them for rendering the selection border.
55
+ */
56
+ private _calculateInitialDimensions;
57
+ /**
58
+ * Render the group with clipping support
59
+ * Elements with isClipping=true clip all elements below them in the group
60
+ */
61
+ render(ctx: CanvasRenderingContext2D, isSelected?: boolean, isHovered?: boolean): void;
62
+ /**
63
+ * Render group with clipping masks
64
+ * Elements with isClipping=true clip all elements below them
65
+ */
66
+ private _renderWithClipping;
67
+ /**
68
+ * Render dashed outline around group
69
+ * Uses an oriented bounding box that doesn't change size during rotation
70
+ */
71
+ private _renderGroupOutline;
72
+ /**
73
+ * Get oriented bounding box (uses cached base dimensions for stability during rotation)
74
+ *
75
+ * This follows the same approach as multi-selection:
76
+ * - Cache the initial axis-aligned bbox dimensions when group is created
77
+ * - Use those cached dimensions during rotation (never recalculate)
78
+ * - This keeps the selection border tight and stable during rotation
79
+ */
80
+ private getOrientedBoundingBox;
81
+ /**
82
+ * Move the group (moves all children)
83
+ */
84
+ move(dx: number, dy: number): void;
85
+ /**
86
+ * Rotate the group (rotates all children around group center)
87
+ */
88
+ setRotation(newRotation: number): void;
89
+ /**
90
+ * Resize the group (scales all children proportionally)
91
+ * Uses the same fixed-corner approach as multi-selection resize
92
+ */
93
+ resize(anchor: ResizeAnchor, newWidth: number, newHeight: number, startData: TransformStartData): void;
94
+ /**
95
+ * Get transform start data (includes children data)
96
+ * Use cached base dimensions instead of axis-aligned bbox for consistency with visual border
97
+ */
98
+ getTransformStartData(): TransformStartData;
99
+ /**
100
+ * Hit test - check if point is inside group's oriented bounding box
101
+ * This allows clicking anywhere within the selection border to drag the group
102
+ */
103
+ hitTest(x: number, y: number): boolean;
104
+ /**
105
+ * Only corner handles for groups (uniform scale)
106
+ */
107
+ getEnabledAnchors(): ResizeAnchor[];
108
+ /**
109
+ * Serialize to JSON
110
+ */
111
+ toJSON(): GroupElementConfig;
112
+ /**
113
+ * Clone the group (deep copy with children)
114
+ */
115
+ clone(): GroupElement;
116
+ /**
117
+ * Add a child to the group
118
+ */
119
+ addChild(child: ChildElement): void;
120
+ /**
121
+ * Remove a child from the group
122
+ */
123
+ removeChild(childId: string): boolean;
124
+ /**
125
+ * Get all children (for edit mode)
126
+ */
127
+ getChildren(): ChildElement[];
128
+ /**
129
+ * Find which child (if any) was clicked at the given point
130
+ * Returns the child element or null if no child was hit
131
+ */
132
+ hitTestChild(x: number, y: number): ChildElement | null;
133
+ }
134
+ export {};
@@ -0,0 +1,103 @@
1
+ import { BaseElement } from './BaseElement.js';
2
+ import { TextElement } from './TextElement.js';
3
+ interface HoverState {
4
+ type: 'element' | 'resize-handle' | 'rotation-handle' | null;
5
+ data?: BaseElement | null;
6
+ startTime?: number;
7
+ }
8
+ export declare class HoverRenderer {
9
+ /**
10
+ * Render hover highlights layer with fade-in animation
11
+ * Outlines the actual element shape instead of a rectangular border
12
+ */
13
+ static renderHoverLayer(ctx: CanvasRenderingContext2D, hoverState: HoverState, selectedId: string | null, _isAltKeyPressed?: boolean, zoom?: number, artboardBackgroundColor?: string): void;
14
+ /**
15
+ * Render outline for a specific element type
16
+ */
17
+ private static renderElementOutline;
18
+ /**
19
+ * Render outline for shape elements (star, rectangle, circle, etc.)
20
+ * Creates a ring effect with a gap between the element and the stroke
21
+ */
22
+ private static renderShapeOutline;
23
+ /**
24
+ * Render outline for image elements
25
+ * Creates a ring effect with a gap between the element and the stroke
26
+ */
27
+ private static renderImageOutline;
28
+ /**
29
+ * Render outline for group elements
30
+ * Creates a ring effect with a gap between the element and the stroke
31
+ */
32
+ private static renderGroupOutline;
33
+ /**
34
+ * Render outline for text elements
35
+ * Creates a ring effect with a gap between text and stroke (ring behind text fill)
36
+ * Supports all transform types: custom, circle, wave, arch, etc.
37
+ */
38
+ private static renderTextOutline;
39
+ /**
40
+ * HOVER RING EFFECT for straight/custom text
41
+ *
42
+ * This is the colored ring that appears when hovering over text elements.
43
+ * Uses offscreen canvas compositing to create a ring with a transparent gap.
44
+ * Supports per-character fonts via rich text spans.
45
+ *
46
+ * NOTE: This is NOT the same as:
47
+ * - Element stroke (StrokeRenderer.ts - only when stroke.enabled = true)
48
+ * - Selection box (dashed rectangle in element.render())
49
+ */
50
+ private static renderHoverRingEffect;
51
+ /**
52
+ * HOVER RING EFFECT for transformed text (circle, wave, arch, lean, ascend, flag)
53
+ *
54
+ * This is the colored ring that appears when hovering over curved/transformed text.
55
+ * Renders text character-by-character along the transform path with ring effect.
56
+ * Uses offscreen canvas compositing to create a ring with a transparent gap.
57
+ *
58
+ * NOTE: This is NOT the same as:
59
+ * - Element stroke (StrokeRenderer.ts - only when stroke.enabled = true)
60
+ * - Selection box (dashed outline shown by each transform's render() method)
61
+ */
62
+ private static renderTransformHoverRingEffect;
63
+ /**
64
+ * Helper to render text along a transform path with hover effect
65
+ */
66
+ private static renderTransformWithHoverEffect;
67
+ /**
68
+ * Calculate character positions for different transform types
69
+ *
70
+ * Also used by EditModeRenderer for cursor positioning on transformed text.
71
+ */
72
+ static calculateCharPositions(element: TextElement, chars: string[], charWidths: number[]): Array<{
73
+ x: number;
74
+ y: number;
75
+ angle: number;
76
+ skewY?: number;
77
+ }>;
78
+ /**
79
+ * Calculate positions for circle transform
80
+ */
81
+ private static calculateCirclePositions;
82
+ /**
83
+ * Calculate positions for wave transform
84
+ */
85
+ private static calculateWavePositions;
86
+ /**
87
+ * Calculate positions for arch transform
88
+ */
89
+ private static calculateArchPositions;
90
+ /**
91
+ * Calculate positions for lean transform
92
+ */
93
+ private static calculateLeanPositions;
94
+ /**
95
+ * Calculate positions for ascend transform
96
+ */
97
+ private static calculateAscendPositions;
98
+ /**
99
+ * Calculate positions for flag transform
100
+ */
101
+ private static calculateFlagPositions;
102
+ }
103
+ export {};
@@ -0,0 +1,137 @@
1
+ import { CommandHistory, Command } from './CommandHistory.js';
2
+ import { ArtboardManager } from './ArtboardManager.js';
3
+ type HistoryType = 'global' | 'artboard';
4
+ interface HistoryEntry {
5
+ type: HistoryType;
6
+ artboardId?: string;
7
+ timestamp: number;
8
+ }
9
+ export declare class HybridHistoryManager {
10
+ private globalHistory;
11
+ private artboardHistories;
12
+ private lastOperation;
13
+ private artboardManager;
14
+ private maxHistorySize;
15
+ private commandExecutedCallbacks;
16
+ constructor(artboardManager: ArtboardManager, maxHistorySize?: number);
17
+ /**
18
+ * Register a callback to be called whenever a command is executed
19
+ * Returns an unsubscribe function
20
+ */
21
+ onCommandExecuted(callback: (command: Command, type: HistoryType, artboardId?: string) => void): () => void;
22
+ /**
23
+ * Notify all callbacks that a command was executed
24
+ */
25
+ private notifyCommandExecuted;
26
+ /**
27
+ * Execute a global command (artboard-level operation)
28
+ */
29
+ executeGlobal(command: Command): void;
30
+ /**
31
+ * Execute a batch of commands as a single global undo entry.
32
+ * No-op if commands array is empty.
33
+ */
34
+ executeBatchGlobal(commands: Command[]): void;
35
+ /**
36
+ * Execute a batch of commands as a single undo entry on a specific artboard.
37
+ * No-op if commands array is empty.
38
+ */
39
+ executeBatchOnArtboard(artboardId: string, commands: Command[]): void;
40
+ /**
41
+ * Execute a command on a specific artboard
42
+ */
43
+ executeOnArtboard(artboardId: string, command: Command): void;
44
+ /**
45
+ * Smart undo - determines which history to use
46
+ */
47
+ undo(): boolean;
48
+ /**
49
+ * Smart redo - determines which history to use
50
+ */
51
+ redo(): boolean;
52
+ /**
53
+ * Undo global operation
54
+ */
55
+ undoGlobal(): boolean;
56
+ /**
57
+ * Redo global operation
58
+ */
59
+ redoGlobal(): boolean;
60
+ /**
61
+ * Undo artboard operation
62
+ */
63
+ undoArtboard(artboardId: string): boolean;
64
+ /**
65
+ * Redo artboard operation
66
+ */
67
+ redoArtboard(artboardId: string): boolean;
68
+ /**
69
+ * Check if global undo is available
70
+ */
71
+ canUndoGlobal(): boolean;
72
+ /**
73
+ * Check if global redo is available
74
+ */
75
+ canRedoGlobal(): boolean;
76
+ /**
77
+ * Check if artboard undo is available
78
+ */
79
+ canUndoArtboard(artboardId: string): boolean;
80
+ /**
81
+ * Check if artboard redo is available
82
+ */
83
+ canRedoArtboard(artboardId: string): boolean;
84
+ /**
85
+ * Check if any undo is available (smart check)
86
+ */
87
+ canUndo(): boolean;
88
+ /**
89
+ * Check if any redo is available (smart check)
90
+ */
91
+ canRedo(): boolean;
92
+ /**
93
+ * Clear all histories
94
+ */
95
+ clear(): void;
96
+ /**
97
+ * Clear history for a specific artboard
98
+ */
99
+ clearArtboardHistory(artboardId: string): void;
100
+ /**
101
+ * Get history for a specific artboard (create if doesn't exist)
102
+ */
103
+ getArtboardHistory(artboardId: string): CommandHistory;
104
+ /**
105
+ * Get global history
106
+ */
107
+ getGlobalHistory(): CommandHistory;
108
+ /**
109
+ * Get state of all histories
110
+ */
111
+ getState(): {
112
+ global: {
113
+ canUndo: boolean;
114
+ canRedo: boolean;
115
+ historySize: number;
116
+ };
117
+ artboards: Map<string, {
118
+ canUndo: boolean;
119
+ canRedo: boolean;
120
+ historySize: number;
121
+ }>;
122
+ lastOperation: HistoryEntry | null;
123
+ };
124
+ /**
125
+ * Update last operation tracker
126
+ */
127
+ private updateLastOperation;
128
+ /**
129
+ * Get description of what will be undone
130
+ */
131
+ getUndoDescription(): string;
132
+ /**
133
+ * Get description of what will be redone
134
+ */
135
+ getRedoDescription(): string;
136
+ }
137
+ export default HybridHistoryManager;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Shared image cache for HTMLImageElement instances.
3
+ * Prevents duplicate loading of the same URL across elements.
4
+ * Reference-counted -- images are evicted when no elements reference them.
5
+ *
6
+ * Usage:
7
+ * const cache = ImageCache.getInstance();
8
+ * const img = cache.acquire('https://example.com/photo.jpg');
9
+ * // ... use img ...
10
+ * cache.release('https://example.com/photo.jpg');
11
+ */
12
+ export declare class ImageCache {
13
+ private static instance;
14
+ private cache;
15
+ private constructor();
16
+ /**
17
+ * Get the singleton ImageCache instance.
18
+ */
19
+ static getInstance(): ImageCache;
20
+ /**
21
+ * Acquire an HTMLImageElement for the given URL.
22
+ * If the URL is already cached, increments the reference count and returns the existing element.
23
+ * If not cached, creates a new HTMLImageElement, starts loading, and caches it.
24
+ *
25
+ * @param url - The image URL to load
26
+ * @returns The cached or newly created HTMLImageElement
27
+ */
28
+ acquire(url: string): HTMLImageElement;
29
+ /**
30
+ * Release a reference to a cached image.
31
+ * When the reference count reaches zero, the entry is evicted from the cache.
32
+ *
33
+ * @param url - The image URL to release
34
+ */
35
+ release(url: string): void;
36
+ /**
37
+ * Get a cached HTMLImageElement without incrementing the reference count.
38
+ * Returns undefined if the URL is not in the cache.
39
+ *
40
+ * @param url - The image URL to look up
41
+ */
42
+ get(url: string): HTMLImageElement | undefined;
43
+ /**
44
+ * Check if a URL is in the cache.
45
+ *
46
+ * @param url - The image URL to check
47
+ */
48
+ has(url: string): boolean;
49
+ /**
50
+ * Get cache statistics.
51
+ *
52
+ * @returns Object with entry count and total reference count across all entries
53
+ */
54
+ getStats(): {
55
+ entries: number;
56
+ totalRefs: number;
57
+ };
58
+ /**
59
+ * Clear the entire cache.
60
+ * Primarily for testing -- removes all entries regardless of reference count.
61
+ */
62
+ clear(): void;
63
+ }