@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,8 +1,8 @@
1
1
  import { useState, useRef, useMemo, useCallback, useEffect } from 'react';
2
2
  import { useNiceTranslation } from '../core/i18n.js';
3
+ import { getExportBlob, handleDownloadBlob, handleCopyImageToClipboard, handleNativeShare } from './photoEditorActions.js';
3
4
  import { DEFAULT_ADJUSTMENTS, renderToCanvas, PHOTO_FILTERS, canvasToFile } from './photoFilters.js';
4
5
  import { EMOJI_CATALOG, deserializeEditorState, renderAllOverlays, renderLiveStroke, hitTestOverlay, createDrawingOverlay, serializeEditorState, createFrameOverlay, createShapeOverlay, createTextOverlay, createEmojiOverlay } from './photoOverlays.js';
5
- import { getExportBlob, handleDownloadBlob, handleCopyImageToClipboard, handleNativeShare } from './photoEditorActions.js';
6
6
 
7
7
  /**
8
8
  * usePhotoEditor.ts — Custom hook encapsulating all PhotoEditor state & logic.
@@ -11,7 +11,7 @@ import { getExportBlob, handleDownloadBlob, handleCopyImageToClipboard, handleNa
11
11
  * out of the god-component so that the main component file is pure composition.
12
12
  */
13
13
  // ── Hook ──
14
- function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initialState }) {
14
+ function usePhotoEditor({ src, playerColor = '#00aaff', onSave, onCancel, initialState, }) {
15
15
  const { t: _t } = useNiceTranslation();
16
16
  const t = (key, def) => _t(key, def);
17
17
  // ── State ──
@@ -19,12 +19,12 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
19
19
  const [image, setImage] = useState(null);
20
20
  const [loading, setLoading] = useState(true);
21
21
  // Tabs
22
- const [activeTab, setActiveTabRaw] = useState("filters");
22
+ const [activeTab, setActiveTabRaw] = useState('filters');
23
23
  const [cropMode, setCropMode] = useState(false);
24
24
  // Filter
25
- const [selectedFilter, setSelectedFilter] = useState("none");
25
+ const [selectedFilter, setSelectedFilter] = useState('none');
26
26
  const [filterIntensity, setFilterIntensity] = useState(1);
27
- const [filterCategory, setFilterCategory] = useState("all");
27
+ const [filterCategory, setFilterCategory] = useState('all');
28
28
  const [filterParams] = useState({});
29
29
  // Adjustments
30
30
  const [adjustments, setAdjustments] = useState({ ...DEFAULT_ADJUSTMENTS });
@@ -51,22 +51,22 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
51
51
  // Sticker / emoji
52
52
  const [emojiCat, setEmojiCat] = useState(EMOJI_CATALOG[0].id);
53
53
  // Text overlay
54
- const [textDraft, setTextDraft] = useState("Tekst");
55
- const [textColor, setTextColor] = useState("#ffffff");
54
+ const [textDraft, setTextDraft] = useState('Tekst');
55
+ const [textColor, setTextColor] = useState('#ffffff');
56
56
  const [textBold, setTextBold] = useState(true);
57
57
  const [textItalic, setTextItalic] = useState(false);
58
58
  const [textOutline, setTextOutline] = useState(true);
59
59
  const [textFontSize, setTextFontSize] = useState(36);
60
60
  const [textBg, setTextBg] = useState(false);
61
61
  // Shape
62
- const [shapeStroke, setShapeStroke] = useState("#ffffff");
63
- const [shapeFill, setShapeFill] = useState("");
62
+ const [shapeStroke, setShapeStroke] = useState('#ffffff');
63
+ const [shapeFill, setShapeFill] = useState('');
64
64
  const [shapeStrokeW, setShapeStrokeW] = useState(3);
65
65
  // Frame
66
- const [frameColor, setFrameColor] = useState("#ffffff");
66
+ const [frameColor, setFrameColor] = useState('#ffffff');
67
67
  const [frameThick, setFrameThick] = useState(3);
68
68
  // Drawing
69
- const [drawColor, setDrawColor] = useState("#ff0000");
69
+ const [drawColor, setDrawColor] = useState('#ff0000');
70
70
  const [drawWidth, setDrawWidth] = useState(4);
71
71
  const [isDrawing, setIsDrawing] = useState(false);
72
72
  const [livePoints, setLivePoints] = useState([]);
@@ -81,17 +81,18 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
81
81
  const containerRef = useRef(null);
82
82
  // ── Derived ──
83
83
  const accent = playerColor;
84
- const accentDim = playerColor + "55";
85
- const selectedOverlay = useMemo(() => { var _a; return (_a = overlays.find(o => o.id === selectedOverlayId)) !== null && _a !== void 0 ? _a : null; }, [overlays, selectedOverlayId]);
84
+ const accentDim = playerColor + '55';
85
+ const selectedOverlay = useMemo(() => { var _a; return (_a = overlays.find((o) => o.id === selectedOverlayId)) !== null && _a !== void 0 ? _a : null; }, [overlays, selectedOverlayId]);
86
86
  // Tab setter (auto-toggle cropMode)
87
87
  const setActiveTab = useCallback((tab) => {
88
88
  setActiveTabRaw(tab);
89
- setCropMode(tab === "crop");
89
+ setCropMode(tab === 'crop');
90
90
  }, []);
91
91
  // ── History ──
92
92
  const pushHistory = useCallback(() => {
93
- if (suppressHistoryRef.current)
93
+ if (suppressHistoryRef.current) {
94
94
  return;
95
+ }
95
96
  const state = {
96
97
  selectedFilter,
97
98
  filterIntensity,
@@ -100,11 +101,21 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
100
101
  flipH,
101
102
  flipV,
102
103
  cropRect: cropRect ? { ...cropRect } : null,
103
- overlays: overlays.map(o => ({ ...o })),
104
+ overlays: overlays.map((o) => ({ ...o })),
104
105
  };
105
- setHistory(prev => [...prev.slice(0, historyIdx + 1), state]);
106
- setHistoryIdx(prev => prev + 1);
107
- }, [selectedFilter, filterIntensity, adjustments, rotation, flipH, flipV, cropRect, overlays, historyIdx]);
106
+ setHistory((prev) => [...prev.slice(0, historyIdx + 1), state]);
107
+ setHistoryIdx((prev) => prev + 1);
108
+ }, [
109
+ selectedFilter,
110
+ filterIntensity,
111
+ adjustments,
112
+ rotation,
113
+ flipH,
114
+ flipV,
115
+ cropRect,
116
+ overlays,
117
+ historyIdx,
118
+ ]);
108
119
  const restoreState = useCallback((s) => {
109
120
  suppressHistoryRef.current = true;
110
121
  setSelectedFilter(s.selectedFilter);
@@ -114,9 +125,11 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
114
125
  setFlipH(s.flipH);
115
126
  setFlipV(s.flipV);
116
127
  setCropRect(s.cropRect ? { ...s.cropRect } : null);
117
- setOverlays(s.overlays.map(o => ({ ...o })));
128
+ setOverlays(s.overlays.map((o) => ({ ...o })));
118
129
  setSelectedOverlayId(null);
119
- setTimeout(() => { suppressHistoryRef.current = false; }, 50);
130
+ setTimeout(() => {
131
+ suppressHistoryRef.current = false;
132
+ }, 50);
120
133
  }, []);
121
134
  const undo = useCallback(() => {
122
135
  if (historyIdx > 0) {
@@ -145,12 +158,13 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
145
158
  img.src = URL.createObjectURL(src);
146
159
  }
147
160
  else {
148
- img.crossOrigin = "anonymous";
161
+ img.crossOrigin = 'anonymous';
149
162
  img.src = src;
150
163
  }
151
164
  return () => {
152
- if (img.src.startsWith("blob:"))
165
+ if (img.src.startsWith('blob:')) {
153
166
  URL.revokeObjectURL(img.src);
167
+ }
154
168
  };
155
169
  }, [src]);
156
170
  // Push initial history once image loads
@@ -166,11 +180,15 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
166
180
  setRotation(prev.rotation);
167
181
  setFlipH(prev.flipH);
168
182
  setFlipV(prev.flipV);
169
- if (prev.cropRect)
183
+ if (prev.cropRect) {
170
184
  setCropRect(prev.cropRect);
171
- if (prev.overlays)
185
+ }
186
+ if (prev.overlays) {
172
187
  setOverlays(prev.overlays);
173
- setTimeout(() => { suppressHistoryRef.current = false; }, 50);
188
+ }
189
+ setTimeout(() => {
190
+ suppressHistoryRef.current = false;
191
+ }, 50);
174
192
  }
175
193
  }
176
194
  pushHistory();
@@ -179,30 +197,52 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
179
197
  }, [image]);
180
198
  // ── Render main canvas ──
181
199
  const renderMain = useCallback(() => {
182
- if (!image || !mainCanvasRef.current)
200
+ if (!image || !mainCanvasRef.current) {
183
201
  return;
202
+ }
184
203
  renderToCanvas(mainCanvasRef.current, image, selectedFilter, { ...filterParams, intensity: filterIntensity }, adjustments, cropMode ? null : cropRect, rotation, flipH, flipV);
185
204
  if (overlays.length > 0 || livePoints.length > 1) {
186
- const ctx = mainCanvasRef.current.getContext("2d");
205
+ const ctx = mainCanvasRef.current.getContext('2d');
187
206
  if (ctx) {
188
207
  const cw = mainCanvasRef.current.width;
189
208
  const ch = mainCanvasRef.current.height;
190
- if (overlays.length > 0)
209
+ if (overlays.length > 0) {
191
210
  renderAllOverlays(ctx, overlays, cw, ch);
192
- if (livePoints.length > 1)
211
+ }
212
+ if (livePoints.length > 1) {
193
213
  renderLiveStroke(ctx, livePoints, drawColor, drawWidth, cw, ch);
214
+ }
194
215
  }
195
216
  }
196
- }, [image, selectedFilter, filterParams, filterIntensity, adjustments, cropRect, cropMode, rotation, flipH, flipV, overlays, livePoints, drawColor, drawWidth]);
197
- useEffect(() => { renderMain(); }, [renderMain]);
217
+ }, [
218
+ image,
219
+ selectedFilter,
220
+ filterParams,
221
+ filterIntensity,
222
+ adjustments,
223
+ cropRect,
224
+ cropMode,
225
+ rotation,
226
+ flipH,
227
+ flipV,
228
+ overlays,
229
+ livePoints,
230
+ drawColor,
231
+ drawWidth,
232
+ ]);
233
+ useEffect(() => {
234
+ renderMain();
235
+ }, [renderMain]);
198
236
  // Render compare canvas (original)
199
237
  useEffect(() => {
200
- if (!image || !compareCanvasRef.current || !showCompare)
238
+ if (!image || !compareCanvasRef.current || !showCompare) {
201
239
  return;
240
+ }
202
241
  const canvas = compareCanvasRef.current;
203
- const ctx = canvas.getContext("2d");
204
- if (!ctx)
242
+ const ctx = canvas.getContext('2d');
243
+ if (!ctx) {
205
244
  return;
245
+ }
206
246
  const crop = cropRect !== null && cropRect !== void 0 ? cropRect : { x: 0, y: 0, w: image.naturalWidth, h: image.naturalHeight };
207
247
  canvas.width = crop.w;
208
248
  canvas.height = crop.h;
@@ -210,24 +250,27 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
210
250
  }, [image, showCompare, cropRect]);
211
251
  // ── Filter thumbnails ──
212
252
  const filteredList = useMemo(() => {
213
- if (filterCategory === "all")
253
+ if (filterCategory === 'all') {
214
254
  return PHOTO_FILTERS;
215
- return PHOTO_FILTERS.filter(f => f.category === filterCategory || f.id === "none");
255
+ }
256
+ return PHOTO_FILTERS.filter((f) => f.category === filterCategory || f.id === 'none');
216
257
  }, [filterCategory]);
217
258
  const generateThumbnail = useCallback((canvas, filter) => {
218
- if (!image)
259
+ if (!image) {
219
260
  return;
261
+ }
220
262
  const size = 64;
221
263
  canvas.width = size;
222
264
  canvas.height = size;
223
- const ctx = canvas.getContext("2d", { willReadFrequently: true });
224
- if (!ctx)
265
+ const ctx = canvas.getContext('2d', { willReadFrequently: true });
266
+ if (!ctx) {
225
267
  return;
268
+ }
226
269
  const s = Math.min(image.naturalWidth, image.naturalHeight);
227
270
  const sx = (image.naturalWidth - s) / 2;
228
271
  const sy = (image.naturalHeight - s) / 2;
229
272
  ctx.drawImage(image, sx, sy, s, s, 0, 0, size, size);
230
- if (filter.id !== "none") {
273
+ if (filter.id !== 'none') {
231
274
  const imgData = ctx.getImageData(0, 0, size, size);
232
275
  const filtered = filter.apply(imgData, { intensity: 1 });
233
276
  ctx.putImageData(filtered, 0, 0);
@@ -235,8 +278,9 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
235
278
  }, [image]);
236
279
  // ── Crop interaction ──
237
280
  const getCanvasScale = useCallback(() => {
238
- if (!mainCanvasRef.current || !containerRef.current || !image)
281
+ if (!mainCanvasRef.current || !containerRef.current || !image) {
239
282
  return { sx: 1, sy: 1, ox: 0, oy: 0 };
283
+ }
240
284
  const rect = mainCanvasRef.current.getBoundingClientRect();
241
285
  const cw = mainCanvasRef.current.width;
242
286
  const ch = mainCanvasRef.current.height;
@@ -249,31 +293,32 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
249
293
  setCropStart({ mx: e.clientX, my: e.clientY, rect: { ...cropRect } });
250
294
  }, [cropRect]);
251
295
  useEffect(() => {
252
- if (!cropDragging || !cropStart || !cropRect || !image)
296
+ if (!cropDragging || !cropStart || !cropRect || !image) {
253
297
  return;
298
+ }
254
299
  const handleMove = (e) => {
255
300
  const scale = getCanvasScale();
256
301
  const dx = (e.clientX - cropStart.mx) * scale.sx;
257
302
  const dy = (e.clientY - cropStart.my) * scale.sy;
258
303
  const r = { ...cropStart.rect };
259
304
  const minSize = 20;
260
- if (cropDragging === "move") {
305
+ if (cropDragging === 'move') {
261
306
  r.x = Math.max(0, Math.min(image.naturalWidth - r.w, r.x + dx));
262
307
  r.y = Math.max(0, Math.min(image.naturalHeight - r.h, r.y + dy));
263
308
  }
264
309
  else {
265
- if (cropDragging.includes("w")) {
310
+ if (cropDragging.includes('w')) {
266
311
  r.x += dx;
267
312
  r.w -= dx;
268
313
  }
269
- if (cropDragging.includes("e")) {
314
+ if (cropDragging.includes('e')) {
270
315
  r.w += dx;
271
316
  }
272
- if (cropDragging.includes("n")) {
317
+ if (cropDragging.includes('n')) {
273
318
  r.y += dy;
274
319
  r.h -= dy;
275
320
  }
276
- if (cropDragging.includes("s")) {
321
+ if (cropDragging.includes('s')) {
277
322
  r.h += dy;
278
323
  }
279
324
  if (r.w < minSize) {
@@ -283,7 +328,7 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
283
328
  r.h = minSize;
284
329
  }
285
330
  if (cropAspect) {
286
- if (cropDragging.includes("w") || cropDragging.includes("e")) {
331
+ if (cropDragging.includes('w') || cropDragging.includes('e')) {
287
332
  r.h = r.w / cropAspect;
288
333
  }
289
334
  else {
@@ -303,82 +348,87 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
303
348
  setCropStart(null);
304
349
  pushHistory();
305
350
  };
306
- window.addEventListener("mousemove", handleMove);
307
- window.addEventListener("mouseup", handleUp);
351
+ window.addEventListener('mousemove', handleMove);
352
+ window.addEventListener('mouseup', handleUp);
308
353
  return () => {
309
- window.removeEventListener("mousemove", handleMove);
310
- window.removeEventListener("mouseup", handleUp);
354
+ window.removeEventListener('mousemove', handleMove);
355
+ window.removeEventListener('mouseup', handleUp);
311
356
  };
312
357
  }, [cropDragging, cropStart, cropRect, image, cropAspect, getCanvasScale, pushHistory]);
313
358
  // Compare slider drag
314
359
  useEffect(() => {
315
- if (!compareDragging)
360
+ if (!compareDragging) {
316
361
  return;
362
+ }
317
363
  const handleMove = (e) => {
318
- if (!containerRef.current)
364
+ if (!containerRef.current) {
319
365
  return;
366
+ }
320
367
  const rect = containerRef.current.getBoundingClientRect();
321
368
  const pct = Math.max(0, Math.min(100, ((e.clientX - rect.left) / rect.width) * 100));
322
369
  setComparePosition(pct);
323
370
  };
324
371
  const handleUp = () => setCompareDragging(false);
325
- window.addEventListener("mousemove", handleMove);
326
- window.addEventListener("mouseup", handleUp);
372
+ window.addEventListener('mousemove', handleMove);
373
+ window.addEventListener('mouseup', handleUp);
327
374
  return () => {
328
- window.removeEventListener("mousemove", handleMove);
329
- window.removeEventListener("mouseup", handleUp);
375
+ window.removeEventListener('mousemove', handleMove);
376
+ window.removeEventListener('mouseup', handleUp);
330
377
  };
331
378
  }, [compareDragging]);
332
379
  // ── Keyboard shortcuts ──
333
380
  useEffect(() => {
334
381
  const handleKey = (e) => {
335
- if (e.ctrlKey && e.key === "z") {
382
+ if (e.ctrlKey && e.key === 'z') {
336
383
  e.preventDefault();
337
384
  undo();
338
385
  }
339
- if (e.ctrlKey && e.key === "y") {
386
+ if (e.ctrlKey && e.key === 'y') {
340
387
  e.preventDefault();
341
388
  redo();
342
389
  }
343
390
  };
344
- window.addEventListener("keydown", handleKey);
345
- return () => window.removeEventListener("keydown", handleKey);
391
+ window.addEventListener('keydown', handleKey);
392
+ return () => window.removeEventListener('keydown', handleKey);
346
393
  }, [undo, redo]);
347
394
  // ── Adjustments ──
348
395
  const handleAdjChange = useCallback((key, value) => {
349
- setAdjustments(prev => ({ ...prev, [key]: value }));
396
+ setAdjustments((prev) => ({ ...prev, [key]: value }));
350
397
  }, []);
351
398
  const handleAdjChangeEnd = useCallback(() => pushHistory(), [pushHistory]);
352
399
  // ── Overlay helpers ──
353
400
  const addOverlay = useCallback((ov) => {
354
- setOverlays(prev => [...prev, ov]);
401
+ setOverlays((prev) => [...prev, ov]);
355
402
  setSelectedOverlayId(ov.id);
356
403
  setTimeout(() => pushHistory(), 30);
357
404
  }, [pushHistory]);
358
405
  const updateOverlay = useCallback((id, patch) => {
359
- setOverlays(prev => prev.map(o => o.id === id ? { ...o, ...patch } : o));
406
+ setOverlays((prev) => prev.map((o) => (o.id === id ? { ...o, ...patch } : o)));
360
407
  }, []);
361
408
  const deleteOverlay = useCallback((id) => {
362
- setOverlays(prev => prev.filter(o => o.id !== id));
363
- if (selectedOverlayId === id)
409
+ setOverlays((prev) => prev.filter((o) => o.id !== id));
410
+ if (selectedOverlayId === id) {
364
411
  setSelectedOverlayId(null);
412
+ }
365
413
  setTimeout(() => pushHistory(), 30);
366
414
  }, [selectedOverlayId, pushHistory]);
367
415
  const moveOverlayForward = useCallback((id) => {
368
- setOverlays(prev => {
369
- const idx = prev.findIndex(o => o.id === id);
370
- if (idx < 0 || idx >= prev.length - 1)
416
+ setOverlays((prev) => {
417
+ const idx = prev.findIndex((o) => o.id === id);
418
+ if (idx < 0 || idx >= prev.length - 1) {
371
419
  return prev;
420
+ }
372
421
  const copy = [...prev];
373
422
  [copy[idx], copy[idx + 1]] = [copy[idx + 1], copy[idx]];
374
423
  return copy;
375
424
  });
376
425
  }, []);
377
426
  const moveOverlayBack = useCallback((id) => {
378
- setOverlays(prev => {
379
- const idx = prev.findIndex(o => o.id === id);
380
- if (idx <= 0)
427
+ setOverlays((prev) => {
428
+ const idx = prev.findIndex((o) => o.id === id);
429
+ if (idx <= 0) {
381
430
  return prev;
431
+ }
382
432
  const copy = [...prev];
383
433
  [copy[idx - 1], copy[idx]] = [copy[idx], copy[idx - 1]];
384
434
  return copy;
@@ -386,8 +436,9 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
386
436
  }, []);
387
437
  // ── Canvas fraction from mouse event ──
388
438
  const getCanvasFraction = useCallback((e) => {
389
- if (!mainCanvasRef.current)
439
+ if (!mainCanvasRef.current) {
390
440
  return { fx: 0.5, fy: 0.5 };
441
+ }
391
442
  const rect = mainCanvasRef.current.getBoundingClientRect();
392
443
  return {
393
444
  fx: Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width)),
@@ -397,10 +448,11 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
397
448
  // ── Canvas mouse handlers ──
398
449
  const handleCanvasMouseDown = useCallback((e) => {
399
450
  var _a, _b, _c, _d;
400
- if (cropMode)
451
+ if (cropMode) {
401
452
  return;
453
+ }
402
454
  const { fx, fy } = getCanvasFraction(e);
403
- if (activeTab === "draw") {
455
+ if (activeTab === 'draw') {
404
456
  e.preventDefault();
405
457
  setIsDrawing(true);
406
458
  setLivePoints([[fx, fy]]);
@@ -422,7 +474,7 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
422
474
  const handleCanvasMouseMove = useCallback((e) => {
423
475
  const { fx, fy } = getCanvasFraction(e);
424
476
  if (isDrawing) {
425
- setLivePoints(prev => [...prev, [fx, fy]]);
477
+ setLivePoints((prev) => [...prev, [fx, fy]]);
426
478
  return;
427
479
  }
428
480
  if (overlayDragging && overlayDragStart && selectedOverlayId) {
@@ -433,19 +485,31 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
433
485
  y: Math.max(0, Math.min(1, overlayDragStart.oy + dy)),
434
486
  });
435
487
  }
436
- }, [getCanvasFraction, isDrawing, overlayDragging, overlayDragStart, selectedOverlayId, updateOverlay]);
488
+ }, [
489
+ getCanvasFraction,
490
+ isDrawing,
491
+ overlayDragging,
492
+ overlayDragStart,
493
+ selectedOverlayId,
494
+ updateOverlay,
495
+ ]);
437
496
  const handleCanvasMouseUp = useCallback(() => {
438
497
  if (isDrawing && livePoints.length > 1) {
439
- const stroke = { points: [...livePoints], color: drawColor, width: drawWidth, opacity: 1 };
498
+ const stroke = {
499
+ points: [...livePoints],
500
+ color: drawColor,
501
+ width: drawWidth,
502
+ opacity: 1,
503
+ };
440
504
  if (!drawingOverlayRef.current) {
441
505
  const dOv = createDrawingOverlay();
442
506
  dOv.strokes.push(stroke);
443
507
  drawingOverlayRef.current = dOv;
444
- setOverlays(prev => [...prev, dOv]);
508
+ setOverlays((prev) => [...prev, dOv]);
445
509
  }
446
510
  else {
447
511
  const id = drawingOverlayRef.current.id;
448
- setOverlays(prev => prev.map(o => o.id === id && o.type === "drawing"
512
+ setOverlays((prev) => prev.map((o) => o.id === id && o.type === 'drawing'
449
513
  ? { ...o, strokes: [...o.strokes, stroke] }
450
514
  : o));
451
515
  }
@@ -464,21 +528,46 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
464
528
  }, [isDrawing, livePoints, drawColor, drawWidth, overlayDragging, pushHistory]);
465
529
  // ── Actions ──
466
530
  const buildExportParams = useCallback(() => {
467
- if (!image)
531
+ if (!image) {
468
532
  return null;
469
- return { image, selectedFilter, filterParams, filterIntensity, adjustments, cropRect, rotation, flipH, flipV, overlays };
470
- }, [image, selectedFilter, filterParams, filterIntensity, adjustments, cropRect, rotation, flipH, flipV, overlays]);
533
+ }
534
+ return {
535
+ image,
536
+ selectedFilter,
537
+ filterParams,
538
+ filterIntensity,
539
+ adjustments,
540
+ cropRect,
541
+ rotation,
542
+ flipH,
543
+ flipV,
544
+ overlays,
545
+ };
546
+ }, [
547
+ image,
548
+ selectedFilter,
549
+ filterParams,
550
+ filterIntensity,
551
+ adjustments,
552
+ cropRect,
553
+ rotation,
554
+ flipH,
555
+ flipV,
556
+ overlays,
557
+ ]);
471
558
  const handleSave = useCallback(async () => {
472
- if (!image || !mainCanvasRef.current)
559
+ if (!image || !mainCanvasRef.current) {
473
560
  return;
474
- const exportCanvas = document.createElement("canvas");
561
+ }
562
+ const exportCanvas = document.createElement('canvas');
475
563
  renderToCanvas(exportCanvas, image, selectedFilter, { ...filterParams, intensity: filterIntensity }, adjustments, cropRect, rotation, flipH, flipV);
476
564
  if (overlays.length > 0) {
477
- const ctx = exportCanvas.getContext("2d");
478
- if (ctx)
565
+ const ctx = exportCanvas.getContext('2d');
566
+ if (ctx) {
479
567
  renderAllOverlays(ctx, overlays, exportCanvas.width, exportCanvas.height);
568
+ }
480
569
  }
481
- const file = await canvasToFile(exportCanvas, "player-photo.jpg", 0.92);
570
+ const file = await canvasToFile(exportCanvas, 'player-photo.jpg', 0.92);
482
571
  const editorState = serializeEditorState({
483
572
  filter: selectedFilter,
484
573
  filterIntensity,
@@ -490,9 +579,21 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
490
579
  overlays,
491
580
  });
492
581
  onSave(file, editorState);
493
- }, [image, selectedFilter, filterParams, filterIntensity, adjustments, cropRect, rotation, flipH, flipV, overlays, onSave]);
582
+ }, [
583
+ image,
584
+ selectedFilter,
585
+ filterParams,
586
+ filterIntensity,
587
+ adjustments,
588
+ cropRect,
589
+ rotation,
590
+ flipH,
591
+ flipV,
592
+ overlays,
593
+ onSave,
594
+ ]);
494
595
  const handleReset = useCallback(() => {
495
- setSelectedFilter("none");
596
+ setSelectedFilter('none');
496
597
  setFilterIntensity(1);
497
598
  setAdjustments({ ...DEFAULT_ADJUSTMENTS });
498
599
  setRotation(0);
@@ -509,25 +610,30 @@ function usePhotoEditor({ src, playerColor = "#00aaff", onSave, onCancel, initia
509
610
  }, [image, pushHistory]);
510
611
  const handleDownload = useCallback(async () => {
511
612
  const p = buildExportParams();
512
- if (!p)
613
+ if (!p) {
513
614
  return;
615
+ }
514
616
  const blob = await getExportBlob(p);
515
- if (blob)
617
+ if (blob) {
516
618
  handleDownloadBlob(blob);
619
+ }
517
620
  }, [buildExportParams]);
518
621
  const handleCopyToClipboard = useCallback(async () => {
519
622
  const p = buildExportParams();
520
- if (!p)
623
+ if (!p) {
521
624
  return;
625
+ }
522
626
  await handleCopyImageToClipboard(p);
523
627
  }, [buildExportParams]);
524
628
  const handleShareNative = useCallback(async () => {
525
629
  const p = buildExportParams();
526
- if (!p)
630
+ if (!p) {
527
631
  return;
632
+ }
528
633
  const blob = await getExportBlob(p);
529
- if (blob)
634
+ if (blob) {
530
635
  await handleNativeShare(blob);
636
+ }
531
637
  }, [buildExportParams]);
532
638
  // ── Return ──
533
639
  return {