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
@@ -1,2347 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-BGl8znzE.js';
2
- import { K as KritzelBrushTool, a as KritzelTextTool, b as KritzelMouseButton, c as KritzelSelectionTool, D as DEFAULT_BRUSH_CONFIG, d as KritzelEraserTool, e as DEFAULT_TEXT_CONFIG, f as KritzelImageTool, g as KritzelEventHelper, h as KritzelBaseCommand, i as KritzelSelectionGroup, j as KrtizelSelectionBox, R as RemoveSelectionGroupCommand, k as RemoveObjectCommand, B as BatchCommand, A as AddObjectCommand, l as AddSelectionGroupCommand, m as KritzelToolRegistry, n as KritzelBaseHandler, o as KritzelBaseTool, p as KritzelKeyboardHelper } from './index-DO2IiM_o.js';
3
-
4
- const kritzelBrushStyleCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box;width:100%}.brush-style-button{display:flex;justify-content:center;align-items:center;width:42px;height:32px;padding:0;border:none;outline:none;background:none;cursor:default;border-radius:0;color:var(--control-text-color);font-weight:bold;-webkit-tap-highlight-color:transparent}.font-style-button:not(:last-child){border-right:1px solid #333333}.font-style-button:hover{background-color:var(--control-hover-bg)}.font-style-button:active{background-color:var(--control-active-bg)}.font-style-button.selected,.font-style-button.selected:hover,.font-style-button.selected:active{background-color:var(--control-selected-bg);color:var(--control-selected-color)}";
5
-
6
- const KritzelBrushStyle = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.typeChange = createEvent(this, "typeChange");
10
- this.type = 'pen';
11
- this.brushOptions = [
12
- { value: 'pen', label: 'Pen' },
13
- { value: 'highlighter', label: 'Highlighter' },
14
- ];
15
- }
16
- handleDropdownValueChange(event) {
17
- this.typeChange.emit(event.detail);
18
- }
19
- render() {
20
- const dropdownOptions = this.brushOptions.map(option => ({
21
- value: option.value,
22
- label: option.label,
23
- }));
24
- return (h(Host, { key: 'd7af382fe6f613aa16a5146785990ad2faa17f60' }, h("kritzel-dropdown", { key: '6d6d330d415c210058834b2968774b3db2ab7fc4', options: dropdownOptions, value: this.type, onValueChanged: event => this.handleDropdownValueChange(event) }, h("button", { key: 'c9fb33795b8e25f68c1d2ae248dc82a6de29e199', class: "brush-style-button", slot: "prefix" }, h("kritzel-icon", { key: '975c95b545a1c27ae2984405ac298592eec9743d', name: this.type, size: 16 })))));
25
- }
26
- };
27
- KritzelBrushStyle.style = kritzelBrushStyleCss;
28
-
29
- const kritzelColorCss = ":host{display:flex}.checkerboard-bg{background:repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 8px 8px;position:relative;overflow:hidden}.color-circle{width:24px;height:24px;border-radius:50%;box-sizing:border-box;display:block}.color-circle.white{border:1px solid var(--kritzel-color-palette-circle-border-color, #dddcdc)}";
30
-
31
- const KritzelColor = class {
32
- constructor(hostRef) {
33
- registerInstance(this, hostRef);
34
- this.size = 24;
35
- }
36
- isLightColor(hexColor) {
37
- if (!hexColor)
38
- return false;
39
- let r = 0, g = 0, b = 0;
40
- let sanitizedHex = hexColor.startsWith('#') ? hexColor.slice(1) : hexColor;
41
- if (sanitizedHex.length === 3) {
42
- r = parseInt(sanitizedHex[0] + sanitizedHex[0], 16);
43
- g = parseInt(sanitizedHex[1] + sanitizedHex[1], 16);
44
- b = parseInt(sanitizedHex[2] + sanitizedHex[2], 16);
45
- }
46
- else if (sanitizedHex.length === 6) {
47
- r = parseInt(sanitizedHex.substring(0, 2), 16);
48
- g = parseInt(sanitizedHex.substring(2, 4), 16);
49
- b = parseInt(sanitizedHex.substring(4, 6), 16);
50
- }
51
- else {
52
- return false;
53
- }
54
- if (isNaN(r) || isNaN(g) || isNaN(b)) {
55
- return false;
56
- }
57
- const luminance = 0.299 * r + 0.587 * g + 0.114 * b;
58
- return luminance > 220;
59
- }
60
- render() {
61
- const isColorVeryLight = this.isLightColor(this.value);
62
- return (h(Host, { key: '19ad3872a132c885c612dc3b96698a0c8dc7214d' }, h("div", { key: 'f67108e82396cbaa3d070c8dfc83da2b080ddf47', class: "checkerboard-bg", style: {
63
- width: `${this.size}px`,
64
- height: `${this.size}px`,
65
- borderRadius: '50%',
66
- display: 'inline-block',
67
- position: 'relative',
68
- } }, h("div", { key: '1af0cc3e9f6eebc04cae2367510ef3b98420a818', class: {
69
- 'color-circle': true,
70
- 'white': isColorVeryLight,
71
- }, style: {
72
- backgroundColor: this.value,
73
- width: `${this.size}px`,
74
- height: `${this.size}px`,
75
- borderRadius: '50%',
76
- position: 'absolute',
77
- top: '0',
78
- left: '0',
79
- display: 'inline-block',
80
- } }))));
81
- }
82
- };
83
- KritzelColor.style = kritzelColorCss;
84
-
85
- const kritzelColorPaletteCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;width:100%;box-sizing:border-box}.color-grid{width:100%;display:grid;grid-template-columns:repeat(6, 32px);gap:8px;justify-items:center;overflow:hidden;height:40px;transition:height 0.1s ease-in-out}.color-grid.expanded{height:500px}.color-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box}.color-container:hover{background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.color-container.selected{border-color:var(--kritzel-selection-border-color, #007AFF);background-color:var(--kritzel-color-palette-selected-background-color)}";
86
-
87
- const KritzelColorPalette = class {
88
- constructor(hostRef) {
89
- registerInstance(this, hostRef);
90
- this.colorChange = createEvent(this, "colorChange");
91
- this.colors = [];
92
- this.selectedColor = null;
93
- this.isExpanded = false;
94
- this.isOpaque = false;
95
- }
96
- handleColorClick(color) {
97
- this.selectedColor = color;
98
- this.colorChange.emit(color);
99
- }
100
- calculateHeight() {
101
- const colorsPerRow = 6;
102
- const rowHeight = 32;
103
- const gap = 8;
104
- const rowCount = Math.ceil(this.colors.length / colorsPerRow);
105
- return `${rowCount * rowHeight + (rowCount - 1) * gap}px`;
106
- }
107
- render() {
108
- const displayedColors = this.isExpanded ? this.colors : this.colors.slice(0, 6);
109
- const expandedHeight = this.isExpanded ? this.calculateHeight() : '32px';
110
- return (h(Host, { key: '0f0d176e1c8b199a973dbdb23b84e4a8d4d57f59' }, h("div", { key: '1d4707cdb30752d21a5058dbbef5fb32934bd3bd', class: {
111
- 'color-grid': true,
112
- 'expanded': this.isExpanded,
113
- }, style: {
114
- height: expandedHeight
115
- } }, displayedColors.map(color => (h("div", { class: {
116
- 'color-container': true,
117
- 'selected': this.selectedColor === color,
118
- }, onClick: () => this.handleColorClick(color) }, h("kritzel-color", { value: color })))))));
119
- }
120
- };
121
- KritzelColorPalette.style = kritzelColorPaletteCss;
122
-
123
- const kritzelContextMenuCss = ":host{display:block}.menu-container{display:flex;flex-direction:column;background-color:var(--kritzel-context-menu-background-color, #ffffff);border-radius:var(--kritzel-context-menu-border-radius, 12px);box-shadow:var(--kritzel-context-menu-box-shadow, 0 1px 6px rgba(0, 0, 0, 0.12));border:var(--kritzel-context-menu-border, 1px solid #f0f0f0);padding:var(--kritzel-context-menu-padding,4px)}.menu-item{display:flex;align-items:center;gap:var(--kritzel-context-menu-item-gap, 8px);background:none;border:none;text-align:left;padding:var(--kritzel-context-menu-item-padding, 8px);border-radius:var(--kritzel-context-menu-item-border-radius, 12px);cursor:pointer;font-size:var(--kritzel-context-menu-item-font-size, 14px);color:var(--kritzel-context-menu-item-color, #333333);white-space:nowrap;-webkit-tap-highlight-color:transparent}.menu-item:not(.disabled):hover{background-color:var(--kritzel-context-menu-item-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.menu-item:not(.disabled):active{background-color:var(--kritzel-context-menu-item-active-background-color, hsl(0, 0%, 0%, 8.6%))}.menu-item.disabled{color:var(--kritzel-context-menu-item-disabled-color, #aaaaaa);cursor:default}.menu-item kritzel-icon{opacity:0.8;flex-shrink:0}.menu-item.disabled kritzel-icon{opacity:0.4}.label{flex-grow:1}";
124
-
125
- const KritzelContextMenu = class {
126
- constructor(hostRef) {
127
- registerInstance(this, hostRef);
128
- this.actionSelected = createEvent(this, "actionSelected");
129
- this.disabledStates = new Map();
130
- this.visibleItems = [];
131
- }
132
- componentWillLoad() {
133
- this.resolveVisibleItems();
134
- this.resolveDisabledStates();
135
- }
136
- onItemsChanged() {
137
- this.resolveVisibleItems();
138
- this.resolveDisabledStates();
139
- }
140
- handleItemClick(item, index) {
141
- if (!this.disabledStates.get(index)) {
142
- this.actionSelected.emit(item);
143
- }
144
- }
145
- async resolveVisibleItems() {
146
- const visibleItems = [];
147
- const visibilityPromises = this.items.map(async (item, index) => {
148
- let isVisible = true;
149
- if (item.visible !== undefined) {
150
- if (typeof item.visible === 'boolean') {
151
- isVisible = item.visible;
152
- }
153
- else if (typeof item.visible === 'function') {
154
- const result = item.visible(null, this.objects);
155
- if (result instanceof Promise) {
156
- isVisible = await result;
157
- }
158
- else {
159
- isVisible = result;
160
- }
161
- }
162
- }
163
- return { item, index, isVisible };
164
- });
165
- const visibilityResults = await Promise.all(visibilityPromises);
166
- visibilityResults.forEach(({ item, isVisible }) => {
167
- if (isVisible) {
168
- visibleItems.push(item);
169
- }
170
- });
171
- this.visibleItems = visibleItems;
172
- }
173
- async resolveDisabledStates() {
174
- const newStates = new Map();
175
- const disabledPromises = this.visibleItems.map(async (item, index) => {
176
- let isDisabled = false;
177
- if (typeof item.disabled === 'boolean') {
178
- isDisabled = item.disabled;
179
- }
180
- else if (typeof item.disabled === 'function') {
181
- const result = item.disabled(null, this.objects);
182
- if (result instanceof Promise) {
183
- isDisabled = await result;
184
- }
185
- else {
186
- isDisabled = result;
187
- }
188
- }
189
- newStates.set(index, isDisabled);
190
- });
191
- await Promise.all(disabledPromises);
192
- this.disabledStates = new Map(newStates);
193
- }
194
- render() {
195
- return (h(Host, { key: '3265d2e63ff1e1f91faf1c6c5da3490687f3adb1' }, h("div", { key: '80b2100e2ffcaba25ca08cfec650b1f7558c5d25', class: "menu-container" }, this.visibleItems.map((item, index) => {
196
- var _a;
197
- const isDisabled = (_a = this.disabledStates.get(index)) !== null && _a !== void 0 ? _a : false;
198
- return (h("button", { key: `${item.label}-${index}`, class: { 'menu-item': true, 'disabled': isDisabled }, onClick: () => this.handleItemClick(item, index), onTouchStart: () => this.handleItemClick(item, index), disabled: isDisabled }, item.icon && h("kritzel-icon", { name: item.icon, size: 16 }), h("span", { class: "label" }, item.label)));
199
- }))));
200
- }
201
- get hostElement() { return getElement(this); }
202
- static get watchers() { return {
203
- "items": ["onItemsChanged"]
204
- }; }
205
- };
206
- KritzelContextMenu.style = kritzelContextMenuCss;
207
-
208
- const kritzelControlBrushConfigCss = ":host{display:flex;flex-direction:column;width:100%}.expand-toggle{background:none;border:none;cursor:pointer;font-size:14px;line-height:1;padding:8px;color:var(--kritzel-color-palette-expand-toggle-color, #666666)}.expand-toggle:hover{color:var(--kritzel-color-palette-expand-toggle-hover-color, #333333)}";
209
-
210
- const KritzelControlBrushConfig = class {
211
- constructor(hostRef) {
212
- registerInstance(this, hostRef);
213
- this.toolChange = createEvent(this, "toolChange");
214
- this.isExpanded = false;
215
- this.palette = [];
216
- }
217
- handleToolChange(newTool) {
218
- this.palette = newTool.palettes[newTool.type];
219
- }
220
- componentWillLoad() {
221
- this.palette = this.tool.palettes[this.tool.type];
222
- }
223
- handleToggleExpand() {
224
- this.isExpanded = !this.isExpanded;
225
- }
226
- handleTypeChange(event) {
227
- this.palette = this.tool.palettes[event.detail];
228
- this.tool.type = event.detail;
229
- this.tool.color = this.palette[0];
230
- this.toolChange.emit(this.tool);
231
- }
232
- handleColorChange(event) {
233
- this.tool.color = event.detail;
234
- this.toolChange.emit(this.tool);
235
- }
236
- handleSizeChange(event) {
237
- this.tool.size = event.detail;
238
- this.toolChange.emit(this.tool);
239
- }
240
- render() {
241
- return (h(Host, { key: '8e7930fcc093f7277ed088d8ec5e54e4cd051b86' }, h("div", { key: '08bd37b90decc9054c05d646aabbba0a4985d04c', style: {
242
- display: 'flex',
243
- flexDirection: 'row',
244
- alignItems: 'center',
245
- justifyContent: 'flex-start',
246
- width: '100%',
247
- gap: '8px',
248
- } }, h("kritzel-brush-style", { key: 'f79744fb6523d0b4fa67c324cbf8ff3eb8a0308d', type: this.tool.type, onTypeChange: event => this.handleTypeChange(event) }), h("button", { key: 'dc3bdd90cebb29f2357e13dbc8d2dcaf02ae056e', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand', style: this.palette.length > 6 ? { visibillity: 'visible' } : { visibility: 'hidden' } }, h("kritzel-icon", { key: '6e9e6de7fc7c708aad700498e030d2ad7364a9f3', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), h("kritzel-color-palette", { key: 'c1ffd48a475754bb1447e9d866b494fd3476f050', colors: this.palette, selectedColor: this.tool.color, isExpanded: this.isExpanded, isOpaque: true, onColorChange: color => this.handleColorChange(color) }), h("kritzel-stroke-size", { key: '38e265b42fe09d0105e0385d7ec8e7d8d318abb0', selectedSize: this.tool.size, onSizeChange: event => this.handleSizeChange(event) })));
249
- }
250
- static get watchers() { return {
251
- "tool": ["handleToolChange"]
252
- }; }
253
- };
254
- KritzelControlBrushConfig.style = kritzelControlBrushConfigCss;
255
-
256
- const kritzelControlTextConfigCss = ":host{display:block;flex-direction:column;width:100%}.expand-toggle{background:none;border:none;cursor:pointer;font-size:14px;line-height:1;padding:8px;color:var(--kritzel-color-palette-expand-toggle-color, #666666)}.expand-toggle:hover{color:var(--kritzel-color-palette-expand-toggle-hover-color, #333333)}";
257
-
258
- const KritzelControlTextConfig = class {
259
- constructor(hostRef) {
260
- registerInstance(this, hostRef);
261
- this.toolChange = createEvent(this, "toolChange");
262
- this.isExpanded = false;
263
- }
264
- handleToggleExpand() {
265
- this.isExpanded = !this.isExpanded;
266
- }
267
- handleFamilyChange(event) {
268
- this.tool.fontFamily = event.detail;
269
- this.toolChange.emit(this.tool);
270
- }
271
- handleColorChange(event) {
272
- this.tool.fontColor = event.detail;
273
- this.toolChange.emit(this.tool);
274
- }
275
- handleSizeChange(event) {
276
- this.tool.fontSize = event.detail;
277
- this.toolChange.emit(this.tool);
278
- }
279
- render() {
280
- return (h(Host, { key: '27d47c47987fb7644313a4face4a7023dfbe454d' }, h("div", { key: '835b8072267da18b39a5c02a6c989e1f7b81e9a5', style: {
281
- display: 'flex',
282
- flexDirection: 'row',
283
- alignItems: 'center',
284
- justifyContent: 'flex-start',
285
- width: '100%',
286
- gap: '8px',
287
- } }, h("kritzel-font-family", { key: 'b7a0bde2e9cf53c9ae7c3a32b424825ca9f757c4', selectedFontFamily: this.tool.fontFamily, onFontFamilyChange: event => this.handleFamilyChange(event) }), h("button", { key: '41aba583656195c4825a15ddc12c5e1efed0d8d2', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand' }, h("kritzel-icon", { key: '5ff979420066703b5d5e886d12f89687392006e3', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), h("kritzel-color-palette", { key: '30fbcc05f80b15fba7f1f5ac6413732d0149ee9b', colors: this.tool.palette, selectedColor: this.tool.fontColor, isExpanded: this.isExpanded, onColorChange: event => this.handleColorChange(event) }), h("kritzel-font-size", { key: '2a0d3c4578316b37bc1a25b6e065ecf565eca2b3', selectedSize: this.tool.fontSize, fontFamily: this.tool.fontFamily, onSizeChange: event => this.handleSizeChange(event) })));
288
- }
289
- };
290
- KritzelControlTextConfig.style = kritzelControlTextConfigCss;
291
-
292
- class KritzelDevicesHelper {
293
- static isTouchDevice() {
294
- return window.matchMedia('(any-pointer: coarse)').matches;
295
- }
296
- }
297
-
298
- const kritzelControlsCss = ":host{display:flex;flex-direction:column;user-select:none}.kritzel-controls{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--kritzel-controls-gap, 8px);height:100%;padding:var(--kritzel-controls-padding, 8px);background-color:var(--kritzel-controls-background-color, #ffffff);border-radius:var(--kritzel-controls-border-radius, 16px);box-shadow:var(--kritzel-controls-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-controls-border, 1px solid #f0f0f0);z-index:10000;position:relative}.kritzel-control{display:flex;justify-content:center;align-items:center;color:var(--kritzel-controls-control-color, #000000);border-radius:var(--kritzel-controls-control-border-radius, 12px);padding:var(--kritzel-controls-control-padding, 8px);border:none;outline:none;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;font-weight:bold}.kritzel-control:hover{background-color:var(--kritzel-controls-control-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.mobile) .kritzel-control:hover{background-color:unset}.kritzel-control:active{background-color:var(--kritzel-controls-control-active-background-color, hsl(0, 0%, 0%, 8.6%))}:host(.mobile) .kritzel-control:active{background-color:unset}.kritzel-control.selected,.kritzel-control.selected:hover,.kritzel-control.selected:active{background-color:var(--kritzel-controls-control-selected-background-color, #007AFF) !important;color:var(--kritzel-controls-control-selected-color, #ffffff) !important}.kritzel-divider{width:var(--kritzel-controls-divider-width, 1px);height:var(--kritzel-controls-divider-height, 24px);background-color:var(--kritzel-controls-divider-background-color, hsl(0, 0%, 0%, 4.3%))}.kritzel-config-container{position:relative;display:flex;justify-content:center;align-items:center;width:40px;height:40px;box-sizing:border-box;-webkit-tap-highlight-color:transparent}.kritzel-config{display:flex;justify-content:center;align-items:center;cursor:pointer}.color-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box;background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.font-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box;background-color:var(--kritzel-color-palette-hover-background-color, #f0f0f0)}.no-config{height:24px;width:24px;border-radius:50%;border:1px dashed gray}kritzel-tooltip{position:fixed;bottom:66px;left:50%;transform:translateX(-50%);z-index:10001}";
299
-
300
- const KritzelControls = class {
301
- constructor(hostRef) {
302
- registerInstance(this, hostRef);
303
- this.isControlsReady = createEvent(this, "isControlsReady");
304
- this.controls = [];
305
- this.activeControl = null;
306
- this.isUtilityPanelVisible = true;
307
- this.firstConfig = null;
308
- this.isTooltipVisible = false;
309
- this.isTouchDevice = KritzelDevicesHelper.isTouchDevice();
310
- this.kritzelEngine = null;
311
- }
312
- async handleActiveToolChange(event) {
313
- var _a;
314
- this.activeControl = this.controls.find(control => control.tool === event.detail) || null;
315
- await ((_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.setFocus());
316
- }
317
- handleClick(event) {
318
- const element = event.target;
319
- if (!this.kritzelEngine || element.closest('.kritzel-tooltip')) {
320
- return;
321
- }
322
- this.isTooltipVisible = false;
323
- this.kritzelEngine.enable();
324
- }
325
- async closeTooltip() {
326
- var _a;
327
- this.isTooltipVisible = false;
328
- (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.enable();
329
- }
330
- get activeToolAsTextTool() {
331
- var _a;
332
- return (_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.tool;
333
- }
334
- get activeToolAsBrushTool() {
335
- var _a;
336
- return (_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.tool;
337
- }
338
- async componentWillLoad() {
339
- await this.initializeEngine();
340
- await this.initializeTools();
341
- this.isControlsReady.emit();
342
- }
343
- async initializeEngine() {
344
- await customElements.whenDefined('kritzel-engine');
345
- this.kritzelEngine = this.host.parentElement.querySelector('kritzel-engine');
346
- if (!this.kritzelEngine) {
347
- throw new Error('kritzel-engine not found in parent element.');
348
- }
349
- }
350
- async initializeTools() {
351
- for (const c of this.controls) {
352
- if (c.type === 'tool' && c.tool) {
353
- c.tool = await this.kritzelEngine.registerTool(c.name, c.tool, c.config);
354
- }
355
- if (c.type === 'tool' && c.isDefault && c.tool) {
356
- await this.kritzelEngine.changeActiveTool(c.tool);
357
- this.activeControl = c;
358
- }
359
- if (c.type === 'config') {
360
- if (this.firstConfig === null) {
361
- this.firstConfig = c;
362
- }
363
- else {
364
- console.warn('Only one config control is allowed. The first one will be used.');
365
- }
366
- }
367
- }
368
- }
369
- async handleControlClick(control) {
370
- this.activeControl = control;
371
- if (this.activeControl.type === 'tool') {
372
- await this.kritzelEngine.changeActiveTool(this.activeControl.tool);
373
- }
374
- }
375
- handleConfigClick(event) {
376
- event.stopPropagation();
377
- this.isTooltipVisible = !this.isTooltipVisible;
378
- this.kritzelEngine.disable();
379
- }
380
- async handleToolChange(event) {
381
- this.activeControl = Object.assign(Object.assign({}, this.activeControl), { tool: event.detail });
382
- await this.kritzelEngine.changeActiveTool(this.activeControl.tool);
383
- }
384
- render() {
385
- var _a, _b;
386
- const hasNoConfig = ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.config) === undefined || ((_b = this.activeControl) === null || _b === void 0 ? void 0 : _b.config) === null;
387
- return (h(Host, { key: '5531510d4b95c082148ce3e8f5d3048f808162b2', class: {
388
- mobile: this.isTouchDevice,
389
- } }, this.isUtilityPanelVisible && (h("kritzel-utility-panel", { key: 'e7e58ee4ae6a8a77918d5c8a954c2dcae287b265', style: {
390
- position: 'absolute',
391
- bottom: '56px',
392
- left: '12px',
393
- }, onUndo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.undo(); }, onRedo: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.redo(); }, onDelete: () => { var _a; return (_a = this.kritzelEngine) === null || _a === void 0 ? void 0 : _a.delete(); } })), h("div", { key: '65ad87089a38f3e89f8332fc6f261555c2e7eb40', class: "kritzel-controls" }, this.controls.map(control => {
394
- var _a, _b, _c, _d, _e, _f, _g, _h;
395
- if (control.type === 'tool') {
396
- return (h("button", { class: {
397
- 'kritzel-control': true,
398
- 'selected': ((_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.name) === (control === null || control === void 0 ? void 0 : control.name),
399
- }, key: control.name, onClick: _event => { var _a; return (_a = this.handleControlClick) === null || _a === void 0 ? void 0 : _a.call(this, control); } }, h("kritzel-icon", { name: control.icon })));
400
- }
401
- if (control.type === 'divider') {
402
- return h("div", { class: "kritzel-divider", key: control.name });
403
- }
404
- if (control.type === 'config' && control.name === ((_b = this.firstConfig) === null || _b === void 0 ? void 0 : _b.name) && this.activeControl) {
405
- return (h("div", { class: "kritzel-config-container", key: control.name }, h("kritzel-tooltip", { isVisible: this.isTooltipVisible, anchorElement: (_c = this.host.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.kritzel-config-container') }, h("div", { style: { width: '294px', height: '100%' } }, this.activeControl.name === 'brush' && (h("kritzel-control-brush-config", { tool: this.activeToolAsBrushTool, onToolChange: event => { var _a; return (_a = this.handleToolChange) === null || _a === void 0 ? void 0 : _a.call(this, event); } })), this.activeControl.name === 'text' && (h("kritzel-control-text-config", { tool: this.activeToolAsTextTool, onToolChange: event => { var _a; return (_a = this.handleToolChange) === null || _a === void 0 ? void 0 : _a.call(this, event); } })))), h("div", { class: "kritzel-config", onClick: event => { var _a; return (_a = this.handleConfigClick) === null || _a === void 0 ? void 0 : _a.call(this, event); }, style: {
406
- cursor: this.activeControl.config ? 'pointer' : 'default',
407
- pointerEvents: hasNoConfig ? 'none' : 'auto',
408
- } }, this.activeControl.tool instanceof KritzelBrushTool && (h("div", { class: "color-container" }, h("kritzel-color", { value: (_d = this.activeToolAsBrushTool) === null || _d === void 0 ? void 0 : _d.color, size: (_e = this.activeToolAsBrushTool) === null || _e === void 0 ? void 0 : _e.size, style: {
409
- borderRadius: '50%',
410
- border: 'none',
411
- } }))), this.activeControl.tool instanceof KritzelTextTool && (h("div", { class: "font-container" }, h("kritzel-font", { fontFamily: (_f = this.activeToolAsTextTool) === null || _f === void 0 ? void 0 : _f.fontFamily, size: (_g = this.activeToolAsTextTool) === null || _g === void 0 ? void 0 : _g.fontSize, color: (_h = this.activeToolAsTextTool) === null || _h === void 0 ? void 0 : _h.fontColor }))), hasNoConfig && h("div", { class: "no-config" }))));
412
- }
413
- }))));
414
- }
415
- static get assetsDirs() { return ["../assets"]; }
416
- get host() { return getElement(this); }
417
- };
418
- KritzelControls.style = kritzelControlsCss;
419
-
420
- const kritzelCursorTrailCss = ":host{display:block;position:fixed;top:0;left:0;width:100vw;height:100vh;pointer-events:none;z-index:9000}";
421
-
422
- const KritzelCursorTrail = class {
423
- constructor(hostRef) {
424
- registerInstance(this, hostRef);
425
- this.cursorTrailPoints = [];
426
- this.isLeftButtonDown = false;
427
- this.TRAIL_DURATION_MS = 100;
428
- this.MAX_TRAIL_POINTS = 50;
429
- }
430
- componentDidLoad() {
431
- this.trailCleanupIntervalId = window.setInterval(() => {
432
- const now = Date.now();
433
- const newTrailPoints = this.cursorTrailPoints.filter(p => now - p.timestamp < this.TRAIL_DURATION_MS);
434
- if (newTrailPoints.length !== this.cursorTrailPoints.length) {
435
- this.cursorTrailPoints = newTrailPoints;
436
- }
437
- }, 50);
438
- }
439
- disconnectedCallback() {
440
- if (this.trailCleanupIntervalId) {
441
- window.clearInterval(this.trailCleanupIntervalId);
442
- }
443
- }
444
- handleMouseDown(ev) {
445
- if (ev.pointerType === 'mouse') {
446
- if (ev.button === KritzelMouseButton.Left) {
447
- this.isLeftButtonDown = true;
448
- this.cursorTrailPoints = [];
449
- }
450
- }
451
- if (ev.pointerType === 'touch') {
452
- if (this.store.state.pointers.size === 1) {
453
- this.isLeftButtonDown = true;
454
- this.cursorTrailPoints = [];
455
- }
456
- }
457
- }
458
- handlePointerMove(ev) {
459
- if (!this.isLeftButtonDown) {
460
- return;
461
- }
462
- const newPoint = { x: ev.clientX, y: ev.clientY, timestamp: Date.now() };
463
- const updatedTrail = [newPoint, ...this.cursorTrailPoints];
464
- if (updatedTrail.length > this.MAX_TRAIL_POINTS) {
465
- this.cursorTrailPoints = updatedTrail.slice(0, this.MAX_TRAIL_POINTS);
466
- }
467
- else {
468
- this.cursorTrailPoints = updatedTrail;
469
- }
470
- }
471
- handlePointerUp(ev) {
472
- if (ev.pointerType === 'mouse') {
473
- if (ev.button === KritzelMouseButton.Left) {
474
- this.isLeftButtonDown = false;
475
- this.cursorTrailPoints = [];
476
- }
477
- }
478
- if (ev.pointerType === 'touch') {
479
- if (this.store.state.pointers.size === 0) {
480
- this.isLeftButtonDown = false;
481
- this.cursorTrailPoints = [];
482
- }
483
- }
484
- }
485
- render() {
486
- return (h(Host, { key: '2e6ee739a4c25cee00470ee95ca22e55712c8d7b' }, this.cursorTrailPoints.length > 1 && (h("svg", { key: '483aa687ccd290980ca9c588a84547df2bfdb659', class: "cursor-trail-svg", xmlns: "http://www.w3.org/2000/svg", style: {
487
- position: 'absolute',
488
- left: '0',
489
- top: '0',
490
- width: '100%',
491
- height: '100%',
492
- pointerEvents: 'none',
493
- opacity: 'var(--kritzel-cursor-trail-opacity, 0.6)',
494
- zIndex: '9000',
495
- } }, this.cursorTrailPoints.slice(1).map((point, index) => {
496
- const prevPoint = this.cursorTrailPoints[index];
497
- const now = Date.now();
498
- const age = now - point.timestamp;
499
- const progress = Math.max(0, Math.min(1, age / this.TRAIL_DURATION_MS));
500
- if (progress >= 1)
501
- return null;
502
- const baseStrokeWidth = Math.max(2, 15 * (1 - progress));
503
- return (h("line", { key: `trail-segment-${point.timestamp}`, x1: prevPoint.x.toString(), y1: prevPoint.y.toString(), x2: point.x.toString(), y2: point.y.toString(), stroke: "var(--kritzel-cursor-trail-color, rgb(228, 228, 228))", "stroke-width": baseStrokeWidth.toString(), "stroke-linecap": "round" }));
504
- })))));
505
- }
506
- };
507
- KritzelCursorTrail.style = kritzelCursorTrailCss;
508
-
509
- const kritzelDropdownCss = ":host{display:inline-flex;vertical-align:middle;width:100%;}.dropdown-wrapper{display:flex;align-items:center;border:1px solid #333333;border-radius:var(--kritzel-controls-control-border-radius, 12px);overflow:hidden;height:32px;width:100%}.custom-select{padding:0 8px;padding-right:30px;height:100%;width:100%;box-sizing:border-box;border-radius:0;border:none;background-color:#fff;cursor:pointer;outline:none;font-size:inherit;color:var(--kritzel-controls-text-color, #333333);-webkit-tap-highlight-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"%23333333\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 9 12 15 18 9\"/></svg>');background-size:16px 16px;background-repeat:no-repeat;background-position:right 8px center}.custom-select.has-suffix-border{border-right:1px solid #333333}.custom-select.has-prefix-border{border-left:1px solid #333333}::slotted(*){height:100%;box-sizing:border-box}";
510
-
511
- const KritzelDropdown = class {
512
- constructor(hostRef) {
513
- registerInstance(this, hostRef);
514
- this.valueChanged = createEvent(this, "valueChanged");
515
- this.options = [];
516
- this.selectStyles = {};
517
- this.hasSuffixContent = false;
518
- this.hasPrefixContent = false;
519
- this.handleSelectChange = (event) => {
520
- const newValue = event.target.value;
521
- if (this.internalValue !== newValue) {
522
- this.internalValue = newValue;
523
- this.valueChanged.emit(this.internalValue);
524
- }
525
- };
526
- this.evaluateSuffixContent = () => {
527
- if (this.suffixSlotElement) {
528
- const newHasContent = this.suffixSlotElement.assignedNodes({ flatten: true }).length > 0;
529
- if (this.hasSuffixContent !== newHasContent) {
530
- this.hasSuffixContent = newHasContent;
531
- }
532
- }
533
- else {
534
- if (this.hasSuffixContent !== false) {
535
- this.hasSuffixContent = false;
536
- }
537
- }
538
- };
539
- this.evaluatePrefixContent = () => {
540
- if (this.prefixSlotElement) {
541
- const newHasContent = this.prefixSlotElement.assignedNodes({ flatten: true }).length > 0;
542
- if (this.hasPrefixContent !== newHasContent) {
543
- this.hasPrefixContent = newHasContent;
544
- }
545
- }
546
- else {
547
- if (this.hasPrefixContent !== false) {
548
- this.hasPrefixContent = false;
549
- }
550
- }
551
- };
552
- }
553
- componentWillLoad() {
554
- this.updateInternalValue(this.value, false);
555
- this.evaluateSuffixContent();
556
- this.evaluatePrefixContent();
557
- }
558
- externalValueChanged(newValue) {
559
- if (newValue !== this.internalValue) {
560
- this.updateInternalValue(newValue, false);
561
- }
562
- }
563
- optionsChanged() {
564
- this.updateInternalValue(this.internalValue, true);
565
- }
566
- updateInternalValue(proposedValue, emitChange) {
567
- let finalValue = proposedValue;
568
- if (this.options && this.options.length > 0) {
569
- const isValidValue = this.options.some(opt => opt.value === finalValue);
570
- if (!finalValue || !isValidValue) {
571
- finalValue = this.options[0].value;
572
- }
573
- }
574
- else {
575
- finalValue = undefined;
576
- }
577
- if (this.internalValue !== finalValue) {
578
- this.internalValue = finalValue;
579
- if (emitChange || (proposedValue !== finalValue && proposedValue !== undefined)) {
580
- this.valueChanged.emit(this.internalValue);
581
- }
582
- }
583
- }
584
- render() {
585
- const selectClasses = {
586
- 'custom-select': true,
587
- 'has-suffix-border': this.hasSuffixContent,
588
- 'has-prefix-border': this.hasPrefixContent,
589
- };
590
- return (h(Host, { key: '32c5f5a4f807c1e316c91b795c005b8d30ce6189' }, h("div", { key: 'b1cbeff18e688da4a2f7472be290b9527a619f07', class: "dropdown-wrapper" }, h("slot", { key: 'b3bbb7e21c6f5620cab41aa4b1c7206b6c75fd86', name: "prefix", ref: el => this.prefixSlotElement = el, onSlotchange: this.evaluatePrefixContent }), h("select", { key: '8b2dcdc125bee59cf29fce7c980b755e78d5816e', class: selectClasses, style: Object.assign(Object.assign({}, this.selectStyles), { width: this.width }), onInput: this.handleSelectChange }, this.options.map(option => (h("option", { value: option.value, style: option.style, selected: option.value === this.internalValue }, option.label)))), h("slot", { key: '8d83f0dea41ac959bf2392948efef33bb70d0154', name: "suffix", ref: el => this.suffixSlotElement = el, onSlotchange: this.evaluateSuffixContent }))));
591
- }
592
- static get watchers() { return {
593
- "value": ["externalValueChanged"],
594
- "options": ["optionsChanged"]
595
- }; }
596
- };
597
- KritzelDropdown.style = kritzelDropdownCss;
598
-
599
- class KritzelIconRegistry {
600
- static register(name, svgContent) {
601
- if (this.registry.has(name)) {
602
- console.warn(`[IconRegistry] Icon "${name}" is already registered. It will be overwritten.`);
603
- }
604
- this.registry.set(name, svgContent);
605
- }
606
- static get(name) {
607
- return this.registry.get(name);
608
- }
609
- static registerIcons(icons) {
610
- for (const name in icons) {
611
- if (Object.prototype.hasOwnProperty.call(icons, name)) {
612
- this.register(name, icons[name]);
613
- }
614
- }
615
- }
616
- static has(name) {
617
- return this.registry.has(name);
618
- }
619
- }
620
- KritzelIconRegistry.registry = new Map();
621
- KritzelIconRegistry.registerIcons({
622
- 'cursor': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>',
623
- 'pen': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/></svg>',
624
- 'highlighter': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-highlighter-icon lucide-highlighter"><path d="m9 11-6 6v3h9l3-3"/><path d="m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"/></svg>',
625
- 'eraser': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21"/><path d="M22 21H7"/><path d="m5 11 9 9"/></svg>',
626
- 'type': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 7 4 4 20 4 20 7"/><line x1="9" x2="15" y1="20" y2="20"/><line x1="12" x2="12" y1="4" y2="20"/></svg>',
627
- 'image': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
628
- 'chevron-down': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>',
629
- 'chevron-up': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m18 15-6-6-6 6"/></svg>',
630
- 'copy': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy-icon lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',
631
- 'paste': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-clipboard-paste-icon lucide-clipboard-paste"><path d="M11 14h10"/><path d="M16 4h2a2 2 0 0 1 2 2v1.344"/><path d="m17 18 4-4-4-4"/><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113"/><rect x="8" y="2" width="8" height="4" rx="1"/></svg>',
632
- 'cut': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-scissors-icon lucide-scissors"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>',
633
- 'delete': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash2-icon lucide-trash-2"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg>',
634
- 'bring-to-front': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-up-to-line-icon lucide-arrow-up-to-line"><path d="M5 3h14"/><path d="m18 13-6-6-6 6"/><path d="M12 7v14"/></svg>',
635
- 'send-to-back': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-to-line-icon lucide-arrow-down-to-line"><path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/></svg>',
636
- 'select-all': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-mouse-pointer-icon lucide-square-mouse-pointer"><path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"/><path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"/></svg>',
637
- 'download': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download-icon lucide-download"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>',
638
- 'undo': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-undo-icon lucide-undo"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>',
639
- 'redo': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-redo-icon lucide-redo"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>'
640
- });
641
-
642
- const ABSOLUTE_SCALE_MAX = 1000;
643
- const ABSOLUTE_SCALE_MIN = 0.0001;
644
-
645
- const kritzelEditorCss = "kritzel-editor{display:flex;margin:0;position:relative;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}kritzel-controls{position:absolute;bottom:28px}";
646
-
647
- const KritzelEditor = class {
648
- constructor(hostRef) {
649
- registerInstance(this, hostRef);
650
- this.isReady = createEvent(this, "isReady");
651
- this.scaleMax = ABSOLUTE_SCALE_MAX;
652
- this.scaleMin = ABSOLUTE_SCALE_MIN;
653
- this.controls = [
654
- {
655
- name: 'selection',
656
- type: 'tool',
657
- tool: KritzelSelectionTool,
658
- icon: 'cursor',
659
- },
660
- {
661
- name: 'brush',
662
- type: 'tool',
663
- tool: KritzelBrushTool,
664
- icon: 'pen',
665
- isDefault: true,
666
- config: DEFAULT_BRUSH_CONFIG,
667
- },
668
- {
669
- name: 'eraser',
670
- type: 'tool',
671
- tool: KritzelEraserTool,
672
- icon: 'eraser',
673
- },
674
- {
675
- name: 'text',
676
- type: 'tool',
677
- tool: KritzelTextTool,
678
- icon: 'type',
679
- config: DEFAULT_TEXT_CONFIG,
680
- },
681
- {
682
- name: 'image',
683
- type: 'tool',
684
- tool: KritzelImageTool,
685
- icon: 'image',
686
- },
687
- {
688
- name: 'divider',
689
- type: 'divider',
690
- },
691
- {
692
- name: 'config',
693
- type: 'config',
694
- },
695
- ];
696
- this.globalContextMenuItems = [
697
- {
698
- label: 'Paste',
699
- icon: 'paste',
700
- disabled: async () => (await this.engineRef.getCopiedObjects()).length === 0,
701
- action: menu => this.engineRef.paste(menu.x, menu.y),
702
- },
703
- { label: 'Select All', icon: 'select-all', action: () => this.selectAllObjectsInViewport() },
704
- ];
705
- this.objectContextMenuItems = [
706
- {
707
- label: 'Edit',
708
- icon: 'pen',
709
- visible: (_, objects) => objects.length === 1 && objects[0].isEditable,
710
- action: (_, objects) => {
711
- if (objects.length === 1) {
712
- const object = objects[0];
713
- if (object.isEditable) {
714
- object.edit();
715
- }
716
- }
717
- },
718
- },
719
- { label: 'Copy', icon: 'copy', action: () => this.engineRef.copy() },
720
- {
721
- label: 'Paste',
722
- icon: 'paste',
723
- disabled: async () => (await this.engineRef.getCopiedObjects()).length === 0,
724
- action: (menu, _) => this.engineRef.paste(menu.x, menu.y),
725
- },
726
- { label: 'Delete', icon: 'delete', action: () => this.engineRef.delete() },
727
- { label: 'Bring to Front', icon: 'bring-to-front', action: () => this.engineRef.moveToTop() },
728
- { label: 'Send to Back', icon: 'send-to-back', action: () => this.engineRef.moveToBottom() },
729
- ];
730
- this.customSvgIcons = {};
731
- this.isControlsVisible = true;
732
- this.isUtilityPanelVisible = true;
733
- this.isEngineReady = false;
734
- this.isControlsReady = false;
735
- }
736
- onIsEngineReady(newValue) {
737
- if (newValue && this.isControlsReady) {
738
- this.checkIsReady();
739
- }
740
- }
741
- onIsControlsReady(newValue) {
742
- if (newValue && this.isEngineReady) {
743
- this.checkIsReady();
744
- }
745
- }
746
- async getObjectById(id) {
747
- return this.engineRef.getObjectById(id);
748
- }
749
- async addObject(object) {
750
- return this.engineRef.addObject(object);
751
- }
752
- async updateObject(object, updatedProperties) {
753
- return this.engineRef.updateObject(object, updatedProperties);
754
- }
755
- async removeObject(object) {
756
- return this.engineRef.removeObject(object);
757
- }
758
- async getSelectedObjects() {
759
- return this.engineRef.getSelectedObjects();
760
- }
761
- async selectObjects(objects) {
762
- return this.engineRef.selectObjects(objects);
763
- }
764
- async selectAllObjectsInViewport() {
765
- return this.engineRef.selectAllObjectsInViewport();
766
- }
767
- async clearSelection() {
768
- this.engineRef.clearSelection();
769
- }
770
- async centerObjectInViewport(object) {
771
- return this.engineRef.centerObjectInViewport(object);
772
- }
773
- handleTouchStart(event) {
774
- if (event.cancelable) {
775
- event.preventDefault();
776
- }
777
- }
778
- handleKeyDown(event) {
779
- var _a;
780
- if (event.key === 'Escape') {
781
- event.preventDefault();
782
- (_a = this.controlsRef) === null || _a === void 0 ? void 0 : _a.closeTooltip();
783
- }
784
- }
785
- componentDidLoad() {
786
- this.registerCustomSvgIcons();
787
- }
788
- async checkIsReady() {
789
- await customElements.whenDefined('kritzel-editor');
790
- await customElements.whenDefined('kritzel-controls');
791
- await customElements.whenDefined('kritzel-engine');
792
- if (!this.isEngineReady || !this.isControlsReady) {
793
- return;
794
- }
795
- this.isReady.emit(this.host);
796
- }
797
- registerCustomSvgIcons() {
798
- for (const [name, svg] of Object.entries(this.customSvgIcons)) {
799
- KritzelIconRegistry.register(name, svg);
800
- }
801
- }
802
- render() {
803
- return (h(Host, { key: 'f2fa7efff5baf4df8a9b2100b96e1546731b006b' }, h("kritzel-engine", { key: 'd4fc5d1b0827656119b14c9e2971818904f41c3f', ref: el => (this.engineRef = el), onIsEngineReady: () => (this.isEngineReady = true), scaleMax: this.scaleMax, scaleMin: this.scaleMin, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems }), h("kritzel-controls", { key: 'd5f3a9b3d23090bbc8f36b8f974226697868988d', ref: el => (this.controlsRef = el), controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, style: this.isControlsVisible ? { display: 'flex' } : { display: 'none' }, onIsControlsReady: () => (this.isControlsReady = true) })));
804
- }
805
- get host() { return getElement(this); }
806
- static get watchers() { return {
807
- "isEngineReady": ["onIsEngineReady"],
808
- "isControlsReady": ["onIsControlsReady"]
809
- }; }
810
- };
811
- KritzelEditor.style = kritzelEditorCss;
812
-
813
- class KritzelViewport {
814
- constructor(store, host) {
815
- this.initialTouchDistance = 0;
816
- this.startX = 0;
817
- this.startY = 0;
818
- this._store = store;
819
- this._store.state.host = host;
820
- this._store.state.viewportWidth = host.clientWidth;
821
- this._store.state.viewportHeight = host.clientHeight;
822
- this._store.state.startX = 0;
823
- this._store.state.startY = 0;
824
- this._store.state.translateX = 0;
825
- this._store.state.translateY = 0;
826
- }
827
- handleResize() {
828
- this._store.state.viewportWidth = this._store.state.host.clientWidth;
829
- this._store.state.viewportHeight = this._store.state.host.clientHeight;
830
- this._store.state.hasViewportChanged = true;
831
- this._store.rerender();
832
- }
833
- handlePointerDown(event) {
834
- if (event.pointerType === 'mouse') {
835
- const adjustedClientX = event.clientX - this._store.offsetX;
836
- const adjustedClientY = event.clientY - this._store.offsetY;
837
- if (event.button === KritzelMouseButton.Right) {
838
- this._store.state.isPanning = true;
839
- this._store.state.startX = adjustedClientX;
840
- this._store.state.startY = adjustedClientY;
841
- }
842
- }
843
- if (event.pointerType === 'touch') {
844
- const activePointers = Array.from(this._store.state.pointers.values());
845
- if (activePointers.length === 2) {
846
- this._store.state.currentPath = null;
847
- this._store.state.isScaling = true;
848
- const firstTouchX = activePointers[0].clientX - this._store.offsetX;
849
- const firstTouchY = activePointers[0].clientY - this._store.offsetY;
850
- const secondTouchX = activePointers[1].clientX - this._store.offsetX;
851
- const secondTouchY = activePointers[1].clientY - this._store.offsetY;
852
- this.initialTouchDistance = Math.sqrt(Math.pow(firstTouchX - secondTouchX, 2) + Math.pow(firstTouchY - secondTouchY, 2));
853
- this.startX = (firstTouchX + secondTouchX) / 2;
854
- this.startY = (firstTouchY + secondTouchY) / 2;
855
- this._store.rerender();
856
- }
857
- }
858
- }
859
- handlePointerMove(event) {
860
- if (event.pointerType === 'mouse') {
861
- const hostRect = this._store.state.host.getBoundingClientRect();
862
- const xRelativeToHost = event.clientX - hostRect.left;
863
- const yRelativeToHost = event.clientY - hostRect.top;
864
- this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
865
- this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
866
- if (this._store.state.isPanning) {
867
- this._store.state.translateX -= this._store.state.startX - xRelativeToHost;
868
- this._store.state.translateY -= this._store.state.startY - yRelativeToHost;
869
- this._store.state.startX = xRelativeToHost;
870
- this._store.state.startY = yRelativeToHost;
871
- this._store.state.hasViewportChanged = true;
872
- this._store.state.skipContextMenu = true;
873
- this._store.rerender();
874
- }
875
- }
876
- if (event.pointerType === 'touch') {
877
- const hostRect = this._store.state.host.getBoundingClientRect();
878
- const xRelativeToHost = event.clientX - hostRect.left;
879
- const yRelativeToHost = event.clientY - hostRect.top;
880
- this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
881
- this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
882
- const activePointers = Array.from(this._store.state.pointers.values());
883
- if (activePointers.length === 2) {
884
- const firstTouchX = activePointers[0].clientX - this._store.offsetX;
885
- const firstTouchY = activePointers[0].clientY - this._store.offsetY;
886
- const secondTouchX = activePointers[1].clientX - this._store.offsetX;
887
- const secondTouchY = activePointers[1].clientY - this._store.offsetY;
888
- const currentTouchDistance = Math.sqrt(Math.pow(firstTouchX - secondTouchX, 2) + Math.pow(firstTouchY - secondTouchY, 2));
889
- const midpointX = (firstTouchX + secondTouchX) / 2;
890
- const midpointY = (firstTouchY + secondTouchY) / 2;
891
- const scaleRatio = currentTouchDistance / this.initialTouchDistance;
892
- const newScale = this._store.state.scale * scaleRatio;
893
- if (newScale > this._store.state.scaleMax || newScale < this._store.state.scaleMin) {
894
- this._store.state.translateX += midpointX - this.startX;
895
- this._store.state.translateY += midpointY - this.startY;
896
- }
897
- else {
898
- const translateXAdjustment = (midpointX - this._store.state.translateX) * (scaleRatio - 1);
899
- const translateYAdjustment = (midpointY - this._store.state.translateY) * (scaleRatio - 1);
900
- this._store.state.translateX += midpointX - this.startX - translateXAdjustment;
901
- this._store.state.translateY += midpointY - this.startY - translateYAdjustment;
902
- this._store.state.scale = newScale;
903
- this.initialTouchDistance = currentTouchDistance;
904
- }
905
- this.startX = midpointX;
906
- this.startY = midpointY;
907
- this._store.state.hasViewportChanged = true;
908
- this._store.rerender();
909
- }
910
- }
911
- }
912
- handlePointerUp(event) {
913
- if (event.pointerType === 'mouse') {
914
- if (this._store.state.isPanning) {
915
- this._store.state.isPanning = false;
916
- this._store.rerender();
917
- }
918
- }
919
- if (event.pointerType === 'touch') {
920
- this._store.state.isScaling = false;
921
- this._store.rerender();
922
- }
923
- }
924
- handleWheel(event) {
925
- event.preventDefault();
926
- if (event.ctrlKey === true && KritzelEventHelper.isMainMouseWheel(event)) {
927
- this.handleZoom(event);
928
- }
929
- if (!event.ctrlKey) {
930
- this.handlePan(event);
931
- }
932
- }
933
- handleZoom(event) {
934
- const rect = this._store.state.host.getBoundingClientRect();
935
- const xRelativeToHost = event.clientX - rect.left;
936
- const yRelativeToHost = event.clientY - rect.top;
937
- this._store.state.pointerX = (xRelativeToHost - this._store.state.translateX) / this._store.state.scale;
938
- this._store.state.pointerY = (yRelativeToHost - this._store.state.translateY) / this._store.state.scale;
939
- const delta = event.deltaY > 0 ? -this._store.state.scaleStep * this._store.state.scale : this._store.state.scaleStep * this._store.state.scale;
940
- const newScale = Math.min(this._store.state.scaleMax, Math.max(this._store.state.scaleMin, this._store.state.scale + delta));
941
- const scaleRatio = newScale / this._store.state.scale;
942
- const translateXAdjustment = (xRelativeToHost - this._store.state.translateX) * (scaleRatio - 1);
943
- const translateYAdjustment = (yRelativeToHost - this._store.state.translateY) * (scaleRatio - 1);
944
- this._store.state.scale = newScale;
945
- this._store.state.translateX -= translateXAdjustment;
946
- this._store.state.translateY -= translateYAdjustment;
947
- this._store.state.hasViewportChanged = true;
948
- this._store.rerender();
949
- }
950
- handlePan(event) {
951
- const panSpeed = 0.8;
952
- this._store.state.translateX -= event.deltaX * panSpeed;
953
- this._store.state.translateY -= event.deltaY * panSpeed;
954
- this._store.state.hasViewportChanged = true;
955
- this._store.rerender();
956
- }
957
- }
958
-
959
- class UpdateViewportCommand extends KritzelBaseCommand {
960
- constructor(store, initiator, previousViewport) {
961
- super(store, initiator);
962
- this.previousViewport = previousViewport;
963
- this.currentViewport = {
964
- scale: this._store.state.scale,
965
- translateX: this._store.state.translateX,
966
- translateY: this._store.state.translateY,
967
- };
968
- }
969
- execute() {
970
- this._store.state.scale = this.currentViewport.scale;
971
- this._store.state.translateX = this.currentViewport.translateX;
972
- this._store.state.translateY = this.currentViewport.translateY;
973
- }
974
- undo() {
975
- this._store.state.scale = this.previousViewport.scale;
976
- this._store.state.translateX = this.previousViewport.translateX;
977
- this._store.state.translateY = this.previousViewport.translateY;
978
- }
979
- }
980
-
981
- class KritzelCircularBuffer {
982
- constructor(capacity) {
983
- this.head = 0;
984
- this.tail = 0;
985
- this.size = 0;
986
- this.capacity = capacity;
987
- this.buffer = new Array(capacity).fill(null);
988
- }
989
- add(item) {
990
- this.buffer[this.head] = item;
991
- this.head = (this.head + 1) % this.capacity;
992
- if (this.size < this.capacity) {
993
- this.size++;
994
- }
995
- else {
996
- this.tail = (this.tail + 1) % this.capacity;
997
- }
998
- }
999
- pop() {
1000
- if (this.size === 0) {
1001
- return null;
1002
- }
1003
- this.head = (this.head - 1 + this.capacity) % this.capacity;
1004
- const item = this.buffer[this.head];
1005
- this.buffer[this.head] = null;
1006
- this.size--;
1007
- return item;
1008
- }
1009
- peek() {
1010
- if (this.size === 0) {
1011
- return null;
1012
- }
1013
- const lastIndex = (this.head - 1 + this.capacity) % this.capacity;
1014
- return this.buffer[lastIndex];
1015
- }
1016
- isEmpty() {
1017
- return this.size === 0;
1018
- }
1019
- clear() {
1020
- this.buffer.fill(null);
1021
- this.head = 0;
1022
- this.tail = 0;
1023
- this.size = 0;
1024
- }
1025
- }
1026
-
1027
- class KritzelHistory {
1028
- constructor(store) {
1029
- this._store = store;
1030
- this.undoStack = new KritzelCircularBuffer(this._store.state.historyBufferSize);
1031
- this.redoStack = new KritzelCircularBuffer(this._store.state.historyBufferSize);
1032
- this.previousViewport = {
1033
- scale: this._store.state.scale,
1034
- scaleStep: this._store.state.scaleStep,
1035
- translateX: this._store.state.translateX,
1036
- translateY: this._store.state.translateY,
1037
- };
1038
- }
1039
- executeCommand(command) {
1040
- if (this._store.state.hasViewportChanged) {
1041
- this.addUpdateViewportCommand();
1042
- }
1043
- command.execute();
1044
- if (this._store.state.debugInfo.logCommands)
1045
- console.info('add', command);
1046
- this.undoStack.add(command);
1047
- if (this.redoStack.isEmpty() === false) {
1048
- this.redoStack.clear();
1049
- }
1050
- this._store.rerender();
1051
- }
1052
- undo() {
1053
- if (this._store.state.hasViewportChanged) {
1054
- const command = new UpdateViewportCommand(this._store, this, this.previousViewport);
1055
- command.undo();
1056
- this._store.state.hasViewportChanged = false;
1057
- this._store.rerender();
1058
- return;
1059
- }
1060
- const command = this.undoStack.pop();
1061
- if (command) {
1062
- command.undo();
1063
- if (this._store.state.debugInfo.logCommands)
1064
- console.info('undo', command);
1065
- this.redoStack.add(command);
1066
- }
1067
- this._store.rerender();
1068
- }
1069
- redo() {
1070
- const command = this.redoStack.pop();
1071
- if (command) {
1072
- command.execute();
1073
- if (this._store.state.debugInfo.logCommands)
1074
- console.info('redo', command);
1075
- this.undoStack.add(command);
1076
- }
1077
- this._store.rerender();
1078
- }
1079
- addUpdateViewportCommand() {
1080
- const command = new UpdateViewportCommand(this._store, this, this.previousViewport);
1081
- command.execute();
1082
- this.undoStack.add(command);
1083
- if (this.redoStack.isEmpty() === false) {
1084
- this.redoStack.clear();
1085
- }
1086
- this._store.state.hasViewportChanged = false;
1087
- this.previousViewport = {
1088
- scale: this._store.state.scale,
1089
- scaleStep: this._store.state.scaleStep,
1090
- translateX: this._store.state.translateX,
1091
- translateY: this._store.state.translateY,
1092
- };
1093
- }
1094
- }
1095
-
1096
- class KritzelOctree {
1097
- constructor(bounds, capacity = 8) {
1098
- this.objects = [];
1099
- this.children = null;
1100
- this.bounds = bounds;
1101
- this.capacity = capacity;
1102
- }
1103
- insert(object) {
1104
- if (!this.intersects(object.rotatedBoundingBox, this.bounds)) {
1105
- return false;
1106
- }
1107
- if (this.objects.length < this.capacity && this.children === null) {
1108
- this.objects.push(object);
1109
- return true;
1110
- }
1111
- if (this.children === null) {
1112
- this.subdivide();
1113
- }
1114
- for (const child of this.children) {
1115
- if (child.insert(object)) {
1116
- return true;
1117
- }
1118
- }
1119
- return false;
1120
- }
1121
- update(object) {
1122
- const index = this.objects.findIndex(o => o.id === object.id);
1123
- if (index !== -1) {
1124
- this.objects[index] = object;
1125
- return true;
1126
- }
1127
- if (this.children !== null) {
1128
- for (const child of this.children) {
1129
- if (child.update(object)) {
1130
- return true;
1131
- }
1132
- }
1133
- }
1134
- return false;
1135
- }
1136
- remove(predicate) {
1137
- const index = this.objects.findIndex(o => predicate(o));
1138
- if (index !== -1) {
1139
- this.objects.splice(index, 1);
1140
- }
1141
- if (this.children !== null) {
1142
- for (const child of this.children) {
1143
- child.remove(predicate);
1144
- }
1145
- }
1146
- }
1147
- query(range) {
1148
- const results = [];
1149
- if (!this.intersects(range, this.bounds)) {
1150
- return results;
1151
- }
1152
- for (const object of this.objects) {
1153
- if (this.intersects(object.rotatedBoundingBox, range)) {
1154
- results.push(object);
1155
- }
1156
- }
1157
- if (this.children !== null) {
1158
- for (const child of this.children) {
1159
- results.push(...child.query(range));
1160
- }
1161
- }
1162
- return results;
1163
- }
1164
- filter(predicate) {
1165
- const results = this.objects.filter(o => predicate(o));
1166
- if (this.children !== null) {
1167
- for (const child of this.children) {
1168
- results.push(...child.filter(predicate));
1169
- }
1170
- }
1171
- return results;
1172
- }
1173
- allObjects() {
1174
- const results = [...this.objects];
1175
- if (this.children !== null) {
1176
- for (const child of this.children) {
1177
- results.push(...child.allObjects());
1178
- }
1179
- }
1180
- return results;
1181
- }
1182
- subdivide() {
1183
- const { x, y, z, width, height, depth } = this.bounds;
1184
- const halfWidth = width / 2;
1185
- const halfHeight = height / 2;
1186
- const halfDepth = depth / 2;
1187
- this.children = [
1188
- new KritzelOctree({ x, y, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1189
- new KritzelOctree({ x: x + halfWidth, y, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1190
- new KritzelOctree({ x, y: y + halfHeight, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1191
- new KritzelOctree({ x: x + halfWidth, y: y + halfHeight, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1192
- new KritzelOctree({ x, y, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1193
- new KritzelOctree({ x: x + halfWidth, y, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1194
- new KritzelOctree({ x, y: y + halfHeight, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1195
- new KritzelOctree({ x: x + halfWidth, y: y + halfHeight, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
1196
- ];
1197
- }
1198
- intersects(a, b) {
1199
- return !(a.x >= b.x + b.width || // a is completely to the right of b
1200
- a.x + a.width <= b.x || // a is completely to the left of b
1201
- a.y >= b.y + b.height || // a is completely below b
1202
- a.y + a.height <= b.y // a is completely above b
1203
- );
1204
- }
1205
- }
1206
-
1207
- class UpdateObjectCommand extends KritzelBaseCommand {
1208
- constructor(store, initiator, object, updatedProperties) {
1209
- super(store, initiator);
1210
- this.object = object;
1211
- this.updatedProperties = updatedProperties;
1212
- this.previousProperties = {};
1213
- for (const key in updatedProperties) {
1214
- if (updatedProperties.hasOwnProperty(key)) {
1215
- this.previousProperties[key] = this.object[key];
1216
- }
1217
- }
1218
- }
1219
- execute() {
1220
- for (const key in this.updatedProperties) {
1221
- if (this.updatedProperties.hasOwnProperty(key)) {
1222
- this.object[key] = this.updatedProperties[key];
1223
- }
1224
- }
1225
- }
1226
- undo() {
1227
- for (const key in this.previousProperties) {
1228
- if (this.previousProperties.hasOwnProperty(key)) {
1229
- this.object[key] = this.previousProperties[key];
1230
- }
1231
- }
1232
- }
1233
- }
1234
-
1235
- const DEFAULT_ENGINE_STATE = {
1236
- activeTool: null,
1237
- activeText: null,
1238
- currentPath: null,
1239
- copiedObjects: null,
1240
- objectsOctree: null,
1241
- selectionBox: null,
1242
- selectionGroup: null,
1243
- resizeHandleType: null,
1244
- hasViewportChanged: false,
1245
- isReady: false,
1246
- isEnabled: true,
1247
- isScaling: false,
1248
- isPanning: false,
1249
- isFocused: false,
1250
- isSelecting: false,
1251
- isResizing: false,
1252
- isResizeHandleSelected: false,
1253
- isRotating: false,
1254
- isRotationHandleSelected: false,
1255
- isDragging: false,
1256
- isDrawing: false,
1257
- isErasing: false,
1258
- isWriting: false,
1259
- isCtrlKeyPressed: false,
1260
- isContextMenuVisible: false,
1261
- contextMenuItems: [],
1262
- contextMenuX: 0,
1263
- contextMenuY: 0,
1264
- skipContextMenu: false,
1265
- debugInfo: {
1266
- showObjectInfo: false,
1267
- showViewportInfo: false,
1268
- logCommands: false,
1269
- },
1270
- host: null,
1271
- pointerX: 0,
1272
- pointerY: 0,
1273
- scale: 1,
1274
- scaleMax: 1,
1275
- scaleMin: 1,
1276
- scaleStep: 0.05,
1277
- startX: 0,
1278
- startY: 0,
1279
- translateX: 0,
1280
- translateXMax: 400,
1281
- translateXMin: 0,
1282
- translateY: 0,
1283
- translateYMax: 400,
1284
- translateYMin: 0,
1285
- viewportWidth: 0,
1286
- viewportHeight: 0,
1287
- historyBufferSize: 1000,
1288
- longTouchTimeout: null,
1289
- longTouchDelay: 300,
1290
- pointers: new Map()
1291
- };
1292
-
1293
- class KritzelStore {
1294
- get history() {
1295
- return this._history;
1296
- }
1297
- get state() {
1298
- return this._state;
1299
- }
1300
- get currentZIndex() {
1301
- return this._state.objectsOctree.filter(o => !(o instanceof KritzelSelectionGroup) && !(o instanceof KrtizelSelectionBox)).length;
1302
- }
1303
- get allObjects() {
1304
- return this._state.objectsOctree.allObjects();
1305
- }
1306
- get selectedObjects() {
1307
- return this.allObjects.filter(o => !(o instanceof KritzelSelectionGroup)).filter(o => o.isSelected);
1308
- }
1309
- get offsetX() {
1310
- return this._state.host.getBoundingClientRect().left;
1311
- }
1312
- get offsetY() {
1313
- return this._state.host.getBoundingClientRect().top;
1314
- }
1315
- constructor(kritzelEngine) {
1316
- this._listeners = new Map();
1317
- this.objects = [];
1318
- this._state = DEFAULT_ENGINE_STATE;
1319
- this._kritzelEngine = kritzelEngine;
1320
- this._history = new KritzelHistory(this);
1321
- this._state.objectsOctree = new KritzelOctree({
1322
- x: -Infinity,
1323
- y: -Infinity,
1324
- z: -Infinity,
1325
- width: Infinity,
1326
- height: Infinity,
1327
- depth: Infinity,
1328
- });
1329
- }
1330
- rerender() {
1331
- const viewportBounds = {
1332
- x: -this._state.translateX / this._state.scale,
1333
- y: -this._state.translateY / this._state.scale,
1334
- z: this._state.scale,
1335
- width: this._state.viewportWidth / this._state.scale,
1336
- height: this._state.viewportHeight / this._state.scale,
1337
- depth: 100,
1338
- };
1339
- this.objects = this._state.objectsOctree.query(viewportBounds);
1340
- if (this._kritzelEngine) {
1341
- this._kritzelEngine.forceUpdate++;
1342
- }
1343
- }
1344
- findObjectById(id) {
1345
- for (const object of this.allObjects) {
1346
- if (object.id === id) {
1347
- return object;
1348
- }
1349
- }
1350
- return null;
1351
- }
1352
- deselectAllObjects() {
1353
- if (this._state.selectionGroup) {
1354
- this._history.executeCommand(new RemoveSelectionGroupCommand(this, this));
1355
- }
1356
- }
1357
- onStateChange(property, listener) {
1358
- if (!this._listeners.has(property)) {
1359
- this._listeners.set(property, new Set());
1360
- }
1361
- this._listeners.get(property).add(listener);
1362
- }
1363
- setState(property, value) {
1364
- const oldValue = this._state[property];
1365
- if (oldValue !== value) {
1366
- this._state[property] = value;
1367
- if (this._listeners.has(property)) {
1368
- this._listeners.get(property).forEach(listener => listener(value, oldValue, String(property)));
1369
- }
1370
- }
1371
- }
1372
- delete() {
1373
- if (!this.state.selectionGroup) {
1374
- return;
1375
- }
1376
- const deleteSelectedObjectsCommand = this.state.selectionGroup.objects.map(obj => new RemoveObjectCommand(this, this.state.selectionGroup, obj));
1377
- const removeSelectionGroupCommand = new RemoveSelectionGroupCommand(this, this.state.selectionGroup);
1378
- const commands = [...deleteSelectedObjectsCommand, removeSelectionGroupCommand];
1379
- this.history.executeCommand(new BatchCommand(this, this.state.selectionGroup, commands));
1380
- }
1381
- deleteObject(id, isHistoryUpdated = true) {
1382
- const object = this.findObjectById(id);
1383
- if (object) {
1384
- if (isHistoryUpdated) {
1385
- const removeObjectCommand = new RemoveObjectCommand(this, this, object);
1386
- this.history.executeCommand(removeObjectCommand);
1387
- }
1388
- else {
1389
- this._state.objectsOctree.remove(obj => obj.id === id);
1390
- this.rerender();
1391
- }
1392
- }
1393
- }
1394
- copy() {
1395
- this.state.copiedObjects = this.state.selectionGroup.copy();
1396
- }
1397
- paste(x, y) {
1398
- this.state.copiedObjects.isSelected = true;
1399
- const adjustedX = x !== undefined ? x : this.state.copiedObjects.translateX + 25;
1400
- const adjustedY = y !== undefined ? y : this.state.copiedObjects.translateY + 25;
1401
- this.state.copiedObjects.updatePosition(adjustedX, adjustedY);
1402
- const commands = [];
1403
- if (this.state.selectionGroup !== null) {
1404
- commands.push(new RemoveSelectionGroupCommand(this, this.state.selectionGroup));
1405
- }
1406
- const addCopiedObjectsCommands = this.state.copiedObjects.objects.map(obj => new AddObjectCommand(this, this, obj));
1407
- const addCopiedObjectsAsSelectionGroupCommand = new AddSelectionGroupCommand(this, this, this.state.copiedObjects);
1408
- commands.push(...addCopiedObjectsCommands, addCopiedObjectsAsSelectionGroupCommand);
1409
- this.history.executeCommand(new BatchCommand(this, this, commands));
1410
- this.state.isSelecting = false;
1411
- this.state.copiedObjects = this.state.selectionGroup.copy();
1412
- this.setState('activeTool', KritzelToolRegistry.getTool('selection'));
1413
- }
1414
- bringForward(object) {
1415
- const max = this.allObjects.length + 1;
1416
- const objects = object ? [object] : this.state.selectionGroup.objects;
1417
- const increaseZIndexCommands = objects.map(obj => {
1418
- if (obj.zIndex === max) {
1419
- return;
1420
- }
1421
- return new UpdateObjectCommand(this, this, obj, { zIndex: obj.zIndex + 1 });
1422
- });
1423
- this.history.executeCommand(new BatchCommand(this, this, increaseZIndexCommands));
1424
- }
1425
- sendBackward(object) {
1426
- const min = 0;
1427
- const objects = object ? [object] : this.state.selectionGroup.objects;
1428
- const decreaseZIndexCommands = objects.map(obj => {
1429
- if (obj.zIndex === min) {
1430
- return;
1431
- }
1432
- return new UpdateObjectCommand(this, this, obj, { zIndex: obj.zIndex - 1 });
1433
- });
1434
- this.history.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
1435
- }
1436
- bringToFront(object) {
1437
- const max = this.allObjects.length + 1;
1438
- const objects = object ? [object] : this.state.selectionGroup.objects;
1439
- const increaseZIndexCommands = objects.map(obj => {
1440
- return new UpdateObjectCommand(this, this, obj, { zIndex: max });
1441
- });
1442
- this.history.executeCommand(new BatchCommand(this, this, increaseZIndexCommands));
1443
- }
1444
- sendToBack(object) {
1445
- const min = -1;
1446
- const objects = object ? [object] : this.state.selectionGroup.objects;
1447
- const decreaseZIndexCommands = objects.map(obj => {
1448
- return new UpdateObjectCommand(this, this, obj, { zIndex: min });
1449
- });
1450
- this.history.executeCommand(new BatchCommand(this, this, decreaseZIndexCommands));
1451
- }
1452
- selectObjects(objects) {
1453
- if (objects.length === 0) {
1454
- return;
1455
- }
1456
- const selectionGroup = KritzelSelectionGroup.create(this);
1457
- objects.forEach(obj => {
1458
- obj.isSelected = false;
1459
- selectionGroup.addOrRemove(obj);
1460
- });
1461
- selectionGroup.isSelected = true;
1462
- this.state.selectionGroup = selectionGroup;
1463
- if (objects.length === 1) {
1464
- selectionGroup.rotation = selectionGroup.objects[0].rotation;
1465
- }
1466
- this.history.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
1467
- }
1468
- selectAllObjectsInViewport() {
1469
- const objectsInViewport = this._state.objectsOctree
1470
- .query({
1471
- x: -this._state.translateX / this._state.scale,
1472
- y: -this._state.translateY / this._state.scale,
1473
- z: this._state.scale,
1474
- width: this._state.viewportWidth / this._state.scale,
1475
- height: this._state.viewportHeight / this._state.scale,
1476
- depth: 100,
1477
- })
1478
- .filter(o => !(o instanceof KritzelSelectionGroup) && !(o instanceof KrtizelSelectionBox) && !(o instanceof KritzelContextMenu));
1479
- if (objectsInViewport.length > 0) {
1480
- const selectionGroup = KritzelSelectionGroup.create(this);
1481
- objectsInViewport.forEach(obj => {
1482
- obj.isSelected = false;
1483
- selectionGroup.addOrRemove(obj);
1484
- });
1485
- selectionGroup.isSelected = true;
1486
- this.state.isSelecting = false;
1487
- if (objectsInViewport.length === 1) {
1488
- selectionGroup.rotation = selectionGroup.objects[0].rotation;
1489
- }
1490
- this.history.executeCommand(new AddSelectionGroupCommand(this, this, selectionGroup));
1491
- this.setState('activeTool', KritzelToolRegistry.getTool('selection'));
1492
- }
1493
- }
1494
- clearSelection() {
1495
- const command = new RemoveSelectionGroupCommand(this, this.state.selectionGroup);
1496
- this.history.executeCommand(command);
1497
- this.state.selectionGroup = null;
1498
- this.state.selectionBox = null;
1499
- this.state.isSelecting = false;
1500
- this.state.isResizeHandleSelected = false;
1501
- this.state.isRotationHandleSelected = false;
1502
- }
1503
- resetActiveText() {
1504
- if (this.state.activeText && this.state.activeText.value === ' ') {
1505
- this.deleteObject(this.state.activeText.id, false);
1506
- this.history.undoStack.pop();
1507
- }
1508
- this.state.activeText = null;
1509
- }
1510
- getObjectFromPointerEvent(event, selector = '.object') {
1511
- var _a;
1512
- const shadowRoot = (_a = this.state.host) === null || _a === void 0 ? void 0 : _a.shadowRoot;
1513
- if (!shadowRoot)
1514
- return null;
1515
- const clientX = event.clientX;
1516
- const clientY = event.clientY;
1517
- const elementAtPoint = shadowRoot.elementFromPoint(clientX, clientY);
1518
- if (!elementAtPoint)
1519
- return null;
1520
- const selectedObject = elementAtPoint.closest(selector);
1521
- if (selectedObject) {
1522
- return this.allObjects.find(object => selectedObject.id === object.id);
1523
- }
1524
- return null;
1525
- }
1526
- getObjectsFromPointerEvent(event, selector = '.object') {
1527
- var _a;
1528
- const shadowRoot = (_a = this.state.host) === null || _a === void 0 ? void 0 : _a.shadowRoot;
1529
- if (!shadowRoot)
1530
- return [];
1531
- const clientX = event.clientX;
1532
- const clientY = event.clientY;
1533
- const elementsAtPoint = shadowRoot.elementsFromPoint(clientX, clientY);
1534
- if (!elementsAtPoint || elementsAtPoint.length === 0)
1535
- return [];
1536
- const objectIds = new Set();
1537
- elementsAtPoint.forEach(element => {
1538
- const selectedObject = element.closest(selector);
1539
- if (selectedObject && selectedObject.id) {
1540
- objectIds.add(selectedObject.id);
1541
- }
1542
- });
1543
- if (objectIds.size > 0) {
1544
- return this.allObjects.filter(object => objectIds.has(object.id)).sort((a, b) => b.zIndex - a.zIndex);
1545
- }
1546
- return [];
1547
- }
1548
- getCanvasPoint(event) {
1549
- if (!this.state.host) {
1550
- return { x: 0, y: 0 };
1551
- }
1552
- // Get the position of the kritzel-engine host element relative to the viewport
1553
- const hostRect = this.state.host.getBoundingClientRect();
1554
- // 1. Make the pointer coordinates relative to the host element
1555
- const xRelativeToHost = event.clientX - hostRect.left;
1556
- const yRelativeToHost = event.clientY - hostRect.top;
1557
- // 2. Reverse the translation applied to the #origin div
1558
- const xWithoutTranslate = xRelativeToHost - this.state.translateX;
1559
- const yWithoutTranslate = yRelativeToHost - this.state.translateY;
1560
- // 3. Reverse the scaling to get the final world coordinates
1561
- const worldX = xWithoutTranslate / this.state.scale;
1562
- const worldY = yWithoutTranslate / this.state.scale;
1563
- return { x: worldX, y: worldY };
1564
- }
1565
- }
1566
-
1567
- class KritzelKeyHandler extends KritzelBaseHandler {
1568
- constructor(store) {
1569
- super(store);
1570
- }
1571
- handleKeyDown(event) {
1572
- if (this._store.state.isFocused === false) {
1573
- event.preventDefault();
1574
- return;
1575
- }
1576
- this._store.state.isCtrlKeyPressed = event.ctrlKey;
1577
- if (this._store.state.isCtrlKeyPressed) {
1578
- event.preventDefault();
1579
- }
1580
- if (event.key === 'Escape' && this._store.state.selectionGroup) {
1581
- this._store.clearSelection();
1582
- }
1583
- if (event.key === 'Delete' && this._store.state.selectionGroup) {
1584
- this._store.delete();
1585
- }
1586
- if (event.key === 'z' && event.ctrlKey) {
1587
- this._store.history.undo();
1588
- }
1589
- if (event.key === 'y' && event.ctrlKey) {
1590
- this._store.history.redo();
1591
- }
1592
- if (event.key === 's' && event.ctrlKey) {
1593
- this._store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
1594
- this._store.deselectAllObjects();
1595
- }
1596
- if (event.key === 'b' && event.ctrlKey) {
1597
- this._store.setState('activeTool', KritzelToolRegistry.getTool('brush'));
1598
- this._store.deselectAllObjects();
1599
- }
1600
- if (event.key === 'e' && event.ctrlKey) {
1601
- this._store.setState('activeTool', KritzelToolRegistry.getTool('eraser'));
1602
- this._store.deselectAllObjects();
1603
- }
1604
- if (event.key === 'i' && event.ctrlKey) {
1605
- this._store.setState('activeTool', KritzelToolRegistry.getTool('image'));
1606
- this._store.deselectAllObjects();
1607
- }
1608
- if (event.key === 'x' && event.ctrlKey) {
1609
- this._store.setState('activeTool', KritzelToolRegistry.getTool('text'));
1610
- this._store.deselectAllObjects();
1611
- }
1612
- if (event.key === 'c' && event.ctrlKey && this._store.state.selectionGroup) {
1613
- this._store.copy();
1614
- this._store.rerender();
1615
- }
1616
- if (event.key === 'v' && event.ctrlKey && this._store.state.copiedObjects) {
1617
- this._store.paste();
1618
- }
1619
- if (event.key === '+' && event.ctrlKey && this._store.state.selectionGroup) {
1620
- this._store.bringForward();
1621
- }
1622
- if (event.key === '-' && event.ctrlKey && this._store.state.selectionGroup) {
1623
- this._store.sendBackward();
1624
- }
1625
- if (event.key === '*' && event.shiftKey && this._store.state.selectionGroup) {
1626
- this._store.bringToFront();
1627
- }
1628
- if (event.key === '_' && event.shiftKey && this._store.state.selectionGroup) {
1629
- this._store.sendToBack();
1630
- }
1631
- if (event.key === 'a' && event.ctrlKey && this._store.state.activeText) {
1632
- this._store.state.activeText.selectAll();
1633
- }
1634
- if (event.key === 'v' && event.ctrlKey && this._store.state.activeText) {
1635
- this._store.state.activeText.insertFromClipboard();
1636
- }
1637
- }
1638
- handleKeyUp(event) {
1639
- if (this._store.state.isFocused === false) {
1640
- return;
1641
- }
1642
- this._store.state.isCtrlKeyPressed = event.ctrlKey;
1643
- }
1644
- }
1645
-
1646
- class KritzelContextMenuHandler extends KritzelBaseHandler {
1647
- constructor(store, globalContextMenuItems, objectContextMenuItems) {
1648
- super(store);
1649
- this.globalContextMenuItems = [];
1650
- this.objectContextMenuItems = [];
1651
- this.globalContextMenuItems = globalContextMenuItems;
1652
- this.objectContextMenuItems = objectContextMenuItems;
1653
- }
1654
- handleContextMenu(event) {
1655
- if (this._store.state.skipContextMenu) {
1656
- this._store.state.skipContextMenu = false;
1657
- return;
1658
- }
1659
- const selectedObject = this._store.getObjectFromPointerEvent(event, '.object');
1660
- if (selectedObject && !(selectedObject instanceof KritzelSelectionGroup)) {
1661
- this._store.state.selectionGroup = KritzelSelectionGroup.create(this._store);
1662
- this._store.state.selectionGroup.addOrRemove(selectedObject);
1663
- this._store.state.selectionGroup.isSelected = true;
1664
- this._store.state.selectionGroup.rotation = selectedObject.rotation;
1665
- this._store.state.isSelecting = false;
1666
- this._store.history.executeCommand(new AddSelectionGroupCommand(this._store, this, this._store.state.selectionGroup));
1667
- }
1668
- this._store.state.contextMenuItems = this._store.state.selectionGroup ? this.objectContextMenuItems : this.globalContextMenuItems;
1669
- let x = event.clientX - this._store.offsetX;
1670
- let y = event.clientY - this._store.offsetY;
1671
- const menuWidthEstimate = 150;
1672
- const menuHeightEstimate = 200;
1673
- const margin = 10;
1674
- if (x + menuWidthEstimate > window.innerWidth - margin) {
1675
- x = window.innerWidth - menuWidthEstimate - margin;
1676
- }
1677
- if (y + menuHeightEstimate > window.innerHeight - margin) {
1678
- y = window.innerHeight - menuHeightEstimate - margin;
1679
- }
1680
- x = Math.max(margin, x);
1681
- y = Math.max(margin, y);
1682
- this._store.state.contextMenuX = x;
1683
- this._store.state.contextMenuY = y;
1684
- this._store.state.isContextMenuVisible = true;
1685
- this._store.state.isEnabled = false;
1686
- this._store.rerender();
1687
- }
1688
- }
1689
-
1690
- class KritzelClassHelper {
1691
- static isInstanceOf(object, className) {
1692
- return object.__class__ === className;
1693
- }
1694
- }
1695
-
1696
- 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}";
1697
-
1698
- const KritzelEngine = class {
1699
- validateScaleMax(newValue) {
1700
- if (newValue > ABSOLUTE_SCALE_MAX) {
1701
- console.warn(`scaleMax cannot be greater than ${ABSOLUTE_SCALE_MAX}.`);
1702
- this.scaleMax = ABSOLUTE_SCALE_MAX;
1703
- this.store.state.scaleMax = this.scaleMax;
1704
- }
1705
- else {
1706
- this.store.state.scaleMax = newValue;
1707
- }
1708
- }
1709
- validateScaleMin(newValue) {
1710
- if (newValue < ABSOLUTE_SCALE_MIN) {
1711
- console.warn(`scaleMin cannot be less than ${ABSOLUTE_SCALE_MIN}.`);
1712
- this.scaleMin = ABSOLUTE_SCALE_MIN;
1713
- this.store.state.scaleMin = this.scaleMin;
1714
- }
1715
- else {
1716
- this.store.state.scaleMin = newValue;
1717
- }
1718
- }
1719
- get isSelecting() {
1720
- return this.store.state.activeTool instanceof KritzelSelectionTool && this.store.state.isSelecting;
1721
- }
1722
- get isSelectionActive() {
1723
- return this.store.state.activeTool instanceof KritzelSelectionTool && this.store.state.selectionGroup !== null;
1724
- }
1725
- constructor(hostRef) {
1726
- registerInstance(this, hostRef);
1727
- this.isEngineReady = createEvent(this, "isEngineReady");
1728
- this.activeToolChange = createEvent(this, "activeToolChange");
1729
- this.scaleMax = ABSOLUTE_SCALE_MAX;
1730
- this.scaleMin = ABSOLUTE_SCALE_MIN;
1731
- this.forceUpdate = 0;
1732
- this.contextMenuElement = null;
1733
- this.store = new KritzelStore(this);
1734
- }
1735
- componentWillLoad() {
1736
- this.validateScaleMax(this.scaleMax);
1737
- this.validateScaleMin(this.scaleMin);
1738
- }
1739
- componentDidLoad() {
1740
- this.contextMenuHandler = new KritzelContextMenuHandler(this.store, this.globalContextMenuItems, this.objectContextMenuItems);
1741
- this.keyHandler = new KritzelKeyHandler(this.store);
1742
- this.viewport = new KritzelViewport(this.store, this.host);
1743
- this._registerStateChangeListeners();
1744
- if (this.store.state.isReady === false) {
1745
- this.store.state.isReady = true;
1746
- this.isEngineReady.emit();
1747
- }
1748
- }
1749
- handleWheel(ev) {
1750
- var _a, _b;
1751
- if (this.store.state.isContextMenuVisible) {
1752
- this.hideContextMenu();
1753
- }
1754
- this.viewport.handleWheel(ev);
1755
- (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handleWheel(ev);
1756
- }
1757
- handlePointerDown(ev) {
1758
- var _a, _b;
1759
- if (KritzelEventHelper.isPointerEventOnContextMenu(ev) === false && this.store.state.isContextMenuVisible) {
1760
- this.hideContextMenu();
1761
- return;
1762
- }
1763
- if (this.store.state.isEnabled === false) {
1764
- return;
1765
- }
1766
- KritzelEventHelper.onLongTouchPress(ev, (event) => {
1767
- if (!(this.store.state.activeTool instanceof KritzelSelectionTool)) {
1768
- return;
1769
- }
1770
- this.contextMenuHandler.handleContextMenu(event);
1771
- });
1772
- this.host.setPointerCapture(ev.pointerId);
1773
- this.store.state.pointers.set(ev.pointerId, ev);
1774
- this.viewport.handlePointerDown(ev);
1775
- (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerDown(ev);
1776
- }
1777
- handlePointerMove(ev) {
1778
- var _a, _b;
1779
- if (this.store.state.isEnabled === false) {
1780
- return;
1781
- }
1782
- this.store.state.pointers.set(ev.pointerId, ev);
1783
- this.viewport.handlePointerMove(ev);
1784
- (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerMove(ev);
1785
- }
1786
- handlePointerUp(ev) {
1787
- var _a, _b;
1788
- if (this.store.state.isEnabled === false) {
1789
- return;
1790
- }
1791
- this.store.state.pointers.delete(ev.pointerId);
1792
- this.host.releasePointerCapture(ev.pointerId);
1793
- this.viewport.handlePointerUp(ev);
1794
- (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerUp(ev);
1795
- }
1796
- handlePointerCancel(ev) {
1797
- var _a, _b;
1798
- if (this.store.state.isEnabled === false) {
1799
- return;
1800
- }
1801
- this.host.releasePointerCapture(ev.pointerId);
1802
- this.store.state.pointers.delete(ev.pointerId);
1803
- this.viewport.handlePointerUp(ev);
1804
- (_b = (_a = this.store.state) === null || _a === void 0 ? void 0 : _a.activeTool) === null || _b === void 0 ? void 0 : _b.handlePointerUp(ev);
1805
- }
1806
- handleContextMenu(ev) {
1807
- ev.preventDefault();
1808
- if (this.store.state.isEnabled === false) {
1809
- return;
1810
- }
1811
- if (ev.pointerType === 'touch') {
1812
- return;
1813
- }
1814
- this.contextMenuHandler.handleContextMenu(ev);
1815
- }
1816
- handleResize() {
1817
- this.viewport.handleResize();
1818
- }
1819
- handleKeyDown(ev) {
1820
- this.keyHandler.handleKeyDown(ev);
1821
- }
1822
- handleKeyUp(ev) {
1823
- this.keyHandler.handleKeyUp(ev);
1824
- }
1825
- updateFocus(ev) {
1826
- const rect = this.store.state.host.getBoundingClientRect();
1827
- const isInside = ev.clientX >= rect.left && ev.clientX <= rect.right && ev.clientY >= rect.top && ev.clientY <= rect.bottom;
1828
- const path = ev.composedPath();
1829
- const kritzelEngineElement = this.host.closest('kritzel-engine');
1830
- const isInKritzelEngine = path.includes(kritzelEngineElement || this.host);
1831
- this.store.setState('isFocused', isInside && isInKritzelEngine);
1832
- }
1833
- async registerTool(toolName, toolClass, toolConfig) {
1834
- if (typeof toolClass !== 'function' || !(toolClass.prototype instanceof KritzelBaseTool)) {
1835
- console.error(`Failed to register tool "${toolName}": Tool class must be a constructor function`);
1836
- return null;
1837
- }
1838
- const registeredTool = KritzelToolRegistry.registerTool(toolName, toolClass, this.store);
1839
- if (toolConfig) {
1840
- Object.entries(toolConfig).forEach(([key, value]) => {
1841
- registeredTool[key] = value;
1842
- });
1843
- }
1844
- return Promise.resolve(registeredTool);
1845
- }
1846
- async changeActiveTool(tool) {
1847
- var _a;
1848
- (_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
1849
- this.store.setState('activeTool', tool);
1850
- this.store.deselectAllObjects();
1851
- tool === null || tool === void 0 ? void 0 : tool.onActivate();
1852
- }
1853
- async setFocus() {
1854
- this.host.focus();
1855
- this.store.state.isFocused = true;
1856
- }
1857
- async disable() {
1858
- this.store.state.isEnabled = false;
1859
- this.forceUpdate++;
1860
- }
1861
- async enable() {
1862
- this.store.state.isEnabled = true;
1863
- this.forceUpdate++;
1864
- }
1865
- async delete() {
1866
- this.store.delete();
1867
- }
1868
- async copy() {
1869
- this.store.copy();
1870
- }
1871
- async paste(x, y) {
1872
- this.store.paste(x, y);
1873
- }
1874
- async bringForward(object) {
1875
- this.store.bringForward(object);
1876
- }
1877
- async sendBackward(object) {
1878
- this.store.sendBackward(object);
1879
- }
1880
- async moveToTop(object) {
1881
- this.store.bringToFront(object);
1882
- }
1883
- async moveToBottom(object) {
1884
- this.store.sendToBack(object);
1885
- }
1886
- async undo() {
1887
- this.store.history.undo();
1888
- }
1889
- async redo() {
1890
- this.store.history.redo();
1891
- }
1892
- async hideContextMenu() {
1893
- this.store.state.pointers.clear();
1894
- this.store.state.isContextMenuVisible = false;
1895
- this.store.state.selectionBox = null;
1896
- this.store.state.isSelecting = false;
1897
- }
1898
- async getObjectById(id) {
1899
- const object = this.store.objects.find(obj => obj.id === id);
1900
- return object || null;
1901
- }
1902
- async addObject(object) {
1903
- this.store.deselectAllObjects();
1904
- object.id = object.generateId();
1905
- object._store = this.store;
1906
- object.scale = object.scale ? object.scale : this.store.state.scale;
1907
- object.zIndex = this.store.currentZIndex;
1908
- const command = new AddObjectCommand(this.store, this, object);
1909
- this.store.history.executeCommand(command);
1910
- return object;
1911
- }
1912
- async updateObject(object, updatedProperties) {
1913
- this.store.deselectAllObjects();
1914
- const command = new UpdateObjectCommand(this.store, this, object, updatedProperties);
1915
- this.store.history.executeCommand(command);
1916
- return object;
1917
- }
1918
- async removeObject(object) {
1919
- this.store.deselectAllObjects();
1920
- const command = new RemoveObjectCommand(this.store, this, object);
1921
- this.store.history.executeCommand(command);
1922
- return object;
1923
- }
1924
- async getSelectedObjects() {
1925
- return this.store.state.selectionGroup ? this.store.state.selectionGroup.objects : [];
1926
- }
1927
- async selectObjects(objects) {
1928
- var _a;
1929
- (_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
1930
- this.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
1931
- this.store.deselectAllObjects();
1932
- this.store.selectObjects(objects);
1933
- console.log('Selected objects:', objects);
1934
- }
1935
- async selectAllObjectsInViewport() {
1936
- var _a;
1937
- (_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
1938
- this.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
1939
- this.store.deselectAllObjects();
1940
- this.store.selectAllObjectsInViewport();
1941
- }
1942
- async clearSelection() {
1943
- this.store.clearSelection();
1944
- }
1945
- async centerObjectInViewport(object) {
1946
- object.centerInViewport();
1947
- const command = new UpdateObjectCommand(this.store, this, object, object);
1948
- this.store.history.executeCommand(command);
1949
- return object;
1950
- }
1951
- async getCopiedObjects() {
1952
- var _a;
1953
- return ((_a = this.store.state.copiedObjects) === null || _a === void 0 ? void 0 : _a.objects) || [];
1954
- }
1955
- _registerStateChangeListeners() {
1956
- this.store.onStateChange('activeTool', this._handleActiveToolChange.bind(this));
1957
- this.store.onStateChange('isFocused', this._handleIsFocusedChange.bind(this));
1958
- }
1959
- _handleActiveToolChange(activeTool) {
1960
- if (!(activeTool instanceof KritzelSelectionTool)) {
1961
- this.store.clearSelection();
1962
- }
1963
- this.store.state.skipContextMenu = false;
1964
- this.activeToolChange.emit(activeTool);
1965
- KritzelKeyboardHelper.forceHideKeyboard();
1966
- }
1967
- _handleIsFocusedChange(isFocused) {
1968
- if (!isFocused) {
1969
- this.store.resetActiveText();
1970
- }
1971
- }
1972
- render() {
1973
- 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;
1974
- const computedStyle = window.getComputedStyle(this.host);
1975
- const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
1976
- const baseHandleSize = parseFloat(baseHandleSizePx);
1977
- const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
1978
- return (h(Host, { key: 'a8e6c284c98509ddd158686887d656d3907d40a2' }, h("div", { key: '3935b658e8859f746a5faef0bb91a527b68fcd3e', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, h("div", { key: '12c190c7ea99ac69310b27e719e7df8392b2b46e' }, "TranslateX: ", (_a = this.store.state) === null || _a === void 0 ? void 0 :
1979
- _a.translateX), h("div", { key: '4c98deccc2a029dab06ed76e5af426f4a05c7b66' }, "TranslateY: ", (_b = this.store.state) === null || _b === void 0 ? void 0 :
1980
- _b.translateY), h("div", { key: '1330191a39c7795f17a6adcc4fbd05e2d6a24d43' }, "ViewportWidth: ", (_c = this.store.state) === null || _c === void 0 ? void 0 :
1981
- _c.viewportWidth), h("div", { key: '1ee59427037357ee6bf746a094285426eb0e6a58' }, "ViewportHeight: ", (_d = this.store.state) === null || _d === void 0 ? void 0 :
1982
- _d.viewportHeight), h("div", { key: '1e68312e8516f25dcff34e9f9f70b90f426b8711' }, "ObjectsInViewport. ", this.store.objects.length), h("div", { key: '1d7cea9e21d9b744d8eaac29286528829143b4fa' }, "Scale: ", (_e = this.store.state) === null || _e === void 0 ? void 0 :
1983
- _e.scale), h("div", { key: '0b60168fbd55aefa3714067bace80f167b8bcac0' }, "ActiveTool: ", (_g = (_f = this.store.state) === null || _f === void 0 ? void 0 : _f.activeTool) === null || _g === void 0 ? void 0 :
1984
- _g.name), h("div", { key: '109752df6a77633d89929f325d296f96d27d7aa9' }, "HasViewportChanged: ", ((_h = this.store.state) === null || _h === void 0 ? void 0 : _h.hasViewportChanged) ? 'true' : 'false'), h("div", { key: 'b35466caf465b490c5d448d694353186ff902f09' }, "IsEnabled: ", ((_j = this.store.state) === null || _j === void 0 ? void 0 : _j.isEnabled) ? 'true' : 'false'), h("div", { key: '5df20e47f3bf234f04eea001b0a0abaf57946498' }, "IsScaling: ", ((_k = this.store.state) === null || _k === void 0 ? void 0 : _k.isScaling) ? 'true' : 'false'), h("div", { key: '9d1ec8b8268488821a968e109fa279393977fdf8' }, "IsPanning: ", ((_l = this.store.state) === null || _l === void 0 ? void 0 : _l.isPanning) ? 'true' : 'false'), h("div", { key: '92fa98b7fa3bf877c4fffaca70683d2d908f5177' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), h("div", { key: '708d02459c1e3907dd88a2f2fd8916c1ee684cf1' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), h("div", { key: '27f45c1b6ee0b6bd0b3301a9c09b9198de722ac4' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), h("div", { key: '50d4476aecfc00d12bae7d8a3880ccb8de82fe68' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), h("div", { key: '0c582e97ee1535b4a14b75b7ef15373c43f21c4b' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), h("div", { key: '7a8378ac991d17d0eaaba5fbd519875197903a39' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), h("div", { key: '00b56f11ffd16f7b9049d2857f5f7effceba1294' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), h("div", { key: '3b7773194bd6bc8b8b2d024afc768f4e9fbb54c6' }, "PointerX: ", (_m = this.store.state) === null || _m === void 0 ? void 0 :
1985
- _m.pointerX), h("div", { key: 'a2b2c96f6180591082a5aee20cc3e82236dac520' }, "PointerY: ", (_o = this.store.state) === null || _o === void 0 ? void 0 :
1986
- _o.pointerY)), h("div", { key: '309eb61fff5182b5076cb3886bbd79006efc30b1', id: "origin", class: "origin", style: {
1987
- transform: `matrix(${(_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale}, 0, 0, ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale}, ${(_r = this.store.state) === null || _r === void 0 ? void 0 : _r.translateX}, ${(_s = this.store.state) === null || _s === void 0 ? void 0 : _s.translateY})`,
1988
- } }, (_t = this.store.objects) === null || _t === void 0 ? void 0 :
1989
- _t.map(object => {
1990
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1991
- 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: {
1992
- height: object === null || object === void 0 ? void 0 : object.totalHeight.toString(),
1993
- width: object === null || object === void 0 ? void 0 : object.totalWidth.toString(),
1994
- left: '0',
1995
- top: '0',
1996
- position: 'absolute',
1997
- transform: `rotate(${object.rotationDegrees}deg)`,
1998
- transformOrigin: 'center',
1999
- opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
2000
- pointerEvents: object.markedForRemoval ? 'none' : 'auto',
2001
- } }, h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
2002
- minHeight: '0',
2003
- minWidth: '0',
2004
- backgroundColor: object.backgroundColor,
2005
- borderColor: object.borderColor,
2006
- borderWidth: object.borderWidth + 'px',
2007
- borderStyle: 'solid',
2008
- padding: object.padding + 'px',
2009
- overflow: 'visible',
2010
- } }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (h("svg", { ref: el => el ? object.mount(el) : object.unmount(), xmlns: "http://www.w3.org/2000/svg", style: {
2011
- height: object === null || object === void 0 ? void 0 : object.height.toString(),
2012
- width: object === null || object === void 0 ? void 0 : object.width.toString(),
2013
- position: 'absolute',
2014
- overflow: 'visible',
2015
- }, 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: {
2016
- width: '100%',
2017
- height: '100%',
2018
- userSelect: 'none',
2019
- pointerEvents: 'none',
2020
- }, 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: {
2021
- width: '100%',
2022
- height: '100%',
2023
- color: object.fontColor,
2024
- fontSize: ((_a = object.fontSize) === null || _a === void 0 ? void 0 : _a.toString()) + 'px',
2025
- fontFamily: object.fontFamily,
2026
- border: 'none',
2027
- outline: 'none',
2028
- resize: 'none',
2029
- overflow: 'hidden',
2030
- display: 'block',
2031
- padding: '1px',
2032
- whiteSpace: 'nowrap',
2033
- pointerEvents: object.isReadonly ? 'none' : 'auto',
2034
- cursor: object.isReadonly ? 'default' : 'text',
2035
- caretColor: object.isReadonly ? 'transparent' : 'auto',
2036
- } })), KritzelClassHelper.isInstanceOf(object, 'KritzelCustomElement') && (h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
2037
- width: '100%',
2038
- height: '100%',
2039
- pointerEvents: 'auto',
2040
- overflow: 'hidden',
2041
- display: 'block',
2042
- } })), KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') && (h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
2043
- width: '100%',
2044
- height: '100%',
2045
- } })), KritzelClassHelper.isInstanceOf(object, 'KrtizelSelectionBox') && (h("div", { ref: el => el ? object.mount(el) : object.unmount(), style: {
2046
- width: '100%',
2047
- height: '100%',
2048
- } }))), h("line", { x1: "0", y1: "0", x2: object.totalWidth, y2: "0", style: {
2049
- stroke: 'var(--kritzel-selection-border-color, #007AFF)',
2050
- strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_b = this.store.state) === null || _b === void 0 ? void 0 : _b.scale})`,
2051
- strokeLinecap: 'square',
2052
- }, visibility: object.isSelected ? 'visible' : 'hidden' }), h("line", { x1: "0", y1: "0", x2: "0", y2: object.totalHeight, style: {
2053
- stroke: 'var(--kritzel-selection-border-color, #007AFF)',
2054
- strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_c = this.store.state) === null || _c === void 0 ? void 0 : _c.scale})`,
2055
- strokeLinecap: 'square',
2056
- }, visibility: object.isSelected ? 'visible' : 'hidden' }), h("line", { x1: "0", y1: object.totalHeight, x2: object.totalWidth, y2: object.totalHeight, style: {
2057
- stroke: 'var(--kritzel-selection-border-color, #007AFF)',
2058
- strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_d = this.store.state) === null || _d === void 0 ? void 0 : _d.scale})`,
2059
- strokeLinecap: 'square',
2060
- }, visibility: object.isSelected ? 'visible' : 'hidden' }), h("line", { x1: object.totalWidth, y1: "0", x2: object.totalWidth, y2: object.totalHeight, style: {
2061
- stroke: 'var(--kritzel-selection-border-color, #007AFF)',
2062
- strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_e = this.store.state) === null || _e === void 0 ? void 0 : _e.scale})`,
2063
- strokeLinecap: 'square',
2064
- }, 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: {
2065
- fill: 'var(--kritzel-selection-handle-color, #000000)',
2066
- }, 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: {
2067
- fill: 'transparent',
2068
- }, 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: {
2069
- fill: 'var(--kritzel-selection-handle-color, #000000)',
2070
- }, 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: {
2071
- fill: 'transparent',
2072
- }, 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: {
2073
- fill: 'var(--kritzel-selection-handle-color, #000000)',
2074
- }, 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: {
2075
- fill: 'transparent',
2076
- }, 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: {
2077
- fill: 'var(--kritzel-selection-handle-color, #000000)',
2078
- }, 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: {
2079
- fill: 'transparent',
2080
- }, 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: {
2081
- stroke: 'var(--kritzel-selection-border-color, #007AFF)',
2082
- strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale})`,
2083
- }, 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: {
2084
- fill: 'var(--kritzel-selection-handle-color, #000000)',
2085
- }, 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: {
2086
- fill: 'transparent',
2087
- cursor: 'grab',
2088
- }, 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)))))));
2089
- }), h("svg", { key: 'c40c470ce1a341a6d238ea6c313bd3a78465dbd9', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
2090
- height: (_u = this.store.state.currentPath) === null || _u === void 0 ? void 0 : _u.height.toString(),
2091
- width: (_v = this.store.state.currentPath) === null || _v === void 0 ? void 0 : _v.width.toString(),
2092
- left: '0',
2093
- top: '0',
2094
- zIndex: (_w = this.store.state.currentPath) === null || _w === void 0 ? void 0 : _w.zIndex.toString(),
2095
- position: 'absolute',
2096
- transform: (_x = this.store.state.currentPath) === null || _x === void 0 ? void 0 : _x.transformationMatrix,
2097
- transformOrigin: 'top left',
2098
- overflow: 'visible',
2099
- }, viewBox: (_y = this.store.state.currentPath) === null || _y === void 0 ? void 0 : _y.viewBox }, h("path", { key: 'f2d62173bc61abf639e356520419b50c0493f34b', d: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.d, fill: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.fill, stroke: (_1 = this.store.state.currentPath) === null || _1 === void 0 ? void 0 : _1.stroke }))), this.store.state.isContextMenuVisible && (h("kritzel-context-menu", { key: 'ad36d2e5eb72e2cbca73c48ef8a4db6d3b6f7a64', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, objects: ((_2 = this.store.state.selectionGroup) === null || _2 === void 0 ? void 0 : _2.objects) || [], style: {
2100
- position: 'fixed',
2101
- left: `${this.store.state.contextMenuX}px`,
2102
- top: `${this.store.state.contextMenuY}px`,
2103
- zIndex: '10000',
2104
- }, onActionSelected: event => {
2105
- var _a;
2106
- event.detail.action({
2107
- x: (-this.store.state.translateX + this.store.state.contextMenuX) / this.store.state.scale,
2108
- y: (-this.store.state.translateY + this.store.state.contextMenuY) / this.store.state.scale,
2109
- }, (_a = this.store.state.selectionGroup) === null || _a === void 0 ? void 0 : _a.objects);
2110
- this.hideContextMenu();
2111
- } })), ((_3 = this.store.state) === null || _3 === void 0 ? void 0 : _3.activeTool) instanceof KritzelEraserTool && !this.store.state.isScaling && h("kritzel-cursor-trail", { key: '6917e2621b4de0b0985e58a6043898d79e367ccc', store: this.store })));
2112
- }
2113
- get host() { return getElement(this); }
2114
- static get watchers() { return {
2115
- "scaleMax": ["validateScaleMax"],
2116
- "scaleMin": ["validateScaleMin"]
2117
- }; }
2118
- };
2119
- KritzelEngine.style = kritzelEngineCss;
2120
-
2121
- const kritzelFontCss = ":host{display:block}.font-preview{color:var(--kritzel-font-size-text-color, #333333);line-height:1;text-align:center;font-weight:bold}";
2122
-
2123
- const KritzelFont = class {
2124
- constructor(hostRef) {
2125
- registerInstance(this, hostRef);
2126
- this.fontFamily = 'Arial, sans-serif';
2127
- this.size = 24;
2128
- this.color = '#000000';
2129
- }
2130
- render() {
2131
- return (h(Host, { key: 'd0378237899c5641ae4354f3bffb14e3f8bafb59' }, h("div", { key: '1475a6ae39ffc97eb780b30c85015c22cecafa6e', class: "font-preview", style: {
2132
- fontFamily: this.fontFamily,
2133
- fontSize: `${this.size}px`,
2134
- color: this.color
2135
- } }, "A")));
2136
- }
2137
- };
2138
- KritzelFont.style = kritzelFontCss;
2139
-
2140
- const kritzelFontFamilyCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box;width:100%}.font-style-button{display:flex;justify-content:center;align-items:center;width:42px;height:32px;padding:0;border:none;outline:none;background:none;cursor:pointer;border-radius:0;color:var(--control-text-color);font-weight:bold;-webkit-tap-highlight-color:transparent}.font-style-button:not(:last-child){border-right:1px solid #333333}.font-style-button:hover{background-color:var(--control-hover-bg)}.font-style-button:active{background-color:var(--control-active-bg)}.font-style-button.selected,.font-style-button.selected:hover,.font-style-button.selected:active{background-color:var(--control-selected-bg);color:var(--control-selected-color)}.font-style-button.italic-text{font-style:italic}";
2141
-
2142
- const KritzelFontFamily = class {
2143
- constructor(hostRef) {
2144
- registerInstance(this, hostRef);
2145
- this.fontFamilyChange = createEvent(this, "fontFamilyChange");
2146
- this.fontOptions = [
2147
- { value: 'arial', label: 'Arial' },
2148
- { value: 'verdana', label: 'Verdana' },
2149
- { value: 'helvetica', label: 'Helvetica' },
2150
- { value: 'tahoma', label: 'Tahoma' },
2151
- { value: 'trebuchet ms', label: 'Trebuchet MS' },
2152
- { value: 'times new roman', label: 'Times New Roman' },
2153
- { value: 'georgia', label: 'Georgia' },
2154
- { value: 'garamond', label: 'Garamond' },
2155
- { value: 'courier new', label: 'Courier New' },
2156
- { value: 'brush script mt', label: 'Brush Script MT' },
2157
- ];
2158
- this.handleDropdownValueChange = (event) => {
2159
- this.fontFamilyChange.emit(event.detail);
2160
- };
2161
- }
2162
- componentWillLoad() {
2163
- if (this.fontOptions && this.fontOptions.length > 0) {
2164
- const isValidCurrentFont = this.fontOptions.some(opt => opt.value === this.selectedFontFamily);
2165
- if (!this.selectedFontFamily || !isValidCurrentFont) {
2166
- this.selectedFontFamily = this.fontOptions[0].value;
2167
- }
2168
- }
2169
- }
2170
- render() {
2171
- const dropdownOptions = this.fontOptions.map(option => ({
2172
- value: option.value,
2173
- label: option.label,
2174
- style: { fontFamily: option.value },
2175
- }));
2176
- return (h(Host, { key: 'f420ff18156d54bfc475148a7d9aae0f1441408c' }, h("kritzel-dropdown", { key: '6b54fb8265a0eb59a6a681c6a2b7a95fb222671c', options: dropdownOptions, value: this.selectedFontFamily, onValueChanged: this.handleDropdownValueChange, selectStyles: { fontFamily: this.selectedFontFamily } }, h("button", { key: 'b853c75a425c7baafa7a8e749c90c0b08884375c', class: "font-style-button", slot: "suffix" }, "B"), h("button", { key: '68dea850dd1d1f38db727d8be0eec3481890c571', class: "font-style-button italic-text", slot: "suffix" }, "I"))));
2177
- }
2178
- };
2179
- KritzelFontFamily.style = kritzelFontFamilyCss;
2180
-
2181
- const kritzelFontSizeCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box}.size-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:4px;cursor:pointer;border:2px solid transparent;box-sizing:border-box;border-radius:50%}.size-container:hover{background-color:var(--kritzel-font-size-hover-background-color, #f0f0f0)}.size-container.selected{border-color:var(--kritzel-selection-border-color, #007AFF);background-color:var(--kritzel-font-size-selected-background-color, #e0e0e0)}";
2182
-
2183
- const KritzelFontSize = class {
2184
- constructor(hostRef) {
2185
- registerInstance(this, hostRef);
2186
- this.sizeChange = createEvent(this, "sizeChange");
2187
- this.sizes = [8, 10, 12, 16, 20, 24];
2188
- this.selectedSize = null;
2189
- this.fontFamily = 'Arial';
2190
- }
2191
- handleSizeClick(size) {
2192
- this.selectedSize = size;
2193
- this.sizeChange.emit(size);
2194
- }
2195
- render() {
2196
- return (h(Host, { key: '1c09a403f1e8278d30b2675c3a6e17e12ec79afa' }, this.sizes.map(size => (h("div", { class: {
2197
- 'size-container': true,
2198
- 'selected': this.selectedSize === size,
2199
- }, onClick: () => this.handleSizeClick(size) }, h("kritzel-font", { fontFamily: this.fontFamily, size: size }))))));
2200
- }
2201
- };
2202
- KritzelFontSize.style = kritzelFontSizeCss;
2203
-
2204
- const kritzelIconCss = ":host{display:inline-flex;justify-content:center;align-items:center;}span{display:flex;align-items:center;width:100%;height:100%;}span>svg{width:100%;height:100%}";
2205
-
2206
- const KritzelIcon = class {
2207
- constructor(hostRef) {
2208
- registerInstance(this, hostRef);
2209
- this.size = 24;
2210
- }
2211
- render() {
2212
- const svgContent = KritzelIconRegistry.get(this.name);
2213
- if (!svgContent) {
2214
- console.error(`[kritzel-icon] Icon "${this.name}" not found in registry.`);
2215
- return h("span", { class: "error-icon", "aria-label": `Error: Icon ${this.name} not found` }, "?");
2216
- }
2217
- const styles = {
2218
- width: `${this.size}px`,
2219
- height: `${this.size}px`,
2220
- };
2221
- return (h(Host, { style: styles }, h("span", { "aria-hidden": !this.label, role: this.label ? 'img' : undefined, "aria-label": this.label, innerHTML: svgContent })));
2222
- }
2223
- };
2224
- KritzelIcon.style = kritzelIconCss;
2225
-
2226
- const kritzelStrokeSizeCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box}.size-container{display:flex;justify-content:center;align-items:center;width:32px;height:32px;border-radius:50%;cursor:pointer;border:2px solid transparent;box-sizing:border-box}.size-container:hover{background-color:var(--kritzel-stroke-size-hover-background-color, #f0f0f0)}.size-container.selected{border-color:var(--kritzel-selection-border-color, #007AFF);background-color:var(--kritzel-stroke-size-selected-background-color, #f0f0f0)}";
2227
-
2228
- const KritzelStrokeSize = class {
2229
- constructor(hostRef) {
2230
- registerInstance(this, hostRef);
2231
- this.sizeChange = createEvent(this, "sizeChange");
2232
- this.sizes = [4, 6, 8, 12, 16, 24];
2233
- this.selectedSize = null;
2234
- }
2235
- handleSizeClick(size) {
2236
- this.selectedSize = size;
2237
- this.sizeChange.emit(size);
2238
- }
2239
- render() {
2240
- return (h(Host, { key: '2e2a4d38920e25e1e60788deabe4912b510d0b10' }, this.sizes.map(size => (h("div", { class: {
2241
- 'size-container': true,
2242
- 'selected': this.selectedSize === size,
2243
- }, onClick: () => this.handleSizeClick(size) }, h("kritzel-color", { value: '#000000', size: size }))))));
2244
- }
2245
- };
2246
- KritzelStrokeSize.style = kritzelStrokeSizeCss;
2247
-
2248
- const kritzelTooltipCss = ":host{width:auto}.tooltip-content{position:relative;padding:8px 12px;border-radius:4px;width:fit-content;background-color:var(--kritzel-controls-tooltip-background-color, #ffffff);color:var(--kritzel-controls-tooltip-color, #000000);padding:var(--kritzel-controls-tooltip-padding, 8px);border-radius:var(--kritzel-controls-tooltip-border-radius, 16px);white-space:nowrap;box-shadow:var(--kritzel-controls-tooltip-box-shadow, 0 1px 6px rgba(0, 0, 0, 0.12))}";
2249
-
2250
- const MOBILE_BREAKPOINT = 768;
2251
- const KritzelTooltip = class {
2252
- constructor(hostRef) {
2253
- registerInstance(this, hostRef);
2254
- this.isVisible = false;
2255
- this.arrowSize = 8;
2256
- this.offsetY = 24;
2257
- this.positionX = 0;
2258
- this.arrowOffset = '0px';
2259
- this.isMobileView = window.innerWidth < MOBILE_BREAKPOINT;
2260
- }
2261
- handleWindowResize() {
2262
- this.isMobileView = window.innerWidth < MOBILE_BREAKPOINT;
2263
- this.calculateAdjustedPosition();
2264
- }
2265
- componentWillLoad() {
2266
- this.isMobileView = window.innerWidth < MOBILE_BREAKPOINT;
2267
- this.calculateAdjustedPosition();
2268
- }
2269
- componentWillUpdate() {
2270
- this.calculateAdjustedPosition();
2271
- }
2272
- calculateAdjustedPosition() {
2273
- var _a;
2274
- if (this.isVisible && this.anchorElement) {
2275
- const anchorRect = this.anchorElement.getBoundingClientRect();
2276
- const tooltipContent = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.tooltip-content');
2277
- if (!this.isMobileView) {
2278
- this.positionX = anchorRect.left + anchorRect.width / 2;
2279
- this.arrowOffset = `calc(${50}% - ${this.arrowSize}px)`;
2280
- }
2281
- else {
2282
- const tooltipRect = tooltipContent.getBoundingClientRect();
2283
- this.positionX = anchorRect.left + anchorRect.width / 2 - tooltipRect.width / 2;
2284
- this.arrowOffset = `${anchorRect.left + anchorRect.width / 2 - tooltipRect.left - this.arrowSize}px`;
2285
- }
2286
- }
2287
- }
2288
- render() {
2289
- return (h(Host, { key: '3161826337f6957d2e568f52cfe3f57d705af0ed', style: {
2290
- position: 'fixed',
2291
- zIndex: '9999',
2292
- transition: 'opacity 0.3s ease-in-out, transform 0.3s ease-in-out',
2293
- visibility: this.isVisible ? 'visible' : 'hidden',
2294
- left: !this.isMobileView ? `${this.positionX}px` : '50%',
2295
- marginBottom: `${this.offsetY + this.arrowSize}px`,
2296
- } }, h("div", { key: '12fc4bc05b7be756102ce3779c9be1d51f3fe13b', class: "tooltip-content", onClick: event => event.stopPropagation() }, h("slot", { key: '90f645f8f7cec371aaeda7207a9fb420b02b2ae4' }), h("div", { key: '73380e2c6df22bc4a97479a52315e7b34d069fa1', class: "tooltip-arrow-wrapper", style: {
2297
- position: 'fixed',
2298
- left: this.arrowOffset,
2299
- bottom: `-${this.arrowSize * 2}px`,
2300
- } }, h("div", { key: '2e13cb01a3282e161d3212f4970a93b20ca1a0fe', class: "tooltip-arrow", style: {
2301
- borderLeft: `${this.arrowSize}px solid transparent`,
2302
- borderRight: `${this.arrowSize}px solid transparent`,
2303
- borderTop: `${this.arrowSize}px solid var(--kritzel-controls-tooltip-background-color, #ffffff)`,
2304
- filter: 'drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2))',
2305
- } }), h("div", { key: '30ddbd00b928c0c734656d6309eaefbae5baf264', class: "tooltip-arrow-rect", style: {
2306
- position: 'relative',
2307
- width: `${this.arrowSize * 2}px`,
2308
- height: `${this.arrowSize}px`,
2309
- backgroundColor: 'var(--kritzel-controls-tooltip-background-color, #ffffff)',
2310
- bottom: `${this.arrowSize * 2}px`,
2311
- } })))));
2312
- }
2313
- get el() { return getElement(this); }
2314
- };
2315
- KritzelTooltip.style = kritzelTooltipCss;
2316
-
2317
- const kritzelUtilityPanelCss = ":host{display:flex;flex-direction:row;align-items:center;padding:4px;gap:8px;border-top-left-radius:12px;border-top-right-radius:12px;background-color:rgb(226, 226, 226);width:fit-content;user-select:none}.utility-button{display:flex;justify-content:center;align-items:center;width:28px;height:28px;padding:8px 4px;border:none;outline:none;background:none;cursor:pointer;color:#333333;-webkit-tap-highlight-color:transparent}.utility-separator{width:1px;height:16px;background-color:hsl(0, 0%, 0%, 4.3%)}";
2318
-
2319
- const KritzelUtilityPanel = class {
2320
- constructor(hostRef) {
2321
- registerInstance(this, hostRef);
2322
- this.undo = createEvent(this, "undo");
2323
- this.redo = createEvent(this, "redo");
2324
- this.delete = createEvent(this, "delete");
2325
- }
2326
- handleUndo(event) {
2327
- if (event.cancelable) {
2328
- event.preventDefault();
2329
- event.stopPropagation();
2330
- this.undo.emit();
2331
- }
2332
- }
2333
- handleRedo(event) {
2334
- event.preventDefault();
2335
- event.stopPropagation();
2336
- this.redo.emit();
2337
- }
2338
- render() {
2339
- return (h(Host, { key: '496ed78323c9899ad363e7f7732a1464d99e1b3b' }, h("button", { key: '7b6b9cd238a8d254f032d5752f184d567e9a3096', class: "utility-button", onClick: event => this.handleUndo(event) }, h("kritzel-icon", { key: '8ac19f36c6b82f7cc4a0249e60cf429f75c09218', name: "undo" })), h("button", { key: '1164727510a968356042507c1e302b85a135baf8', class: "utility-button", onClick: event => this.handleRedo(event) }, h("kritzel-icon", { key: '1c6cc414d5841a06853f99316eee7a0a609d5c92', name: "redo" })), h("div", { key: 'e6f3342569b1c6b5a6b267cc215bc8e5d259e302', class: "utility-separator" }), h("button", { key: '0aa486a543df924c224f3637857cdcdb06f995ea', class: "utility-button" }, h("kritzel-icon", { key: '9ee324e03f5df5297916549743539f7f19950768', name: "delete", onClick: () => this.delete.emit() }))));
2340
- }
2341
- };
2342
- KritzelUtilityPanel.style = kritzelUtilityPanelCss;
2343
-
2344
- export { KritzelBrushStyle as kritzel_brush_style, KritzelColor as kritzel_color, KritzelColorPalette as kritzel_color_palette, KritzelContextMenu as kritzel_context_menu, KritzelControlBrushConfig as kritzel_control_brush_config, KritzelControlTextConfig as kritzel_control_text_config, KritzelControls as kritzel_controls, KritzelCursorTrail as kritzel_cursor_trail, KritzelDropdown as kritzel_dropdown, KritzelEditor as kritzel_editor, KritzelEngine as kritzel_engine, KritzelFont as kritzel_font, KritzelFontFamily as kritzel_font_family, KritzelFontSize as kritzel_font_size, KritzelIcon as kritzel_icon, KritzelStrokeSize as kritzel_stroke_size, KritzelTooltip as kritzel_tooltip, KritzelUtilityPanel as kritzel_utility_panel };
2345
- //# sourceMappingURL=kritzel-brush-style.kritzel-color.kritzel-color-palette.kritzel-context-menu.kritzel-control-brush-config.kritzel-control-text-config.kritzel-controls.kritzel-cursor-trail.kritzel-dropdown.kritzel-editor.kritzel-engine.kritzel-font.kritzel-font-family.kritzel-font-size.kritzel-icon.kritzel-stroke-size.kritzel-tooltip.kritzel-utility-panel.entry.js.map
2346
-
2347
- //# sourceMappingURL=kritzel-brush-style_18.entry.js.map