kritzel-stencil 0.0.124 → 0.0.126

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 (378) hide show
  1. package/dist/{components/p-Cnc43o9b.js → stencil/brush-tool.class-D1U3x9_Y.js} +57 -11
  2. package/dist/stencil/brush-tool.class-D1U3x9_Y.js.map +1 -0
  3. package/dist/{collection/configs/default-brush-tool.config.js → stencil/default-text-tool.config-DvOZmpuR.js} +38 -2
  4. package/dist/stencil/default-text-tool.config-DvOZmpuR.js.map +1 -0
  5. package/dist/stencil/engine.constants-DsjjAmnl.js +7 -0
  6. package/dist/stencil/engine.constants-DsjjAmnl.js.map +1 -0
  7. package/dist/{components/p-D8W6LE-c.js → stencil/event-button.enum-D8W6LE-c.js} +2 -2
  8. package/dist/stencil/event-button.enum-D8W6LE-c.js.map +1 -0
  9. package/dist/{collection/classes/registries/icon-registry.class.js → stencil/icon-registry.class-Bw5YkOTi.js} +6 -2
  10. package/dist/stencil/icon-registry.class-Bw5YkOTi.js.map +1 -0
  11. package/dist/stencil/image-tool.class-uKAmXFSl.js +1341 -0
  12. package/dist/stencil/image-tool.class-uKAmXFSl.js.map +1 -0
  13. package/dist/stencil/index-Df69oUcb.js +4334 -0
  14. package/dist/stencil/index-Df69oUcb.js.map +1 -0
  15. package/dist/stencil/index.esm.js +16 -1
  16. package/dist/stencil/index.esm.js.map +1 -1
  17. package/dist/stencil/kritzel-brush-style.entry.esm.js.map +1 -0
  18. package/dist/stencil/kritzel-brush-style.entry.js +31 -0
  19. package/dist/stencil/kritzel-brush-style.entry.js.map +1 -0
  20. package/dist/stencil/kritzel-color-palette.entry.esm.js.map +1 -0
  21. package/dist/{components/p-Bn5P7YQn.js → stencil/kritzel-color-palette.entry.js} +11 -37
  22. package/dist/stencil/kritzel-color-palette.entry.js.map +1 -0
  23. package/dist/stencil/kritzel-color.entry.esm.js.map +1 -0
  24. package/dist/{components/p-D0sLslUq.js → stencil/kritzel-color.entry.js} +11 -29
  25. package/dist/stencil/kritzel-color.entry.js.map +1 -0
  26. package/dist/{components/p-BY8BWGge.js → stencil/kritzel-context-menu-B2p1_Ffh.js} +12 -40
  27. package/dist/stencil/kritzel-context-menu-B2p1_Ffh.js.map +1 -0
  28. package/dist/stencil/kritzel-context-menu-DPHV6MRm.js +91 -0
  29. package/dist/stencil/kritzel-context-menu-DPHV6MRm.js.map +1 -0
  30. package/dist/stencil/kritzel-context-menu.entry.esm.js.map +1 -0
  31. package/dist/stencil/kritzel-context-menu.entry.js +5 -0
  32. package/dist/stencil/kritzel-context-menu.entry.js.map +1 -0
  33. package/dist/stencil/kritzel-control-brush-config.entry.esm.js.map +1 -0
  34. package/dist/stencil/kritzel-control-brush-config.entry.js +54 -0
  35. package/dist/stencil/kritzel-control-brush-config.entry.js.map +1 -0
  36. package/dist/stencil/kritzel-control-text-config.entry.esm.js.map +1 -0
  37. package/dist/stencil/kritzel-control-text-config.entry.js +42 -0
  38. package/dist/stencil/kritzel-control-text-config.entry.js.map +1 -0
  39. package/dist/stencil/kritzel-controls.entry.esm.js.map +1 -0
  40. package/dist/{components/p-CneTqrgt.js → stencil/kritzel-controls.entry.js} +16 -116
  41. package/dist/stencil/kritzel-controls.entry.js.map +1 -0
  42. package/dist/stencil/kritzel-cursor-trail.entry.esm.js.map +1 -0
  43. package/dist/{components/p-Cw2ATHMj.js → stencil/kritzel-cursor-trail.entry.js} +11 -30
  44. package/dist/stencil/kritzel-cursor-trail.entry.js.map +1 -0
  45. package/dist/stencil/kritzel-dropdown.entry.esm.js.map +1 -0
  46. package/dist/{components/p-NZJPrwJV.js → stencil/kritzel-dropdown.entry.js} +11 -37
  47. package/dist/stencil/kritzel-dropdown.entry.js.map +1 -0
  48. package/dist/stencil/kritzel-editor.entry.esm.js.map +1 -0
  49. package/dist/stencil/kritzel-editor.entry.js +180 -0
  50. package/dist/stencil/kritzel-editor.entry.js.map +1 -0
  51. package/dist/stencil/kritzel-engine.entry.esm.js.map +1 -0
  52. package/dist/stencil/kritzel-engine.entry.js +1318 -0
  53. package/dist/stencil/kritzel-engine.entry.js.map +1 -0
  54. package/dist/stencil/kritzel-font-family.entry.esm.js.map +1 -0
  55. package/dist/{components/p-CF8ziFc4.js → stencil/kritzel-font-family.entry.js} +11 -35
  56. package/dist/stencil/kritzel-font-family.entry.js.map +1 -0
  57. package/dist/stencil/kritzel-font-size.entry.esm.js.map +1 -0
  58. package/dist/stencil/kritzel-font-size.entry.js +29 -0
  59. package/dist/stencil/kritzel-font-size.entry.js.map +1 -0
  60. package/dist/stencil/kritzel-font.entry.esm.js.map +1 -0
  61. package/dist/stencil/kritzel-font.entry.js +25 -0
  62. package/dist/stencil/kritzel-font.entry.js.map +1 -0
  63. package/dist/stencil/kritzel-icon.entry.esm.js.map +1 -0
  64. package/dist/stencil/kritzel-icon.entry.js +29 -0
  65. package/dist/stencil/kritzel-icon.entry.js.map +1 -0
  66. package/dist/stencil/kritzel-stroke-size.entry.esm.js.map +1 -0
  67. package/dist/stencil/kritzel-stroke-size.entry.js +28 -0
  68. package/dist/stencil/kritzel-stroke-size.entry.js.map +1 -0
  69. package/dist/stencil/kritzel-tooltip.entry.esm.js.map +1 -0
  70. package/dist/{components/p-DpiklJU9.js → stencil/kritzel-tooltip.entry.js} +14 -37
  71. package/dist/stencil/kritzel-tooltip.entry.js.map +1 -0
  72. package/dist/stencil/kritzel-utility-panel.entry.esm.js.map +1 -0
  73. package/dist/stencil/kritzel-utility-panel.entry.js +33 -0
  74. package/dist/stencil/kritzel-utility-panel.entry.js.map +1 -0
  75. package/dist/stencil/loader.esm.js.map +1 -1
  76. package/dist/stencil/stencil.esm.js +49 -1
  77. package/dist/stencil/stencil.esm.js.map +1 -1
  78. package/dist/types/classes/objects/path.class.d.ts +1 -1
  79. package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +2 -2
  80. package/dist/types/components.d.ts +4 -4
  81. package/package.json +62 -57
  82. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -8
  83. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
  84. package/dist/cjs/index-C05uAr89.js +0 -1591
  85. package/dist/cjs/index-C05uAr89.js.map +0 -1
  86. package/dist/cjs/index-UcX3pzju.js +0 -2549
  87. package/dist/cjs/index-UcX3pzju.js.map +0 -1
  88. package/dist/cjs/index.cjs.js +0 -19
  89. package/dist/cjs/index.cjs.js.map +0 -1
  90. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js +0 -2366
  91. package/dist/cjs/kritzel-brush-style_18.cjs.entry.js.map +0 -1
  92. package/dist/cjs/loader.cjs.js +0 -16
  93. package/dist/cjs/loader.cjs.js.map +0 -1
  94. package/dist/cjs/stencil.cjs.js +0 -28
  95. package/dist/cjs/stencil.cjs.js.map +0 -1
  96. package/dist/collection/classes/commands/add-object.command.js +0 -14
  97. package/dist/collection/classes/commands/add-object.command.js.map +0 -1
  98. package/dist/collection/classes/commands/add-selection-group.command.js +0 -20
  99. package/dist/collection/classes/commands/add-selection-group.command.js.map +0 -1
  100. package/dist/collection/classes/commands/base.command.js +0 -15
  101. package/dist/collection/classes/commands/base.command.js.map +0 -1
  102. package/dist/collection/classes/commands/batch.command.js +0 -14
  103. package/dist/collection/classes/commands/batch.command.js.map +0 -1
  104. package/dist/collection/classes/commands/move-selection-group.command.js +0 -25
  105. package/dist/collection/classes/commands/move-selection-group.command.js.map +0 -1
  106. package/dist/collection/classes/commands/remove-object.command.js +0 -17
  107. package/dist/collection/classes/commands/remove-object.command.js.map +0 -1
  108. package/dist/collection/classes/commands/remove-selection-group.command.js +0 -18
  109. package/dist/collection/classes/commands/remove-selection-group.command.js.map +0 -1
  110. package/dist/collection/classes/commands/resize-selection-group.command.js +0 -18
  111. package/dist/collection/classes/commands/resize-selection-group.command.js.map +0 -1
  112. package/dist/collection/classes/commands/rotate-selection-group.command.js +0 -24
  113. package/dist/collection/classes/commands/rotate-selection-group.command.js.map +0 -1
  114. package/dist/collection/classes/commands/update-object.command.js +0 -29
  115. package/dist/collection/classes/commands/update-object.command.js.map +0 -1
  116. package/dist/collection/classes/commands/update-viewport.command.js +0 -23
  117. package/dist/collection/classes/commands/update-viewport.command.js.map +0 -1
  118. package/dist/collection/classes/handlers/base.handler.js +0 -7
  119. package/dist/collection/classes/handlers/base.handler.js.map +0 -1
  120. package/dist/collection/classes/handlers/context-menu.handler.js +0 -47
  121. package/dist/collection/classes/handlers/context-menu.handler.js.map +0 -1
  122. package/dist/collection/classes/handlers/hover.handler.js +0 -22
  123. package/dist/collection/classes/handlers/hover.handler.js.map +0 -1
  124. package/dist/collection/classes/handlers/key.handler.js +0 -81
  125. package/dist/collection/classes/handlers/key.handler.js.map +0 -1
  126. package/dist/collection/classes/handlers/move.handler.js +0 -84
  127. package/dist/collection/classes/handlers/move.handler.js.map +0 -1
  128. package/dist/collection/classes/handlers/resize.handler.js +0 -150
  129. package/dist/collection/classes/handlers/resize.handler.js.map +0 -1
  130. package/dist/collection/classes/handlers/rotation.handler.js +0 -102
  131. package/dist/collection/classes/handlers/rotation.handler.js.map +0 -1
  132. package/dist/collection/classes/handlers/selection.handler.js +0 -200
  133. package/dist/collection/classes/handlers/selection.handler.js.map +0 -1
  134. package/dist/collection/classes/history.class.js +0 -71
  135. package/dist/collection/classes/history.class.js.map +0 -1
  136. package/dist/collection/classes/objects/base-object.class.js +0 -199
  137. package/dist/collection/classes/objects/base-object.class.js.map +0 -1
  138. package/dist/collection/classes/objects/custom-element.class.js +0 -52
  139. package/dist/collection/classes/objects/custom-element.class.js.map +0 -1
  140. package/dist/collection/classes/objects/image.class.js +0 -53
  141. package/dist/collection/classes/objects/image.class.js.map +0 -1
  142. package/dist/collection/classes/objects/path.class.js +0 -260
  143. package/dist/collection/classes/objects/path.class.js.map +0 -1
  144. package/dist/collection/classes/objects/selection-box.class.js +0 -22
  145. package/dist/collection/classes/objects/selection-box.class.js.map +0 -1
  146. package/dist/collection/classes/objects/selection-group.class.js +0 -161
  147. package/dist/collection/classes/objects/selection-group.class.js.map +0 -1
  148. package/dist/collection/classes/objects/text.class.js +0 -141
  149. package/dist/collection/classes/objects/text.class.js.map +0 -1
  150. package/dist/collection/classes/registries/icon-registry.class.js.map +0 -1
  151. package/dist/collection/classes/registries/tool.registry.js +0 -18
  152. package/dist/collection/classes/registries/tool.registry.js.map +0 -1
  153. package/dist/collection/classes/reviver.class.js +0 -66
  154. package/dist/collection/classes/reviver.class.js.map +0 -1
  155. package/dist/collection/classes/store.class.js +0 -287
  156. package/dist/collection/classes/store.class.js.map +0 -1
  157. package/dist/collection/classes/structures/circular-buffer.structure.js +0 -46
  158. package/dist/collection/classes/structures/circular-buffer.structure.js.map +0 -1
  159. package/dist/collection/classes/structures/octree.structure.js +0 -111
  160. package/dist/collection/classes/structures/octree.structure.js.map +0 -1
  161. package/dist/collection/classes/tools/base-tool.class.js +0 -31
  162. package/dist/collection/classes/tools/base-tool.class.js.map +0 -1
  163. package/dist/collection/classes/tools/brush-tool.class.js +0 -116
  164. package/dist/collection/classes/tools/brush-tool.class.js.map +0 -1
  165. package/dist/collection/classes/tools/eraser-tool.class.js +0 -86
  166. package/dist/collection/classes/tools/eraser-tool.class.js.map +0 -1
  167. package/dist/collection/classes/tools/image-tool.class.js +0 -88
  168. package/dist/collection/classes/tools/image-tool.class.js.map +0 -1
  169. package/dist/collection/classes/tools/selection-tool.class.js +0 -156
  170. package/dist/collection/classes/tools/selection-tool.class.js.map +0 -1
  171. package/dist/collection/classes/tools/text-tool.class.js +0 -116
  172. package/dist/collection/classes/tools/text-tool.class.js.map +0 -1
  173. package/dist/collection/classes/viewport.class.js +0 -148
  174. package/dist/collection/classes/viewport.class.js.map +0 -1
  175. package/dist/collection/collection-manifest.json +0 -29
  176. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.css +0 -10
  177. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +0 -154
  178. package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js.map +0 -1
  179. package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +0 -24
  180. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +0 -672
  181. package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +0 -1
  182. package/dist/collection/components/core/kritzel-engine/kritzel-engine.css +0 -60
  183. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +0 -1288
  184. package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +0 -1
  185. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.css +0 -44
  186. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +0 -100
  187. package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js.map +0 -1
  188. package/dist/collection/components/shared/kritzel-color/kritzel-color.css +0 -21
  189. package/dist/collection/components/shared/kritzel-color/kritzel-color.js +0 -108
  190. package/dist/collection/components/shared/kritzel-color/kritzel-color.js.map +0 -1
  191. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +0 -46
  192. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +0 -147
  193. package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js.map +0 -1
  194. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.css +0 -53
  195. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +0 -215
  196. package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js.map +0 -1
  197. package/dist/collection/components/shared/kritzel-font/kritzel-font.css +0 -10
  198. package/dist/collection/components/shared/kritzel-font/kritzel-font.js +0 -92
  199. package/dist/collection/components/shared/kritzel-font/kritzel-font.js.map +0 -1
  200. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.css +0 -48
  201. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +0 -115
  202. package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js.map +0 -1
  203. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.css +0 -30
  204. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +0 -112
  205. package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js.map +0 -1
  206. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.css +0 -17
  207. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js +0 -94
  208. package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js.map +0 -1
  209. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +0 -28
  210. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +0 -91
  211. package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js.map +0 -1
  212. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.css +0 -17
  213. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +0 -181
  214. package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js.map +0 -1
  215. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.css +0 -55
  216. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +0 -178
  217. package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js.map +0 -1
  218. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.css +0 -19
  219. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +0 -136
  220. package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js.map +0 -1
  221. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.css +0 -19
  222. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +0 -116
  223. package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js.map +0 -1
  224. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +0 -124
  225. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +0 -268
  226. package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +0 -1
  227. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +0 -33
  228. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +0 -79
  229. package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js.map +0 -1
  230. package/dist/collection/configs/default-brush-tool.config.js.map +0 -1
  231. package/dist/collection/configs/default-engine-state.js +0 -58
  232. package/dist/collection/configs/default-engine-state.js.map +0 -1
  233. package/dist/collection/configs/default-text-tool.config.js +0 -32
  234. package/dist/collection/configs/default-text-tool.config.js.map +0 -1
  235. package/dist/collection/constants/engine.constants.js +0 -3
  236. package/dist/collection/constants/engine.constants.js.map +0 -1
  237. package/dist/collection/enums/event-button.enum.js +0 -7
  238. package/dist/collection/enums/event-button.enum.js.map +0 -1
  239. package/dist/collection/enums/handle-type.enum.js +0 -8
  240. package/dist/collection/enums/handle-type.enum.js.map +0 -1
  241. package/dist/collection/helpers/class.helper.js +0 -6
  242. package/dist/collection/helpers/class.helper.js.map +0 -1
  243. package/dist/collection/helpers/devices.helper.js +0 -6
  244. package/dist/collection/helpers/devices.helper.js.map +0 -1
  245. package/dist/collection/helpers/event.helper.js +0 -58
  246. package/dist/collection/helpers/event.helper.js.map +0 -1
  247. package/dist/collection/helpers/geometry.helper.js +0 -53
  248. package/dist/collection/helpers/geometry.helper.js.map +0 -1
  249. package/dist/collection/helpers/html.helper.js +0 -7
  250. package/dist/collection/helpers/html.helper.js.map +0 -1
  251. package/dist/collection/helpers/keyboard.helper.js +0 -31
  252. package/dist/collection/helpers/keyboard.helper.js.map +0 -1
  253. package/dist/collection/helpers/math.helper.js +0 -6
  254. package/dist/collection/helpers/math.helper.js.map +0 -1
  255. package/dist/collection/helpers/object.helper.js +0 -38
  256. package/dist/collection/helpers/object.helper.js.map +0 -1
  257. package/dist/collection/index.js +0 -21
  258. package/dist/collection/index.js.map +0 -1
  259. package/dist/collection/interfaces/bounding-box.interface.js +0 -2
  260. package/dist/collection/interfaces/bounding-box.interface.js.map +0 -1
  261. package/dist/collection/interfaces/command.interface.js +0 -2
  262. package/dist/collection/interfaces/command.interface.js.map +0 -1
  263. package/dist/collection/interfaces/context-menu-item.interface.js +0 -2
  264. package/dist/collection/interfaces/context-menu-item.interface.js.map +0 -1
  265. package/dist/collection/interfaces/debug-info.interface.js +0 -2
  266. package/dist/collection/interfaces/debug-info.interface.js.map +0 -1
  267. package/dist/collection/interfaces/engine-state.interface.js +0 -2
  268. package/dist/collection/interfaces/engine-state.interface.js.map +0 -1
  269. package/dist/collection/interfaces/object.interface.js +0 -2
  270. package/dist/collection/interfaces/object.interface.js.map +0 -1
  271. package/dist/collection/interfaces/path-options.interface.js +0 -2
  272. package/dist/collection/interfaces/path-options.interface.js.map +0 -1
  273. package/dist/collection/interfaces/point.interface.js +0 -2
  274. package/dist/collection/interfaces/point.interface.js.map +0 -1
  275. package/dist/collection/interfaces/polygon.interface.js +0 -2
  276. package/dist/collection/interfaces/polygon.interface.js.map +0 -1
  277. package/dist/collection/interfaces/selection-state.interface.js +0 -2
  278. package/dist/collection/interfaces/selection-state.interface.js.map +0 -1
  279. package/dist/collection/interfaces/serializable.interface.js +0 -2
  280. package/dist/collection/interfaces/serializable.interface.js.map +0 -1
  281. package/dist/collection/interfaces/tool.interface.js +0 -2
  282. package/dist/collection/interfaces/tool.interface.js.map +0 -1
  283. package/dist/collection/interfaces/toolbar-control.interface.js +0 -2
  284. package/dist/collection/interfaces/toolbar-control.interface.js.map +0 -1
  285. package/dist/collection/types/state.types.js +0 -2
  286. package/dist/collection/types/state.types.js.map +0 -1
  287. package/dist/components/index.js +0 -24
  288. package/dist/components/index.js.map +0 -1
  289. package/dist/components/kritzel-brush-style.js +0 -9
  290. package/dist/components/kritzel-brush-style.js.map +0 -1
  291. package/dist/components/kritzel-color-palette.js +0 -9
  292. package/dist/components/kritzel-color-palette.js.map +0 -1
  293. package/dist/components/kritzel-color.js +0 -9
  294. package/dist/components/kritzel-color.js.map +0 -1
  295. package/dist/components/kritzel-context-menu.js +0 -9
  296. package/dist/components/kritzel-context-menu.js.map +0 -1
  297. package/dist/components/kritzel-control-brush-config.js +0 -9
  298. package/dist/components/kritzel-control-brush-config.js.map +0 -1
  299. package/dist/components/kritzel-control-text-config.js +0 -9
  300. package/dist/components/kritzel-control-text-config.js.map +0 -1
  301. package/dist/components/kritzel-controls.js +0 -9
  302. package/dist/components/kritzel-controls.js.map +0 -1
  303. package/dist/components/kritzel-cursor-trail.js +0 -9
  304. package/dist/components/kritzel-cursor-trail.js.map +0 -1
  305. package/dist/components/kritzel-dropdown.js +0 -9
  306. package/dist/components/kritzel-dropdown.js.map +0 -1
  307. package/dist/components/kritzel-editor.js +0 -409
  308. package/dist/components/kritzel-editor.js.map +0 -1
  309. package/dist/components/kritzel-engine.js +0 -9
  310. package/dist/components/kritzel-engine.js.map +0 -1
  311. package/dist/components/kritzel-font-family.js +0 -9
  312. package/dist/components/kritzel-font-family.js.map +0 -1
  313. package/dist/components/kritzel-font-size.js +0 -9
  314. package/dist/components/kritzel-font-size.js.map +0 -1
  315. package/dist/components/kritzel-font.js +0 -9
  316. package/dist/components/kritzel-font.js.map +0 -1
  317. package/dist/components/kritzel-icon.js +0 -9
  318. package/dist/components/kritzel-icon.js.map +0 -1
  319. package/dist/components/kritzel-stroke-size.js +0 -9
  320. package/dist/components/kritzel-stroke-size.js.map +0 -1
  321. package/dist/components/kritzel-tooltip.js +0 -9
  322. package/dist/components/kritzel-tooltip.js.map +0 -1
  323. package/dist/components/kritzel-utility-panel.js +0 -9
  324. package/dist/components/kritzel-utility-panel.js.map +0 -1
  325. package/dist/components/p-BOj_wqdw.js +0 -54
  326. package/dist/components/p-BOj_wqdw.js.map +0 -1
  327. package/dist/components/p-BY8BWGge.js.map +0 -1
  328. package/dist/components/p-Bn5P7YQn.js.map +0 -1
  329. package/dist/components/p-C9usqwb5.js +0 -61
  330. package/dist/components/p-C9usqwb5.js.map +0 -1
  331. package/dist/components/p-CF8ziFc4.js.map +0 -1
  332. package/dist/components/p-CiT5gBDh.js +0 -44
  333. package/dist/components/p-CiT5gBDh.js.map +0 -1
  334. package/dist/components/p-Cn_kantt.js +0 -54
  335. package/dist/components/p-Cn_kantt.js.map +0 -1
  336. package/dist/components/p-Cnc43o9b.js.map +0 -1
  337. package/dist/components/p-CneTqrgt.js.map +0 -1
  338. package/dist/components/p-CtiROna-.js +0 -90
  339. package/dist/components/p-CtiROna-.js.map +0 -1
  340. package/dist/components/p-Cw2ATHMj.js.map +0 -1
  341. package/dist/components/p-D0sLslUq.js.map +0 -1
  342. package/dist/components/p-D8W6LE-c.js.map +0 -1
  343. package/dist/components/p-DJN0U8pI.js +0 -1327
  344. package/dist/components/p-DJN0U8pI.js.map +0 -1
  345. package/dist/components/p-DJaVT2yR.js +0 -2724
  346. package/dist/components/p-DJaVT2yR.js.map +0 -1
  347. package/dist/components/p-DMAzUKo6.js +0 -102
  348. package/dist/components/p-DMAzUKo6.js.map +0 -1
  349. package/dist/components/p-DSLY0tr5.js +0 -52
  350. package/dist/components/p-DSLY0tr5.js.map +0 -1
  351. package/dist/components/p-DpiklJU9.js.map +0 -1
  352. package/dist/components/p-NZJPrwJV.js.map +0 -1
  353. package/dist/components/p-ubNAWsY_.js +0 -111
  354. package/dist/components/p-ubNAWsY_.js.map +0 -1
  355. package/dist/esm/app-globals-DQuL1Twl.js +0 -6
  356. package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
  357. package/dist/esm/index-BGl8znzE.js +0 -1564
  358. package/dist/esm/index-BGl8znzE.js.map +0 -1
  359. package/dist/esm/index-DO2IiM_o.js +0 -2525
  360. package/dist/esm/index-DO2IiM_o.js.map +0 -1
  361. package/dist/esm/index.js +0 -4
  362. package/dist/esm/index.js.map +0 -1
  363. package/dist/esm/kritzel-brush-style_18.entry.js +0 -2347
  364. package/dist/esm/kritzel-brush-style_18.entry.js.map +0 -1
  365. package/dist/esm/loader.js +0 -14
  366. package/dist/esm/loader.js.map +0 -1
  367. package/dist/esm/stencil.js +0 -24
  368. package/dist/esm/stencil.js.map +0 -1
  369. package/dist/index.cjs.js +0 -1
  370. package/dist/index.js +0 -1
  371. package/dist/stencil/p-BGl8znzE.js +0 -3
  372. package/dist/stencil/p-BGl8znzE.js.map +0 -1
  373. package/dist/stencil/p-DO2IiM_o.js +0 -2
  374. package/dist/stencil/p-DO2IiM_o.js.map +0 -1
  375. package/dist/stencil/p-DQuL1Twl.js +0 -2
  376. package/dist/stencil/p-DQuL1Twl.js.map +0 -1
  377. package/dist/stencil/p-c64f6589.entry.js +0 -2
  378. package/dist/stencil/p-c64f6589.entry.js.map +0 -1
@@ -0,0 +1,1318 @@
1
+ import { r as registerInstance, a as createEvent, h, d as Host, e as getElement } from './index-Df69oUcb.js';
2
+ import { K as KritzelMouseButton } from './event-button.enum-D8W6LE-c.js';
3
+ import { d as KritzelEventHelper, e as KritzelBaseCommand, A as AddObjectCommand, f as KritzelToolRegistry, g as KritzelBaseTool, h as KritzelKeyboardHelper } from './brush-tool.class-D1U3x9_Y.js';
4
+ import { d as KritzelSelectionGroup, e as KrtizelSelectionBox, R as RemoveSelectionGroupCommand, f as RemoveObjectCommand, B as BatchCommand, A as AddSelectionGroupCommand, g as KritzelBaseHandler, c as KritzelSelectionTool, a as KritzelEraserTool } from './image-tool.class-uKAmXFSl.js';
5
+ import { K as KritzelContextMenu } from './kritzel-context-menu-DPHV6MRm.js';
6
+ import { A as ABSOLUTE_SCALE_MAX, a as ABSOLUTE_SCALE_MIN } from './engine.constants-DsjjAmnl.js';
7
+
8
+ class KritzelViewport {
9
+ constructor(store, host) {
10
+ this.initialTouchDistance = 0;
11
+ this.startX = 0;
12
+ this.startY = 0;
13
+ this._store = store;
14
+ this._store.state.host = host;
15
+ this._store.state.viewportWidth = host.clientWidth;
16
+ this._store.state.viewportHeight = host.clientHeight;
17
+ this._store.state.startX = 0;
18
+ this._store.state.startY = 0;
19
+ this._store.state.translateX = 0;
20
+ this._store.state.translateY = 0;
21
+ }
22
+ handleResize() {
23
+ this._store.state.viewportWidth = this._store.state.host.clientWidth;
24
+ this._store.state.viewportHeight = this._store.state.host.clientHeight;
25
+ this._store.state.hasViewportChanged = true;
26
+ this._store.rerender();
27
+ }
28
+ handlePointerDown(event) {
29
+ if (event.pointerType === 'mouse') {
30
+ const adjustedClientX = event.clientX - this._store.offsetX;
31
+ const adjustedClientY = event.clientY - this._store.offsetY;
32
+ if (event.button === KritzelMouseButton.Right) {
33
+ this._store.state.isPanning = true;
34
+ this._store.state.startX = adjustedClientX;
35
+ this._store.state.startY = adjustedClientY;
36
+ }
37
+ }
38
+ if (event.pointerType === 'touch') {
39
+ const activePointers = Array.from(this._store.state.pointers.values());
40
+ if (activePointers.length === 2) {
41
+ this._store.state.currentPath = null;
42
+ this._store.state.isScaling = true;
43
+ const firstTouchX = activePointers[0].clientX - this._store.offsetX;
44
+ const firstTouchY = activePointers[0].clientY - this._store.offsetY;
45
+ const secondTouchX = activePointers[1].clientX - this._store.offsetX;
46
+ const secondTouchY = activePointers[1].clientY - this._store.offsetY;
47
+ this.initialTouchDistance = Math.sqrt(Math.pow(firstTouchX - secondTouchX, 2) + Math.pow(firstTouchY - secondTouchY, 2));
48
+ this.startX = (firstTouchX + secondTouchX) / 2;
49
+ this.startY = (firstTouchY + secondTouchY) / 2;
50
+ this._store.rerender();
51
+ }
52
+ }
53
+ }
54
+ handlePointerMove(event) {
55
+ if (event.pointerType === 'mouse') {
56
+ const hostRect = this._store.state.host.getBoundingClientRect();
57
+ const xRelativeToHost = event.clientX - hostRect.left;
58
+ const yRelativeToHost = event.clientY - hostRect.top;
59
+ this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
60
+ this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
61
+ if (this._store.state.isPanning) {
62
+ this._store.state.translateX -= this._store.state.startX - xRelativeToHost;
63
+ this._store.state.translateY -= this._store.state.startY - yRelativeToHost;
64
+ this._store.state.startX = xRelativeToHost;
65
+ this._store.state.startY = yRelativeToHost;
66
+ this._store.state.hasViewportChanged = true;
67
+ this._store.state.skipContextMenu = true;
68
+ this._store.rerender();
69
+ }
70
+ }
71
+ if (event.pointerType === 'touch') {
72
+ const hostRect = this._store.state.host.getBoundingClientRect();
73
+ const xRelativeToHost = event.clientX - hostRect.left;
74
+ const yRelativeToHost = event.clientY - hostRect.top;
75
+ this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
76
+ this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
77
+ const activePointers = Array.from(this._store.state.pointers.values());
78
+ if (activePointers.length === 2) {
79
+ const firstTouchX = activePointers[0].clientX - this._store.offsetX;
80
+ const firstTouchY = activePointers[0].clientY - this._store.offsetY;
81
+ const secondTouchX = activePointers[1].clientX - this._store.offsetX;
82
+ const secondTouchY = activePointers[1].clientY - this._store.offsetY;
83
+ const currentTouchDistance = Math.sqrt(Math.pow(firstTouchX - secondTouchX, 2) + Math.pow(firstTouchY - secondTouchY, 2));
84
+ const midpointX = (firstTouchX + secondTouchX) / 2;
85
+ const midpointY = (firstTouchY + secondTouchY) / 2;
86
+ const scaleRatio = currentTouchDistance / this.initialTouchDistance;
87
+ const newScale = this._store.state.scale * scaleRatio;
88
+ if (newScale > this._store.state.scaleMax || newScale < this._store.state.scaleMin) {
89
+ this._store.state.translateX += midpointX - this.startX;
90
+ this._store.state.translateY += midpointY - this.startY;
91
+ }
92
+ else {
93
+ const translateXAdjustment = (midpointX - this._store.state.translateX) * (scaleRatio - 1);
94
+ const translateYAdjustment = (midpointY - this._store.state.translateY) * (scaleRatio - 1);
95
+ this._store.state.translateX += midpointX - this.startX - translateXAdjustment;
96
+ this._store.state.translateY += midpointY - this.startY - translateYAdjustment;
97
+ this._store.state.scale = newScale;
98
+ this.initialTouchDistance = currentTouchDistance;
99
+ }
100
+ this.startX = midpointX;
101
+ this.startY = midpointY;
102
+ this._store.state.hasViewportChanged = true;
103
+ this._store.rerender();
104
+ }
105
+ }
106
+ }
107
+ handlePointerUp(event) {
108
+ if (event.pointerType === 'mouse') {
109
+ if (this._store.state.isPanning) {
110
+ this._store.state.isPanning = false;
111
+ this._store.rerender();
112
+ }
113
+ }
114
+ if (event.pointerType === 'touch') {
115
+ this._store.state.isScaling = false;
116
+ this._store.rerender();
117
+ }
118
+ }
119
+ handleWheel(event) {
120
+ event.preventDefault();
121
+ if (event.ctrlKey === true && KritzelEventHelper.isMainMouseWheel(event)) {
122
+ this.handleZoom(event);
123
+ }
124
+ if (!event.ctrlKey) {
125
+ this.handlePan(event);
126
+ }
127
+ }
128
+ handleZoom(event) {
129
+ const rect = this._store.state.host.getBoundingClientRect();
130
+ const xRelativeToHost = event.clientX - rect.left;
131
+ const yRelativeToHost = event.clientY - rect.top;
132
+ this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
133
+ this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
134
+ const delta = event.deltaY > 0 ? -this._store.state.scaleStep * this._store.state.scale : this._store.state.scaleStep * this._store.state.scale;
135
+ const newScale = Math.min(this._store.state.scaleMax, Math.max(this._store.state.scaleMin, this._store.state.scale + delta));
136
+ const scaleRatio = newScale / this._store.state.scale;
137
+ const translateXAdjustment = (xRelativeToHost - this._store.state.translateX) * (scaleRatio - 1);
138
+ const translateYAdjustment = (yRelativeToHost - this._store.state.translateY) * (scaleRatio - 1);
139
+ this._store.state.scale = newScale;
140
+ this._store.state.translateX -= translateXAdjustment;
141
+ this._store.state.translateY -= translateYAdjustment;
142
+ this._store.state.hasViewportChanged = true;
143
+ this._store.rerender();
144
+ }
145
+ handlePan(event) {
146
+ const panSpeed = 0.8;
147
+ this._store.state.translateX -= event.deltaX * panSpeed;
148
+ this._store.state.translateY -= event.deltaY * panSpeed;
149
+ this._store.state.hasViewportChanged = true;
150
+ this._store.rerender();
151
+ }
152
+ }
153
+
154
+ class UpdateViewportCommand extends KritzelBaseCommand {
155
+ constructor(store, initiator, previousViewport) {
156
+ super(store, initiator);
157
+ this.previousViewport = previousViewport;
158
+ this.currentViewport = {
159
+ scale: this._store.state.scale,
160
+ translateX: this._store.state.translateX,
161
+ translateY: this._store.state.translateY,
162
+ };
163
+ }
164
+ execute() {
165
+ this._store.state.scale = this.currentViewport.scale;
166
+ this._store.state.translateX = this.currentViewport.translateX;
167
+ this._store.state.translateY = this.currentViewport.translateY;
168
+ }
169
+ undo() {
170
+ this._store.state.scale = this.previousViewport.scale;
171
+ this._store.state.translateX = this.previousViewport.translateX;
172
+ this._store.state.translateY = this.previousViewport.translateY;
173
+ }
174
+ }
175
+
176
+ class KritzelCircularBuffer {
177
+ constructor(capacity) {
178
+ this.head = 0;
179
+ this.tail = 0;
180
+ this.size = 0;
181
+ this.capacity = capacity;
182
+ this.buffer = new Array(capacity).fill(null);
183
+ }
184
+ add(item) {
185
+ this.buffer[this.head] = item;
186
+ this.head = (this.head + 1) % this.capacity;
187
+ if (this.size < this.capacity) {
188
+ this.size++;
189
+ }
190
+ else {
191
+ this.tail = (this.tail + 1) % this.capacity;
192
+ }
193
+ }
194
+ pop() {
195
+ if (this.size === 0) {
196
+ return null;
197
+ }
198
+ this.head = (this.head - 1 + this.capacity) % this.capacity;
199
+ const item = this.buffer[this.head];
200
+ this.buffer[this.head] = null;
201
+ this.size--;
202
+ return item;
203
+ }
204
+ peek() {
205
+ if (this.size === 0) {
206
+ return null;
207
+ }
208
+ const lastIndex = (this.head - 1 + this.capacity) % this.capacity;
209
+ return this.buffer[lastIndex];
210
+ }
211
+ isEmpty() {
212
+ return this.size === 0;
213
+ }
214
+ clear() {
215
+ this.buffer.fill(null);
216
+ this.head = 0;
217
+ this.tail = 0;
218
+ this.size = 0;
219
+ }
220
+ }
221
+
222
+ class KritzelHistory {
223
+ constructor(store) {
224
+ this._store = store;
225
+ this.undoStack = new KritzelCircularBuffer(this._store.state.historyBufferSize);
226
+ this.redoStack = new KritzelCircularBuffer(this._store.state.historyBufferSize);
227
+ this.previousViewport = {
228
+ scale: this._store.state.scale,
229
+ scaleStep: this._store.state.scaleStep,
230
+ translateX: this._store.state.translateX,
231
+ translateY: this._store.state.translateY,
232
+ };
233
+ }
234
+ executeCommand(command) {
235
+ if (this._store.state.hasViewportChanged) {
236
+ this.addUpdateViewportCommand();
237
+ }
238
+ command.execute();
239
+ if (this._store.state.debugInfo.logCommands)
240
+ console.info('add', command);
241
+ this.undoStack.add(command);
242
+ if (this.redoStack.isEmpty() === false) {
243
+ this.redoStack.clear();
244
+ }
245
+ this._store.rerender();
246
+ }
247
+ undo() {
248
+ if (this._store.state.hasViewportChanged) {
249
+ const command = new UpdateViewportCommand(this._store, this, this.previousViewport);
250
+ command.undo();
251
+ this._store.state.hasViewportChanged = false;
252
+ this._store.rerender();
253
+ return;
254
+ }
255
+ const command = this.undoStack.pop();
256
+ if (command) {
257
+ command.undo();
258
+ if (this._store.state.debugInfo.logCommands)
259
+ console.info('undo', command);
260
+ this.redoStack.add(command);
261
+ }
262
+ this._store.rerender();
263
+ }
264
+ redo() {
265
+ const command = this.redoStack.pop();
266
+ if (command) {
267
+ command.execute();
268
+ if (this._store.state.debugInfo.logCommands)
269
+ console.info('redo', command);
270
+ this.undoStack.add(command);
271
+ }
272
+ this._store.rerender();
273
+ }
274
+ addUpdateViewportCommand() {
275
+ const command = new UpdateViewportCommand(this._store, this, this.previousViewport);
276
+ command.execute();
277
+ this.undoStack.add(command);
278
+ if (this.redoStack.isEmpty() === false) {
279
+ this.redoStack.clear();
280
+ }
281
+ this._store.state.hasViewportChanged = false;
282
+ this.previousViewport = {
283
+ scale: this._store.state.scale,
284
+ scaleStep: this._store.state.scaleStep,
285
+ translateX: this._store.state.translateX,
286
+ translateY: this._store.state.translateY,
287
+ };
288
+ }
289
+ }
290
+
291
+ class KritzelOctree {
292
+ constructor(bounds, capacity = 8) {
293
+ this.objects = [];
294
+ this.children = null;
295
+ this.bounds = bounds;
296
+ this.capacity = capacity;
297
+ }
298
+ insert(object) {
299
+ if (!this.intersects(object.rotatedBoundingBox, this.bounds)) {
300
+ return false;
301
+ }
302
+ if (this.objects.length < this.capacity && this.children === null) {
303
+ this.objects.push(object);
304
+ return true;
305
+ }
306
+ if (this.children === null) {
307
+ this.subdivide();
308
+ }
309
+ for (const child of this.children) {
310
+ if (child.insert(object)) {
311
+ return true;
312
+ }
313
+ }
314
+ return false;
315
+ }
316
+ update(object) {
317
+ const index = this.objects.findIndex(o => o.id === object.id);
318
+ if (index !== -1) {
319
+ this.objects[index] = object;
320
+ return true;
321
+ }
322
+ if (this.children !== null) {
323
+ for (const child of this.children) {
324
+ if (child.update(object)) {
325
+ return true;
326
+ }
327
+ }
328
+ }
329
+ return false;
330
+ }
331
+ remove(predicate) {
332
+ const index = this.objects.findIndex(o => predicate(o));
333
+ if (index !== -1) {
334
+ this.objects.splice(index, 1);
335
+ }
336
+ if (this.children !== null) {
337
+ for (const child of this.children) {
338
+ child.remove(predicate);
339
+ }
340
+ }
341
+ }
342
+ query(range) {
343
+ const results = [];
344
+ if (!this.intersects(range, this.bounds)) {
345
+ return results;
346
+ }
347
+ for (const object of this.objects) {
348
+ if (this.intersects(object.rotatedBoundingBox, range)) {
349
+ results.push(object);
350
+ }
351
+ }
352
+ if (this.children !== null) {
353
+ for (const child of this.children) {
354
+ results.push(...child.query(range));
355
+ }
356
+ }
357
+ return results;
358
+ }
359
+ filter(predicate) {
360
+ const results = this.objects.filter(o => predicate(o));
361
+ if (this.children !== null) {
362
+ for (const child of this.children) {
363
+ results.push(...child.filter(predicate));
364
+ }
365
+ }
366
+ return results;
367
+ }
368
+ allObjects() {
369
+ const results = [...this.objects];
370
+ if (this.children !== null) {
371
+ for (const child of this.children) {
372
+ results.push(...child.allObjects());
373
+ }
374
+ }
375
+ return results;
376
+ }
377
+ subdivide() {
378
+ const { x, y, z, width, height, depth } = this.bounds;
379
+ const halfWidth = width / 2;
380
+ const halfHeight = height / 2;
381
+ const halfDepth = depth / 2;
382
+ this.children = [
383
+ new KritzelOctree({ x, y, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
384
+ new KritzelOctree({ x: x + halfWidth, y, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
385
+ new KritzelOctree({ x, y: y + halfHeight, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
386
+ new KritzelOctree({ x: x + halfWidth, y: y + halfHeight, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
387
+ new KritzelOctree({ x, y, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
388
+ new KritzelOctree({ x: x + halfWidth, y, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
389
+ new KritzelOctree({ x, y: y + halfHeight, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
390
+ new KritzelOctree({ x: x + halfWidth, y: y + halfHeight, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
391
+ ];
392
+ }
393
+ intersects(a, b) {
394
+ return !(a.x >= b.x + b.width || // a is completely to the right of b
395
+ a.x + a.width <= b.x || // a is completely to the left of b
396
+ a.y >= b.y + b.height || // a is completely below b
397
+ a.y + a.height <= b.y // a is completely above b
398
+ );
399
+ }
400
+ }
401
+
402
+ class UpdateObjectCommand extends KritzelBaseCommand {
403
+ constructor(store, initiator, object, updatedProperties) {
404
+ super(store, initiator);
405
+ this.object = object;
406
+ this.updatedProperties = updatedProperties;
407
+ this.previousProperties = {};
408
+ for (const key in updatedProperties) {
409
+ if (updatedProperties.hasOwnProperty(key)) {
410
+ this.previousProperties[key] = this.object[key];
411
+ }
412
+ }
413
+ }
414
+ execute() {
415
+ for (const key in this.updatedProperties) {
416
+ if (this.updatedProperties.hasOwnProperty(key)) {
417
+ this.object[key] = this.updatedProperties[key];
418
+ }
419
+ }
420
+ }
421
+ undo() {
422
+ for (const key in this.previousProperties) {
423
+ if (this.previousProperties.hasOwnProperty(key)) {
424
+ this.object[key] = this.previousProperties[key];
425
+ }
426
+ }
427
+ }
428
+ }
429
+
430
+ const DEFAULT_ENGINE_STATE = {
431
+ activeTool: null,
432
+ activeText: null,
433
+ currentPath: null,
434
+ copiedObjects: null,
435
+ objectsOctree: null,
436
+ selectionBox: null,
437
+ selectionGroup: null,
438
+ resizeHandleType: null,
439
+ hasViewportChanged: false,
440
+ isReady: false,
441
+ isEnabled: true,
442
+ isScaling: false,
443
+ isPanning: false,
444
+ isFocused: false,
445
+ isSelecting: false,
446
+ isResizing: false,
447
+ isResizeHandleSelected: false,
448
+ isRotating: false,
449
+ isRotationHandleSelected: false,
450
+ isDragging: false,
451
+ isDrawing: false,
452
+ isErasing: false,
453
+ isWriting: false,
454
+ isCtrlKeyPressed: false,
455
+ isContextMenuVisible: false,
456
+ contextMenuItems: [],
457
+ contextMenuX: 0,
458
+ contextMenuY: 0,
459
+ skipContextMenu: false,
460
+ debugInfo: {
461
+ showObjectInfo: false,
462
+ showViewportInfo: false,
463
+ logCommands: false,
464
+ },
465
+ host: null,
466
+ pointerX: 0,
467
+ pointerY: 0,
468
+ scale: 1,
469
+ scaleMax: 1,
470
+ scaleMin: 1,
471
+ scaleStep: 0.05,
472
+ startX: 0,
473
+ startY: 0,
474
+ translateX: 0,
475
+ translateXMax: 400,
476
+ translateXMin: 0,
477
+ translateY: 0,
478
+ translateYMax: 400,
479
+ translateYMin: 0,
480
+ viewportWidth: 0,
481
+ viewportHeight: 0,
482
+ historyBufferSize: 1000,
483
+ longTouchTimeout: null,
484
+ longTouchDelay: 300,
485
+ pointers: new Map()
486
+ };
487
+
488
+ class KritzelStore {
489
+ get history() {
490
+ return this._history;
491
+ }
492
+ get state() {
493
+ return this._state;
494
+ }
495
+ get currentZIndex() {
496
+ return this._state.objectsOctree.filter(o => !(o instanceof KritzelSelectionGroup) && !(o instanceof KrtizelSelectionBox)).length;
497
+ }
498
+ get allObjects() {
499
+ return this._state.objectsOctree.allObjects();
500
+ }
501
+ get selectedObjects() {
502
+ return this.allObjects.filter(o => !(o instanceof KritzelSelectionGroup)).filter(o => o.isSelected);
503
+ }
504
+ get offsetX() {
505
+ return this._state.host.getBoundingClientRect().left;
506
+ }
507
+ get offsetY() {
508
+ return this._state.host.getBoundingClientRect().top;
509
+ }
510
+ constructor(kritzelEngine) {
511
+ this._listeners = new Map();
512
+ this.objects = [];
513
+ this._state = DEFAULT_ENGINE_STATE;
514
+ this._kritzelEngine = kritzelEngine;
515
+ this._history = new KritzelHistory(this);
516
+ this._state.objectsOctree = new KritzelOctree({
517
+ x: -Infinity,
518
+ y: -Infinity,
519
+ z: -Infinity,
520
+ width: Infinity,
521
+ height: Infinity,
522
+ depth: Infinity,
523
+ });
524
+ }
525
+ rerender() {
526
+ const viewportBounds = {
527
+ x: -this._state.translateX / this._state.scale,
528
+ y: -this._state.translateY / this._state.scale,
529
+ z: this._state.scale,
530
+ width: this._state.viewportWidth / this._state.scale,
531
+ height: this._state.viewportHeight / this._state.scale,
532
+ depth: 100,
533
+ };
534
+ this.objects = this._state.objectsOctree.query(viewportBounds);
535
+ if (this._kritzelEngine) {
536
+ this._kritzelEngine.forceUpdate++;
537
+ }
538
+ }
539
+ findObjectById(id) {
540
+ for (const object of this.allObjects) {
541
+ if (object.id === id) {
542
+ return object;
543
+ }
544
+ }
545
+ return null;
546
+ }
547
+ deselectAllObjects() {
548
+ if (this._state.selectionGroup) {
549
+ this._history.executeCommand(new RemoveSelectionGroupCommand(this, this));
550
+ }
551
+ }
552
+ onStateChange(property, listener) {
553
+ if (!this._listeners.has(property)) {
554
+ this._listeners.set(property, new Set());
555
+ }
556
+ this._listeners.get(property).add(listener);
557
+ }
558
+ setState(property, value) {
559
+ const oldValue = this._state[property];
560
+ if (oldValue !== value) {
561
+ this._state[property] = value;
562
+ if (this._listeners.has(property)) {
563
+ this._listeners.get(property).forEach(listener => listener(value, oldValue, String(property)));
564
+ }
565
+ }
566
+ }
567
+ delete() {
568
+ if (!this.state.selectionGroup) {
569
+ return;
570
+ }
571
+ const deleteSelectedObjectsCommand = this.state.selectionGroup.objects.map(obj => new RemoveObjectCommand(this, this.state.selectionGroup, obj));
572
+ const removeSelectionGroupCommand = new RemoveSelectionGroupCommand(this, this.state.selectionGroup);
573
+ const commands = [...deleteSelectedObjectsCommand, removeSelectionGroupCommand];
574
+ this.history.executeCommand(new BatchCommand(this, this.state.selectionGroup, commands));
575
+ }
576
+ deleteObject(id, isHistoryUpdated = true) {
577
+ const object = this.findObjectById(id);
578
+ if (object) {
579
+ if (isHistoryUpdated) {
580
+ const removeObjectCommand = new RemoveObjectCommand(this, this, object);
581
+ this.history.executeCommand(removeObjectCommand);
582
+ }
583
+ else {
584
+ this._state.objectsOctree.remove(obj => obj.id === id);
585
+ this.rerender();
586
+ }
587
+ }
588
+ }
589
+ copy() {
590
+ this.state.copiedObjects = this.state.selectionGroup.copy();
591
+ }
592
+ paste(x, y) {
593
+ this.state.copiedObjects.isSelected = true;
594
+ const adjustedX = x !== undefined ? x : this.state.copiedObjects.translateX + 25;
595
+ const adjustedY = y !== undefined ? y : this.state.copiedObjects.translateY + 25;
596
+ this.state.copiedObjects.updatePosition(adjustedX, adjustedY);
597
+ const commands = [];
598
+ if (this.state.selectionGroup !== null) {
599
+ commands.push(new RemoveSelectionGroupCommand(this, this.state.selectionGroup));
600
+ }
601
+ const addCopiedObjectsCommands = this.state.copiedObjects.objects.map(obj => new AddObjectCommand(this, this, obj));
602
+ const addCopiedObjectsAsSelectionGroupCommand = new AddSelectionGroupCommand(this, this, this.state.copiedObjects);
603
+ commands.push(...addCopiedObjectsCommands, addCopiedObjectsAsSelectionGroupCommand);
604
+ this.history.executeCommand(new BatchCommand(this, this, commands));
605
+ this.state.isSelecting = false;
606
+ this.state.copiedObjects = this.state.selectionGroup.copy();
607
+ this.setState('activeTool', KritzelToolRegistry.getTool('selection'));
608
+ }
609
+ bringForward(object) {
610
+ const max = this.allObjects.length + 1;
611
+ const objects = object ? [object] : this.state.selectionGroup.objects;
612
+ const increaseZIndexCommands = objects.map(obj => {
613
+ if (obj.zIndex === max) {
614
+ return;
615
+ }
616
+ return new UpdateObjectCommand(this, this, obj, { zIndex: obj.zIndex + 1 });
617
+ });
618
+ this.history.executeCommand(new BatchCommand(this, this, increaseZIndexCommands));
619
+ }
620
+ sendBackward(object) {
621
+ const min = 0;
622
+ const objects = object ? [object] : this.state.selectionGroup.objects;
623
+ const decreaseZIndexCommands = objects.map(obj => {
624
+ if (obj.zIndex === min) {
625
+ return;
626
+ }
627
+ return new UpdateObjectCommand(this, this, obj, { zIndex: obj.zIndex - 1 });
628
+ });
629
+ this.history.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
630
+ }
631
+ bringToFront(object) {
632
+ const max = Math.max(...this.allObjects.map(obj => obj.zIndex)) + 1;
633
+ const objects = object ? [object] : this.state.selectionGroup.objects;
634
+ const increaseZIndexCommands = objects.map(obj => {
635
+ return new UpdateObjectCommand(this, this, obj, { zIndex: max });
636
+ });
637
+ this.history.executeCommand(new BatchCommand(this, this, increaseZIndexCommands));
638
+ }
639
+ sendToBack(object) {
640
+ const min = Math.min(...this.allObjects.map(obj => obj.zIndex)) - 1;
641
+ const objects = object ? [object] : this.state.selectionGroup.objects;
642
+ const decreaseZIndexCommands = objects.map(obj => {
643
+ return new UpdateObjectCommand(this, this, obj, { zIndex: min });
644
+ });
645
+ this.history.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
646
+ }
647
+ selectObjects(objects) {
648
+ if (objects.length === 0) {
649
+ return;
650
+ }
651
+ const selectionGroup = KritzelSelectionGroup.create(this);
652
+ objects.forEach(obj => {
653
+ obj.isSelected = false;
654
+ selectionGroup.addOrRemove(obj);
655
+ });
656
+ selectionGroup.isSelected = true;
657
+ this.state.selectionGroup = selectionGroup;
658
+ if (objects.length === 1) {
659
+ selectionGroup.rotation = selectionGroup.objects[0].rotation;
660
+ }
661
+ this.history.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
662
+ }
663
+ selectAllObjectsInViewport() {
664
+ const objectsInViewport = this._state.objectsOctree
665
+ .query({
666
+ x: -this._state.translateX / this._state.scale,
667
+ y: -this._state.translateY / this._state.scale,
668
+ z: this._state.scale,
669
+ width: this._state.viewportWidth / this._state.scale,
670
+ height: this._state.viewportHeight / this._state.scale,
671
+ depth: 100,
672
+ })
673
+ .filter(o => !(o instanceof KritzelSelectionGroup) && !(o instanceof KrtizelSelectionBox) && !(o instanceof KritzelContextMenu));
674
+ if (objectsInViewport.length > 0) {
675
+ const selectionGroup = KritzelSelectionGroup.create(this);
676
+ objectsInViewport.forEach(obj => {
677
+ obj.isSelected = false;
678
+ selectionGroup.addOrRemove(obj);
679
+ });
680
+ selectionGroup.isSelected = true;
681
+ this.state.isSelecting = false;
682
+ if (objectsInViewport.length === 1) {
683
+ selectionGroup.rotation = selectionGroup.objects[0].rotation;
684
+ }
685
+ this.history.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
686
+ this.setState('activeTool', KritzelToolRegistry.getTool('selection'));
687
+ }
688
+ }
689
+ clearSelection() {
690
+ const command = new RemoveSelectionGroupCommand(this, this.state.selectionGroup);
691
+ this.history.executeCommand(command);
692
+ this.state.selectionGroup = null;
693
+ this.state.selectionBox = null;
694
+ this.state.isSelecting = false;
695
+ this.state.isResizeHandleSelected = false;
696
+ this.state.isRotationHandleSelected = false;
697
+ }
698
+ resetActiveText() {
699
+ if (this.state.activeText && this.state.activeText.value === ' ') {
700
+ this.deleteObject(this.state.activeText.id, false);
701
+ this.history.undoStack.pop();
702
+ }
703
+ this.state.activeText = null;
704
+ }
705
+ getObjectFromPointerEvent(event, selector = '.object') {
706
+ var _a;
707
+ const shadowRoot = (_a = this.state.host) === null || _a === void 0 ? void 0 : _a.shadowRoot;
708
+ if (!shadowRoot)
709
+ return null;
710
+ const clientX = event.clientX;
711
+ const clientY = event.clientY;
712
+ const elementAtPoint = shadowRoot.elementFromPoint(clientX, clientY);
713
+ if (!elementAtPoint)
714
+ return null;
715
+ const selectedObject = elementAtPoint.closest(selector);
716
+ if (selectedObject) {
717
+ return this.allObjects.find(object => selectedObject.id === object.id);
718
+ }
719
+ return null;
720
+ }
721
+ getObjectsFromPointerEvent(event, selector = '.object') {
722
+ var _a;
723
+ const shadowRoot = (_a = this.state.host) === null || _a === void 0 ? void 0 : _a.shadowRoot;
724
+ if (!shadowRoot)
725
+ return [];
726
+ const clientX = event.clientX;
727
+ const clientY = event.clientY;
728
+ const elementsAtPoint = shadowRoot.elementsFromPoint(clientX, clientY);
729
+ if (!elementsAtPoint || elementsAtPoint.length === 0)
730
+ return [];
731
+ const objectIds = new Set();
732
+ elementsAtPoint.forEach(element => {
733
+ const selectedObject = element.closest(selector);
734
+ if (selectedObject && selectedObject.id) {
735
+ objectIds.add(selectedObject.id);
736
+ }
737
+ });
738
+ if (objectIds.size > 0) {
739
+ return this.allObjects.filter(object => objectIds.has(object.id)).sort((a, b) => b.zIndex - a.zIndex);
740
+ }
741
+ return [];
742
+ }
743
+ getCanvasPoint(event) {
744
+ if (!this.state.host) {
745
+ return { x: 0, y: 0 };
746
+ }
747
+ // Get the position of the kritzel-engine host element relative to the viewport
748
+ const hostRect = this.state.host.getBoundingClientRect();
749
+ // 1. Make the pointer coordinates relative to the host element
750
+ const xRelativeToHost = event.clientX - hostRect.left;
751
+ const yRelativeToHost = event.clientY - hostRect.top;
752
+ // 2. Reverse the translation applied to the #origin div
753
+ const xWithoutTranslate = xRelativeToHost - this.state.translateX;
754
+ const yWithoutTranslate = yRelativeToHost - this.state.translateY;
755
+ // 3. Reverse the scaling to get the final world coordinates
756
+ const worldX = xWithoutTranslate / this.state.scale;
757
+ const worldY = yWithoutTranslate / this.state.scale;
758
+ return { x: worldX, y: worldY };
759
+ }
760
+ }
761
+
762
+ class KritzelKeyHandler extends KritzelBaseHandler {
763
+ constructor(store) {
764
+ super(store);
765
+ }
766
+ handleKeyDown(event) {
767
+ if (this._store.state.isFocused === false) {
768
+ event.preventDefault();
769
+ return;
770
+ }
771
+ this._store.state.isCtrlKeyPressed = event.ctrlKey;
772
+ if (this._store.state.isCtrlKeyPressed) {
773
+ event.preventDefault();
774
+ }
775
+ if (event.key === 'Escape' && this._store.state.selectionGroup) {
776
+ this._store.clearSelection();
777
+ }
778
+ if (event.key === 'Delete' && this._store.state.selectionGroup) {
779
+ this._store.delete();
780
+ }
781
+ if (event.key === 'z' && event.ctrlKey) {
782
+ this._store.history.undo();
783
+ }
784
+ if (event.key === 'y' && event.ctrlKey) {
785
+ this._store.history.redo();
786
+ }
787
+ if (event.key === 's' && event.ctrlKey) {
788
+ this._store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
789
+ this._store.deselectAllObjects();
790
+ }
791
+ if (event.key === 'b' && event.ctrlKey) {
792
+ this._store.setState('activeTool', KritzelToolRegistry.getTool('brush'));
793
+ this._store.deselectAllObjects();
794
+ }
795
+ if (event.key === 'e' && event.ctrlKey) {
796
+ this._store.setState('activeTool', KritzelToolRegistry.getTool('eraser'));
797
+ this._store.deselectAllObjects();
798
+ }
799
+ if (event.key === 'i' && event.ctrlKey) {
800
+ this._store.setState('activeTool', KritzelToolRegistry.getTool('image'));
801
+ this._store.deselectAllObjects();
802
+ }
803
+ if (event.key === 'x' && event.ctrlKey) {
804
+ this._store.setState('activeTool', KritzelToolRegistry.getTool('text'));
805
+ this._store.deselectAllObjects();
806
+ }
807
+ if (event.key === 'c' && event.ctrlKey && this._store.state.selectionGroup) {
808
+ this._store.copy();
809
+ this._store.rerender();
810
+ }
811
+ if (event.key === 'v' && event.ctrlKey && this._store.state.copiedObjects) {
812
+ this._store.paste();
813
+ }
814
+ if (event.key === '+' && event.ctrlKey && this._store.state.selectionGroup) {
815
+ this._store.bringForward();
816
+ }
817
+ if (event.key === '-' && event.ctrlKey && this._store.state.selectionGroup) {
818
+ this._store.sendBackward();
819
+ }
820
+ if (event.key === '*' && event.shiftKey && this._store.state.selectionGroup) {
821
+ this._store.bringToFront();
822
+ }
823
+ if (event.key === '_' && event.shiftKey && this._store.state.selectionGroup) {
824
+ this._store.sendToBack();
825
+ }
826
+ if (event.key === 'a' && event.ctrlKey && this._store.state.activeText) {
827
+ this._store.state.activeText.selectAll();
828
+ }
829
+ if (event.key === 'v' && event.ctrlKey && this._store.state.activeText) {
830
+ this._store.state.activeText.insertFromClipboard();
831
+ }
832
+ }
833
+ handleKeyUp(event) {
834
+ if (this._store.state.isFocused === false) {
835
+ return;
836
+ }
837
+ this._store.state.isCtrlKeyPressed = event.ctrlKey;
838
+ }
839
+ }
840
+
841
+ class KritzelContextMenuHandler extends KritzelBaseHandler {
842
+ constructor(store, globalContextMenuItems, objectContextMenuItems) {
843
+ super(store);
844
+ this.globalContextMenuItems = [];
845
+ this.objectContextMenuItems = [];
846
+ this.globalContextMenuItems = globalContextMenuItems;
847
+ this.objectContextMenuItems = objectContextMenuItems;
848
+ }
849
+ handleContextMenu(event) {
850
+ if (this._store.state.skipContextMenu) {
851
+ this._store.state.skipContextMenu = false;
852
+ return;
853
+ }
854
+ const selectedObject = this._store.getObjectFromPointerEvent(event, '.object');
855
+ if (selectedObject && !(selectedObject instanceof KritzelSelectionGroup)) {
856
+ this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);
857
+ this._store.state.selectionGroup.addOrRemove(selectedObject);
858
+ this._store.state.selectionGroup.isSelected = true;
859
+ this._store.state.selectionGroup.rotation = selectedObject.rotation;
860
+ this._store.state.isSelecting = false;
861
+ this._store.history.executeCommand(new AddSelectionGroupCommand(this._store, this, this._store.state.selectionGroup));
862
+ }
863
+ this._store.state.contextMenuItems = this._store.state.selectionGroup ? this.objectContextMenuItems : this.globalContextMenuItems;
864
+ let x = event.clientX - this._store.offsetX;
865
+ let y = event.clientY - this._store.offsetY;
866
+ const menuWidthEstimate = 150;
867
+ const menuHeightEstimate = 200;
868
+ const margin = 10;
869
+ if (x + menuWidthEstimate > window.innerWidth - margin) {
870
+ x = window.innerWidth - menuWidthEstimate - margin;
871
+ }
872
+ if (y + menuHeightEstimate > window.innerHeight - margin) {
873
+ y = window.innerHeight - menuHeightEstimate - margin;
874
+ }
875
+ x = Math.max(margin, x);
876
+ y = Math.max(margin, y);
877
+ this._store.state.contextMenuX = x;
878
+ this._store.state.contextMenuY = y;
879
+ this._store.state.isContextMenuVisible = true;
880
+ this._store.state.isEnabled = false;
881
+ this._store.rerender();
882
+ }
883
+ }
884
+
885
+ class KritzelClassHelper {
886
+ static isInstanceOf(object, className) {
887
+ return object.__class__ === className;
888
+ }
889
+ }
890
+
891
+ const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.debug-panel{position:absolute;pointer-events:none;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;pointer-events:none;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{overflow:visible}textarea{all:unset;box-sizing:border-box;outline:none !important;border:none !important;overflow:visible}.resize-handle-overlay.top-left,.resize-handle-overlay.bottom-right{cursor:nwse-resize}.resize-handle-overlay.top-right,.resize-handle-overlay.bottom-left{cursor:nesw-resize}.rotation-handle-overlay{cursor:grab}";
892
+
893
+ const KritzelEngine = class {
894
+ validateScaleMax(newValue) {
895
+ if (newValue > ABSOLUTE_SCALE_MAX) {
896
+ console.warn(`scaleMax cannot be greater than ${ABSOLUTE_SCALE_MAX}.`);
897
+ this.scaleMax = ABSOLUTE_SCALE_MAX;
898
+ this.store.state.scaleMax = this.scaleMax;
899
+ }
900
+ else {
901
+ this.store.state.scaleMax = newValue;
902
+ }
903
+ }
904
+ validateScaleMin(newValue) {
905
+ if (newValue < ABSOLUTE_SCALE_MIN) {
906
+ console.warn(`scaleMin cannot be less than ${ABSOLUTE_SCALE_MIN}.`);
907
+ this.scaleMin = ABSOLUTE_SCALE_MIN;
908
+ this.store.state.scaleMin = this.scaleMin;
909
+ }
910
+ else {
911
+ this.store.state.scaleMin = newValue;
912
+ }
913
+ }
914
+ get isSelecting() {
915
+ return this.store.state.activeTool instanceof KritzelSelectionTool && this.store.state.isSelecting;
916
+ }
917
+ get isSelectionActive() {
918
+ return this.store.state.activeTool instanceof KritzelSelectionTool && this.store.state.selectionGroup !== null;
919
+ }
920
+ constructor(hostRef) {
921
+ registerInstance(this, hostRef);
922
+ this.isEngineReady = createEvent(this, "isEngineReady", 7);
923
+ this.activeToolChange = createEvent(this, "activeToolChange", 7);
924
+ this.scaleMax = ABSOLUTE_SCALE_MAX;
925
+ this.scaleMin = ABSOLUTE_SCALE_MIN;
926
+ this.forceUpdate = 0;
927
+ this.contextMenuElement = null;
928
+ this.store = new KritzelStore(this);
929
+ }
930
+ componentWillLoad() {
931
+ this.validateScaleMax(this.scaleMax);
932
+ this.validateScaleMin(this.scaleMin);
933
+ }
934
+ componentDidLoad() {
935
+ this.contextMenuHandler = new KritzelContextMenuHandler(this.store, this.globalContextMenuItems, this.objectContextMenuItems);
936
+ this.keyHandler = new KritzelKeyHandler(this.store);
937
+ this.viewport = new KritzelViewport(this.store, this.host);
938
+ this._registerStateChangeListeners();
939
+ if (this.store.state.isReady === false) {
940
+ this.store.state.isReady = true;
941
+ this.isEngineReady.emit();
942
+ }
943
+ }
944
+ handleWheel(ev) {
945
+ var _a, _b;
946
+ if (this.store.state.isContextMenuVisible) {
947
+ this.hideContextMenu();
948
+ }
949
+ this.viewport.handleWheel(ev);
950
+ (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handleWheel(ev);
951
+ }
952
+ handlePointerDown(ev) {
953
+ var _a, _b;
954
+ if (KritzelEventHelper.isPointerEventOnContextMenu(ev) === false && this.store.state.isContextMenuVisible) {
955
+ this.hideContextMenu();
956
+ return;
957
+ }
958
+ if (this.store.state.isEnabled === false) {
959
+ return;
960
+ }
961
+ KritzelEventHelper.onLongTouchPress(ev, (event) => {
962
+ if (!(this.store.state.activeTool instanceof KritzelSelectionTool)) {
963
+ return;
964
+ }
965
+ this.contextMenuHandler.handleContextMenu(event);
966
+ });
967
+ this.host.setPointerCapture(ev.pointerId);
968
+ this.store.state.pointers.set(ev.pointerId, ev);
969
+ this.viewport.handlePointerDown(ev);
970
+ (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerDown(ev);
971
+ }
972
+ handlePointerMove(ev) {
973
+ var _a, _b;
974
+ if (this.store.state.isEnabled === false) {
975
+ return;
976
+ }
977
+ this.store.state.pointers.set(ev.pointerId, ev);
978
+ this.viewport.handlePointerMove(ev);
979
+ (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerMove(ev);
980
+ }
981
+ handlePointerUp(ev) {
982
+ var _a, _b;
983
+ if (this.store.state.isEnabled === false) {
984
+ return;
985
+ }
986
+ this.store.state.pointers.delete(ev.pointerId);
987
+ this.host.releasePointerCapture(ev.pointerId);
988
+ this.viewport.handlePointerUp(ev);
989
+ (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerUp(ev);
990
+ }
991
+ handlePointerCancel(ev) {
992
+ var _a, _b;
993
+ if (this.store.state.isEnabled === false) {
994
+ return;
995
+ }
996
+ this.host.releasePointerCapture(ev.pointerId);
997
+ this.store.state.pointers.delete(ev.pointerId);
998
+ this.viewport.handlePointerUp(ev);
999
+ (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerUp(ev);
1000
+ }
1001
+ handleContextMenu(ev) {
1002
+ ev.preventDefault();
1003
+ if (this.store.state.isEnabled === false) {
1004
+ return;
1005
+ }
1006
+ if (ev.pointerType === 'touch') {
1007
+ return;
1008
+ }
1009
+ this.contextMenuHandler.handleContextMenu(ev);
1010
+ }
1011
+ handleResize() {
1012
+ this.viewport.handleResize();
1013
+ }
1014
+ handleKeyDown(ev) {
1015
+ this.keyHandler.handleKeyDown(ev);
1016
+ }
1017
+ handleKeyUp(ev) {
1018
+ this.keyHandler.handleKeyUp(ev);
1019
+ }
1020
+ updateFocus(ev) {
1021
+ const rect = this.store.state.host.getBoundingClientRect();
1022
+ const isInside = ev.clientX >= rect.left && ev.clientX <= rect.right && ev.clientY >= rect.top && ev.clientY <= rect.bottom;
1023
+ const path = ev.composedPath();
1024
+ const kritzelEngineElement = this.host.closest('kritzel-engine');
1025
+ const isInKritzelEngine = path.includes(kritzelEngineElement || this.host);
1026
+ this.store.setState('isFocused', isInside && isInKritzelEngine);
1027
+ }
1028
+ async registerTool(toolName, toolClass, toolConfig) {
1029
+ if (typeof toolClass !== 'function' || !(toolClass.prototype instanceof KritzelBaseTool)) {
1030
+ console.error(`Failed to register tool "${toolName}": Tool class must be a constructor function`);
1031
+ return null;
1032
+ }
1033
+ const registeredTool = KritzelToolRegistry.registerTool(toolName, toolClass, this.store);
1034
+ if (toolConfig) {
1035
+ Object.entries(toolConfig).forEach(([key, value]) => {
1036
+ registeredTool[key] = value;
1037
+ });
1038
+ }
1039
+ return Promise.resolve(registeredTool);
1040
+ }
1041
+ async changeActiveTool(tool) {
1042
+ var _a;
1043
+ (_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
1044
+ this.store.setState('activeTool', tool);
1045
+ this.store.deselectAllObjects();
1046
+ tool === null || tool === void 0 ? void 0 : tool.onActivate();
1047
+ }
1048
+ async setFocus() {
1049
+ this.host.focus();
1050
+ this.store.state.isFocused = true;
1051
+ }
1052
+ async disable() {
1053
+ this.store.state.isEnabled = false;
1054
+ this.forceUpdate++;
1055
+ }
1056
+ async enable() {
1057
+ this.store.state.isEnabled = true;
1058
+ this.forceUpdate++;
1059
+ }
1060
+ async delete() {
1061
+ this.store.delete();
1062
+ }
1063
+ async copy() {
1064
+ this.store.copy();
1065
+ }
1066
+ async paste(x, y) {
1067
+ this.store.paste(x, y);
1068
+ }
1069
+ async bringForward(object) {
1070
+ this.store.bringForward(object);
1071
+ }
1072
+ async sendBackward(object) {
1073
+ this.store.sendBackward(object);
1074
+ }
1075
+ async bringToFront(object) {
1076
+ this.store.bringToFront(object);
1077
+ }
1078
+ async sendToBack(object) {
1079
+ this.store.sendToBack(object);
1080
+ }
1081
+ async undo() {
1082
+ this.store.history.undo();
1083
+ }
1084
+ async redo() {
1085
+ this.store.history.redo();
1086
+ }
1087
+ async hideContextMenu() {
1088
+ this.store.state.pointers.clear();
1089
+ this.store.state.isContextMenuVisible = false;
1090
+ this.store.state.selectionBox = null;
1091
+ this.store.state.isSelecting = false;
1092
+ }
1093
+ async getObjectById(id) {
1094
+ const object = this.store.objects.find(obj => obj.id === id);
1095
+ return object || null;
1096
+ }
1097
+ async addObject(object) {
1098
+ this.store.deselectAllObjects();
1099
+ object.id = object.generateId();
1100
+ object._store = this.store;
1101
+ object.scale = object.scale ? object.scale : this.store.state.scale;
1102
+ object.zIndex = this.store.currentZIndex;
1103
+ const command = new AddObjectCommand(this.store, this, object);
1104
+ this.store.history.executeCommand(command);
1105
+ return object;
1106
+ }
1107
+ async updateObject(object, updatedProperties) {
1108
+ this.store.deselectAllObjects();
1109
+ const command = new UpdateObjectCommand(this.store, this, object, updatedProperties);
1110
+ this.store.history.executeCommand(command);
1111
+ return object;
1112
+ }
1113
+ async removeObject(object) {
1114
+ this.store.deselectAllObjects();
1115
+ const command = new RemoveObjectCommand(this.store, this, object);
1116
+ this.store.history.executeCommand(command);
1117
+ return object;
1118
+ }
1119
+ async getSelectedObjects() {
1120
+ return this.store.state.selectionGroup ? this.store.state.selectionGroup.objects : [];
1121
+ }
1122
+ async selectObjects(objects) {
1123
+ var _a;
1124
+ (_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
1125
+ this.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
1126
+ this.store.deselectAllObjects();
1127
+ this.store.selectObjects(objects);
1128
+ }
1129
+ async selectAllObjectsInViewport() {
1130
+ var _a;
1131
+ (_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
1132
+ this.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
1133
+ this.store.deselectAllObjects();
1134
+ this.store.selectAllObjectsInViewport();
1135
+ }
1136
+ async clearSelection() {
1137
+ this.store.clearSelection();
1138
+ }
1139
+ async centerObjectInViewport(object) {
1140
+ object.centerInViewport();
1141
+ const command = new UpdateObjectCommand(this.store, this, object, object);
1142
+ this.store.history.executeCommand(command);
1143
+ return object;
1144
+ }
1145
+ async getCopiedObjects() {
1146
+ var _a;
1147
+ return ((_a = this.store.state.copiedObjects) === null || _a === void 0 ? void 0 : _a.objects) || [];
1148
+ }
1149
+ _registerStateChangeListeners() {
1150
+ this.store.onStateChange('activeTool', this._handleActiveToolChange.bind(this));
1151
+ this.store.onStateChange('isFocused', this._handleIsFocusedChange.bind(this));
1152
+ }
1153
+ _handleActiveToolChange(activeTool) {
1154
+ if (!(activeTool instanceof KritzelSelectionTool)) {
1155
+ this.store.clearSelection();
1156
+ }
1157
+ this.store.state.skipContextMenu = false;
1158
+ this.activeToolChange.emit(activeTool);
1159
+ KritzelKeyboardHelper.forceHideKeyboard();
1160
+ }
1161
+ _handleIsFocusedChange(isFocused) {
1162
+ if (!isFocused) {
1163
+ this.store.resetActiveText();
1164
+ }
1165
+ }
1166
+ render() {
1167
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
1168
+ const computedStyle = window.getComputedStyle(this.host);
1169
+ const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
1170
+ const baseHandleSize = parseFloat(baseHandleSizePx);
1171
+ const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
1172
+ return (h(Host, { key: '10a88c74cc96dc353b55bd42c116e5dd3adcf40f' }, h("div", { key: 'a385ba0e880acc8835b4dced3a1dc42ac4967634', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, h("div", { key: '84768a6978341ceffa0c43078440c10258396ab2' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
1173
+ _a.translateX), h("div", { key: 'daaeeeb2859bf05f4bf97b0342f269f32958ee8e' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
1174
+ _b.translateY), h("div", { key: '882cd55cea6a694e07b440504c76a2676c9d6a35' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
1175
+ _c.viewportWidth), h("div", { key: 'f609c147e7fd9e3228b7b440507d432fe6e7c3d1' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
1176
+ _d.viewportHeight), h("div", { key: 'd07a0f4cd96f5c29a53813260b425ed056db4176' }, "ObjectsInViewport. ", this.store.objects.length), h("div", { key: 'ac39c77acee2b3ca6b6a4136fb01f3ca0215e2f9' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
1177
+ _e.scale), h("div", { key: 'dcda96e3285be12c3d62830829b61c4be19c1d83' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
1178
+ _g.name), h("div", { key: '0ac588ddaab0921425bffa47420abeae80ce8cbf' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), h("div", { key: '56baf174f2be1cf55c232b1dac7f3194581ffb09' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), h("div", { key: 'b865e7690c228d798ff72a4bcebf7f4bd868ddd8' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), h("div", { key: 'a5590a4c56e1f499c9ba72415567ec262b5d1ec0' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), h("div", { key: '52945f8e10f2703d87371b63c7caf43ad98bf60e' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), h("div", { key: '93c6a4ca860a8cf60c136ae1e33d55d0645dd534' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: '8cd515d5558bbc79f8a36121fc7c1ed19e506f4b' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: 'bae172be8b381e917f378a9d261fcbb4592f7dd9' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: 'bcc2e0edada2a46d188c4f0133b865a1401d3181' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: 'a63af8b0116a12a9f55863c9ddeb913f35ad4efa' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), h("div", { key: '105286223979bb9081fa179b52615bf7a614f7ce' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), h("div", { key: '246883d2e1e21379c1b62cd6dd75d8433e2dd538' }, "PointerX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
1179
+ _m.pointerX), h("div", { key: 'd49120e78afb1ad52c6c2f4a9388f69959d4d804' }, "PointerY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
1180
+ _o.pointerY), h("div", { key: '09012207e7dee163c2ff18010fb7aada269316d9' }, "SelectedObjects: ", ((_p = this.store.state.selectionGroup) === null || _p === void 0 ? void 0 : _p.objects.length) || 0)), h("div", { key: '62930df28cf3c374fd382efa2aac81fd827bad4d', id: "origin", class: "origin", style: {
1181
+ transform: `matrix(${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale}, 0, 0, ${(_r = this.store.state) === null || _r === void 0 ? void 0 : _r.scale}, ${(_s = this.store.state) === null || _s === void 0 ? void 0 : _s.translateX}, ${(_t = this.store.state) === null || _t === void 0 ? void 0 : _t.translateY})`,
1182
+ } }, (_u = this.store.objects) === null || _u === void 0 ? void 0 :
1183
+ _u.map(object => {
1184
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1185
+ return (h("div", { style: { transform: object === null || object === void 0 ? void 0 : object.transformationMatrix, transformOrigin: 'top left', zIndex: object.zIndex.toString(), position: 'absolute' } }, h("svg", { xmlns: "http://www.w3.org/2000/svg", key: object.id, id: object.id, class: "object", style: {
1186
+ height: object === null || object === void 0 ? void 0 : object.totalHeight.toString(),
1187
+ width: object === null || object === void 0 ? void 0 : object.totalWidth.toString(),
1188
+ left: '0',
1189
+ top: '0',
1190
+ position: 'absolute',
1191
+ transform: `rotate(${object.rotationDegrees}deg)`,
1192
+ transformOrigin: 'center',
1193
+ opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
1194
+ pointerEvents: object.markedForRemoval ? 'none' : 'auto',
1195
+ } }, h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
1196
+ minHeight: '0',
1197
+ minWidth: '0',
1198
+ backgroundColor: object.backgroundColor,
1199
+ borderColor: object.borderColor,
1200
+ borderWidth: object.borderWidth + 'px',
1201
+ borderStyle: 'solid',
1202
+ padding: object.padding + 'px',
1203
+ overflow: 'visible',
1204
+ } }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (h("svg", { ref: el => el ? object.mount(el) : object.unmount(), xmlns: "http://www.w3.org/2000/svg", style: {
1205
+ height: object === null || object === void 0 ? void 0 : object.height.toString(),
1206
+ width: object === null || object === void 0 ? void 0 : object.width.toString(),
1207
+ position: 'absolute',
1208
+ overflow: 'visible',
1209
+ }, viewBox: object === null || object === void 0 ? void 0 : object.viewBox }, h("path", { d: object === null || object === void 0 ? void 0 : object.d, fill: object.fill, stroke: object === null || object === void 0 ? void 0 : object.stroke }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (h("img", { ref: el => el ? object.mount(el) : object.unmount(), src: object.src, style: {
1210
+ width: '100%',
1211
+ height: '100%',
1212
+ userSelect: 'none',
1213
+ pointerEvents: 'none',
1214
+ }, draggable: false, onDragStart: e => e.preventDefault() })), KritzelClassHelper.isInstanceOf(object, 'KritzelText') && (h("textarea", { ref: el => el ? object.mount(el) : object.unmount(), value: object.value, onKeyDown: event => object.handleKeyDown(event), onInput: event => object.handleInput(event), rows: object.rows, style: {
1215
+ width: '100%',
1216
+ height: '100%',
1217
+ color: object.fontColor,
1218
+ fontSize: ((_a = object.fontSize) === null || _a === void 0 ? void 0 : _a.toString()) + 'px',
1219
+ fontFamily: object.fontFamily,
1220
+ border: 'none',
1221
+ outline: 'none',
1222
+ resize: 'none',
1223
+ overflow: 'hidden',
1224
+ display: 'block',
1225
+ padding: '1px',
1226
+ whiteSpace: 'nowrap',
1227
+ pointerEvents: object.isReadonly ? 'none' : 'auto',
1228
+ cursor: object.isReadonly ? 'default' : 'text',
1229
+ caretColor: object.isReadonly ? 'transparent' : 'auto',
1230
+ } })), KritzelClassHelper.isInstanceOf(object, 'KritzelCustomElement') && (h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
1231
+ width: '100%',
1232
+ height: '100%',
1233
+ pointerEvents: 'auto',
1234
+ overflow: 'hidden',
1235
+ display: 'block',
1236
+ } })), KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') && (h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
1237
+ width: '100%',
1238
+ height: '100%',
1239
+ } })), KritzelClassHelper.isInstanceOf(object, 'KrtizelSelectionBox') && (h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
1240
+ width: '100%',
1241
+ height: '100%',
1242
+ } }))), h("line", { x1: "0", y1: "0", x2: object.totalWidth, y2: "0", style: {
1243
+ stroke: 'var(--kritzel-selection-border-color, #007AFF)',
1244
+ strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_b = this.store.state) === null || _b === void 0 ? void 0 : _b.scale})`,
1245
+ strokeLinecap: 'square',
1246
+ }, visibility: object.isSelected ? 'visible' : 'hidden' }), h("line", { x1: "0", y1: "0", x2: "0", y2: object.totalHeight, style: {
1247
+ stroke: 'var(--kritzel-selection-border-color, #007AFF)',
1248
+ strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_c = this.store.state) === null || _c === void 0 ? void 0 : _c.scale})`,
1249
+ strokeLinecap: 'square',
1250
+ }, visibility: object.isSelected ? 'visible' : 'hidden' }), h("line", { x1: "0", y1: object.totalHeight, x2: object.totalWidth, y2: object.totalHeight, style: {
1251
+ stroke: 'var(--kritzel-selection-border-color, #007AFF)',
1252
+ strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_d = this.store.state) === null || _d === void 0 ? void 0 : _d.scale})`,
1253
+ strokeLinecap: 'square',
1254
+ }, visibility: object.isSelected ? 'visible' : 'hidden' }), h("line", { x1: object.totalWidth, y1: "0", x2: object.totalWidth, y2: object.totalHeight, style: {
1255
+ stroke: 'var(--kritzel-selection-border-color, #007AFF)',
1256
+ strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_e = this.store.state) === null || _e === void 0 ? void 0 : _e.scale})`,
1257
+ strokeLinecap: 'square',
1258
+ }, visibility: object.isSelected ? 'visible' : 'hidden' }), h("circle", { class: "resize-handle top-left", cx: "0", cy: "0", r: `${(baseHandleSize * object.scale) / ((_f = this.store.state) === null || _f === void 0 ? void 0 : _f.scale)}`, style: {
1259
+ fill: 'var(--kritzel-selection-handle-color, #000000)',
1260
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "resize-handle-overlay top-left", cx: "0", cy: "0", r: `${(baseHandleTouchSize * object.scale) / ((_g = this.store.state) === null || _g === void 0 ? void 0 : _g.scale)}`, style: {
1261
+ fill: 'transparent',
1262
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "resize-handle top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleSize * object.scale) / ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.scale)}`, style: {
1263
+ fill: 'var(--kritzel-selection-handle-color, #000000)',
1264
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "resize-handle-overlay top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleTouchSize * object.scale) / ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.scale)}`, style: {
1265
+ fill: 'transparent',
1266
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "resize-handle bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.scale)}`, style: {
1267
+ fill: 'var(--kritzel-selection-handle-color, #000000)',
1268
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "resize-handle-overlay bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleTouchSize * object.scale) / ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.scale)}`, style: {
1269
+ fill: 'transparent',
1270
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "resize-handle bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / ((_m = this.store.state) === null || _m === void 0 ? void 0 : _m.scale)}`, style: {
1271
+ fill: 'var(--kritzel-selection-handle-color, #000000)',
1272
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "resize-handle-overlay bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleTouchSize * object.scale) / ((_o = this.store.state) === null || _o === void 0 ? void 0 : _o.scale)}`, style: {
1273
+ fill: 'transparent',
1274
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("line", { x1: object.totalWidth / 2, y1: "0", x2: object.totalWidth / 2, y2: -((15 * object.scale) / ((_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale)), style: {
1275
+ stroke: 'var(--kritzel-selection-border-color, #007AFF)',
1276
+ strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale})`,
1277
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "rotation-handle", cx: object.totalWidth / 2, cy: -((15 * object.scale) / ((_r = this.store.state) === null || _r === void 0 ? void 0 : _r.scale)), r: `${(baseHandleSize * object.scale) / ((_s = this.store.state) === null || _s === void 0 ? void 0 : _s.scale)}`, style: {
1278
+ fill: 'var(--kritzel-selection-handle-color, #000000)',
1279
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("circle", { class: "rotation-handle-overlay", cx: object.totalWidth / 2, cy: -((15 * object.scale) / ((_t = this.store.state) === null || _t === void 0 ? void 0 : _t.scale)), r: `${(baseHandleTouchSize * object.scale) / ((_u = this.store.state) === null || _u === void 0 ? void 0 : _u.scale)}`, style: {
1280
+ fill: 'transparent',
1281
+ cursor: 'grab',
1282
+ }, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.isDebugInfoVisible ? 'block' : 'none' } }, h("div", { style: { width: '100%', height: '100%' } }, h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation), h("div", { style: { whiteSpace: 'nowrap' } }, "x: ", object.x), h("div", { style: { whiteSpace: 'nowrap' } }, "y: ", object.y)))))));
1283
+ }), h("svg", { key: '754094fce45e3c34dec0430215c6e29af1f5eec6', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
1284
+ height: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.height.toString(),
1285
+ width: (_w = this.store.state.currentPath) === null || _w === void 0 ? void 0 : _w.width.toString(),
1286
+ left: '0',
1287
+ top: '0',
1288
+ zIndex: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.zIndex.toString(),
1289
+ position: 'absolute',
1290
+ transform: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.transformationMatrix,
1291
+ transformOrigin: 'top left',
1292
+ overflow: 'visible',
1293
+ }, viewBox: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.viewBox }, h("path", { key: '738ac0a32f474973a3fe41a6dd40f03fdfe0fa2e', d: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.d, fill: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.fill, stroke: (_2 = this.store.state.currentPath) === null || _2 === void 0 ? void 0 : _2.stroke }))), this.store.state.isContextMenuVisible && (h("kritzel-context-menu", { key: 'f322bc10aef729232d42f0622bdc56ab76bb8a7e', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, objects: ((_3 = this.store.state.selectionGroup) === null || _3 === void 0 ? void 0 : _3.objects) || [], style: {
1294
+ position: 'fixed',
1295
+ left: `${this.store.state.contextMenuX}px`,
1296
+ top: `${this.store.state.contextMenuY}px`,
1297
+ zIndex: '10000',
1298
+ }, onActionSelected: event => {
1299
+ var _a;
1300
+ event.detail.action({
1301
+ x: (-this.store.state.translateX + this.store.state.contextMenuX) / this.store.state.scale,
1302
+ y: (-this.store.state.translateY + this.store.state.contextMenuY) / this.store.state.scale,
1303
+ }, (_a = this.store.state.selectionGroup) === null || _a === void 0 ? void 0 : _a.objects);
1304
+ this.hideContextMenu();
1305
+ } })), ((_4 = this.store.state) === null || _4 === void 0 ? void 0 : _4.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && h("kritzel-cursor-trail", { key: '8025a5b432840f6859c4306568383d66c2edf33f', store: this.store })));
1306
+ }
1307
+ get host() { return getElement(this); }
1308
+ static get watchers() { return {
1309
+ "scaleMax": ["validateScaleMax"],
1310
+ "scaleMin": ["validateScaleMin"]
1311
+ }; }
1312
+ };
1313
+ KritzelEngine.style = kritzelEngineCss;
1314
+
1315
+ export { KritzelEngine as kritzel_engine };
1316
+ //# sourceMappingURL=kritzel-engine.entry.esm.js.map
1317
+
1318
+ //# sourceMappingURL=kritzel-engine.entry.js.map