kritzel-stencil 0.0.130 → 0.0.132

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 (388) hide show
  1. package/dist/cjs/{index-CUSIflVf.js → index-nzUNdMPh.js} +47 -17
  2. package/dist/cjs/index-nzUNdMPh.js.map +1 -0
  3. package/dist/cjs/{index-CfXjPLHb.js → index-ouFX0OVi.js} +891 -802
  4. package/dist/cjs/index-ouFX0OVi.js.map +1 -0
  5. package/dist/cjs/index.cjs.js +2 -1
  6. package/dist/cjs/index.cjs.js.map +1 -1
  7. package/dist/cjs/kritzel-brush-style.cjs.entry.js +32 -0
  8. package/dist/cjs/kritzel-brush-style.entry.cjs.js.map +1 -0
  9. package/dist/cjs/{kritzel-brush-style_23.cjs.entry.js → kritzel-color_22.cjs.entry.js} +1539 -1325
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/stencil.cjs.js +3 -3
  12. package/dist/cjs/stencil.cjs.js.map +1 -1
  13. package/dist/collection/classes/commands/add-object.command.js +7 -7
  14. package/dist/collection/classes/commands/add-object.command.js.map +1 -1
  15. package/dist/collection/classes/commands/add-selection-group.command.js +10 -9
  16. package/dist/collection/classes/commands/add-selection-group.command.js.map +1 -1
  17. package/dist/collection/classes/commands/base.command.js +6 -4
  18. package/dist/collection/classes/commands/base.command.js.map +1 -1
  19. package/dist/collection/classes/commands/batch.command.js +3 -2
  20. package/dist/collection/classes/commands/batch.command.js.map +1 -1
  21. package/dist/collection/classes/commands/move-selection-group.command.js +13 -7
  22. package/dist/collection/classes/commands/move-selection-group.command.js.map +1 -1
  23. package/dist/collection/classes/commands/remove-object.command.js +9 -9
  24. package/dist/collection/classes/commands/remove-object.command.js.map +1 -1
  25. package/dist/collection/classes/commands/remove-selection-group.command.js +8 -7
  26. package/dist/collection/classes/commands/remove-selection-group.command.js.map +1 -1
  27. package/dist/collection/classes/commands/resize-selection-group.command.js +10 -7
  28. package/dist/collection/classes/commands/resize-selection-group.command.js.map +1 -1
  29. package/dist/collection/classes/commands/rotate-selection-group.command.js +15 -12
  30. package/dist/collection/classes/commands/rotate-selection-group.command.js.map +1 -1
  31. package/dist/collection/classes/commands/update-object.command.js +7 -5
  32. package/dist/collection/classes/commands/update-object.command.js.map +1 -1
  33. package/dist/collection/classes/commands/update-viewport.command.js +13 -11
  34. package/dist/collection/classes/commands/update-viewport.command.js.map +1 -1
  35. package/dist/collection/classes/{store.class.js → core/core.class.js} +123 -147
  36. package/dist/collection/classes/core/core.class.js.map +1 -0
  37. package/dist/collection/classes/{database.class.js → core/database.class.js} +34 -25
  38. package/dist/collection/classes/core/database.class.js.map +1 -0
  39. package/dist/collection/classes/core/history.class.js +88 -0
  40. package/dist/collection/classes/core/history.class.js.map +1 -0
  41. package/dist/collection/classes/{reviver.class.js → core/reviver.class.js} +27 -22
  42. package/dist/collection/classes/core/reviver.class.js.map +1 -0
  43. package/dist/collection/classes/core/store.class.js +51 -0
  44. package/dist/collection/classes/core/store.class.js.map +1 -0
  45. package/dist/collection/classes/core/viewport.class.js +165 -0
  46. package/dist/collection/classes/core/viewport.class.js.map +1 -0
  47. package/dist/collection/classes/core/workspace.class.js +42 -0
  48. package/dist/collection/classes/core/workspace.class.js.map +1 -0
  49. package/dist/collection/classes/handlers/base.handler.js +4 -3
  50. package/dist/collection/classes/handlers/base.handler.js.map +1 -1
  51. package/dist/collection/classes/handlers/context-menu.handler.js +26 -21
  52. package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
  53. package/dist/collection/classes/handlers/hover.handler.js +5 -5
  54. package/dist/collection/classes/handlers/hover.handler.js.map +1 -1
  55. package/dist/collection/classes/handlers/key.handler.js +38 -44
  56. package/dist/collection/classes/handlers/key.handler.js.map +1 -1
  57. package/dist/collection/classes/handlers/move.handler.js +40 -35
  58. package/dist/collection/classes/handlers/move.handler.js.map +1 -1
  59. package/dist/collection/classes/handlers/resize.handler.js +57 -60
  60. package/dist/collection/classes/handlers/resize.handler.js.map +1 -1
  61. package/dist/collection/classes/handlers/rotation.handler.js +55 -57
  62. package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
  63. package/dist/collection/classes/handlers/selection.handler.js +78 -75
  64. package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
  65. package/dist/collection/classes/objects/base-object.class.js +49 -31
  66. package/dist/collection/classes/objects/base-object.class.js.map +1 -1
  67. package/dist/collection/classes/objects/custom-element.class.js +6 -5
  68. package/dist/collection/classes/objects/custom-element.class.js.map +1 -1
  69. package/dist/collection/classes/objects/image.class.js +17 -17
  70. package/dist/collection/classes/objects/image.class.js.map +1 -1
  71. package/dist/collection/classes/objects/path.class.js +36 -34
  72. package/dist/collection/classes/objects/path.class.js.map +1 -1
  73. package/dist/collection/classes/objects/selection-box.class.js +6 -9
  74. package/dist/collection/classes/objects/selection-box.class.js.map +1 -1
  75. package/dist/collection/classes/objects/selection-group.class.js +23 -22
  76. package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
  77. package/dist/collection/classes/objects/text.class.js +23 -23
  78. package/dist/collection/classes/objects/text.class.js.map +1 -1
  79. package/dist/collection/classes/registries/icon-registry.class.js +1 -1
  80. package/dist/collection/classes/registries/icon-registry.class.js.map +1 -1
  81. package/dist/collection/classes/registries/tool.registry.js +3 -3
  82. package/dist/collection/classes/registries/tool.registry.js.map +1 -1
  83. package/dist/collection/classes/structures/circular-buffer.structure.js +5 -3
  84. package/dist/collection/classes/structures/circular-buffer.structure.js.map +1 -1
  85. package/dist/collection/classes/structures/object-map.structure.js +1 -0
  86. package/dist/collection/classes/structures/object-map.structure.js.map +1 -1
  87. package/dist/collection/classes/tools/base-tool.class.js +13 -6
  88. package/dist/collection/classes/tools/base-tool.class.js.map +1 -1
  89. package/dist/collection/classes/tools/brush-tool.class.js +64 -60
  90. package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
  91. package/dist/collection/classes/tools/eraser-tool.class.js +27 -28
  92. package/dist/collection/classes/tools/eraser-tool.class.js.map +1 -1
  93. package/dist/collection/classes/tools/image-tool.class.js +14 -15
  94. package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
  95. package/dist/collection/classes/tools/selection-tool.class.js +48 -43
  96. package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
  97. package/dist/collection/classes/tools/text-tool.class.js +57 -58
  98. package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
  99. package/dist/collection/collection-manifest.json +1 -1
  100. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +30 -30
  101. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js.map +1 -1
  102. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +7 -9
  103. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +267 -93
  104. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
  105. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +319 -327
  106. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
  107. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +7 -8
  108. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js.map +1 -1
  109. package/dist/collection/components/shared/kritzel-color/kritzel-color.js +4 -5
  110. package/dist/collection/components/shared/kritzel-color/kritzel-color.js.map +1 -1
  111. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +5 -0
  112. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +8 -9
  113. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js.map +1 -1
  114. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +53 -49
  115. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js.map +1 -1
  116. package/dist/collection/components/shared/kritzel-font/kritzel-font.js +4 -6
  117. package/dist/collection/components/shared/kritzel-font/kritzel-font.js.map +1 -1
  118. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +18 -18
  119. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js.map +1 -1
  120. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +5 -6
  121. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js.map +1 -1
  122. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.css +1 -0
  123. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js +3 -3
  124. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js.map +1 -1
  125. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.css +6 -2
  126. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +36 -30
  127. package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js.map +1 -1
  128. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.css +25 -7
  129. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +61 -40
  130. package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js.map +1 -1
  131. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +22 -61
  132. package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js.map +1 -1
  133. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.css +16 -20
  134. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +104 -53
  135. package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js.map +1 -1
  136. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +4 -0
  137. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +4 -5
  138. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js.map +1 -1
  139. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +85 -14
  140. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js.map +1 -1
  141. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +50 -16
  142. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js.map +1 -1
  143. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.css +4 -0
  144. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +7 -7
  145. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js.map +1 -1
  146. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +5 -5
  147. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js.map +1 -1
  148. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +12 -1
  149. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +41 -32
  150. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
  151. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +5 -0
  152. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +4 -1
  153. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js.map +1 -1
  154. package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js +40 -28
  155. package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js.map +1 -1
  156. package/dist/collection/configs/default-engine-state.js +0 -1
  157. package/dist/collection/configs/default-engine-state.js.map +1 -1
  158. package/dist/collection/helpers/devices.helper.js +20 -0
  159. package/dist/collection/helpers/devices.helper.js.map +1 -1
  160. package/dist/collection/helpers/event.helper.js +2 -6
  161. package/dist/collection/helpers/event.helper.js.map +1 -1
  162. package/dist/collection/helpers/html.helper.js +30 -2
  163. package/dist/collection/helpers/html.helper.js.map +1 -1
  164. package/dist/collection/helpers/object.helper.js +2 -14
  165. package/dist/collection/helpers/object.helper.js.map +1 -1
  166. package/dist/collection/index.js +1 -0
  167. package/dist/collection/index.js.map +1 -1
  168. package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
  169. package/dist/collection/interfaces/serializable.interface.js.map +1 -1
  170. package/dist/collection/types/deep-readonly.type.js +2 -0
  171. package/dist/collection/types/deep-readonly.type.js.map +1 -0
  172. package/dist/components/index.js +4 -3
  173. package/dist/components/index.js.map +1 -1
  174. package/dist/components/kritzel-brush-style.js +59 -1
  175. package/dist/components/kritzel-brush-style.js.map +1 -1
  176. package/dist/components/kritzel-color-palette.js +1 -1
  177. package/dist/components/kritzel-color.js +1 -1
  178. package/dist/components/kritzel-context-menu.js +1 -1
  179. package/dist/components/kritzel-control-brush-config.js +1 -1
  180. package/dist/components/kritzel-control-text-config.js +1 -1
  181. package/dist/components/kritzel-controls.js +1 -1
  182. package/dist/components/kritzel-cursor-trail.js +1 -1
  183. package/dist/components/kritzel-dropdown.js +1 -1
  184. package/dist/components/kritzel-editor.js +172 -124
  185. package/dist/components/kritzel-editor.js.map +1 -1
  186. package/dist/components/kritzel-engine.js +1 -1
  187. package/dist/components/kritzel-font-family.js +1 -1
  188. package/dist/components/kritzel-font-size.js +1 -1
  189. package/dist/components/kritzel-font.js +1 -1
  190. package/dist/components/kritzel-icon.js +1 -1
  191. package/dist/components/kritzel-menu-item.js +1 -1
  192. package/dist/components/kritzel-menu.js +1 -1
  193. package/dist/components/kritzel-portal.js +1 -1
  194. package/dist/components/kritzel-split-button.js +1 -1
  195. package/dist/components/kritzel-stroke-size.js +1 -1
  196. package/dist/components/kritzel-tooltip.js +1 -1
  197. package/dist/components/kritzel-utility-panel.js +1 -1
  198. package/dist/components/kritzel-workspace-manager.js +1 -1
  199. package/dist/components/{p-BGccckxP.js → p-0iJh9Z6m.js} +9 -8
  200. package/dist/components/p-0iJh9Z6m.js.map +1 -0
  201. package/dist/components/{p-C9-70hiF.js → p-B3VQubt_.js} +268 -236
  202. package/dist/components/p-B3VQubt_.js.map +1 -0
  203. package/dist/components/{p-5CJxFNEE.js → p-B7kZ1_RH.js} +7 -6
  204. package/dist/components/p-B7kZ1_RH.js.map +1 -0
  205. package/dist/components/{p-Cb1IUD_g.js → p-B7w19kIk.js} +17 -27
  206. package/dist/components/p-B7w19kIk.js.map +1 -0
  207. package/dist/components/{p-BU2q3PRS.js → p-BGdsAz54.js} +31 -19
  208. package/dist/components/p-BGdsAz54.js.map +1 -0
  209. package/dist/components/{p-BZ-j_4CK.js → p-BM9IjvnD.js} +7 -7
  210. package/dist/components/p-BM9IjvnD.js.map +1 -0
  211. package/dist/components/{p-26poIWa_.js → p-BPsQrpzN.js} +47 -18
  212. package/dist/components/p-BPsQrpzN.js.map +1 -0
  213. package/dist/components/{p-BqrTPNyu.js → p-BYanlgdq.js} +41 -15
  214. package/dist/components/p-BYanlgdq.js.map +1 -0
  215. package/dist/components/{p-D_Uh-xv_.js → p-BiCgeOiJ.js} +60 -56
  216. package/dist/components/p-BiCgeOiJ.js.map +1 -0
  217. package/dist/components/{p-BcQWRzsB.js → p-C1-nvBx9.js} +42 -29
  218. package/dist/components/p-C1-nvBx9.js.map +1 -0
  219. package/dist/components/p-C6qB08BS.js +68 -0
  220. package/dist/components/p-C6qB08BS.js.map +1 -0
  221. package/dist/components/{p-jpGLgpoq.js → p-CTvJDYFQ.js} +26 -64
  222. package/dist/components/p-CTvJDYFQ.js.map +1 -0
  223. package/dist/components/{p-BAPUTr3K.js → p-CsyM5q2M.js} +13 -12
  224. package/dist/components/p-CsyM5q2M.js.map +1 -0
  225. package/dist/components/p-CvmWmUK9.js +149 -0
  226. package/dist/components/p-CvmWmUK9.js.map +1 -0
  227. package/dist/components/{p-fyfT6A5K.js → p-DCx3703u.js} +9 -6
  228. package/dist/components/p-DCx3703u.js.map +1 -0
  229. package/dist/components/{p-BvlGgLAQ.js → p-DFO-6kuA.js} +57 -51
  230. package/dist/components/p-DFO-6kuA.js.map +1 -0
  231. package/dist/components/p-D_907-Wd.js +267 -0
  232. package/dist/components/p-D_907-Wd.js.map +1 -0
  233. package/dist/components/{p-jGaWxggY.js → p-Davd1R_4.js} +1278 -1227
  234. package/dist/components/p-Davd1R_4.js.map +1 -0
  235. package/dist/components/{p-DtmZW6eP.js → p-Db3kxVe2.js} +27 -25
  236. package/dist/components/p-Db3kxVe2.js.map +1 -0
  237. package/dist/components/{p-_ntxNi8v.js → p-Ddlbt3Bj.js} +22 -20
  238. package/dist/components/p-Ddlbt3Bj.js.map +1 -0
  239. package/dist/components/{p-Crni2OI4.js → p-DjU7p3od.js} +15 -13
  240. package/dist/components/p-DjU7p3od.js.map +1 -0
  241. package/dist/components/p-EXPChOF6.js +30 -0
  242. package/dist/components/p-EXPChOF6.js.map +1 -0
  243. package/dist/components/p-YqK8ch2R.js +46 -0
  244. package/dist/components/p-YqK8ch2R.js.map +1 -0
  245. package/dist/components/p-l10It7Nm.js +30 -0
  246. package/dist/components/p-l10It7Nm.js.map +1 -0
  247. package/dist/components/{p-BLmFBe2a.js → p-sq9jgfX0.js} +8 -6
  248. package/dist/components/p-sq9jgfX0.js.map +1 -0
  249. package/dist/components/{p-BcQTDgzV.js → p-sreNwi0N.js} +9 -8
  250. package/dist/components/p-sreNwi0N.js.map +1 -0
  251. package/dist/esm/{index-DqqxAoZI.js → index-C_uHp-ur.js} +891 -803
  252. package/dist/esm/index-C_uHp-ur.js.map +1 -0
  253. package/dist/esm/{index-NiIEUDzj.js → index-oCOlsFCN.js} +47 -17
  254. package/dist/esm/index-oCOlsFCN.js.map +1 -0
  255. package/dist/esm/index.js +1 -1
  256. package/dist/esm/kritzel-brush-style.entry.js +30 -0
  257. package/dist/esm/kritzel-brush-style.entry.js.map +1 -0
  258. package/dist/esm/{kritzel-brush-style_23.entry.js → kritzel-color_22.entry.js} +1538 -1323
  259. package/dist/esm/loader.js +3 -3
  260. package/dist/esm/stencil.js +4 -4
  261. package/dist/esm/stencil.js.map +1 -1
  262. package/dist/stencil/index.esm.js +1 -1
  263. package/dist/stencil/kritzel-brush-style.entry.esm.js.map +1 -0
  264. package/dist/stencil/p-25d1e040.entry.js +2 -0
  265. package/dist/stencil/p-25d1e040.entry.js.map +1 -0
  266. package/dist/stencil/p-C_uHp-ur.js +2 -0
  267. package/dist/stencil/p-C_uHp-ur.js.map +1 -0
  268. package/dist/stencil/p-a6f8283e.entry.js +2 -0
  269. package/dist/stencil/p-a6f8283e.entry.js.map +1 -0
  270. package/dist/stencil/p-oCOlsFCN.js +3 -0
  271. package/dist/stencil/p-oCOlsFCN.js.map +1 -0
  272. package/dist/stencil/stencil.esm.js +1 -1
  273. package/dist/stencil/stencil.esm.js.map +1 -1
  274. package/dist/types/classes/commands/add-object.command.d.ts +2 -2
  275. package/dist/types/classes/commands/add-selection-group.command.d.ts +2 -1
  276. package/dist/types/classes/commands/base.command.d.ts +3 -3
  277. package/dist/types/classes/commands/batch.command.d.ts +2 -1
  278. package/dist/types/classes/commands/move-selection-group.command.d.ts +2 -1
  279. package/dist/types/classes/commands/remove-object.command.d.ts +2 -2
  280. package/dist/types/classes/commands/remove-selection-group.command.d.ts +2 -2
  281. package/dist/types/classes/commands/resize-selection-group.command.d.ts +2 -1
  282. package/dist/types/classes/commands/rotate-selection-group.command.d.ts +2 -1
  283. package/dist/types/classes/commands/update-object.command.d.ts +2 -2
  284. package/dist/types/classes/commands/update-viewport.command.d.ts +2 -1
  285. package/dist/types/classes/{store.class.d.ts → core/core.class.d.ts} +9 -19
  286. package/dist/types/classes/{database.class.d.ts → core/database.class.d.ts} +3 -2
  287. package/dist/types/classes/{history.class.d.ts → core/history.class.d.ts} +5 -5
  288. package/dist/types/classes/core/reviver.class.d.ts +6 -0
  289. package/dist/types/classes/core/store.class.d.ts +17 -0
  290. package/dist/types/classes/{viewport.class.d.ts → core/viewport.class.d.ts} +3 -3
  291. package/dist/types/classes/core/workspace.class.d.ts +24 -0
  292. package/dist/types/classes/handlers/base.handler.d.ts +3 -3
  293. package/dist/types/classes/handlers/context-menu.handler.d.ts +2 -2
  294. package/dist/types/classes/handlers/hover.handler.d.ts +2 -2
  295. package/dist/types/classes/handlers/key.handler.d.ts +2 -2
  296. package/dist/types/classes/handlers/move.handler.d.ts +2 -2
  297. package/dist/types/classes/handlers/resize.handler.d.ts +2 -2
  298. package/dist/types/classes/handlers/rotation.handler.d.ts +2 -2
  299. package/dist/types/classes/handlers/selection.handler.d.ts +2 -2
  300. package/dist/types/classes/objects/base-object.class.d.ts +5 -4
  301. package/dist/types/classes/objects/custom-element.class.d.ts +2 -2
  302. package/dist/types/classes/objects/image.class.d.ts +2 -2
  303. package/dist/types/classes/objects/path.class.d.ts +2 -4
  304. package/dist/types/classes/objects/selection-box.class.d.ts +2 -2
  305. package/dist/types/classes/objects/selection-group.class.d.ts +2 -2
  306. package/dist/types/classes/objects/text.class.d.ts +2 -2
  307. package/dist/types/classes/registries/tool.registry.d.ts +2 -2
  308. package/dist/types/classes/tools/base-tool.class.d.ts +8 -4
  309. package/dist/types/classes/tools/brush-tool.class.d.ts +2 -2
  310. package/dist/types/classes/tools/eraser-tool.class.d.ts +2 -2
  311. package/dist/types/classes/tools/image-tool.class.d.ts +2 -2
  312. package/dist/types/classes/tools/selection-tool.class.d.ts +2 -2
  313. package/dist/types/classes/tools/text-tool.class.d.ts +2 -2
  314. package/dist/types/components/core/kritzel-cursor-trail/kritzel-cursor-trail.d.ts +5 -5
  315. package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +13 -3
  316. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +21 -22
  317. package/dist/types/components/shared/kritzel-dropdown/kritzel-dropdown.d.ts +2 -2
  318. package/dist/types/components/shared/kritzel-menu-item/kritzel-menu-item.d.ts +2 -0
  319. package/dist/types/components/shared/kritzel-portal/kritzel-portal.d.ts +0 -1
  320. package/dist/types/components/shared/kritzel-split-button/kritzel-split-button.d.ts +4 -2
  321. package/dist/types/components/shared/kritzel-tooltip/kritzel-tooltip.d.ts +8 -2
  322. package/dist/types/components/ui/kritzel-context-menu/kritzel-context-menu.d.ts +5 -3
  323. package/dist/types/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.d.ts +1 -1
  324. package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +3 -1
  325. package/dist/types/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.d.ts +3 -2
  326. package/dist/types/components.d.ts +41 -12
  327. package/dist/types/helpers/devices.helper.d.ts +4 -0
  328. package/dist/types/helpers/event.helper.d.ts +1 -1
  329. package/dist/types/helpers/html.helper.d.ts +1 -0
  330. package/dist/types/index.d.ts +1 -0
  331. package/dist/types/interfaces/engine-state.interface.d.ts +1 -2
  332. package/dist/types/interfaces/serializable.interface.d.ts +2 -1
  333. package/dist/types/stencil-public-runtime.d.ts +6 -4
  334. package/dist/types/types/deep-readonly.type.d.ts +7 -0
  335. package/package.json +64 -63
  336. package/dist/cjs/index-CUSIflVf.js.map +0 -1
  337. package/dist/cjs/index-CfXjPLHb.js.map +0 -1
  338. package/dist/collection/classes/database.class.js.map +0 -1
  339. package/dist/collection/classes/history.class.js +0 -84
  340. package/dist/collection/classes/history.class.js.map +0 -1
  341. package/dist/collection/classes/reviver.class.js.map +0 -1
  342. package/dist/collection/classes/store.class.js.map +0 -1
  343. package/dist/collection/classes/viewport.class.js +0 -152
  344. package/dist/collection/classes/viewport.class.js.map +0 -1
  345. package/dist/collection/classes/workspace.class.js +0 -10
  346. package/dist/collection/classes/workspace.class.js.map +0 -1
  347. package/dist/components/p-26poIWa_.js.map +0 -1
  348. package/dist/components/p-5CJxFNEE.js.map +0 -1
  349. package/dist/components/p-BAPUTr3K.js.map +0 -1
  350. package/dist/components/p-BGccckxP.js.map +0 -1
  351. package/dist/components/p-BLmFBe2a.js.map +0 -1
  352. package/dist/components/p-BU2q3PRS.js.map +0 -1
  353. package/dist/components/p-BZ-j_4CK.js.map +0 -1
  354. package/dist/components/p-Bb6od8He.js +0 -42
  355. package/dist/components/p-Bb6od8He.js.map +0 -1
  356. package/dist/components/p-BcQTDgzV.js.map +0 -1
  357. package/dist/components/p-BcQWRzsB.js.map +0 -1
  358. package/dist/components/p-BeVv4o5c.js +0 -14
  359. package/dist/components/p-BeVv4o5c.js.map +0 -1
  360. package/dist/components/p-BqrTPNyu.js.map +0 -1
  361. package/dist/components/p-BvlGgLAQ.js.map +0 -1
  362. package/dist/components/p-C-DqsDXz.js +0 -238
  363. package/dist/components/p-C-DqsDXz.js.map +0 -1
  364. package/dist/components/p-C9-70hiF.js.map +0 -1
  365. package/dist/components/p-CJKA5zIE.js +0 -10
  366. package/dist/components/p-CJKA5zIE.js.map +0 -1
  367. package/dist/components/p-CaPdvVd4.js +0 -127
  368. package/dist/components/p-CaPdvVd4.js.map +0 -1
  369. package/dist/components/p-Cb1IUD_g.js.map +0 -1
  370. package/dist/components/p-Crni2OI4.js.map +0 -1
  371. package/dist/components/p-D_Uh-xv_.js.map +0 -1
  372. package/dist/components/p-DtmZW6eP.js.map +0 -1
  373. package/dist/components/p-V4ui5aWj.js +0 -63
  374. package/dist/components/p-V4ui5aWj.js.map +0 -1
  375. package/dist/components/p-_ntxNi8v.js.map +0 -1
  376. package/dist/components/p-fyfT6A5K.js.map +0 -1
  377. package/dist/components/p-jGaWxggY.js.map +0 -1
  378. package/dist/components/p-jpGLgpoq.js.map +0 -1
  379. package/dist/esm/index-DqqxAoZI.js.map +0 -1
  380. package/dist/esm/index-NiIEUDzj.js.map +0 -1
  381. package/dist/stencil/p-DqqxAoZI.js +0 -2
  382. package/dist/stencil/p-DqqxAoZI.js.map +0 -1
  383. package/dist/stencil/p-NiIEUDzj.js +0 -3
  384. package/dist/stencil/p-NiIEUDzj.js.map +0 -1
  385. package/dist/stencil/p-eebdbf65.entry.js +0 -2
  386. package/dist/stencil/p-eebdbf65.entry.js.map +0 -1
  387. package/dist/types/classes/reviver.class.d.ts +0 -6
  388. package/dist/types/classes/workspace.class.d.ts +0 -16
@@ -1,11 +1,13 @@
1
- import { O as ObjectHelper } from './p-Bb6od8He.js';
2
1
  import { K as KritzelMouseButton } from './p-D8W6LE-c.js';
2
+ import { O as ObjectHelper } from './p-EXPChOF6.js';
3
3
 
4
4
  class KritzelBaseCommand {
5
- constructor(store, initiator, skipHistory = false) {
6
- var _a, _b;
7
- this._store = store;
8
- this.initiator = (_b = (_a = initiator === null || initiator === void 0 ? void 0 : initiator.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'Unknown';
5
+ _core;
6
+ initiator;
7
+ skipHistory;
8
+ constructor(core, initiator, skipHistory = false) {
9
+ this._core = core;
10
+ this.initiator = initiator?.constructor?.name ?? 'Unknown';
9
11
  this.skipHistory = skipHistory;
10
12
  }
11
13
  execute() {
@@ -17,8 +19,11 @@ class KritzelBaseCommand {
17
19
  }
18
20
 
19
21
  class UpdateObjectCommand extends KritzelBaseCommand {
20
- constructor(store, initiator, object, updatedProperties, skipHistory = false) {
21
- super(store, initiator, skipHistory);
22
+ object;
23
+ updatedProperties;
24
+ previousProperties;
25
+ constructor(core, initiator, object, updatedProperties, skipHistory = false) {
26
+ super(core, initiator, skipHistory);
22
27
  this.object = object;
23
28
  this.updatedProperties = updatedProperties;
24
29
  this.previousProperties = {};
@@ -34,7 +39,7 @@ class UpdateObjectCommand extends KritzelBaseCommand {
34
39
  this.object[key] = this.updatedProperties[key];
35
40
  }
36
41
  }
37
- this._store.updateObjectInDatabase(ObjectHelper.clone(this.object));
42
+ this._core.updateObjectInDatabase(this.object);
38
43
  }
39
44
  undo() {
40
45
  for (const key in this.previousProperties) {
@@ -42,13 +47,14 @@ class UpdateObjectCommand extends KritzelBaseCommand {
42
47
  this.object[key] = this.previousProperties[key];
43
48
  }
44
49
  }
45
- this._store.updateObjectInDatabase(ObjectHelper.clone(this.object));
50
+ this._core.updateObjectInDatabase(this.object);
46
51
  }
47
52
  }
48
53
 
49
54
  class KritzelToolRegistry {
50
- static registerTool(toolName, constructor, store) {
51
- const toolInstance = new constructor(store);
55
+ static registry = {};
56
+ static registerTool(toolName, constructor, core) {
57
+ const toolInstance = new constructor(core);
52
58
  toolInstance.name = toolName;
53
59
  this.registry[toolName] = toolInstance;
54
60
  return toolInstance;
@@ -62,13 +68,13 @@ class KritzelToolRegistry {
62
68
  return toolInstance;
63
69
  }
64
70
  }
65
- KritzelToolRegistry.registry = {};
66
71
 
67
72
  class KritzelBaseTool {
68
- constructor(store) {
69
- this.__class__ = this.constructor.name;
70
- this.name = 'base-tool';
71
- this._store = store;
73
+ __class__ = this.constructor.name;
74
+ name = 'base-tool';
75
+ _core;
76
+ constructor(core) {
77
+ this._core = core;
72
78
  }
73
79
  onActivate() {
74
80
  // default implementation
@@ -88,24 +94,31 @@ class KritzelBaseTool {
88
94
  handleWheel(_event) {
89
95
  // default implementation
90
96
  }
91
- revive(object) {
97
+ serialize() {
98
+ return {
99
+ __class__: this.__class__,
100
+ name: this.name,
101
+ };
102
+ }
103
+ deserialize(object) {
92
104
  Object.assign(this, object);
93
105
  return this;
94
106
  }
95
107
  }
96
108
 
97
109
  class AddObjectCommand extends KritzelBaseCommand {
98
- constructor(store, initiator, object, skipHistory = false) {
99
- super(store, initiator, skipHistory);
110
+ object;
111
+ constructor(core, initiator, object, skipHistory = false) {
112
+ super(core, initiator, skipHistory);
100
113
  this.object = object;
101
114
  }
102
115
  execute() {
103
- this._store.state.objectsMap.insert(this.object);
104
- this._store.addObjectToDatabase(ObjectHelper.clone(this.object));
116
+ this._core.store.state.objectsMap.insert(this.object);
117
+ this._core.addObjectToDatabase(this.object);
105
118
  }
106
119
  undo() {
107
- this._store.state.objectsMap.remove(object => object.id === this.object.id);
108
- this._store.deleteObjectFromDatabase(this.object.id);
120
+ this._core.store.state.objectsMap.remove(object => object.id === this.object.id);
121
+ this._core.deleteObjectFromDatabase(this.object.id);
109
122
  }
110
123
  }
111
124
 
@@ -124,11 +137,7 @@ class KritzelEventHelper {
124
137
  const contextMenu = path.find(element => element.classList && element.classList.contains('context-menu'));
125
138
  return !!contextMenu;
126
139
  }
127
- static onLongTouchPress(event, onSuccess, onCancel) {
128
- if (event.pointerType !== 'touch') {
129
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
130
- return () => { };
131
- }
140
+ static onLongPress(event, onSuccess, onCancel) {
132
141
  const longPressTimeout = 400;
133
142
  const moveThreshold = 10;
134
143
  const startX = event.clientX;
@@ -141,7 +150,7 @@ class KritzelEventHelper {
141
150
  const cancel = () => {
142
151
  clearTimeout(timer);
143
152
  removeListeners();
144
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
153
+ onCancel?.();
145
154
  };
146
155
  const onPointerMove = (e) => {
147
156
  if (Math.abs(e.clientX - startX) > moveThreshold || Math.abs(e.clientY - startY) > moveThreshold) {
@@ -216,28 +225,28 @@ class KritzelKeyboardHelper {
216
225
  }
217
226
 
218
227
  class KritzelTextTool extends KritzelBaseTool {
219
- constructor(store) {
220
- super(store);
221
- this.fontFamily = 'Arial';
222
- this.fontSize = 16;
223
- this.fontColor = '#000000';
224
- this.palette = [
225
- '#000000',
226
- '#FFFFFF',
227
- '#FF0000',
228
- '#00FF00',
229
- '#0000FF',
230
- '#FFFF00',
231
- '#FF00FF',
232
- '#00FFFF',
233
- '#808080',
234
- '#C0C0C0',
235
- '#800000',
236
- '#008000',
237
- '#000080',
238
- '#808000',
239
- '#800080',
240
- ];
228
+ fontFamily = 'Arial';
229
+ fontSize = 16;
230
+ fontColor = '#000000';
231
+ palette = [
232
+ '#000000',
233
+ '#FFFFFF',
234
+ '#FF0000',
235
+ '#00FF00',
236
+ '#0000FF',
237
+ '#FFFF00',
238
+ '#FF00FF',
239
+ '#00FFFF',
240
+ '#808080',
241
+ '#C0C0C0',
242
+ '#800000',
243
+ '#008000',
244
+ '#000080',
245
+ '#808000',
246
+ '#800080',
247
+ ];
248
+ constructor(core) {
249
+ super(core);
241
250
  }
242
251
  handlePointerDown(event) {
243
252
  if (event.cancelable) {
@@ -246,80 +255,79 @@ class KritzelTextTool extends KritzelBaseTool {
246
255
  if (event.pointerType === 'mouse') {
247
256
  const path = event.composedPath().slice(1);
248
257
  const objectElement = path.find(element => element.classList && element.classList.contains('object'));
249
- const object = this._store.findObjectById(objectElement === null || objectElement === void 0 ? void 0 : objectElement.id);
250
- if (this._store.state.activeText === null && object && object instanceof KritzelText) {
251
- this._store.state.activeText = object;
258
+ const object = this._core.findObjectById(objectElement?.id);
259
+ if (this._core.store.state.activeText === null && object && object instanceof KritzelText) {
260
+ this._core.store.setState('activeText', object);
252
261
  object.focus();
253
262
  return;
254
263
  }
255
- if (this._store.state.activeText !== null && object instanceof KritzelText) {
264
+ if (this._core.store.state.activeText !== null && object instanceof KritzelText) {
256
265
  object.focus();
257
266
  return;
258
267
  }
259
- if (this._store.state.activeText !== null) {
260
- this._store.resetActiveText();
261
- this._store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
268
+ if (this._core.store.state.activeText !== null) {
269
+ this._core.resetActiveText();
270
+ this._core.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
262
271
  return;
263
272
  }
264
273
  if (KritzelEventHelper.isLeftClick(event) === false) {
265
274
  return;
266
275
  }
267
- const clientX = event.clientX - this._store.offsetX;
268
- const clientY = event.clientY - this._store.offsetY;
269
- const text = KritzelText.create(this._store, this.fontSize, this.fontFamily);
276
+ const clientX = event.clientX - this._core.store.offsetX;
277
+ const clientY = event.clientY - this._core.store.offsetY;
278
+ const text = KritzelText.create(this._core, this.fontSize, this.fontFamily);
270
279
  text.fontColor = this.fontColor;
271
- text.translateX = (clientX - this._store.state.translateX) / this._store.state.scale;
272
- text.translateY = (clientY - this._store.state.translateY) / this._store.state.scale;
273
- text.zIndex = this._store.currentZIndex;
274
- this._store.state.activeText = text;
275
- this._store.history.executeCommand(new AddObjectCommand(this._store, this, text));
280
+ text.translateX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
281
+ text.translateY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
282
+ text.zIndex = this._core.store.currentZIndex;
283
+ this._core.store.setState('activeText', text);
284
+ this._core.history.executeCommand(new AddObjectCommand(this._core, this, text));
276
285
  }
277
286
  if (event.pointerType === 'touch') {
278
- const activePointers = Array.from(this._store.state.pointers.values());
287
+ const activePointers = Array.from(this._core.store.state.pointers.values());
279
288
  const path = event.composedPath().slice(1);
280
289
  const objectElement = path.find(element => element.classList && element.classList.contains('object'));
281
- const object = this._store.findObjectById(objectElement === null || objectElement === void 0 ? void 0 : objectElement.id);
282
- if (this._store.state.activeText === null && object && object instanceof KritzelText) {
283
- this._store.state.activeText = object;
290
+ const object = this._core.findObjectById(objectElement?.id);
291
+ if (this._core.store.state.activeText === null && object && object instanceof KritzelText) {
292
+ this._core.store.setState('activeText', object);
284
293
  object.focus();
285
294
  return;
286
295
  }
287
- if (this._store.state.activeText !== null && object instanceof KritzelText) {
296
+ if (this._core.store.state.activeText !== null && object instanceof KritzelText) {
288
297
  object.focus();
289
298
  return;
290
299
  }
291
- if (this._store.state.activeText !== null) {
292
- this._store.resetActiveText();
293
- this._store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
300
+ if (this._core.store.state.activeText !== null) {
301
+ this._core.resetActiveText();
302
+ this._core.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
294
303
  return;
295
304
  }
296
305
  if (activePointers.length > 1) {
297
306
  return;
298
307
  }
299
308
  KritzelKeyboardHelper.disableInteractiveWidget();
300
- const clientX = Math.round(activePointers[0].clientX - this._store.offsetX);
301
- const clientY = Math.round(activePointers[0].clientY - this._store.offsetY);
302
- const text = KritzelText.create(this._store, this.fontSize, this.fontFamily);
309
+ const clientX = Math.round(activePointers[0].clientX - this._core.store.offsetX);
310
+ const clientY = Math.round(activePointers[0].clientY - this._core.store.offsetY);
311
+ const text = KritzelText.create(this._core, this.fontSize, this.fontFamily);
303
312
  text.fontColor = this.fontColor;
304
- text.translateX = (clientX - this._store.state.translateX) / this._store.state.scale;
305
- text.translateY = (clientY - this._store.state.translateY) / this._store.state.scale;
306
- text.zIndex = this._store.currentZIndex;
307
- this._store.state.activeText = text;
308
- this._store.history.executeCommand(new AddObjectCommand(this._store, this, text));
313
+ text.translateX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
314
+ text.translateY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
315
+ text.zIndex = this._core.store.currentZIndex;
316
+ this._core.store.setState('activeText', text);
317
+ this._core.history.executeCommand(new AddObjectCommand(this._core, this, text));
309
318
  }
310
319
  }
311
320
  handlePointerUp(event) {
312
- var _a, _b, _c, _d;
313
321
  if (event.cancelable) {
314
322
  event.preventDefault();
315
323
  }
316
324
  if (event.pointerType === 'mouse') {
317
- (_a = this._store.state.activeText) === null || _a === void 0 ? void 0 : _a.updateTextareaDimensions();
318
- (_b = this._store.state.activeText) === null || _b === void 0 ? void 0 : _b.focus();
325
+ this._core.store.state.activeText?.updateTextareaDimensions();
326
+ this._core.store.state.activeText?.focus();
319
327
  }
320
328
  if (event.pointerType === 'touch') {
321
- (_c = this._store.state.activeText) === null || _c === void 0 ? void 0 : _c.updateTextareaDimensions();
322
- (_d = this._store.state.activeText) === null || _d === void 0 ? void 0 : _d.focus();
329
+ this._core.store.state.activeText?.updateTextareaDimensions();
330
+ this._core.store.state.activeText?.focus();
323
331
  KritzelKeyboardHelper.enableInteractiveWidget();
324
332
  }
325
333
  }
@@ -379,6 +387,34 @@ class KritzelGeometryHelper {
379
387
  }
380
388
 
381
389
  class KritzelBaseObject {
390
+ __class__ = 'KritzelBaseObject';
391
+ _core;
392
+ _elementRef;
393
+ id;
394
+ workspaceId;
395
+ x;
396
+ y;
397
+ translateX;
398
+ translateY;
399
+ height;
400
+ width;
401
+ backgroundColor;
402
+ borderColor;
403
+ borderWidth = 0;
404
+ opacity = 1;
405
+ padding = 0;
406
+ scale;
407
+ resizing = false;
408
+ rotation = 0;
409
+ markedForRemoval = false;
410
+ zIndex = 0;
411
+ isVisible = true;
412
+ isSelected = false;
413
+ isHovered = false;
414
+ isMounted = false;
415
+ isEditable = false;
416
+ isInteractive = false;
417
+ isDebugInfoVisible = false;
382
418
  get totalWidth() {
383
419
  return this.width + this.padding * 2;
384
420
  }
@@ -464,28 +500,13 @@ class KritzelBaseObject {
464
500
  return this.translateY + this.totalHeight / 2;
465
501
  }
466
502
  constructor() {
467
- this.__class__ = 'KritzelBaseObject';
468
- this.borderWidth = 0;
469
- this.opacity = 1;
470
- this.padding = 0;
471
- this.resizing = false;
472
- this.rotation = 0;
473
- this.markedForRemoval = false;
474
- this.zIndex = 0;
475
- this.isVisible = true;
476
- this.isSelected = false;
477
- this.isHovered = false;
478
- this.isMounted = false;
479
- this.isEditable = false;
480
- this.isInteractive = false;
481
- this.isDebugInfoVisible = false;
482
503
  this.id = this.generateId();
483
504
  }
484
- static create(store) {
505
+ static create(core) {
485
506
  const object = new KritzelBaseObject();
486
- object._store = store;
487
- object.zIndex = store.currentZIndex;
488
- object.workspaceId = store.state.activeWorkspace.id;
507
+ object._core = core;
508
+ object.zIndex = core.store.currentZIndex;
509
+ object.workspaceId = core.store.state.activeWorkspace.id;
489
510
  return object;
490
511
  }
491
512
  mount(element) {
@@ -512,23 +533,23 @@ class KritzelBaseObject {
512
533
  }
513
534
  isInViewport() {
514
535
  const viewportBounds = {
515
- x: -this._store.state.translateX / this._store.state.scale,
516
- y: -this._store.state.translateY / this._store.state.scale,
517
- width: this._store.state.viewportWidth / this._store.state.scale,
518
- height: this._store.state.viewportHeight / this._store.state.scale};
536
+ x: -this._core.store.state.translateX / this._core.store.state.scale,
537
+ y: -this._core.store.state.translateY / this._core.store.state.scale,
538
+ width: this._core.store.state.viewportWidth / this._core.store.state.scale,
539
+ height: this._core.store.state.viewportHeight / this._core.store.state.scale};
519
540
  return (this.boundingBox.x < viewportBounds.x + viewportBounds.width &&
520
541
  this.boundingBox.x + this.boundingBox.width > viewportBounds.x &&
521
542
  this.boundingBox.y < viewportBounds.y + viewportBounds.height &&
522
543
  this.boundingBox.y + this.boundingBox.height > viewportBounds.y);
523
544
  }
524
545
  centerInViewport() {
525
- const scale = this._store.state.scale;
526
- this.translateX = (this._store.state.viewportWidth / 2 - this.totalWidth / 2 - this._store.state.translateX) / scale;
527
- this.translateY = (this._store.state.viewportHeight / 2 - this.totalHeight / 2 - this._store.state.translateY) / scale;
546
+ const scale = this._core.store.state.scale;
547
+ this.translateX = (this._core.store.state.viewportWidth / 2 - this.totalWidth / 2 - this._core.store.state.translateX) / scale;
548
+ this.translateY = (this._core.store.state.viewportHeight / 2 - this.totalHeight / 2 - this._core.store.state.translateY) / scale;
528
549
  }
529
550
  move(startX, startY, endX, endY) {
530
- const deltaX = (startX - endX) / this._store.state.scale;
531
- const deltaY = (startY - endY) / this._store.state.scale;
551
+ const deltaX = (startX - endX) / this._core.store.state.scale;
552
+ const deltaY = (startY - endY) / this._core.store.state.scale;
532
553
  this.translateX += deltaX;
533
554
  this.translateY += deltaY;
534
555
  }
@@ -554,7 +575,12 @@ class KritzelBaseObject {
554
575
  onSelectedClick() {
555
576
  // This method can be overridden by subclasses to handle click events when the object is selected.
556
577
  }
557
- revive(object) {
578
+ serialize() {
579
+ return {
580
+ ...ObjectHelper.clone(this)
581
+ };
582
+ }
583
+ deserialize(object) {
558
584
  Object.assign(this, object);
559
585
  return this;
560
586
  }
@@ -574,26 +600,26 @@ class KritzelBaseObject {
574
600
  updatePosition(x, y) {
575
601
  this.translateX = x;
576
602
  this.translateY = y;
577
- this._store.state.objectsMap.update(this);
603
+ this._core.store.state.objectsMap.update(this);
578
604
  }
579
605
  }
580
606
 
581
607
  class KritzelText extends KritzelBaseObject {
608
+ __class__ = 'KritzelText';
609
+ value = '';
610
+ fontFamily = 'Arial';
611
+ fontSize = 8;
612
+ fontColor = '#000000';
613
+ initialWidth = 3;
614
+ isNew = true;
615
+ isDebugInfoVisible = true;
616
+ isEditable = true;
617
+ rows = 1;
582
618
  get isReadonly() {
583
- return !(this._store.state.activeTool instanceof KritzelTextTool);
619
+ return !(this._core.store.state.activeTool instanceof KritzelTextTool);
584
620
  }
585
621
  constructor(config) {
586
622
  super();
587
- this.__class__ = 'KritzelText';
588
- this.value = '';
589
- this.fontFamily = 'Arial';
590
- this.fontSize = 8;
591
- this.fontColor = '#000000';
592
- this.initialWidth = 3;
593
- this.isNew = true;
594
- this.isDebugInfoVisible = true;
595
- this.isEditable = true;
596
- this.rows = 1;
597
623
  if (config) {
598
624
  this.value = config.value || ' ';
599
625
  this.translateX = config.translateX || 0;
@@ -606,22 +632,22 @@ class KritzelText extends KritzelBaseObject {
606
632
  this.scale = config.scale || 1;
607
633
  }
608
634
  }
609
- static create(store, fontSize, fontFamily) {
635
+ static create(core, fontSize, fontFamily) {
610
636
  const object = new KritzelText();
611
- object._store = store;
637
+ object._core = core;
612
638
  object.id = object.generateId();
613
- object.workspaceId = store.state.activeWorkspace.id;
639
+ object.workspaceId = core.store.state.activeWorkspace.id;
614
640
  object.fontSize = fontSize;
615
641
  object.fontFamily = fontFamily;
616
642
  object.translateX = 0;
617
643
  object.translateY = 0;
618
- object.width = object.initialWidth / (object._store.state.scale < 0 ? object._store.state.scale : 1);
619
- object.height = (object.fontSize * 1.2) / (object._store.state.scale < 0 ? object._store.state.scale : 1);
644
+ object.width = object.initialWidth / (object._core.store.state.scale < 0 ? object._core.store.state.scale : 1);
645
+ object.height = (object.fontSize * 1.2) / (object._core.store.state.scale < 0 ? object._core.store.state.scale : 1);
620
646
  object.padding = 5;
621
647
  object.backgroundColor = 'transparent';
622
- object.scale = object._store.state.scale;
648
+ object.scale = object._core.store.state.scale;
623
649
  object.value = ' ';
624
- object.zIndex = store.currentZIndex;
650
+ object.zIndex = core.store.currentZIndex;
625
651
  return object;
626
652
  }
627
653
  mount(element) {
@@ -675,7 +701,7 @@ class KritzelText extends KritzelBaseObject {
675
701
  document.body.removeChild(span);
676
702
  this.width = textWidth;
677
703
  this.height = textHeight;
678
- this._store.history.executeCommand(new UpdateObjectCommand(this._store, this, this, Object.assign({}, this)));
704
+ this._core.history.executeCommand(new UpdateObjectCommand(this._core, this, this, { ...this }));
679
705
  }
680
706
  }
681
707
  focus() {
@@ -708,10 +734,10 @@ class KritzelText extends KritzelBaseObject {
708
734
  }
709
735
  }
710
736
  edit() {
711
- this._store.setState('activeTool', KritzelToolRegistry.getTool('text'));
712
- this._store.state.selectionGroup = null;
713
- this._store.state.selectionBox = null;
714
- this._store.state.activeText = this;
737
+ this._core.store.setState('activeTool', KritzelToolRegistry.getTool('text'));
738
+ this._core.store.setState('selectionGroup', null);
739
+ this._core.store.setState('selectionBox', null);
740
+ this._core.store.setState('activeText', this);
715
741
  setTimeout(() => {
716
742
  this.focus();
717
743
  }, 300);
@@ -740,47 +766,50 @@ class KritzelMathHelper {
740
766
  }
741
767
 
742
768
  class KritzelPath extends KritzelBaseObject {
769
+ __class__ = 'KritzelPath';
770
+ points;
771
+ d;
772
+ stroke = 'none';
773
+ strokeWidth;
774
+ lineSlack = 0.5;
775
+ fill;
776
+ x = 0;
777
+ y = 0;
778
+ height = 0;
779
+ width = 0;
780
+ scale = 1;
781
+ options;
782
+ isVisible = true;
783
+ isDebugInfoVisible = true;
784
+ _adjustedPoints = null;
743
785
  get viewBox() {
744
786
  return `${this.x} ${this.y} ${this.width} ${this.height}`;
745
787
  }
746
788
  constructor(config) {
747
- var _a, _b, _c, _d, _e, _f;
748
789
  super();
749
- this.__class__ = 'KritzelPath';
750
- this.stroke = 'none';
751
- this.lineSlack = 0.5;
752
- this.x = 0;
753
- this.y = 0;
754
- this.height = 0;
755
- this.width = 0;
756
- this.scale = 1;
757
- this.isVisible = true;
758
- this.isDebugInfoVisible = true;
759
- this._adjustedPoints = null;
760
790
  this.options = config;
761
- this.points = (_a = config === null || config === void 0 ? void 0 : config.points) !== null && _a !== void 0 ? _a : [];
762
- this.translateX = (_b = config === null || config === void 0 ? void 0 : config.translateX) !== null && _b !== void 0 ? _b : 0;
763
- this.translateY = (_c = config === null || config === void 0 ? void 0 : config.translateY) !== null && _c !== void 0 ? _c : 0;
764
- this.scale = (_d = config === null || config === void 0 ? void 0 : config.scale) !== null && _d !== void 0 ? _d : 1;
765
- this.strokeWidth = (_e = config === null || config === void 0 ? void 0 : config.strokeWidth) !== null && _e !== void 0 ? _e : 8;
766
- this.fill = (_f = config === null || config === void 0 ? void 0 : config.fill) !== null && _f !== void 0 ? _f : '#000000';
791
+ this.points = config?.points ?? [];
792
+ this.translateX = config?.translateX ?? 0;
793
+ this.translateY = config?.translateY ?? 0;
794
+ this.scale = config?.scale ?? 1;
795
+ this.strokeWidth = config?.strokeWidth ?? 8;
796
+ this.fill = config?.fill ?? '#000000';
767
797
  this.d = this.generateSvgPath();
768
798
  this.updateDimensions();
769
799
  }
770
- static create(store, options) {
771
- var _a, _b, _c, _d, _e, _f;
800
+ static create(core, options) {
772
801
  const object = new KritzelPath();
773
- object._store = store;
802
+ object._core = core;
774
803
  object.id = object.generateId();
775
- object.workspaceId = store.state.activeWorkspace.id;
804
+ object.workspaceId = core.store.state.activeWorkspace.id;
776
805
  object.options = options;
777
- object.points = (_a = options === null || options === void 0 ? void 0 : options.points) !== null && _a !== void 0 ? _a : [];
778
- object.translateX = (_b = options === null || options === void 0 ? void 0 : options.translateX) !== null && _b !== void 0 ? _b : 0;
779
- object.translateY = (_c = options === null || options === void 0 ? void 0 : options.translateY) !== null && _c !== void 0 ? _c : 0;
780
- object.scale = (_d = options === null || options === void 0 ? void 0 : options.scale) !== null && _d !== void 0 ? _d : 1;
781
- object.strokeWidth = (_e = options === null || options === void 0 ? void 0 : options.strokeWidth) !== null && _e !== void 0 ? _e : 8;
782
- object.fill = (_f = options === null || options === void 0 ? void 0 : options.fill) !== null && _f !== void 0 ? _f : '#000000';
783
- object.zIndex = store.currentZIndex;
806
+ object.points = options?.points ?? [];
807
+ object.translateX = options?.translateX ?? 0;
808
+ object.translateY = options?.translateY ?? 0;
809
+ object.scale = options?.scale ?? 1;
810
+ object.strokeWidth = options?.strokeWidth ?? 8;
811
+ object.fill = options?.fill ?? '#000000';
812
+ object.zIndex = core.store.currentZIndex;
784
813
  object.d = object.generateSvgPath();
785
814
  object.updateDimensions();
786
815
  return object;
@@ -808,8 +837,8 @@ class KritzelPath extends KritzelBaseObject {
808
837
  this._adjustedPoints = null;
809
838
  }
810
839
  move(startX, startY, endX, endY) {
811
- const deltaX = (startX - endX) / this._store.state.scale;
812
- const deltaY = (startY - endY) / this._store.state.scale;
840
+ const deltaX = (startX - endX) / this._core.store.state.scale;
841
+ const deltaY = (startY - endY) / this._core.store.state.scale;
813
842
  this.translateX += deltaX;
814
843
  this.translateY += deltaY;
815
844
  this._adjustedPoints = null;
@@ -888,11 +917,10 @@ class KritzelPath extends KritzelBaseObject {
888
917
  this.translateX = x;
889
918
  this.translateY = y;
890
919
  this._adjustedPoints = null;
891
- this._store.state.objectsMap.update(this);
920
+ this._core.store.state.objectsMap.update(this);
892
921
  }
893
922
  computeAdjustedPoints() {
894
- var _a;
895
- if (!((_a = this.points) === null || _a === void 0 ? void 0 : _a.length)) {
923
+ if (!this.points?.length) {
896
924
  return [];
897
925
  }
898
926
  const angle = this.rotation;
@@ -1005,15 +1033,15 @@ class KritzelPath extends KritzelBaseObject {
1005
1033
  }
1006
1034
 
1007
1035
  class KritzelBrushTool extends KritzelBaseTool {
1008
- constructor(store) {
1009
- super(store);
1010
- this.type = 'pen';
1011
- this.color = '#000000';
1012
- this.size = 6;
1013
- this.palettes = {
1014
- pen: ['#000000', '#FFFFFF', '#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF', '#808080', '#C0C0C0', '#800000', '#008000', '#000080', '#808000', '#800080'],
1015
- highlighter: ['#ffff00', '#ffb347', '#b4ffb4'],
1016
- };
1036
+ type = 'pen';
1037
+ color = '#000000';
1038
+ size = 6;
1039
+ palettes = {
1040
+ pen: ['#000000', '#FFFFFF', '#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF', '#808080', '#C0C0C0', '#800000', '#008000', '#000080', '#808000', '#800080'],
1041
+ highlighter: ['#ffff00', '#ffb347', '#b4ffb4'],
1042
+ };
1043
+ constructor(core) {
1044
+ super(core);
1017
1045
  }
1018
1046
  handlePointerDown(event) {
1019
1047
  if (event.cancelable) {
@@ -1021,34 +1049,34 @@ class KritzelBrushTool extends KritzelBaseTool {
1021
1049
  }
1022
1050
  if (event.pointerType === 'mouse') {
1023
1051
  if (KritzelEventHelper.isLeftClick(event)) {
1024
- this._store.state.isDrawing = true;
1025
- const x = event.clientX - this._store.offsetX;
1026
- const y = event.clientY - this._store.offsetY;
1027
- this._store.state.currentPath = KritzelPath.create(this._store, {
1052
+ this._core.store.setState('isDrawing', true);
1053
+ const x = event.clientX - this._core.store.offsetX;
1054
+ const y = event.clientY - this._core.store.offsetY;
1055
+ this._core.store.setState('currentPath', KritzelPath.create(this._core, {
1028
1056
  points: [[x, y]],
1029
- translateX: -this._store.state.translateX,
1030
- translateY: -this._store.state.translateY,
1031
- scale: this._store.state.scale,
1057
+ translateX: -this._core.store.state.translateX,
1058
+ translateY: -this._core.store.state.translateY,
1059
+ scale: this._core.store.state.scale,
1032
1060
  fill: this.color,
1033
1061
  strokeWidth: this.size,
1034
- });
1062
+ }));
1035
1063
  }
1036
1064
  }
1037
1065
  if (event.pointerType === 'touch') {
1038
- const activePointers = Array.from(this._store.state.pointers.values());
1066
+ const activePointers = Array.from(this._core.store.state.pointers.values());
1039
1067
  if (activePointers.length === 1) {
1040
- const x = Math.round(activePointers[0].clientX - this._store.offsetX);
1041
- const y = Math.round(activePointers[0].clientY - this._store.offsetY);
1042
- this._store.state.isDrawing = true;
1043
- this._store.state.currentPath = KritzelPath.create(this._store, {
1068
+ const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);
1069
+ const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);
1070
+ this._core.store.setState('isDrawing', true);
1071
+ this._core.store.setState('currentPath', KritzelPath.create(this._core, {
1044
1072
  points: [[x, y]],
1045
- translateX: -this._store.state.translateX,
1046
- translateY: -this._store.state.translateY,
1047
- scale: this._store.state.scale,
1073
+ translateX: -this._core.store.state.translateX,
1074
+ translateY: -this._core.store.state.translateY,
1075
+ scale: this._core.store.state.scale,
1048
1076
  fill: this.color,
1049
1077
  strokeWidth: this.size,
1050
- });
1051
- this._store.rerender();
1078
+ }));
1079
+ this._core.rerender();
1052
1080
  }
1053
1081
  }
1054
1082
  }
@@ -1057,34 +1085,34 @@ class KritzelBrushTool extends KritzelBaseTool {
1057
1085
  event.preventDefault();
1058
1086
  }
1059
1087
  if (event.pointerType === 'mouse') {
1060
- if (this._store.state.isDrawing) {
1061
- const x = event.clientX - this._store.offsetX;
1062
- const y = event.clientY - this._store.offsetY;
1063
- this._store.state.currentPath = KritzelPath.create(this._store, {
1064
- points: [...this._store.state.currentPath.points, [x, y]],
1065
- translateX: -this._store.state.translateX,
1066
- translateY: -this._store.state.translateY,
1067
- scale: this._store.state.scale,
1088
+ if (this._core.store.state.isDrawing) {
1089
+ const x = event.clientX - this._core.store.offsetX;
1090
+ const y = event.clientY - this._core.store.offsetY;
1091
+ this._core.store.setState('currentPath', KritzelPath.create(this._core, {
1092
+ points: [...this._core.store.state.currentPath.points, [x, y]],
1093
+ translateX: -this._core.store.state.translateX,
1094
+ translateY: -this._core.store.state.translateY,
1095
+ scale: this._core.store.state.scale,
1068
1096
  fill: this.color,
1069
1097
  strokeWidth: this.size,
1070
- });
1071
- this._store.rerender();
1098
+ }));
1099
+ this._core.rerender();
1072
1100
  }
1073
1101
  }
1074
1102
  if (event.pointerType === 'touch') {
1075
- const activePointers = Array.from(this._store.state.pointers.values());
1103
+ const activePointers = Array.from(this._core.store.state.pointers.values());
1076
1104
  if (activePointers.length === 1) {
1077
- const x = Math.round(activePointers[0].clientX - this._store.offsetX);
1078
- const y = Math.round(activePointers[0].clientY - this._store.offsetY);
1079
- this._store.state.currentPath = KritzelPath.create(this._store, {
1080
- points: [...this._store.state.currentPath.points, [x, y]],
1081
- translateX: -this._store.state.translateX,
1082
- translateY: -this._store.state.translateY,
1083
- scale: this._store.state.scale,
1105
+ const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);
1106
+ const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);
1107
+ this._core.store.setState('currentPath', KritzelPath.create(this._core, {
1108
+ points: [...this._core.store.state.currentPath.points, [x, y]],
1109
+ translateX: -this._core.store.state.translateX,
1110
+ translateY: -this._core.store.state.translateY,
1111
+ scale: this._core.store.state.scale,
1084
1112
  fill: this.color,
1085
1113
  strokeWidth: this.size,
1086
- });
1087
- this._store.rerender();
1114
+ }));
1115
+ this._core.rerender();
1088
1116
  }
1089
1117
  }
1090
1118
  }
@@ -1093,30 +1121,34 @@ class KritzelBrushTool extends KritzelBaseTool {
1093
1121
  event.preventDefault();
1094
1122
  }
1095
1123
  if (event.pointerType === 'mouse') {
1096
- if (this._store.state.isDrawing) {
1097
- this._store.state.isDrawing = false;
1098
- if (this._store.state.currentPath) {
1099
- this._store.state.currentPath.zIndex = this._store.currentZIndex;
1100
- this._store.history.executeCommand(new AddObjectCommand(this._store, this, this._store.state.currentPath));
1124
+ if (this._core.store.state.isDrawing) {
1125
+ this._core.store.setState('isDrawing', false);
1126
+ if (this._core.store.state.currentPath) {
1127
+ const currentPath = this._core.store.state.currentPath;
1128
+ currentPath.zIndex = this._core.store.currentZIndex;
1129
+ this._core.store.setState('currentPath', currentPath);
1130
+ this._core.history.executeCommand(new AddObjectCommand(this._core, this, this._core.store.state.currentPath));
1101
1131
  }
1102
- this._store.state.currentPath = undefined;
1132
+ this._core.store.setState('currentPath', undefined);
1103
1133
  }
1104
1134
  }
1105
1135
  if (event.pointerType === 'touch') {
1106
- if (this._store.state.isDrawing) {
1107
- this._store.state.isDrawing = false;
1108
- if (this._store.state.currentPath) {
1109
- this._store.state.currentPath.zIndex = this._store.currentZIndex;
1110
- this._store.history.executeCommand(new AddObjectCommand(this._store, this, this._store.state.currentPath));
1136
+ if (this._core.store.state.isDrawing) {
1137
+ this._core.store.setState('isDrawing', false);
1138
+ if (this._core.store.state.currentPath) {
1139
+ const currentPath = this._core.store.state.currentPath;
1140
+ currentPath.zIndex = this._core.store.currentZIndex;
1141
+ this._core.store.setState('currentPath', currentPath);
1142
+ this._core.history.executeCommand(new AddObjectCommand(this._core, this, currentPath));
1111
1143
  }
1112
- this._store.state.currentPath = undefined;
1113
- this._store.rerender();
1144
+ this._core.store.setState('currentPath', undefined);
1145
+ this._core.rerender();
1114
1146
  }
1115
1147
  }
1116
1148
  }
1117
1149
  }
1118
1150
 
1119
1151
  export { AddObjectCommand as A, KritzelText as K, UpdateObjectCommand as U, KritzelPath as a, KritzelBrushTool as b, KritzelTextTool as c, KritzelKeyboardHelper as d, KritzelBaseObject as e, KritzelBaseCommand as f, KritzelBaseTool as g, KritzelEventHelper as h, KritzelToolRegistry as i };
1120
- //# sourceMappingURL=p-C9-70hiF.js.map
1152
+ //# sourceMappingURL=p-B3VQubt_.js.map
1121
1153
 
1122
- //# sourceMappingURL=p-C9-70hiF.js.map
1154
+ //# sourceMappingURL=p-B3VQubt_.js.map