@kritzel/engine 0.4.31

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 (373) hide show
  1. package/LICENSE.md +50 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  3. package/dist/cjs/engine.constants-CakmdKMW.js +28206 -0
  4. package/dist/cjs/index-BbbWU2aN.js +1742 -0
  5. package/dist/cjs/index.cjs.js +4232 -0
  6. package/dist/cjs/kritzel-awareness-cursors_5.cjs.entry.js +28004 -0
  7. package/dist/cjs/loader.cjs.js +13 -0
  8. package/dist/cjs/stencil.cjs.js +25 -0
  9. package/dist/collection/classes/core/core.class.js +1389 -0
  10. package/dist/collection/classes/core/reviver.class.js +124 -0
  11. package/dist/collection/classes/core/store.class.js +337 -0
  12. package/dist/collection/classes/core/viewport.class.js +794 -0
  13. package/dist/collection/classes/core/workspace.class.js +112 -0
  14. package/dist/collection/classes/handlers/base.handler.js +20 -0
  15. package/dist/collection/classes/handlers/context-menu.handler.js +170 -0
  16. package/dist/collection/classes/handlers/hover.handler.js +35 -0
  17. package/dist/collection/classes/handlers/key.handler.js +162 -0
  18. package/dist/collection/classes/handlers/line-handle.handler.js +475 -0
  19. package/dist/collection/classes/handlers/move.handler.js +295 -0
  20. package/dist/collection/classes/handlers/resize.handler.js +327 -0
  21. package/dist/collection/classes/handlers/rotation.handler.js +174 -0
  22. package/dist/collection/classes/handlers/selection.handler.js +526 -0
  23. package/dist/collection/classes/managers/anchor.manager.js +1476 -0
  24. package/dist/collection/classes/managers/browser-permission.manager.js +64 -0
  25. package/dist/collection/classes/managers/clipboard.manager.js +346 -0
  26. package/dist/collection/classes/managers/clipboard.types.js +1 -0
  27. package/dist/collection/classes/managers/cursor.manager.js +139 -0
  28. package/dist/collection/classes/managers/license.manager.js +341 -0
  29. package/dist/collection/classes/managers/localization.manager.js +227 -0
  30. package/dist/collection/classes/managers/theme.manager.js +206 -0
  31. package/dist/collection/classes/objects/base-object.class.js +462 -0
  32. package/dist/collection/classes/objects/dynamic-object.class.js +437 -0
  33. package/dist/collection/classes/objects/group.class.js +590 -0
  34. package/dist/collection/classes/objects/image.class.js +500 -0
  35. package/dist/collection/classes/objects/line.class.js +789 -0
  36. package/dist/collection/classes/objects/path.class.js +578 -0
  37. package/dist/collection/classes/objects/selection-box.class.js +32 -0
  38. package/dist/collection/classes/objects/selection-group.class.js +752 -0
  39. package/dist/collection/classes/objects/shape.class.js +628 -0
  40. package/dist/collection/classes/objects/text.class.js +461 -0
  41. package/dist/collection/classes/providers/assets/asset-resolver.class.js +536 -0
  42. package/dist/collection/classes/providers/assets/http-asset-provider.class.js +111 -0
  43. package/dist/collection/classes/providers/assets/indexeddb-asset-provider.class.js +241 -0
  44. package/dist/collection/classes/providers/assets/presigned-asset-provider.class.js +86 -0
  45. package/dist/collection/classes/providers/paste-intent/event-paste-intent.provider.js +48 -0
  46. package/dist/collection/classes/providers/paste-intent/ios-paste-intent.provider.js +16 -0
  47. package/dist/collection/classes/providers/paste-intent/navigator-paste-intent.provider.js +86 -0
  48. package/dist/collection/classes/providers/sync/broadcast-sync-provider.class.js +100 -0
  49. package/dist/collection/classes/providers/sync/hocuspocus-sync-provider.class.js +333 -0
  50. package/dist/collection/classes/providers/sync/in-memory-sync-provider.class.js +69 -0
  51. package/dist/collection/classes/providers/sync/indexeddb-sync-provider.class.js +39 -0
  52. package/dist/collection/classes/providers/sync/websocket-sync-provider.class.js +110 -0
  53. package/dist/collection/classes/registries/dynamic-object-renderer.registry.js +52 -0
  54. package/dist/collection/classes/registries/font-registry.class.js +161 -0
  55. package/dist/collection/classes/registries/icon-registry.class.js +118 -0
  56. package/dist/collection/classes/registries/paste-intent-provider.registry.js +26 -0
  57. package/dist/collection/classes/registries/tool.registry.js +69 -0
  58. package/dist/collection/classes/structures/app-state-map.structure.js +461 -0
  59. package/dist/collection/classes/structures/object-map.structure.js +1103 -0
  60. package/dist/collection/classes/structures/quadtree.structure.js +251 -0
  61. package/dist/collection/classes/tools/base-tool.class.js +88 -0
  62. package/dist/collection/classes/tools/brush-tool.class.js +236 -0
  63. package/dist/collection/classes/tools/eraser-tool.class.js +133 -0
  64. package/dist/collection/classes/tools/image-tool.class.js +152 -0
  65. package/dist/collection/classes/tools/line-tool.class.js +249 -0
  66. package/dist/collection/classes/tools/selection-tool.class.js +611 -0
  67. package/dist/collection/classes/tools/shape-tool.class.js +251 -0
  68. package/dist/collection/classes/tools/text-tool.class.js +179 -0
  69. package/dist/collection/collection-manifest.json +17 -0
  70. package/dist/collection/components/kritzel-awareness-cursors/kritzel-awareness-cursors.css +115 -0
  71. package/dist/collection/components/kritzel-awareness-cursors/kritzel-awareness-cursors.js +380 -0
  72. package/dist/collection/components/kritzel-cursor-trail/kritzel-cursor-trail.css +10 -0
  73. package/dist/collection/components/kritzel-cursor-trail/kritzel-cursor-trail.js +153 -0
  74. package/dist/collection/components/kritzel-engine/kritzel-engine.css +81 -0
  75. package/dist/collection/components/kritzel-engine/kritzel-engine.js +6345 -0
  76. package/dist/collection/components/kritzel-icon/kritzel-icon.css +18 -0
  77. package/dist/collection/components/kritzel-icon/kritzel-icon.js +93 -0
  78. package/dist/collection/components/kritzel-watermark/kritzel-watermark.css +29 -0
  79. package/dist/collection/components/kritzel-watermark/kritzel-watermark.js +83 -0
  80. package/dist/collection/configs/default-asset-storage.config.js +9 -0
  81. package/dist/collection/configs/default-brush-tool.config.js +9 -0
  82. package/dist/collection/configs/default-engine-config.js +73 -0
  83. package/dist/collection/configs/default-line-tool.config.js +12 -0
  84. package/dist/collection/configs/default-shape-tool.config.js +15 -0
  85. package/dist/collection/configs/default-sync.config.js +6 -0
  86. package/dist/collection/configs/default-text-tool.config.js +12 -0
  87. package/dist/collection/constants/color-palette.constants.js +40 -0
  88. package/dist/collection/constants/core.constants.js +1 -0
  89. package/dist/collection/constants/engine.constants.js +4 -0
  90. package/dist/collection/constants/license.constants.js +25 -0
  91. package/dist/collection/constants/schema.constants.js +4 -0
  92. package/dist/collection/constants/storage.constants.js +1 -0
  93. package/dist/collection/constants/stroke-size.constants.js +2 -0
  94. package/dist/collection/constants/text-tool-fonts.constants.js +18 -0
  95. package/dist/collection/constants/version.js +6 -0
  96. package/dist/collection/enums/alignment.enum.js +9 -0
  97. package/dist/collection/enums/event-button.enum.js +6 -0
  98. package/dist/collection/enums/handle-type.enum.js +7 -0
  99. package/dist/collection/enums/shape-type.enum.js +6 -0
  100. package/dist/collection/events/active-workspace-change.event.js +1 -0
  101. package/dist/collection/events/editor-is-ready.event.js +1 -0
  102. package/dist/collection/events/login.event.js +1 -0
  103. package/dist/collection/helpers/alignment.helper.js +73 -0
  104. package/dist/collection/helpers/class.helper.js +5 -0
  105. package/dist/collection/helpers/color.helper.js +106 -0
  106. package/dist/collection/helpers/cursor.helper.js +57 -0
  107. package/dist/collection/helpers/devices.helper.js +28 -0
  108. package/dist/collection/helpers/event.helper.js +58 -0
  109. package/dist/collection/helpers/geometry.helper.js +149 -0
  110. package/dist/collection/helpers/html.helper.js +116 -0
  111. package/dist/collection/helpers/image-file.helper.js +6 -0
  112. package/dist/collection/helpers/keyboard.helper.js +55 -0
  113. package/dist/collection/helpers/localization.helper.js +25 -0
  114. package/dist/collection/helpers/math.helper.js +8 -0
  115. package/dist/collection/helpers/migration.helper.js +45 -0
  116. package/dist/collection/helpers/object.helper.js +29 -0
  117. package/dist/collection/helpers/svg-export.helper.js +655 -0
  118. package/dist/collection/helpers/theme.helper.js +77 -0
  119. package/dist/collection/helpers/tool-config.helper.js +63 -0
  120. package/dist/collection/helpers/wheel.helper.js +113 -0
  121. package/dist/collection/index.js +107 -0
  122. package/dist/collection/interfaces/anchor.interface.js +1 -0
  123. package/dist/collection/interfaces/arrow-head.interface.js +1 -0
  124. package/dist/collection/interfaces/asset-provider.interface.js +1 -0
  125. package/dist/collection/interfaces/asset-storage-config.interface.js +1 -0
  126. package/dist/collection/interfaces/asset.interface.js +1 -0
  127. package/dist/collection/interfaces/bounding-box.interface.js +1 -0
  128. package/dist/collection/interfaces/clonable.interface.js +1 -0
  129. package/dist/collection/interfaces/context-menu-item.interface.js +1 -0
  130. package/dist/collection/interfaces/context-menu-state.interface.js +1 -0
  131. package/dist/collection/interfaces/debug-info.interface.js +1 -0
  132. package/dist/collection/interfaces/dialog.interface.js +1 -0
  133. package/dist/collection/interfaces/document-metadata.interface.js +1 -0
  134. package/dist/collection/interfaces/dynamic-object-renderer.interface.js +1 -0
  135. package/dist/collection/interfaces/engine-state.interface.js +1 -0
  136. package/dist/collection/interfaces/font.interface.js +1 -0
  137. package/dist/collection/interfaces/localization.interface.js +1 -0
  138. package/dist/collection/interfaces/login-config.interface.js +1 -0
  139. package/dist/collection/interfaces/master-detail.interface.js +1 -0
  140. package/dist/collection/interfaces/menu-item.interface.js +1 -0
  141. package/dist/collection/interfaces/migration.interface.js +1 -0
  142. package/dist/collection/interfaces/notification.interface.js +1 -0
  143. package/dist/collection/interfaces/object-change-event.interface.js +1 -0
  144. package/dist/collection/interfaces/object-export.interface.js +1 -0
  145. package/dist/collection/interfaces/object.interface.js +1 -0
  146. package/dist/collection/interfaces/paste-intent-provider.interface.js +1 -0
  147. package/dist/collection/interfaces/point.interface.js +1 -0
  148. package/dist/collection/interfaces/polygon.interface.js +1 -0
  149. package/dist/collection/interfaces/remote-cursor.interface.js +1 -0
  150. package/dist/collection/interfaces/selection-state.interface.js +1 -0
  151. package/dist/collection/interfaces/serializable.interface.js +1 -0
  152. package/dist/collection/interfaces/settings.interface.js +1 -0
  153. package/dist/collection/interfaces/share.interface.js +1 -0
  154. package/dist/collection/interfaces/shortcut.interface.js +1 -0
  155. package/dist/collection/interfaces/sync-config.interface.js +21 -0
  156. package/dist/collection/interfaces/sync-provider.interface.js +1 -0
  157. package/dist/collection/interfaces/theme.interface.js +1 -0
  158. package/dist/collection/interfaces/tool-config.interface.js +1 -0
  159. package/dist/collection/interfaces/tool-type.interface.js +1 -0
  160. package/dist/collection/interfaces/tool.interface.js +1 -0
  161. package/dist/collection/interfaces/toolbar-item.interface.js +1 -0
  162. package/dist/collection/interfaces/undo-state.interface.js +1 -0
  163. package/dist/collection/interfaces/user.interface.js +1 -0
  164. package/dist/collection/interfaces/viewport-state.interface.js +1 -0
  165. package/dist/collection/locales/de-locale.js +119 -0
  166. package/dist/collection/locales/en-locale.js +120 -0
  167. package/dist/collection/locales/fr-locale.js +119 -0
  168. package/dist/collection/migrations/app-state.migrations.js +47 -0
  169. package/dist/collection/migrations/workspace.migrations.js +67 -0
  170. package/dist/collection/themes/dark-theme.js +340 -0
  171. package/dist/collection/themes/light-theme.js +346 -0
  172. package/dist/collection/types/deep-readonly.type.js +1 -0
  173. package/dist/collection/types/state.types.js +1 -0
  174. package/dist/components/index.d.ts +47 -0
  175. package/dist/components/index.js +4143 -0
  176. package/dist/components/kritzel-awareness-cursors.d.ts +11 -0
  177. package/dist/components/kritzel-awareness-cursors.js +6 -0
  178. package/dist/components/kritzel-cursor-trail.d.ts +11 -0
  179. package/dist/components/kritzel-cursor-trail.js +6 -0
  180. package/dist/components/kritzel-engine.d.ts +11 -0
  181. package/dist/components/kritzel-engine.js +52641 -0
  182. package/dist/components/kritzel-icon.d.ts +11 -0
  183. package/dist/components/kritzel-icon.js +6 -0
  184. package/dist/components/kritzel-watermark.d.ts +11 -0
  185. package/dist/components/kritzel-watermark.js +6 -0
  186. package/dist/components/p-B2Htv9ou.js +49 -0
  187. package/dist/components/p-BvRGQvVI.js +3456 -0
  188. package/dist/components/p-CfSx6HU_.js +1469 -0
  189. package/dist/components/p-YP8wAcF4.js +122 -0
  190. package/dist/components/p-fx6msYHJ.js +167 -0
  191. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  192. package/dist/esm/engine.constants-Bl5-pbq-.js +28143 -0
  193. package/dist/esm/index-BU9Mv7y0.js +1715 -0
  194. package/dist/esm/index.js +4134 -0
  195. package/dist/esm/kritzel-awareness-cursors_5.entry.js +27978 -0
  196. package/dist/esm/loader.js +11 -0
  197. package/dist/esm/stencil.js +21 -0
  198. package/dist/index.cjs.js +1 -0
  199. package/dist/index.js +1 -0
  200. package/dist/stencil/index.esm.js +4134 -0
  201. package/dist/stencil/p-BU9Mv7y0.js +1702 -0
  202. package/dist/stencil/p-Bl5-pbq-.js +28143 -0
  203. package/dist/stencil/p-DQuL1Twl.js +3 -0
  204. package/dist/stencil/p-f0a8b7af.entry.js +27978 -0
  205. package/dist/stencil/stencil.esm.js +21 -0
  206. package/dist/types/classes/core/core.class.d.ts +532 -0
  207. package/dist/types/classes/core/reviver.class.d.ts +32 -0
  208. package/dist/types/classes/core/store.class.d.ts +198 -0
  209. package/dist/types/classes/core/viewport.class.d.ts +256 -0
  210. package/dist/types/classes/core/workspace.class.d.ts +95 -0
  211. package/dist/types/classes/handlers/base.handler.d.ts +18 -0
  212. package/dist/types/classes/handlers/context-menu.handler.d.ts +67 -0
  213. package/dist/types/classes/handlers/hover.handler.d.ts +23 -0
  214. package/dist/types/classes/handlers/key.handler.d.ts +44 -0
  215. package/dist/types/classes/handlers/line-handle.handler.d.ts +115 -0
  216. package/dist/types/classes/handlers/move.handler.d.ts +94 -0
  217. package/dist/types/classes/handlers/resize.handler.d.ts +95 -0
  218. package/dist/types/classes/handlers/rotation.handler.d.ts +50 -0
  219. package/dist/types/classes/handlers/selection.handler.d.ts +153 -0
  220. package/dist/types/classes/managers/anchor.manager.d.ts +513 -0
  221. package/dist/types/classes/managers/browser-permission.manager.d.ts +41 -0
  222. package/dist/types/classes/managers/clipboard.manager.d.ts +71 -0
  223. package/dist/types/classes/managers/clipboard.types.d.ts +23 -0
  224. package/dist/types/classes/managers/cursor.manager.d.ts +66 -0
  225. package/dist/types/classes/managers/license.manager.d.ts +147 -0
  226. package/dist/types/classes/managers/localization.manager.d.ts +145 -0
  227. package/dist/types/classes/managers/theme.manager.d.ts +112 -0
  228. package/dist/types/classes/objects/base-object.class.d.ts +266 -0
  229. package/dist/types/classes/objects/dynamic-object.class.d.ts +148 -0
  230. package/dist/types/classes/objects/group.class.d.ts +231 -0
  231. package/dist/types/classes/objects/image.class.d.ts +246 -0
  232. package/dist/types/classes/objects/line.class.d.ts +285 -0
  233. package/dist/types/classes/objects/path.class.d.ts +220 -0
  234. package/dist/types/classes/objects/selection-box.class.d.ts +19 -0
  235. package/dist/types/classes/objects/selection-group.class.d.ts +267 -0
  236. package/dist/types/classes/objects/shape.class.d.ts +322 -0
  237. package/dist/types/classes/objects/text.class.d.ts +197 -0
  238. package/dist/types/classes/providers/assets/asset-resolver.class.d.ts +141 -0
  239. package/dist/types/classes/providers/assets/http-asset-provider.class.d.ts +79 -0
  240. package/dist/types/classes/providers/assets/indexeddb-asset-provider.class.d.ts +69 -0
  241. package/dist/types/classes/providers/assets/presigned-asset-provider.class.d.ts +69 -0
  242. package/dist/types/classes/providers/paste-intent/event-paste-intent.provider.d.ts +8 -0
  243. package/dist/types/classes/providers/paste-intent/ios-paste-intent.provider.d.ts +6 -0
  244. package/dist/types/classes/providers/paste-intent/navigator-paste-intent.provider.d.ts +9 -0
  245. package/dist/types/classes/providers/sync/broadcast-sync-provider.class.d.ts +23 -0
  246. package/dist/types/classes/providers/sync/hocuspocus-sync-provider.class.d.ts +163 -0
  247. package/dist/types/classes/providers/sync/in-memory-sync-provider.class.d.ts +39 -0
  248. package/dist/types/classes/providers/sync/indexeddb-sync-provider.class.d.ts +25 -0
  249. package/dist/types/classes/providers/sync/websocket-sync-provider.class.d.ts +63 -0
  250. package/dist/types/classes/registries/dynamic-object-renderer.registry.d.ts +32 -0
  251. package/dist/types/classes/registries/font-registry.class.d.ts +19 -0
  252. package/dist/types/classes/registries/icon-registry.class.d.ts +39 -0
  253. package/dist/types/classes/registries/paste-intent-provider.registry.d.ts +10 -0
  254. package/dist/types/classes/registries/tool.registry.d.ts +53 -0
  255. package/dist/types/classes/structures/app-state-map.structure.d.ts +171 -0
  256. package/dist/types/classes/structures/object-map.structure.d.ts +403 -0
  257. package/dist/types/classes/structures/quadtree.structure.d.ts +128 -0
  258. package/dist/types/classes/tools/base-tool.class.d.ts +72 -0
  259. package/dist/types/classes/tools/brush-tool.class.d.ts +68 -0
  260. package/dist/types/classes/tools/eraser-tool.class.d.ts +38 -0
  261. package/dist/types/classes/tools/image-tool.class.d.ts +74 -0
  262. package/dist/types/classes/tools/line-tool.class.d.ts +63 -0
  263. package/dist/types/classes/tools/selection-tool.class.d.ts +188 -0
  264. package/dist/types/classes/tools/shape-tool.class.d.ts +90 -0
  265. package/dist/types/classes/tools/text-tool.class.d.ts +66 -0
  266. package/dist/types/components/kritzel-awareness-cursors/kritzel-awareness-cursors.d.ts +29 -0
  267. package/dist/types/components/kritzel-cursor-trail/kritzel-cursor-trail.d.ts +19 -0
  268. package/dist/types/components/kritzel-engine/kritzel-engine.d.ts +695 -0
  269. package/dist/types/components/kritzel-icon/kritzel-icon.d.ts +6 -0
  270. package/dist/types/components/kritzel-watermark/kritzel-watermark.d.ts +20 -0
  271. package/dist/types/components.d.ts +981 -0
  272. package/dist/types/configs/default-asset-storage.config.d.ts +8 -0
  273. package/dist/types/configs/default-brush-tool.config.d.ts +2 -0
  274. package/dist/types/configs/default-engine-config.d.ts +2 -0
  275. package/dist/types/configs/default-line-tool.config.d.ts +2 -0
  276. package/dist/types/configs/default-shape-tool.config.d.ts +2 -0
  277. package/dist/types/configs/default-sync.config.d.ts +5 -0
  278. package/dist/types/configs/default-text-tool.config.d.ts +2 -0
  279. package/dist/types/constants/color-palette.constants.d.ts +31 -0
  280. package/dist/types/constants/core.constants.d.ts +0 -0
  281. package/dist/types/constants/engine.constants.d.ts +4 -0
  282. package/dist/types/constants/license.constants.d.ts +25 -0
  283. package/dist/types/constants/schema.constants.d.ts +4 -0
  284. package/dist/types/constants/storage.constants.d.ts +1 -0
  285. package/dist/types/constants/stroke-size.constants.d.ts +2 -0
  286. package/dist/types/constants/text-tool-fonts.constants.d.ts +3 -0
  287. package/dist/types/constants/version.d.ts +6 -0
  288. package/dist/types/enums/alignment.enum.d.ts +8 -0
  289. package/dist/types/enums/event-button.enum.d.ts +5 -0
  290. package/dist/types/enums/handle-type.enum.d.ts +6 -0
  291. package/dist/types/enums/shape-type.enum.d.ts +5 -0
  292. package/dist/types/events/active-workspace-change.event.d.ts +7 -0
  293. package/dist/types/events/editor-is-ready.event.d.ts +18 -0
  294. package/dist/types/events/login.event.d.ts +3 -0
  295. package/dist/types/helpers/alignment.helper.d.ts +21 -0
  296. package/dist/types/helpers/class.helper.d.ts +3 -0
  297. package/dist/types/helpers/color.helper.d.ts +34 -0
  298. package/dist/types/helpers/cursor.helper.d.ts +22 -0
  299. package/dist/types/helpers/devices.helper.d.ts +8 -0
  300. package/dist/types/helpers/event.helper.d.ts +6 -0
  301. package/dist/types/helpers/geometry.helper.d.ts +38 -0
  302. package/dist/types/helpers/html.helper.d.ts +8 -0
  303. package/dist/types/helpers/image-file.helper.d.ts +3 -0
  304. package/dist/types/helpers/keyboard.helper.d.ts +6 -0
  305. package/dist/types/helpers/localization.helper.d.ts +18 -0
  306. package/dist/types/helpers/math.helper.d.ts +4 -0
  307. package/dist/types/helpers/migration.helper.d.ts +30 -0
  308. package/dist/types/helpers/object.helper.d.ts +9 -0
  309. package/dist/types/helpers/svg-export.helper.d.ts +231 -0
  310. package/dist/types/helpers/theme.helper.d.ts +42 -0
  311. package/dist/types/helpers/tool-config.helper.d.ts +4 -0
  312. package/dist/types/helpers/wheel.helper.d.ts +9 -0
  313. package/dist/types/index.d.ts +109 -0
  314. package/dist/types/interfaces/anchor.interface.d.ts +147 -0
  315. package/dist/types/interfaces/arrow-head.interface.d.ts +27 -0
  316. package/dist/types/interfaces/asset-provider.interface.d.ts +88 -0
  317. package/dist/types/interfaces/asset-storage-config.interface.d.ts +40 -0
  318. package/dist/types/interfaces/asset.interface.d.ts +43 -0
  319. package/dist/types/interfaces/bounding-box.interface.d.ts +8 -0
  320. package/dist/types/interfaces/clonable.interface.d.ts +3 -0
  321. package/dist/types/interfaces/context-menu-item.interface.d.ts +25 -0
  322. package/dist/types/interfaces/context-menu-state.interface.d.ts +16 -0
  323. package/dist/types/interfaces/debug-info.interface.d.ts +7 -0
  324. package/dist/types/interfaces/dialog.interface.d.ts +4 -0
  325. package/dist/types/interfaces/document-metadata.interface.d.ts +6 -0
  326. package/dist/types/interfaces/dynamic-object-renderer.interface.d.ts +40 -0
  327. package/dist/types/interfaces/engine-state.interface.d.ts +82 -0
  328. package/dist/types/interfaces/font.interface.d.ts +15 -0
  329. package/dist/types/interfaces/localization.interface.d.ts +143 -0
  330. package/dist/types/interfaces/login-config.interface.d.ts +24 -0
  331. package/dist/types/interfaces/master-detail.interface.d.ts +14 -0
  332. package/dist/types/interfaces/menu-item.interface.d.ts +27 -0
  333. package/dist/types/interfaces/migration.interface.d.ts +16 -0
  334. package/dist/types/interfaces/notification.interface.d.ts +10 -0
  335. package/dist/types/interfaces/object-change-event.interface.d.ts +31 -0
  336. package/dist/types/interfaces/object-export.interface.d.ts +20 -0
  337. package/dist/types/interfaces/object.interface.d.ts +53 -0
  338. package/dist/types/interfaces/paste-intent-provider.interface.d.ts +10 -0
  339. package/dist/types/interfaces/point.interface.d.ts +4 -0
  340. package/dist/types/interfaces/polygon.interface.d.ts +7 -0
  341. package/dist/types/interfaces/remote-cursor.interface.d.ts +18 -0
  342. package/dist/types/interfaces/selection-state.interface.d.ts +7 -0
  343. package/dist/types/interfaces/serializable.interface.d.ts +5 -0
  344. package/dist/types/interfaces/settings.interface.d.ts +25 -0
  345. package/dist/types/interfaces/share.interface.d.ts +9 -0
  346. package/dist/types/interfaces/shortcut.interface.d.ts +10 -0
  347. package/dist/types/interfaces/sync-config.interface.d.ts +41 -0
  348. package/dist/types/interfaces/sync-provider.interface.d.ts +66 -0
  349. package/dist/types/interfaces/theme.interface.d.ts +553 -0
  350. package/dist/types/interfaces/tool-config.interface.d.ts +24 -0
  351. package/dist/types/interfaces/tool-type.interface.d.ts +1 -0
  352. package/dist/types/interfaces/tool.interface.d.ts +8 -0
  353. package/dist/types/interfaces/toolbar-item.interface.d.ts +66 -0
  354. package/dist/types/interfaces/undo-state.interface.d.ts +6 -0
  355. package/dist/types/interfaces/user.interface.d.ts +22 -0
  356. package/dist/types/interfaces/viewport-state.interface.d.ts +7 -0
  357. package/dist/types/locales/de-locale.d.ts +5 -0
  358. package/dist/types/locales/en-locale.d.ts +6 -0
  359. package/dist/types/locales/fr-locale.d.ts +5 -0
  360. package/dist/types/migrations/app-state.migrations.d.ts +11 -0
  361. package/dist/types/migrations/workspace.migrations.d.ts +11 -0
  362. package/dist/types/stencil-public-runtime.d.ts +1873 -0
  363. package/dist/types/themes/dark-theme.d.ts +5 -0
  364. package/dist/types/themes/light-theme.d.ts +5 -0
  365. package/dist/types/types/deep-readonly.type.d.ts +7 -0
  366. package/dist/types/types/state.types.d.ts +3 -0
  367. package/loader/cdn.js +1 -0
  368. package/loader/index.cjs.js +1 -0
  369. package/loader/index.d.ts +24 -0
  370. package/loader/index.es2017.js +1 -0
  371. package/loader/index.js +2 -0
  372. package/package.json +101 -0
  373. package/readme.md +11 -0
@@ -0,0 +1,695 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import { KritzelViewport } from '../../classes/core/viewport.class';
3
+ import { KritzelKeyHandler } from '../../classes/handlers/key.handler';
4
+ import { KritzelBaseTool } from '../../classes/tools/base-tool.class';
5
+ import { ContextMenuItem } from '../../interfaces/context-menu-item.interface';
6
+ import { KritzelBrushToolConfig, KritzelLineToolConfig, KritzelShapeToolConfig, KritzelTextToolConfig } from '../../interfaces/toolbar-item.interface';
7
+ import { KritzelContextMenuHandler } from '../../classes/handlers/context-menu.handler';
8
+ import { KritzelBaseObject } from '../../classes/objects/base-object.class';
9
+ import { KritzelWorkspace } from '../../classes/core/workspace.class';
10
+ import { KritzelEngineState } from '../../interfaces/engine-state.interface';
11
+ import { KritzelDebugInfo } from '../../interfaces/debug-info.interface';
12
+ import { KritzelSettingsConfig } from '../../interfaces/settings.interface';
13
+ import { KritzelCore } from '../../classes/core/core.class';
14
+ import { KritzelSyncConfig } from '../../interfaces/sync-config.interface';
15
+ import { KritzelAssetStorageConfig } from '../../interfaces/asset-storage-config.interface';
16
+ import { KritzelUndoState } from '../../interfaces/undo-state.interface';
17
+ import { KritzelTheme, ThemeName } from '../../interfaces/theme.interface';
18
+ import { KritzelLocale, KritzelTermKey, KritzelTermVars, LocaleCode } from '../../interfaces/localization.interface';
19
+ import { KritzelShortcut } from '../../interfaces/shortcut.interface';
20
+ import { KritzelAlignment } from '../../enums/alignment.enum';
21
+ import { KritzelViewportState } from '../../interfaces/viewport-state.interface';
22
+ import { ObjectsAddedEvent, ObjectsRemovedEvent, ObjectsUpdatedEvent, ObjectsInViewportChangeEvent } from '../../interfaces/object-change-event.interface';
23
+ import { IKritzelUser } from '../../interfaces/user.interface';
24
+ import { KritzelNotification } from '../../interfaces/notification.interface';
25
+ import { KritzelContextMenuState } from '../../interfaces/context-menu-state.interface';
26
+ import { KritzelObjectExportFormat } from '../../interfaces/object-export.interface';
27
+ export declare class KritzelEngine {
28
+ host: HTMLElement;
29
+ private activeImportFileInput?;
30
+ private cancelActiveImport?;
31
+ /** Authoritative workspace catalog for this engine instance. When provided, provider-only workspaces are hidden but not deleted. */
32
+ workspaces?: KritzelWorkspace[];
33
+ onWorkspacesPropChange(): Promise<void>;
34
+ /** Optional unique identifier for namespacing storage keys across multiple editor instances. */
35
+ editorId?: string;
36
+ /** Optional workspace ID to load. If provided, the engine will look up and load this workspace by ID. */
37
+ activeWorkspaceId?: string;
38
+ onActiveWorkspaceIdChange(newWorkspaceId?: string): Promise<void>;
39
+ /** Configuration for real-time synchronization providers (e.g., IndexedDB, WebSocket). */
40
+ syncConfig?: KritzelSyncConfig;
41
+ onSyncConfigChange(newValue: KritzelSyncConfig | undefined): Promise<void>;
42
+ /**
43
+ * Configuration for binary asset storage (e.g., images).
44
+ *
45
+ * The Yjs document only persists asset ids; the actual bytes are stored
46
+ * by the providers listed here. Defaults to IndexedDB-only storage. To
47
+ * support cross-device image sync alongside a networked sync provider
48
+ * (Hocuspocus, WebSocket), configure at least one remote asset provider
49
+ * such as `HttpAssetProvider` or `PresignedAssetProvider`.
50
+ */
51
+ assetStorageConfig?: KritzelAssetStorageConfig;
52
+ onAssetStorageConfigChange(newValue: KritzelAssetStorageConfig | undefined): Promise<void>;
53
+ /** The current user for awareness broadcasting (name, id, cursor position). */
54
+ user?: IKritzelUser;
55
+ onUserChange(newValue: IKritzelUser | undefined): void;
56
+ /** Context menu items shown when right-clicking the canvas background. */
57
+ globalContextMenuItems?: ContextMenuItem[];
58
+ onGlobalContextMenuItemsChange(newValue: ContextMenuItem[] | undefined): void;
59
+ /** Context menu items shown when right-clicking a selected object. */
60
+ objectContextMenuItems?: ContextMenuItem[];
61
+ onObjectContextMenuItemsChange(newValue: ContextMenuItem[] | undefined): void;
62
+ /** Maximum zoom scale allowed. Clamped to the absolute maximum defined by the engine. */
63
+ scaleMax: number;
64
+ validateScaleMax(newValue: number): void;
65
+ /** Minimum zoom scale allowed. Clamped to the absolute minimum defined by the engine. */
66
+ scaleMin: number;
67
+ validateScaleMin(newValue: number): void;
68
+ /** The HTML element to apply cursor styles to. Defaults to `document.body` if not set. */
69
+ cursorTarget?: HTMLElement;
70
+ onCursorTargetChange(newValue: HTMLElement | undefined): void;
71
+ /** When true, objects are drawn at a fixed visual size regardless of zoom level */
72
+ lockDrawingScale: boolean;
73
+ onLockDrawingScaleChange(newValue: boolean): void;
74
+ /** The current theme to apply to the editor */
75
+ theme: ThemeName;
76
+ onThemeChange(newValue: ThemeName): void;
77
+ /** License key that, when valid, removes the "Powered by Kritzel" watermark. */
78
+ licenseKey?: string;
79
+ onLicenseKeyChange(newValue?: string): void;
80
+ /** An array of available themes for the editor. */
81
+ themes?: KritzelTheme[];
82
+ onThemesChange(newValue?: KritzelTheme[]): void;
83
+ /** The current locale (language) code to apply to the editor, e.g. 'en', 'de', 'fr'. */
84
+ locale: LocaleCode;
85
+ onLocaleChange(newValue: LocaleCode): void;
86
+ /** An array of available locale definitions (with optional partial term overrides). Replaces the built-in locale set (en/de/fr) when provided, even if empty. */
87
+ locales?: KritzelLocale[];
88
+ onLocalesChange(newValue?: KritzelLocale[]): void;
89
+ /** The locale used to resolve terms missing from the active locale. */
90
+ fallbackLocale: LocaleCode;
91
+ onFallbackLocaleChange(newValue: LocaleCode): void;
92
+ /** Left boundary of the viewport in world coordinates. Objects beyond this X position cannot be panned to. */
93
+ viewportBoundaryLeft: number;
94
+ onViewportBoundaryLeftChange(newValue: number): void;
95
+ /** Right boundary of the viewport in world coordinates. Objects beyond this X position cannot be panned to. */
96
+ viewportBoundaryRight: number;
97
+ onViewportBoundaryRightChange(newValue: number): void;
98
+ /** Top boundary of the viewport in world coordinates. Objects beyond this Y position cannot be panned to. */
99
+ viewportBoundaryTop: number;
100
+ onViewportBoundaryTopChange(newValue: number): void;
101
+ /** Bottom boundary of the viewport in world coordinates. Objects beyond this Y position cannot be panned to. */
102
+ viewportBoundaryBottom: number;
103
+ onViewportBoundaryBottomChange(newValue: number): void;
104
+ /** Debug info display options controlling which debug overlays are visible */
105
+ debugInfo?: KritzelDebugInfo;
106
+ onDebugInfoChange(newValue: KritzelDebugInfo): void;
107
+ /** When false, non-modified wheel events do not pan the viewport. */
108
+ isPanningEnabled: boolean;
109
+ /** When false, Ctrl+wheel events do not zoom the viewport. */
110
+ isZoomingEnabled: boolean;
111
+ /** Emitted when the engine has fully initialized and is ready for interaction. */
112
+ isEngineReady: EventEmitter<KritzelEngineState>;
113
+ /** Emitted when the active drawing tool changes. */
114
+ activeToolChange: EventEmitter<KritzelBaseTool>;
115
+ /** Emitted when workspaces are created, updated, or deleted. */
116
+ workspacesChange: EventEmitter<KritzelWorkspace[]>;
117
+ /** Emitted when the active workspace changes (e.g., after import). */
118
+ activeWorkspaceChange: EventEmitter<KritzelWorkspace>;
119
+ /** Emitted on long-press (touch/pen). Useful for showing custom context menus on mobile. */
120
+ longpress: EventEmitter<PointerEvent>;
121
+ /** Emitted when objects on the canvas are added, removed, or modified. */
122
+ objectsChange: EventEmitter<KritzelBaseObject[]>;
123
+ /** Emitted when one or more objects are added to the canvas. */
124
+ objectsAdded: EventEmitter<ObjectsAddedEvent>;
125
+ /** Emitted when one or more objects are removed from the canvas. */
126
+ objectsRemoved: EventEmitter<ObjectsRemovedEvent>;
127
+ /** Emitted when one or more objects are updated on the canvas. */
128
+ objectsUpdated: EventEmitter<ObjectsUpdatedEvent>;
129
+ /** Emitted when the set of selected objects changes. */
130
+ objectsSelectionChange: EventEmitter<KritzelBaseObject[]>;
131
+ /** Emitted when the undo/redo state changes, providing current undo availability. */
132
+ undoStateChange: EventEmitter<KritzelUndoState>;
133
+ /** Emitted when the set of objects visible in the current viewport changes (e.g., after pan or zoom). */
134
+ objectsInViewportChange: EventEmitter<ObjectsInViewportChangeEvent>;
135
+ /** Emitted when the viewport position, scale, or dimensions change (e.g., after pan, zoom, or resize). */
136
+ viewportChange: EventEmitter<KritzelViewportState>;
137
+ /** Emitted when the awareness state changes (remote user cursors, presence). */
138
+ awarenessChange: EventEmitter<Map<number, Record<string, any>>>;
139
+ /** Emitted when notifications change. */
140
+ notificationsChange: EventEmitter<KritzelNotification>;
141
+ /** Emitted when context-menu visibility, items, or position changes. */
142
+ contextMenuStateChange: EventEmitter<KritzelContextMenuState>;
143
+ /** Emitted while the selected workspace's objects are being initialized and synchronized. */
144
+ isLoadingChange: EventEmitter<boolean>;
145
+ forceUpdate: number;
146
+ /** Manually triggers the `objectsSelectionChange` event. */
147
+ triggerSelectionChange(): Promise<void>;
148
+ /** Starts a scene bootstrap phase by hiding the scene immediately. */
149
+ beginSceneBootstrap(): Promise<void>;
150
+ /** Ends a scene bootstrap phase by fading the scene back in. */
151
+ endSceneBootstrap(): Promise<void>;
152
+ handleWheel(ev: WheelEvent): void;
153
+ handlePointerDown(ev: PointerEvent): void;
154
+ private throttledPointerMoveMulti;
155
+ handlePointerMove(ev: PointerEvent): void;
156
+ handlePointerUp(ev: PointerEvent): void;
157
+ handlePointerCancel(ev: PointerEvent): void;
158
+ private isEmbeddedDynamicObjectInteraction;
159
+ private isNativeInteractiveEmbeddedTarget;
160
+ handlePointerLeave(): void;
161
+ handleLongPress(ev: CustomEvent<PointerEvent>): void;
162
+ handleContextMenu(ev: PointerEvent): void;
163
+ handleResize(): void;
164
+ handleKeyDown(ev: KeyboardEvent): void;
165
+ handleKeyUp(ev: KeyboardEvent): void;
166
+ handleCopy(ev: ClipboardEvent): void;
167
+ handleCut(ev: ClipboardEvent): void;
168
+ handlePaste(ev: ClipboardEvent): void;
169
+ /**
170
+ * Determines if the engine should handle a keyboard/clipboard shortcut event.
171
+ * Returns true only if:
172
+ * - The event originates from within the engine component, OR
173
+ * - The event target is not an interactive element that needs keyboard input
174
+ *
175
+ * This prevents conflicts with inputs, textareas, dialogs, or other
176
+ * interactive elements that need their own keyboard handling.
177
+ */
178
+ private shouldHandleGlobalShortcutEvent;
179
+ preventDoubleTapZoomOnTouchDevices(ev: MouseEvent): void;
180
+ /**
181
+ * Registers a new drawing tool with the engine.
182
+ * @param toolName - Unique identifier for the tool (e.g., 'brush', 'eraser').
183
+ * @param toolClass - Constructor class extending `KritzelBaseTool`.
184
+ * @param toolConfig - Optional initial configuration to apply to the tool instance.
185
+ * @returns The registered tool instance, or `null` if registration failed.
186
+ */
187
+ registerTool(toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig | KritzelLineToolConfig | KritzelShapeToolConfig): Promise<KritzelBaseTool | null>;
188
+ private activateTool;
189
+ /**
190
+ * Switches the active drawing tool by its registered name.
191
+ * @param toolName - The name the tool was registered with (e.g., 'brush', 'eraser').
192
+ */
193
+ changeActiveTool(toolName: string): Promise<void>;
194
+ /** Disables all user interaction with the engine (pointer, keyboard, etc.). */
195
+ disable(): Promise<void>;
196
+ /** Re-enables user interaction after a call to `disable()`. */
197
+ enable(): Promise<void>;
198
+ /** Deletes the currently selected objects from the canvas. */
199
+ delete(): Promise<void>;
200
+ /** Copies the currently selected objects to the internal clipboard. */
201
+ copy(): Promise<void>;
202
+ /** Cuts the currently selected objects to the internal clipboard (deletes them from the canvas). */
203
+ cut(): Promise<void>;
204
+ /**
205
+ * Pastes previously copied objects at the specified world coordinates.
206
+ * @param x - X position in world coordinates.
207
+ * @param y - Y position in world coordinates.
208
+ */
209
+ paste(x: number, y: number): Promise<void>;
210
+ /**
211
+ * Moves an object one layer forward in the z-order.
212
+ * @param object - The object to move. If omitted, applies to the current selection.
213
+ */
214
+ bringForward(object?: KritzelBaseObject<any>): Promise<void>;
215
+ /**
216
+ * Moves an object one layer backward in the z-order.
217
+ * @param object - The object to move. If omitted, applies to the current selection.
218
+ */
219
+ sendBackward(object?: KritzelBaseObject<any>): Promise<void>;
220
+ /**
221
+ * Moves an object to the very front of the z-order.
222
+ * @param object - The object to move. If omitted, applies to the current selection.
223
+ */
224
+ bringToFront(object?: KritzelBaseObject<any>): Promise<void>;
225
+ /**
226
+ * Moves an object to the very back of the z-order.
227
+ * @param object - The object to move. If omitted, applies to the current selection.
228
+ */
229
+ sendToBack(object?: KritzelBaseObject<any>): Promise<void>;
230
+ /**
231
+ * Aligns the currently selected objects according to the specified alignment.
232
+ * @param alignment - The alignment direction (e.g., `CenterHorizontal`, `StartVertical`).
233
+ */
234
+ alignObjects(alignment: KritzelAlignment): Promise<void>;
235
+ /** Groups the currently selected objects into a single selection group. */
236
+ group(): Promise<void>;
237
+ /** Ungroups the currently selected group back into individual objects. */
238
+ ungroup(): Promise<void>;
239
+ /** Undoes the last action. */
240
+ undo(): Promise<void>;
241
+ /** Redoes the last undone action. */
242
+ redo(): Promise<void>;
243
+ /** Hides the context menu and resets any associated selection state. */
244
+ hideContextMenu(): Promise<void>;
245
+ /**
246
+ * Programmatically opens the context menu at a specified world-coordinate position.
247
+ * If `objectId` is provided and found, the object context menu is shown for that object.
248
+ * If no `objectId` is provided but a selection group already exists, the object context menu is shown.
249
+ * Otherwise, the global context menu is shown.
250
+ * @param options.x - The X position in world (canvas) coordinates.
251
+ * @param options.y - The Y position in world (canvas) coordinates.
252
+ * @param options.objectId - Optional ID of an object to select and show the object context menu for.
253
+ */
254
+ openContextMenu(options: {
255
+ x: number;
256
+ y: number;
257
+ objectId?: string;
258
+ }): Promise<void>;
259
+ /**
260
+ * Retrieves a canvas object by its unique ID.
261
+ * @param id - The object's unique identifier.
262
+ * @returns The matching object, or `null` if not found.
263
+ */
264
+ getObjectById<T extends KritzelBaseObject>(id: string): Promise<T | null>;
265
+ /** Returns all objects on the canvas across all layers. */
266
+ getAllObjects<T extends KritzelBaseObject>(): Promise<T[]>;
267
+ /**
268
+ * Returns all objects that match the given predicate function.
269
+ * Excludes internal selection-related objects (selection groups and selection boxes).
270
+ * @param predicate - A filter function called for each object. Return `true` to include.
271
+ * @returns An array of matching objects.
272
+ *
273
+ * @example
274
+ * ```ts
275
+ * // Find all text objects
276
+ * const texts = await engine.findObjects(obj => obj.__class__ === 'KritzelText');
277
+ *
278
+ * // Find objects at a point
279
+ * const hits = await engine.findObjects(obj => obj.hitTest(100, 200));
280
+ *
281
+ * // Combine criteria
282
+ * const filtered = await engine.findObjects(obj => obj.__class__ === 'KritzelPath' && obj.opacity < 0.5);
283
+ * ```
284
+ */
285
+ findObjects<T extends KritzelBaseObject>(predicate: (obj: KritzelBaseObject<Element>) => boolean): Promise<T[]>;
286
+ /** Returns the total number of objects on the canvas. */
287
+ getObjectsTotalCount(): Promise<number>;
288
+ /**
289
+ * Adds a new object to the canvas. The object will be assigned an ID, core reference, and z-index automatically.
290
+ * @param object - The object instance to add.
291
+ * @returns The added object.
292
+ */
293
+ addObject<T extends KritzelBaseObject>(object: T): Promise<T | null>;
294
+ /**
295
+ * Adds multiple objects to the canvas in a single batch operation.
296
+ * All objects are inserted within one Yjs transaction (single undo step),
297
+ * triggering only one rerender cycle. Intended for programmatic streaming
298
+ * scenarios where per-object overhead would cause stutter.
299
+ * @param objects - The object instances to add.
300
+ * @returns The added objects.
301
+ */
302
+ addObjects<T extends KritzelBaseObject>(objects: T[]): Promise<T[]>;
303
+ /**
304
+ * Updates properties of an existing canvas object.
305
+ * @param object - The object to update.
306
+ * @param updatedProperties - A partial set of properties to apply.
307
+ * @returns The updated object.
308
+ */
309
+ updateObject<T extends KritzelBaseObject>(object: T, updatedProperties: Partial<T>): Promise<T | null>;
310
+ /**
311
+ * Removes an object from the canvas.
312
+ * @param object - The object to remove.
313
+ * @returns The removed object.
314
+ */
315
+ removeObject<T extends KritzelBaseObject>(object: T): Promise<T | null>;
316
+ /**
317
+ * Removes multiple objects from the canvas in a single batch operation.
318
+ * All removals happen within one Yjs transaction (single undo step),
319
+ * triggering only one rerender cycle. Intended for programmatic streaming
320
+ * scenarios where per-object overhead would cause stutter.
321
+ * @param objects - The objects to remove.
322
+ * @returns The removed objects.
323
+ */
324
+ removeObjects<T extends KritzelBaseObject>(objects: T[]): Promise<T[]>;
325
+ /** Returns the currently selected objects. Returns an empty array if nothing is selected. */
326
+ getSelectedObjects(): Promise<KritzelBaseObject<any>[]>;
327
+ /** Returns all registered keyboard shortcuts (without action/condition) for display in a help UI. */
328
+ getDisplayableShortcuts(): Promise<Omit<KritzelShortcut, 'action' | 'condition'>[]>;
329
+ /**
330
+ * Programmatically selects the given objects. Switches to the selection tool automatically.
331
+ * @param objects - The objects to select.
332
+ */
333
+ selectObjects(objects: KritzelBaseObject[]): Promise<void>;
334
+ /** Selects all objects currently visible in the viewport. Switches to the selection tool automatically. */
335
+ selectAllObjectsInViewport(): Promise<void>;
336
+ /** Deselects all currently selected objects. */
337
+ clearSelection(): Promise<void>;
338
+ /**
339
+ * Pans and zooms the viewport to center on the given object.
340
+ * @param object - The object to center in the viewport.
341
+ * @returns The centered object.
342
+ */
343
+ centerObjectInViewport(object: KritzelBaseObject): Promise<KritzelBaseObject<HTMLElement | SVGElement>>;
344
+ /**
345
+ * Pans the viewport to center on the given object without changing the zoom level.
346
+ * Unlike `centerObjectInViewport`, this moves the camera — not the object.
347
+ * @param object - The object whose center the viewport should pan to.
348
+ */
349
+ panToObject(object: KritzelBaseObject): Promise<void>;
350
+ /**
351
+ * Pans and zooms the viewport to fit the nearest content, with padding.
352
+ * Useful when the user has panned away from all objects.
353
+ * @returns `true` if content was found and the viewport was adjusted, `false` otherwise.
354
+ */
355
+ backToContent(): Promise<boolean>;
356
+ /**
357
+ * Pans and zooms the viewport to fit ALL objects on the canvas, including those not currently rendered.
358
+ * Calculates the combined bounding box of all objects and centers the viewport to show them.
359
+ * @param animate - Whether to animate the viewport transition (default: true).
360
+ * @returns `true` if objects were found and the viewport was adjusted, `false` otherwise.
361
+ */
362
+ centerAllObjects(animate?: boolean): Promise<boolean>;
363
+ /**
364
+ * Pans and zooms the viewport to fit the provided objects.
365
+ * Calculates the combined bounding box of the given objects and centers the viewport to show them.
366
+ * @param objects - The objects to center and fit in the viewport.
367
+ * @param animate - Whether to animate the viewport transition (default: true).
368
+ * @returns `true` if objects were provided and the viewport was adjusted, `false` otherwise.
369
+ */
370
+ centerObjects(objects: KritzelBaseObject[], animate?: boolean): Promise<boolean>;
371
+ /**
372
+ * Sets the viewport to center on the given world coordinates at the specified scale.
373
+ * @param x - X position in world coordinates to center on.
374
+ * @param y - Y position in world coordinates to center on.
375
+ * @param scale - Target scale level.
376
+ */
377
+ setViewport(x: number, y: number, scale: number): Promise<void>;
378
+ /**
379
+ * Pans the viewport to center on the given world coordinates without changing the scale.
380
+ * @param x - X position in world coordinates to center on.
381
+ * @param y - Y position in world coordinates to center on.
382
+ */
383
+ panTo(x: number, y: number): Promise<void>;
384
+ /**
385
+ * Zooms the viewport to the given scale level.
386
+ * Optionally centers on a world point; if omitted, zooms around the viewport center.
387
+ * @param scale - Target scale level.
388
+ * @param worldX - Optional X position in world coordinates to center on.
389
+ * @param worldY - Optional Y position in world coordinates to center on.
390
+ */
391
+ zoomTo(scale: number, worldX?: number, worldY?: number): Promise<void>;
392
+ /**
393
+ * Zooms in by a fixed step, centered on the current viewport center, with a smooth animation.
394
+ * @param factor - Multiplicative zoom-in step.
395
+ * @param duration - Animation duration in milliseconds.
396
+ */
397
+ zoomIn(factor: number, duration: number): Promise<void>;
398
+ /**
399
+ * Zooms out by a fixed step, centered on the current viewport center, with a smooth animation.
400
+ * @param factor - Multiplicative zoom-out step.
401
+ * @param duration - Animation duration in milliseconds.
402
+ */
403
+ zoomOut(factor: number, duration: number): Promise<void>;
404
+ /**
405
+ * Returns the current viewport state including position, scale, and dimensions.
406
+ * @returns The current viewport state.
407
+ */
408
+ getViewport(): Promise<KritzelViewportState>;
409
+ /**
410
+ * Converts screen-relative pixel coordinates to world coordinates.
411
+ * @param x - X position in screen pixels (relative to the engine element).
412
+ * @param y - Y position in screen pixels (relative to the engine element).
413
+ * @returns World coordinates { x, y }.
414
+ */
415
+ screenToWorld(x: number, y: number): Promise<{
416
+ x: number;
417
+ y: number;
418
+ }>;
419
+ /**
420
+ * Converts world coordinates to screen-relative pixel coordinates.
421
+ * @param x - X position in world coordinates.
422
+ * @param y - Y position in world coordinates.
423
+ * @returns Screen coordinates { x, y } relative to the engine element.
424
+ */
425
+ worldToScreen(x: number, y: number): Promise<{
426
+ x: number;
427
+ y: number;
428
+ }>;
429
+ /** Returns all objects currently visible within the viewport bounds. */
430
+ getObjectsInViewport(): Promise<KritzelBaseObject[]>;
431
+ /**
432
+ * Captures a screenshot of the current viewport as a data URL.
433
+ * @param format - The image format: `'png'` (default) or `'svg'`.
434
+ * @returns A data URL string of the captured image.
435
+ */
436
+ getScreenshot(format?: 'png' | 'svg'): Promise<string | null>;
437
+ /**
438
+ * Exports the current viewport as a PNG file and triggers a browser download.
439
+ */
440
+ exportViewportAsPng(): Promise<void>;
441
+ /**
442
+ * Exports the current viewport as an SVG file and triggers a browser download.
443
+ */
444
+ exportViewportAsSvg(): Promise<void>;
445
+ /**
446
+ * Returns export formats supported by the currently selected object.
447
+ * Only returns formats when exactly one object is selected.
448
+ */
449
+ getSelectedObjectSupportedExportFormats(): Promise<KritzelObjectExportFormat[]>;
450
+ /**
451
+ * Checks whether the currently selected object supports a specific export format.
452
+ * Returns false when none or multiple objects are selected.
453
+ */
454
+ canExportSelectedObjectAs(format: KritzelObjectExportFormat): Promise<boolean>;
455
+ /**
456
+ * Exports the currently selected object in the requested format and triggers a file download.
457
+ * Only supports single selection.
458
+ */
459
+ exportSelectedObject(format: KritzelObjectExportFormat): Promise<void>;
460
+ /**
461
+ * Exports the current workspace and all its objects as a JSON string.
462
+ * The exported data includes workspace metadata (id, name, viewport) and all canvas objects.
463
+ * @returns A JSON string representing the complete workspace state.
464
+ */
465
+ exportAsJson(): Promise<string>;
466
+ /**
467
+ * Imports a workspace from a JSON string into a new workspace.
468
+ * Creates a new workspace with the imported data and automatically switches to it.
469
+ * @param json - A JSON string containing workspace data (from exportAsJson).
470
+ * @throws Error if the JSON is invalid or the format version is incompatible.
471
+ */
472
+ importFromJson(json: string): Promise<void>;
473
+ /**
474
+ * Loads objects from a workspace JSON string into the current workspace.
475
+ * Unlike importFromJson, this does not create a new workspace - it adds objects to the existing one.
476
+ * Useful for initializing a workspace with pre-existing content after the editor is ready.
477
+ * @param json - A JSON string containing workspace data (from exportAsJson).
478
+ * @returns The number of objects loaded.
479
+ * @throws Error if the JSON is invalid or the format version is incompatible.
480
+ */
481
+ loadObjectsFromJson(json: string): Promise<number>;
482
+ private getWorkspaceExportMode;
483
+ private collectPortableAssets;
484
+ private restorePortableAssets;
485
+ private blobToDataUrl;
486
+ private dataUrlToBlob;
487
+ private triggerDataUrlDownload;
488
+ private getSingleSelectedExportableObject;
489
+ private getObjectExportContext;
490
+ private getObjectAsSvgMarkup;
491
+ private svgMarkupToDataUrl;
492
+ private svgMarkupToPngDataUrl;
493
+ private getImportedWorkspaceName;
494
+ private getImportedWorkspaceViewport;
495
+ /**
496
+ * Exports the current workspace as a JSON file and triggers a browser download.
497
+ * @param filename - Optional custom filename (without extension). Defaults to workspace name with timestamp.
498
+ */
499
+ downloadAsJson(filename?: string): Promise<void>;
500
+ /**
501
+ * Opens a file picker dialog and imports the selected JSON file into the workspace.
502
+ * This method creates a hidden file input, triggers the browser's file chooser,
503
+ * reads the selected JSON file, and imports it using importFromJson.
504
+ * @returns A promise that resolves when the import is complete or rejects on error/cancel.
505
+ */
506
+ importFromFile(): Promise<void>;
507
+ /** Cancels an active file picker opened by importFromFile. */
508
+ cancelImportFromFile(): Promise<void>;
509
+ /**
510
+ * Switches the active workspace in the engine by ID.
511
+ * @param id - The unique ID of the workspace to activate
512
+ */
513
+ setActiveWorkspace(id: string): Promise<void>;
514
+ /**
515
+ * Creates a new workspace and emits a `workspacesChange` event.
516
+ * Emits `activeWorkspaceChange` if the created workspace is activated.
517
+ * @param workspace - The workspace instance to create.
518
+ * @returns The created workspace.
519
+ */
520
+ createWorkspace(workspace: KritzelWorkspace): Promise<KritzelWorkspace | null>;
521
+ /**
522
+ * Applies a workspace as declared and emits a `workspacesChange` event.
523
+ * Metadata and viewport are always applied. When `workspace.objects` is set it is treated as the
524
+ * complete desired object set (`undefined` leaves objects untouched, `[]` removes them all);
525
+ * updating objects of a non-active workspace requires a configured sync provider.
526
+ * @param workspace - The workspace describing the desired state.
527
+ */
528
+ updateWorkspace(workspace: KritzelWorkspace): Promise<void>;
529
+ /**
530
+ * Deletes a workspace and emits a `workspacesChange` event.
531
+ * @param workspace - The workspace to delete.
532
+ */
533
+ deleteWorkspace(workspace: KritzelWorkspace): Promise<void>;
534
+ /** Returns all available workspaces. */
535
+ getWorkspaces(): Promise<KritzelWorkspace[]>;
536
+ /** Returns the currently active workspace. */
537
+ getActiveWorkspace(): Promise<KritzelWorkspace>;
538
+ /**
539
+ * Gets whether the active workspace is publicly accessible.
540
+ * @returns True if the workspace is public, false otherwise
541
+ */
542
+ getIsPublic(): Promise<boolean>;
543
+ /**
544
+ * Loads a shared workspace by token.
545
+ * If the workspace exists locally, it switches to it.
546
+ * If it doesn't exist, it adds it to the local workspaces list and then switches to it.
547
+ * @param token - The connection token identifying the shared workspace
548
+ */
549
+ loadSharedWorkspace(token: string): Promise<void>;
550
+ /**
551
+ * Reinitializes sync by performing a full teardown and re-initialization.
552
+ * Destroys the current Yjs documents and providers, then rebuilds everything
553
+ * from the current syncConfig. Data reloads from IndexedDB nearly instantly.
554
+ * Call this after updating the syncConfig prop (e.g. after authentication state changes).
555
+ */
556
+ reinitSync(): Promise<void>;
557
+ /**
558
+ * Persists the given settings object to localStorage using the namespaced storage key.
559
+ * @param settings - The settings configuration to persist.
560
+ */
561
+ saveSettings(settings: KritzelSettingsConfig): Promise<void>;
562
+ /**
563
+ * Loads the persisted settings object from localStorage.
564
+ * @returns The stored settings, or null if nothing is stored or the value is invalid.
565
+ */
566
+ loadSettings(): Promise<Partial<KritzelSettingsConfig> | null>;
567
+ /**
568
+ * Registers additional locale definitions (with optional partial term overrides).
569
+ * @param locales - The locale definitions to register.
570
+ */
571
+ registerLocales(locales: KritzelLocale[]): Promise<void>;
572
+ /**
573
+ * Declaratively configures the full locale catalog, replacing the available
574
+ * locale set. Pass `undefined` to restore the built-in locales (en/de/fr).
575
+ * @param locales - The full locale catalog, or `undefined` for built-ins.
576
+ */
577
+ configureLocales(locales?: KritzelLocale[]): Promise<void>;
578
+ /**
579
+ * Sets the active locale (language) and re-renders the UI.
580
+ * @param code - The locale code to activate, e.g. 'de'.
581
+ */
582
+ setLocale(code: LocaleCode): Promise<void>;
583
+ /**
584
+ * Gets the currently active locale code.
585
+ */
586
+ getLocale(): Promise<LocaleCode>;
587
+ /**
588
+ * Gets the list of available locale codes (built-in and registered).
589
+ */
590
+ getAvailableLocales(): Promise<LocaleCode[]>;
591
+ /**
592
+ * Gets the list of available locales as `{ code, label }` options for a selector.
593
+ */
594
+ getAvailableLocaleOptions(): Promise<{
595
+ code: LocaleCode;
596
+ label: string;
597
+ }[]>;
598
+ /**
599
+ * Resolves a term key to its translated string for the active locale.
600
+ * @param key - The term key to resolve.
601
+ * @param vars - Optional values for `{placeholder}` interpolation.
602
+ */
603
+ t(key: KritzelTermKey, vars?: KritzelTermVars): Promise<string>;
604
+ /**
605
+ * Resolves every known term key for the active locale into a flat map.
606
+ * Useful for UI layers that need to localize many strings at once.
607
+ */
608
+ getResolvedTerms(): Promise<Partial<Record<KritzelTermKey, string>>>;
609
+ core: KritzelCore;
610
+ viewport: KritzelViewport;
611
+ contextMenuHandler: KritzelContextMenuHandler;
612
+ keyHandler: KritzelKeyHandler;
613
+ private _lastHadSelectionGroup;
614
+ private _isViewportReady;
615
+ private _isYjsInitialized;
616
+ private _isAssetStorageInitialized;
617
+ private _isResolvingActiveWorkspaceId;
618
+ private _stateChangeListenersRegistered;
619
+ private _workspaceInitializationPromise;
620
+ private _workspaceInitializationTargetKey;
621
+ private _syncInitPromise;
622
+ private _syncConfigRevision;
623
+ private _assetStorageConfigRevision;
624
+ private _hasLoggedUnlicensedWelcomeBanner;
625
+ private _previousVisibleDynamicObjects;
626
+ private _revealedImageKeys;
627
+ private _sceneBootstrapOpacity;
628
+ private _sceneBootstrapTransitionEnabled;
629
+ private _sceneBootstrapTransitionTimer;
630
+ private readonly _defaultUndoState;
631
+ private setLoadingState;
632
+ private isNetworkAvailable;
633
+ private emitContextMenuStateChange;
634
+ private applyToolConfig;
635
+ private normalizeToolConfig;
636
+ private isTextToolConfig;
637
+ /** Built-in tool classes of this bundle keyed by their tool type. */
638
+ private static readonly BUILT_IN_TOOL_CLASSES;
639
+ /**
640
+ * Resolves a tool class to the internal built-in class when a foreign copy is passed.
641
+ * Classes from another compiled copy of the library (dual-package hazard, e.g. built-ins
642
+ * re-exported by a framework wrapper) would otherwise break `instanceof` checks.
643
+ */
644
+ private resolveToolClass;
645
+ get isSelecting(): boolean;
646
+ get isSelectionActive(): boolean;
647
+ constructor();
648
+ disconnectedCallback(): void;
649
+ componentWillLoad(): void;
650
+ componentDidLoad(): Promise<void>;
651
+ private initializeSyncAndWorkspace;
652
+ /**
653
+ * Initializes the asset storage layer with the latest config. Mirrors
654
+ * the in-flight replay logic of {@link doInitializeSyncAndWorkspace} for
655
+ * `assetStorageConfig` prop updates that arrive while init is running.
656
+ */
657
+ private initializeAssetStorage;
658
+ private logUnlicensedWelcomeBanner;
659
+ private doInitializeSyncAndWorkspace;
660
+ private initializeStartupWorkspace;
661
+ /**
662
+ * On a cold start the remote workspace list may still be in flight; creating a
663
+ * fallback workspace before it arrives would pollute the synced app state.
664
+ */
665
+ private waitForRemoteAppStateIfEmpty;
666
+ private resolveStartupWorkspace;
667
+ private ensureActiveWorkspaceIsVisible;
668
+ private reconcileProvidedWorkspaces;
669
+ private isWorkspaceCatalogControlled;
670
+ private getProvidedWorkspaces;
671
+ private getVisibleWorkspaces;
672
+ private findVisibleWorkspace;
673
+ private syncVisibleWorkspacesToState;
674
+ private hasWorkspaceMetadataChanged;
675
+ private cloneWorkspaceMetadata;
676
+ private tryResolveActiveWorkspaceFromId;
677
+ private switchToWorkspaceById;
678
+ private initializeWorkspaceIfNeeded;
679
+ emitObjectsChange(): void;
680
+ emitObjectsAdded(objects: KritzelBaseObject<any>[]): void;
681
+ emitObjectsRemoved(objects: KritzelBaseObject<any>[]): void;
682
+ emitObjectsUpdated(objects: {
683
+ object: KritzelBaseObject<any>;
684
+ changedProperties: string[];
685
+ }[]): void;
686
+ emitAwarenessChange(states: Map<number, Record<string, any>>): void;
687
+ emitObjectsInViewportChange(): void;
688
+ private _registerStateChangeListeners;
689
+ private _handleActiveToolChange;
690
+ private getObjectEffectiveOpacity;
691
+ private getSelectionHandleCapabilities;
692
+ private getImageRevealKey;
693
+ private shouldAnimateImageFirstReveal;
694
+ render(): any;
695
+ }