@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,636 @@
1
+ /**
2
+ * photoOverlays.ts — Overlay / layer engine for PhotoEditor.
3
+ *
4
+ * Handles emojis, text, shapes, freehand drawing strokes, and decorative frames
5
+ * as positioned layers on top of the base (filtered) image.
6
+ *
7
+ * All positions use **fractional coordinates** (0 … 1) relative to the rendered
8
+ * canvas so overlays survive crop / resize changes.
9
+ */
10
+ const EMOJI_CATALOG = [
11
+ {
12
+ id: "faces",
13
+ label: "Buźki",
14
+ icon: "😊",
15
+ emojis: [
16
+ "😀", "😃", "😄", "😁", "😆", "😅", "🤣", "😂", "🙂", "😉", "😊", "😇",
17
+ "🥰", "😍", "🤩", "😘", "😗", "😚", "😋", "😛", "😜", "🤪", "😝", "🤑",
18
+ "🤗", "🤭", "🤫", "🤔", "😐", "😑", "😶", "🙄", "😏", "😣", "😥", "😮",
19
+ "🤐", "😯", "😪", "😫", "🥱", "😴", "🤤", "😌", "😷", "🤒", "🤕", "🤢",
20
+ "🤮", "🥵", "🥶", "🥴", "😵", "🤯", "🤠", "🥳", "🥸", "😎", "🤓", "🧐",
21
+ "😤", "😡", "🤬", "😈", "👿", "💀", "☠️", "💩", "🤡", "👹", "👻", "👽", "🤖",
22
+ ],
23
+ },
24
+ {
25
+ id: "gestures",
26
+ label: "Gesty",
27
+ icon: "👍",
28
+ emojis: [
29
+ "👍", "👎", "👊", "✊", "🤛", "🤜", "🤝", "👏", "🙌", "🫶", "👐", "🤲",
30
+ "🙏", "✌️", "🤞", "🤟", "🤘", "🤙", "👈", "👉", "👆", "👇", "☝️", "✋",
31
+ "🤚", "🖐️", "🖖", "👋", "🤏", "✍️", "💪", "🦾", "🦵", "🦶", "👂", "👃",
32
+ "👀", "👁️", "👅", "👄",
33
+ ],
34
+ },
35
+ {
36
+ id: "hearts",
37
+ label: "Serca",
38
+ icon: "❤️",
39
+ emojis: [
40
+ "❤️", "🧡", "💛", "💚", "💙", "💜", "🖤", "🤍", "🤎", "❤️‍🔥", "💔", "❣️",
41
+ "💕", "💞", "💓", "💗", "💖", "💘", "💝", "💟", "♥️", "💌", "💋", "💍", "💎",
42
+ ],
43
+ },
44
+ {
45
+ id: "animals",
46
+ label: "Zwierzki",
47
+ icon: "🐶",
48
+ emojis: [
49
+ "🐶", "🐱", "🐭", "🐹", "🐰", "🦊", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮",
50
+ "🐷", "🐸", "🐵", "🙈", "🙉", "🙊", "🐔", "🐧", "🐦", "🦆", "🦅", "🦉",
51
+ "🦋", "🐌", "🐞", "🐙", "🐬", "🐳", "🦈", "🐊", "🐘", "🦒", "🦘", "🐴", "🦄",
52
+ ],
53
+ },
54
+ {
55
+ id: "party",
56
+ label: "Impreza",
57
+ icon: "🎉",
58
+ emojis: [
59
+ "🎉", "🎊", "🎈", "🎁", "🎀", "🎃", "🎄", "🎆", "🎇", "✨", "🏆", "🏅",
60
+ "🥇", "🥈", "🥉", "🎪", "🎭", "🎨", "🎬", "🎤", "🎧", "🎼", "🎵", "🎶",
61
+ "🎹", "🥁", "🎷", "🎺", "🎸", "🎻", "🎲", "🎯", "🎳", "🕹️", "🎮", "🎰",
62
+ ],
63
+ },
64
+ {
65
+ id: "food",
66
+ label: "Jedzenie",
67
+ icon: "🍕",
68
+ emojis: [
69
+ "🍏", "🍎", "🍐", "🍊", "🍋", "🍌", "🍉", "🍇", "🍓", "🍒", "🍑", "🥭",
70
+ "🍍", "🥝", "🍅", "🥑", "🍆", "🌽", "🌶️", "🍞", "🧀", "🥚", "🍳", "🥓",
71
+ "🍗", "🌭", "🍔", "🍟", "🍕", "🌮", "🌯", "🥪", "🍝", "🍜", "🍣", "🍤",
72
+ "🍦", "🍰", "🎂", "🍩", "🍪", "🍫", "🍬", "🍭", "🍿", "☕", "🍵", "🍺",
73
+ "🍻", "🥂", "🍷", "🍸", "🍹", "🧃", "🍾",
74
+ ],
75
+ },
76
+ {
77
+ id: "nature",
78
+ label: "Natura",
79
+ icon: "🌸",
80
+ emojis: [
81
+ "🌸", "🌺", "🌹", "🌻", "🌼", "💐", "🌷", "🌱", "🪴", "🌲", "🌳", "🌴",
82
+ "🌵", "🍀", "☘️", "🌿", "🍃", "🍂", "🍁", "🌊", "🌈", "☀️", "🌤️", "⛅",
83
+ "☁️", "🌧️", "⛈️", "🌩️", "❄️", "☃️", "⛄", "🔥", "💧", "💦", "🌏", "🌙",
84
+ "🌟", "💫", "✨", "☄️",
85
+ ],
86
+ },
87
+ {
88
+ id: "symbols",
89
+ label: "Symbole",
90
+ icon: "⚡",
91
+ emojis: [
92
+ "⚡", "💥", "🔥", "✨", "💫", "🌟", "⭐", "💡", "💣", "🧨", "🎯", "♠️",
93
+ "♥️", "♦️", "♣️", "🔮", "🧿", "♻️", "⚜️", "⭕", "✅", "❌", "➕", "➖",
94
+ "❗", "❓", "‼️", "⁉️", "💯", "🔴", "🟠", "🟡", "🟢", "🔵", "🟣", "⚫",
95
+ "⚪", "🔺", "🔻", "🔶", "🔷", "🏳️", "🏴", "🚩", "🏳️‍🌈",
96
+ ],
97
+ },
98
+ ];
99
+ const SHAPE_CATALOG = [
100
+ { id: "rect", label: "Prostokąt", icon: "⬜" },
101
+ { id: "circle", label: "Koło", icon: "⭕" },
102
+ { id: "triangle", label: "Trójkąt", icon: "🔺" },
103
+ { id: "star", label: "Gwiazda", icon: "⭐" },
104
+ { id: "heart", label: "Serce", icon: "❤️" },
105
+ { id: "arrow", label: "Strzałka", icon: "➡️" },
106
+ { id: "diamond", label: "Romb", icon: "💎" },
107
+ { id: "hexagon", label: "Sześciokąt", icon: "⬡" },
108
+ { id: "cross", label: "Krzyżyk", icon: "✚" },
109
+ { id: "lightning", label: "Błyskawica", icon: "⚡" },
110
+ ];
111
+ const FRAME_CATALOG = [
112
+ { id: "simple", label: "Prosta", icon: "▪️" },
113
+ { id: "double", label: "Podwójna", icon: "◻️" },
114
+ { id: "rounded", label: "Zaokrąglona", icon: "⬜" },
115
+ { id: "polaroid", label: "Polaroid", icon: "📸" },
116
+ { id: "film", label: "Klisza", icon: "🎞️" },
117
+ { id: "vintage", label: "Vintage", icon: "🖼️" },
118
+ { id: "ornate", label: "Ozdobna", icon: "🏛️" },
119
+ { id: "shadow", label: "Cień", icon: "🌑" },
120
+ { id: "neon", label: "Neon", icon: "💡" },
121
+ { id: "torn", label: "Podarta", icon: "📃" },
122
+ ];
123
+ // ═══════════════════════════════════════════════════════════════
124
+ // ── ID generation
125
+ // ═══════════════════════════════════════════════════════════════
126
+ let _nextId = 1;
127
+ function generateOverlayId() {
128
+ return `ov-${_nextId++}-${Date.now().toString(36)}`;
129
+ }
130
+ // ═══════════════════════════════════════════════════════════════
131
+ // ── Rendering
132
+ // ═══════════════════════════════════════════════════════════════
133
+ /** Render all overlays to a canvas context. */
134
+ function renderAllOverlays(ctx, overlays, w, h) {
135
+ for (const ov of overlays)
136
+ renderSingleOverlay(ctx, ov, w, h);
137
+ }
138
+ function renderSingleOverlay(ctx, ov, w, h) {
139
+ ctx.save();
140
+ ctx.globalAlpha = ov.opacity;
141
+ if (ov.type === "drawing") {
142
+ renderDrawing(ctx, ov, w, h);
143
+ ctx.restore();
144
+ return;
145
+ }
146
+ if (ov.type === "frame") {
147
+ renderFrame(ctx, ov, w, h);
148
+ ctx.restore();
149
+ return;
150
+ }
151
+ // Position-based overlays (emoji, text, shape)
152
+ const cx = ov.x * w;
153
+ const cy = ov.y * h;
154
+ ctx.translate(cx, cy);
155
+ ctx.rotate((ov.rotation * Math.PI) / 180);
156
+ ctx.scale(ov.scaleX, ov.scaleY);
157
+ switch (ov.type) {
158
+ case "emoji":
159
+ renderEmoji(ctx, ov);
160
+ break;
161
+ case "text":
162
+ renderText(ctx, ov);
163
+ break;
164
+ case "shape":
165
+ renderShape(ctx, ov);
166
+ break;
167
+ }
168
+ ctx.restore();
169
+ }
170
+ // -- Emoji -------------------------------------------------------
171
+ function renderEmoji(ctx, ov) {
172
+ ctx.font = `${ov.fontSize}px "Segoe UI Emoji","Apple Color Emoji","Noto Color Emoji",sans-serif`;
173
+ ctx.textAlign = "center";
174
+ ctx.textBaseline = "middle";
175
+ ctx.fillText(ov.emoji, 0, 0);
176
+ }
177
+ // -- Text --------------------------------------------------------
178
+ function renderText(ctx, ov) {
179
+ const style = `${ov.italic ? "italic " : ""}${ov.bold ? "bold " : ""}`;
180
+ ctx.font = `${style}${ov.fontSize}px ${ov.fontFamily || "Arial"},sans-serif`;
181
+ ctx.textAlign = "center";
182
+ ctx.textBaseline = "middle";
183
+ const lines = ov.text.split("\n");
184
+ const lineH = ov.fontSize * 1.25;
185
+ const totalH = lineH * lines.length;
186
+ const startY = -(totalH / 2) + lineH / 2;
187
+ // Background
188
+ if (ov.background) {
189
+ const maxW = Math.max(...lines.map(l => ctx.measureText(l).width));
190
+ const pad = ov.backgroundPadding;
191
+ ctx.fillStyle = ov.background;
192
+ const rx = -(maxW / 2 + pad);
193
+ const ry = startY - lineH / 2 - pad;
194
+ roundRect(ctx, rx, ry, maxW + pad * 2, totalH + pad * 2, 6);
195
+ ctx.fill();
196
+ }
197
+ // Shadow
198
+ if (ov.shadow) {
199
+ ctx.shadowColor = ov.shadow;
200
+ ctx.shadowBlur = 4;
201
+ ctx.shadowOffsetX = 2;
202
+ ctx.shadowOffsetY = 2;
203
+ }
204
+ for (let i = 0; i < lines.length; i++) {
205
+ const ly = startY + i * lineH;
206
+ if (ov.outlineColor && ov.outlineWidth > 0) {
207
+ ctx.strokeStyle = ov.outlineColor;
208
+ ctx.lineWidth = ov.outlineWidth;
209
+ ctx.lineJoin = "round";
210
+ ctx.strokeText(lines[i], 0, ly);
211
+ }
212
+ ctx.fillStyle = ov.color;
213
+ ctx.fillText(lines[i], 0, ly);
214
+ }
215
+ ctx.shadowColor = "transparent";
216
+ }
217
+ // -- Shape -------------------------------------------------------
218
+ function renderShape(ctx, ov) {
219
+ drawShapePath(ctx, ov.shapeKind, ov.width, ov.height);
220
+ if (ov.fillColor) {
221
+ ctx.fillStyle = ov.fillColor;
222
+ ctx.fill();
223
+ }
224
+ if (ov.strokeColor && ov.strokeWidth > 0) {
225
+ ctx.strokeStyle = ov.strokeColor;
226
+ ctx.lineWidth = ov.strokeWidth;
227
+ ctx.stroke();
228
+ }
229
+ }
230
+ function drawShapePath(ctx, kind, w, h) {
231
+ const hw = w / 2, hh = h / 2;
232
+ ctx.beginPath();
233
+ switch (kind) {
234
+ case "rect":
235
+ ctx.rect(-hw, -hh, w, h);
236
+ break;
237
+ case "circle":
238
+ ctx.ellipse(0, 0, hw, hh, 0, 0, Math.PI * 2);
239
+ break;
240
+ case "triangle":
241
+ ctx.moveTo(0, -hh);
242
+ ctx.lineTo(hw, hh);
243
+ ctx.lineTo(-hw, hh);
244
+ ctx.closePath();
245
+ break;
246
+ case "star": {
247
+ const spikes = 5, outer = Math.min(hw, hh), inner = outer * 0.4;
248
+ for (let i = 0; i < spikes * 2; i++) {
249
+ const r = i % 2 === 0 ? outer : inner;
250
+ const a = (Math.PI * i) / spikes - Math.PI / 2;
251
+ if (i === 0)
252
+ ctx.moveTo(Math.cos(a) * r, Math.sin(a) * r);
253
+ else
254
+ ctx.lineTo(Math.cos(a) * r, Math.sin(a) * r);
255
+ }
256
+ ctx.closePath();
257
+ break;
258
+ }
259
+ case "heart": {
260
+ const s = Math.min(hw, hh);
261
+ ctx.moveTo(0, s * 0.4);
262
+ ctx.bezierCurveTo(-s, -s * 0.2, -s * 0.6, -s, 0, -s * 0.4);
263
+ ctx.bezierCurveTo(s * 0.6, -s, s, -s * 0.2, 0, s * 0.4);
264
+ break;
265
+ }
266
+ case "arrow":
267
+ ctx.moveTo(-hw, -hh * 0.3);
268
+ ctx.lineTo(hw * 0.3, -hh * 0.3);
269
+ ctx.lineTo(hw * 0.3, -hh);
270
+ ctx.lineTo(hw, 0);
271
+ ctx.lineTo(hw * 0.3, hh);
272
+ ctx.lineTo(hw * 0.3, hh * 0.3);
273
+ ctx.lineTo(-hw, hh * 0.3);
274
+ ctx.closePath();
275
+ break;
276
+ case "diamond":
277
+ ctx.moveTo(0, -hh);
278
+ ctx.lineTo(hw, 0);
279
+ ctx.lineTo(0, hh);
280
+ ctx.lineTo(-hw, 0);
281
+ ctx.closePath();
282
+ break;
283
+ case "hexagon":
284
+ for (let i = 0; i < 6; i++) {
285
+ const a = (Math.PI * 2 * i) / 6 - Math.PI / 2;
286
+ const r = Math.min(hw, hh);
287
+ const px = Math.cos(a) * r, py = Math.sin(a) * r;
288
+ if (i === 0)
289
+ ctx.moveTo(px, py);
290
+ else
291
+ ctx.lineTo(px, py);
292
+ }
293
+ ctx.closePath();
294
+ break;
295
+ case "cross": {
296
+ const t = Math.min(hw, hh) * 0.3;
297
+ ctx.moveTo(-t, -hh);
298
+ ctx.lineTo(t, -hh);
299
+ ctx.lineTo(t, -t);
300
+ ctx.lineTo(hw, -t);
301
+ ctx.lineTo(hw, t);
302
+ ctx.lineTo(t, t);
303
+ ctx.lineTo(t, hh);
304
+ ctx.lineTo(-t, hh);
305
+ ctx.lineTo(-t, t);
306
+ ctx.lineTo(-hw, t);
307
+ ctx.lineTo(-hw, -t);
308
+ ctx.lineTo(-t, -t);
309
+ ctx.closePath();
310
+ break;
311
+ }
312
+ case "lightning": {
313
+ const s = Math.min(hw, hh);
314
+ ctx.moveTo(-s * 0.1, -s);
315
+ ctx.lineTo(s * 0.5, -s * 0.1);
316
+ ctx.lineTo(s * 0.05, -s * 0.1);
317
+ ctx.lineTo(s * 0.4, s);
318
+ ctx.lineTo(-s * 0.15, s * 0.15);
319
+ ctx.lineTo(s * 0.05, s * 0.15);
320
+ ctx.lineTo(-s * 0.4, -s * 0.5);
321
+ ctx.closePath();
322
+ break;
323
+ }
324
+ }
325
+ }
326
+ // -- Drawing (freehand strokes) ----------------------------------
327
+ function renderDrawing(ctx, ov, w, h) {
328
+ for (const stroke of ov.strokes) {
329
+ if (stroke.points.length < 2)
330
+ continue;
331
+ ctx.beginPath();
332
+ ctx.strokeStyle = stroke.color;
333
+ ctx.lineWidth = stroke.width;
334
+ ctx.lineCap = "round";
335
+ ctx.lineJoin = "round";
336
+ ctx.globalAlpha = stroke.opacity;
337
+ const [sx, sy] = stroke.points[0];
338
+ ctx.moveTo(sx * w, sy * h);
339
+ for (let i = 1; i < stroke.points.length; i++) {
340
+ const [px, py] = stroke.points[i];
341
+ ctx.lineTo(px * w, py * h);
342
+ }
343
+ ctx.stroke();
344
+ }
345
+ }
346
+ // -- Canvas stroke (draw a live, in-progress stroke) -------------
347
+ function renderLiveStroke(ctx, points, color, width, canvasW, canvasH) {
348
+ if (points.length < 2)
349
+ return;
350
+ ctx.save();
351
+ ctx.beginPath();
352
+ ctx.strokeStyle = color;
353
+ ctx.lineWidth = width;
354
+ ctx.lineCap = "round";
355
+ ctx.lineJoin = "round";
356
+ ctx.moveTo(points[0][0] * canvasW, points[0][1] * canvasH);
357
+ for (let i = 1; i < points.length; i++) {
358
+ ctx.lineTo(points[i][0] * canvasW, points[i][1] * canvasH);
359
+ }
360
+ ctx.stroke();
361
+ ctx.restore();
362
+ }
363
+ // -- Frame -------------------------------------------------------
364
+ function renderFrame(ctx, ov, w, h) {
365
+ const t = Math.min(w, h) * ov.thickness;
366
+ ctx.strokeStyle = ov.color;
367
+ ctx.fillStyle = ov.color;
368
+ switch (ov.frameStyle) {
369
+ case "simple":
370
+ ctx.lineWidth = t;
371
+ ctx.strokeRect(t / 2, t / 2, w - t, h - t);
372
+ break;
373
+ case "double":
374
+ ctx.lineWidth = t * 0.3;
375
+ ctx.strokeRect(t * 0.15, t * 0.15, w - t * 0.3, h - t * 0.3);
376
+ ctx.strokeRect(t * 0.7, t * 0.7, w - t * 1.4, h - t * 1.4);
377
+ break;
378
+ case "rounded":
379
+ ctx.lineWidth = t;
380
+ roundRect(ctx, t / 2, t / 2, w - t, h - t, t * 2);
381
+ ctx.stroke();
382
+ break;
383
+ case "polaroid":
384
+ ctx.fillRect(0, 0, w, t);
385
+ ctx.fillRect(0, 0, t, h);
386
+ ctx.fillRect(w - t, 0, t, h);
387
+ ctx.fillRect(0, h - t * 3, w, t * 3);
388
+ break;
389
+ case "film": {
390
+ ctx.fillRect(0, 0, w, t);
391
+ ctx.fillRect(0, h - t, w, t);
392
+ const holeW = t * 0.5, holeH = t * 0.7;
393
+ const count = Math.floor(w / (t * 1.5)) || 1;
394
+ const spacing = w / (count + 1);
395
+ ctx.fillStyle = "#111";
396
+ for (let i = 1; i <= count; i++) {
397
+ const cx = spacing * i;
398
+ roundRect(ctx, cx - holeW / 2, (t - holeH) / 2, holeW, holeH, 2);
399
+ ctx.fill();
400
+ roundRect(ctx, cx - holeW / 2, h - t + (t - holeH) / 2, holeW, holeH, 2);
401
+ ctx.fill();
402
+ }
403
+ break;
404
+ }
405
+ case "vintage": {
406
+ ctx.lineWidth = t * 0.5;
407
+ ctx.strokeRect(t * 0.25, t * 0.25, w - t * 0.5, h - t * 0.5);
408
+ ctx.lineWidth = 1;
409
+ ctx.strokeStyle = ov.color + "88";
410
+ ctx.strokeRect(t, t, w - t * 2, h - t * 2);
411
+ const os = t * 0.8;
412
+ for (const [dx, dy] of [[0, 0], [w - os, 0], [0, h - os], [w - os, h - os]]) {
413
+ ctx.beginPath();
414
+ ctx.moveTo(dx + os * 0.2, dy + os * 0.2);
415
+ ctx.lineTo(dx + os * 0.8, dy + os * 0.2);
416
+ ctx.lineTo(dx + os * 0.5, dy + os * 0.5);
417
+ ctx.lineTo(dx + os * 0.2, dy + os * 0.8);
418
+ ctx.closePath();
419
+ ctx.strokeStyle = ov.color;
420
+ ctx.lineWidth = 1.5;
421
+ ctx.stroke();
422
+ }
423
+ break;
424
+ }
425
+ case "ornate": {
426
+ ctx.lineWidth = t * 0.4;
427
+ ctx.strokeRect(t * 0.2, t * 0.2, w - t * 0.4, h - t * 0.4);
428
+ const cs = t * 1.5;
429
+ ctx.lineWidth = 2;
430
+ for (const [ox, oy, sx, sy] of [
431
+ [0, 0, 1, 1], [w, 0, -1, 1], [0, h, 1, -1], [w, h, -1, -1],
432
+ ]) {
433
+ ctx.save();
434
+ ctx.translate(ox, oy);
435
+ ctx.scale(sx, sy);
436
+ ctx.beginPath();
437
+ ctx.arc(cs * 0.3, cs * 0.3, cs * 0.2, 0, Math.PI * 1.5, true);
438
+ ctx.stroke();
439
+ ctx.beginPath();
440
+ ctx.moveTo(0, cs * 0.5);
441
+ ctx.quadraticCurveTo(cs * 0.5, cs * 0.5, cs * 0.5, 0);
442
+ ctx.stroke();
443
+ ctx.restore();
444
+ }
445
+ break;
446
+ }
447
+ case "shadow":
448
+ ctx.shadowColor = "rgba(0,0,0,0.5)";
449
+ ctx.shadowBlur = t * 2;
450
+ ctx.shadowOffsetX = t * 0.5;
451
+ ctx.shadowOffsetY = t * 0.5;
452
+ ctx.lineWidth = t * 0.3;
453
+ ctx.strokeRect(t, t, w - t * 2, h - t * 2);
454
+ ctx.shadowColor = "transparent";
455
+ break;
456
+ case "neon":
457
+ for (let i = 3; i >= 0; i--) {
458
+ ctx.shadowColor = ov.color;
459
+ ctx.shadowBlur = t * (i + 1) * 2;
460
+ ctx.lineWidth = t * 0.2;
461
+ ctx.strokeStyle = i === 0 ? "#fff" : ov.color;
462
+ ctx.globalAlpha = i === 0 ? ov.opacity : 0.3 * ov.opacity;
463
+ ctx.strokeRect(t, t, w - t * 2, h - t * 2);
464
+ }
465
+ ctx.shadowColor = "transparent";
466
+ break;
467
+ case "torn": {
468
+ const step = 8;
469
+ const seed = (i) => {
470
+ const x = Math.sin(i * 127.1 + 311.7) * 43758.5453;
471
+ return (x - Math.floor(x)) - 0.5;
472
+ };
473
+ // Top
474
+ ctx.beginPath();
475
+ ctx.moveTo(0, 0);
476
+ for (let i = 0, x = 0; x <= w; x += step, i++)
477
+ ctx.lineTo(x, t + seed(i) * t * 0.8);
478
+ ctx.lineTo(w, 0);
479
+ ctx.closePath();
480
+ ctx.fill();
481
+ // Bottom
482
+ ctx.beginPath();
483
+ ctx.moveTo(0, h);
484
+ for (let i = 0, x = 0; x <= w; x += step, i++)
485
+ ctx.lineTo(x, h - t - seed(i + 1000) * t * 0.8);
486
+ ctx.lineTo(w, h);
487
+ ctx.closePath();
488
+ ctx.fill();
489
+ // Left
490
+ ctx.beginPath();
491
+ ctx.moveTo(0, 0);
492
+ for (let i = 0, y = 0; y <= h; y += step, i++)
493
+ ctx.lineTo(t + seed(i + 2000) * t * 0.8, y);
494
+ ctx.lineTo(0, h);
495
+ ctx.closePath();
496
+ ctx.fill();
497
+ // Right
498
+ ctx.beginPath();
499
+ ctx.moveTo(w, 0);
500
+ for (let i = 0, y = 0; y <= h; y += step, i++)
501
+ ctx.lineTo(w - t - seed(i + 3000) * t * 0.8, y);
502
+ ctx.lineTo(w, h);
503
+ ctx.closePath();
504
+ ctx.fill();
505
+ break;
506
+ }
507
+ }
508
+ }
509
+ function roundRect(ctx, x, y, w, h, r) {
510
+ ctx.beginPath();
511
+ ctx.moveTo(x + r, y);
512
+ ctx.lineTo(x + w - r, y);
513
+ ctx.quadraticCurveTo(x + w, y, x + w, y + r);
514
+ ctx.lineTo(x + w, y + h - r);
515
+ ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
516
+ ctx.lineTo(x + r, y + h);
517
+ ctx.quadraticCurveTo(x, y + h, x, y + h - r);
518
+ ctx.lineTo(x, y + r);
519
+ ctx.quadraticCurveTo(x, y, x + r, y);
520
+ ctx.closePath();
521
+ }
522
+ // ═══════════════════════════════════════════════════════════════
523
+ // ── Hit testing
524
+ // ═══════════════════════════════════════════════════════════════
525
+ /**
526
+ * Returns `true` when the point (px, py) in canvas-fraction space
527
+ * hits the bounding box of the overlay (ignoring rotation).
528
+ */
529
+ function hitTestOverlay(ov, px, py, _w, _h) {
530
+ if (ov.type === "drawing" || ov.type === "frame")
531
+ return false;
532
+ let hitW, hitH;
533
+ switch (ov.type) {
534
+ case "emoji":
535
+ hitW = hitH = (ov.fontSize * ov.scaleX) / _w;
536
+ break;
537
+ case "text": {
538
+ hitW = (ov.text.length * ov.fontSize * 0.55 * ov.scaleX) / _w;
539
+ hitH = (ov.fontSize * 1.3 * ov.scaleY) / _h;
540
+ break;
541
+ }
542
+ case "shape":
543
+ hitW = (ov.width * ov.scaleX) / _w;
544
+ hitH = (ov.height * ov.scaleY) / _h;
545
+ break;
546
+ default:
547
+ return false;
548
+ }
549
+ const margin = 15 / _w;
550
+ return Math.abs(px - ov.x) < hitW / 2 + margin && Math.abs(py - ov.y) < hitH / 2 + margin;
551
+ }
552
+ // ═══════════════════════════════════════════════════════════════
553
+ // ── Factory helpers
554
+ // ═══════════════════════════════════════════════════════════════
555
+ function createEmojiOverlay(emoji, canvasW, canvasH) {
556
+ return {
557
+ id: generateOverlayId(),
558
+ type: "emoji",
559
+ x: 0.5, y: 0.5,
560
+ scaleX: 1, scaleY: 1,
561
+ rotation: 0, opacity: 1,
562
+ emoji,
563
+ fontSize: Math.round(Math.min(canvasW, canvasH) * 0.08),
564
+ };
565
+ }
566
+ function createTextOverlay(text = "Tekst") {
567
+ return {
568
+ id: generateOverlayId(),
569
+ type: "text",
570
+ x: 0.5, y: 0.5,
571
+ scaleX: 1, scaleY: 1,
572
+ rotation: 0, opacity: 1,
573
+ text,
574
+ fontFamily: "Arial",
575
+ fontSize: 36,
576
+ color: "#ffffff",
577
+ bold: true,
578
+ italic: false,
579
+ outlineColor: "#000000",
580
+ outlineWidth: 2,
581
+ shadow: null,
582
+ background: null,
583
+ backgroundPadding: 6,
584
+ };
585
+ }
586
+ function createShapeOverlay(kind) {
587
+ return {
588
+ id: generateOverlayId(),
589
+ type: "shape",
590
+ x: 0.5, y: 0.5,
591
+ scaleX: 1, scaleY: 1,
592
+ rotation: 0, opacity: 1,
593
+ shapeKind: kind,
594
+ width: 100, height: 100,
595
+ fillColor: null,
596
+ strokeColor: "#ffffff",
597
+ strokeWidth: 3,
598
+ };
599
+ }
600
+ function createDrawingOverlay() {
601
+ return {
602
+ id: generateOverlayId(),
603
+ type: "drawing",
604
+ x: 0, y: 0,
605
+ scaleX: 1, scaleY: 1,
606
+ rotation: 0, opacity: 1,
607
+ strokes: [],
608
+ };
609
+ }
610
+ function createFrameOverlay(style, color = "#ffffff") {
611
+ return {
612
+ id: generateOverlayId(),
613
+ type: "frame",
614
+ x: 0, y: 0,
615
+ scaleX: 1, scaleY: 1,
616
+ rotation: 0, opacity: 1,
617
+ frameStyle: style,
618
+ color,
619
+ thickness: 0.03,
620
+ };
621
+ }
622
+ function serializeEditorState(state) {
623
+ return JSON.stringify(state);
624
+ }
625
+ function deserializeEditorState(json) {
626
+ try {
627
+ return JSON.parse(json);
628
+ }
629
+ catch (_a) {
630
+ /* Expected: JSON.parse may fail on malformed serialized state */
631
+ return null;
632
+ }
633
+ }
634
+
635
+ export { EMOJI_CATALOG, FRAME_CATALOG, SHAPE_CATALOG, createDrawingOverlay, createEmojiOverlay, createFrameOverlay, createShapeOverlay, createTextOverlay, deserializeEditorState, generateOverlayId, hitTestOverlay, renderAllOverlays, renderLiveStroke, serializeEditorState };
636
+ //# sourceMappingURL=photoOverlays.js.map