@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,66 @@
1
+ import { KritzelCore } from '../core/core.class';
2
+ /**
3
+ * Manages cursor state and updates across the application.
4
+ * Handles cursor changes based on handle hovers, tool states, and interactions.
5
+ */
6
+ export declare class KritzelCursorManager {
7
+ private readonly _core;
8
+ private _targetElement;
9
+ private _shadowRoot;
10
+ /**
11
+ * Creates a new KritzelCursorManager instance.
12
+ * @param core - The KritzelCore instance that provides access to the store and other core functionality.
13
+ */
14
+ constructor(core: KritzelCore);
15
+ /**
16
+ * Sets the target element where cursor styles will be applied.
17
+ * Resets any cursor styles on the previous target element before setting the new one.
18
+ * Also sets the `--kritzel-global-pointer-cursor` CSS variable for child components to use.
19
+ * @param element - The HTML element to apply cursor styles to, or null to clear the target.
20
+ */
21
+ setTargetElement(element: HTMLElement | null): void;
22
+ /**
23
+ * Gets the current cursor target element.
24
+ * @returns The HTML element where cursor styles are applied, or null if not set.
25
+ */
26
+ getTargetElement(): HTMLElement | null;
27
+ /**
28
+ * Sets the shadow root used for element detection in hover state calculations.
29
+ * Required for `elementsFromPoint()` to work within the shadow DOM.
30
+ * @param shadowRoot - The ShadowRoot instance of the component.
31
+ */
32
+ setShadowRoot(shadowRoot: ShadowRoot): void;
33
+ /**
34
+ * Resets cursor to default state by setting both icon and iconActive to 'default'.
35
+ * Should be called when all pointers are released to return to the standard cursor.
36
+ */
37
+ resetToDefault(): void;
38
+ /**
39
+ * Detects handle hover states using elementsFromPoint() to work with overlapped elements.
40
+ * This approach finds all elements at the pointer position instead of relying on pointerenter/pointerleave,
41
+ * which allows proper detection even when elements overlap.
42
+ *
43
+ * Updates the cursor state based on which handle type is being hovered:
44
+ * - Resize handle overlays: Sets a rotated vertical move cursor based on handle position and selection rotation.
45
+ * - Rotation handle overlays: Sets a hand cursor that changes to grab when active.
46
+ * - Line handle overlays: Sets a hand cursor that changes to grab when active.
47
+ * - No handle: Resets to default cursor.
48
+ *
49
+ * @param ev - The PointerEvent containing the cursor position (clientX, clientY).
50
+ */
51
+ updateHoverState(ev: PointerEvent): void;
52
+ /**
53
+ * Applies the current cursor state to the target element.
54
+ * Reads the cursor configuration from the store state and uses KritzelCursorHelper
55
+ * to generate the appropriate cursor value. Uses the active icon when pointer is down,
56
+ * otherwise uses the default icon.
57
+ * Should be called in the render loop to keep the cursor in sync with state.
58
+ */
59
+ applyCursor(): void;
60
+ /**
61
+ * Cleans up cursor state when the component is disconnected.
62
+ * Removes cursor styles and CSS custom properties from the target element,
63
+ * then clears all internal references to allow garbage collection.
64
+ */
65
+ cleanup(): void;
66
+ }
@@ -0,0 +1,147 @@
1
+ import { KritzelCore } from '../core/core.class';
2
+ /**
3
+ * Manages license validation state for the Kritzel editor.
4
+ *
5
+ * The manager is owned per {@link KritzelCore} instance (like the theme and
6
+ * localization managers) so that multiple editors on the same page validate
7
+ * independently.
8
+ *
9
+ * A license key is an offline Ed25519 signed token of the form
10
+ * `KRTZL1.<base64url(payload)>.<base64url(signature)>`. The library verifies it
11
+ * against the embedded {@link KRITZEL_LICENSE_PUBLIC_KEY}; only the owner can
12
+ * mint tokens, with the matching private key (see scripts/license/).
13
+ *
14
+ * Responsibilities:
15
+ * - Cheaply reject absent/malformed/expired keys synchronously so the watermark
16
+ * never flashes off for an obviously invalid key.
17
+ * - Verify the signature asynchronously via WebCrypto, then drive a rerender if
18
+ * the licensed state changed so the watermark is re-asserted on the reactive
19
+ * render path.
20
+ * - Periodically re-check on a randomized interval so the check is harder to
21
+ * stub out programmatically than a fixed `setInterval`. Re-checks reuse the
22
+ * cached verified token and only re-evaluate expiry, so crypto is not re-run
23
+ * on an unchanged key every tick.
24
+ *
25
+ * Failure semantics (fail open):
26
+ * - No key provided -> unlicensed (free tier, watermark shown). The normal
27
+ * default, not an error.
28
+ * - Key present but cleanly invalid (malformed, bad signature, expired) ->
29
+ * unlicensed.
30
+ * - Key present but validation throws an *unexpected* internal error, or the
31
+ * runtime lacks Ed25519 support in WebCrypto -> fail open and treat as
32
+ * licensed so a library defect or old browser never breaks a paying
33
+ * customer's app.
34
+ */
35
+ export declare class KritzelLicenseManager {
36
+ private readonly _core;
37
+ /** The most recently provided license key, re-checked on each periodic tick. */
38
+ private _licenseKey?;
39
+ /** Cached result of the latest validation. */
40
+ private _isLicensed;
41
+ /**
42
+ * The token whose signature most recently verified successfully. Lets the
43
+ * periodic re-check skip crypto and only re-evaluate expiry while the key is
44
+ * unchanged.
45
+ */
46
+ private _verifiedToken?;
47
+ /**
48
+ * Monotonic id incremented on every {@link validate} call. An in-flight async
49
+ * verification only commits its result if its id still matches, so a stale
50
+ * verification resolving after a newer call can never clobber fresh state.
51
+ */
52
+ private _validationId;
53
+ /** Cached imported public key, lazily created on first signature check. */
54
+ private _publicKeyPromise?;
55
+ /** Handle for the self-rescheduling re-validation timer. */
56
+ private _timer;
57
+ /**
58
+ * Creates a new KritzelLicenseManager instance.
59
+ * @param core - The KritzelCore instance this manager belongs to
60
+ */
61
+ constructor(core: KritzelCore);
62
+ /**
63
+ * Whether the editor is currently considered licensed (watermark hidden).
64
+ */
65
+ get isLicensed(): boolean;
66
+ /**
67
+ * Validates the given license key.
68
+ *
69
+ * Runs a synchronous structural pre-check first: an absent, malformed, or
70
+ * already-expired key resolves the state immediately (no async work). A
71
+ * structurally valid key then has its signature verified asynchronously; the
72
+ * licensed state is committed (and a rerender triggered) only if it changed.
73
+ *
74
+ * The return value reflects the state known *synchronously* at call time. The
75
+ * authoritative result for a structurally valid key arrives shortly after via
76
+ * the async verification and the reactive rerender.
77
+ *
78
+ * @param key - The license key to validate, or undefined to clear the license
79
+ * @returns The licensed state known synchronously at call time
80
+ */
81
+ validate(key?: string): boolean;
82
+ /**
83
+ * Starts periodic re-validation on a randomized interval between
84
+ * {@link MIN_REVALIDATION_DELAY_MS} and {@link MAX_REVALIDATION_DELAY_MS}.
85
+ *
86
+ * Uses a self-rescheduling `setTimeout` (a fresh random delay each cycle)
87
+ * rather than a fixed `setInterval`, making the check fractionally harder to
88
+ * predict and no-op programmatically. Any existing timer is cleared first so
89
+ * the method is idempotent.
90
+ */
91
+ startPeriodicValidation(): void;
92
+ /**
93
+ * Stops periodic re-validation and releases the timer.
94
+ */
95
+ stopPeriodicValidation(): void;
96
+ /**
97
+ * Cleanup hook called when the editor is torn down.
98
+ */
99
+ destroy(): void;
100
+ /**
101
+ * Commits a new licensed state, triggering a rerender only when it changed.
102
+ * The {@link validationId} guard is checked by async callers; synchronous
103
+ * callers pass the current id.
104
+ */
105
+ private commit;
106
+ /**
107
+ * Schedules the next re-validation tick at a randomized delay.
108
+ */
109
+ private scheduleNextValidation;
110
+ /**
111
+ * Returns a random delay within the configured re-validation window.
112
+ */
113
+ private getRandomRevalidationDelay;
114
+ /**
115
+ * Synchronous structural pre-check of a license key: verifies the format
116
+ * prefix, three-part structure, JSON payload, and (if present) that the token
117
+ * has not expired. Does not verify the signature.
118
+ *
119
+ * @returns `rejected` for absent/malformed/expired keys, or `pass` with the
120
+ * parsed segments and claims for a structurally valid, unexpired token.
121
+ */
122
+ private preCheck;
123
+ /** Returns the normalized current hostname, or null when unavailable/invalid. */
124
+ private getCurrentHostname;
125
+ /** Normalizes and validates the allowed domains claim. */
126
+ private normalizeAllowedDomains;
127
+ /** Normalizes a domain and rejects malformed hostnames. */
128
+ private normalizeDomain;
129
+ /**
130
+ * Verifies the Ed25519 signature of the token against the embedded public
131
+ * key. Resolves true/false for a definitive valid/invalid signature.
132
+ *
133
+ * Rejects (rather than resolving false) on unexpected crypto failures or when
134
+ * the runtime lacks Ed25519 support, so the caller fails open.
135
+ */
136
+ private verifySignature;
137
+ /**
138
+ * Imports and caches the embedded Ed25519 public key for signature checks.
139
+ */
140
+ private getPublicKey;
141
+ /** Decodes a base64url string to its UTF-8 text. */
142
+ private base64UrlToString;
143
+ /** Decodes a base64url string to raw bytes. */
144
+ private base64UrlToBytes;
145
+ /** Encodes a string to its UTF-8 bytes. */
146
+ private utf8Bytes;
147
+ }
@@ -0,0 +1,145 @@
1
+ import { KritzelCore } from '../core/core.class';
2
+ import { KritzelLocale, KritzelTermKey, KritzelTermVars, LocaleCode } from '../../interfaces/localization.interface';
3
+ /**
4
+ * Manages localization state and term resolution across the Kritzel editor.
5
+ *
6
+ * The manager is owned per {@link KritzelCore} instance (like the theme manager)
7
+ * so that multiple editors on the same page can use different languages in
8
+ * isolation.
9
+ *
10
+ * Term resolution follows a deterministic fallback chain for each key:
11
+ * 1. active locale's custom terms
12
+ * 2. active locale's built-in terms
13
+ * 3. fallback locale's custom terms
14
+ * 4. fallback locale's built-in terms
15
+ * 5. the key itself (last resort)
16
+ *
17
+ * Persistence of the selected locale is handled by the KritzelSettings
18
+ * component; this manager only reads the stored value.
19
+ */
20
+ export declare class KritzelLocalizationManager {
21
+ private readonly _core;
22
+ private readonly _storageKey;
23
+ /** Built-in locale definitions, keyed by locale code. */
24
+ private readonly _builtinLocales;
25
+ /** Consumer-registered locale definitions, keyed by locale code. */
26
+ private readonly _customLocales;
27
+ private _currentLocale;
28
+ private _fallbackLocale;
29
+ /** Whether the consumer explicitly configured a locale catalog (even an empty one) via `configureLocales`. */
30
+ private _explicitLocales;
31
+ /**
32
+ * Creates a new KritzelLocalizationManager instance.
33
+ * Seeds the built-in locales and initializes the current locale from the
34
+ * settings object in localStorage (or the default locale).
35
+ *
36
+ * @param core - The KritzelCore instance this manager belongs to
37
+ */
38
+ constructor(core: KritzelCore);
39
+ /**
40
+ * Gets the currently active locale code.
41
+ */
42
+ get currentLocale(): LocaleCode;
43
+ /**
44
+ * Gets the fallback locale code used when a term is missing from the active locale.
45
+ */
46
+ get fallbackLocale(): LocaleCode;
47
+ /**
48
+ * Sets the fallback locale code used when a term is missing from the active locale.
49
+ *
50
+ * @param code - The fallback locale code
51
+ */
52
+ setFallbackLocale(code: LocaleCode): void;
53
+ /**
54
+ * Registers consumer-provided locale definitions. Definitions are merged by
55
+ * code; registering the same code again replaces the previous definition.
56
+ * A registered locale may provide a partial set of terms — missing terms are
57
+ * resolved through the fallback chain.
58
+ *
59
+ * @param locales - The locale definitions to register
60
+ */
61
+ registerLocales(locales: KritzelLocale[]): void;
62
+ /**
63
+ * Declaratively configures the full locale catalog, replacing any previously
64
+ * configured or registered custom locales. Unlike {@link registerLocales},
65
+ * this determines which locales are considered "available" (e.g. for a
66
+ * settings selector): passing `undefined` restores the built-in set
67
+ * (en/de/fr); passing an array (even empty) makes that array's codes the
68
+ * exclusive available set, falling back to `en` only if the array is empty.
69
+ * Built-in term fallback for missing keys is unaffected either way.
70
+ *
71
+ * @param locales - The full locale catalog, or `undefined` to use built-ins
72
+ */
73
+ configureLocales(locales?: KritzelLocale[]): void;
74
+ /**
75
+ * Resolves the locale code that should actually be activated, falling back
76
+ * to the first available locale when the requested one isn't available.
77
+ *
78
+ * @param requested - The locale code the consumer asked to activate
79
+ */
80
+ resolveActiveLocale(requested: LocaleCode): LocaleCode;
81
+ /**
82
+ * Sets the active locale and triggers a re-render so UI strings update.
83
+ *
84
+ * @param code - The locale code to activate
85
+ */
86
+ setLocale(code: LocaleCode): void;
87
+ /**
88
+ * Gets the list of available locale codes. When a locale catalog was
89
+ * explicitly configured via {@link configureLocales}, only those codes are
90
+ * returned (or `[DEFAULT_LOCALE]` if the catalog is empty); otherwise the
91
+ * built-in and registered codes are combined.
92
+ */
93
+ getAvailableLocales(): LocaleCode[];
94
+ /**
95
+ * Gets the available locales as `{ code, label }` pairs for use in a selector.
96
+ * A registered locale's label takes precedence over the built-in label; the
97
+ * code is used as the label when none is provided.
98
+ */
99
+ getAvailableLocaleOptions(): {
100
+ code: LocaleCode;
101
+ label: string;
102
+ }[];
103
+ /**
104
+ * Gets the display label for a locale code, falling back to the code itself.
105
+ *
106
+ * @param code - The locale code
107
+ */
108
+ getLocaleLabel(code: LocaleCode): string;
109
+ /**
110
+ * Resolves a term key to its translated string for the active locale and
111
+ * interpolates any `{placeholder}` tokens.
112
+ *
113
+ * @param key - The term key to resolve
114
+ * @param vars - Optional values for `{placeholder}` interpolation
115
+ * @returns The translated, interpolated string (or the key if unresolved)
116
+ *
117
+ * @example
118
+ * manager.translate('menu.copy'); // 'Copy'
119
+ * manager.translate('share.expires', { date: '5/1' }); // 'Expires 5/1'
120
+ */
121
+ translate(key: KritzelTermKey, vars?: KritzelTermVars): string;
122
+ /**
123
+ * Resolves every known term key for the active locale into a flat map.
124
+ *
125
+ * The key set is the union of all keys defined across the built-in and
126
+ * registered locales, so consumer-added keys are included. Each value is
127
+ * resolved through the same fallback chain as {@link translate} (without
128
+ * interpolation, since these are shared, variable-free UI labels).
129
+ *
130
+ * @returns A map of every term key to its resolved string for the active locale
131
+ */
132
+ getAllTerms(): Partial<Record<KritzelTermKey, string>>;
133
+ /**
134
+ * Reads the stored locale from the settings object in localStorage using this
135
+ * instance's namespaced key.
136
+ *
137
+ * @returns The stored locale code if valid, or the default locale
138
+ */
139
+ getStoredLocale(): LocaleCode;
140
+ /**
141
+ * Cleans up the localization manager state.
142
+ * Provided for lifecycle parity with other managers.
143
+ */
144
+ cleanup(): void;
145
+ }
@@ -0,0 +1,112 @@
1
+ import { KritzelTheme, ThemeName } from '../../interfaces/theme.interface';
2
+ import { KritzelCore } from '../core/core.class';
3
+ /**
4
+ * Manages theme state and application across the Kritzel editor.
5
+ * Reads the persisted theme from the settings object in localStorage but does not write to it.
6
+ * Persistence is handled exclusively by the KritzelSettings component.
7
+ *
8
+ * The theme manager is responsible for:
9
+ * - Reading the stored theme preference from the settings object
10
+ * - Applying CSS custom properties to target elements
11
+ * - Switching between light and dark themes at runtime
12
+ */
13
+ export declare class KritzelThemeManager {
14
+ private readonly _core;
15
+ private _currentTheme;
16
+ private _targetElement;
17
+ private readonly _storageKey;
18
+ private _themeRegistry;
19
+ /**
20
+ * Creates a new KritzelThemeManager instance.
21
+ * Initializes the current theme from the settings object in localStorage or uses the default theme.
22
+ *
23
+ * @param core - The KritzelCore instance this manager belongs to
24
+ */
25
+ constructor(core: KritzelCore);
26
+ /**
27
+ * Gets the current active theme name.
28
+ *
29
+ * @returns The name of the currently active theme ('light' or 'dark')
30
+ */
31
+ get currentTheme(): ThemeName;
32
+ /**
33
+ * Sets the target element where theme CSS variables will be applied.
34
+ * If an element is provided, the current theme is immediately applied to it.
35
+ *
36
+ * @param element - The HTML element to apply theme styles to, or null to clear
37
+ */
38
+ setTargetElement(element: HTMLElement | null): void;
39
+ /**
40
+ * Gets the current target element where theme CSS variables are applied.
41
+ *
42
+ * @returns The current target HTML element, or null if none is set
43
+ */
44
+ getTargetElement(): HTMLElement | null;
45
+ /**
46
+ * Gets the theme configuration object by its name.
47
+ * Falls back to the first registered theme if the requested name is not found.
48
+ *
49
+ * @param themeName - The name of the theme to retrieve
50
+ * @returns The KritzelTheme object containing all theme CSS variable values
51
+ */
52
+ getThemeByName(themeName: ThemeName): KritzelTheme;
53
+ /**
54
+ * Registers the provided themes to this theme manager instance.
55
+ *
56
+ * @param themes - The complete list of themes to make available
57
+ */
58
+ registerThemes(themes: KritzelTheme[]): void;
59
+ /**
60
+ * Pre-emptively applies the stored theme's CSS variables to the closest editor or document.
61
+ * This prevents a "Flash of Unstyled Content" (FOUC) while Stencil web components are hydrating.
62
+ *
63
+ * @param element - The HTML element to apply the theme to
64
+ */
65
+ injectThemeEarly(element?: HTMLElement): void;
66
+ /**
67
+ * Gets all registered themes.
68
+ *
69
+ * @returns An array of all registered theme objects
70
+ */
71
+ getAllThemes(): KritzelTheme[];
72
+ /**
73
+ * Gets the stored theme name from the settings object in localStorage using this instance's namespaced key.
74
+ *
75
+ * @returns The stored theme name if valid, or 'light' as the default
76
+ */
77
+ getStoredTheme(): ThemeName;
78
+ /**
79
+ * Gets the stored theme from the default (non-namespaced) settings object in localStorage.
80
+ * Used by static utility helpers that don't have access to a core instance.
81
+ *
82
+ * @returns The stored theme name if valid, or 'light' as the default
83
+ */
84
+ static getStoredTheme(): ThemeName;
85
+ /**
86
+ * Sets the current theme and applies it to the target element.
87
+ * Does not persist the theme — persistence is handled by the KritzelSettings component.
88
+ *
89
+ * @param themeName - The theme name to set ('light' or 'dark')
90
+ */
91
+ setTheme(themeName: ThemeName): void;
92
+ /**
93
+ * Checks if the current theme is the dark theme.
94
+ *
95
+ * @returns True if the current theme is 'dark', false otherwise
96
+ */
97
+ isDarkTheme(): boolean;
98
+ /**
99
+ * Applies a theme to the target element by setting CSS custom properties.
100
+ * Uses the ThemeHelper utility to automatically derive CSS variable names
101
+ * from the theme interface structure and apply them to the element's style.
102
+ * Does nothing if no target element is set.
103
+ *
104
+ * @param themeName - The name of the theme to apply ('light' or 'dark')
105
+ */
106
+ applyTheme(themeName: ThemeName): void;
107
+ /**
108
+ * Cleans up the theme manager state by clearing the target element reference.
109
+ * Should be called when the manager is no longer needed to prevent memory leaks.
110
+ */
111
+ cleanup(): void;
112
+ }