@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
@@ -5,30 +5,31 @@ import React from 'react';
5
5
  const DEFAULT_ICON_CONFIG = {
6
6
  viewBox: 24,
7
7
  strokeWidth: 2,
8
- strokeLinecap: "round",
9
- strokeLinejoin: "round",
10
- fill: "none",
11
- stroke: "currentColor",
12
- variant: "outline",
8
+ strokeLinecap: 'round',
9
+ strokeLinejoin: 'round',
10
+ fill: 'none',
11
+ stroke: 'currentColor',
12
+ variant: 'outline',
13
13
  };
14
14
  // ── Hook ────────────────────────────────────────────────────────
15
15
  function useIconEditor(initialSvg) {
16
16
  const [config, setConfig] = React.useState(DEFAULT_ICON_CONFIG);
17
17
  const [shapes, setShapes] = React.useState([]);
18
18
  const [selectedId, setSelectedId] = React.useState(null);
19
- const [tool, setTool] = React.useState("select");
19
+ const [tool, setTool] = React.useState('select');
20
20
  const [snapToGrid, setSnapToGrid] = React.useState(true);
21
21
  const [historyIdx, setHistoryIdx] = React.useState(0);
22
22
  const historyRef = React.useRef([[]]);
23
23
  // Parse initial SVG
24
24
  React.useEffect(() => {
25
- if (!initialSvg)
25
+ if (!initialSvg) {
26
26
  return;
27
+ }
27
28
  const pathMatches = initialSvg.matchAll(/<path[^>]*d="([^"]*)"[^>]*\/?>/g);
28
29
  const parsed = [];
29
30
  let id = 0;
30
31
  for (const match of pathMatches) {
31
- parsed.push({ id: `shape-${id++}`, type: "path", d: match[1] });
32
+ parsed.push({ id: `shape-${id++}`, type: 'path', d: match[1] });
32
33
  }
33
34
  if (parsed.length > 0) {
34
35
  setShapes(parsed);
@@ -40,20 +41,23 @@ function useIconEditor(initialSvg) {
40
41
  const snap = JSON.parse(JSON.stringify(newShapes));
41
42
  historyRef.current = historyRef.current.slice(0, historyIdx + 1);
42
43
  historyRef.current.push(snap);
43
- if (historyRef.current.length > 50)
44
+ if (historyRef.current.length > 50) {
44
45
  historyRef.current.shift();
46
+ }
45
47
  setHistoryIdx(historyRef.current.length - 1);
46
48
  }, [historyIdx]);
47
49
  const undo = React.useCallback(() => {
48
- if (historyIdx <= 0)
50
+ if (historyIdx <= 0) {
49
51
  return;
52
+ }
50
53
  const newIdx = historyIdx - 1;
51
54
  setHistoryIdx(newIdx);
52
55
  setShapes(JSON.parse(JSON.stringify(historyRef.current[newIdx])));
53
56
  }, [historyIdx]);
54
57
  const redo = React.useCallback(() => {
55
- if (historyIdx >= historyRef.current.length - 1)
58
+ if (historyIdx >= historyRef.current.length - 1) {
56
59
  return;
60
+ }
57
61
  const newIdx = historyIdx + 1;
58
62
  setHistoryIdx(newIdx);
59
63
  setShapes(JSON.parse(JSON.stringify(historyRef.current[newIdx])));
@@ -73,61 +77,73 @@ function useIconEditor(initialSvg) {
73
77
  const deleteShape = React.useCallback((id) => {
74
78
  const newShapes = shapes.filter((s) => s.id !== id);
75
79
  setShapes(newShapes);
76
- if (selectedId === id)
80
+ if (selectedId === id) {
77
81
  setSelectedId(null);
82
+ }
78
83
  pushHistory(newShapes);
79
84
  }, [shapes, selectedId, pushHistory]);
80
85
  const toSvg = React.useCallback(() => {
81
86
  const vb = config.viewBox;
82
- const children = shapes.map((s) => {
87
+ const children = shapes
88
+ .map((s) => {
83
89
  var _a, _b, _c;
84
90
  const fill = (_a = s.fill) !== null && _a !== void 0 ? _a : config.fill;
85
91
  const stroke = (_b = s.stroke) !== null && _b !== void 0 ? _b : config.stroke;
86
92
  const sw = (_c = s.strokeWidth) !== null && _c !== void 0 ? _c : config.strokeWidth;
87
93
  switch (s.type) {
88
- case "path":
94
+ case 'path':
89
95
  return ` <path d="${s.d}" fill="${fill}" stroke="${stroke}" stroke-width="${sw}" stroke-linecap="${config.strokeLinecap}" stroke-linejoin="${config.strokeLinejoin}" />`;
90
- case "circle":
96
+ case 'circle':
91
97
  return ` <circle cx="${s.cx}" cy="${s.cy}" r="${s.r}" fill="${fill}" stroke="${stroke}" stroke-width="${sw}" />`;
92
- case "rect":
98
+ case 'rect':
93
99
  return ` <rect x="${s.x}" y="${s.y}" width="${s.width}" height="${s.height}" fill="${fill}" stroke="${stroke}" stroke-width="${sw}" rx="1" />`;
94
- case "line":
100
+ case 'line':
95
101
  return ` <line x1="${s.x1}" y1="${s.y1}" x2="${s.x2}" y2="${s.y2}" stroke="${stroke}" stroke-width="${sw}" stroke-linecap="${config.strokeLinecap}" />`;
96
102
  default:
97
- return "";
103
+ return '';
98
104
  }
99
- }).join("\n");
105
+ })
106
+ .join('\n');
100
107
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${vb}" height="${vb}" viewBox="0 0 ${vb} ${vb}" fill="${config.fill}" stroke="${config.stroke}" stroke-width="${config.strokeWidth}" stroke-linecap="${config.strokeLinecap}" stroke-linejoin="${config.strokeLinejoin}">\n${children}\n</svg>`;
101
108
  }, [shapes, config]);
102
109
  const toReactComponent = React.useCallback((name) => {
103
110
  const svg = toSvg();
104
111
  const inner = svg
105
- .replace(/<svg[^>]*>/, "")
106
- .replace(/<\/svg>/, "")
112
+ .replace(/<svg[^>]*>/, '')
113
+ .replace(/<\/svg>/, '')
107
114
  .trim()
108
- .replace(/stroke-width/g, "strokeWidth")
109
- .replace(/stroke-linecap/g, "strokeLinecap")
110
- .replace(/stroke-linejoin/g, "strokeLinejoin")
111
- .replace(/fill-rule/g, "fillRule")
112
- .replace(/clip-rule/g, "clipRule");
115
+ .replace(/stroke-width/g, 'strokeWidth')
116
+ .replace(/stroke-linecap/g, 'strokeLinecap')
117
+ .replace(/stroke-linejoin/g, 'strokeLinejoin')
118
+ .replace(/fill-rule/g, 'fillRule')
119
+ .replace(/clip-rule/g, 'clipRule');
113
120
  return `import React from "react";\n\nexport const ${name}: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 ${config.viewBox} ${config.viewBox}" fill="${config.fill}" stroke="${config.stroke}" strokeWidth="${config.strokeWidth}" strokeLinecap="${config.strokeLinecap}" strokeLinejoin="${config.strokeLinejoin}" {...props}>\n ${inner}\n </svg>\n);\n`;
114
121
  }, [toSvg, config]);
115
122
  return {
116
- config, setConfig,
117
- shapes, setShapes,
118
- selectedId, setSelectedId,
119
- tool, setTool,
120
- addShape, updateShape, deleteShape,
121
- toSvg, toReactComponent,
122
- undo, redo,
123
+ config,
124
+ setConfig,
125
+ shapes,
126
+ setShapes,
127
+ selectedId,
128
+ setSelectedId,
129
+ tool,
130
+ setTool,
131
+ addShape,
132
+ updateShape,
133
+ deleteShape,
134
+ toSvg,
135
+ toReactComponent,
136
+ undo,
137
+ redo,
123
138
  canUndo: historyIdx > 0,
124
139
  canRedo: historyIdx < historyRef.current.length - 1,
125
- snapToGrid, setSnapToGrid,
140
+ snapToGrid,
141
+ setSnapToGrid,
126
142
  };
127
143
  }
128
144
  // ── Component ───────────────────────────────────────────────────
129
145
  /** SVG icon editor with grid, snap, drawing, and export capabilities. */
130
- const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className = "", }) => {
146
+ const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className = '', }) => {
131
147
  const editor = useIconEditor(initialSvg);
132
148
  const svgRef = React.useRef(null);
133
149
  const drawing = React.useRef(false);
@@ -139,47 +155,56 @@ const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className
139
155
  // Keyboard shortcuts
140
156
  React.useEffect(() => {
141
157
  const handler = (e) => {
142
- if (e.key === "Delete" && editor.selectedId) {
158
+ if (e.key === 'Delete' && editor.selectedId) {
143
159
  editor.deleteShape(editor.selectedId);
144
160
  return;
145
161
  }
146
- if (e.ctrlKey && e.key === "z") {
162
+ if (e.ctrlKey && e.key === 'z') {
147
163
  e.preventDefault();
148
164
  editor.undo();
149
165
  return;
150
166
  }
151
- if (e.ctrlKey && e.key === "y") {
167
+ if (e.ctrlKey && e.key === 'y') {
152
168
  e.preventDefault();
153
169
  editor.redo();
154
170
  return;
155
171
  }
156
- if (e.key === "v" && !e.ctrlKey)
157
- editor.setTool("select");
158
- if (e.key === "c" && !e.ctrlKey)
159
- editor.setTool("circle");
160
- if (e.key === "r" && !e.ctrlKey)
161
- editor.setTool("rect");
162
- if (e.key === "l" && !e.ctrlKey)
163
- editor.setTool("line");
164
- if (e.key === "p" && !e.ctrlKey)
165
- editor.setTool("path");
166
- if (e.key === "g" && !e.ctrlKey)
167
- editor.setSnapToGrid(s => !s);
168
- if (e.key === "Escape")
172
+ if (e.key === 'v' && !e.ctrlKey) {
173
+ editor.setTool('select');
174
+ }
175
+ if (e.key === 'c' && !e.ctrlKey) {
176
+ editor.setTool('circle');
177
+ }
178
+ if (e.key === 'r' && !e.ctrlKey) {
179
+ editor.setTool('rect');
180
+ }
181
+ if (e.key === 'l' && !e.ctrlKey) {
182
+ editor.setTool('line');
183
+ }
184
+ if (e.key === 'p' && !e.ctrlKey) {
185
+ editor.setTool('path');
186
+ }
187
+ if (e.key === 'g' && !e.ctrlKey) {
188
+ editor.setSnapToGrid((s) => !s);
189
+ }
190
+ if (e.key === 'Escape') {
169
191
  editor.setSelectedId(null);
192
+ }
170
193
  };
171
- window.addEventListener("keydown", handler);
172
- return () => window.removeEventListener("keydown", handler);
194
+ window.addEventListener('keydown', handler);
195
+ return () => window.removeEventListener('keydown', handler);
173
196
  }, [editor]);
174
197
  const snapCoord = (v) => {
175
- if (!editor.snapToGrid)
198
+ if (!editor.snapToGrid) {
176
199
  return v;
200
+ }
177
201
  return Math.round(v * 2) / 2; // snap to 0.5 grid
178
202
  };
179
203
  const getSvgCoord = (e) => {
180
204
  const svg = svgRef.current;
181
- if (!svg)
205
+ if (!svg) {
182
206
  return { x: 0, y: 0 };
207
+ }
183
208
  const rect = svg.getBoundingClientRect();
184
209
  return {
185
210
  x: snapCoord(((e.clientX - rect.left) / rect.width) * vb),
@@ -188,14 +213,19 @@ const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className
188
213
  };
189
214
  const handleMouseDown = (e) => {
190
215
  const { x, y } = getSvgCoord(e);
191
- if (editor.tool === "select") {
216
+ if (editor.tool === 'select') {
192
217
  // Check if clicking on a shape for drag
193
- const hit = editor.shapes.find(s => {
218
+ const hit = editor.shapes.find((s) => {
194
219
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
195
- if (s.type === "rect")
196
- return x >= ((_a = s.x) !== null && _a !== void 0 ? _a : 0) && x <= ((_b = s.x) !== null && _b !== void 0 ? _b : 0) + ((_c = s.width) !== null && _c !== void 0 ? _c : 0) && y >= ((_d = s.y) !== null && _d !== void 0 ? _d : 0) && y <= ((_e = s.y) !== null && _e !== void 0 ? _e : 0) + ((_f = s.height) !== null && _f !== void 0 ? _f : 0);
197
- if (s.type === "circle")
220
+ if (s.type === 'rect') {
221
+ return (x >= ((_a = s.x) !== null && _a !== void 0 ? _a : 0) &&
222
+ x <= ((_b = s.x) !== null && _b !== void 0 ? _b : 0) + ((_c = s.width) !== null && _c !== void 0 ? _c : 0) &&
223
+ y >= ((_d = s.y) !== null && _d !== void 0 ? _d : 0) &&
224
+ y <= ((_e = s.y) !== null && _e !== void 0 ? _e : 0) + ((_f = s.height) !== null && _f !== void 0 ? _f : 0));
225
+ }
226
+ if (s.type === 'circle') {
198
227
  return Math.hypot(x - ((_g = s.cx) !== null && _g !== void 0 ? _g : 0), y - ((_h = s.cy) !== null && _h !== void 0 ? _h : 0)) <= ((_j = s.r) !== null && _j !== void 0 ? _j : 0);
228
+ }
199
229
  return false;
200
230
  });
201
231
  if (hit) {
@@ -210,14 +240,14 @@ const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className
210
240
  }
211
241
  drawing.current = true;
212
242
  drawStart.current = { x, y };
213
- if (editor.tool === "circle") {
214
- setPendingShape({ id: "pending", type: "circle", cx: x, cy: y, r: 0 });
243
+ if (editor.tool === 'circle') {
244
+ setPendingShape({ id: 'pending', type: 'circle', cx: x, cy: y, r: 0 });
215
245
  }
216
- else if (editor.tool === "rect") {
217
- setPendingShape({ id: "pending", type: "rect", x, y, width: 0, height: 0 });
246
+ else if (editor.tool === 'rect') {
247
+ setPendingShape({ id: 'pending', type: 'rect', x, y, width: 0, height: 0 });
218
248
  }
219
- else if (editor.tool === "line") {
220
- setPendingShape({ id: "pending", type: "line", x1: x, y1: y, x2: x, y2: y });
249
+ else if (editor.tool === 'line') {
250
+ setPendingShape({ id: 'pending', type: 'line', x1: x, y1: y, x2: x, y2: y });
221
251
  }
222
252
  };
223
253
  const handleMouseMove = (e) => {
@@ -227,27 +257,43 @@ const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className
227
257
  if (draggingShape.current) {
228
258
  const dx = x - dragStart.current.x;
229
259
  const dy = y - dragStart.current.y;
230
- const shape = editor.shapes.find(s => s.id === draggingShape.current);
260
+ const shape = editor.shapes.find((s) => s.id === draggingShape.current);
231
261
  if (shape) {
232
- if (shape.type === "rect")
262
+ if (shape.type === 'rect') {
233
263
  editor.updateShape(shape.id, { x: ((_a = shape.x) !== null && _a !== void 0 ? _a : 0) + dx, y: ((_b = shape.y) !== null && _b !== void 0 ? _b : 0) + dy });
234
- if (shape.type === "circle")
264
+ }
265
+ if (shape.type === 'circle') {
235
266
  editor.updateShape(shape.id, { cx: ((_c = shape.cx) !== null && _c !== void 0 ? _c : 0) + dx, cy: ((_d = shape.cy) !== null && _d !== void 0 ? _d : 0) + dy });
267
+ }
236
268
  dragStart.current = { x, y };
237
269
  }
238
270
  return;
239
271
  }
240
- if (!drawing.current)
272
+ if (!drawing.current) {
241
273
  return;
274
+ }
242
275
  const sx = drawStart.current.x, sy = drawStart.current.y;
243
- if (editor.tool === "circle") {
244
- setPendingShape({ id: "pending", type: "circle", cx: sx, cy: sy, r: Math.hypot(x - sx, y - sy) });
276
+ if (editor.tool === 'circle') {
277
+ setPendingShape({
278
+ id: 'pending',
279
+ type: 'circle',
280
+ cx: sx,
281
+ cy: sy,
282
+ r: Math.hypot(x - sx, y - sy),
283
+ });
245
284
  }
246
- else if (editor.tool === "rect") {
247
- setPendingShape({ id: "pending", type: "rect", x: Math.min(sx, x), y: Math.min(sy, y), width: Math.abs(x - sx), height: Math.abs(y - sy) });
285
+ else if (editor.tool === 'rect') {
286
+ setPendingShape({
287
+ id: 'pending',
288
+ type: 'rect',
289
+ x: Math.min(sx, x),
290
+ y: Math.min(sy, y),
291
+ width: Math.abs(x - sx),
292
+ height: Math.abs(y - sy),
293
+ });
248
294
  }
249
- else if (editor.tool === "line") {
250
- setPendingShape({ id: "pending", type: "line", x1: sx, y1: sy, x2: x, y2: y });
295
+ else if (editor.tool === 'line') {
296
+ setPendingShape({ id: 'pending', type: 'line', x1: sx, y1: sy, x2: x, y2: y });
251
297
  }
252
298
  };
253
299
  const handleMouseUp = () => {
@@ -260,17 +306,20 @@ const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className
260
306
  drawing.current = false;
261
307
  // Only add if shape has non-zero size
262
308
  const { id: _, ...shapeData } = pendingShape;
263
- if (pendingShape.type === "circle" && ((_a = pendingShape.r) !== null && _a !== void 0 ? _a : 0) > 0.2) {
309
+ if (pendingShape.type === 'circle' && ((_a = pendingShape.r) !== null && _a !== void 0 ? _a : 0) > 0.2) {
264
310
  editor.addShape(shapeData);
265
311
  }
266
- else if (pendingShape.type === "rect" && ((_b = pendingShape.width) !== null && _b !== void 0 ? _b : 0) > 0.2 && ((_c = pendingShape.height) !== null && _c !== void 0 ? _c : 0) > 0.2) {
312
+ else if (pendingShape.type === 'rect' &&
313
+ ((_b = pendingShape.width) !== null && _b !== void 0 ? _b : 0) > 0.2 &&
314
+ ((_c = pendingShape.height) !== null && _c !== void 0 ? _c : 0) > 0.2) {
267
315
  editor.addShape(shapeData);
268
316
  }
269
- else if (pendingShape.type === "line") {
317
+ else if (pendingShape.type === 'line') {
270
318
  const dx = ((_d = pendingShape.x2) !== null && _d !== void 0 ? _d : 0) - ((_e = pendingShape.x1) !== null && _e !== void 0 ? _e : 0);
271
319
  const dy = ((_f = pendingShape.y2) !== null && _f !== void 0 ? _f : 0) - ((_g = pendingShape.y1) !== null && _g !== void 0 ? _g : 0);
272
- if (Math.hypot(dx, dy) > 0.2)
320
+ if (Math.hypot(dx, dy) > 0.2) {
273
321
  editor.addShape(shapeData);
322
+ }
274
323
  }
275
324
  setPendingShape(null);
276
325
  };
@@ -279,20 +328,28 @@ const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className
279
328
  const svg = editor.toSvg();
280
329
  const pngSizes = new Map();
281
330
  for (const size of sizes) {
282
- const canvas = document.createElement("canvas");
331
+ const canvas = document.createElement('canvas');
283
332
  canvas.width = size;
284
333
  canvas.height = size;
285
- const ctx = canvas.getContext("2d");
334
+ const ctx = canvas.getContext('2d');
286
335
  const img = new Image();
287
- const blob = new Blob([svg], { type: "image/svg+xml" });
336
+ const blob = new Blob([svg], { type: 'image/svg+xml' });
288
337
  const url = URL.createObjectURL(blob);
289
338
  await new Promise((resolve) => {
290
- img.onload = () => { ctx.drawImage(img, 0, 0, size, size); canvas.toBlob((b) => { if (b)
291
- pngSizes.set(size, b); URL.revokeObjectURL(url); resolve(); }, "image/png"); };
339
+ img.onload = () => {
340
+ ctx.drawImage(img, 0, 0, size, size);
341
+ canvas.toBlob((b) => {
342
+ if (b) {
343
+ pngSizes.set(size, b);
344
+ }
345
+ URL.revokeObjectURL(url);
346
+ resolve();
347
+ }, 'image/png');
348
+ };
292
349
  img.src = url;
293
350
  });
294
351
  }
295
- onExport === null || onExport === void 0 ? void 0 : onExport({ svg, reactComponent: editor.toReactComponent("MyIcon"), pngSizes });
352
+ onExport === null || onExport === void 0 ? void 0 : onExport({ svg, reactComponent: editor.toReactComponent('MyIcon'), pngSizes });
296
353
  };
297
354
  const renderShape = (s, isPending = false) => {
298
355
  var _a, _b, _c;
@@ -300,31 +357,197 @@ const NiceIconEditor = ({ initialSvg, gridSize = 24, onSave, onExport, className
300
357
  const stroke = (_b = s.stroke) !== null && _b !== void 0 ? _b : editor.config.stroke;
301
358
  const sw = (_c = s.strokeWidth) !== null && _c !== void 0 ? _c : editor.config.strokeWidth;
302
359
  const isSelected = !isPending && s.id === editor.selectedId;
303
- const selProps = isSelected ? { strokeDasharray: "0.5 0.3" } : {};
304
- const evtProps = isPending ? {} : { onClick: (e) => { e.stopPropagation(); editor.setSelectedId(s.id); }, style: { cursor: "pointer" } };
360
+ const selProps = isSelected ? { strokeDasharray: '0.5 0.3' } : {};
361
+ const evtProps = isPending
362
+ ? {}
363
+ : {
364
+ onClick: (e) => {
365
+ e.stopPropagation();
366
+ editor.setSelectedId(s.id);
367
+ },
368
+ style: { cursor: 'pointer' },
369
+ };
305
370
  switch (s.type) {
306
- case "path": return jsx("path", { d: s.d, fill: fill, stroke: isSelected ? "#339af0" : stroke, strokeWidth: sw * (vb / 400), strokeLinecap: editor.config.strokeLinecap, strokeLinejoin: editor.config.strokeLinejoin, ...evtProps }, s.id);
307
- case "circle": return jsx("circle", { cx: s.cx, cy: s.cy, r: s.r, fill: isPending ? "rgba(51,154,240,0.15)" : fill, stroke: isSelected ? "#339af0" : (isPending ? "#339af0" : stroke), strokeWidth: sw * (vb / 400), ...selProps, ...evtProps }, s.id);
308
- case "rect": return jsx("rect", { x: s.x, y: s.y, width: s.width, height: s.height, fill: isPending ? "rgba(51,154,240,0.15)" : fill, stroke: isSelected ? "#339af0" : (isPending ? "#339af0" : stroke), strokeWidth: sw * (vb / 400), rx: 0.3, ...selProps, ...evtProps }, s.id);
309
- case "line": return jsx("line", { x1: s.x1, y1: s.y1, x2: s.x2, y2: s.y2, stroke: isSelected ? "#339af0" : (isPending ? "#339af0" : stroke), strokeWidth: sw * (vb / 400), strokeLinecap: editor.config.strokeLinecap, ...selProps, ...evtProps }, s.id);
310
- default: return null;
371
+ case 'path':
372
+ return (jsx("path", { d: s.d, fill: fill, stroke: isSelected ? '#339af0' : stroke, strokeWidth: sw * (vb / 400), strokeLinecap: editor.config.strokeLinecap, strokeLinejoin: editor.config.strokeLinejoin, ...evtProps }, s.id));
373
+ case 'circle':
374
+ return (jsx("circle", { cx: s.cx, cy: s.cy, r: s.r, fill: isPending ? 'rgba(51,154,240,0.15)' : fill, stroke: isSelected ? '#339af0' : isPending ? '#339af0' : stroke, strokeWidth: sw * (vb / 400), ...selProps, ...evtProps }, s.id));
375
+ case 'rect':
376
+ return (jsx("rect", { x: s.x, y: s.y, width: s.width, height: s.height, fill: isPending ? 'rgba(51,154,240,0.15)' : fill, stroke: isSelected ? '#339af0' : isPending ? '#339af0' : stroke, strokeWidth: sw * (vb / 400), rx: 0.3, ...selProps, ...evtProps }, s.id));
377
+ case 'line':
378
+ return (jsx("line", { x1: s.x1, y1: s.y1, x2: s.x2, y2: s.y2, stroke: isSelected ? '#339af0' : isPending ? '#339af0' : stroke, strokeWidth: sw * (vb / 400), strokeLinecap: editor.config.strokeLinecap, ...selProps, ...evtProps }, s.id));
379
+ default:
380
+ return null;
311
381
  }
312
382
  };
313
383
  const toolBtnStyle = (active) => ({
314
- padding: "4px 8px", borderRadius: 4, border: "none", cursor: "pointer",
315
- background: active ? "#339af0" : "#2c2e33", color: active ? "#fff" : "#c1c2c5", fontSize: 11,
384
+ padding: '4px 8px',
385
+ borderRadius: 4,
386
+ border: 'none',
387
+ cursor: 'pointer',
388
+ background: active ? '#339af0' : '#2c2e33',
389
+ color: active ? '#fff' : '#c1c2c5',
390
+ fontSize: 11,
316
391
  });
317
- return (jsxs("div", { className: `nice-icon-editor ${className}`, style: { display: "flex", flexDirection: "column", gap: 8, background: "#1a1b1e", color: "#c1c2c5", padding: 12, borderRadius: 8 }, children: [jsxs("div", { style: { display: "flex", gap: 4, fontSize: 12, alignItems: "center", flexWrap: "wrap" }, children: [["select", "path", "circle", "rect", "line"].map((t) => (jsxs("button", { onClick: () => editor.setTool(t), style: toolBtnStyle(editor.tool === t), children: [t, " (", t[0], ")"] }, t))), jsx("div", { style: { width: 1, height: 20, background: "#373a40" } }), jsx("button", { onClick: editor.undo, disabled: !editor.canUndo, style: toolBtnStyle(false), title: "Undo (Ctrl+Z)", children: "\u21A9" }), jsx("button", { onClick: editor.redo, disabled: !editor.canRedo, style: toolBtnStyle(false), title: "Redo (Ctrl+Y)", children: "\u21AA" }), jsx("div", { style: { width: 1, height: 20, background: "#373a40" } }), jsx("button", { onClick: () => editor.setSnapToGrid(s => !s), style: toolBtnStyle(editor.snapToGrid), title: "Snap to Grid (G)", children: "\u229E" }), editor.selectedId && jsx("button", { onClick: () => editor.deleteShape(editor.selectedId), style: { ...toolBtnStyle(false), color: "#ff6b6b" }, title: "Delete (Del)", children: "\u2715" }), jsx("div", { style: { flex: 1 } }), jsx("button", { onClick: handleSave, style: { padding: "4px 12px", borderRadius: 4, border: "none", cursor: "pointer", background: "#2f9e44", color: "#fff", fontSize: 11 }, children: "Save SVG" }), jsx("button", { onClick: () => handleExportPng(), style: { padding: "4px 12px", borderRadius: 4, border: "none", cursor: "pointer", background: "#228be6", color: "#fff", fontSize: 11 }, children: "Export PNG" })] }), jsxs("div", { style: { display: "flex", gap: 12 }, children: [jsx("div", { style: { width: 400, height: 400, background: "#141517", borderRadius: 6, position: "relative", overflow: "hidden" }, children: jsxs("svg", { ref: svgRef, width: 400, height: 400, viewBox: `0 0 ${vb} ${vb}`, style: { position: "absolute", inset: 0, cursor: editor.tool === "select" ? "default" : "crosshair" }, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, children: [Array.from({ length: vb + 1 }, (_, i) => (jsxs(React.Fragment, { children: [jsx("line", { x1: i, y1: 0, x2: i, y2: vb, stroke: "rgba(255,255,255,0.08)", strokeWidth: 0.05 }), jsx("line", { x1: 0, y1: i, x2: vb, y2: i, stroke: "rgba(255,255,255,0.08)", strokeWidth: 0.05 })] }, `g${i}`))), jsx("line", { x1: vb / 2, y1: 0, x2: vb / 2, y2: vb, stroke: "rgba(255,255,255,0.15)", strokeWidth: 0.05 }), jsx("line", { x1: 0, y1: vb / 2, x2: vb, y2: vb / 2, stroke: "rgba(255,255,255,0.15)", strokeWidth: 0.05 }), editor.shapes.map(s => renderShape(s)), pendingShape && renderShape(pendingShape, true)] }) }), jsxs("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: 8, fontSize: 12 }, children: [jsxs("div", { children: [jsx("label", { children: "Grid Size: " }), jsxs("select", { value: editor.config.viewBox, onChange: e => editor.setConfig({ ...editor.config, viewBox: Number(e.target.value) }), style: { background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 3, padding: 2 }, children: [jsx("option", { value: 16, children: "16\u00D716" }), jsx("option", { value: 24, children: "24\u00D724" }), jsx("option", { value: 32, children: "32\u00D732" }), jsx("option", { value: 48, children: "48\u00D748" })] })] }), jsxs("div", { children: [jsx("label", { children: "Stroke Width: " }), jsx("input", { type: "range", min: 0.5, max: 4, step: 0.25, value: editor.config.strokeWidth, onChange: e => editor.setConfig({ ...editor.config, strokeWidth: Number(e.target.value) }), style: { width: 100 } }), jsxs("span", { children: [" ", editor.config.strokeWidth] })] }), jsxs("div", { children: [jsx("label", { children: "Variant: " }), ["outline", "filled", "duotone"].map(v => (jsx("button", { onClick: () => editor.setConfig({ ...editor.config, variant: v }), style: { padding: "2px 6px", marginLeft: 2, borderRadius: 3, border: "none", cursor: "pointer",
318
- background: editor.config.variant === v ? "#339af0" : "#2c2e33",
319
- color: editor.config.variant === v ? "#fff" : "#c1c2c5", fontSize: 11 }, children: v }, v)))] }), editor.selectedId && (() => {
320
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
321
- const sel = editor.shapes.find(s => s.id === editor.selectedId);
322
- if (!sel)
323
- return null;
324
- return (jsxs("div", { style: { borderTop: "1px solid #373a40", paddingTop: 8 }, children: [jsxs("strong", { children: ["Selected: ", sel.type] }), sel.type === "rect" && (jsxs("div", { style: { display: "grid", gridTemplateColumns: "60px 1fr", gap: 2, marginTop: 4, fontSize: 11 }, children: [jsx("span", { children: "X:" }), jsx("input", { type: "number", value: (_a = sel.x) !== null && _a !== void 0 ? _a : 0, step: 0.5, onChange: e => editor.updateShape(sel.id, { x: Number(e.target.value) }), style: { background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 2, padding: 1, fontSize: 10 } }), jsx("span", { children: "Y:" }), jsx("input", { type: "number", value: (_b = sel.y) !== null && _b !== void 0 ? _b : 0, step: 0.5, onChange: e => editor.updateShape(sel.id, { y: Number(e.target.value) }), style: { background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 2, padding: 1, fontSize: 10 } }), jsx("span", { children: "Width:" }), jsx("input", { type: "number", value: (_c = sel.width) !== null && _c !== void 0 ? _c : 0, step: 0.5, onChange: e => editor.updateShape(sel.id, { width: Number(e.target.value) }), style: { background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 2, padding: 1, fontSize: 10 } }), jsx("span", { children: "Height:" }), jsx("input", { type: "number", value: (_d = sel.height) !== null && _d !== void 0 ? _d : 0, step: 0.5, onChange: e => editor.updateShape(sel.id, { height: Number(e.target.value) }), style: { background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 2, padding: 1, fontSize: 10 } })] })), sel.type === "circle" && (jsxs("div", { style: { display: "grid", gridTemplateColumns: "60px 1fr", gap: 2, marginTop: 4, fontSize: 11 }, children: [jsx("span", { children: "CX:" }), jsx("input", { type: "number", value: (_e = sel.cx) !== null && _e !== void 0 ? _e : 0, step: 0.5, onChange: e => editor.updateShape(sel.id, { cx: Number(e.target.value) }), style: { background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 2, padding: 1, fontSize: 10 } }), jsx("span", { children: "CY:" }), jsx("input", { type: "number", value: (_f = sel.cy) !== null && _f !== void 0 ? _f : 0, step: 0.5, onChange: e => editor.updateShape(sel.id, { cy: Number(e.target.value) }), style: { background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 2, padding: 1, fontSize: 10 } }), jsx("span", { children: "Radius:" }), jsx("input", { type: "number", value: (_g = sel.r) !== null && _g !== void 0 ? _g : 0, step: 0.5, onChange: e => editor.updateShape(sel.id, { r: Number(e.target.value) }), style: { background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 2, padding: 1, fontSize: 10 } })] })), sel.type === "path" && (jsxs("div", { style: { marginTop: 4 }, children: [jsx("label", { style: { fontSize: 10 }, children: "SVG Path:" }), jsx("textarea", { value: (_h = sel.d) !== null && _h !== void 0 ? _h : "", onChange: e => editor.updateShape(sel.id, { d: e.target.value }), rows: 3, style: { width: "100%", background: "#2c2e33", color: "#c1c2c5", border: "1px solid #373a40", borderRadius: 3, padding: 4, fontSize: 10, fontFamily: "monospace", resize: "vertical" } })] })), jsxs("div", { style: { marginTop: 4, display: "flex", gap: 4, alignItems: "center" }, children: [jsx("span", { style: { fontSize: 10 }, children: "Fill:" }), jsx("input", { type: "color", value: (_j = sel.fill) !== null && _j !== void 0 ? _j : "#000000", onChange: e => editor.updateShape(sel.id, { fill: e.target.value }), style: { width: 24, height: 18, border: "none", padding: 0, cursor: "pointer" } }), jsx("span", { style: { fontSize: 10 }, children: "Stroke:" }), jsx("input", { type: "color", value: (_k = sel.stroke) !== null && _k !== void 0 ? _k : "#000000", onChange: e => editor.updateShape(sel.id, { stroke: e.target.value }), style: { width: 24, height: 18, border: "none", padding: 0, cursor: "pointer" } })] })] }));
325
- })(), jsxs("div", { style: { borderTop: "1px solid #373a40", paddingTop: 8 }, children: [jsxs("strong", { children: ["Shapes (", editor.shapes.length, ")"] }), jsx("div", { style: { marginTop: 4, maxHeight: 120, overflowY: "auto" }, children: editor.shapes.map(s => (jsxs("div", { onClick: () => editor.setSelectedId(s.id), style: { padding: "2px 4px", cursor: "pointer", borderRadius: 2, fontSize: 11,
326
- background: editor.selectedId === s.id ? "#339af0" : "transparent",
327
- color: editor.selectedId === s.id ? "#fff" : "#c1c2c5" }, children: [s.type, " ", s.id.slice(-4)] }, s.id))) })] }), jsxs("div", { style: { borderTop: "1px solid #373a40", paddingTop: 8 }, children: [jsx("strong", { children: "Preview" }), jsx("div", { style: { display: "flex", gap: 8, marginTop: 8, alignItems: "end" }, children: [16, 24, 32, 48].map(size => (jsxs("div", { style: { textAlign: "center", fontSize: 10, color: "#868e96" }, children: [jsx("div", { style: { background: "#fff", display: "inline-block", padding: 4, borderRadius: 3 }, dangerouslySetInnerHTML: { __html: editor.toSvg().replace(/width="\d+"/, `width="${size}"`).replace(/height="\d+"/, `height="${size}"`) } }), jsxs("div", { children: [size, "px"] })] }, size))) })] })] })] })] }));
392
+ return (jsxs("div", { className: `nice-icon-editor ${className}`, style: {
393
+ display: 'flex',
394
+ flexDirection: 'column',
395
+ gap: 8,
396
+ background: '#1a1b1e',
397
+ color: '#c1c2c5',
398
+ padding: 12,
399
+ borderRadius: 8,
400
+ }, children: [jsxs("div", { style: { display: 'flex', gap: 4, fontSize: 12, alignItems: 'center', flexWrap: 'wrap' }, children: [['select', 'path', 'circle', 'rect', 'line'].map((t) => (jsxs("button", { onClick: () => editor.setTool(t), style: toolBtnStyle(editor.tool === t), children: [t, " (", t[0], ")"] }, t))), jsx("div", { style: { width: 1, height: 20, background: '#373a40' } }), jsx("button", { onClick: editor.undo, disabled: !editor.canUndo, style: toolBtnStyle(false), title: "Undo (Ctrl+Z)", children: "\u21A9" }), jsx("button", { onClick: editor.redo, disabled: !editor.canRedo, style: toolBtnStyle(false), title: "Redo (Ctrl+Y)", children: "\u21AA" }), jsx("div", { style: { width: 1, height: 20, background: '#373a40' } }), jsx("button", { onClick: () => editor.setSnapToGrid((s) => !s), style: toolBtnStyle(editor.snapToGrid), title: "Snap to Grid (G)", children: "\u229E" }), editor.selectedId && (jsx("button", { onClick: () => editor.deleteShape(editor.selectedId), style: { ...toolBtnStyle(false), color: '#ff6b6b' }, title: "Delete (Del)", children: "\u2715" })), jsx("div", { style: { flex: 1 } }), jsx("button", { onClick: handleSave, style: {
401
+ padding: '4px 12px',
402
+ borderRadius: 4,
403
+ border: 'none',
404
+ cursor: 'pointer',
405
+ background: '#2f9e44',
406
+ color: '#fff',
407
+ fontSize: 11,
408
+ }, children: "Save SVG" }), jsx("button", { onClick: () => handleExportPng(), style: {
409
+ padding: '4px 12px',
410
+ borderRadius: 4,
411
+ border: 'none',
412
+ cursor: 'pointer',
413
+ background: '#228be6',
414
+ color: '#fff',
415
+ fontSize: 11,
416
+ }, children: "Export PNG" })] }), jsxs("div", { style: { display: 'flex', gap: 12 }, children: [jsx("div", { style: {
417
+ width: 400,
418
+ height: 400,
419
+ background: '#141517',
420
+ borderRadius: 6,
421
+ position: 'relative',
422
+ overflow: 'hidden',
423
+ }, children: jsxs("svg", { ref: svgRef, width: 400, height: 400, viewBox: `0 0 ${vb} ${vb}`, style: {
424
+ position: 'absolute',
425
+ inset: 0,
426
+ cursor: editor.tool === 'select' ? 'default' : 'crosshair',
427
+ }, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, children: [Array.from({ length: vb + 1 }, (_, i) => (jsxs(React.Fragment, { children: [jsx("line", { x1: i, y1: 0, x2: i, y2: vb, stroke: "rgba(255,255,255,0.08)", strokeWidth: 0.05 }), jsx("line", { x1: 0, y1: i, x2: vb, y2: i, stroke: "rgba(255,255,255,0.08)", strokeWidth: 0.05 })] }, `g${i}`))), jsx("line", { x1: vb / 2, y1: 0, x2: vb / 2, y2: vb, stroke: "rgba(255,255,255,0.15)", strokeWidth: 0.05 }), jsx("line", { x1: 0, y1: vb / 2, x2: vb, y2: vb / 2, stroke: "rgba(255,255,255,0.15)", strokeWidth: 0.05 }), editor.shapes.map((s) => renderShape(s)), pendingShape && renderShape(pendingShape, true)] }) }), jsxs("div", { style: { flex: 1, display: 'flex', flexDirection: 'column', gap: 8, fontSize: 12 }, children: [jsxs("div", { children: [jsx("label", { children: "Grid Size: " }), jsxs("select", { value: editor.config.viewBox, onChange: (e) => editor.setConfig({ ...editor.config, viewBox: Number(e.target.value) }), style: {
428
+ background: '#2c2e33',
429
+ color: '#c1c2c5',
430
+ border: '1px solid #373a40',
431
+ borderRadius: 3,
432
+ padding: 2,
433
+ }, children: [jsx("option", { value: 16, children: "16\u00D716" }), jsx("option", { value: 24, children: "24\u00D724" }), jsx("option", { value: 32, children: "32\u00D732" }), jsx("option", { value: 48, children: "48\u00D748" })] })] }), jsxs("div", { children: [jsx("label", { children: "Stroke Width: " }), jsx("input", { type: "range", min: 0.5, max: 4, step: 0.25, value: editor.config.strokeWidth, onChange: (e) => editor.setConfig({ ...editor.config, strokeWidth: Number(e.target.value) }), style: { width: 100 } }), jsxs("span", { children: [" ", editor.config.strokeWidth] })] }), jsxs("div", { children: [jsx("label", { children: "Variant: " }), ['outline', 'filled', 'duotone'].map((v) => (jsx("button", { onClick: () => editor.setConfig({ ...editor.config, variant: v }), style: {
434
+ padding: '2px 6px',
435
+ marginLeft: 2,
436
+ borderRadius: 3,
437
+ border: 'none',
438
+ cursor: 'pointer',
439
+ background: editor.config.variant === v ? '#339af0' : '#2c2e33',
440
+ color: editor.config.variant === v ? '#fff' : '#c1c2c5',
441
+ fontSize: 11,
442
+ }, children: v }, v)))] }), editor.selectedId &&
443
+ (() => {
444
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
445
+ const sel = editor.shapes.find((s) => s.id === editor.selectedId);
446
+ if (!sel) {
447
+ return null;
448
+ }
449
+ return (jsxs("div", { style: { borderTop: '1px solid #373a40', paddingTop: 8 }, children: [jsxs("strong", { children: ["Selected: ", sel.type] }), sel.type === 'rect' && (jsxs("div", { style: {
450
+ display: 'grid',
451
+ gridTemplateColumns: '60px 1fr',
452
+ gap: 2,
453
+ marginTop: 4,
454
+ fontSize: 11,
455
+ }, children: [jsx("span", { children: "X:" }), jsx("input", { type: "number", value: (_a = sel.x) !== null && _a !== void 0 ? _a : 0, step: 0.5, onChange: (e) => editor.updateShape(sel.id, { x: Number(e.target.value) }), style: {
456
+ background: '#2c2e33',
457
+ color: '#c1c2c5',
458
+ border: '1px solid #373a40',
459
+ borderRadius: 2,
460
+ padding: 1,
461
+ fontSize: 10,
462
+ } }), jsx("span", { children: "Y:" }), jsx("input", { type: "number", value: (_b = sel.y) !== null && _b !== void 0 ? _b : 0, step: 0.5, onChange: (e) => editor.updateShape(sel.id, { y: Number(e.target.value) }), style: {
463
+ background: '#2c2e33',
464
+ color: '#c1c2c5',
465
+ border: '1px solid #373a40',
466
+ borderRadius: 2,
467
+ padding: 1,
468
+ fontSize: 10,
469
+ } }), jsx("span", { children: "Width:" }), jsx("input", { type: "number", value: (_c = sel.width) !== null && _c !== void 0 ? _c : 0, step: 0.5, onChange: (e) => editor.updateShape(sel.id, { width: Number(e.target.value) }), style: {
470
+ background: '#2c2e33',
471
+ color: '#c1c2c5',
472
+ border: '1px solid #373a40',
473
+ borderRadius: 2,
474
+ padding: 1,
475
+ fontSize: 10,
476
+ } }), jsx("span", { children: "Height:" }), jsx("input", { type: "number", value: (_d = sel.height) !== null && _d !== void 0 ? _d : 0, step: 0.5, onChange: (e) => editor.updateShape(sel.id, { height: Number(e.target.value) }), style: {
477
+ background: '#2c2e33',
478
+ color: '#c1c2c5',
479
+ border: '1px solid #373a40',
480
+ borderRadius: 2,
481
+ padding: 1,
482
+ fontSize: 10,
483
+ } })] })), sel.type === 'circle' && (jsxs("div", { style: {
484
+ display: 'grid',
485
+ gridTemplateColumns: '60px 1fr',
486
+ gap: 2,
487
+ marginTop: 4,
488
+ fontSize: 11,
489
+ }, children: [jsx("span", { children: "CX:" }), jsx("input", { type: "number", value: (_e = sel.cx) !== null && _e !== void 0 ? _e : 0, step: 0.5, onChange: (e) => editor.updateShape(sel.id, { cx: Number(e.target.value) }), style: {
490
+ background: '#2c2e33',
491
+ color: '#c1c2c5',
492
+ border: '1px solid #373a40',
493
+ borderRadius: 2,
494
+ padding: 1,
495
+ fontSize: 10,
496
+ } }), jsx("span", { children: "CY:" }), jsx("input", { type: "number", value: (_f = sel.cy) !== null && _f !== void 0 ? _f : 0, step: 0.5, onChange: (e) => editor.updateShape(sel.id, { cy: Number(e.target.value) }), style: {
497
+ background: '#2c2e33',
498
+ color: '#c1c2c5',
499
+ border: '1px solid #373a40',
500
+ borderRadius: 2,
501
+ padding: 1,
502
+ fontSize: 10,
503
+ } }), jsx("span", { children: "Radius:" }), jsx("input", { type: "number", value: (_g = sel.r) !== null && _g !== void 0 ? _g : 0, step: 0.5, onChange: (e) => editor.updateShape(sel.id, { r: Number(e.target.value) }), style: {
504
+ background: '#2c2e33',
505
+ color: '#c1c2c5',
506
+ border: '1px solid #373a40',
507
+ borderRadius: 2,
508
+ padding: 1,
509
+ fontSize: 10,
510
+ } })] })), sel.type === 'path' && (jsxs("div", { style: { marginTop: 4 }, children: [jsx("label", { style: { fontSize: 10 }, children: "SVG Path:" }), jsx("textarea", { value: (_h = sel.d) !== null && _h !== void 0 ? _h : '', onChange: (e) => editor.updateShape(sel.id, { d: e.target.value }), rows: 3, style: {
511
+ width: '100%',
512
+ background: '#2c2e33',
513
+ color: '#c1c2c5',
514
+ border: '1px solid #373a40',
515
+ borderRadius: 3,
516
+ padding: 4,
517
+ fontSize: 10,
518
+ fontFamily: 'monospace',
519
+ resize: 'vertical',
520
+ } })] })), jsxs("div", { style: { marginTop: 4, display: 'flex', gap: 4, alignItems: 'center' }, children: [jsx("span", { style: { fontSize: 10 }, children: "Fill:" }), jsx("input", { type: "color", value: (_j = sel.fill) !== null && _j !== void 0 ? _j : '#000000', onChange: (e) => editor.updateShape(sel.id, { fill: e.target.value }), style: {
521
+ width: 24,
522
+ height: 18,
523
+ border: 'none',
524
+ padding: 0,
525
+ cursor: 'pointer',
526
+ } }), jsx("span", { style: { fontSize: 10 }, children: "Stroke:" }), jsx("input", { type: "color", value: (_k = sel.stroke) !== null && _k !== void 0 ? _k : '#000000', onChange: (e) => editor.updateShape(sel.id, { stroke: e.target.value }), style: {
527
+ width: 24,
528
+ height: 18,
529
+ border: 'none',
530
+ padding: 0,
531
+ cursor: 'pointer',
532
+ } })] })] }));
533
+ })(), jsxs("div", { style: { borderTop: '1px solid #373a40', paddingTop: 8 }, children: [jsxs("strong", { children: ["Shapes (", editor.shapes.length, ")"] }), jsx("div", { style: { marginTop: 4, maxHeight: 120, overflowY: 'auto' }, children: editor.shapes.map((s) => (jsxs("div", { onClick: () => editor.setSelectedId(s.id), style: {
534
+ padding: '2px 4px',
535
+ cursor: 'pointer',
536
+ borderRadius: 2,
537
+ fontSize: 11,
538
+ background: editor.selectedId === s.id ? '#339af0' : 'transparent',
539
+ color: editor.selectedId === s.id ? '#fff' : '#c1c2c5',
540
+ }, children: [s.type, " ", s.id.slice(-4)] }, s.id))) })] }), jsxs("div", { style: { borderTop: '1px solid #373a40', paddingTop: 8 }, children: [jsx("strong", { children: "Preview" }), jsx("div", { style: { display: 'flex', gap: 8, marginTop: 8, alignItems: 'end' }, children: [16, 24, 32, 48].map((size) => (jsxs("div", { style: { textAlign: 'center', fontSize: 10, color: '#868e96' }, children: [jsx("div", { style: {
541
+ background: '#fff',
542
+ display: 'inline-block',
543
+ padding: 4,
544
+ borderRadius: 3,
545
+ }, dangerouslySetInnerHTML: {
546
+ __html: editor
547
+ .toSvg()
548
+ .replace(/width="\d+"/, `width="${size}"`)
549
+ .replace(/height="\d+"/, `height="${size}"`),
550
+ } }), jsxs("div", { children: [size, "px"] })] }, size))) })] })] })] })] }));
328
551
  };
329
552
 
330
553
  export { NiceIconEditor, useIconEditor };