@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,246 @@
1
+ import { KritzelCore } from '../core/core.class';
2
+ import { KritzelAssetLoadState } from '../../interfaces/asset.interface';
3
+ import { KritzelBaseObject } from './base-object.class';
4
+ import { KritzelObjectExportContext, KritzelObjectExportFormat } from '../../interfaces/object-export.interface';
5
+ /**
6
+ * Configuration options for creating a KritzelImage instance.
7
+ */
8
+ export interface KritzelImageConfig {
9
+ assetId?: string;
10
+ mimeType?: string;
11
+ src?: string;
12
+ x?: number;
13
+ y?: number;
14
+ translateX?: number;
15
+ translateY?: number;
16
+ rotation?: number;
17
+ scale?: number;
18
+ width?: number;
19
+ height?: number;
20
+ maxWidth?: number;
21
+ maxHeight?: number;
22
+ maxLoadAttempts?: number;
23
+ }
24
+ /**
25
+ * Represents an image object on the canvas.
26
+ *
27
+ * Image bytes are NOT stored on this object or inside the Yjs document.
28
+ * Instead, the image is identified by a stable `assetId`; the actual
29
+ * bytes live in the asset storage layer (see `KritzelAssetResolver`).
30
+ * This keeps the CRDT small and lets images be served from pluggable
31
+ * storage (IndexedDB, HTTP, pre-signed S3, ...).
32
+ *
33
+ * Legacy images persisted before the asset layer existed may still carry
34
+ * a `src` data URL; the renderer and migration path treat `src` as a
35
+ * read-only fallback that is upgraded to an `assetId` on first load.
36
+ */
37
+ export declare class KritzelImage extends KritzelBaseObject<HTMLImageElement> {
38
+ __class__: string;
39
+ /**
40
+ * Stable asset identifier (uuid) persisted in the Yjs document.
41
+ * Used by the asset resolver to locate the image bytes across
42
+ * devices and storage backends.
43
+ */
44
+ assetId: string;
45
+ /**
46
+ * MIME type of the referenced asset (e.g. `image/png`). Persisted in
47
+ * the Yjs document alongside `assetId` so the renderer can hint
48
+ * browsers and the exporter can produce correct data URLs.
49
+ */
50
+ mimeType: string;
51
+ /**
52
+ * Legacy inline source (typically a `data:` URL). Preserved only for
53
+ * backward compatibility with documents that were created before the
54
+ * asset storage layer existed. New images should use `assetId`.
55
+ *
56
+ * @deprecated Use `assetId` with an asset storage provider instead.
57
+ */
58
+ src: string;
59
+ maxWidth: number;
60
+ maxHeight: number;
61
+ maxCompressionSize: number;
62
+ /**
63
+ * URL resolved from the asset storage layer (e.g. a `blob:` or https URL).
64
+ * Not serialized into the Yjs document.
65
+ */
66
+ resolvedSrc?: string;
67
+ /**
68
+ * Current load state for the referenced asset.
69
+ * Not serialized into the Yjs document.
70
+ */
71
+ loadState: KritzelAssetLoadState;
72
+ /**
73
+ * Maximum number of resolution attempts per page load before the
74
+ * image is considered permanently failed. Defaults to 3.
75
+ *
76
+ * Only attempts that fail with a definitive "asset not found"
77
+ * (i.e. {@link AssetNotFoundError}) consume this budget. Transient
78
+ * failures (network blips, remote temporarily unreachable) do not
79
+ * count against the budget; they are bounded by
80
+ * {@link maxTransientRetryDurationMs} instead.
81
+ *
82
+ * The counter is transient (not persisted to Yjs) and resets every
83
+ * time a fresh `KritzelImage` instance is constructed, so a full page
84
+ * reload always grants a fresh budget.
85
+ */
86
+ maxLoadAttempts: number;
87
+ /**
88
+ * Number of resolution attempts that have failed with a definitive
89
+ * "asset not found" so far for the current page load. Only updates
90
+ * for {@link AssetNotFoundError} rejections; transient failures do
91
+ * not increment this counter. Not serialized into the Yjs document.
92
+ */
93
+ loadAttempts: number;
94
+ /**
95
+ * Maximum wall-clock duration (in milliseconds) the image will keep
96
+ * retrying transient resolution failures before giving up and
97
+ * surfacing the error placeholder. Defaults to 30 seconds.
98
+ *
99
+ * This bound exists so that a permanently-broken backend eventually
100
+ * surfaces UX feedback even when failures look "transient" (and
101
+ * therefore do not consume {@link maxLoadAttempts}).
102
+ */
103
+ maxTransientRetryDurationMs: number;
104
+ /**
105
+ * Wall-clock timestamp (ms since epoch) of the first transient
106
+ * failure in the current retry chain. `null` when no transient
107
+ * retries are in flight. Reset on success and on definitive miss.
108
+ * Not serialized into the Yjs document.
109
+ */
110
+ transientRetryStartedAt: number | null;
111
+ /**
112
+ * Creates a new KritzelImage instance.
113
+ * @param config - Optional configuration object to initialize image properties
114
+ * including assetId, src, position (x, y), translation, and scale.
115
+ */
116
+ constructor(config?: KritzelImageConfig);
117
+ /**
118
+ * Factory method to create a new KritzelImage instance with core integration.
119
+ * Initializes the image with default values and links it to the core store.
120
+ * @param core - The KritzelCore instance providing access to store and state management.
121
+ * @returns A new KritzelImage instance configured with the core context.
122
+ */
123
+ static create(core: KritzelCore, config?: Partial<KritzelImage>): KritzelImage;
124
+ /**
125
+ * Resizes the image while maintaining aspect ratio based on the new height.
126
+ * Updates the image's position and dimensions, then syncs changes to y.js
127
+ * for collaborative editing support.
128
+ * @param x - The new x translation coordinate.
129
+ * @param y - The new y translation coordinate.
130
+ * @param width - The new width (used for validation, not directly applied).
131
+ * @param height - The new height used to calculate the scale factor.
132
+ */
133
+ resize(x: number, y: number, width: number, height: number): void;
134
+ /**
135
+ * Serializes the image, excluding transient rendering state so the
136
+ * Yjs document never persists blob URLs or load lifecycle flags.
137
+ */
138
+ serialize(): any;
139
+ /**
140
+ * Carries transient asset-loading state (resolved URL, load lifecycle,
141
+ * retry counters) over from the previous local instance when a remote
142
+ * Yjs update produces a freshly-revived replacement. Without this,
143
+ * frequent remote updates (e.g. another user dragging the image)
144
+ * would reset `loadState` to `'idle'` on every tick and cause the
145
+ * skeleton to flicker between renders.
146
+ */
147
+ adoptTransientStateFrom(previous: KritzelBaseObject<any>): void;
148
+ /**
149
+ * Triggers (idempotent) resolution of the referenced asset. Updates
150
+ * `resolvedSrc` and `loadState` as the resolution progresses and
151
+ * schedules a re-render when the URL is available.
152
+ *
153
+ * Failure handling distinguishes two cases:
154
+ * - Definitive miss ({@link AssetNotFoundError}): consumes one slot
155
+ * of the {@link maxLoadAttempts} budget. Once exhausted, the
156
+ * image is marked permanently `'error'` for the remainder of the
157
+ * page load to avoid hammering an unavailable backend; a full
158
+ * reload (which constructs a fresh instance) grants a new budget.
159
+ * - Transient failure (network blip, resolver init in flight, ...):
160
+ * does NOT consume the attempt budget. Retries continue with the
161
+ * same exponential backoff up to
162
+ * {@link maxTransientRetryDurationMs} of wall-clock time, after
163
+ * which the image is marked `'error'`.
164
+ */
165
+ ensureResolved(): void;
166
+ /**
167
+ * Schedules a retry of {@link ensureResolved} with a small exponential
168
+ * backoff. The backoff base is the current attempt index so successive
169
+ * definitive misses ramp up gradually.
170
+ */
171
+ private scheduleRetry;
172
+ /**
173
+ * One-shot migration for legacy images that were persisted with an
174
+ * inline `src` data URL. Uploads the bytes to the asset resolver and
175
+ * swaps the image to use the resulting `assetId`, clearing `src` so
176
+ * the Yjs document no longer carries the raw payload.
177
+ */
178
+ private migrateLegacyDataUrlIfNeeded;
179
+ /**
180
+ * Kicks off asset resolution (or legacy data-URL migration) without
181
+ * requiring the `<img>` element to be mounted. Safe to call multiple
182
+ * times; both underlying paths are idempotent.
183
+ *
184
+ * Useful for the renderer's loading-skeleton path, where the actual
185
+ * `<img>` is not in the DOM yet but the asset bytes still need to
186
+ * start loading.
187
+ */
188
+ ensureLoaded(): void;
189
+ /**
190
+ * Prepares image objects for insertion into the canvas while preserving
191
+ * the standard object-first flow (`new KritzelImage(...); addObject(image)`).
192
+ *
193
+ * Behavior:
194
+ * - If `assetId` is already set, no-op.
195
+ * - If `src` is set (URL or data URL), uploads bytes through the asset
196
+ * resolver, fills `assetId`/`mimeType`, computes dimensions when needed,
197
+ * and seeds `resolvedSrc` for immediate rendering.
198
+ */
199
+ prepareForInsert(): Promise<void>;
200
+ /**
201
+ * Measures intrinsic image dimensions from a Blob.
202
+ */
203
+ private measureImageBlob;
204
+ /**
205
+ * Overrides base mount to kick off asset resolution the first time
206
+ * the image is attached to the DOM. Legacy images persisted with an
207
+ * inline `src` data URL are opportunistically migrated to the asset
208
+ * storage layer on first mount.
209
+ */
210
+ mount(element: HTMLImageElement): void;
211
+ /**
212
+ * Creates a KritzelImage from a URL, handling image loading and dimension calculation.
213
+ * Loads the image, calculates scaled dimensions respecting maxWidth/maxHeight constraints,
214
+ * and returns a fully configured KritzelImage instance.
215
+ *
216
+ * Intended for legacy / data-URL code paths only. New callers should
217
+ * upload through the asset resolver and construct the image from the
218
+ * resulting asset descriptor.
219
+ * @param src - The image URL or data URI to load.
220
+ * @param config - Optional partial configuration to pass to the KritzelImage constructor.
221
+ * @returns A promise resolving to a fully configured KritzelImage with correct dimensions.
222
+ */
223
+ static fromUrl(src: string, config?: Partial<KritzelImage>): Promise<KritzelImage>;
224
+ /**
225
+ * Creates a fully initialized KritzelImage from a Blob.
226
+ * Uploads the blob via the asset resolver and sets up dimensions/asset references.
227
+ *
228
+ * @param core - The KritzelCore instance providing the asset resolver and state.
229
+ * @param blob - The image Blob (e.g. from clipboard or file picker).
230
+ * @param config - Optional configuration to merge into the new image.
231
+ * @returns A promise resolving to a fully loaded KritzelImage object.
232
+ */
233
+ static fromBlob(core: KritzelCore, blob: Blob, config?: Partial<KritzelImage>): Promise<KritzelImage>;
234
+ /**
235
+ * Calculates scaled dimensions for an image while respecting maxWidth and maxHeight constraints.
236
+ * Maintains the original aspect ratio by using the smaller of the two scale ratios.
237
+ * @param img - The HTMLImageElement to calculate dimensions for.
238
+ * @returns An object containing the scaled width and height values.
239
+ */
240
+ calculateScaledDimensions(img: HTMLImageElement): {
241
+ scaledWidth: number;
242
+ scaledHeight: number;
243
+ };
244
+ getSupportedExportFormats(): KritzelObjectExportFormat[];
245
+ exportAs(format: KritzelObjectExportFormat, context: KritzelObjectExportContext): Promise<string | null>;
246
+ }
@@ -0,0 +1,285 @@
1
+ import { KritzelBaseObject } from './base-object.class';
2
+ import { KritzelPolygon } from '../../interfaces/polygon.interface';
3
+ import { KritzelCore } from '../core/core.class';
4
+ import { LineAnchor } from '../../interfaces/anchor.interface';
5
+ import { ArrowHeadStyle, LineArrowConfig } from '../../interfaces/arrow-head.interface';
6
+ import { ThemeAwareColor } from '../../constants/color-palette.constants';
7
+ /**
8
+ * Configuration options for creating a KritzelLine instance.
9
+ */
10
+ export interface KritzelLineConfig {
11
+ startX: number;
12
+ startY: number;
13
+ endX: number;
14
+ endY: number;
15
+ controlX?: number;
16
+ controlY?: number;
17
+ translateX?: number;
18
+ translateY?: number;
19
+ /** Rotation in degrees at initialization time. */
20
+ rotation?: number;
21
+ scale?: number;
22
+ stroke?: ThemeAwareColor;
23
+ strokeWidth?: number;
24
+ opacity?: number;
25
+ /** Anchor connection for the start point */
26
+ startAnchor?: LineAnchor;
27
+ /** Anchor connection for the end point */
28
+ endAnchor?: LineAnchor;
29
+ /** Arrow head configuration for start and end of line */
30
+ arrows?: LineArrowConfig;
31
+ }
32
+ export declare class KritzelLine extends KritzelBaseObject<SVGElement> {
33
+ __class__: string;
34
+ startX: number;
35
+ startY: number;
36
+ endX: number;
37
+ endY: number;
38
+ controlX?: number;
39
+ controlY?: number;
40
+ stroke: ThemeAwareColor;
41
+ strokeWidth: number;
42
+ scale: number;
43
+ options: KritzelLineConfig | undefined;
44
+ /** Anchor connection for the start point of the line */
45
+ startAnchor?: LineAnchor;
46
+ /** Anchor connection for the end point of the line */
47
+ endAnchor?: LineAnchor;
48
+ /** Arrow head configuration for start and end of line */
49
+ arrows?: LineArrowConfig;
50
+ isVisible: boolean;
51
+ isDebugInfoVisible: boolean;
52
+ isCompleted: boolean;
53
+ /** Cached adjusted points for hit testing, accounting for rotation and translation */
54
+ private _adjustedPoints?;
55
+ /** Cached clip information for anchored line endpoints */
56
+ private _clipInfo;
57
+ /**
58
+ * Generates the SVG path data string for the line.
59
+ * Returns a quadratic Bezier curve path if control point exists, otherwise a straight line.
60
+ * @returns SVG path data string in the format "M x y Q cx cy ex ey" or "M x y L ex ey"
61
+ */
62
+ get d(): string;
63
+ /**
64
+ * Generates the SVG viewBox attribute string for rendering the line.
65
+ * @returns ViewBox string in the format "x y width height"
66
+ */
67
+ get viewBox(): string;
68
+ /**
69
+ * Creates a new KritzelLine instance.
70
+ * @param config - Optional configuration options for the line including start/end points,
71
+ * control point for curves, stroke settings, anchors, and arrow configuration
72
+ */
73
+ constructor(config?: KritzelLineConfig);
74
+ /**
75
+ * Factory method to create a new KritzelLine with a core reference and unique ID.
76
+ * This is the preferred way to create lines that will be managed by the core.
77
+ * @param core - The KritzelCore instance that will manage this line
78
+ * @param options - Optional configuration options for the line
79
+ * @returns A fully initialized KritzelLine instance with generated ID and workspace assignment
80
+ */
81
+ static create(core: KritzelCore, options?: KritzelLineConfig): KritzelLine;
82
+ /**
83
+ * Resizes the line to fit within the specified dimensions.
84
+ * Scales both endpoints and control point proportionally, then repositions the line.
85
+ * @param x - New X position for the line (or null to keep current)
86
+ * @param y - New Y position for the line (or null to keep current)
87
+ * @param width - New width to scale the line to (must be > 1)
88
+ * @param height - New height to scale the line to (must be > 1)
89
+ */
90
+ resize(x: number | null, y: number | null, width: number, height: number): void;
91
+ /**
92
+ * Sets the rotation angle of the line around its center.
93
+ * Invalidates cached adjusted points and clip info.
94
+ * @param value - Rotation angle in radians
95
+ */
96
+ rotate(value: number): void;
97
+ /**
98
+ * Moves the line by calculating the delta between start and end positions.
99
+ * Updates anchored objects if the line has anchor connections.
100
+ * @param startX - Starting X position of the drag in screen coordinates
101
+ * @param startY - Starting Y position of the drag in screen coordinates
102
+ * @param endX - Ending X position of the drag in screen coordinates
103
+ * @param endY - Ending Y position of the drag in screen coordinates
104
+ */
105
+ move(startX: number, startY: number, endX: number, endY: number): void;
106
+ /**
107
+ * Tests if a point intersects with the line within the stroke tolerance.
108
+ * Uses distance to line segment for straight lines, or distance to Bezier curve for curved lines.
109
+ * @param x - X coordinate of the point to test in world coordinates
110
+ * @param y - Y coordinate of the point to test in world coordinates
111
+ * @returns True if the point is within the stroke width tolerance of the line
112
+ */
113
+ hitTest(x: number, y: number): boolean;
114
+ /**
115
+ * Tests if the line intersects with or is contained within a polygon.
116
+ * Checks endpoint containment, polygon vertex proximity, curve sampling for Bezier curves,
117
+ * and line-edge intersections for straight lines.
118
+ * @param polygon - The polygon to test intersection with, defined by four corner points
119
+ * @returns True if any part of the line intersects with the polygon
120
+ */
121
+ hitTestPolygon(polygon: KritzelPolygon): boolean;
122
+ /**
123
+ * Updates the translation position of the line without recalculating dimensions.
124
+ * Invalidates cached adjusted points and clip info.
125
+ * @param x - New X translation in world coordinates
126
+ * @param y - New Y translation in world coordinates
127
+ */
128
+ updatePosition(x: number, y: number): void;
129
+ /**
130
+ * Updates a specific endpoint of the line (start or end).
131
+ * Recalculates the bounding box dimensions and adjusts translation to maintain
132
+ * the visual position after the origin shift, accounting for rotation.
133
+ * @param handleType - Which endpoint to update: 'start' or 'end'
134
+ * @param newX - New X coordinate in viewBox-local space (relative to x, y origin)
135
+ * @param newY - New Y coordinate in viewBox-local space (relative to x, y origin)
136
+ */
137
+ updateEndpoint(handleType: 'start' | 'end', newX: number, newY: number): void;
138
+ /**
139
+ * Updates the control point for a quadratic Bezier curve.
140
+ * Recalculates bounding box and adjusts translation to maintain visual position.
141
+ * Pass undefined for both parameters to convert the line back to a straight line.
142
+ * @param newX - New X coordinate for the control point, or undefined to remove
143
+ * @param newY - New Y coordinate for the control point, or undefined to remove
144
+ */
145
+ updateControlPoint(newX: number | undefined, newY: number | undefined): void;
146
+ /**
147
+ * Computes the line endpoints in world coordinates, accounting for rotation,
148
+ * scale, and translation transformations.
149
+ * @returns Array of two points [[startX, startY], [endX, endY]] in world coordinates
150
+ */
151
+ private computeAdjustedPoints;
152
+ /**
153
+ * Calculates the minimum distance from a point to a line segment.
154
+ * Uses parametric projection to find the closest point on the segment.
155
+ * @param x - X coordinate of the test point
156
+ * @param y - Y coordinate of the test point
157
+ * @param x1 - X coordinate of the segment start
158
+ * @param y1 - Y coordinate of the segment start
159
+ * @param x2 - X coordinate of the segment end
160
+ * @param y2 - Y coordinate of the segment end
161
+ * @returns The minimum distance from the point to the line segment
162
+ */
163
+ private pointToLineSegmentDistance;
164
+ /**
165
+ * Calculates the minimum distance from a point to a quadratic Bezier curve.
166
+ * Uses sampling along the curve (20 samples) to approximate the closest point.
167
+ * @param x - X coordinate of the test point in world coordinates
168
+ * @param y - Y coordinate of the test point in world coordinates
169
+ * @param startT - Start parameter for curve sampling (0-1), used for clipped curves
170
+ * @param endT - End parameter for curve sampling (0-1), used for clipped curves
171
+ * @returns The minimum distance from the point to the sampled curve
172
+ */
173
+ private pointToBezierDistance;
174
+ /**
175
+ * Retrieves or computes the clip information for anchored line endpoints.
176
+ * Caches the result to avoid recalculation on subsequent calls.
177
+ * @returns Object containing optional start and end clip points with world coordinates
178
+ * and parametric t values for curve clipping
179
+ */
180
+ private getClipInfo;
181
+ /**
182
+ * Computes the adjusted control point in world coordinates.
183
+ * Applies rotation around the bounding box center, then scale and translation transforms.
184
+ * @returns Array [x, y] representing the control point in world coordinates,
185
+ * or the midpoint of the line if no control point is defined
186
+ */
187
+ private computeAdjustedControlPoint;
188
+ /**
189
+ * Gets the bounding polygon of the line in world coordinates, accounting for rotation.
190
+ * Used for selection bounds and intersection testing.
191
+ * @returns A polygon with four corner points (topLeft, topRight, bottomRight, bottomLeft)
192
+ * transformed to world coordinates with rotation applied
193
+ */
194
+ get rotatedPolygon(): KritzelPolygon;
195
+ /**
196
+ * Calculates the tight bounding box for a quadratic Bezier curve or straight line.
197
+ * For curves, finds extrema points where the derivative equals zero to ensure
198
+ * the bounding box encompasses the entire curve arc.
199
+ * @param startX - X coordinate of the line start point
200
+ * @param startY - Y coordinate of the line start point
201
+ * @param endX - X coordinate of the line end point
202
+ * @param endY - Y coordinate of the line end point
203
+ * @param controlX - X coordinate of the control point (undefined for straight lines)
204
+ * @param controlY - Y coordinate of the control point (undefined for straight lines)
205
+ * @param strokeWidth - Width of the line stroke for padding calculation
206
+ * @returns Object with minX, minY, maxX, maxY including stroke width padding
207
+ */
208
+ static calculateBoundingBox(startX: number, startY: number, endX: number, endY: number, controlX: number | undefined, controlY: number | undefined, strokeWidth: number): {
209
+ minX: number;
210
+ minY: number;
211
+ maxX: number;
212
+ maxY: number;
213
+ };
214
+ /**
215
+ * Calculates the bounding box for this line instance using the current endpoint,
216
+ * control point, and stroke width values.
217
+ * @returns Object with minX, minY, maxX, maxY bounds including stroke width padding
218
+ */
219
+ calculateBoundingBox(): {
220
+ minX: number;
221
+ minY: number;
222
+ maxX: number;
223
+ maxY: number;
224
+ };
225
+ /**
226
+ * Serializes the line while excluding transient cache fields.
227
+ * @returns A serializable line object without runtime caches
228
+ */
229
+ serialize(): any;
230
+ /**
231
+ * Deserializes and resets transient caches so geometry is recomputed lazily.
232
+ * @param object - The serialized line object
233
+ * @returns This instance cast to type T
234
+ */
235
+ deserialize<T>(object: any): T;
236
+ /**
237
+ * Recalculates and updates the width, height, x, y, and translation properties
238
+ * based on the current endpoint positions and stroke width.
239
+ * Called during construction and after endpoint changes.
240
+ */
241
+ private updateDimensions;
242
+ /**
243
+ * Gets the unique SVG marker ID for the arrow head at the start of the line.
244
+ * Used in SVG defs for marker-start attribute.
245
+ * @returns A unique marker ID string in the format "arrow-start-{lineId}"
246
+ */
247
+ get startMarkerId(): string;
248
+ /**
249
+ * Gets the unique SVG marker ID for the arrow head at the end of the line.
250
+ * Used in SVG defs for marker-end attribute.
251
+ * @returns A unique marker ID string in the format "arrow-end-{lineId}"
252
+ */
253
+ get endMarkerId(): string;
254
+ /**
255
+ * Gets the arrow head size for the specified end of the line.
256
+ * @param end - Which end to get the arrow size for: 'start' or 'end'
257
+ * @returns The configured arrow size, or strokeWidth * 3 as default
258
+ */
259
+ getArrowSize(end: 'start' | 'end'): number;
260
+ /**
261
+ * Gets the resolved fill color for the arrow head at the specified end.
262
+ * Resolves theme-aware colors to the appropriate value for the current theme.
263
+ * @param end - Which end to get the arrow fill for: 'start' or 'end'
264
+ * @returns The resolved CSS color string for the arrow fill
265
+ */
266
+ getArrowFill(end: 'start' | 'end'): string;
267
+ /**
268
+ * Generates SVG path data for an arrow head based on the given style.
269
+ * All paths are designed to fit in a 10x10 viewBox with the tip at (10, 5).
270
+ * @param style - The arrow head style: 'triangle' (filled), 'open' (outline),
271
+ * 'diamond' (rhombus), or 'circle'. Defaults to 'triangle'.
272
+ * @returns SVG path data string for use in a marker element
273
+ */
274
+ getArrowPath(style?: ArrowHeadStyle): string;
275
+ /**
276
+ * Checks if an arrow head is enabled at the start of the line.
277
+ * @returns True if the start arrow configuration exists and is enabled
278
+ */
279
+ get hasStartArrow(): boolean;
280
+ /**
281
+ * Checks if an arrow head is enabled at the end of the line.
282
+ * @returns True if the end arrow configuration exists and is enabled
283
+ */
284
+ get hasEndArrow(): boolean;
285
+ }