@nice2dev/ui-graphics 1.1.0 → 1.1.1

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 (391) hide show
  1. package/dist/cjs/animation/AnimatedPerson.js +69 -63
  2. package/dist/cjs/animation/AnimatedPerson.js.map +1 -1
  3. package/dist/cjs/animation/AnimationEditor.js +27 -20
  4. package/dist/cjs/animation/AnimationEditor.js.map +1 -1
  5. package/dist/cjs/animation/Audience.js +17 -11
  6. package/dist/cjs/animation/Audience.js.map +1 -1
  7. package/dist/cjs/animation/BodyRenderer.js +7 -7
  8. package/dist/cjs/animation/BodyRenderer.js.map +1 -1
  9. package/dist/cjs/animation/animationHelper.js +83 -52
  10. package/dist/cjs/animation/animationHelper.js.map +1 -1
  11. package/dist/cjs/animation/characterTypes.js +171 -30
  12. package/dist/cjs/animation/characterTypes.js.map +1 -1
  13. package/dist/cjs/animation/choreoDSL.js +114 -62
  14. package/dist/cjs/animation/choreoDSL.js.map +1 -1
  15. package/dist/cjs/animation/karaokeIntegration.js +10 -11
  16. package/dist/cjs/animation/karaokeIntegration.js.map +1 -1
  17. package/dist/cjs/animation/lottieExport.js +15 -9
  18. package/dist/cjs/animation/lottieExport.js.map +1 -1
  19. package/dist/cjs/animation/motionPath.js +125 -30
  20. package/dist/cjs/animation/motionPath.js.map +1 -1
  21. package/dist/cjs/animation/physics.js +157 -57
  22. package/dist/cjs/animation/physics.js.map +1 -1
  23. package/dist/cjs/animation/rig/RigPlayer.js +7 -6
  24. package/dist/cjs/animation/rig/RigPlayer.js.map +1 -1
  25. package/dist/cjs/animation/rig/RiggedBody.js +7 -7
  26. package/dist/cjs/animation/rig/RiggedBody.js.map +1 -1
  27. package/dist/cjs/animation/rig/choreoRigBridge.js +52 -29
  28. package/dist/cjs/animation/rig/choreoRigBridge.js.map +1 -1
  29. package/dist/cjs/animation/rig/poseOps.js +6 -3
  30. package/dist/cjs/animation/rig/poseOps.js.map +1 -1
  31. package/dist/cjs/animation/shapes/arms.js +7 -6
  32. package/dist/cjs/animation/shapes/arms.js.map +1 -1
  33. package/dist/cjs/animation/shapes/eyes.js +31 -18
  34. package/dist/cjs/animation/shapes/eyes.js.map +1 -1
  35. package/dist/cjs/animation/shapes/hair.js +39 -23
  36. package/dist/cjs/animation/shapes/hair.js.map +1 -1
  37. package/dist/cjs/animation/shapes/heads.js +47 -29
  38. package/dist/cjs/animation/shapes/heads.js.map +1 -1
  39. package/dist/cjs/animation/shapes/headwear.js +26 -14
  40. package/dist/cjs/animation/shapes/headwear.js.map +1 -1
  41. package/dist/cjs/animation/shapes/legs.js +7 -6
  42. package/dist/cjs/animation/shapes/legs.js.map +1 -1
  43. package/dist/cjs/animation/shapes/mouths.js +28 -18
  44. package/dist/cjs/animation/shapes/mouths.js.map +1 -1
  45. package/dist/cjs/animation/shapes/noses.js +18 -9
  46. package/dist/cjs/animation/shapes/noses.js.map +1 -1
  47. package/dist/cjs/animation/shapes/outfits.js +25 -14
  48. package/dist/cjs/animation/shapes/outfits.js.map +1 -1
  49. package/dist/cjs/animation/shapes/torsos.js +5 -4
  50. package/dist/cjs/animation/shapes/torsos.js.map +1 -1
  51. package/dist/cjs/animation/spineExport.js +33 -26
  52. package/dist/cjs/animation/spineExport.js.map +1 -1
  53. package/dist/cjs/core/LocalUI.js +16 -16
  54. package/dist/cjs/core/LocalUI.js.map +1 -1
  55. package/dist/cjs/core/NiceBrushEngine.js +205 -69
  56. package/dist/cjs/core/NiceBrushEngine.js.map +1 -1
  57. package/dist/cjs/core/collaboration.js +35 -21
  58. package/dist/cjs/core/collaboration.js.map +1 -1
  59. package/dist/cjs/core/colorBlindness.js +64 -24
  60. package/dist/cjs/core/colorBlindness.js.map +1 -1
  61. package/dist/cjs/core/dragDrop.js +34 -26
  62. package/dist/cjs/core/dragDrop.js.map +1 -1
  63. package/dist/cjs/core/fixes.js +26 -14
  64. package/dist/cjs/core/fixes.js.map +1 -1
  65. package/dist/cjs/core/gridGuides.js +24 -16
  66. package/dist/cjs/core/gridGuides.js.map +1 -1
  67. package/dist/cjs/core/historyVisual.js +42 -23
  68. package/dist/cjs/core/historyVisual.js.map +1 -1
  69. package/dist/cjs/core/integrations.js +65 -48
  70. package/dist/cjs/core/integrations.js.map +1 -1
  71. package/dist/cjs/core/minimap.js +40 -24
  72. package/dist/cjs/core/minimap.js.map +1 -1
  73. package/dist/cjs/core/plugins.js +10 -6
  74. package/dist/cjs/core/plugins.js.map +1 -1
  75. package/dist/cjs/core/rtl.js +32 -27
  76. package/dist/cjs/core/rtl.js.map +1 -1
  77. package/dist/cjs/core/shortcuts.js +77 -39
  78. package/dist/cjs/core/shortcuts.js.map +1 -1
  79. package/dist/cjs/core/theme.js +68 -61
  80. package/dist/cjs/core/theme.js.map +1 -1
  81. package/dist/cjs/core/yjsCollaboration.js +61 -28
  82. package/dist/cjs/core/yjsCollaboration.js.map +1 -1
  83. package/dist/cjs/font/NiceFontEditor.js +160 -57
  84. package/dist/cjs/font/NiceFontEditor.js.map +1 -1
  85. package/dist/cjs/font/fontFormatUtils.js +37 -24
  86. package/dist/cjs/font/fontFormatUtils.js.map +1 -1
  87. package/dist/cjs/game/GameAsset2dEditor.js +73 -60
  88. package/dist/cjs/game/GameAsset2dEditor.js.map +1 -1
  89. package/dist/cjs/game/gameAssetUtils.js +18 -13
  90. package/dist/cjs/game/gameAssetUtils.js.map +1 -1
  91. package/dist/cjs/game/useGameAssetEditor.js +160 -143
  92. package/dist/cjs/game/useGameAssetEditor.js.map +1 -1
  93. package/dist/cjs/icon/NiceIconEditor.js +329 -106
  94. package/dist/cjs/icon/NiceIconEditor.js.map +1 -1
  95. package/dist/cjs/packages/ui/dist/NiceErrorBoundary-D75yr_WE.js +572 -0
  96. package/dist/cjs/packages/ui/dist/NiceErrorBoundary-D75yr_WE.js.map +1 -0
  97. package/dist/cjs/packages/ui/dist/NiceForm-CKoJA6NG.js +4979 -0
  98. package/dist/cjs/packages/ui/dist/NiceForm-CKoJA6NG.js.map +1 -0
  99. package/dist/cjs/packages/ui/dist/NiceModal-1QX7NhyH.js +98 -0
  100. package/dist/cjs/packages/ui/dist/NiceModal-1QX7NhyH.js.map +1 -0
  101. package/dist/cjs/packages/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js +5244 -0
  102. package/dist/cjs/packages/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js.map +1 -0
  103. package/dist/cjs/packages/ui/dist/NicePagination-DbE-uOkl.js +174 -0
  104. package/dist/cjs/packages/ui/dist/NicePagination-DbE-uOkl.js.map +1 -0
  105. package/dist/cjs/packages/ui/dist/NicePinCodeInput-B8cI8zu8.js +10459 -0
  106. package/dist/cjs/packages/ui/dist/NicePinCodeInput-B8cI8zu8.js.map +1 -0
  107. package/dist/cjs/packages/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js +6313 -0
  108. package/dist/cjs/packages/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js.map +1 -0
  109. package/dist/cjs/packages/ui/dist/NiceTabs-DzLHzwuA.js +1639 -0
  110. package/dist/cjs/packages/ui/dist/NiceTabs-DzLHzwuA.js.map +1 -0
  111. package/dist/cjs/packages/ui/dist/NiceWindow-DeC83yfE.js +807 -0
  112. package/dist/cjs/packages/ui/dist/NiceWindow-DeC83yfE.js.map +1 -0
  113. package/dist/cjs/packages/ui/dist/charts-BAS21jkC.js +3833 -0
  114. package/dist/cjs/packages/ui/dist/charts-BAS21jkC.js.map +1 -0
  115. package/dist/cjs/packages/ui/dist/core-Da43q-pO.js +11683 -0
  116. package/dist/cjs/packages/ui/dist/core-Da43q-pO.js.map +1 -0
  117. package/dist/cjs/packages/ui/dist/index-pAuGTbuB.js +28876 -0
  118. package/dist/cjs/packages/ui/dist/index-pAuGTbuB.js.map +1 -0
  119. package/dist/cjs/photo/FilterThumb.js +7 -5
  120. package/dist/cjs/photo/FilterThumb.js.map +1 -1
  121. package/dist/cjs/photo/NiceAITools.js +78 -32
  122. package/dist/cjs/photo/NiceAITools.js.map +1 -1
  123. package/dist/cjs/photo/PhotoEditor.js +4 -4
  124. package/dist/cjs/photo/PhotoEditor.js.map +1 -1
  125. package/dist/cjs/photo/PhotoEditorCanvas.js +56 -22
  126. package/dist/cjs/photo/PhotoEditorCanvas.js.map +1 -1
  127. package/dist/cjs/photo/PhotoEditorLeftPanel.js +106 -48
  128. package/dist/cjs/photo/PhotoEditorLeftPanel.js.map +1 -1
  129. package/dist/cjs/photo/PhotoEditorToolbar.js +2 -2
  130. package/dist/cjs/photo/PhotoEditorToolbar.js.map +1 -1
  131. package/dist/cjs/photo/photoEditorActions.js +27 -18
  132. package/dist/cjs/photo/photoEditorActions.js.map +1 -1
  133. package/dist/cjs/photo/photoFilters.js +316 -81
  134. package/dist/cjs/photo/photoFilters.js.map +1 -1
  135. package/dist/cjs/photo/photoOverlays.js +521 -165
  136. package/dist/cjs/photo/photoOverlays.js.map +1 -1
  137. package/dist/cjs/photo/photoSelection.js +69 -35
  138. package/dist/cjs/photo/photoSelection.js.map +1 -1
  139. package/dist/cjs/photo/usePhotoEditor.js +203 -97
  140. package/dist/cjs/photo/usePhotoEditor.js.map +1 -1
  141. package/dist/cjs/pixel/HSVPicker.js +32 -19
  142. package/dist/cjs/pixel/HSVPicker.js.map +1 -1
  143. package/dist/cjs/pixel/PixelEditor.js +25 -14
  144. package/dist/cjs/pixel/PixelEditor.js.map +1 -1
  145. package/dist/cjs/pixel/PixelEditorCanvas.js +2 -2
  146. package/dist/cjs/pixel/PixelEditorCanvas.js.map +1 -1
  147. package/dist/cjs/pixel/PixelEditorMenuBar.js +3 -3
  148. package/dist/cjs/pixel/PixelEditorMenuBar.js.map +1 -1
  149. package/dist/cjs/pixel/PixelEditorRightPanel.js +28 -8
  150. package/dist/cjs/pixel/PixelEditorRightPanel.js.map +1 -1
  151. package/dist/cjs/pixel/PixelEditorStatusBar.js +2 -2
  152. package/dist/cjs/pixel/PixelEditorStatusBar.js.map +1 -1
  153. package/dist/cjs/pixel/PixelEditorTimeline.js +3 -4
  154. package/dist/cjs/pixel/PixelEditorTimeline.js.map +1 -1
  155. package/dist/cjs/pixel/PixelEditorToolbar.js +3 -3
  156. package/dist/cjs/pixel/PixelEditorToolbar.js.map +1 -1
  157. package/dist/cjs/pixel/SpriteGeneratorPanel.js +136 -54
  158. package/dist/cjs/pixel/SpriteGeneratorPanel.js.map +1 -1
  159. package/dist/cjs/pixel/asepriteFormat.js +122 -38
  160. package/dist/cjs/pixel/asepriteFormat.js.map +1 -1
  161. package/dist/cjs/pixel/characterGeneratorPresets.js +208 -54
  162. package/dist/cjs/pixel/characterGeneratorPresets.js.map +1 -1
  163. package/dist/cjs/pixel/pixelEditorExports.js +42 -35
  164. package/dist/cjs/pixel/pixelEditorExports.js.map +1 -1
  165. package/dist/cjs/pixel/pixelEditorTypes.js +67 -33
  166. package/dist/cjs/pixel/pixelEditorTypes.js.map +1 -1
  167. package/dist/cjs/pixel/pixelEditorUtils.js +62 -38
  168. package/dist/cjs/pixel/pixelEditorUtils.js.map +1 -1
  169. package/dist/cjs/pixel/spriteGeneratorCore.js +47 -24
  170. package/dist/cjs/pixel/spriteGeneratorCore.js.map +1 -1
  171. package/dist/cjs/pixel/usePixelEditor.js +475 -213
  172. package/dist/cjs/pixel/usePixelEditor.js.map +1 -1
  173. package/dist/cjs/texture/Nice3DTexturePainter.js +201 -71
  174. package/dist/cjs/texture/Nice3DTexturePainter.js.map +1 -1
  175. package/dist/cjs/ui/NiceUIDesigner.js +280 -91
  176. package/dist/cjs/ui/NiceUIDesigner.js.map +1 -1
  177. package/dist/cjs/vector/NiceSvgToCode.js +96 -34
  178. package/dist/cjs/vector/NiceSvgToCode.js.map +1 -1
  179. package/dist/cjs/vector/VectorEditor.js +14 -13
  180. package/dist/cjs/vector/VectorEditor.js.map +1 -1
  181. package/dist/cjs/vector/VectorEditorMenuBar.js +7 -6
  182. package/dist/cjs/vector/VectorEditorMenuBar.js.map +1 -1
  183. package/dist/cjs/vector/VectorEditorRightPanel.js +87 -32
  184. package/dist/cjs/vector/VectorEditorRightPanel.js.map +1 -1
  185. package/dist/cjs/vector/VectorEditorShapeRenderer.js +17 -15
  186. package/dist/cjs/vector/VectorEditorShapeRenderer.js.map +1 -1
  187. package/dist/cjs/vector/VectorEditorStatusBar.js.map +1 -1
  188. package/dist/cjs/vector/useVectorEditor.js +312 -122
  189. package/dist/cjs/vector/useVectorEditor.js.map +1 -1
  190. package/dist/cjs/vector/vectorBooleanOps.js +60 -42
  191. package/dist/cjs/vector/vectorBooleanOps.js.map +1 -1
  192. package/dist/cjs/vector/vectorEditorExport.js +40 -34
  193. package/dist/cjs/vector/vectorEditorExport.js.map +1 -1
  194. package/dist/cjs/vector/vectorGradients.js +41 -40
  195. package/dist/cjs/vector/vectorGradients.js.map +1 -1
  196. package/dist/esm/animation/AnimatedPerson.js +69 -63
  197. package/dist/esm/animation/AnimatedPerson.js.map +1 -1
  198. package/dist/esm/animation/AnimationEditor.js +27 -20
  199. package/dist/esm/animation/AnimationEditor.js.map +1 -1
  200. package/dist/esm/animation/Audience.js +17 -11
  201. package/dist/esm/animation/Audience.js.map +1 -1
  202. package/dist/esm/animation/BodyRenderer.js +7 -7
  203. package/dist/esm/animation/BodyRenderer.js.map +1 -1
  204. package/dist/esm/animation/animationHelper.js +83 -52
  205. package/dist/esm/animation/animationHelper.js.map +1 -1
  206. package/dist/esm/animation/characterTypes.js +171 -30
  207. package/dist/esm/animation/characterTypes.js.map +1 -1
  208. package/dist/esm/animation/choreoDSL.js +114 -62
  209. package/dist/esm/animation/choreoDSL.js.map +1 -1
  210. package/dist/esm/animation/karaokeIntegration.js +10 -11
  211. package/dist/esm/animation/karaokeIntegration.js.map +1 -1
  212. package/dist/esm/animation/lottieExport.js +15 -9
  213. package/dist/esm/animation/lottieExport.js.map +1 -1
  214. package/dist/esm/animation/motionPath.js +125 -30
  215. package/dist/esm/animation/motionPath.js.map +1 -1
  216. package/dist/esm/animation/physics.js +157 -57
  217. package/dist/esm/animation/physics.js.map +1 -1
  218. package/dist/esm/animation/rig/RigPlayer.js +7 -6
  219. package/dist/esm/animation/rig/RigPlayer.js.map +1 -1
  220. package/dist/esm/animation/rig/RiggedBody.js +7 -7
  221. package/dist/esm/animation/rig/RiggedBody.js.map +1 -1
  222. package/dist/esm/animation/rig/choreoRigBridge.js +52 -29
  223. package/dist/esm/animation/rig/choreoRigBridge.js.map +1 -1
  224. package/dist/esm/animation/rig/poseOps.js +6 -3
  225. package/dist/esm/animation/rig/poseOps.js.map +1 -1
  226. package/dist/esm/animation/shapes/arms.js +7 -6
  227. package/dist/esm/animation/shapes/arms.js.map +1 -1
  228. package/dist/esm/animation/shapes/eyes.js +31 -18
  229. package/dist/esm/animation/shapes/eyes.js.map +1 -1
  230. package/dist/esm/animation/shapes/hair.js +39 -23
  231. package/dist/esm/animation/shapes/hair.js.map +1 -1
  232. package/dist/esm/animation/shapes/heads.js +47 -29
  233. package/dist/esm/animation/shapes/heads.js.map +1 -1
  234. package/dist/esm/animation/shapes/headwear.js +26 -14
  235. package/dist/esm/animation/shapes/headwear.js.map +1 -1
  236. package/dist/esm/animation/shapes/legs.js +7 -6
  237. package/dist/esm/animation/shapes/legs.js.map +1 -1
  238. package/dist/esm/animation/shapes/mouths.js +28 -18
  239. package/dist/esm/animation/shapes/mouths.js.map +1 -1
  240. package/dist/esm/animation/shapes/noses.js +18 -9
  241. package/dist/esm/animation/shapes/noses.js.map +1 -1
  242. package/dist/esm/animation/shapes/outfits.js +25 -14
  243. package/dist/esm/animation/shapes/outfits.js.map +1 -1
  244. package/dist/esm/animation/shapes/torsos.js +5 -4
  245. package/dist/esm/animation/shapes/torsos.js.map +1 -1
  246. package/dist/esm/animation/spineExport.js +33 -26
  247. package/dist/esm/animation/spineExport.js.map +1 -1
  248. package/dist/esm/core/LocalUI.js +16 -16
  249. package/dist/esm/core/LocalUI.js.map +1 -1
  250. package/dist/esm/core/NiceBrushEngine.js +205 -69
  251. package/dist/esm/core/NiceBrushEngine.js.map +1 -1
  252. package/dist/esm/core/collaboration.js +35 -21
  253. package/dist/esm/core/collaboration.js.map +1 -1
  254. package/dist/esm/core/colorBlindness.js +64 -24
  255. package/dist/esm/core/colorBlindness.js.map +1 -1
  256. package/dist/esm/core/dragDrop.js +34 -26
  257. package/dist/esm/core/dragDrop.js.map +1 -1
  258. package/dist/esm/core/fixes.js +26 -14
  259. package/dist/esm/core/fixes.js.map +1 -1
  260. package/dist/esm/core/gridGuides.js +24 -16
  261. package/dist/esm/core/gridGuides.js.map +1 -1
  262. package/dist/esm/core/historyVisual.js +42 -23
  263. package/dist/esm/core/historyVisual.js.map +1 -1
  264. package/dist/esm/core/integrations.js +65 -48
  265. package/dist/esm/core/integrations.js.map +1 -1
  266. package/dist/esm/core/minimap.js +40 -24
  267. package/dist/esm/core/minimap.js.map +1 -1
  268. package/dist/esm/core/plugins.js +10 -6
  269. package/dist/esm/core/plugins.js.map +1 -1
  270. package/dist/esm/core/rtl.js +32 -27
  271. package/dist/esm/core/rtl.js.map +1 -1
  272. package/dist/esm/core/shortcuts.js +77 -39
  273. package/dist/esm/core/shortcuts.js.map +1 -1
  274. package/dist/esm/core/theme.js +68 -61
  275. package/dist/esm/core/theme.js.map +1 -1
  276. package/dist/esm/core/yjsCollaboration.js +61 -28
  277. package/dist/esm/core/yjsCollaboration.js.map +1 -1
  278. package/dist/esm/font/NiceFontEditor.js +160 -57
  279. package/dist/esm/font/NiceFontEditor.js.map +1 -1
  280. package/dist/esm/font/fontFormatUtils.js +37 -24
  281. package/dist/esm/font/fontFormatUtils.js.map +1 -1
  282. package/dist/esm/game/GameAsset2dEditor.js +73 -60
  283. package/dist/esm/game/GameAsset2dEditor.js.map +1 -1
  284. package/dist/esm/game/gameAssetUtils.js +18 -13
  285. package/dist/esm/game/gameAssetUtils.js.map +1 -1
  286. package/dist/esm/game/useGameAssetEditor.js +160 -143
  287. package/dist/esm/game/useGameAssetEditor.js.map +1 -1
  288. package/dist/esm/icon/NiceIconEditor.js +329 -106
  289. package/dist/esm/icon/NiceIconEditor.js.map +1 -1
  290. package/dist/esm/packages/ui/dist/NiceErrorBoundary-D75yr_WE.js +563 -0
  291. package/dist/esm/packages/ui/dist/NiceErrorBoundary-D75yr_WE.js.map +1 -0
  292. package/dist/esm/packages/ui/dist/NiceForm-CKoJA6NG.js +4960 -0
  293. package/dist/esm/packages/ui/dist/NiceForm-CKoJA6NG.js.map +1 -0
  294. package/dist/esm/packages/ui/dist/NiceModal-1QX7NhyH.js +96 -0
  295. package/dist/esm/packages/ui/dist/NiceModal-1QX7NhyH.js.map +1 -0
  296. package/dist/esm/packages/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js +5201 -0
  297. package/dist/esm/packages/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js.map +1 -0
  298. package/dist/esm/packages/ui/dist/NicePagination-DbE-uOkl.js +172 -0
  299. package/dist/esm/packages/ui/dist/NicePagination-DbE-uOkl.js.map +1 -0
  300. package/dist/esm/packages/ui/dist/NicePinCodeInput-B8cI8zu8.js +10408 -0
  301. package/dist/esm/packages/ui/dist/NicePinCodeInput-B8cI8zu8.js.map +1 -0
  302. package/dist/esm/packages/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js +6296 -0
  303. package/dist/esm/packages/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js.map +1 -0
  304. package/dist/esm/packages/ui/dist/NiceTabs-DzLHzwuA.js +1630 -0
  305. package/dist/esm/packages/ui/dist/NiceTabs-DzLHzwuA.js.map +1 -0
  306. package/dist/esm/packages/ui/dist/NiceWindow-DeC83yfE.js +796 -0
  307. package/dist/esm/packages/ui/dist/NiceWindow-DeC83yfE.js.map +1 -0
  308. package/dist/esm/packages/ui/dist/charts-BAS21jkC.js +3809 -0
  309. package/dist/esm/packages/ui/dist/charts-BAS21jkC.js.map +1 -0
  310. package/dist/esm/packages/ui/dist/core-Da43q-pO.js +11502 -0
  311. package/dist/esm/packages/ui/dist/core-Da43q-pO.js.map +1 -0
  312. package/dist/esm/packages/ui/dist/index-pAuGTbuB.js +28792 -0
  313. package/dist/esm/packages/ui/dist/index-pAuGTbuB.js.map +1 -0
  314. package/dist/esm/photo/FilterThumb.js +7 -5
  315. package/dist/esm/photo/FilterThumb.js.map +1 -1
  316. package/dist/esm/photo/NiceAITools.js +78 -32
  317. package/dist/esm/photo/NiceAITools.js.map +1 -1
  318. package/dist/esm/photo/PhotoEditor.js +4 -4
  319. package/dist/esm/photo/PhotoEditor.js.map +1 -1
  320. package/dist/esm/photo/PhotoEditorCanvas.js +56 -22
  321. package/dist/esm/photo/PhotoEditorCanvas.js.map +1 -1
  322. package/dist/esm/photo/PhotoEditorLeftPanel.js +106 -48
  323. package/dist/esm/photo/PhotoEditorLeftPanel.js.map +1 -1
  324. package/dist/esm/photo/PhotoEditorToolbar.js +2 -2
  325. package/dist/esm/photo/PhotoEditorToolbar.js.map +1 -1
  326. package/dist/esm/photo/photoEditorActions.js +27 -18
  327. package/dist/esm/photo/photoEditorActions.js.map +1 -1
  328. package/dist/esm/photo/photoFilters.js +316 -81
  329. package/dist/esm/photo/photoFilters.js.map +1 -1
  330. package/dist/esm/photo/photoOverlays.js +521 -165
  331. package/dist/esm/photo/photoOverlays.js.map +1 -1
  332. package/dist/esm/photo/photoSelection.js +69 -35
  333. package/dist/esm/photo/photoSelection.js.map +1 -1
  334. package/dist/esm/photo/usePhotoEditor.js +203 -97
  335. package/dist/esm/photo/usePhotoEditor.js.map +1 -1
  336. package/dist/esm/pixel/HSVPicker.js +32 -19
  337. package/dist/esm/pixel/HSVPicker.js.map +1 -1
  338. package/dist/esm/pixel/PixelEditor.js +25 -14
  339. package/dist/esm/pixel/PixelEditor.js.map +1 -1
  340. package/dist/esm/pixel/PixelEditorCanvas.js +2 -2
  341. package/dist/esm/pixel/PixelEditorCanvas.js.map +1 -1
  342. package/dist/esm/pixel/PixelEditorMenuBar.js +3 -3
  343. package/dist/esm/pixel/PixelEditorMenuBar.js.map +1 -1
  344. package/dist/esm/pixel/PixelEditorRightPanel.js +28 -8
  345. package/dist/esm/pixel/PixelEditorRightPanel.js.map +1 -1
  346. package/dist/esm/pixel/PixelEditorStatusBar.js +2 -2
  347. package/dist/esm/pixel/PixelEditorStatusBar.js.map +1 -1
  348. package/dist/esm/pixel/PixelEditorTimeline.js +3 -4
  349. package/dist/esm/pixel/PixelEditorTimeline.js.map +1 -1
  350. package/dist/esm/pixel/PixelEditorToolbar.js +3 -3
  351. package/dist/esm/pixel/PixelEditorToolbar.js.map +1 -1
  352. package/dist/esm/pixel/SpriteGeneratorPanel.js +136 -54
  353. package/dist/esm/pixel/SpriteGeneratorPanel.js.map +1 -1
  354. package/dist/esm/pixel/asepriteFormat.js +122 -38
  355. package/dist/esm/pixel/asepriteFormat.js.map +1 -1
  356. package/dist/esm/pixel/characterGeneratorPresets.js +208 -54
  357. package/dist/esm/pixel/characterGeneratorPresets.js.map +1 -1
  358. package/dist/esm/pixel/pixelEditorExports.js +42 -35
  359. package/dist/esm/pixel/pixelEditorExports.js.map +1 -1
  360. package/dist/esm/pixel/pixelEditorTypes.js +67 -33
  361. package/dist/esm/pixel/pixelEditorTypes.js.map +1 -1
  362. package/dist/esm/pixel/pixelEditorUtils.js +62 -38
  363. package/dist/esm/pixel/pixelEditorUtils.js.map +1 -1
  364. package/dist/esm/pixel/spriteGeneratorCore.js +47 -24
  365. package/dist/esm/pixel/spriteGeneratorCore.js.map +1 -1
  366. package/dist/esm/pixel/usePixelEditor.js +475 -213
  367. package/dist/esm/pixel/usePixelEditor.js.map +1 -1
  368. package/dist/esm/texture/Nice3DTexturePainter.js +201 -71
  369. package/dist/esm/texture/Nice3DTexturePainter.js.map +1 -1
  370. package/dist/esm/ui/NiceUIDesigner.js +280 -91
  371. package/dist/esm/ui/NiceUIDesigner.js.map +1 -1
  372. package/dist/esm/vector/NiceSvgToCode.js +96 -34
  373. package/dist/esm/vector/NiceSvgToCode.js.map +1 -1
  374. package/dist/esm/vector/VectorEditor.js +14 -13
  375. package/dist/esm/vector/VectorEditor.js.map +1 -1
  376. package/dist/esm/vector/VectorEditorMenuBar.js +7 -6
  377. package/dist/esm/vector/VectorEditorMenuBar.js.map +1 -1
  378. package/dist/esm/vector/VectorEditorRightPanel.js +87 -32
  379. package/dist/esm/vector/VectorEditorRightPanel.js.map +1 -1
  380. package/dist/esm/vector/VectorEditorShapeRenderer.js +17 -15
  381. package/dist/esm/vector/VectorEditorShapeRenderer.js.map +1 -1
  382. package/dist/esm/vector/VectorEditorStatusBar.js.map +1 -1
  383. package/dist/esm/vector/useVectorEditor.js +312 -122
  384. package/dist/esm/vector/useVectorEditor.js.map +1 -1
  385. package/dist/esm/vector/vectorBooleanOps.js +60 -42
  386. package/dist/esm/vector/vectorBooleanOps.js.map +1 -1
  387. package/dist/esm/vector/vectorEditorExport.js +40 -34
  388. package/dist/esm/vector/vectorEditorExport.js.map +1 -1
  389. package/dist/esm/vector/vectorGradients.js +41 -40
  390. package/dist/esm/vector/vectorGradients.js.map +1 -1
  391. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var vectorEditorTypes = require('./vectorEditorTypes.js');
4
+ var vectorBooleanOps = require('./vectorBooleanOps.js');
5
5
  var vectorEditorExport = require('./vectorEditorExport.js');
6
6
  var vectorEditorImport = require('./vectorEditorImport.js');
7
- var vectorBooleanOps = require('./vectorBooleanOps.js');
7
+ var vectorEditorTypes = require('./vectorEditorTypes.js');
8
8
 
9
9
  /**
10
10
  * useVectorEditor — extracted logic + state for VectorEditor.
@@ -15,12 +15,12 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
15
15
  /* ── state ── */
16
16
  const [shapes, setShapes] = React.useState([]);
17
17
  const [selId, setSelId] = React.useState(null);
18
- const [tool, setTool] = React.useState("pointer");
19
- const [fillCol, setFillCol] = React.useState("#5566cc");
20
- const [strokeCol, setStrokeCol] = React.useState("#ffffff");
18
+ const [tool, setTool] = React.useState('pointer');
19
+ const [fillCol, setFillCol] = React.useState('#5566cc');
20
+ const [strokeCol, setStrokeCol] = React.useState('#ffffff');
21
21
  const [strokeW, setStrokeW] = React.useState(2);
22
22
  const [fontSize, setFontSize] = React.useState(24);
23
- const [fontFamily, setFontFamily] = React.useState("sans-serif");
23
+ const [fontFamily, setFontFamily] = React.useState('sans-serif');
24
24
  const [shapeOpacity, setShapeOpacity] = React.useState(1);
25
25
  const [cornerRadius, setCornerRadius] = React.useState(12);
26
26
  const [polygonSides, setPolygonSides] = React.useState(6);
@@ -30,7 +30,7 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
30
30
  const [px, setPx] = React.useState(0);
31
31
  const [py, setPy] = React.useState(0);
32
32
  const [dlgSvg, setDlgSvg] = React.useState(false);
33
- const [svgText, setSvgText] = React.useState("");
33
+ const [svgText, setSvgText] = React.useState('');
34
34
  const [snapGrid, setSnapGrid] = React.useState(false);
35
35
  const [gridSize, setGridSize] = React.useState(16);
36
36
  const [hasClipboard, setHasClipboard] = React.useState(false);
@@ -61,18 +61,21 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
61
61
  hIdx.current = hist.current.length - 1;
62
62
  }, []);
63
63
  React.useEffect(() => {
64
- if (hist.current.length === 0)
64
+ if (hist.current.length === 0) {
65
65
  snap([]);
66
+ }
66
67
  }, [snap]);
67
68
  const undo = React.useCallback(() => {
68
- if (hIdx.current <= 0)
69
+ if (hIdx.current <= 0) {
69
70
  return;
71
+ }
70
72
  hIdx.current--;
71
73
  setShapes(vectorEditorTypes.cloneShapes(hist.current[hIdx.current].shapes));
72
74
  }, []);
73
75
  const redo = React.useCallback(() => {
74
- if (hIdx.current >= hist.current.length - 1)
76
+ if (hIdx.current >= hist.current.length - 1) {
75
77
  return;
78
+ }
76
79
  hIdx.current++;
77
80
  setShapes(vectorEditorTypes.cloneShapes(hist.current[hIdx.current].shapes));
78
81
  }, []);
@@ -80,8 +83,9 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
80
83
  const scr2art = React.useCallback((cx, cy) => {
81
84
  var _a;
82
85
  const r = (_a = boxRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
83
- if (!r)
86
+ if (!r) {
84
87
  return { x: 0, y: 0 };
88
+ }
85
89
  let x = (cx - r.left - r.width / 2 - px) / zoom + artW / 2;
86
90
  let y = (cy - r.top - r.height / 2 - py) / zoom + artH / 2;
87
91
  if (snapGrid) {
@@ -98,8 +102,9 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
98
102
  panStart.current = { mx: e.clientX, my: e.clientY, px, py };
99
103
  return;
100
104
  }
101
- if (e.button !== 0)
105
+ if (e.button !== 0) {
102
106
  return;
107
+ }
103
108
  const p = scr2art(e.clientX, e.clientY);
104
109
  const defaultBase = {
105
110
  fill: fillCol,
@@ -108,7 +113,7 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
108
113
  opacity: shapeOpacity,
109
114
  rotation: 0,
110
115
  };
111
- if (tool === "pointer") {
116
+ if (tool === 'pointer') {
112
117
  let hit = null;
113
118
  for (let i = shapes.length - 1; i >= 0; i--) {
114
119
  const s = shapes[i];
@@ -124,13 +129,22 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
124
129
  }
125
130
  return;
126
131
  }
127
- if (tool === "pen") {
132
+ if (tool === 'pen') {
128
133
  penPts.current.push(p);
129
134
  if (penPts.current.length === 1) {
130
135
  const ns = {
131
- id: vectorEditorTypes.sid(), type: "polyline", x: p.x, y: p.y, w: 0, h: 0,
132
- points: [{ x: p.x, y: p.y }], fill: "none", stroke: strokeCol,
133
- strokeWidth: strokeW, opacity: shapeOpacity, rotation: 0,
136
+ id: vectorEditorTypes.sid(),
137
+ type: 'polyline',
138
+ x: p.x,
139
+ y: p.y,
140
+ w: 0,
141
+ h: 0,
142
+ points: [{ x: p.x, y: p.y }],
143
+ fill: 'none',
144
+ stroke: strokeCol,
145
+ strokeWidth: strokeW,
146
+ opacity: shapeOpacity,
147
+ rotation: 0,
134
148
  };
135
149
  pendingShape.current = ns;
136
150
  setShapes((prev) => [...prev, ns]);
@@ -142,21 +156,37 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
142
156
  setShapes((prev) => prev.map((s) => {
143
157
  var _a;
144
158
  return s.id === ((_a = pendingShape.current) === null || _a === void 0 ? void 0 : _a.id)
145
- ? { ...s, points: pts, x: Math.min(...xs), y: Math.min(...ys), w: Math.max(...xs) - Math.min(...xs), h: Math.max(...ys) - Math.min(...ys) }
159
+ ? {
160
+ ...s,
161
+ points: pts,
162
+ x: Math.min(...xs),
163
+ y: Math.min(...ys),
164
+ w: Math.max(...xs) - Math.min(...xs),
165
+ h: Math.max(...ys) - Math.min(...ys),
166
+ }
146
167
  : s;
147
168
  }));
148
169
  }
149
170
  return;
150
171
  }
151
- if (tool === "text") {
152
- const txt = prompt("Enter text:", "Hello");
153
- if (!txt)
172
+ if (tool === 'text') {
173
+ const txt = prompt('Enter text:', 'Hello');
174
+ if (!txt) {
154
175
  return;
176
+ }
155
177
  const ns = {
156
- id: vectorEditorTypes.sid(), type: "text", x: p.x, y: p.y,
157
- w: txt.length * fontSize * 0.6, h: fontSize,
158
- ...defaultBase, stroke: "none", strokeWidth: 0,
159
- text: txt, fontSize, fontFamily,
178
+ id: vectorEditorTypes.sid(),
179
+ type: 'text',
180
+ x: p.x,
181
+ y: p.y,
182
+ w: txt.length * fontSize * 0.6,
183
+ h: fontSize,
184
+ ...defaultBase,
185
+ stroke: 'none',
186
+ strokeWidth: 0,
187
+ text: txt,
188
+ fontSize,
189
+ fontFamily,
160
190
  };
161
191
  const next = [...shapes, ns];
162
192
  snap(next);
@@ -164,11 +194,17 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
164
194
  setSelId(ns.id);
165
195
  return;
166
196
  }
167
- if (tool === "polygon") {
197
+ if (tool === 'polygon') {
168
198
  const r2 = 40;
169
199
  const ns = {
170
- id: vectorEditorTypes.sid(), type: "polygon", x: p.x - r2, y: p.y - r2,
171
- w: r2 * 2, h: r2 * 2, ...defaultBase, sides: polygonSides,
200
+ id: vectorEditorTypes.sid(),
201
+ type: 'polygon',
202
+ x: p.x - r2,
203
+ y: p.y - r2,
204
+ w: r2 * 2,
205
+ h: r2 * 2,
206
+ ...defaultBase,
207
+ sides: polygonSides,
172
208
  };
173
209
  drawing.current = true;
174
210
  startPt.current = p;
@@ -176,11 +212,18 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
176
212
  setShapes((prev) => [...prev, ns]);
177
213
  return;
178
214
  }
179
- if (tool === "star") {
215
+ if (tool === 'star') {
180
216
  const r2 = 40;
181
217
  const ns = {
182
- id: vectorEditorTypes.sid(), type: "star", x: p.x - r2, y: p.y - r2,
183
- w: r2 * 2, h: r2 * 2, ...defaultBase, sides: starPoints2, innerRadius: starInnerRatio,
218
+ id: vectorEditorTypes.sid(),
219
+ type: 'star',
220
+ x: p.x - r2,
221
+ y: p.y - r2,
222
+ w: r2 * 2,
223
+ h: r2 * 2,
224
+ ...defaultBase,
225
+ sides: starPoints2,
226
+ innerRadius: starInnerRatio,
184
227
  };
185
228
  drawing.current = true;
186
229
  startPt.current = p;
@@ -191,29 +234,61 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
191
234
  // rect / roundrect / ellipse / line / arrow — start drag
192
235
  drawing.current = true;
193
236
  startPt.current = p;
194
- const typeMap = { line: "line", arrow: "arrow", ellipse: "ellipse", roundrect: "roundrect" };
195
- const shapeType = typeMap[tool] || "rect";
196
- const isLineLike = shapeType === "line" || shapeType === "arrow";
237
+ const typeMap = {
238
+ line: 'line',
239
+ arrow: 'arrow',
240
+ ellipse: 'ellipse',
241
+ roundrect: 'roundrect',
242
+ };
243
+ const shapeType = typeMap[tool] || 'rect';
244
+ const isLineLike = shapeType === 'line' || shapeType === 'arrow';
197
245
  const ns = {
198
- id: vectorEditorTypes.sid(), type: shapeType, x: p.x, y: p.y, w: 0, h: 0,
199
- x2: p.x, y2: p.y,
200
- fill: isLineLike ? "none" : fillCol, stroke: strokeCol,
201
- strokeWidth: strokeW, opacity: shapeOpacity, rotation: 0,
202
- rx: shapeType === "roundrect" ? cornerRadius : undefined,
246
+ id: vectorEditorTypes.sid(),
247
+ type: shapeType,
248
+ x: p.x,
249
+ y: p.y,
250
+ w: 0,
251
+ h: 0,
252
+ x2: p.x,
253
+ y2: p.y,
254
+ fill: isLineLike ? 'none' : fillCol,
255
+ stroke: strokeCol,
256
+ strokeWidth: strokeW,
257
+ opacity: shapeOpacity,
258
+ rotation: 0,
259
+ rx: shapeType === 'roundrect' ? cornerRadius : undefined,
203
260
  };
204
261
  pendingShape.current = ns;
205
262
  setShapes((prev) => [...prev, ns]);
206
- }, [tool, shapes, scr2art, px, py, fillCol, strokeCol, strokeW, fontSize, fontFamily, snap, shapeOpacity, polygonSides, starPoints2, starInnerRatio, cornerRadius]);
263
+ }, [
264
+ tool,
265
+ shapes,
266
+ scr2art,
267
+ px,
268
+ py,
269
+ fillCol,
270
+ strokeCol,
271
+ strokeW,
272
+ fontSize,
273
+ fontFamily,
274
+ snap,
275
+ shapeOpacity,
276
+ polygonSides,
277
+ starPoints2,
278
+ starInnerRatio,
279
+ cornerRadius,
280
+ ]);
207
281
  const onMove = React.useCallback((e) => {
208
282
  if (panning.current) {
209
283
  setPx(panStart.current.px + (e.clientX - panStart.current.mx));
210
284
  setPy(panStart.current.py + (e.clientY - panStart.current.my));
211
285
  return;
212
286
  }
213
- if (!drawing.current)
287
+ if (!drawing.current) {
214
288
  return;
289
+ }
215
290
  const p = scr2art(e.clientX, e.clientY);
216
- if (tool === "pointer" && selId) {
291
+ if (tool === 'pointer' && selId) {
217
292
  const dx = p.x - startPt.current.x;
218
293
  const dy = p.y - startPt.current.y;
219
294
  startPt.current = p;
@@ -221,7 +296,9 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
221
296
  var _a;
222
297
  return s.id === selId
223
298
  ? {
224
- ...s, x: s.x + dx, y: s.y + dy,
299
+ ...s,
300
+ x: s.x + dx,
301
+ y: s.y + dy,
225
302
  x2: s.x2 != null ? s.x2 + dx : undefined,
226
303
  y2: s.y2 != null ? s.y2 + dy : undefined,
227
304
  points: (_a = s.points) === null || _a === void 0 ? void 0 : _a.map((pt) => ({ x: pt.x + dx, y: pt.y + dy })),
@@ -230,10 +307,11 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
230
307
  }));
231
308
  return;
232
309
  }
233
- if (!pendingShape.current)
310
+ if (!pendingShape.current) {
234
311
  return;
312
+ }
235
313
  const t = pendingShape.current.type;
236
- if (t === "polygon" || t === "star") {
314
+ if (t === 'polygon' || t === 'star') {
237
315
  const cx = startPt.current.x;
238
316
  const cy = startPt.current.y;
239
317
  const dx = p.x - cx;
@@ -244,14 +322,14 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
244
322
  : s));
245
323
  return;
246
324
  }
247
- if (t === "rect" || t === "roundrect" || t === "ellipse") {
325
+ if (t === 'rect' || t === 'roundrect' || t === 'ellipse') {
248
326
  const x1 = Math.min(startPt.current.x, p.x);
249
327
  const y1 = Math.min(startPt.current.y, p.y);
250
328
  const w2 = Math.abs(p.x - startPt.current.x);
251
329
  const h2 = Math.abs(p.y - startPt.current.y);
252
330
  setShapes((prev) => prev.map((s) => s.id === pendingShape.current.id ? { ...s, x: x1, y: y1, w: w2, h: h2 } : s));
253
331
  }
254
- else if (t === "line" || t === "arrow") {
332
+ else if (t === 'line' || t === 'arrow') {
255
333
  setShapes((prev) => prev.map((s) => s.id === pendingShape.current.id
256
334
  ? { ...s, w: Math.abs(p.x - s.x), h: Math.abs(p.y - s.y), x2: p.x, y2: p.y }
257
335
  : s));
@@ -267,9 +345,9 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
267
345
  drawing.current = false;
268
346
  if (pendingShape.current) {
269
347
  const ps = pendingShape.current;
270
- if (ps.type !== "polyline" && ps.type !== "text") {
348
+ if (ps.type !== 'polyline' && ps.type !== 'text') {
271
349
  const minD = 3;
272
- const isTiny = ps.type === "line" || ps.type === "arrow"
350
+ const isTiny = ps.type === 'line' || ps.type === 'arrow'
273
351
  ? Math.abs(((_a = ps.x2) !== null && _a !== void 0 ? _a : ps.x) - ps.x) < minD && Math.abs(((_b = ps.y2) !== null && _b !== void 0 ? _b : ps.y) - ps.y) < minD
274
352
  : Math.abs(ps.w) < minD && Math.abs(ps.h) < minD;
275
353
  if (isTiny) {
@@ -284,14 +362,22 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
284
362
  }
285
363
  }, [snap]);
286
364
  const onWheel = React.useCallback((e) => {
287
- e.preventDefault();
288
365
  setZoom((z) => {
289
366
  const n = e.deltaY < 0 ? z * 1.15 : z / 1.15;
290
367
  return Math.max(0.1, Math.min(10, n));
291
368
  });
292
369
  }, []);
370
+ React.useEffect(() => {
371
+ const el = boxRef.current;
372
+ if (!el) {
373
+ return;
374
+ }
375
+ const handler = (e) => e.preventDefault();
376
+ el.addEventListener('wheel', handler, { passive: false });
377
+ return () => el.removeEventListener('wheel', handler);
378
+ }, []);
293
379
  const onDblClick = React.useCallback(() => {
294
- if (tool === "pen" && pendingShape.current) {
380
+ if (tool === 'pen' && pendingShape.current) {
295
381
  snap(shapesRef.current);
296
382
  setSelId(pendingShape.current.id);
297
383
  pendingShape.current = null;
@@ -300,52 +386,69 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
300
386
  }, [tool, snap]);
301
387
  /* ── shape operations ── */
302
388
  const deleteShape = React.useCallback(() => {
303
- if (!selId)
389
+ if (!selId) {
304
390
  return;
391
+ }
305
392
  const next = shapes.filter((s) => s.id !== selId);
306
393
  snap(next);
307
394
  setShapes(next);
308
395
  setSelId(null);
309
396
  }, [selId, shapes, snap]);
310
397
  const bringToFront = React.useCallback(() => {
311
- if (!selId)
398
+ if (!selId) {
312
399
  return;
400
+ }
313
401
  const next = [...shapes.filter((s) => s.id !== selId), shapes.find((s) => s.id === selId)];
314
402
  snap(next);
315
403
  setShapes(next);
316
404
  }, [selId, shapes, snap]);
317
405
  const sendToBack = React.useCallback(() => {
318
- if (!selId)
406
+ if (!selId) {
319
407
  return;
408
+ }
320
409
  const next = [shapes.find((s) => s.id === selId), ...shapes.filter((s) => s.id !== selId)];
321
410
  snap(next);
322
411
  setShapes(next);
323
412
  }, [selId, shapes, snap]);
324
413
  const updateSel = React.useCallback((patch) => {
325
- if (!selId)
414
+ if (!selId) {
326
415
  return;
416
+ }
327
417
  setShapes((prev) => prev.map((s) => (s.id === selId ? { ...s, ...patch } : s)));
328
418
  }, [selId]);
329
419
  /* ── clipboard ── */
330
420
  const copyShape = React.useCallback(() => {
331
- if (!selShape)
421
+ if (!selShape) {
332
422
  return;
423
+ }
333
424
  clipboard.current = JSON.parse(JSON.stringify(selShape));
334
425
  setHasClipboard(true);
335
426
  }, [selShape]);
336
427
  const pasteShape = React.useCallback(() => {
337
- if (!clipboard.current)
428
+ if (!clipboard.current) {
338
429
  return;
339
- const ns = { ...JSON.parse(JSON.stringify(clipboard.current)), id: vectorEditorTypes.sid(), x: clipboard.current.x + 20, y: clipboard.current.y + 20 };
430
+ }
431
+ const ns = {
432
+ ...JSON.parse(JSON.stringify(clipboard.current)),
433
+ id: vectorEditorTypes.sid(),
434
+ x: clipboard.current.x + 20,
435
+ y: clipboard.current.y + 20,
436
+ };
340
437
  const next = [...shapes, ns];
341
438
  snap(next);
342
439
  setShapes(next);
343
440
  setSelId(ns.id);
344
441
  }, [shapes, snap]);
345
442
  const duplicateShape = React.useCallback(() => {
346
- if (!selShape)
443
+ if (!selShape) {
347
444
  return;
348
- const ns = { ...JSON.parse(JSON.stringify(selShape)), id: vectorEditorTypes.sid(), x: selShape.x + 20, y: selShape.y + 20 };
445
+ }
446
+ const ns = {
447
+ ...JSON.parse(JSON.stringify(selShape)),
448
+ id: vectorEditorTypes.sid(),
449
+ x: selShape.x + 20,
450
+ y: selShape.y + 20,
451
+ };
349
452
  const next = [...shapes, ns];
350
453
  snap(next);
351
454
  setShapes(next);
@@ -353,69 +456,82 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
353
456
  }, [selShape, shapes, snap]);
354
457
  /* ── flip ── */
355
458
  const flipH = React.useCallback(() => {
356
- if (!selId || !selShape)
459
+ if (!selId || !selShape) {
357
460
  return;
461
+ }
358
462
  if (selShape.points) {
359
463
  const cx = selShape.x + selShape.w / 2;
360
- const next = shapes.map((s) => { var _a; return s.id === selId ? { ...s, points: (_a = s.points) === null || _a === void 0 ? void 0 : _a.map((pt) => ({ x: cx * 2 - pt.x, y: pt.y })) } : s; });
464
+ const next = shapes.map((s) => {
465
+ var _a;
466
+ return s.id === selId
467
+ ? { ...s, points: (_a = s.points) === null || _a === void 0 ? void 0 : _a.map((pt) => ({ x: cx * 2 - pt.x, y: pt.y })) }
468
+ : s;
469
+ });
361
470
  snap(next);
362
471
  setShapes(next);
363
472
  }
364
- else if (selShape.type === "line" || selShape.type === "arrow") {
365
- const next = shapes.map((s) => { var _a; return s.id === selId ? { ...s, x: (_a = s.x2) !== null && _a !== void 0 ? _a : s.x, x2: s.x } : s; });
473
+ else if (selShape.type === 'line' || selShape.type === 'arrow') {
474
+ const next = shapes.map((s) => { var _a; return (s.id === selId ? { ...s, x: (_a = s.x2) !== null && _a !== void 0 ? _a : s.x, x2: s.x } : s); });
366
475
  snap(next);
367
476
  setShapes(next);
368
477
  }
369
478
  else {
370
479
  const newRot = selShape.rotation ? -selShape.rotation : 0;
371
- const next = shapes.map((s) => s.id === selId ? { ...s, rotation: newRot } : s);
480
+ const next = shapes.map((s) => (s.id === selId ? { ...s, rotation: newRot } : s));
372
481
  snap(next);
373
482
  setShapes(next);
374
483
  }
375
484
  }, [selId, selShape, shapes, snap]);
376
485
  const flipV = React.useCallback(() => {
377
- if (!selId || !selShape)
486
+ if (!selId || !selShape) {
378
487
  return;
488
+ }
379
489
  if (selShape.points) {
380
490
  const cy = selShape.y + selShape.h / 2;
381
- const next = shapes.map((s) => { var _a; return s.id === selId ? { ...s, points: (_a = s.points) === null || _a === void 0 ? void 0 : _a.map((pt) => ({ x: pt.x, y: cy * 2 - pt.y })) } : s; });
491
+ const next = shapes.map((s) => {
492
+ var _a;
493
+ return s.id === selId
494
+ ? { ...s, points: (_a = s.points) === null || _a === void 0 ? void 0 : _a.map((pt) => ({ x: pt.x, y: cy * 2 - pt.y })) }
495
+ : s;
496
+ });
382
497
  snap(next);
383
498
  setShapes(next);
384
499
  }
385
- else if (selShape.type === "line" || selShape.type === "arrow") {
386
- const next = shapes.map((s) => { var _a; return s.id === selId ? { ...s, y: (_a = s.y2) !== null && _a !== void 0 ? _a : s.y, y2: s.y } : s; });
500
+ else if (selShape.type === 'line' || selShape.type === 'arrow') {
501
+ const next = shapes.map((s) => { var _a; return (s.id === selId ? { ...s, y: (_a = s.y2) !== null && _a !== void 0 ? _a : s.y, y2: s.y } : s); });
387
502
  snap(next);
388
503
  setShapes(next);
389
504
  }
390
505
  else {
391
506
  const newRot = selShape.rotation ? (180 - selShape.rotation) % 360 : 180;
392
- const next = shapes.map((s) => s.id === selId ? { ...s, rotation: newRot } : s);
507
+ const next = shapes.map((s) => (s.id === selId ? { ...s, rotation: newRot } : s));
393
508
  snap(next);
394
509
  setShapes(next);
395
510
  }
396
511
  }, [selId, selShape, shapes, snap]);
397
512
  /* ── alignment ── */
398
513
  const alignShapes = React.useCallback((mode) => {
399
- if (!selId || !selShape)
514
+ if (!selId || !selShape) {
400
515
  return;
516
+ }
401
517
  let patch = {};
402
518
  switch (mode) {
403
- case "left":
519
+ case 'left':
404
520
  patch = { x: 0 };
405
521
  break;
406
- case "right":
522
+ case 'right':
407
523
  patch = { x: artW - selShape.w };
408
524
  break;
409
- case "center":
525
+ case 'center':
410
526
  patch = { x: (artW - selShape.w) / 2 };
411
527
  break;
412
- case "top":
528
+ case 'top':
413
529
  patch = { y: 0 };
414
530
  break;
415
- case "bottom":
531
+ case 'bottom':
416
532
  patch = { y: artH - selShape.h };
417
533
  break;
418
- case "middle":
534
+ case 'middle':
419
535
  patch = { y: (artH - selShape.h) / 2 };
420
536
  break;
421
537
  }
@@ -427,15 +543,17 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
427
543
  const [boolSecondShape, setBoolSecondShape] = React.useState(null);
428
544
  const applyBoolean = React.useCallback((operation) => {
429
545
  var _a;
430
- if (!selId || !boolSecondShape)
546
+ if (!selId || !boolSecondShape) {
431
547
  return;
548
+ }
432
549
  const shapeA = shapes.find((s) => s.id === selId);
433
550
  const shapeB = shapes.find((s) => s.id === boolSecondShape);
434
- if (!shapeA || !shapeB)
551
+ if (!shapeA || !shapeB) {
435
552
  return;
553
+ }
436
554
  const result = vectorBooleanOps.booleanOperation(shapeA, shapeB, operation);
437
555
  if (!result) {
438
- alert("Boolean operation resulted in empty shape");
556
+ console.warn('[VectorEditor] Boolean operation resulted in empty shape');
439
557
  return;
440
558
  }
441
559
  // Remove original shapes, add result(s)
@@ -452,13 +570,14 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
452
570
  setShapes(next);
453
571
  setBoolSecondShape(null);
454
572
  }, [selId, boolSecondShape, shapes, snap]);
455
- const unionShapes = React.useCallback(() => applyBoolean("union"), [applyBoolean]);
456
- const subtractShapes = React.useCallback(() => applyBoolean("difference"), [applyBoolean]);
457
- const intersectShapes = React.useCallback(() => applyBoolean("intersection"), [applyBoolean]);
458
- const excludeShapes = React.useCallback(() => applyBoolean("exclusion"), [applyBoolean]);
573
+ const unionShapes = React.useCallback(() => applyBoolean('union'), [applyBoolean]);
574
+ const subtractShapes = React.useCallback(() => applyBoolean('difference'), [applyBoolean]);
575
+ const intersectShapes = React.useCallback(() => applyBoolean('intersection'), [applyBoolean]);
576
+ const excludeShapes = React.useCallback(() => applyBoolean('exclusion'), [applyBoolean]);
459
577
  const outlineStroke = React.useCallback(() => {
460
- if (!selId || !selShape)
578
+ if (!selId || !selShape) {
461
579
  return;
580
+ }
462
581
  const result = vectorBooleanOps.flattenToOutline(selShape);
463
582
  const next = shapes.map((s) => (s.id === selId ? result : s));
464
583
  snap(next);
@@ -470,7 +589,7 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
470
589
  try {
471
590
  const imported = vectorEditorImport.parseSVGToShapes(raw);
472
591
  if (imported.length === 0) {
473
- alert("No supported shapes found in SVG.");
592
+ console.warn('[VectorEditor] No supported shapes found in SVG.');
474
593
  return;
475
594
  }
476
595
  const next = [...shapes, ...imported];
@@ -479,10 +598,12 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
479
598
  setDlgSvg(false);
480
599
  }
481
600
  catch (e) {
482
- alert(e instanceof Error ? e.message : "Failed to parse SVG.");
601
+ console.warn('[VectorEditor] SVG parse error:', e instanceof Error ? e.message : 'Failed to parse SVG.');
483
602
  }
484
603
  }, [shapes, snap]);
485
- const openFile = React.useCallback(async (file) => { importSVGString(await file.text()); }, [importSVGString]);
604
+ const openFile = React.useCallback(async (file) => {
605
+ importSVGString(await file.text());
606
+ }, [importSVGString]);
486
607
  /* ── new / reset ── */
487
608
  const newCanvas = React.useCallback(() => {
488
609
  snap([]);
@@ -494,17 +615,19 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
494
615
  }, [snap]);
495
616
  /* ── save to library ── */
496
617
  const saveToLibrary = React.useCallback(() => {
497
- if (!onSaveToLibrary)
618
+ if (!onSaveToLibrary) {
498
619
  return;
620
+ }
499
621
  const svg = vectorEditorExport.buildSVGString(shapes, artW, artH);
500
- const blob = new Blob([svg], { type: "image/svg+xml" });
622
+ const blob = new Blob([svg], { type: 'image/svg+xml' });
501
623
  const reader = new FileReader();
502
624
  reader.onload = () => {
503
- const defaultName = "drawing.svg";
504
- const name = window.prompt("Save to library as:", defaultName);
505
- if (!name || !name.trim())
625
+ const defaultName = 'drawing.svg';
626
+ const name = window.prompt('Save to library as:', defaultName);
627
+ if (!name || !name.trim()) {
506
628
  return;
507
- onSaveToLibrary(reader.result, name.trim(), "image/svg+xml");
629
+ }
630
+ onSaveToLibrary(reader.result, name.trim(), 'image/svg+xml');
508
631
  };
509
632
  reader.readAsDataURL(blob);
510
633
  }, [shapes, artW, artH, onSaveToLibrary]);
@@ -516,7 +639,7 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
516
639
  const exportBMP = React.useCallback(() => vectorEditorExport.exportBMPFile(shapes, artW, artH), [shapes, artW, artH]);
517
640
  /* ── tool switch helper (finishes pen) ── */
518
641
  const switchTool = React.useCallback((newTool) => {
519
- if (tool === "pen" && newTool !== "pen" && pendingShape.current) {
642
+ if (tool === 'pen' && newTool !== 'pen' && pendingShape.current) {
520
643
  snap(shapes);
521
644
  pendingShape.current = null;
522
645
  penPts.current = [];
@@ -527,34 +650,35 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
527
650
  React.useEffect(() => {
528
651
  const h = (e) => {
529
652
  const t = e.target;
530
- if (t.tagName === "INPUT" || t.tagName === "TEXTAREA")
653
+ if (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA') {
531
654
  return;
532
- if (e.ctrlKey && e.key === "z") {
655
+ }
656
+ if (e.ctrlKey && e.key === 'z') {
533
657
  e.preventDefault();
534
658
  undo();
535
659
  return;
536
660
  }
537
- if (e.ctrlKey && (e.key === "y" || (e.shiftKey && e.key === "Z"))) {
661
+ if (e.ctrlKey && (e.key === 'y' || (e.shiftKey && e.key === 'Z'))) {
538
662
  e.preventDefault();
539
663
  redo();
540
664
  return;
541
665
  }
542
- if (e.ctrlKey && e.key === "c") {
666
+ if (e.ctrlKey && e.key === 'c') {
543
667
  e.preventDefault();
544
668
  copyShape();
545
669
  return;
546
670
  }
547
- if (e.ctrlKey && e.key === "v") {
671
+ if (e.ctrlKey && e.key === 'v') {
548
672
  e.preventDefault();
549
673
  pasteShape();
550
674
  return;
551
675
  }
552
- if (e.ctrlKey && e.key === "d") {
676
+ if (e.ctrlKey && e.key === 'd') {
553
677
  e.preventDefault();
554
678
  duplicateShape();
555
679
  return;
556
680
  }
557
- if (e.key === "Escape") {
681
+ if (e.key === 'Escape') {
558
682
  if (pendingShape.current) {
559
683
  setShapes((prev) => prev.filter((s) => s.id !== pendingShape.current.id));
560
684
  pendingShape.current = null;
@@ -567,45 +691,111 @@ function useVectorEditor({ artW, artH, onSaveToLibrary }) {
567
691
  return;
568
692
  }
569
693
  const km = {
570
- v: "pointer", r: "rect", u: "roundrect", c: "ellipse", l: "line",
571
- a: "arrow", g: "polygon", s: "star", p: "pen", t: "text",
694
+ v: 'pointer',
695
+ r: 'rect',
696
+ u: 'roundrect',
697
+ c: 'ellipse',
698
+ l: 'line',
699
+ a: 'arrow',
700
+ g: 'polygon',
701
+ s: 'star',
702
+ p: 'pen',
703
+ t: 'text',
572
704
  };
573
705
  if (km[e.key.toLowerCase()] && !e.ctrlKey && !e.altKey) {
574
706
  setTool(km[e.key.toLowerCase()]);
575
707
  return;
576
708
  }
577
- if (e.key === "Delete" || e.key === "Backspace")
709
+ if (e.key === 'Delete' || e.key === 'Backspace') {
578
710
  deleteShape();
711
+ }
579
712
  };
580
- window.addEventListener("keydown", h);
581
- return () => window.removeEventListener("keydown", h);
713
+ window.addEventListener('keydown', h);
714
+ return () => window.removeEventListener('keydown', h);
582
715
  }, [undo, redo, deleteShape, copyShape, pasteShape, duplicateShape]);
583
716
  /* ── return ── */
584
717
  return {
585
718
  // state
586
- shapes, selId, tool, fillCol, strokeCol, strokeW, fontSize, fontFamily,
587
- shapeOpacity, cornerRadius, polygonSides, starPoints2, starInnerRatio,
588
- zoom, px, py, dlgSvg, svgText, snapGrid, gridSize, hasClipboard,
719
+ shapes,
720
+ selId,
721
+ tool,
722
+ fillCol,
723
+ strokeCol,
724
+ strokeW,
725
+ fontSize,
726
+ fontFamily,
727
+ shapeOpacity,
728
+ cornerRadius,
729
+ polygonSides,
730
+ starPoints2,
731
+ starInnerRatio,
732
+ zoom,
733
+ px,
734
+ py,
735
+ dlgSvg,
736
+ svgText,
737
+ snapGrid,
738
+ gridSize,
739
+ hasClipboard,
589
740
  boolSecondShape,
590
741
  // derived
591
742
  selShape,
592
743
  // setters
593
- setTool, setFillCol, setStrokeCol, setStrokeW, setFontSize, setFontFamily,
594
- setShapeOpacity, setCornerRadius, setPolygonSides, setStarPoints2, setStarInnerRatio,
595
- setZoom, setDlgSvg, setSvgText, setSnapGrid, setGridSize, setSelId,
744
+ setTool,
745
+ setFillCol,
746
+ setStrokeCol,
747
+ setStrokeW,
748
+ setFontSize,
749
+ setFontFamily,
750
+ setShapeOpacity,
751
+ setCornerRadius,
752
+ setPolygonSides,
753
+ setStarPoints2,
754
+ setStarInnerRatio,
755
+ setZoom,
756
+ setDlgSvg,
757
+ setSvgText,
758
+ setSnapGrid,
759
+ setGridSize,
760
+ setSelId,
596
761
  setBoolSecondShape,
597
762
  // refs
598
- boxRef, fInp,
763
+ boxRef,
764
+ fInp,
599
765
  // mouse handlers
600
- onDown, onMove, onUp, onWheel, onDblClick,
766
+ onDown,
767
+ onMove,
768
+ onUp,
769
+ onWheel,
770
+ onDblClick,
601
771
  // actions
602
- undo, redo, deleteShape, bringToFront, sendToBack, updateSel,
603
- copyShape, pasteShape, duplicateShape,
604
- flipH, flipV, alignShapes,
605
- unionShapes, subtractShapes, intersectShapes, excludeShapes, outlineStroke,
606
- importSVGString, openFile, newCanvas,
607
- exportSVG, exportPNG, exportJPG, exportWebP, exportBMP,
608
- switchTool, saveToLibrary,
772
+ undo,
773
+ redo,
774
+ deleteShape,
775
+ bringToFront,
776
+ sendToBack,
777
+ updateSel,
778
+ copyShape,
779
+ pasteShape,
780
+ duplicateShape,
781
+ flipH,
782
+ flipV,
783
+ alignShapes,
784
+ unionShapes,
785
+ subtractShapes,
786
+ intersectShapes,
787
+ excludeShapes,
788
+ outlineStroke,
789
+ importSVGString,
790
+ openFile,
791
+ newCanvas,
792
+ exportSVG,
793
+ exportPNG,
794
+ exportJPG,
795
+ exportWebP,
796
+ exportBMP,
797
+ switchTool,
798
+ saveToLibrary,
609
799
  };
610
800
  }
611
801