@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,254 @@
1
+ /**
2
+ * integrations.ts — External service integrations for editors.
3
+ *
4
+ * Stock image pickers (Unsplash/Pexels), Adobe CC connector,
5
+ * Figma import/export, template library, and AI image generation.
6
+ */
7
+ // ── Unsplash Integration ────────────────────────────────────────
8
+ class UnsplashProvider {
9
+ constructor(accessKey) {
10
+ this.accessKey = accessKey;
11
+ }
12
+ async search(options) {
13
+ const { query, page = 1, perPage = 20, orientation } = options;
14
+ const params = new URLSearchParams({
15
+ query,
16
+ page: String(page),
17
+ per_page: String(perPage),
18
+ ...(orientation ? { orientation } : {}),
19
+ });
20
+ const response = await fetch(`https://api.unsplash.com/search/photos?${params}`, { headers: { Authorization: `Client-ID ${this.accessKey}` } });
21
+ if (!response.ok)
22
+ throw new Error(`Unsplash API error: ${response.status}`);
23
+ const data = await response.json();
24
+ return data.results.map((r) => ({
25
+ id: String(r.id),
26
+ url: String(r.urls.regular),
27
+ thumbnailUrl: String(r.urls.thumb),
28
+ author: String(r.user.name),
29
+ source: "unsplash",
30
+ width: Number(r.width),
31
+ height: Number(r.height),
32
+ description: r.description ? String(r.description) : undefined,
33
+ }));
34
+ }
35
+ }
36
+ // ── Pexels Integration ──────────────────────────────────────────
37
+ class PexelsProvider {
38
+ constructor(apiKey) {
39
+ this.apiKey = apiKey;
40
+ }
41
+ async search(options) {
42
+ const { query, page = 1, perPage = 20, orientation } = options;
43
+ const params = new URLSearchParams({
44
+ query,
45
+ page: String(page),
46
+ per_page: String(perPage),
47
+ ...(orientation ? { orientation } : {}),
48
+ });
49
+ const response = await fetch(`https://api.pexels.com/v1/search?${params}`, { headers: { Authorization: this.apiKey } });
50
+ if (!response.ok)
51
+ throw new Error(`Pexels API error: ${response.status}`);
52
+ const data = await response.json();
53
+ return data.photos.map((p) => {
54
+ var _a;
55
+ return ({
56
+ id: String(p.id),
57
+ url: String(p.src.large),
58
+ thumbnailUrl: String(p.src.tiny),
59
+ author: String(p.photographer),
60
+ source: "pexels",
61
+ width: Number(p.width),
62
+ height: Number(p.height),
63
+ description: String((_a = p.alt) !== null && _a !== void 0 ? _a : ""),
64
+ });
65
+ });
66
+ }
67
+ }
68
+ class AdobeCCConnector {
69
+ constructor(config) {
70
+ this.config = config;
71
+ }
72
+ /** Get the OAuth authorization URL. */
73
+ getAuthUrl() {
74
+ const params = new URLSearchParams({
75
+ client_id: this.config.clientId,
76
+ redirect_uri: this.config.redirectUri,
77
+ scope: "openid,creative_sdk",
78
+ response_type: "code",
79
+ });
80
+ return `https://ims-na1.adobelogin.com/ims/authorize/v2?${params}`;
81
+ }
82
+ /** Import a file from Adobe CC Libraries. */
83
+ async importFromLibrary(accessToken, assetId) {
84
+ const response = await fetch(`https://cc-api-storage.adobe.io/assets/${encodeURIComponent(assetId)}/rendition`, { headers: { Authorization: `Bearer ${accessToken}`, "x-api-key": this.config.clientId } });
85
+ if (!response.ok)
86
+ throw new Error(`Adobe CC API error: ${response.status}`);
87
+ return response.blob();
88
+ }
89
+ }
90
+ // ── Figma Integration ───────────────────────────────────────────
91
+ class FigmaConnector {
92
+ constructor(accessToken) {
93
+ this.accessToken = accessToken;
94
+ }
95
+ /** Import nodes from a Figma file. */
96
+ async importFile(fileKey, nodeIds) {
97
+ var _a;
98
+ const url = `https://api.figma.com/v1/files/${encodeURIComponent(fileKey)}` +
99
+ ((nodeIds === null || nodeIds === void 0 ? void 0 : nodeIds.length) ? `?ids=${nodeIds.map(encodeURIComponent).join(",")}` : "");
100
+ const response = await fetch(url, {
101
+ headers: { "X-Figma-Token": this.accessToken },
102
+ });
103
+ if (!response.ok)
104
+ throw new Error(`Figma API error: ${response.status}`);
105
+ const data = await response.json();
106
+ const nodes = this.extractNodes(data.document);
107
+ // Fetch images for nodes
108
+ const images = new Map();
109
+ if (nodes.length > 0) {
110
+ const ids = nodes.map((n) => n.id).join(",");
111
+ const imgResp = await fetch(`https://api.figma.com/v1/images/${encodeURIComponent(fileKey)}?ids=${ids}&format=svg`, { headers: { "X-Figma-Token": this.accessToken } });
112
+ if (imgResp.ok) {
113
+ const imgData = await imgResp.json();
114
+ for (const [id, imgUrl] of Object.entries((_a = imgData.images) !== null && _a !== void 0 ? _a : {})) {
115
+ if (typeof imgUrl === "string") {
116
+ const blobResp = await fetch(imgUrl);
117
+ if (blobResp.ok)
118
+ images.set(id, await blobResp.blob());
119
+ }
120
+ }
121
+ }
122
+ }
123
+ return { nodes, images };
124
+ }
125
+ /** Export a design to Figma (via plugin API—returns Figma plugin code). */
126
+ exportToFigmaPlugin(svg, nodeName = "Nice2Dev Export") {
127
+ return `// Figma Plugin — paste into Figma Plugin Console
128
+ const node = figma.createNodeFromSvg(\`${svg.replace(/`/g, "\\`")}\`);
129
+ node.name = "${nodeName}";
130
+ figma.currentPage.appendChild(node);
131
+ figma.viewport.scrollAndZoomIntoView([node]);
132
+ figma.closePlugin("Imported from Nice2Dev");`;
133
+ }
134
+ extractNodes(document) {
135
+ const nodes = [];
136
+ const walk = (node) => {
137
+ var _a, _b, _c;
138
+ if (node.type && node.id) {
139
+ const abs = node.absoluteBoundingBox;
140
+ nodes.push({
141
+ id: String(node.id),
142
+ name: String((_a = node.name) !== null && _a !== void 0 ? _a : ""),
143
+ type: String(node.type),
144
+ width: (_b = abs === null || abs === void 0 ? void 0 : abs.width) !== null && _b !== void 0 ? _b : 0,
145
+ height: (_c = abs === null || abs === void 0 ? void 0 : abs.height) !== null && _c !== void 0 ? _c : 0,
146
+ });
147
+ }
148
+ const children = node.children;
149
+ if (Array.isArray(children))
150
+ children.forEach(walk);
151
+ };
152
+ walk(document);
153
+ return nodes;
154
+ }
155
+ }
156
+ // ── Template Library ────────────────────────────────────────────
157
+ class TemplateLibrary {
158
+ constructor() {
159
+ this.templates = [];
160
+ }
161
+ /** Register a template. */
162
+ register(template) {
163
+ this.templates.push(template);
164
+ }
165
+ /** Get all templates. */
166
+ getAll() {
167
+ return [...this.templates];
168
+ }
169
+ /** Get templates by category. */
170
+ getByCategory(category) {
171
+ return this.templates.filter((t) => t.category === category);
172
+ }
173
+ /** Get all categories. */
174
+ getCategories() {
175
+ return [...new Set(this.templates.map((t) => t.category))];
176
+ }
177
+ /** Search templates by name. */
178
+ search(query) {
179
+ const lower = query.toLowerCase();
180
+ return this.templates.filter((t) => t.name.toLowerCase().includes(lower));
181
+ }
182
+ }
183
+ // ── AI Image Generation ─────────────────────────────────────────
184
+ async function generateAIImage(options) {
185
+ var _a, _b;
186
+ const { prompt, width = 512, height = 512, style = "realistic", provider, apiKey, apiUrl } = options;
187
+ if (!apiKey)
188
+ throw new Error("API key is required for AI image generation");
189
+ let url;
190
+ let body;
191
+ const headers = { "Content-Type": "application/json" };
192
+ switch (provider) {
193
+ case "openai":
194
+ url = "https://api.openai.com/v1/images/generations";
195
+ headers["Authorization"] = `Bearer ${apiKey}`;
196
+ body = JSON.stringify({
197
+ model: "dall-e-3",
198
+ prompt: `${prompt} (style: ${style})`,
199
+ n: 1,
200
+ size: `${width}x${height}`,
201
+ response_format: "url",
202
+ });
203
+ break;
204
+ case "stability":
205
+ url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image";
206
+ headers["Authorization"] = `Bearer ${apiKey}`;
207
+ body = JSON.stringify({
208
+ text_prompts: [{ text: prompt, weight: 1 }],
209
+ cfg_scale: 7,
210
+ width, height,
211
+ samples: 1,
212
+ steps: 30,
213
+ style_preset: style === "pixel-art" ? "pixel-art" : style === "vector" ? "line-art" : undefined,
214
+ });
215
+ break;
216
+ case "custom":
217
+ if (!apiUrl)
218
+ throw new Error("Custom API URL is required");
219
+ url = apiUrl;
220
+ headers["Authorization"] = `Bearer ${apiKey}`;
221
+ body = JSON.stringify({ prompt, width, height, style });
222
+ break;
223
+ default:
224
+ throw new Error(`Unknown AI provider: ${provider}`);
225
+ }
226
+ const response = await fetch(url, { method: "POST", headers, body });
227
+ if (!response.ok)
228
+ throw new Error(`AI generation failed: ${response.status}`);
229
+ const data = await response.json();
230
+ // Extract image URL based on provider
231
+ let imageUrl;
232
+ if (provider === "openai") {
233
+ imageUrl = data.data[0].url;
234
+ }
235
+ else if (provider === "stability") {
236
+ imageUrl = `data:image/png;base64,${data.artifacts[0].base64}`;
237
+ }
238
+ else {
239
+ imageUrl = (_b = (_a = data.url) !== null && _a !== void 0 ? _a : data.image) !== null && _b !== void 0 ? _b : "";
240
+ }
241
+ const imgResp = imageUrl.startsWith("data:") ? null : await fetch(imageUrl);
242
+ const imageBlob = imgResp ? await imgResp.blob() : base64ToBlob(imageUrl.split(",")[1], "image/png");
243
+ return { imageUrl, imageBlob, metadata: data };
244
+ }
245
+ function base64ToBlob(base64, mimeType) {
246
+ const bytes = atob(base64);
247
+ const arr = new Uint8Array(bytes.length);
248
+ for (let i = 0; i < bytes.length; i++)
249
+ arr[i] = bytes.charCodeAt(i);
250
+ return new Blob([arr], { type: mimeType });
251
+ }
252
+
253
+ export { AdobeCCConnector, FigmaConnector, PexelsProvider, TemplateLibrary, UnsplashProvider, generateAIImage };
254
+ //# sourceMappingURL=integrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.js","sources":["../../../src/core/integrations.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;AAKG;AA+DH;MAEa,gBAAgB,CAAA;AAC3B,IAAA,WAAA,CAAoB,SAAiB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AAE,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AACnE,IAAA,OAAO,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5C;;;;"}
@@ -0,0 +1,139 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * minimap.ts — Zoom navigator / minimap component for editors.
5
+ *
6
+ * Provides a small overview of the full canvas with a viewport indicator
7
+ * that can be dragged to navigate around the document.
8
+ */
9
+ // ── Component ───────────────────────────────────────────────────
10
+ /** Zoom navigator / minimap showing a scaled-down view of the full document. */
11
+ const Minimap = ({ canvasRef, imageDataUrl, documentWidth, documentHeight, viewport, onViewportChange, config = {}, className = "", }) => {
12
+ const { width: mapW = 160, height: mapH = 120, visible = true, position = "bottom-right", opacity = 0.85, } = config;
13
+ const minimapCanvasRef = React.useRef(null);
14
+ const isDragging = React.useRef(false);
15
+ const scaleX = mapW / (documentWidth || 1);
16
+ const scaleY = mapH / (documentHeight || 1);
17
+ const scale = Math.min(scaleX, scaleY);
18
+ // Draw minimap
19
+ React.useEffect(() => {
20
+ if (!visible)
21
+ return;
22
+ const canvas = minimapCanvasRef.current;
23
+ if (!canvas)
24
+ return;
25
+ const ctx = canvas.getContext("2d");
26
+ if (!ctx)
27
+ return;
28
+ ctx.clearRect(0, 0, mapW, mapH);
29
+ // Draw background
30
+ ctx.fillStyle = "#1a1a2e";
31
+ ctx.fillRect(0, 0, mapW, mapH);
32
+ // Draw document content
33
+ if (canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current) {
34
+ const sw = documentWidth * scale;
35
+ const sh = documentHeight * scale;
36
+ ctx.drawImage(canvasRef.current, 0, 0, documentWidth, documentHeight, 0, 0, sw, sh);
37
+ }
38
+ else if (imageDataUrl) {
39
+ const img = new Image();
40
+ img.onload = () => {
41
+ const sw = documentWidth * scale;
42
+ const sh = documentHeight * scale;
43
+ ctx.drawImage(img, 0, 0, sw, sh);
44
+ drawViewport(ctx);
45
+ };
46
+ img.src = imageDataUrl;
47
+ return;
48
+ }
49
+ drawViewport(ctx);
50
+ }, [visible, canvasRef, imageDataUrl, viewport, documentWidth, documentHeight, scale, mapW, mapH]);
51
+ function drawViewport(ctx) {
52
+ // Draw viewport rect
53
+ const vx = viewport.x * scale;
54
+ const vy = viewport.y * scale;
55
+ const vw = viewport.width * scale;
56
+ const vh = viewport.height * scale;
57
+ ctx.strokeStyle = "rgba(59, 130, 246, 0.8)";
58
+ ctx.lineWidth = 1.5;
59
+ ctx.strokeRect(vx, vy, vw, vh);
60
+ // Dim areas outside viewport
61
+ ctx.fillStyle = "rgba(0, 0, 0, 0.3)";
62
+ // Top
63
+ ctx.fillRect(0, 0, mapW, vy);
64
+ // Bottom
65
+ ctx.fillRect(0, vy + vh, mapW, mapH - vy - vh);
66
+ // Left
67
+ ctx.fillRect(0, vy, vx, vh);
68
+ // Right
69
+ ctx.fillRect(vx + vw, vy, mapW - vx - vw, vh);
70
+ }
71
+ const handlePointerDown = (e) => {
72
+ isDragging.current = true;
73
+ updateViewportFromPointer(e);
74
+ e.target.setPointerCapture(e.pointerId);
75
+ };
76
+ const handlePointerMove = (e) => {
77
+ if (!isDragging.current)
78
+ return;
79
+ updateViewportFromPointer(e);
80
+ };
81
+ const handlePointerUp = () => {
82
+ isDragging.current = false;
83
+ };
84
+ function updateViewportFromPointer(e) {
85
+ var _a;
86
+ const rect = (_a = minimapCanvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
87
+ if (!rect || !onViewportChange)
88
+ return;
89
+ const mx = e.clientX - rect.left;
90
+ const my = e.clientY - rect.top;
91
+ const docX = mx / scale - viewport.width / 2;
92
+ const docY = my / scale - viewport.height / 2;
93
+ onViewportChange({
94
+ x: Math.max(0, Math.min(documentWidth - viewport.width, docX)),
95
+ y: Math.max(0, Math.min(documentHeight - viewport.height, docY)),
96
+ width: viewport.width,
97
+ height: viewport.height,
98
+ });
99
+ }
100
+ if (!visible)
101
+ return null;
102
+ const positionStyles = {
103
+ "top-left": { top: 8, left: 8 },
104
+ "top-right": { top: 8, right: 8 },
105
+ "bottom-left": { bottom: 8, left: 8 },
106
+ "bottom-right": { bottom: 8, right: 8 },
107
+ };
108
+ return React.createElement("div", {
109
+ className: `nice-minimap ${className}`,
110
+ style: {
111
+ position: "absolute",
112
+ ...positionStyles[position],
113
+ opacity,
114
+ borderRadius: 4,
115
+ overflow: "hidden",
116
+ border: "1px solid rgba(255,255,255,0.2)",
117
+ cursor: "crosshair",
118
+ zIndex: 100,
119
+ },
120
+ }, React.createElement("canvas", {
121
+ ref: minimapCanvasRef,
122
+ width: mapW,
123
+ height: mapH,
124
+ onPointerDown: handlePointerDown,
125
+ onPointerMove: handlePointerMove,
126
+ onPointerUp: handlePointerUp,
127
+ style: { display: "block" },
128
+ }));
129
+ };
130
+ // ── Hook ────────────────────────────────────────────────────────
131
+ /** Hook for managing minimap visibility state. */
132
+ function useMinimap(initialVisible = true) {
133
+ const [visible, setVisible] = React.useState(initialVisible);
134
+ const toggle = React.useCallback(() => setVisible((v) => !v), []);
135
+ return { visible, setVisible, toggle };
136
+ }
137
+
138
+ export { Minimap, useMinimap };
139
+ //# sourceMappingURL=minimap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"minimap.js","sources":["../../../src/core/minimap.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AA0CH;AAEA;AACO,MAAM,OAAO,GAA2B,CAAC,EAC9C,SAAS,EACT,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,MAAM,GAAG,EAAE,EACX,SAAS,GAAG,EAAE,GACf,KAAI;IACH,MAAM,EACJ,KAAK,EAAE,IAAI,GAAG,GAAG,EACjB,MAAM,EAAE,IAAI,GAAG,GAAG,EAClB,OAAO,GAAG,IAAI,EACd,QAAQ,GAAG,cAAc,EACzB,OAAO,GAAG,IAAI,GACf,GAAG,MAAM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,QAAA,aAAa,EAAE,iBAAiB;AAChC,QAAA,aAAa,EAAE,iBAAiB;AAChC,QAAA,WAAW,EAAE,eAAe;AAC5B,QAAA,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;AAC5B,KAAA,CAAC,CACH;AACH;AAEA;AAEA;AACM,SAAU,UAAU,CAAC,cAAc,GAAG,IAAI,EAAA;AAC9C,IAAA,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC;IAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACjE,IAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE;AACxC;;;;"}
@@ -0,0 +1,124 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * plugins.ts — Plugin system for @nice2dev/ui-graphics editors.
5
+ *
6
+ * Allows third-party extensions to register custom tools, filters,
7
+ * export formats, and UI panels for any editor.
8
+ */
9
+ // ── Plugin Registry ─────────────────────────────────────────────
10
+ class PluginRegistryImpl {
11
+ constructor() {
12
+ this.plugins = new Map();
13
+ this.listeners = new Map();
14
+ }
15
+ /** Register a plugin. Calls onInit if defined. */
16
+ register(plugin) {
17
+ var _a;
18
+ if (this.plugins.has(plugin.id)) {
19
+ console.warn(`[PluginRegistry] Plugin "${plugin.id}" already registered, replacing.`);
20
+ this.unregister(plugin.id);
21
+ }
22
+ this.plugins.set(plugin.id, plugin);
23
+ (_a = plugin.onInit) === null || _a === void 0 ? void 0 : _a.call(plugin);
24
+ this.emit("register", plugin);
25
+ }
26
+ /** Unregister a plugin. Calls onDestroy if defined. */
27
+ unregister(pluginId) {
28
+ var _a;
29
+ const plugin = this.plugins.get(pluginId);
30
+ if (plugin) {
31
+ (_a = plugin.onDestroy) === null || _a === void 0 ? void 0 : _a.call(plugin);
32
+ this.plugins.delete(pluginId);
33
+ this.emit("unregister", plugin);
34
+ }
35
+ }
36
+ /** Get a registered plugin by ID. */
37
+ get(pluginId) {
38
+ return this.plugins.get(pluginId);
39
+ }
40
+ /** Get all registered plugins. */
41
+ getAll() {
42
+ return Array.from(this.plugins.values());
43
+ }
44
+ /** Get plugins for a specific editor type. */
45
+ getForEditor(editor) {
46
+ return this.getAll().filter((p) => !p.editors || p.editors.length === 0 || p.editors.includes(editor));
47
+ }
48
+ /** Get all tools from plugins for a specific editor. */
49
+ getTools(editor) {
50
+ return this.getForEditor(editor).flatMap((p) => { var _a; return (_a = p.tools) !== null && _a !== void 0 ? _a : []; });
51
+ }
52
+ /** Get all filters from plugins for a specific editor. */
53
+ getFilters(editor) {
54
+ return this.getForEditor(editor).flatMap((p) => { var _a; return (_a = p.filters) !== null && _a !== void 0 ? _a : []; });
55
+ }
56
+ /** Get all exporters from plugins for a specific editor. */
57
+ getExporters(editor) {
58
+ return this.getForEditor(editor).flatMap((p) => { var _a; return (_a = p.exporters) !== null && _a !== void 0 ? _a : []; });
59
+ }
60
+ /** Get all panels from plugins for a specific editor. */
61
+ getPanels(editor) {
62
+ return this.getForEditor(editor).flatMap((p) => { var _a; return (_a = p.panels) !== null && _a !== void 0 ? _a : []; });
63
+ }
64
+ /** Get all menu actions from plugins for a specific editor. */
65
+ getMenuActions(editor) {
66
+ return this.getForEditor(editor).flatMap((p) => { var _a; return (_a = p.menuActions) !== null && _a !== void 0 ? _a : []; });
67
+ }
68
+ /** Subscribe to registry events. */
69
+ on(event, handler) {
70
+ if (!this.listeners.has(event))
71
+ this.listeners.set(event, new Set());
72
+ this.listeners.get(event).add(handler);
73
+ return () => { var _a; return (_a = this.listeners.get(event)) === null || _a === void 0 ? void 0 : _a.delete(handler); };
74
+ }
75
+ emit(event, plugin) {
76
+ var _a;
77
+ (_a = this.listeners.get(event)) === null || _a === void 0 ? void 0 : _a.forEach((h) => h(plugin));
78
+ }
79
+ /** Clear all plugins. */
80
+ clear() {
81
+ var _a;
82
+ for (const plugin of this.plugins.values()) {
83
+ (_a = plugin.onDestroy) === null || _a === void 0 ? void 0 : _a.call(plugin);
84
+ }
85
+ this.plugins.clear();
86
+ }
87
+ }
88
+ /** Global plugin registry singleton. */
89
+ const PluginRegistry = new PluginRegistryImpl();
90
+ // ── React Hook ──────────────────────────────────────────────────
91
+ /** React hook that returns plugins for a specific editor, re-renders on changes. */
92
+ function usePlugins(editor) {
93
+ const [, setTick] = React.useState(0);
94
+ React.useEffect(() => {
95
+ const unsub1 = PluginRegistry.on("register", () => setTick((t) => t + 1));
96
+ const unsub2 = PluginRegistry.on("unregister", () => setTick((t) => t + 1));
97
+ return () => { unsub1(); unsub2(); };
98
+ }, []);
99
+ return {
100
+ plugins: PluginRegistry.getForEditor(editor),
101
+ tools: PluginRegistry.getTools(editor),
102
+ filters: PluginRegistry.getFilters(editor),
103
+ exporters: PluginRegistry.getExporters(editor),
104
+ panels: PluginRegistry.getPanels(editor),
105
+ menuActions: PluginRegistry.getMenuActions(editor),
106
+ };
107
+ }
108
+ // ── Plugin Context (React) ──────────────────────────────────────
109
+ const PluginContext = React.createContext(PluginRegistry);
110
+ const NicePluginProvider = ({ plugins, children }) => {
111
+ React.useEffect(() => {
112
+ if (plugins) {
113
+ plugins.forEach((p) => PluginRegistry.register(p));
114
+ return () => plugins.forEach((p) => PluginRegistry.unregister(p.id));
115
+ }
116
+ }, [plugins]);
117
+ return React.createElement(PluginContext.Provider, { value: PluginRegistry }, children);
118
+ };
119
+ function usePluginRegistry() {
120
+ return React.useContext(PluginContext);
121
+ }
122
+
123
+ export { NicePluginProvider, PluginRegistry, usePluginRegistry, usePlugins };
124
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sources":["../../../src/core/plugins.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAkEH;AAMA,MAAM,kBAAkB,CAAA;AAAxB,IAAA,WAAA,GAAA;AACU,QAAA,IA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,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAClD,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtE;AACF,IAAA,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAEb,IAAA,OAAO,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,QAAQ,CAAC;AACzF;SAEgB,iBAAiB,GAAA;AAC/B,IAAA,OAAO,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;AACxC;;;;"}
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * rtl.ts — Right-to-left (RTL) UI support for editors.
5
+ *
6
+ * Provides RTL direction context, CSS logical properties,
7
+ * and layout utilities for RTL languages (Arabic, Hebrew, etc.).
8
+ */
9
+ // ── Context ─────────────────────────────────────────────────────
10
+ const defaultRTLConfig = {
11
+ direction: "ltr",
12
+ mirrorToolbar: false,
13
+ mirrorPanels: false,
14
+ };
15
+ const RTLContext = React.createContext(defaultRTLConfig);
16
+ /** Provider for RTL configuration. Wraps editors to enable RTL support. */
17
+ const NiceRTLProvider = ({ direction = "ltr", mirrorToolbar = true, mirrorPanels = true, children }) => {
18
+ const config = React.useMemo(() => ({
19
+ direction,
20
+ mirrorToolbar: direction === "rtl" ? mirrorToolbar : false,
21
+ mirrorPanels: direction === "rtl" ? mirrorPanels : false,
22
+ }), [direction, mirrorToolbar, mirrorPanels]);
23
+ return React.createElement(RTLContext.Provider, { value: config }, React.createElement("div", {
24
+ dir: direction,
25
+ style: { direction },
26
+ }, children));
27
+ };
28
+ /** Hook to access RTL configuration. */
29
+ function useRTL() {
30
+ return React.useContext(RTLContext);
31
+ }
32
+ /** Hook that returns true if the current direction is RTL. */
33
+ function useIsRTL() {
34
+ return React.useContext(RTLContext).direction === "rtl";
35
+ }
36
+ // ── CSS Helpers ─────────────────────────────────────────────────
37
+ /** Convert physical CSS properties to logical equivalents for RTL awareness. */
38
+ function logicalStyles(direction, styles) {
39
+ if (direction === "ltr")
40
+ return styles;
41
+ const mapped = { ...styles };
42
+ // Swap left/right margins
43
+ if ("marginLeft" in styles || "marginRight" in styles) {
44
+ mapped.marginLeft = styles.marginRight;
45
+ mapped.marginRight = styles.marginLeft;
46
+ }
47
+ // Swap left/right padding
48
+ if ("paddingLeft" in styles || "paddingRight" in styles) {
49
+ mapped.paddingLeft = styles.paddingRight;
50
+ mapped.paddingRight = styles.paddingLeft;
51
+ }
52
+ // Swap left/right positioning
53
+ if ("left" in styles || "right" in styles) {
54
+ mapped.left = styles.right;
55
+ mapped.right = styles.left;
56
+ }
57
+ // Swap borderRadius corners
58
+ if ("borderTopLeftRadius" in styles || "borderTopRightRadius" in styles) {
59
+ mapped.borderTopLeftRadius = styles.borderTopRightRadius;
60
+ mapped.borderTopRightRadius = styles.borderTopLeftRadius;
61
+ }
62
+ if ("borderBottomLeftRadius" in styles || "borderBottomRightRadius" in styles) {
63
+ mapped.borderBottomLeftRadius = styles.borderBottomRightRadius;
64
+ mapped.borderBottomRightRadius = styles.borderBottomLeftRadius;
65
+ }
66
+ // Swap text-align
67
+ if (styles.textAlign === "left")
68
+ mapped.textAlign = "right";
69
+ else if (styles.textAlign === "right")
70
+ mapped.textAlign = "left";
71
+ return mapped;
72
+ }
73
+ /** Get panel flex direction based on RTL. */
74
+ function rtlFlexDirection(direction) {
75
+ return direction === "rtl" ? "row-reverse" : "row";
76
+ }
77
+ /** Detect direction from document or browser locale. */
78
+ function detectDirection() {
79
+ var _a, _b;
80
+ if (typeof document !== "undefined") {
81
+ const dir = document.documentElement.getAttribute("dir");
82
+ if (dir === "rtl")
83
+ return "rtl";
84
+ }
85
+ if (typeof navigator !== "undefined") {
86
+ const lang = (_b = (_a = navigator.language) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : "";
87
+ const rtlLangs = ["ar", "he", "fa", "ur", "ps", "sd", "yi", "ku"];
88
+ if (rtlLangs.some((l) => lang.startsWith(l)))
89
+ return "rtl";
90
+ }
91
+ return "ltr";
92
+ }
93
+
94
+ export { NiceRTLProvider, detectDirection, logicalStyles, rtlFlexDirection, useIsRTL, useRTL };
95
+ //# sourceMappingURL=rtl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rtl.js","sources":["../../../src/core/rtl.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAeH;AAEA,MAAM,gBAAgB,GAAc;AAClC,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,aAAa,EAAE,KAAK;AACpB,IAAA,YAAY,EAAE,KAAK;CACpB;AAED,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,CAAY,gBAAgB,CAAC;AAEnE;MACa,eAAe,GAKvB,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,aAAa,GAAG,IAAI,EAAE,YAAY,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAI;IAClF,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAC1B,OAAO;QACL,SAAS;QACT,aAAa,EAAE,SAAS,KAAK,KAAK,GAAG,aAAa,GAAG,KAAK;QAC1D,YAAY,EAAE,SAAS,KAAK,KAAK,GAAG,YAAY,GAAG,KAAK;KACzD,CAAC,EACF,CAAC,SAAS,EAAE,aAAa,EAAE,YAAY,CAAC,CACzC;AAED,IAAA,OAAO,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAC/D,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACzB,QAAA,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,EAAE,SAAS,EAAE;KACrB,EAAE,QAAQ,CAAC,CACb;AACH;AAEA;SACgB,MAAM,GAAA;AACpB,IAAA,OAAO,KAAK,CAAC,UAAU,CA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