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