@nice2dev/ui-graphics 1.0.0

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 (511) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/LICENSE +21 -0
  3. package/README.md +339 -0
  4. package/dist/cjs/animation/AnimatedPerson.js +153 -0
  5. package/dist/cjs/animation/AnimatedPerson.js.map +1 -0
  6. package/dist/cjs/animation/AnimationEditor.js +106 -0
  7. package/dist/cjs/animation/AnimationEditor.js.map +1 -0
  8. package/dist/cjs/animation/Audience.js +59 -0
  9. package/dist/cjs/animation/Audience.js.map +1 -0
  10. package/dist/cjs/animation/BodyRenderer.js +33 -0
  11. package/dist/cjs/animation/BodyRenderer.js.map +1 -0
  12. package/dist/cjs/animation/animationHelper.js +272 -0
  13. package/dist/cjs/animation/animationHelper.js.map +1 -0
  14. package/dist/cjs/animation/characterTypes.js +75 -0
  15. package/dist/cjs/animation/characterTypes.js.map +1 -0
  16. package/dist/cjs/animation/choreoDSL.js +190 -0
  17. package/dist/cjs/animation/choreoDSL.js.map +1 -0
  18. package/dist/cjs/animation/choreography.js +41 -0
  19. package/dist/cjs/animation/choreography.js.map +1 -0
  20. package/dist/cjs/animation/karaokeIntegration.js +98 -0
  21. package/dist/cjs/animation/karaokeIntegration.js.map +1 -0
  22. package/dist/cjs/animation/lottieExport.js +128 -0
  23. package/dist/cjs/animation/lottieExport.js.map +1 -0
  24. package/dist/cjs/animation/motionPath.js +196 -0
  25. package/dist/cjs/animation/motionPath.js.map +1 -0
  26. package/dist/cjs/animation/physics.js +201 -0
  27. package/dist/cjs/animation/physics.js.map +1 -0
  28. package/dist/cjs/animation/rig/RigPlayer.js +63 -0
  29. package/dist/cjs/animation/rig/RigPlayer.js.map +1 -0
  30. package/dist/cjs/animation/rig/RiggedBody.js +30 -0
  31. package/dist/cjs/animation/rig/RiggedBody.js.map +1 -0
  32. package/dist/cjs/animation/rig/choreoRigBridge.js +63 -0
  33. package/dist/cjs/animation/rig/choreoRigBridge.js.map +1 -0
  34. package/dist/cjs/animation/rig/ik.js +22 -0
  35. package/dist/cjs/animation/rig/ik.js.map +1 -0
  36. package/dist/cjs/animation/rig/poseOps.js +49 -0
  37. package/dist/cjs/animation/rig/poseOps.js.map +1 -0
  38. package/dist/cjs/animation/rig/presets.js +60 -0
  39. package/dist/cjs/animation/rig/presets.js.map +1 -0
  40. package/dist/cjs/animation/rig/rigMath.js +41 -0
  41. package/dist/cjs/animation/rig/rigMath.js.map +1 -0
  42. package/dist/cjs/animation/rig/rigTypes.js +44 -0
  43. package/dist/cjs/animation/rig/rigTypes.js.map +1 -0
  44. package/dist/cjs/animation/shapes/arms.js +15 -0
  45. package/dist/cjs/animation/shapes/arms.js.map +1 -0
  46. package/dist/cjs/animation/shapes/eyes.js +52 -0
  47. package/dist/cjs/animation/shapes/eyes.js.map +1 -0
  48. package/dist/cjs/animation/shapes/hair.js +55 -0
  49. package/dist/cjs/animation/shapes/hair.js.map +1 -0
  50. package/dist/cjs/animation/shapes/heads.js +62 -0
  51. package/dist/cjs/animation/shapes/heads.js.map +1 -0
  52. package/dist/cjs/animation/shapes/headwear.js +44 -0
  53. package/dist/cjs/animation/shapes/headwear.js.map +1 -0
  54. package/dist/cjs/animation/shapes/legs.js +15 -0
  55. package/dist/cjs/animation/shapes/legs.js.map +1 -0
  56. package/dist/cjs/animation/shapes/mouths.js +53 -0
  57. package/dist/cjs/animation/shapes/mouths.js.map +1 -0
  58. package/dist/cjs/animation/shapes/noses.js +31 -0
  59. package/dist/cjs/animation/shapes/noses.js.map +1 -0
  60. package/dist/cjs/animation/shapes/outfits.js +43 -0
  61. package/dist/cjs/animation/shapes/outfits.js.map +1 -0
  62. package/dist/cjs/animation/shapes/torsos.js +13 -0
  63. package/dist/cjs/animation/shapes/torsos.js.map +1 -0
  64. package/dist/cjs/animation/spineExport.js +132 -0
  65. package/dist/cjs/animation/spineExport.js.map +1 -0
  66. package/dist/cjs/core/LocalUI.js +54 -0
  67. package/dist/cjs/core/LocalUI.js.map +1 -0
  68. package/dist/cjs/core/collaboration.js +259 -0
  69. package/dist/cjs/core/collaboration.js.map +1 -0
  70. package/dist/cjs/core/colorBlindness.js +97 -0
  71. package/dist/cjs/core/colorBlindness.js.map +1 -0
  72. package/dist/cjs/core/dragDrop.js +168 -0
  73. package/dist/cjs/core/dragDrop.js.map +1 -0
  74. package/dist/cjs/core/fixes.js +185 -0
  75. package/dist/cjs/core/fixes.js.map +1 -0
  76. package/dist/cjs/core/gridGuides.js +245 -0
  77. package/dist/cjs/core/gridGuides.js.map +1 -0
  78. package/dist/cjs/core/historyVisual.js +124 -0
  79. package/dist/cjs/core/historyVisual.js.map +1 -0
  80. package/dist/cjs/core/i18n.js +16 -0
  81. package/dist/cjs/core/i18n.js.map +1 -0
  82. package/dist/cjs/core/integrations.js +261 -0
  83. package/dist/cjs/core/integrations.js.map +1 -0
  84. package/dist/cjs/core/minimap.js +142 -0
  85. package/dist/cjs/core/minimap.js.map +1 -0
  86. package/dist/cjs/core/plugins.js +129 -0
  87. package/dist/cjs/core/plugins.js.map +1 -0
  88. package/dist/cjs/core/rtl.js +102 -0
  89. package/dist/cjs/core/rtl.js.map +1 -0
  90. package/dist/cjs/core/shortcuts.js +205 -0
  91. package/dist/cjs/core/shortcuts.js.map +1 -0
  92. package/dist/cjs/core/theme.js +171 -0
  93. package/dist/cjs/core/theme.js.map +1 -0
  94. package/dist/cjs/font/NiceFontEditor.js +193 -0
  95. package/dist/cjs/font/NiceFontEditor.js.map +1 -0
  96. package/dist/cjs/game/GameAsset2dEditor.js +371 -0
  97. package/dist/cjs/game/GameAsset2dEditor.js.map +1 -0
  98. package/dist/cjs/game/GameAsset2dEditor.module.css.js +6 -0
  99. package/dist/cjs/game/GameAsset2dEditor.module.css.js.map +1 -0
  100. package/dist/cjs/game/gameAssetTypes.js +20 -0
  101. package/dist/cjs/game/gameAssetTypes.js.map +1 -0
  102. package/dist/cjs/game/gameAssetUtils.js +475 -0
  103. package/dist/cjs/game/gameAssetUtils.js.map +1 -0
  104. package/dist/cjs/game/useGameAssetEditor.js +761 -0
  105. package/dist/cjs/game/useGameAssetEditor.js.map +1 -0
  106. package/dist/cjs/icon/NiceIconEditor.js +249 -0
  107. package/dist/cjs/icon/NiceIconEditor.js.map +1 -0
  108. package/dist/cjs/index.js +264 -0
  109. package/dist/cjs/index.js.map +1 -0
  110. package/dist/cjs/nice2dev-ui/dist/index.js +32070 -0
  111. package/dist/cjs/nice2dev-ui/dist/index.js.map +1 -0
  112. package/dist/cjs/nice2dev-ui-graphics.css +1 -0
  113. package/dist/cjs/photo/FilterThumb.js +29 -0
  114. package/dist/cjs/photo/FilterThumb.js.map +1 -0
  115. package/dist/cjs/photo/PhotoEditor.js +20 -0
  116. package/dist/cjs/photo/PhotoEditor.js.map +1 -0
  117. package/dist/cjs/photo/PhotoEditor.module.css.js +6 -0
  118. package/dist/cjs/photo/PhotoEditor.module.css.js.map +1 -0
  119. package/dist/cjs/photo/PhotoEditorCanvas.js +59 -0
  120. package/dist/cjs/photo/PhotoEditorCanvas.js.map +1 -0
  121. package/dist/cjs/photo/PhotoEditorLeftPanel.js +174 -0
  122. package/dist/cjs/photo/PhotoEditorLeftPanel.js.map +1 -0
  123. package/dist/cjs/photo/PhotoEditorToolbar.js +15 -0
  124. package/dist/cjs/photo/PhotoEditorToolbar.js.map +1 -0
  125. package/dist/cjs/photo/photoEditorActions.js +80 -0
  126. package/dist/cjs/photo/photoEditorActions.js.map +1 -0
  127. package/dist/cjs/photo/photoEditorTypes.js +40 -0
  128. package/dist/cjs/photo/photoEditorTypes.js.map +1 -0
  129. package/dist/cjs/photo/photoFilters.js +880 -0
  130. package/dist/cjs/photo/photoFilters.js.map +1 -0
  131. package/dist/cjs/photo/photoOverlays.js +651 -0
  132. package/dist/cjs/photo/photoOverlays.js.map +1 -0
  133. package/dist/cjs/photo/photoSelection.js +547 -0
  134. package/dist/cjs/photo/photoSelection.js.map +1 -0
  135. package/dist/cjs/photo/usePhotoEditor.js +640 -0
  136. package/dist/cjs/photo/usePhotoEditor.js.map +1 -0
  137. package/dist/cjs/pixel/HSVPicker.js +173 -0
  138. package/dist/cjs/pixel/HSVPicker.js.map +1 -0
  139. package/dist/cjs/pixel/PixelEditor.js +28 -0
  140. package/dist/cjs/pixel/PixelEditor.js.map +1 -0
  141. package/dist/cjs/pixel/PixelEditor.module.css.js +6 -0
  142. package/dist/cjs/pixel/PixelEditor.module.css.js.map +1 -0
  143. package/dist/cjs/pixel/PixelEditorCanvas.js +15 -0
  144. package/dist/cjs/pixel/PixelEditorCanvas.js.map +1 -0
  145. package/dist/cjs/pixel/PixelEditorMenuBar.js +11 -0
  146. package/dist/cjs/pixel/PixelEditorMenuBar.js.map +1 -0
  147. package/dist/cjs/pixel/PixelEditorRightPanel.js +15 -0
  148. package/dist/cjs/pixel/PixelEditorRightPanel.js.map +1 -0
  149. package/dist/cjs/pixel/PixelEditorStatusBar.js +15 -0
  150. package/dist/cjs/pixel/PixelEditorStatusBar.js.map +1 -0
  151. package/dist/cjs/pixel/PixelEditorTimeline.js +11 -0
  152. package/dist/cjs/pixel/PixelEditorTimeline.js.map +1 -0
  153. package/dist/cjs/pixel/PixelEditorToolbar.js +16 -0
  154. package/dist/cjs/pixel/PixelEditorToolbar.js.map +1 -0
  155. package/dist/cjs/pixel/asepriteFormat.js +512 -0
  156. package/dist/cjs/pixel/asepriteFormat.js.map +1 -0
  157. package/dist/cjs/pixel/pixelEditorExports.js +471 -0
  158. package/dist/cjs/pixel/pixelEditorExports.js.map +1 -0
  159. package/dist/cjs/pixel/pixelEditorTypes.js +102 -0
  160. package/dist/cjs/pixel/pixelEditorTypes.js.map +1 -0
  161. package/dist/cjs/pixel/pixelEditorUtils.js +664 -0
  162. package/dist/cjs/pixel/pixelEditorUtils.js.map +1 -0
  163. package/dist/cjs/pixel/usePixelEditor.js +1112 -0
  164. package/dist/cjs/pixel/usePixelEditor.js.map +1 -0
  165. package/dist/cjs/texture/Nice3DTexturePainter.js +236 -0
  166. package/dist/cjs/texture/Nice3DTexturePainter.js.map +1 -0
  167. package/dist/cjs/ui/NiceUIDesigner.js +191 -0
  168. package/dist/cjs/ui/NiceUIDesigner.js.map +1 -0
  169. package/dist/cjs/vector/VectorEditor.js +31 -0
  170. package/dist/cjs/vector/VectorEditor.js.map +1 -0
  171. package/dist/cjs/vector/VectorEditor.module.css.js +6 -0
  172. package/dist/cjs/vector/VectorEditor.module.css.js.map +1 -0
  173. package/dist/cjs/vector/VectorEditorMenuBar.js +16 -0
  174. package/dist/cjs/vector/VectorEditorMenuBar.js.map +1 -0
  175. package/dist/cjs/vector/VectorEditorRightPanel.js +126 -0
  176. package/dist/cjs/vector/VectorEditorRightPanel.js.map +1 -0
  177. package/dist/cjs/vector/VectorEditorShapeRenderer.js +55 -0
  178. package/dist/cjs/vector/VectorEditorShapeRenderer.js.map +1 -0
  179. package/dist/cjs/vector/VectorEditorStatusBar.js +14 -0
  180. package/dist/cjs/vector/VectorEditorStatusBar.js.map +1 -0
  181. package/dist/cjs/vector/useVectorEditor.js +613 -0
  182. package/dist/cjs/vector/useVectorEditor.js.map +1 -0
  183. package/dist/cjs/vector/vectorBooleanOps.js +511 -0
  184. package/dist/cjs/vector/vectorBooleanOps.js.map +1 -0
  185. package/dist/cjs/vector/vectorEditorExport.js +159 -0
  186. package/dist/cjs/vector/vectorEditorExport.js.map +1 -0
  187. package/dist/cjs/vector/vectorEditorImport.js +150 -0
  188. package/dist/cjs/vector/vectorEditorImport.js.map +1 -0
  189. package/dist/cjs/vector/vectorEditorTypes.js +72 -0
  190. package/dist/cjs/vector/vectorEditorTypes.js.map +1 -0
  191. package/dist/cjs/vector/vectorGradients.js +201 -0
  192. package/dist/cjs/vector/vectorGradients.js.map +1 -0
  193. package/dist/esm/animation/AnimatedPerson.js +151 -0
  194. package/dist/esm/animation/AnimatedPerson.js.map +1 -0
  195. package/dist/esm/animation/AnimationEditor.js +104 -0
  196. package/dist/esm/animation/AnimationEditor.js.map +1 -0
  197. package/dist/esm/animation/Audience.js +57 -0
  198. package/dist/esm/animation/Audience.js.map +1 -0
  199. package/dist/esm/animation/BodyRenderer.js +28 -0
  200. package/dist/esm/animation/BodyRenderer.js.map +1 -0
  201. package/dist/esm/animation/animationHelper.js +268 -0
  202. package/dist/esm/animation/animationHelper.js.map +1 -0
  203. package/dist/esm/animation/characterTypes.js +70 -0
  204. package/dist/esm/animation/characterTypes.js.map +1 -0
  205. package/dist/esm/animation/choreoDSL.js +182 -0
  206. package/dist/esm/animation/choreoDSL.js.map +1 -0
  207. package/dist/esm/animation/choreography.js +36 -0
  208. package/dist/esm/animation/choreography.js.map +1 -0
  209. package/dist/esm/animation/karaokeIntegration.js +91 -0
  210. package/dist/esm/animation/karaokeIntegration.js.map +1 -0
  211. package/dist/esm/animation/lottieExport.js +123 -0
  212. package/dist/esm/animation/lottieExport.js.map +1 -0
  213. package/dist/esm/animation/motionPath.js +185 -0
  214. package/dist/esm/animation/motionPath.js.map +1 -0
  215. package/dist/esm/animation/physics.js +192 -0
  216. package/dist/esm/animation/physics.js.map +1 -0
  217. package/dist/esm/animation/rig/RigPlayer.js +61 -0
  218. package/dist/esm/animation/rig/RigPlayer.js.map +1 -0
  219. package/dist/esm/animation/rig/RiggedBody.js +28 -0
  220. package/dist/esm/animation/rig/RiggedBody.js.map +1 -0
  221. package/dist/esm/animation/rig/choreoRigBridge.js +60 -0
  222. package/dist/esm/animation/rig/choreoRigBridge.js.map +1 -0
  223. package/dist/esm/animation/rig/ik.js +20 -0
  224. package/dist/esm/animation/rig/ik.js.map +1 -0
  225. package/dist/esm/animation/rig/poseOps.js +45 -0
  226. package/dist/esm/animation/rig/poseOps.js.map +1 -0
  227. package/dist/esm/animation/rig/presets.js +53 -0
  228. package/dist/esm/animation/rig/presets.js.map +1 -0
  229. package/dist/esm/animation/rig/rigMath.js +37 -0
  230. package/dist/esm/animation/rig/rigMath.js.map +1 -0
  231. package/dist/esm/animation/rig/rigTypes.js +40 -0
  232. package/dist/esm/animation/rig/rigTypes.js.map +1 -0
  233. package/dist/esm/animation/shapes/arms.js +13 -0
  234. package/dist/esm/animation/shapes/arms.js.map +1 -0
  235. package/dist/esm/animation/shapes/eyes.js +45 -0
  236. package/dist/esm/animation/shapes/eyes.js.map +1 -0
  237. package/dist/esm/animation/shapes/hair.js +46 -0
  238. package/dist/esm/animation/shapes/hair.js.map +1 -0
  239. package/dist/esm/animation/shapes/heads.js +52 -0
  240. package/dist/esm/animation/shapes/heads.js.map +1 -0
  241. package/dist/esm/animation/shapes/headwear.js +36 -0
  242. package/dist/esm/animation/shapes/headwear.js.map +1 -0
  243. package/dist/esm/animation/shapes/legs.js +13 -0
  244. package/dist/esm/animation/shapes/legs.js.map +1 -0
  245. package/dist/esm/animation/shapes/mouths.js +45 -0
  246. package/dist/esm/animation/shapes/mouths.js.map +1 -0
  247. package/dist/esm/animation/shapes/noses.js +23 -0
  248. package/dist/esm/animation/shapes/noses.js.map +1 -0
  249. package/dist/esm/animation/shapes/outfits.js +37 -0
  250. package/dist/esm/animation/shapes/outfits.js.map +1 -0
  251. package/dist/esm/animation/shapes/torsos.js +11 -0
  252. package/dist/esm/animation/shapes/torsos.js.map +1 -0
  253. package/dist/esm/animation/spineExport.js +128 -0
  254. package/dist/esm/animation/spineExport.js.map +1 -0
  255. package/dist/esm/core/LocalUI.js +50 -0
  256. package/dist/esm/core/LocalUI.js.map +1 -0
  257. package/dist/esm/core/collaboration.js +252 -0
  258. package/dist/esm/core/collaboration.js.map +1 -0
  259. package/dist/esm/core/colorBlindness.js +90 -0
  260. package/dist/esm/core/colorBlindness.js.map +1 -0
  261. package/dist/esm/core/dragDrop.js +165 -0
  262. package/dist/esm/core/dragDrop.js.map +1 -0
  263. package/dist/esm/core/fixes.js +179 -0
  264. package/dist/esm/core/fixes.js.map +1 -0
  265. package/dist/esm/core/gridGuides.js +232 -0
  266. package/dist/esm/core/gridGuides.js.map +1 -0
  267. package/dist/esm/core/historyVisual.js +121 -0
  268. package/dist/esm/core/historyVisual.js.map +1 -0
  269. package/dist/esm/core/i18n.js +13 -0
  270. package/dist/esm/core/i18n.js.map +1 -0
  271. package/dist/esm/core/integrations.js +254 -0
  272. package/dist/esm/core/integrations.js.map +1 -0
  273. package/dist/esm/core/minimap.js +139 -0
  274. package/dist/esm/core/minimap.js.map +1 -0
  275. package/dist/esm/core/plugins.js +124 -0
  276. package/dist/esm/core/plugins.js.map +1 -0
  277. package/dist/esm/core/rtl.js +95 -0
  278. package/dist/esm/core/rtl.js.map +1 -0
  279. package/dist/esm/core/shortcuts.js +200 -0
  280. package/dist/esm/core/shortcuts.js.map +1 -0
  281. package/dist/esm/core/theme.js +162 -0
  282. package/dist/esm/core/theme.js.map +1 -0
  283. package/dist/esm/font/NiceFontEditor.js +189 -0
  284. package/dist/esm/font/NiceFontEditor.js.map +1 -0
  285. package/dist/esm/game/GameAsset2dEditor.js +369 -0
  286. package/dist/esm/game/GameAsset2dEditor.js.map +1 -0
  287. package/dist/esm/game/GameAsset2dEditor.module.css.js +4 -0
  288. package/dist/esm/game/GameAsset2dEditor.module.css.js.map +1 -0
  289. package/dist/esm/game/gameAssetTypes.js +18 -0
  290. package/dist/esm/game/gameAssetTypes.js.map +1 -0
  291. package/dist/esm/game/gameAssetUtils.js +456 -0
  292. package/dist/esm/game/gameAssetUtils.js.map +1 -0
  293. package/dist/esm/game/useGameAssetEditor.js +759 -0
  294. package/dist/esm/game/useGameAssetEditor.js.map +1 -0
  295. package/dist/esm/icon/NiceIconEditor.js +246 -0
  296. package/dist/esm/icon/NiceIconEditor.js.map +1 -0
  297. package/dist/esm/index.js +59 -0
  298. package/dist/esm/index.js.map +1 -0
  299. package/dist/esm/nice2dev-ui/dist/index.js +31720 -0
  300. package/dist/esm/nice2dev-ui/dist/index.js.map +1 -0
  301. package/dist/esm/nice2dev-ui-graphics.css +1 -0
  302. package/dist/esm/photo/FilterThumb.js +27 -0
  303. package/dist/esm/photo/FilterThumb.js.map +1 -0
  304. package/dist/esm/photo/PhotoEditor.js +18 -0
  305. package/dist/esm/photo/PhotoEditor.js.map +1 -0
  306. package/dist/esm/photo/PhotoEditor.module.css.js +4 -0
  307. package/dist/esm/photo/PhotoEditor.module.css.js.map +1 -0
  308. package/dist/esm/photo/PhotoEditorCanvas.js +57 -0
  309. package/dist/esm/photo/PhotoEditorCanvas.js.map +1 -0
  310. package/dist/esm/photo/PhotoEditorLeftPanel.js +172 -0
  311. package/dist/esm/photo/PhotoEditorLeftPanel.js.map +1 -0
  312. package/dist/esm/photo/PhotoEditorToolbar.js +13 -0
  313. package/dist/esm/photo/PhotoEditorToolbar.js.map +1 -0
  314. package/dist/esm/photo/photoEditorActions.js +75 -0
  315. package/dist/esm/photo/photoEditorActions.js.map +1 -0
  316. package/dist/esm/photo/photoEditorTypes.js +36 -0
  317. package/dist/esm/photo/photoEditorTypes.js.map +1 -0
  318. package/dist/esm/photo/photoFilters.js +871 -0
  319. package/dist/esm/photo/photoFilters.js.map +1 -0
  320. package/dist/esm/photo/photoOverlays.js +636 -0
  321. package/dist/esm/photo/photoOverlays.js.map +1 -0
  322. package/dist/esm/photo/photoSelection.js +535 -0
  323. package/dist/esm/photo/photoSelection.js.map +1 -0
  324. package/dist/esm/photo/usePhotoEditor.js +638 -0
  325. package/dist/esm/photo/usePhotoEditor.js.map +1 -0
  326. package/dist/esm/pixel/HSVPicker.js +171 -0
  327. package/dist/esm/pixel/HSVPicker.js.map +1 -0
  328. package/dist/esm/pixel/PixelEditor.js +26 -0
  329. package/dist/esm/pixel/PixelEditor.js.map +1 -0
  330. package/dist/esm/pixel/PixelEditor.module.css.js +4 -0
  331. package/dist/esm/pixel/PixelEditor.module.css.js.map +1 -0
  332. package/dist/esm/pixel/PixelEditorCanvas.js +13 -0
  333. package/dist/esm/pixel/PixelEditorCanvas.js.map +1 -0
  334. package/dist/esm/pixel/PixelEditorMenuBar.js +9 -0
  335. package/dist/esm/pixel/PixelEditorMenuBar.js.map +1 -0
  336. package/dist/esm/pixel/PixelEditorRightPanel.js +13 -0
  337. package/dist/esm/pixel/PixelEditorRightPanel.js.map +1 -0
  338. package/dist/esm/pixel/PixelEditorStatusBar.js +13 -0
  339. package/dist/esm/pixel/PixelEditorStatusBar.js.map +1 -0
  340. package/dist/esm/pixel/PixelEditorTimeline.js +9 -0
  341. package/dist/esm/pixel/PixelEditorTimeline.js.map +1 -0
  342. package/dist/esm/pixel/PixelEditorToolbar.js +14 -0
  343. package/dist/esm/pixel/PixelEditorToolbar.js.map +1 -0
  344. package/dist/esm/pixel/asepriteFormat.js +505 -0
  345. package/dist/esm/pixel/asepriteFormat.js.map +1 -0
  346. package/dist/esm/pixel/pixelEditorExports.js +461 -0
  347. package/dist/esm/pixel/pixelEditorExports.js.map +1 -0
  348. package/dist/esm/pixel/pixelEditorTypes.js +90 -0
  349. package/dist/esm/pixel/pixelEditorTypes.js.map +1 -0
  350. package/dist/esm/pixel/pixelEditorUtils.js +631 -0
  351. package/dist/esm/pixel/pixelEditorUtils.js.map +1 -0
  352. package/dist/esm/pixel/usePixelEditor.js +1110 -0
  353. package/dist/esm/pixel/usePixelEditor.js.map +1 -0
  354. package/dist/esm/texture/Nice3DTexturePainter.js +233 -0
  355. package/dist/esm/texture/Nice3DTexturePainter.js.map +1 -0
  356. package/dist/esm/ui/NiceUIDesigner.js +187 -0
  357. package/dist/esm/ui/NiceUIDesigner.js.map +1 -0
  358. package/dist/esm/vector/VectorEditor.js +29 -0
  359. package/dist/esm/vector/VectorEditor.js.map +1 -0
  360. package/dist/esm/vector/VectorEditor.module.css.js +4 -0
  361. package/dist/esm/vector/VectorEditor.module.css.js.map +1 -0
  362. package/dist/esm/vector/VectorEditorMenuBar.js +14 -0
  363. package/dist/esm/vector/VectorEditorMenuBar.js.map +1 -0
  364. package/dist/esm/vector/VectorEditorRightPanel.js +124 -0
  365. package/dist/esm/vector/VectorEditorRightPanel.js.map +1 -0
  366. package/dist/esm/vector/VectorEditorShapeRenderer.js +53 -0
  367. package/dist/esm/vector/VectorEditorShapeRenderer.js.map +1 -0
  368. package/dist/esm/vector/VectorEditorStatusBar.js +12 -0
  369. package/dist/esm/vector/VectorEditorStatusBar.js.map +1 -0
  370. package/dist/esm/vector/useVectorEditor.js +611 -0
  371. package/dist/esm/vector/useVectorEditor.js.map +1 -0
  372. package/dist/esm/vector/vectorBooleanOps.js +507 -0
  373. package/dist/esm/vector/vectorBooleanOps.js.map +1 -0
  374. package/dist/esm/vector/vectorEditorExport.js +152 -0
  375. package/dist/esm/vector/vectorEditorExport.js.map +1 -0
  376. package/dist/esm/vector/vectorEditorImport.js +148 -0
  377. package/dist/esm/vector/vectorEditorImport.js.map +1 -0
  378. package/dist/esm/vector/vectorEditorTypes.js +63 -0
  379. package/dist/esm/vector/vectorEditorTypes.js.map +1 -0
  380. package/dist/esm/vector/vectorGradients.js +193 -0
  381. package/dist/esm/vector/vectorGradients.js.map +1 -0
  382. package/dist/types/__benchmarks__/bench.d.ts +13 -0
  383. package/dist/types/__tests__/setup.d.ts +4 -0
  384. package/dist/types/animation/AnimatedPerson.d.ts +14 -0
  385. package/dist/types/animation/AnimationEditor.d.ts +20 -0
  386. package/dist/types/animation/Audience.d.ts +11 -0
  387. package/dist/types/animation/BodyRenderer.d.ts +12 -0
  388. package/dist/types/animation/animationHelper.d.ts +28 -0
  389. package/dist/types/animation/characterTypes.d.ts +37 -0
  390. package/dist/types/animation/choreoDSL.d.ts +88 -0
  391. package/dist/types/animation/choreography.d.ts +8 -0
  392. package/dist/types/animation/karaokeIntegration.d.ts +31 -0
  393. package/dist/types/animation/lottieExport.d.ts +77 -0
  394. package/dist/types/animation/motionPath.d.ts +60 -0
  395. package/dist/types/animation/physics.d.ts +73 -0
  396. package/dist/types/animation/rig/RigPlayer.d.ts +32 -0
  397. package/dist/types/animation/rig/RiggedBody.d.ts +19 -0
  398. package/dist/types/animation/rig/choreoRigBridge.d.ts +9 -0
  399. package/dist/types/animation/rig/ik.d.ts +8 -0
  400. package/dist/types/animation/rig/poseOps.d.ts +14 -0
  401. package/dist/types/animation/rig/presets.d.ts +13 -0
  402. package/dist/types/animation/rig/rigMath.d.ts +7 -0
  403. package/dist/types/animation/rig/rigTypes.d.ts +38 -0
  404. package/dist/types/animation/shapes/arms.d.ts +10 -0
  405. package/dist/types/animation/shapes/eyes.d.ts +17 -0
  406. package/dist/types/animation/shapes/hair.d.ts +17 -0
  407. package/dist/types/animation/shapes/heads.d.ts +18 -0
  408. package/dist/types/animation/shapes/headwear.d.ts +16 -0
  409. package/dist/types/animation/shapes/legs.d.ts +10 -0
  410. package/dist/types/animation/shapes/mouths.d.ts +17 -0
  411. package/dist/types/animation/shapes/noses.d.ts +17 -0
  412. package/dist/types/animation/shapes/outfits.d.ts +14 -0
  413. package/dist/types/animation/shapes/torsos.d.ts +9 -0
  414. package/dist/types/animation/spineExport.d.ts +66 -0
  415. package/dist/types/core/LocalUI.d.ts +21 -0
  416. package/dist/types/core/collaboration.d.ts +164 -0
  417. package/dist/types/core/colorBlindness.d.ts +24 -0
  418. package/dist/types/core/dragDrop.d.ts +46 -0
  419. package/dist/types/core/fixes.d.ts +80 -0
  420. package/dist/types/core/gridGuides.d.ts +70 -0
  421. package/dist/types/core/historyVisual.d.ts +915 -0
  422. package/dist/types/core/i18n.d.ts +27 -0
  423. package/dist/types/core/integrations.d.ts +103 -0
  424. package/dist/types/core/minimap.d.ts +49 -0
  425. package/dist/types/core/plugins.d.ts +111 -0
  426. package/dist/types/core/rtl.d.ts +32 -0
  427. package/dist/types/core/shortcuts.d.ts +150 -0
  428. package/dist/types/core/theme.d.ts +78 -0
  429. package/dist/types/core/useGamepad.d.ts +64 -0
  430. package/dist/types/core/usePointerPressure.d.ts +88 -0
  431. package/dist/types/font/NiceFontEditor.d.ts +62 -0
  432. package/dist/types/game/AnimationPreviewPlayer.d.ts +29 -0
  433. package/dist/types/game/CollisionEditor.d.ts +101 -0
  434. package/dist/types/game/GameAsset2dEditor.d.ts +17 -0
  435. package/dist/types/game/GameAssetExportPanel.d.ts +20 -0
  436. package/dist/types/game/IsometricEditor.d.ts +22 -0
  437. package/dist/types/game/IsometricTilePanel.d.ts +18 -0
  438. package/dist/types/game/gameAssetExport.d.ts +160 -0
  439. package/dist/types/game/gameAssetTypes.d.ts +238 -0
  440. package/dist/types/game/gameAssetUtils.d.ts +23 -0
  441. package/dist/types/game/index.d.ts +8 -0
  442. package/dist/types/game/isometricTiles.d.ts +250 -0
  443. package/dist/types/game/useAnimationPreview.d.ts +63 -0
  444. package/dist/types/game/useCollisionEditor.d.ts +96 -0
  445. package/dist/types/game/useGameAssetEditor.d.ts +79 -0
  446. package/dist/types/game/useGameAssetExport.d.ts +82 -0
  447. package/dist/types/icon/NiceIconEditor.d.ts +79 -0
  448. package/dist/types/index.d.ts +85 -0
  449. package/dist/types/photo/BatchProcessingPanel.d.ts +13 -0
  450. package/dist/types/photo/FaceDetectionPanel.d.ts +18 -0
  451. package/dist/types/photo/FilterThumb.d.ts +14 -0
  452. package/dist/types/photo/PerspectiveCorrectionPanel.d.ts +17 -0
  453. package/dist/types/photo/PhotoEditor.d.ts +2 -0
  454. package/dist/types/photo/PhotoEditorCanvas.d.ts +14 -0
  455. package/dist/types/photo/PhotoEditorLeftPanel.d.ts +13 -0
  456. package/dist/types/photo/PhotoEditorToolbar.d.ts +13 -0
  457. package/dist/types/photo/RawFilePanel.d.ts +14 -0
  458. package/dist/types/photo/StyleTransferPanel.d.ts +15 -0
  459. package/dist/types/photo/aiStyleTransfer.d.ts +58 -0
  460. package/dist/types/photo/batchProcessing.d.ts +95 -0
  461. package/dist/types/photo/faceDetection.d.ts +103 -0
  462. package/dist/types/photo/index.d.ts +17 -0
  463. package/dist/types/photo/perspectiveCorrection.d.ts +134 -0
  464. package/dist/types/photo/photoEditorActions.d.ts +40 -0
  465. package/dist/types/photo/photoEditorTypes.d.ts +34 -0
  466. package/dist/types/photo/photoFilters.d.ts +55 -0
  467. package/dist/types/photo/photoOverlays.d.ts +126 -0
  468. package/dist/types/photo/photoSelection.d.ts +56 -0
  469. package/dist/types/photo/rawFileSupport.d.ts +124 -0
  470. package/dist/types/photo/usePhotoEditor.d.ts +123 -0
  471. package/dist/types/pixel/HSVPicker.d.ts +11 -0
  472. package/dist/types/pixel/PaletteExtractorPanel.d.ts +16 -0
  473. package/dist/types/pixel/PixelEditor.d.ts +17 -0
  474. package/dist/types/pixel/PixelEditorCanvas.d.ts +10 -0
  475. package/dist/types/pixel/PixelEditorMenuBar.d.ts +11 -0
  476. package/dist/types/pixel/PixelEditorRightPanel.d.ts +11 -0
  477. package/dist/types/pixel/PixelEditorStatusBar.d.ts +11 -0
  478. package/dist/types/pixel/PixelEditorTimeline.d.ts +11 -0
  479. package/dist/types/pixel/PixelEditorToolbar.d.ts +11 -0
  480. package/dist/types/pixel/TileMapPanel.d.ts +14 -0
  481. package/dist/types/pixel/asepriteFormat.d.ts +62 -0
  482. package/dist/types/pixel/paletteExtractor.d.ts +73 -0
  483. package/dist/types/pixel/pixelEditorExports.d.ts +31 -0
  484. package/dist/types/pixel/pixelEditorTypes.d.ts +51 -0
  485. package/dist/types/pixel/pixelEditorUtils.d.ts +136 -0
  486. package/dist/types/pixel/tileMapMode.d.ts +122 -0
  487. package/dist/types/pixel/usePixelEditor.d.ts +114 -0
  488. package/dist/types/texture/Nice3DTexturePainter.d.ts +55 -0
  489. package/dist/types/ui/NiceUIDesigner.d.ts +43 -0
  490. package/dist/types/vector/PathSimplificationPanel.d.ts +15 -0
  491. package/dist/types/vector/PdfExportPanel.d.ts +20 -0
  492. package/dist/types/vector/TextOnPathPanel.d.ts +26 -0
  493. package/dist/types/vector/VectorEditor.d.ts +32 -0
  494. package/dist/types/vector/VectorEditorMenuBar.d.ts +8 -0
  495. package/dist/types/vector/VectorEditorRightPanel.d.ts +7 -0
  496. package/dist/types/vector/VectorEditorShapeRenderer.d.ts +9 -0
  497. package/dist/types/vector/VectorEditorStatusBar.d.ts +9 -0
  498. package/dist/types/vector/VectorFilterPanel.d.ts +19 -0
  499. package/dist/types/vector/VectorPatternPanel.d.ts +21 -0
  500. package/dist/types/vector/pathSimplification.d.ts +135 -0
  501. package/dist/types/vector/pdfExport.d.ts +65 -0
  502. package/dist/types/vector/textOnPath.d.ts +145 -0
  503. package/dist/types/vector/useVectorEditor.d.ts +90 -0
  504. package/dist/types/vector/vectorBooleanOps.d.ts +22 -0
  505. package/dist/types/vector/vectorEditorExport.d.ts +8 -0
  506. package/dist/types/vector/vectorEditorImport.d.ts +7 -0
  507. package/dist/types/vector/vectorEditorTypes.d.ts +47 -0
  508. package/dist/types/vector/vectorGradients.d.ts +64 -0
  509. package/dist/types/vector/vectorPatternFills.d.ts +101 -0
  510. package/dist/types/vector/vectorSvgFilters.d.ts +134 -0
  511. package/package.json +93 -0
@@ -0,0 +1,179 @@
1
+ /**
2
+ * fixes.ts — Bug fixes and performance patches for editors.
3
+ *
4
+ * - PhotoEditor: Retina/HiDPI canvas devicePixelRatio handling
5
+ * - VectorEditor: Shape virtualization for >100 shapes
6
+ * - AnimationEditor: Memory leak prevention (raf/timer cleanup)
7
+ */
8
+ /**
9
+ * Configure a canvas for Retina/HiDPI displays.
10
+ * Scales the backing store while keeping CSS dimensions intact.
11
+ */
12
+ function setupRetinaCanvas(canvas, options) {
13
+ var _a;
14
+ const dpr = (_a = options.dpr) !== null && _a !== void 0 ? _a : (typeof window !== "undefined" ? window.devicePixelRatio : 1);
15
+ canvas.width = Math.round(options.width * dpr);
16
+ canvas.height = Math.round(options.height * dpr);
17
+ canvas.style.width = `${options.width}px`;
18
+ canvas.style.height = `${options.height}px`;
19
+ const ctx = canvas.getContext("2d");
20
+ ctx.scale(dpr, dpr);
21
+ return ctx;
22
+ }
23
+ /**
24
+ * Get the correct mouse position on a Retina canvas.
25
+ */
26
+ function retinaMousePosition(e, canvas) {
27
+ const rect = canvas.getBoundingClientRect();
28
+ return {
29
+ x: e.clientX - rect.left,
30
+ y: e.clientY - rect.top,
31
+ };
32
+ }
33
+ /**
34
+ * Given a list of shapes with bounding boxes and a visible viewport,
35
+ * returns only the shapes intersecting the viewport.
36
+ */
37
+ function virtualizeShapes(shapes, viewport, margin = 50) {
38
+ const vx = viewport.x - margin;
39
+ const vy = viewport.y - margin;
40
+ const vr = viewport.x + viewport.width + margin;
41
+ const vb = viewport.y + viewport.height + margin;
42
+ return shapes
43
+ .filter(({ bounds: b }) => {
44
+ const bx2 = b.x + b.width;
45
+ const by2 = b.y + b.height;
46
+ return bx2 >= vx && b.x <= vr && by2 >= vy && b.y <= vb;
47
+ })
48
+ .map(({ shape }) => shape);
49
+ }
50
+ /**
51
+ * Spatial hash grid for fast shape lookup.
52
+ * Greatly speeds up rendering and hit-testing with many shapes.
53
+ */
54
+ class SpatialHashGrid {
55
+ constructor(cellSize = 200) {
56
+ this.cellSize = cellSize;
57
+ this.cells = new Map();
58
+ }
59
+ cellKey(cx, cy) {
60
+ return `${cx},${cy}`;
61
+ }
62
+ /** Insert a shape into the grid. */
63
+ insert(shape, bounds) {
64
+ const x0 = Math.floor(bounds.x / this.cellSize);
65
+ const y0 = Math.floor(bounds.y / this.cellSize);
66
+ const x1 = Math.floor((bounds.x + bounds.width) / this.cellSize);
67
+ const y1 = Math.floor((bounds.y + bounds.height) / this.cellSize);
68
+ const vs = { shape, bounds };
69
+ for (let cx = x0; cx <= x1; cx++) {
70
+ for (let cy = y0; cy <= y1; cy++) {
71
+ const key = this.cellKey(cx, cy);
72
+ const cell = this.cells.get(key);
73
+ if (cell)
74
+ cell.push(vs);
75
+ else
76
+ this.cells.set(key, [vs]);
77
+ }
78
+ }
79
+ }
80
+ /** Query shapes overlapping the given viewport. */
81
+ query(viewport) {
82
+ const x0 = Math.floor(viewport.x / this.cellSize);
83
+ const y0 = Math.floor(viewport.y / this.cellSize);
84
+ const x1 = Math.floor((viewport.x + viewport.width) / this.cellSize);
85
+ const y1 = Math.floor((viewport.y + viewport.height) / this.cellSize);
86
+ const seen = new Set();
87
+ const result = [];
88
+ for (let cx = x0; cx <= x1; cx++) {
89
+ for (let cy = y0; cy <= y1; cy++) {
90
+ const cell = this.cells.get(this.cellKey(cx, cy));
91
+ if (!cell)
92
+ continue;
93
+ for (const vs of cell) {
94
+ if (!seen.has(vs.shape)) {
95
+ seen.add(vs.shape);
96
+ result.push(vs.shape);
97
+ }
98
+ }
99
+ }
100
+ }
101
+ return result;
102
+ }
103
+ /** Remove all shapes from the grid. */
104
+ clear() {
105
+ this.cells.clear();
106
+ }
107
+ /** Rebuild the grid from a list of shapes. */
108
+ rebuild(shapes) {
109
+ this.clear();
110
+ for (const vs of shapes)
111
+ this.insert(vs.shape, vs.bounds);
112
+ }
113
+ }
114
+ // ── Animation Memory Leak Prevention ────────────────────────────
115
+ /**
116
+ * Track requestAnimationFrame IDs and timers for proper cleanup.
117
+ */
118
+ class AnimationCleanup {
119
+ constructor() {
120
+ this.rafIds = new Set();
121
+ this.timerIds = new Set();
122
+ this.intervalIds = new Set();
123
+ this.disposed = false;
124
+ }
125
+ /** Wraps requestAnimationFrame with tracking. */
126
+ requestAnimationFrame(cb) {
127
+ if (this.disposed)
128
+ return -1;
129
+ const id = window.requestAnimationFrame((time) => {
130
+ this.rafIds.delete(id);
131
+ if (!this.disposed)
132
+ cb(time);
133
+ });
134
+ this.rafIds.add(id);
135
+ return id;
136
+ }
137
+ /** Wraps setTimeout with tracking. */
138
+ setTimeout(cb, ms) {
139
+ if (this.disposed)
140
+ return null;
141
+ const id = setTimeout(() => {
142
+ this.timerIds.delete(id);
143
+ if (!this.disposed)
144
+ cb();
145
+ }, ms);
146
+ this.timerIds.add(id);
147
+ return id;
148
+ }
149
+ /** Wraps setInterval with tracking. */
150
+ setInterval(cb, ms) {
151
+ if (this.disposed)
152
+ return null;
153
+ const id = setInterval(() => {
154
+ if (this.disposed) {
155
+ clearInterval(id);
156
+ return;
157
+ }
158
+ cb();
159
+ }, ms);
160
+ this.intervalIds.add(id);
161
+ return id;
162
+ }
163
+ /** Cancel all tracked timers and animation frames. */
164
+ dispose() {
165
+ this.disposed = true;
166
+ for (const id of this.rafIds)
167
+ window.cancelAnimationFrame(id);
168
+ for (const id of this.timerIds)
169
+ clearTimeout(id);
170
+ for (const id of this.intervalIds)
171
+ clearInterval(id);
172
+ this.rafIds.clear();
173
+ this.timerIds.clear();
174
+ this.intervalIds.clear();
175
+ }
176
+ }
177
+
178
+ export { AnimationCleanup, SpatialHashGrid, retinaMousePosition, setupRetinaCanvas, virtualizeShapes };
179
+ //# sourceMappingURL=fixes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixes.js","sources":["../../../src/core/fixes.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;AAMG;AAaH;;;AAGG;AACG,SAAU,iBAAiB,CAC/B,MAAyB,EACzB,OAA4B,EAAA;;IAE5B,MAAM,GAAG,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,GAAG,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,IAAK,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC,gBAAgB,GAAG,CAAC,CAAC;AACxF,IAAA,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC;AAC9C,IAAA,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC;IAChD,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,OAAO,CAAC,KAAK,CAAA,EAAA,CAAI;IACzC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAA,EAAA,CAAI;IAE3C,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAE;AACpC,IAAA,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC;AACnB,IAAA,OAAO,GAAG;AACZ;AAEA;;AAEG;AACG,SAAU,mBAAmB,CACjC,CAAoD,EACpD,MAAyB,EAAA;AAEzB,IAAA,MAAM,IA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ACX;;IAGA,WAAW,CAAC,EAAc,EAAE,EAAU,EAAA;QACpC,IAAI,IAAI,CAAC,QAAQ;AAAE,YAAA,OAAO,IAAiD;AAC3E,QAAA,MAAM,EAAE,GAAG,WAAW,CAAC,MAAK;AAC1B,YAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACjB,aAAa,CAAC,EAAE,CAAC;gBACjB;YACF;AACA,YAAA,EAAE,EAAE;QACN,CAAC,EAAE,EAAE,CAAC;AACN,QAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;AACxB,QAAA,OAAO,EAAE;IACX;;IAGA,OAAO,GAAA;AACL,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;AACpB,QAAA,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,MAAM;AAAE,YAAA,MAAM,CAAC,oBAAoB,CAAC,EAAE,CAAC;AAC7D,QAAA,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ;YAAE,YAAY,CAAC,EAAE,CAAC;AAChD,QAAA,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,WAAW;YAAE,aAAa,CAAC,EAAE,CAAC;AACpD,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;AACnB,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;AACrB,QAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE;IAC1B;AACD;;;;"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * gridGuides.ts — Grid, guides, rulers, and snap-to-grid/pixel for editors.
3
+ *
4
+ * Unified system for drawing grids, ruler bars, snapping to grid,
5
+ * and managing user-defined guide lines.
6
+ */
7
+ // ── Default Config ──────────────────────────────────────────────
8
+ // ── Grid Rendering ──────────────────────────────────────────────
9
+ /** Draw a grid on a canvas context. */
10
+ function drawGrid(ctx, width, height, config, offsetX = 0, offsetY = 0, zoom = 1) {
11
+ if (!config.enabled)
12
+ return;
13
+ const gridSize = config.size * zoom;
14
+ const subSize = gridSize / config.subdivisions;
15
+ ctx.save();
16
+ ctx.globalAlpha = config.opacity;
17
+ // Sub-grid
18
+ if (config.subdivisions > 1 && subSize >= 3) {
19
+ ctx.strokeStyle = config.subColor;
20
+ ctx.lineWidth = 0.5;
21
+ ctx.beginPath();
22
+ const startX = -(offsetX % subSize);
23
+ const startY = -(offsetY % subSize);
24
+ for (let x = startX; x <= width; x += subSize) {
25
+ ctx.moveTo(Math.round(x) + 0.5, 0);
26
+ ctx.lineTo(Math.round(x) + 0.5, height);
27
+ }
28
+ for (let y = startY; y <= height; y += subSize) {
29
+ ctx.moveTo(0, Math.round(y) + 0.5);
30
+ ctx.lineTo(width, Math.round(y) + 0.5);
31
+ }
32
+ ctx.stroke();
33
+ }
34
+ // Main grid
35
+ ctx.strokeStyle = config.color;
36
+ ctx.lineWidth = 1;
37
+ ctx.beginPath();
38
+ const mainStartX = -(offsetX % gridSize);
39
+ const mainStartY = -(offsetY % gridSize);
40
+ for (let x = mainStartX; x <= width; x += gridSize) {
41
+ ctx.moveTo(Math.round(x) + 0.5, 0);
42
+ ctx.lineTo(Math.round(x) + 0.5, height);
43
+ }
44
+ for (let y = mainStartY; y <= height; y += gridSize) {
45
+ ctx.moveTo(0, Math.round(y) + 0.5);
46
+ ctx.lineTo(width, Math.round(y) + 0.5);
47
+ }
48
+ ctx.stroke();
49
+ ctx.restore();
50
+ }
51
+ // ── Ruler Rendering ─────────────────────────────────────────────
52
+ /** Draw horizontal ruler bar. */
53
+ function drawHorizontalRuler(ctx, width, config, offsetX = 0, zoom = 1) {
54
+ if (!config.enabled)
55
+ return;
56
+ ctx.save();
57
+ ctx.fillStyle = config.backgroundColor;
58
+ ctx.fillRect(0, 0, width, config.size);
59
+ const step = calculateRulerStep(zoom);
60
+ ctx.strokeStyle = config.color;
61
+ ctx.fillStyle = config.textColor;
62
+ ctx.font = "9px monospace";
63
+ ctx.textAlign = "center";
64
+ const startX = Math.floor(-offsetX / (step * zoom)) * step;
65
+ const endX = startX + width / zoom + step;
66
+ for (let val = startX; val <= endX; val += step) {
67
+ const x = (val + offsetX / zoom) * zoom;
68
+ if (x < 0 || x > width)
69
+ continue;
70
+ // Major tick
71
+ ctx.beginPath();
72
+ ctx.moveTo(Math.round(x) + 0.5, config.size);
73
+ ctx.lineTo(Math.round(x) + 0.5, config.size - config.tickSize * 2);
74
+ ctx.stroke();
75
+ ctx.fillText(String(Math.round(val)), x, config.size - config.tickSize * 2 - 2);
76
+ // Minor ticks
77
+ for (let m = 1; m < 5; m++) {
78
+ const mx = ((val + (step * m) / 5) + offsetX / zoom) * zoom;
79
+ if (mx < 0 || mx > width)
80
+ continue;
81
+ ctx.beginPath();
82
+ ctx.moveTo(Math.round(mx) + 0.5, config.size);
83
+ ctx.lineTo(Math.round(mx) + 0.5, config.size - config.tickSize);
84
+ ctx.stroke();
85
+ }
86
+ }
87
+ ctx.restore();
88
+ }
89
+ /** Draw vertical ruler bar. */
90
+ function drawVerticalRuler(ctx, height, config, offsetY = 0, zoom = 1) {
91
+ if (!config.enabled)
92
+ return;
93
+ ctx.save();
94
+ ctx.fillStyle = config.backgroundColor;
95
+ ctx.fillRect(0, 0, config.size, height);
96
+ const step = calculateRulerStep(zoom);
97
+ ctx.strokeStyle = config.color;
98
+ ctx.fillStyle = config.textColor;
99
+ ctx.font = "9px monospace";
100
+ const startY = Math.floor(-offsetY / (step * zoom)) * step;
101
+ const endY = startY + height / zoom + step;
102
+ for (let val = startY; val <= endY; val += step) {
103
+ const y = (val + offsetY / zoom) * zoom;
104
+ if (y < 0 || y > height)
105
+ continue;
106
+ ctx.beginPath();
107
+ ctx.moveTo(config.size, Math.round(y) + 0.5);
108
+ ctx.lineTo(config.size - config.tickSize * 2, Math.round(y) + 0.5);
109
+ ctx.stroke();
110
+ // Rotated text
111
+ ctx.save();
112
+ ctx.translate(config.size - config.tickSize * 2 - 2, y);
113
+ ctx.rotate(-Math.PI / 2);
114
+ ctx.textAlign = "center";
115
+ ctx.fillText(String(Math.round(val)), 0, 0);
116
+ ctx.restore();
117
+ }
118
+ ctx.restore();
119
+ }
120
+ function calculateRulerStep(zoom) {
121
+ var _a;
122
+ const idealStep = 50 / zoom;
123
+ const magnitude = Math.pow(10, Math.floor(Math.log10(idealStep)));
124
+ const candidates = [1, 2, 5, 10].map((m) => m * magnitude);
125
+ return (_a = candidates.find((c) => c >= idealStep)) !== null && _a !== void 0 ? _a : idealStep;
126
+ }
127
+ // ── Guide Rendering ─────────────────────────────────────────────
128
+ /** Draw guides on a canvas context. */
129
+ function drawGuides(ctx, width, height, config, offsetX = 0, offsetY = 0, zoom = 1) {
130
+ if (!config.enabled)
131
+ return;
132
+ ctx.save();
133
+ ctx.setLineDash([6, 3]);
134
+ ctx.lineWidth = 1;
135
+ for (const guide of config.guides) {
136
+ ctx.strokeStyle = guide.color || config.color;
137
+ ctx.beginPath();
138
+ if (guide.orientation === "horizontal") {
139
+ const y = (guide.position + offsetY / zoom) * zoom;
140
+ ctx.moveTo(0, Math.round(y) + 0.5);
141
+ ctx.lineTo(width, Math.round(y) + 0.5);
142
+ }
143
+ else {
144
+ const x = (guide.position + offsetX / zoom) * zoom;
145
+ ctx.moveTo(Math.round(x) + 0.5, 0);
146
+ ctx.lineTo(Math.round(x) + 0.5, height);
147
+ }
148
+ ctx.stroke();
149
+ }
150
+ ctx.setLineDash([]);
151
+ ctx.restore();
152
+ }
153
+ // ── Snapping ────────────────────────────────────────────────────
154
+ /** Snap a point to the grid. */
155
+ function snapToGrid(x, y, gridSize) {
156
+ return {
157
+ x: Math.round(x / gridSize) * gridSize,
158
+ y: Math.round(y / gridSize) * gridSize,
159
+ snappedX: true,
160
+ snappedY: true,
161
+ };
162
+ }
163
+ /** Snap a point to nearby guides. */
164
+ function snapToGuides(x, y, guides, snapDistance) {
165
+ let sx = x, sy = y;
166
+ let snappedX = false, snappedY = false;
167
+ for (const guide of guides) {
168
+ if (guide.orientation === "vertical") {
169
+ if (Math.abs(x - guide.position) <= snapDistance) {
170
+ sx = guide.position;
171
+ snappedX = true;
172
+ }
173
+ }
174
+ else {
175
+ if (Math.abs(y - guide.position) <= snapDistance) {
176
+ sy = guide.position;
177
+ snappedY = true;
178
+ }
179
+ }
180
+ }
181
+ return { x: sx, y: sy, snappedX, snappedY };
182
+ }
183
+ /** Snap to pixel (floor to nearest integer). */
184
+ function snapToPixel(x, y) {
185
+ return {
186
+ x: Math.round(x),
187
+ y: Math.round(y),
188
+ snappedX: true,
189
+ snappedY: true,
190
+ };
191
+ }
192
+ /** Combined snap: try guides first, then grid, then pixel. */
193
+ function snapPoint(x, y, gridConfig, guidesConfig) {
194
+ // Try guides first
195
+ if (guidesConfig.enabled && guidesConfig.snapToGuides) {
196
+ const guideResult = snapToGuides(x, y, guidesConfig.guides, guidesConfig.snapDistance);
197
+ if (guideResult.snappedX || guideResult.snappedY)
198
+ return guideResult;
199
+ }
200
+ // Then grid
201
+ if (gridConfig.enabled && gridConfig.snapToGrid) {
202
+ return snapToGrid(x, y, gridConfig.size);
203
+ }
204
+ return { x, y, snappedX: false, snappedY: false };
205
+ }
206
+ // ── Guide Management ────────────────────────────────────────────
207
+ let nextGuideId = 1;
208
+ /** Create a new guide. */
209
+ function createGuide(orientation, position, color) {
210
+ return {
211
+ id: `guide-${nextGuideId++}`,
212
+ orientation,
213
+ position,
214
+ color: color !== null && color !== void 0 ? color : "rgba(59, 130, 246, 0.6)",
215
+ locked: false,
216
+ };
217
+ }
218
+ /** Add a guide to the config. */
219
+ function addGuide(config, guide) {
220
+ return { ...config, guides: [...config.guides, guide] };
221
+ }
222
+ /** Remove a guide by ID. */
223
+ function removeGuide(config, guideId) {
224
+ return { ...config, guides: config.guides.filter((g) => g.id !== guideId) };
225
+ }
226
+ /** Clear all guides. */
227
+ function clearGuides(config) {
228
+ return { ...config, guides: [] };
229
+ }
230
+
231
+ export { addGuide, clearGuides, createGuide, drawGrid, drawGuides, drawHorizontalRuler, drawVerticalRuler, removeGuide, snapPoint, snapToGrid, snapToGuides, snapToPixel };
232
+ //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AU,CAAC,UAAU,EAAE;QAC/C,OAAO,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC;IAC1C;AAEA,IAAA,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;AACnD;AAEA;AAEA,IAAI,WAAW,GAAG,CAAC;AAEnB;SACgB,WAAW,CACzB,WAAsC,EACtC,QAAgB,EAChB,KAAc,EAAA;IAEd,OAAO;AACL,QAAA,EAAE,EAAE,CAAA,MAAA,EAAS,WAAW,EAAE,CAAA,CAAE;QAC5B,WAAW;QACX,QAAQ;AACR,QAAA,KAAK,EAAE,KAAK,KAAA,IAAA,IAAL,KAAK,KAAA,MAAA,GAAL,KAAK,GAAI,yBAAyB;AACzC,QAAA,MAAM,EAAE,KAAK;KACd;AACH;AAEA;AACM,SAAU,QAAQ,CAAC,MAAoB,EAAE,KAAY,EAAA;AACzD,IAAA,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;AACzD;AAEA;AACM,SAAU,WAAW,CAAC,MAAoB,EAAE,OAAe,EAAA;IAC/D,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE;AAC7E;AAEA;AACM,SAAU,WAAW,CAAC,MAAoB,EAAA;IAC9C,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE;AAClC;;;;"}
@@ -0,0 +1,121 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * historyVisual.ts — Visual undo/redo history for editors.
5
+ *
6
+ * Provides a visual timeline showing thumbnails/labels for each history entry,
7
+ * allowing users to click on any point to jump to that state.
8
+ */
9
+ // ── Hook ────────────────────────────────────────────────────────
10
+ let nextHistoryId = 1;
11
+ /** React hook for visual undo/redo history management. */
12
+ function useVisualHistory(maxEntries = 100) {
13
+ const [state, setState] = React.useState({
14
+ entries: [],
15
+ currentIndex: -1,
16
+ });
17
+ const push = React.useCallback((label, snapshot, thumbnail) => {
18
+ setState((prev) => {
19
+ // Trim redo stack
20
+ const entries = prev.entries.slice(0, prev.currentIndex + 1);
21
+ const entry = {
22
+ id: nextHistoryId++,
23
+ label,
24
+ timestamp: Date.now(),
25
+ thumbnail,
26
+ state: snapshot,
27
+ };
28
+ entries.push(entry);
29
+ // Enforce max
30
+ while (entries.length > maxEntries)
31
+ entries.shift();
32
+ return { entries, currentIndex: entries.length - 1 };
33
+ });
34
+ }, [maxEntries]);
35
+ const undo = React.useCallback(() => {
36
+ let result = null;
37
+ setState((prev) => {
38
+ if (prev.currentIndex <= 0)
39
+ return prev;
40
+ const newIndex = prev.currentIndex - 1;
41
+ result = prev.entries[newIndex].state;
42
+ return { ...prev, currentIndex: newIndex };
43
+ });
44
+ return result;
45
+ }, []);
46
+ const redo = React.useCallback(() => {
47
+ let result = null;
48
+ setState((prev) => {
49
+ if (prev.currentIndex >= prev.entries.length - 1)
50
+ return prev;
51
+ const newIndex = prev.currentIndex + 1;
52
+ result = prev.entries[newIndex].state;
53
+ return { ...prev, currentIndex: newIndex };
54
+ });
55
+ return result;
56
+ }, []);
57
+ const jumpTo = React.useCallback((index) => {
58
+ let result = null;
59
+ setState((prev) => {
60
+ if (index < 0 || index >= prev.entries.length)
61
+ return prev;
62
+ result = prev.entries[index].state;
63
+ return { ...prev, currentIndex: index };
64
+ });
65
+ return result;
66
+ }, []);
67
+ const clear = React.useCallback(() => {
68
+ setState({ entries: [], currentIndex: -1 });
69
+ }, []);
70
+ return {
71
+ push,
72
+ undo,
73
+ redo,
74
+ jumpTo,
75
+ getState: () => state,
76
+ canUndo: state.currentIndex > 0,
77
+ canRedo: state.currentIndex < state.entries.length - 1,
78
+ count: state.entries.length,
79
+ currentIndex: state.currentIndex,
80
+ entries: state.entries,
81
+ clear,
82
+ };
83
+ }
84
+ /** Visual history timeline panel showing entries with thumbnails. */
85
+ function VisualHistoryPanel({ history, onJump, className = "", style, }) {
86
+ const handleClick = (index) => {
87
+ const state = history.jumpTo(index);
88
+ if (state !== null && onJump)
89
+ onJump(state);
90
+ };
91
+ return React.createElement("div", {
92
+ className: `nice-visual-history ${className}`,
93
+ style: { display: "flex", flexDirection: "column", gap: 2, padding: 4, ...style },
94
+ }, React.createElement("div", {
95
+ style: { display: "flex", justifyContent: "space-between", marginBottom: 4, fontSize: 11 },
96
+ }, React.createElement("strong", null, "History"), React.createElement("span", { style: { opacity: 0.6 } }, `${history.currentIndex + 1} / ${history.count}`)), React.createElement("div", {
97
+ style: { display: "flex", flexDirection: "column", gap: 1, overflowY: "auto", maxHeight: 300 },
98
+ }, history.entries.map((entry, idx) => React.createElement("div", {
99
+ key: entry.id,
100
+ onClick: () => handleClick(idx),
101
+ style: {
102
+ display: "flex",
103
+ alignItems: "center",
104
+ gap: 4,
105
+ padding: "3px 6px",
106
+ cursor: "pointer",
107
+ fontSize: 11,
108
+ borderRadius: 3,
109
+ background: idx === history.currentIndex ? "rgba(59,130,246,0.15)" : "transparent",
110
+ fontWeight: idx === history.currentIndex ? 600 : 400,
111
+ opacity: idx > history.currentIndex ? 0.4 : 1,
112
+ },
113
+ }, entry.thumbnail && React.createElement("img", {
114
+ src: entry.thumbnail,
115
+ alt: "",
116
+ style: { width: 24, height: 24, borderRadius: 2, objectFit: "cover" },
117
+ }), React.createElement("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, entry.label)))));
118
+ }
119
+
120
+ export { VisualHistoryPanel, useVisualHistory };
121
+ //# sourceMappingURL=historyVisual.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historyVisual.js","sources":["../../../src/core/historyVisual.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AA6CH;AAEA,IAAI,aAAa,GAA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,QAAA,GAAG,EAAE,EAAE;AACP,QAAA,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;AACtE,KAAA,CAAC,EACF,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EACpH,KAAK,CAAC,KAAK,CACZ,CACF,CACF,CACF,CACF;AACH;;;;"}
@@ -0,0 +1,13 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createContext, useContext } from 'react';
3
+
4
+ const fallback = (_key, defaultValue) => defaultValue;
5
+ const NiceI18nContext = createContext(fallback);
6
+ const NiceI18nProvider = ({ t, children }) => (jsx(NiceI18nContext.Provider, { value: t, children: children }));
7
+ function useNiceTranslation() {
8
+ const t = useContext(NiceI18nContext);
9
+ return { t };
10
+ }
11
+
12
+ export { NiceI18nProvider, useNiceTranslation };
13
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.js","sources":["../../../src/core/i18n.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;AAqBA,MAAM,QAAQ,GAAoB,CAAC,IAAY,EAAE,YAAoB,KAAK,YAAY;AAEtF,MAAM,eAAe,GAAG,aAAa,CAAkB,QAAQ,CAAC;AAOzD,MAAM,gBAAgB,GAAoC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,MAC/EA,GAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,CAAC,EAAA,QAAA,EAAG,QAAQ,EAAA,CAA4B;SAG3D,kBAAkB,GAAA;AAChC,IAAA,MAAM,CAAC,GAAG,UAAU,CAAC,eAAe,CAAC;IACrC,OAAO,EAAE,CAAC,EAAE;AACd;;;;"}