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