@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,21 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './p-BU9Mv7y0.js';
2
+ export { s as setNonce } from './p-BU9Mv7y0.js';
3
+ import { g as globalScripts } from './p-DQuL1Twl.js';
4
+
5
+ /*
6
+ Stencil Client Patch Browser v4.44.2 | MIT Licensed | https://stenciljs.com
7
+ */
8
+
9
+ var patchBrowser = () => {
10
+ const importMeta = import.meta.url;
11
+ const opts = {};
12
+ if (importMeta !== "") {
13
+ opts.resourcesUrl = new URL(".", importMeta).href;
14
+ }
15
+ return promiseResolve(opts);
16
+ };
17
+
18
+ patchBrowser().then(async (options) => {
19
+ await globalScripts();
20
+ return bootstrapLazy([["p-f0a8b7af",[[513,"kritzel-engine",{"workspaces":[16],"editorId":[1,"editor-id"],"activeWorkspaceId":[1,"active-workspace-id"],"syncConfig":[16],"assetStorageConfig":[16],"user":[16],"globalContextMenuItems":[16],"objectContextMenuItems":[16],"scaleMax":[1026,"scale-max"],"scaleMin":[1026,"scale-min"],"cursorTarget":[16],"lockDrawingScale":[4,"lock-drawing-scale"],"theme":[1],"licenseKey":[1,"license-key"],"themes":[16],"locale":[1],"locales":[16],"fallbackLocale":[1,"fallback-locale"],"viewportBoundaryLeft":[2,"viewport-boundary-left"],"viewportBoundaryRight":[2,"viewport-boundary-right"],"viewportBoundaryTop":[2,"viewport-boundary-top"],"viewportBoundaryBottom":[2,"viewport-boundary-bottom"],"debugInfo":[16],"isPanningEnabled":[4,"is-panning-enabled"],"isZoomingEnabled":[4,"is-zooming-enabled"],"forceUpdate":[32],"triggerSelectionChange":[64],"beginSceneBootstrap":[64],"endSceneBootstrap":[64],"registerTool":[64],"changeActiveTool":[64],"disable":[64],"enable":[64],"delete":[64],"copy":[64],"cut":[64],"paste":[64],"bringForward":[64],"sendBackward":[64],"bringToFront":[64],"sendToBack":[64],"alignObjects":[64],"group":[64],"ungroup":[64],"undo":[64],"redo":[64],"hideContextMenu":[64],"openContextMenu":[64],"getObjectById":[64],"getAllObjects":[64],"findObjects":[64],"getObjectsTotalCount":[64],"addObject":[64],"addObjects":[64],"updateObject":[64],"removeObject":[64],"removeObjects":[64],"getSelectedObjects":[64],"getDisplayableShortcuts":[64],"selectObjects":[64],"selectAllObjectsInViewport":[64],"clearSelection":[64],"centerObjectInViewport":[64],"panToObject":[64],"backToContent":[64],"centerAllObjects":[64],"centerObjects":[64],"setViewport":[64],"panTo":[64],"zoomTo":[64],"zoomIn":[64],"zoomOut":[64],"getViewport":[64],"screenToWorld":[64],"worldToScreen":[64],"getObjectsInViewport":[64],"getScreenshot":[64],"exportViewportAsPng":[64],"exportViewportAsSvg":[64],"getSelectedObjectSupportedExportFormats":[64],"canExportSelectedObjectAs":[64],"exportSelectedObject":[64],"exportAsJson":[64],"importFromJson":[64],"loadObjectsFromJson":[64],"downloadAsJson":[64],"importFromFile":[64],"cancelImportFromFile":[64],"setActiveWorkspace":[64],"createWorkspace":[64],"updateWorkspace":[64],"deleteWorkspace":[64],"getWorkspaces":[64],"getActiveWorkspace":[64],"getIsPublic":[64],"loadSharedWorkspace":[64],"reinitSync":[64],"saveSettings":[64],"loadSettings":[64],"registerLocales":[64],"configureLocales":[64],"setLocale":[64],"getLocale":[64],"getAvailableLocales":[64],"getAvailableLocaleOptions":[64],"t":[64],"getResolvedTerms":[64]},[[1,"wheel","handleWheel"],[0,"pointerdown","handlePointerDown"],[0,"pointermove","handlePointerMove"],[0,"pointerup","handlePointerUp"],[0,"pointercancel","handlePointerCancel"],[1,"pointerleave","handlePointerLeave"],[1,"longpress","handleLongPress"],[0,"contextmenu","handleContextMenu"],[9,"resize","handleResize"],[8,"keydown","handleKeyDown"],[8,"keyup","handleKeyUp"],[8,"copy","handleCopy"],[8,"cut","handleCut"],[8,"paste","handlePaste"],[4,"dblclick","preventDoubleTapZoomOnTouchDevices"]],{"workspaces":[{"onWorkspacesPropChange":0}],"activeWorkspaceId":[{"onActiveWorkspaceIdChange":0}],"syncConfig":[{"onSyncConfigChange":0}],"assetStorageConfig":[{"onAssetStorageConfigChange":0}],"user":[{"onUserChange":0}],"globalContextMenuItems":[{"onGlobalContextMenuItemsChange":0}],"objectContextMenuItems":[{"onObjectContextMenuItemsChange":0}],"scaleMax":[{"validateScaleMax":0}],"scaleMin":[{"validateScaleMin":0}],"cursorTarget":[{"onCursorTargetChange":0}],"lockDrawingScale":[{"onLockDrawingScaleChange":0}],"theme":[{"onThemeChange":0}],"licenseKey":[{"onLicenseKeyChange":0}],"themes":[{"onThemesChange":0}],"locale":[{"onLocaleChange":0}],"locales":[{"onLocalesChange":0}],"fallbackLocale":[{"onFallbackLocaleChange":0}],"viewportBoundaryLeft":[{"onViewportBoundaryLeftChange":0}],"viewportBoundaryRight":[{"onViewportBoundaryRightChange":0}],"viewportBoundaryTop":[{"onViewportBoundaryTopChange":0}],"viewportBoundaryBottom":[{"onViewportBoundaryBottomChange":0}],"debugInfo":[{"onDebugInfoChange":0}]}],[513,"kritzel-awareness-cursors",{"core":[16],"showEdgeIndicators":[4,"show-edge-indicators"],"edgeIndicatorPadding":[2,"edge-indicator-padding"],"remoteCursors":[32],"objectVersion":[32]}],[513,"kritzel-cursor-trail",{"core":[16],"cursorTrailPoints":[32],"isLeftButtonDown":[32]},[[9,"pointerdown","handleMouseDown"],[9,"pointermove","handlePointerMove"],[9,"pointerup","handlePointerUp"]]],[513,"kritzel-icon",{"name":[1],"label":[1],"size":[2]}],[513,"kritzel-watermark",{"core":[16],"label":[1]}]]]], options);
21
+ });
@@ -0,0 +1,532 @@
1
+ import { KritzelEngine } from '../../components/kritzel-engine/kritzel-engine';
2
+ import { KritzelAlignment } from '../../enums/alignment.enum';
3
+ import { KritzelBaseObject } from '../objects/base-object.class';
4
+ import { KritzelSelectionGroup } from '../objects/selection-group.class';
5
+ import { KritzelToolRegistry } from '../registries/tool.registry';
6
+ import { KritzelStore } from './store.class';
7
+ import { KritzelWorkspace } from './workspace.class';
8
+ import { KritzelSyncConfig } from '../../interfaces/sync-config.interface';
9
+ import { KritzelAssetStorageConfig } from '../../interfaces/asset-storage-config.interface';
10
+ import { KritzelAssetResolver } from '../providers/assets/asset-resolver.class';
11
+ import { KritzelAppStateMap } from '../structures/app-state-map.structure';
12
+ import { KritzelAnchorManager } from '../managers/anchor.manager';
13
+ import { KritzelCursorManager } from '../managers/cursor.manager';
14
+ import { KritzelThemeManager } from '../managers/theme.manager';
15
+ import { KritzelLocalizationManager } from '../managers/localization.manager';
16
+ import { KritzelLicenseManager } from '../managers/license.manager';
17
+ import { KritzelBrowserPermissionManager } from '../managers/browser-permission.manager';
18
+ import { KritzelClipboardManager } from '../managers/clipboard.manager';
19
+ import { IKritzelUser } from '../../interfaces/user.interface';
20
+ interface InitializeWorkspaceOptions {
21
+ /**
22
+ * When true, no fallback workspace will be created if there is no provided workspace,
23
+ * no last active workspace, and no recent workspace.
24
+ */
25
+ skipFallbackCreation?: boolean;
26
+ }
27
+ /** Objects affected by reconciling a workspace's declared object set. */
28
+ export interface KritzelWorkspaceObjectsDiff {
29
+ added: KritzelBaseObject<any>[];
30
+ updated: KritzelBaseObject<any>[];
31
+ removed: KritzelBaseObject<any>[];
32
+ }
33
+ /**
34
+ * Central orchestrator class for the Kritzel canvas system.
35
+ * Manages workspaces, objects, selection, clipboard operations, and coordinates
36
+ * between the engine, store, and various managers.
37
+ */
38
+ export declare class KritzelCore {
39
+ /** The underlying Kritzel engine component */
40
+ private readonly _kritzelEngine;
41
+ /** State management store */
42
+ private readonly _store;
43
+ /** Optional sync configuration for collaborative features */
44
+ private _syncConfig?;
45
+ /** Optional asset storage configuration for image / binary payloads */
46
+ private _assetStorageConfig?;
47
+ /** Resolves and stores binary assets referenced by canvas objects */
48
+ private readonly _assetResolver;
49
+ /** App state map for persistent workspace storage */
50
+ private readonly _appStateMap;
51
+ /** Manager for line anchor points and connections */
52
+ private readonly _anchorManager;
53
+ /** Manager for cursor states and appearance */
54
+ private readonly _cursorManager;
55
+ /** Manager for theme styling */
56
+ private readonly _themeManager;
57
+ /** Manager for localization / translated UI strings */
58
+ private readonly _localizationManager;
59
+ /** Manager for license validation and watermark gating */
60
+ private readonly _licenseManager;
61
+ /** Manager for browser permission checks and permission prompts */
62
+ private readonly _permissionManager;
63
+ /** Manager for clipboard copy/cut/paste orchestration */
64
+ private readonly _clipboardManager;
65
+ /** Per-core registry of drawing tools (one instance per editor). */
66
+ private readonly _toolRegistry;
67
+ /** Optional unique identifier for namespacing storage keys across multiple editor instances */
68
+ private _editorId?;
69
+ /** Current user for awareness broadcasting */
70
+ private _user?;
71
+ /**
72
+ * Gets the Kritzel engine instance.
73
+ * @returns The KritzelEngine managing rendering and events
74
+ */
75
+ get engine(): KritzelEngine;
76
+ /**
77
+ * Gets the state store instance.
78
+ * @returns The KritzelStore managing application state
79
+ */
80
+ get store(): KritzelStore;
81
+ /**
82
+ * Gets the app state map for workspace persistence.
83
+ * @returns The KritzelAppStateMap for storing workspace data
84
+ */
85
+ get appStateMap(): KritzelAppStateMap;
86
+ /**
87
+ * Gets the anchor manager for line connections.
88
+ * @returns The KritzelAnchorManager for managing line anchors
89
+ */
90
+ get anchorManager(): KritzelAnchorManager;
91
+ /**
92
+ * Gets the cursor manager.
93
+ * @returns The KritzelCursorManager for managing cursor states
94
+ */
95
+ get cursorManager(): KritzelCursorManager;
96
+ /**
97
+ * Gets the theme manager.
98
+ * @returns The KritzelThemeManager for managing visual themes
99
+ */
100
+ get themeManager(): KritzelThemeManager;
101
+ /**
102
+ * Gets the localization manager.
103
+ * @returns The KritzelLocalizationManager for resolving translated UI strings
104
+ */
105
+ get localizationManager(): KritzelLocalizationManager;
106
+ /**
107
+ * Gets the license manager.
108
+ * @returns The KritzelLicenseManager for validating licenses and gating the watermark
109
+ */
110
+ get licenseManager(): KritzelLicenseManager;
111
+ /**
112
+ * Gets the browser permission manager.
113
+ * @returns The KritzelBrowserPermissionManager for browser permission checks and requests
114
+ */
115
+ get permissionManager(): KritzelBrowserPermissionManager;
116
+ /**
117
+ * Gets the tool registry scoped to this core instance.
118
+ * @returns The KritzelToolRegistry owned by this core
119
+ */
120
+ get toolRegistry(): KritzelToolRegistry;
121
+ /**
122
+ * Gets the clipboard manager scoped to this core instance.
123
+ * @returns The KritzelClipboardManager owned by this core
124
+ */
125
+ get clipboardManager(): KritzelClipboardManager;
126
+ /**
127
+ * Gets the editor ID used for namespacing storage keys.
128
+ * @returns The editor ID or undefined if not set
129
+ */
130
+ get editorId(): string | undefined;
131
+ /**
132
+ * Builds a namespaced storage key.
133
+ * When editorId is set, appends it after the base prefix:
134
+ * e.g. 'kritzel-settings' → 'kritzel-settings-homepage'
135
+ * @param base - The base key name (e.g. 'kritzel-settings')
136
+ * @returns The namespaced key
137
+ */
138
+ getStorageKey(base: string): string;
139
+ /**
140
+ * Gets the current user.
141
+ */
142
+ get user(): IKritzelUser | undefined;
143
+ /**
144
+ * Sets the current user and propagates to the active object map's awareness.
145
+ */
146
+ setUser(user?: IKritzelUser): void;
147
+ /**
148
+ * Creates a new KritzelCore instance.
149
+ * Initializes the store with default configuration and sets up all managers.
150
+ * @param kritzelEngine - The KritzelEngine component to orchestrate
151
+ * @param editorId - Optional unique identifier for namespacing storage keys
152
+ */
153
+ constructor(kritzelEngine: KritzelEngine, editorId?: string);
154
+ /**
155
+ * Gets the asset resolver responsible for storing and resolving
156
+ * binary payloads (images, etc.) referenced by canvas objects.
157
+ */
158
+ get assetResolver(): KritzelAssetResolver;
159
+ /**
160
+ * Sets the synchronization configuration for collaborative features.
161
+ * @param config - The sync configuration or undefined to disable sync
162
+ */
163
+ setSyncConfig(config?: KritzelSyncConfig): void;
164
+ /**
165
+ * Sets the asset storage configuration used for image / binary payloads.
166
+ * Takes effect on the next `initializeYjs` call (or on explicit
167
+ * `initializeAssets` if invoked directly).
168
+ */
169
+ setAssetStorageConfig(config?: KritzelAssetStorageConfig): void;
170
+ /**
171
+ * Sets the editor ID for namespacing storage keys.
172
+ * Must be called before any storage initialization (e.g., in componentWillLoad).
173
+ * Re-initializes the theme manager to pick up the new storage key.
174
+ * @param editorId - The unique identifier for this editor instance
175
+ */
176
+ setEditorId(editorId?: string): void;
177
+ /**
178
+ * Initializes the Yjs document for collaborative editing.
179
+ * Sets up the app state map with the current sync configuration.
180
+ *
181
+ * Asset storage is initialized separately via {@link initializeAssetStorage}
182
+ * so that it can be deferred until the `assetStorageConfig` prop arrives,
183
+ * mirroring the lazy-init pattern used for sync config.
184
+ */
185
+ initializeYjs(): Promise<void>;
186
+ /**
187
+ * Initializes the asset storage layer with the current asset storage
188
+ * configuration. Safe to call multiple times: subsequent calls are
189
+ * no-ops because {@link KritzelAssetResolver.init} is idempotent.
190
+ * To apply a new configuration after initialization, destroy the
191
+ * resolver first or use {@link KritzelEngine.reinitSync}.
192
+ */
193
+ initializeAssetStorage(): Promise<void>;
194
+ /**
195
+ * Emits a single warning when the sync config declares at least one
196
+ * network provider but the asset storage config has none. In that
197
+ * scenario images added on this device will not be available to
198
+ * other devices, yielding a broken cross-device experience.
199
+ */
200
+ private warnIfAssetStorageMismatched;
201
+ /**
202
+ * Load all workspaces from app state map
203
+ */
204
+ private loadWorkspacesFromAppState;
205
+ /**
206
+ * Save a workspace to app state map
207
+ */
208
+ private saveWorkspaceToAppState;
209
+ /**
210
+ * Delete a workspace from app state map
211
+ */
212
+ private deleteWorkspaceFromAppState;
213
+ /**
214
+ * Initializes or switches to a workspace.
215
+ * Handles workspace loading from app state, localStorage preferences,
216
+ * viewport state restoration, and ObjectMap initialization.
217
+ * @param workspace - Optional workspace to switch to; if not provided, uses last active or most recent
218
+ * @param options - Optional initialization behavior flags
219
+ */
220
+ initializeWorkspace(workspace?: KritzelWorkspace, options?: InitializeWorkspaceOptions): Promise<void>;
221
+ private seedWorkspaceObjects;
222
+ /**
223
+ * Mirrors engine.addObject() runtime initialization for consumer-constructed objects.
224
+ */
225
+ private prepareObjectForWorkspace;
226
+ /**
227
+ * Applies `desiredObjects` as the complete object set of an object map.
228
+ * Objects are matched by ID: unknown IDs are added, known IDs are updated (replacing the live
229
+ * instance when a different one is passed), and objects absent from the list are removed.
230
+ * @param objectsMap - The map to reconcile
231
+ * @param workspaceId - The workspace the objects belong to
232
+ * @param desiredObjects - The desired object set
233
+ * @param nextZIndex - Supplies the z-index for newly added objects
234
+ * @param scaleFallback - Scale applied to objects that do not define one
235
+ * @returns The objects that were added, updated and removed
236
+ */
237
+ private reconcileWorkspaceObjects;
238
+ /**
239
+ * Releases runtime resources held by an object that is about to leave the canvas.
240
+ * Unlike removeObject() this never cascades into group children, so the reconciled
241
+ * object set stays exactly what the caller declared.
242
+ */
243
+ private detachObject;
244
+ /**
245
+ * Returns the next free z-index within an object map.
246
+ */
247
+ private nextZIndexOf;
248
+ /**
249
+ * Loads a shared workspace by token.
250
+ * If the workspace exists locally, it switches to it.
251
+ * If it doesn't exist, it adds it to the local workspaces list and then switches to it.
252
+ * @param token - The connection token identifying the shared workspace
253
+ */
254
+ loadSharedWorkspace(token: string): Promise<void>;
255
+ /**
256
+ * Gets all objects currently visible within the viewport bounds.
257
+ * Excludes selection-related objects and sorts by z-index.
258
+ * @returns Array of visible objects sorted by z-index ascending
259
+ */
260
+ getObjectsInViewport(): KritzelBaseObject<any>[];
261
+ /**
262
+ * Forces a rerender of the engine component.
263
+ * Increments forceUpdate counter to trigger Stencil's reactivity.
264
+ */
265
+ rerender(): void;
266
+ /**
267
+ * Finds an object in the store by its unique identifier.
268
+ * @param id - The unique ID of the object to find
269
+ * @returns The found object or null if not found
270
+ */
271
+ findObjectById(id: string): KritzelBaseObject<any> | null;
272
+ /**
273
+ * Gets all workspaces from the app state map.
274
+ * @returns Array of all available workspaces
275
+ */
276
+ getWorkspaces(): KritzelWorkspace[];
277
+ /**
278
+ * Switches the active workspace in the editor by ID.
279
+ * @param workspaceId - The unique ID of the workspace to activate
280
+ */
281
+ setActiveWorkspace(workspaceId: string): Promise<void>;
282
+ /**
283
+ * Creates a new workspace and saves it to the app state.
284
+ * @param workspace - The workspace instance to create
285
+ * @returns The created workspace instance
286
+ */
287
+ createWorkspace(workspace: KritzelWorkspace): Promise<KritzelWorkspace>;
288
+ /**
289
+ * Applies a workspace as declared: metadata, viewport, and — when `workspace.objects` is set —
290
+ * the complete object set. A `undefined` object list leaves existing objects untouched, an empty
291
+ * list removes them all. Objects of non-active workspaces are written through a background
292
+ * object map and therefore require a configured sync provider.
293
+ * @param workspace - The workspace describing the desired state
294
+ * @returns The object changes that were applied, or null if objects were not touched
295
+ */
296
+ updateWorkspace(workspace: KritzelWorkspace): Promise<KritzelWorkspaceObjectsDiff | null>;
297
+ /**
298
+ * Moves the live viewport to the workspace's declared viewport.
299
+ * Compared against the persisted viewport rather than the live one, so a workspace that was
300
+ * read and passed back unchanged (e.g. a rename) never snaps the canvas.
301
+ */
302
+ private applyWorkspaceViewport;
303
+ private applyObjectsToActiveWorkspace;
304
+ /**
305
+ * Applies objects to a workspace that is not currently open by loading its document into a
306
+ * background object map, reconciling, and disposing it again.
307
+ */
308
+ private applyObjectsToInactiveWorkspace;
309
+ /**
310
+ * Deletes a workspace and its associated data.
311
+ * Handles cleanup of active workspace ObjectMap if deleting the current workspace.
312
+ * Also deletes the workspace's IndexedDB database.
313
+ * @param workspace - The workspace to delete
314
+ */
315
+ deleteWorkspace(workspace: KritzelWorkspace): void;
316
+ /**
317
+ * Persists the current viewport state to the active workspace.
318
+ * Converts screen-space translate values to device-independent world-space center coordinates.
319
+ * Validates that the workspace still exists before saving.
320
+ * @param translateX - The X translation of the viewport
321
+ * @param translateY - The Y translation of the viewport
322
+ * @param scale - The zoom scale of the viewport
323
+ */
324
+ updateWorkspaceViewport(translateX: number, translateY: number, scale: number): void;
325
+ /**
326
+ * Gets whether the active workspace is publicly accessible.
327
+ * @returns True if the workspace is public, false otherwise
328
+ */
329
+ getIsPublic(): boolean;
330
+ /**
331
+ * Adds an object to the current workspace's object map.
332
+ * @param object - The object to add to the canvas
333
+ */
334
+ addObject(object: KritzelBaseObject<any>): void;
335
+ /**
336
+ * Removes an object from the workspace.
337
+ * Handles recursive deletion of group children (unless preserved),
338
+ * cleans up line anchors, and removes from the object map.
339
+ * @param object - The object to remove
340
+ * @param preserveChildren - If true and object is a group, children are kept; defaults to false
341
+ */
342
+ removeObject(object: KritzelBaseObject<any>, preserveChildren?: boolean): void;
343
+ /**
344
+ * Updates properties on an object and persists the changes.
345
+ * Calls the object's onAfterUpdate hook with changed property keys.
346
+ * @typeParam T - The type of the object being updated
347
+ * @param object - The object to update
348
+ * @param updatedProperties - Partial object containing properties to update
349
+ */
350
+ updateObject<T extends KritzelBaseObject<any>>(object: T, updatedProperties: Partial<T>): void;
351
+ /**
352
+ * Adds a selection group to the canvas.
353
+ * Removes any existing selection group and selection box first.
354
+ * Triggers the selection change event.
355
+ * @param selectionGroup - The selection group to add
356
+ */
357
+ addSelectionGroup(selectionGroup: KritzelSelectionGroup): void;
358
+ /**
359
+ * Returns whether the provided selection group belongs to the local user context.
360
+ * Local groups are either explicitly owned by the current user or have no user ID.
361
+ */
362
+ private isLocalSelectionGroup;
363
+ /**
364
+ * Applies deselection teardown side effects to a selection group before removal.
365
+ */
366
+ private teardownSelectionGroup;
367
+ /**
368
+ * Removes all local selection groups from the store, including orphaned groups
369
+ * that are no longer referenced by store.selectionGroup.
370
+ * @returns True when at least one local selection group was removed
371
+ */
372
+ private removeLocalSelectionGroups;
373
+ /**
374
+ * Removes the current selection group from the canvas.
375
+ * Clears the cached reference and triggers the selection change event.
376
+ */
377
+ removeSelectionGroup(): void;
378
+ /**
379
+ * Removes the current selection box from the canvas.
380
+ * Clears the cached reference.
381
+ */
382
+ removeSelectionBox(): void;
383
+ /**
384
+ * Deselects all objects by removing the selection group.
385
+ * Triggers a rerender.
386
+ */
387
+ deselectAllObjects(): void;
388
+ /**
389
+ * Deletes all objects in the current selection group.
390
+ * Removes the selection group and emits viewport change event.
391
+ */
392
+ delete(): void;
393
+ /**
394
+ * Undoes the last action in the history stack.
395
+ */
396
+ undo(): void;
397
+ /**
398
+ * Redoes the last undone action from the history stack.
399
+ */
400
+ redo(): void;
401
+ /**
402
+ * Deletes a specific object by its ID.
403
+ * Emits viewport change event and triggers rerender.
404
+ * @param id - The unique ID of the object to delete
405
+ */
406
+ deleteObject(id: string): void;
407
+ /**
408
+ * Moves objects one step forward in the z-order stack.
409
+ * @param object - Optional specific object to move; defaults to all selected objects
410
+ */
411
+ bringForward(object?: KritzelBaseObject<any>): void;
412
+ /**
413
+ * Moves objects one step backward in the z-order stack.
414
+ * @param object - Optional specific object to move; defaults to all selected objects
415
+ */
416
+ sendBackward(object?: KritzelBaseObject<any>): void;
417
+ /**
418
+ * Moves objects to the very front of the z-order stack.
419
+ * @param object - Optional specific object to move; defaults to all selected objects
420
+ */
421
+ bringToFront(object?: KritzelBaseObject<any>): void;
422
+ /**
423
+ * Moves objects to the very back of the z-order stack.
424
+ * @param object - Optional specific object to move; defaults to all selected objects
425
+ */
426
+ sendToBack(object?: KritzelBaseObject<any>): void;
427
+ /**
428
+ * Aligns objects within the current selection group based on the specified alignment type.
429
+ * Requires at least 2 objects to be selected.
430
+ * @param alignment The alignment type to apply
431
+ */
432
+ alignObjects(alignment: KritzelAlignment): void;
433
+ /**
434
+ * Groups the currently selected objects into a KritzelGroup.
435
+ * Requires at least 2 objects to be selected.
436
+ */
437
+ group(): void;
438
+ /**
439
+ * Ungroups any KritzelGroup objects in the current selection.
440
+ * Children are extracted and become top-level objects.
441
+ */
442
+ ungroup(): void;
443
+ /**
444
+ * Creates a selection from the given objects.
445
+ * Clears existing selection, creates a selection group, and marks objects as selected.
446
+ * @param objects - Array of objects to select; no-op if empty
447
+ */
448
+ selectObjects(objects: KritzelBaseObject<any>[]): void;
449
+ /**
450
+ * Selects all objects in the workspace.
451
+ * Excludes selection-related objects.
452
+ * Switches to selection tool.
453
+ */
454
+ selectAllObjects(): void;
455
+ /**
456
+ * Selects all objects currently visible in the viewport.
457
+ * Excludes selection-related objects.
458
+ * Switches to selection tool.
459
+ */
460
+ selectAllObjectsInViewport(): void;
461
+ /**
462
+ * Clears all selection state.
463
+ * Removes selection group and box, resets selection-related flags.
464
+ */
465
+ clearSelection(): void;
466
+ /**
467
+ * Resets the active text object.
468
+ * Deletes empty text objects or saves non-empty ones.
469
+ */
470
+ resetActiveText(): void;
471
+ /**
472
+ * Resets the active shape object by saving it.
473
+ */
474
+ resetActiveShape(): void;
475
+ /**
476
+ * Gets the topmost object at a pointer event location that matches a selector.
477
+ * Performs hit testing to verify the object is actually under the pointer.
478
+ * @param event - The pointer event with client coordinates
479
+ * @param selector - CSS selector to match elements; defaults to '.object'
480
+ * @returns The matched object or null if none found or hit test fails
481
+ */
482
+ getObjectFromPointerEvent(event: PointerEvent, selector?: string): KritzelBaseObject<any> | null;
483
+ /**
484
+ * Gets all objects at a pointer event location that match a selector.
485
+ * Returns objects sorted by z-index (highest first) for proper layering.
486
+ * @param event - The pointer event with client coordinates
487
+ * @param selector - CSS selector to match elements; defaults to '.object'
488
+ * @returns Array of matched objects sorted by z-index descending
489
+ */
490
+ getObjectsFromPointerEvent(event: PointerEvent, selector?: string): KritzelBaseObject<any>[];
491
+ /**
492
+ * Get all elements at a pointer position that match a given selector.
493
+ * Uses elementsFromPoint to find overlapped elements.
494
+ */
495
+ getElementsAtPoint(event: PointerEvent, selector: string): Element[];
496
+ /**
497
+ * Check if any element at the pointer position matches the given selector.
498
+ * Useful for detecting hover states on overlapped elements.
499
+ */
500
+ isPointerOverElement(event: PointerEvent, selector: string): boolean;
501
+ /**
502
+ * Converts a pointer event to canvas (world) coordinates.
503
+ * Accounts for host element offset and viewport transform.
504
+ * @param event - The pointer event with client coordinates
505
+ * @returns Object with x and y in canvas coordinates
506
+ */
507
+ getCanvasPoint(event: PointerEvent): {
508
+ x: number;
509
+ y: number;
510
+ };
511
+ /**
512
+ * Prepares the engine for a workspace change.
513
+ * Cancels pending viewport updates, saves current viewport state,
514
+ * resets active text, clears selection, and switches to selection tool.
515
+ */
516
+ beforeWorkspaceChange(): void;
517
+ /**
518
+ * Determines whether to display the selection group UI for an object.
519
+ * Hides UI for single KritzelLine selections (they have their own UI).
520
+ * @param object - The object to check
521
+ * @returns True if selection group UI should be displayed
522
+ */
523
+ displaySelectionGroupUI(object: KritzelBaseObject<any>): boolean;
524
+ /**
525
+ * Determines whether to display the line-specific selection UI for an object.
526
+ * Shows line UI only for single KritzelLine selections.
527
+ * @param object - The object to check
528
+ * @returns True if line selection UI should be displayed
529
+ */
530
+ displaySelectionLineUI(object: KritzelBaseObject<any>): boolean;
531
+ }
532
+ export {};
@@ -0,0 +1,32 @@
1
+ import type { KritzelCore } from "./core.class";
2
+ /**
3
+ * Handles deserialization/revival of Kritzel objects from plain JavaScript objects.
4
+ * This class uses a pattern similar to JSON.parse reviver to reconstruct class instances
5
+ * from their serialized representations, preserving the object's prototype chain and methods.
6
+ */
7
+ export declare class KritzelReviver {
8
+ /** Reference to the KritzelCore instance for creating objects */
9
+ private readonly _core;
10
+ /**
11
+ * Creates a new KritzelReviver instance.
12
+ * @param core - The KritzelCore instance used to create revived objects
13
+ */
14
+ constructor(core: KritzelCore);
15
+ /**
16
+ * Recursively revives a plain JavaScript object (or array) into typed Kritzel instances.
17
+ * Uses the `__class__` property to determine the correct class to instantiate.
18
+ * Objects without `__class__` are recursively processed to revive nested objects.
19
+ *
20
+ * Supported classes:
21
+ * - Objects: KritzelPath, KritzelLine, KritzelText, KritzelShape, KritzelImage,
22
+ * KritzelDynamicObject, KritzelSelectionGroup, KritzelGroup
23
+ * - Workspace: KritzelWorkspace
24
+ * - Tools: KritzelBrushTool, KritzelEraserTool, KritzelImageTool, KritzelSelectionTool,
25
+ * KritzelTextTool, KritzelLineTool, KritzelShapeTool
26
+ *
27
+ * @typeParam T - The expected return type after revival
28
+ * @param obj - The plain object to revive, typically from JSON deserialization
29
+ * @returns The revived object with proper class instances, or the original value if not an object
30
+ */
31
+ revive<T>(obj: any): T;
32
+ }