@nova-lab/core 1.0.0-dev.19 → 1.1.1-dev.229

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 (501) hide show
  1. package/README.md +1035 -10
  2. package/THIRD_PARTY_NOTICES.md +26 -0
  3. package/dist/2d/accessibility.d.ts +2 -0
  4. package/dist/2d/accessibility.js +171 -0
  5. package/dist/2d/commands.d.ts +2 -0
  6. package/dist/2d/commands.js +80 -0
  7. package/dist/2d/effects.d.ts +10 -0
  8. package/dist/2d/effects.js +566 -0
  9. package/dist/2d/ktx2.d.ts +5 -0
  10. package/dist/2d/ktx2.js +542 -0
  11. package/dist/2d/lighting.d.ts +3 -0
  12. package/dist/2d/lighting.js +495 -0
  13. package/dist/2d/lottie.d.ts +3 -0
  14. package/dist/2d/lottie.js +254 -0
  15. package/dist/2d/meshes.d.ts +4 -0
  16. package/dist/2d/meshes.js +451 -0
  17. package/dist/2d/primitives.d.ts +3 -0
  18. package/dist/2d/primitives.js +85 -0
  19. package/dist/2d/render-textures.d.ts +3 -0
  20. package/dist/2d/render-textures.js +539 -0
  21. package/dist/2d/svg/documents.d.ts +5 -0
  22. package/dist/2d/svg/documents.js +7 -0
  23. package/dist/2d/svg/renderer.d.ts +3 -0
  24. package/dist/2d/svg/renderer.js +222 -0
  25. package/dist/2d/svg.d.ts +3 -0
  26. package/dist/2d/svg.js +4 -0
  27. package/dist/2d/tools.d.ts +2 -0
  28. package/dist/2d/tools.js +100 -0
  29. package/dist/2d/video.d.ts +5 -0
  30. package/dist/2d/video.js +90 -0
  31. package/dist/2d.d.ts +2 -0
  32. package/dist/2d.js +220 -0
  33. package/dist/3d/animation.d.ts +8 -0
  34. package/dist/3d/animation.js +1396 -0
  35. package/dist/3d/area-lights.d.ts +2 -0
  36. package/dist/3d/area-lights.js +19 -0
  37. package/dist/3d/audio.d.ts +4 -0
  38. package/dist/3d/audio.js +500 -0
  39. package/dist/3d/character.d.ts +2 -0
  40. package/dist/3d/character.js +136 -0
  41. package/dist/3d/collision.d.ts +3 -0
  42. package/dist/3d/collision.js +387 -0
  43. package/dist/3d/commands.d.ts +2 -0
  44. package/dist/3d/commands.js +108 -0
  45. package/dist/3d/controls.d.ts +8 -0
  46. package/dist/3d/controls.js +1041 -0
  47. package/dist/3d/documents.d.ts +5 -0
  48. package/dist/3d/documents.js +227 -0
  49. package/dist/3d/effects.d.ts +5 -0
  50. package/dist/3d/effects.js +1986 -0
  51. package/dist/3d/export.d.ts +4 -0
  52. package/dist/3d/export.js +347 -0
  53. package/dist/3d/fbx.d.ts +2 -0
  54. package/dist/3d/fbx.js +784 -0
  55. package/dist/3d/gltf.d.ts +2 -0
  56. package/dist/3d/gltf.js +5 -0
  57. package/dist/3d/helpers.d.ts +5 -0
  58. package/dist/3d/helpers.js +191 -0
  59. package/dist/3d/ik.d.ts +9 -0
  60. package/dist/3d/ik.js +777 -0
  61. package/dist/3d/loaders.d.ts +17 -0
  62. package/dist/3d/loaders.js +1406 -0
  63. package/dist/3d/nodes.d.ts +8 -0
  64. package/dist/3d/nodes.js +49 -0
  65. package/dist/3d/particles.d.ts +5 -0
  66. package/dist/3d/particles.js +1574 -0
  67. package/dist/3d/physics/backend.d.ts +7 -0
  68. package/dist/3d/physics/backend.js +1 -0
  69. package/dist/3d/physics/rapier.d.ts +3 -0
  70. package/dist/3d/physics/rapier.js +765 -0
  71. package/dist/3d/physics.d.ts +5 -0
  72. package/dist/3d/physics.js +3346 -0
  73. package/dist/3d/splats.d.ts +7 -0
  74. package/dist/3d/splats.js +862 -0
  75. package/dist/3d/text.d.ts +5 -0
  76. package/dist/3d/text.js +1043 -0
  77. package/dist/3d/tiles.d.ts +24 -0
  78. package/dist/3d/tiles.js +1705 -0
  79. package/dist/3d/tools.d.ts +12 -0
  80. package/dist/3d/tools.js +338 -0
  81. package/dist/3d/usdz.d.ts +2 -0
  82. package/dist/3d/usdz.js +634 -0
  83. package/dist/3d/xr.d.ts +2 -0
  84. package/dist/3d/xr.js +202 -0
  85. package/dist/3d-B4jWF8Qb.js +5591 -0
  86. package/dist/3d.d.ts +40 -0
  87. package/dist/3d.js +44 -0
  88. package/dist/Capsule-BFVpZfvc.js +44 -0
  89. package/dist/Clip-CAN7t03k.js +204 -0
  90. package/dist/Color-vuv9UnoY.js +34 -0
  91. package/dist/DeformedMesh-CPi0P_vc.js +280 -0
  92. package/dist/Document-DCVEZSvM.js +415 -0
  93. package/dist/Errors-B2ekO9bZ.js +30 -0
  94. package/dist/Features-BsjmePtc.js +557 -0
  95. package/dist/GLTFResourceIO-CYJyCUTt.js +124 -0
  96. package/dist/GPUParticleState-CQlNpoDa.js +545 -0
  97. package/dist/Geometry-DytO490z.js +227 -0
  98. package/dist/Inflate-DWw0V-Up.js +42 -0
  99. package/dist/InstancedMesh-DPrgrw5z.js +527 -0
  100. package/dist/Limits-Bw5XQdFr.js +20 -0
  101. package/dist/LineHelper-Ad0z9uDi.js +131 -0
  102. package/dist/LoaderIO-BwrM84OM.js +114 -0
  103. package/dist/Material-BpfLPmK9.js +777 -0
  104. package/dist/Mesh-BaRxAAJq.js +209 -0
  105. package/dist/Node-QfgAE2_v.js +877 -0
  106. package/dist/NovaAssetRegistry-p2QlCwvT.js +1168 -0
  107. package/dist/NovaNode-CBZ-Ol-W.js +2016 -0
  108. package/dist/NovaRenderCommandWriter-CWQRa42y.js +1949 -0
  109. package/dist/NovaTextSelectionService-CipuujCT.js +18526 -0
  110. package/dist/NovaWebGLProgram-BO250QNF.js +97 -0
  111. package/dist/Options-CajE7LLJ.js +15 -0
  112. package/dist/PolygonMesh-D4PnnfIo.js +657 -0
  113. package/dist/Ready-BzyhRtjD.js +21 -0
  114. package/dist/Scene-CDfNgf9I.js +911 -0
  115. package/dist/Shader-b6_HDndT.js +48 -0
  116. package/dist/SplatShader-wJ6GJ3vo.js +130 -0
  117. package/dist/Texture-dTKMlTpK.js +267 -0
  118. package/dist/TextureLoader-CfDzdy2m.js +411 -0
  119. package/dist/Textures-CGL4Kf-8.js +651 -0
  120. package/dist/ToneMapping-D9IWvN0u.js +46 -0
  121. package/dist/WebGPURenderer-DjD0IxVC.js +4921 -0
  122. package/dist/ZipReader-C-MSEsSr.js +84 -0
  123. package/dist/core.js +218 -24024
  124. package/dist/domain/types/base.types.d.ts +18 -9
  125. package/dist/domain/types/component.types.d.ts +5 -5
  126. package/dist/domain/types/cursor.types.d.ts +1 -1
  127. package/dist/domain/types/diagnostics.types.d.ts +2 -0
  128. package/dist/domain/types/export.types.d.ts +2 -2
  129. package/dist/domain/types/hit-test.types.d.ts +1 -1
  130. package/dist/domain/types/motion.types.d.ts +2 -2
  131. package/dist/domain/types/renderer.types.d.ts +88 -4
  132. package/dist/domain/types/rendering/index.d.ts +29 -4
  133. package/dist/domain/types/sound.types.d.ts +1 -1
  134. package/dist/domain/types/theme.types.d.ts +1 -1
  135. package/dist/domain/utils/bounds.d.ts +1 -1
  136. package/dist/domain/utils/nova-text.d.ts +9 -0
  137. package/dist/domain/utils/schemaBounds.d.ts +2 -2
  138. package/dist/export-svg-document-ChaNXMaG.js +668 -0
  139. package/dist/features/3d/Errors.d.ts +57 -0
  140. package/dist/features/3d/Nova3DApp.d.ts +429 -0
  141. package/dist/features/3d/animation/Animator.d.ts +260 -0
  142. package/dist/features/3d/animation/Clip.d.ts +74 -0
  143. package/dist/features/3d/animation/Graph.d.ts +158 -0
  144. package/dist/features/3d/animation/Mask.d.ts +40 -0
  145. package/dist/features/3d/audio/Audio.d.ts +114 -0
  146. package/dist/features/3d/audio/Sound.d.ts +133 -0
  147. package/dist/features/3d/character/CharacterController.d.ts +61 -0
  148. package/dist/features/3d/collision/Capsule.d.ts +25 -0
  149. package/dist/features/3d/collision/Octree.d.ts +94 -0
  150. package/dist/features/3d/controls/CameraMotionControls.d.ts +154 -0
  151. package/dist/features/3d/controls/CameraOrientation.d.ts +47 -0
  152. package/dist/features/3d/controls/OrbitControls.d.ts +73 -0
  153. package/dist/features/3d/controls/PointerGesture.d.ts +25 -0
  154. package/dist/features/3d/controls/PointerLock.d.ts +36 -0
  155. package/dist/features/3d/controls/Snapping.d.ts +32 -0
  156. package/dist/features/3d/controls/TransformGizmo.d.ts +79 -0
  157. package/dist/features/3d/deformation/DeformationGPU.d.ts +52 -0
  158. package/dist/features/3d/deformation/DeformationShader.d.ts +2 -0
  159. package/dist/features/3d/deformation/DeformedMesh.d.ts +36 -0
  160. package/dist/features/3d/deformation/GeometryDeformation.d.ts +25 -0
  161. package/dist/features/3d/documents/Document.d.ts +59 -0
  162. package/dist/features/3d/documents/DocumentCommands.d.ts +45 -0
  163. package/dist/features/3d/documents/DocumentSchema.d.ts +18 -0
  164. package/dist/features/3d/documents/DocumentTransform.d.ts +4 -0
  165. package/dist/features/3d/documents/DocumentTypes.d.ts +182 -0
  166. package/dist/features/3d/documents/DocumentValidation.d.ts +18 -0
  167. package/dist/features/3d/documents/Projection.d.ts +65 -0
  168. package/dist/features/3d/effects/CubeLUT.d.ts +24 -0
  169. package/dist/features/3d/effects/Effects.d.ts +32 -0
  170. package/dist/features/3d/effects/EffectsGPU.d.ts +80 -0
  171. package/dist/features/3d/effects/EffectsPlan.d.ts +268 -0
  172. package/dist/features/3d/effects/EffectsShaders.d.ts +35 -0
  173. package/dist/features/3d/export/GLTFExporter.d.ts +49 -0
  174. package/dist/features/3d/export/ThreeMFExporter.d.ts +19 -0
  175. package/dist/features/3d/export/ZipWriter.d.ts +9 -0
  176. package/dist/features/3d/fbx/FBXLoader.d.ts +26 -0
  177. package/dist/features/3d/fbx/FBXParser.d.ts +35 -0
  178. package/dist/features/3d/fbx/FBXScene.d.ts +20 -0
  179. package/dist/features/3d/gltf/GLTFLoader.d.ts +16 -0
  180. package/dist/features/3d/gltf/GLTFTypes.d.ts +64 -0
  181. package/dist/features/3d/gltf/services/GLTFBinary.d.ts +21 -0
  182. package/dist/features/3d/gltf/services/GLTFGeometry.d.ts +14 -0
  183. package/dist/features/3d/gltf/services/GLTFResourceIO.d.ts +64 -0
  184. package/dist/features/3d/helpers/LineHelper.d.ts +51 -0
  185. package/dist/features/3d/helpers/StaticHelpers.d.ts +47 -0
  186. package/dist/features/3d/helpers/TrackedHelpers.d.ts +84 -0
  187. package/dist/features/3d/ik/ChainIK.d.ts +44 -0
  188. package/dist/features/3d/ik/IKChain.d.ts +92 -0
  189. package/dist/features/3d/ik/IKMath.d.ts +49 -0
  190. package/dist/features/3d/ik/IKSolver.d.ts +97 -0
  191. package/dist/features/3d/ik/LookAtIK.d.ts +58 -0
  192. package/dist/features/3d/ik/TwoBoneIK.d.ts +57 -0
  193. package/dist/features/3d/import/ImportAnimation.d.ts +20 -0
  194. package/dist/features/3d/import/ImportMath.d.ts +42 -0
  195. package/dist/features/3d/import/ImportedModel.d.ts +135 -0
  196. package/dist/features/3d/import/Inflate.d.ts +5 -0
  197. package/dist/features/3d/import/ModelAsset.d.ts +149 -0
  198. package/dist/features/3d/import/PolygonMesh.d.ts +54 -0
  199. package/dist/features/3d/lights/AreaLightTables.d.ts +8 -0
  200. package/dist/features/3d/lights/AreaLights.d.ts +11 -0
  201. package/dist/features/3d/loaders/EXRCompression.d.ts +13 -0
  202. package/dist/features/3d/loaders/EXRLoader.d.ts +39 -0
  203. package/dist/features/3d/loaders/HDRLoader.d.ts +26 -0
  204. package/dist/features/3d/loaders/Limits.d.ts +70 -0
  205. package/dist/features/3d/loaders/LoaderBuffers.d.ts +42 -0
  206. package/dist/features/3d/loaders/LoaderIO.d.ts +81 -0
  207. package/dist/features/3d/loaders/LoaderModel.d.ts +80 -0
  208. package/dist/features/3d/loaders/LoaderText.d.ts +27 -0
  209. package/dist/features/3d/loaders/MTLLoader.d.ts +105 -0
  210. package/dist/features/3d/loaders/OBJLoader.d.ts +70 -0
  211. package/dist/features/3d/loaders/PLYLoader.d.ts +47 -0
  212. package/dist/features/3d/loaders/STLLoader.d.ts +27 -0
  213. package/dist/features/3d/model/Camera.d.ts +33 -0
  214. package/dist/features/3d/model/Environment.d.ts +31 -0
  215. package/dist/features/3d/model/Geometry.d.ts +59 -0
  216. package/dist/features/3d/model/InstancedMesh.d.ts +134 -0
  217. package/dist/features/3d/model/LOD.d.ts +31 -0
  218. package/dist/features/3d/model/Light.d.ts +200 -0
  219. package/dist/features/3d/model/Material.d.ts +308 -0
  220. package/dist/features/3d/model/MaterialExtensions.d.ts +200 -0
  221. package/dist/features/3d/model/Mesh.d.ts +92 -0
  222. package/dist/features/3d/model/Node.d.ts +87 -0
  223. package/dist/features/3d/model/ReflectionProbe.d.ts +45 -0
  224. package/dist/features/3d/model/RenderTarget.d.ts +41 -0
  225. package/dist/features/3d/model/Scene.d.ts +173 -0
  226. package/dist/features/3d/model/Texture.d.ts +143 -0
  227. package/dist/features/3d/nodes/Nodes.d.ts +8 -0
  228. package/dist/features/3d/nodes/ShaderNode.d.ts +240 -0
  229. package/dist/features/3d/particles/GPUParticleSchedule.d.ts +67 -0
  230. package/dist/features/3d/particles/GPUParticleShaders.d.ts +19 -0
  231. package/dist/features/3d/particles/GPUParticleState.d.ts +106 -0
  232. package/dist/features/3d/particles/GPUParticleSystem.d.ts +192 -0
  233. package/dist/features/3d/particles/ParticleCurves.d.ts +34 -0
  234. package/dist/features/3d/particles/ParticleOptions.d.ts +78 -0
  235. package/dist/features/3d/particles/ParticleSystem.d.ts +368 -0
  236. package/dist/features/3d/physics/PhysicsBackend.d.ts +352 -0
  237. package/dist/features/3d/physics/PhysicsDebug.d.ts +24 -0
  238. package/dist/features/3d/physics/PhysicsWorld.d.ts +352 -0
  239. package/dist/features/3d/physics/basic/BasicCollision.d.ts +75 -0
  240. package/dist/features/3d/physics/basic/BasicPhysics.d.ts +24 -0
  241. package/dist/features/3d/physics/basic/BasicShapes.d.ts +103 -0
  242. package/dist/features/3d/physics/rapier/ContactBuffer.d.ts +32 -0
  243. package/dist/features/3d/physics/rapier/RapierBackend.d.ts +17 -0
  244. package/dist/features/3d/physics/rapier/RapierShapes.d.ts +4 -0
  245. package/dist/features/3d/physics/rapier/RapierWorld.d.ts +198 -0
  246. package/dist/features/3d/physics/rapier/Validation.d.ts +8 -0
  247. package/dist/features/3d/services/Background.d.ts +22 -0
  248. package/dist/features/3d/services/BasicShader.d.ts +55 -0
  249. package/dist/features/3d/services/ClusteredLights.d.ts +69 -0
  250. package/dist/features/3d/services/DrawOrder.d.ts +37 -0
  251. package/dist/features/3d/services/EffectsProcessor.d.ts +38 -0
  252. package/dist/features/3d/services/EnvironmentBRDF.d.ts +35 -0
  253. package/dist/features/3d/services/EnvironmentMaps.d.ts +55 -0
  254. package/dist/features/3d/services/FogShader.d.ts +6 -0
  255. package/dist/features/3d/services/Frustum.d.ts +7 -0
  256. package/dist/features/3d/services/GLState.d.ts +86 -0
  257. package/dist/features/3d/services/GPUPicker.d.ts +31 -0
  258. package/dist/features/3d/services/InstanceShader.d.ts +3 -0
  259. package/dist/features/3d/services/LineProgram.d.ts +32 -0
  260. package/dist/features/3d/services/PBRProgram.d.ts +115 -0
  261. package/dist/features/3d/services/Renderer.d.ts +50 -0
  262. package/dist/features/3d/services/Shader.d.ts +22 -0
  263. package/dist/features/3d/services/ShaderProgram.d.ts +38 -0
  264. package/dist/features/3d/services/ShadowMaps.d.ts +97 -0
  265. package/dist/features/3d/services/SpatialIndex.d.ts +16 -0
  266. package/dist/features/3d/services/TextureLoader.d.ts +40 -0
  267. package/dist/features/3d/services/TextureMipmaps.d.ts +42 -0
  268. package/dist/features/3d/services/ToneMapping.d.ts +12 -0
  269. package/dist/features/3d/services/WebGLRenderer.d.ts +261 -0
  270. package/dist/features/3d/splats/SplatData.d.ts +136 -0
  271. package/dist/features/3d/splats/SplatLoaders.d.ts +64 -0
  272. package/dist/features/3d/splats/SplatShader.d.ts +14 -0
  273. package/dist/features/3d/splats/SplatSort.d.ts +69 -0
  274. package/dist/features/3d/splats/Splats.d.ts +116 -0
  275. package/dist/features/3d/text/FontAtlas.d.ts +246 -0
  276. package/dist/features/3d/text/SDF.d.ts +28 -0
  277. package/dist/features/3d/text/Text.d.ts +179 -0
  278. package/dist/features/3d/text/TextLayout.d.ts +73 -0
  279. package/dist/features/3d/text/TextShader.d.ts +12 -0
  280. package/dist/features/3d/tiles/BoundingVolume.d.ts +43 -0
  281. package/dist/features/3d/tiles/Geodesy.d.ts +106 -0
  282. package/dist/features/3d/tiles/GlobeControls.d.ts +147 -0
  283. package/dist/features/3d/tiles/TileContent.d.ts +35 -0
  284. package/dist/features/3d/tiles/TileFormats.d.ts +77 -0
  285. package/dist/features/3d/tiles/Tiles3D.d.ts +236 -0
  286. package/dist/features/3d/tiles/Tileset.d.ts +81 -0
  287. package/dist/features/3d/tools/BatchedMesh.d.ts +74 -0
  288. package/dist/features/3d/tools/CanvasSurface.d.ts +81 -0
  289. package/dist/features/3d/tools/Color.d.ts +11 -0
  290. package/dist/features/3d/tools/MergeGeometries.d.ts +22 -0
  291. package/dist/features/3d/tools/Options.d.ts +15 -0
  292. package/dist/features/3d/tools/Polyhedra.d.ts +30 -0
  293. package/dist/features/3d/tools/PrimitiveBuffers.d.ts +42 -0
  294. package/dist/features/3d/tools/Primitives.d.ts +164 -0
  295. package/dist/features/3d/tools/Ready.d.ts +12 -0
  296. package/dist/features/3d/tools/SpatialMath.d.ts +57 -0
  297. package/dist/features/3d/tools/SphericalHarmonics.d.ts +9 -0
  298. package/dist/features/3d/tools/math/mat3.d.ts +7 -0
  299. package/dist/features/3d/tools/math/mat4.d.ts +19 -0
  300. package/dist/features/3d/tools/math/quat.d.ts +6 -0
  301. package/dist/features/3d/tools/math/vec3.d.ts +16 -0
  302. package/dist/features/3d/tools/math/vec4.d.ts +5 -0
  303. package/dist/features/3d/types.d.ts +359 -0
  304. package/dist/features/3d/usdz/USDAParser.d.ts +50 -0
  305. package/dist/features/3d/usdz/USDScene.d.ts +20 -0
  306. package/dist/features/3d/usdz/USDZLoader.d.ts +27 -0
  307. package/dist/features/3d/usdz/ZipReader.d.ts +16 -0
  308. package/dist/features/3d/webgpu/Backend.d.ts +40 -0
  309. package/dist/features/3d/webgpu/BasicShader.d.ts +10 -0
  310. package/dist/features/3d/webgpu/Constants.d.ts +32 -0
  311. package/dist/features/3d/webgpu/Deformation.d.ts +71 -0
  312. package/dist/features/3d/webgpu/Environment.d.ts +66 -0
  313. package/dist/features/3d/webgpu/Features.d.ts +68 -0
  314. package/dist/features/3d/webgpu/Layouts.d.ts +27 -0
  315. package/dist/features/3d/webgpu/Lines.d.ts +40 -0
  316. package/dist/features/3d/webgpu/LitExtras.d.ts +46 -0
  317. package/dist/features/3d/webgpu/LitFeatures.d.ts +41 -0
  318. package/dist/features/3d/webgpu/LitScene.d.ts +60 -0
  319. package/dist/features/3d/webgpu/LitShader.d.ts +68 -0
  320. package/dist/features/3d/webgpu/Particles.d.ts +114 -0
  321. package/dist/features/3d/webgpu/Picking.d.ts +59 -0
  322. package/dist/features/3d/webgpu/PipelineKey.d.ts +33 -0
  323. package/dist/features/3d/webgpu/Points.d.ts +41 -0
  324. package/dist/features/3d/webgpu/Probes.d.ts +45 -0
  325. package/dist/features/3d/webgpu/ShaderChunks.d.ts +18 -0
  326. package/dist/features/3d/webgpu/ShaderMaterial.d.ts +57 -0
  327. package/dist/features/3d/webgpu/ShaderMaterialSource.d.ts +5 -0
  328. package/dist/features/3d/webgpu/Shadows.d.ts +49 -0
  329. package/dist/features/3d/webgpu/Splats.d.ts +47 -0
  330. package/dist/features/3d/webgpu/Textures.d.ts +52 -0
  331. package/dist/features/3d/webgpu/Transmission.d.ts +30 -0
  332. package/dist/features/3d/webgpu/UniformLayout.d.ts +30 -0
  333. package/dist/features/3d/webgpu/UtilityShaders.d.ts +38 -0
  334. package/dist/features/3d/webgpu/WebGPURenderer.d.ts +327 -0
  335. package/dist/features/3d/webgpu/effects/EffectsShaders.d.ts +74 -0
  336. package/dist/features/3d/webgpu/effects/WebGPUEffects.d.ts +140 -0
  337. package/dist/features/3d/xr/XR.d.ts +100 -0
  338. package/dist/gltf-By-n0qEg.js +960 -0
  339. package/dist/index.d.ts +86 -81
  340. package/dist/model/document-actions/document-commands.d.ts +18 -0
  341. package/dist/model/documents/svg/create-svg-document-renderer.d.ts +32 -0
  342. package/dist/model/documents/svg/export-svg-document.d.ts +5 -0
  343. package/dist/model/documents/svg/import-svg-document.d.ts +6 -0
  344. package/dist/model/documents/svg/svg-document.types.d.ts +111 -0
  345. package/dist/model/documents/svg/svg-values.d.ts +16 -0
  346. package/dist/model/documents/svg/svg-xml.d.ts +18 -0
  347. package/dist/model/input/NovaInputProxy_Adapter.d.ts +2 -1
  348. package/dist/model/input/NovaInputValidationController.d.ts +1 -1
  349. package/dist/model/input/NovaTextInputController.d.ts +1 -1
  350. package/dist/model/input/NovaTextLayoutEngine.d.ts +2 -6
  351. package/dist/model/input/index.d.ts +7 -7
  352. package/dist/model/input/nova-input.types.d.ts +1 -1
  353. package/dist/model/lighting/LightingRenderer2D.d.ts +58 -0
  354. package/dist/model/lighting/NovaLighting2D.d.ts +56 -0
  355. package/dist/model/lighting/lighting-shaders.d.ts +3 -0
  356. package/dist/model/lighting/lighting-state.d.ts +27 -0
  357. package/dist/model/lighting/lighting.types.d.ts +107 -0
  358. package/dist/model/lottie/LottieNode.d.ts +4 -0
  359. package/dist/model/lottie/lottie.types.d.ts +83 -0
  360. package/dist/model/lottie/prepare-lottie.d.ts +3 -0
  361. package/dist/model/lottie/sample-position.d.ts +9 -0
  362. package/dist/model/motion/NovaMotionEngine.d.ts +3 -3
  363. package/dist/model/motion/nova-motion-easing.d.ts +1 -1
  364. package/dist/model/motion/nova-motion-interpolation.d.ts +1 -1
  365. package/dist/model/motion/nova-motion-presets.d.ts +2 -2
  366. package/dist/model/motion/nova-motion-timeline.d.ts +1 -1
  367. package/dist/model/platform/NovaCanvas.d.ts +7 -6
  368. package/dist/model/primitives/NovaPrimitiveUnsupportedError.d.ts +13 -0
  369. package/dist/model/primitives/definePrimitive.d.ts +5 -0
  370. package/dist/model/primitives/primitive.types.d.ts +28 -0
  371. package/dist/model/render/backends/canvas2d/NovaCanvas2DTargetManager.d.ts +3 -3
  372. package/dist/model/render/backends/canvas2d/NovaRenderer2D.d.ts +61 -15
  373. package/dist/model/render/backends/canvas2d/nova-canvas-blend.d.ts +5 -0
  374. package/dist/model/render/backends/nova-render-backend-factory.d.ts +6 -6
  375. package/dist/model/render/backends/nova-render-backend.d.ts +8 -2
  376. package/dist/model/render/backends/webgl/NovaRendererWebGL.d.ts +32 -11
  377. package/dist/model/render/backends/webgl/NovaStreamCacheIdleLedger.d.ts +12 -1
  378. package/dist/model/render/backends/webgl/NovaWebGLBatcher.d.ts +1 -1
  379. package/dist/model/render/backends/webgl/NovaWebGLCircleImagePass.d.ts +23 -0
  380. package/dist/model/render/backends/webgl/NovaWebGLCompositionPass.d.ts +9 -0
  381. package/dist/model/render/backends/webgl/NovaWebGLDevice.d.ts +3 -1
  382. package/dist/model/render/backends/webgl/NovaWebGLDiagnostics.d.ts +1 -1
  383. package/dist/model/render/backends/webgl/NovaWebGLFrameRenderer.d.ts +162 -53
  384. package/dist/model/render/backends/webgl/NovaWebGLPathClipPass.d.ts +13 -0
  385. package/dist/model/render/backends/webgl/NovaWebGLPathUnion.d.ts +23 -0
  386. package/dist/model/render/compiler/NovaRenderBuilder.d.ts +24 -10
  387. package/dist/model/render/compiler/NovaRenderCommandWriter.d.ts +10 -5
  388. package/dist/model/render/compiler/NovaRenderCompiler.d.ts +7 -6
  389. package/dist/model/render/compiler/NovaRenderFrameBuilder.d.ts +4 -3
  390. package/dist/model/render/effects/blur.d.ts +8 -0
  391. package/dist/model/render/effects/color-matrix.d.ts +8 -0
  392. package/dist/model/render/effects/drop-shadow.d.ts +18 -0
  393. package/dist/model/render/effects/nova-effect-registry.d.ts +66 -0
  394. package/dist/model/render/effects/nova-gaussian-kernel.d.ts +7 -0
  395. package/dist/model/render/effects/nova-gaussian-textures.d.ts +11 -0
  396. package/dist/model/render/effects/shader-effect.d.ts +64 -0
  397. package/dist/model/render/geometry/nova-alpha-mask.d.ts +5 -0
  398. package/dist/model/render/geometry/nova-composition.d.ts +9 -0
  399. package/dist/model/render/geometry/nova-node-clip.d.ts +17 -0
  400. package/dist/model/render/geometry/nova-path-geometry.d.ts +24 -0
  401. package/dist/model/render/geometry/nova-path-tessellation.d.ts +7 -0
  402. package/dist/model/render/geometry/nova-polygon-triangulation.d.ts +1 -1
  403. package/dist/model/render/graph/NovaRectBatchBuffer.d.ts +58 -0
  404. package/dist/model/render/graph/NovaRenderGraph.d.ts +40 -6
  405. package/dist/model/render/graph/NovaRenderHitIndex.d.ts +1 -1
  406. package/dist/model/render/graph/nova-auto-rect.d.ts +1 -1
  407. package/dist/model/render/graph/nova-linear-rect-repack.d.ts +4 -4
  408. package/dist/model/render/graph/nova-linear-rect-transition.d.ts +2 -2
  409. package/dist/model/render/graph/nova-render-culling.d.ts +2 -2
  410. package/dist/model/render/graph/nova-render-dirty-items.d.ts +1 -1
  411. package/dist/model/render/graph/nova-render-group.d.ts +1 -1
  412. package/dist/model/render/graph/nova-render-item.d.ts +2 -2
  413. package/dist/model/render/graph/nova-render-layer.d.ts +1 -1
  414. package/dist/model/render/graph/nova-render-payload-snapshot.d.ts +3 -1
  415. package/dist/model/render/graph/nova-render-program.d.ts +5 -3
  416. package/dist/model/render/graph/nova-render-sequence.d.ts +1 -1
  417. package/dist/model/render/graph/nova-render-stream.d.ts +2 -2
  418. package/dist/model/render/ktx2/BasisSession.d.ts +45 -0
  419. package/dist/model/render/ktx2/KTX2Container.d.ts +26 -0
  420. package/dist/model/render/ktx2/KTX2Loader.d.ts +55 -0
  421. package/dist/model/render/meshes/MeshNode.d.ts +13 -0
  422. package/dist/model/render/meshes/NovaMeshWebGLDevice.d.ts +27 -0
  423. package/dist/model/render/meshes/geometry.d.ts +7 -0
  424. package/dist/model/render/meshes/mesh.d.ts +3 -0
  425. package/dist/model/render/meshes/mesh.types.d.ts +116 -0
  426. package/dist/model/render/meshes/nova-mesh-registry.d.ts +55 -0
  427. package/dist/model/render/orchestration/NovaRenderOrchestrator.d.ts +25 -3
  428. package/dist/model/render/policy/nova-render-policy.d.ts +1 -1
  429. package/dist/model/render/resources/NovaGlyphAtlasManager.d.ts +2 -2
  430. package/dist/model/render/resources/NovaTextAtlasManager.d.ts +3 -3
  431. package/dist/model/render/resources/NovaTextLayoutEngine.d.ts +1 -1
  432. package/dist/model/render/resources/nova-bitmap-upload.d.ts +10 -0
  433. package/dist/model/render/schema/NovaRenderContext.d.ts +6 -4
  434. package/dist/model/render/schema/nova-style-compiler.d.ts +5 -2
  435. package/dist/model/render/targets/NovaNodeRenderTextureSource.d.ts +29 -0
  436. package/dist/model/render/targets/NovaRenderTargetManager.d.ts +1 -1
  437. package/dist/model/render/targets/NovaRenderTexture.d.ts +57 -0
  438. package/dist/model/render/targets/nova-render-target-refs.d.ts +5 -0
  439. package/dist/model/render/targets/nova-render-target-resource.d.ts +1 -1
  440. package/dist/model/render/targets/nova-render-texture-runtime.d.ts +71 -0
  441. package/dist/model/render/textures/nova-compressed-image.d.ts +20 -0
  442. package/dist/model/render/utils/nova-icon-rendering.d.ts +3 -1
  443. package/dist/model/render/utils/nova-image-geometry.d.ts +11 -0
  444. package/dist/model/render/utils/nova-markdown-layout.d.ts +19 -0
  445. package/dist/model/render/utils/nova-text-paint.d.ts +26 -0
  446. package/dist/model/render/utils/nova-wrapped-text-layout.d.ts +19 -0
  447. package/dist/model/runtime/app/Nova.d.ts +35 -35
  448. package/dist/model/runtime/app/NovaApp.d.ts +58 -30
  449. package/dist/model/runtime/app/NovaRaphRuntime.d.ts +2 -2
  450. package/dist/model/runtime/app/createNovaRaphRuntime.d.ts +3 -3
  451. package/dist/model/runtime/assets/NovaAssetRegistry.d.ts +89 -2
  452. package/dist/model/runtime/assets/NovaVideoTexture.d.ts +38 -0
  453. package/dist/model/runtime/assets/nova-render-texture-image-identity.d.ts +4 -0
  454. package/dist/model/runtime/commands/NovaCommandBus.d.ts +1 -1
  455. package/dist/model/runtime/components/NovaComponentNode.d.ts +6 -6
  456. package/dist/model/runtime/components/NovaComponentRegistry.d.ts +1 -1
  457. package/dist/model/runtime/components/NovaSchemaRegistry.d.ts +7 -6
  458. package/dist/model/runtime/components/nova-component-metadata.d.ts +1 -1
  459. package/dist/model/runtime/components/nova-component.decorator.d.ts +2 -2
  460. package/dist/model/runtime/components/nova-defined-component.d.ts +3 -3
  461. package/dist/model/runtime/context/nova-context.d.ts +1 -1
  462. package/dist/model/runtime/cursor/NovaCursorManager.d.ts +3 -3
  463. package/dist/model/runtime/diagnostics/NovaDiagnostics_Module.d.ts +3 -3
  464. package/dist/model/runtime/interaction/NovaEvents.d.ts +16 -6
  465. package/dist/model/runtime/interaction/NovaHitIndex.d.ts +1 -1
  466. package/dist/model/runtime/interaction/NovaSpatialIndex.d.ts +2 -2
  467. package/dist/model/runtime/scene/NovaScene.d.ts +3 -3
  468. package/dist/model/runtime/scene/nova-scene-components.d.ts +6 -6
  469. package/dist/model/runtime/state/nova-store-decorators.d.ts +1 -1
  470. package/dist/model/runtime/state/nova-store-runtime.d.ts +1 -1
  471. package/dist/model/runtime/state/nova-store-tracking.d.ts +7 -3
  472. package/dist/model/runtime/sync/NovaSyncScope.d.ts +11 -2
  473. package/dist/model/runtime/sync/nova-sync-context.d.ts +2 -2
  474. package/dist/model/runtime/sync/nova-sync-ports.d.ts +2 -2
  475. package/dist/model/runtime/sync/nova-sync.types.d.ts +15 -3
  476. package/dist/model/runtime/template/NovaTemplateRuntime.d.ts +6 -6
  477. package/dist/model/runtime/tree/NovaContainer.d.ts +4 -4
  478. package/dist/model/runtime/tree/NovaNode.d.ts +58 -18
  479. package/dist/model/runtime/tree/NovaRaphNode.d.ts +8 -2
  480. package/dist/model/runtime/tree/NovaSurface.d.ts +32 -10
  481. package/dist/model/runtime/tree/nova-node-capture-invalidation.d.ts +11 -0
  482. package/dist/model/semantic/NovaSemanticService.d.ts +1 -1
  483. package/dist/model/semantic/browser/createAccessibilityBridge.d.ts +29 -0
  484. package/dist/model/sound/NovaSoundEngine.d.ts +3 -2
  485. package/dist/model/text-selection/NovaTextSelectionService.d.ts +2 -2
  486. package/dist/model/text-selection/index.d.ts +2 -2
  487. package/dist/model/text-selection/nova-text-selection.types.d.ts +1 -1
  488. package/dist/model/theme/NovaGlobalThemeRegistry.d.ts +2 -2
  489. package/dist/model/theme/NovaThemeService.d.ts +5 -3
  490. package/dist/model/theme/createTokenTheme.d.ts +15 -0
  491. package/dist/model/tools/transform-tools.d.ts +43 -0
  492. package/dist/nodes--Ds4IS2h.js +621 -0
  493. package/dist/nova-color-parser-BCN_rFRN.js +250 -0
  494. package/dist/nova-compressed-image-CE2Ya9Xa.js +46 -0
  495. package/dist/nova-mesh-registry-B7Xz5mhU.js +24 -0
  496. package/dist/nova-render-texture-image-identity-DQ09XFKs.js +15 -0
  497. package/dist/nova-text-paint-CcntsRjI.js +48 -0
  498. package/dist/tokens.d.ts +2 -0
  499. package/dist/tokens.js +50 -0
  500. package/dist/vec4-BTNv1fUp.js +20 -0
  501. package/package.json +229 -4
@@ -0,0 +1,495 @@
1
+ function u(o, e, t = -1e7, r = 1e7) {
2
+ if (!Number.isFinite(o) || o < t || o > r)
3
+ throw new RangeError(`[Nova2D lighting] ${e} must be finite in ${t}..${r}`);
4
+ return o;
5
+ }
6
+ function C(o) {
7
+ return Object.freeze({ x: u(o.x, "bounds.x"), y: u(o.y, "bounds.y"), width: u(o.width, "bounds.width", 1e-3), height: u(o.height, "bounds.height", 1e-3) });
8
+ }
9
+ function y(o, e = !1) {
10
+ if (o?.length !== 3)
11
+ throw new TypeError("[Nova2D lighting] Expected an XYZ tuple");
12
+ const t = o.map((s, i) => u(s, `vector[${i}]`)), r = Math.hypot(...t);
13
+ if (e && r < 1e-5)
14
+ throw new RangeError("[Nova2D lighting] Direction cannot be zero");
15
+ return Object.freeze(e ? t.map((s) => s / r) : t);
16
+ }
17
+ function E(o = 255) {
18
+ if (!Number.isInteger(o))
19
+ throw new RangeError("[Nova2D lighting] Layers must be an eight-bit integer");
20
+ return u(o, "layers", 0, 255);
21
+ }
22
+ function A(o = "#ffffff") {
23
+ let e;
24
+ if (typeof o == "string") {
25
+ if (!/^#(?:[\da-f]{3}|[\da-f]{6})$/i.test(o))
26
+ throw new TypeError("[Nova2D lighting] Color must be #RGB, #RRGGBB or an RGB tuple");
27
+ const t = o.slice(1).split("").map((r) => o.length === 4 ? r + r : r).join("");
28
+ e = [0, 2, 4].map((r) => Number.parseInt(t.slice(r, r + 2), 16) / 255);
29
+ } else {
30
+ if (o.length !== 3)
31
+ throw new TypeError("[Nova2D lighting] Color needs three channels");
32
+ e = o.map((t) => u(t, "color", 0, 1));
33
+ }
34
+ return Object.freeze([...e]);
35
+ }
36
+ function M(o, e) {
37
+ const t = {
38
+ enabled: e.enabled ?? !0,
39
+ color: A(e.color),
40
+ intensity: u(e.intensity ?? 1, "intensity", 0, 16),
41
+ layers: E(e.layers),
42
+ shadows: Object.freeze({ enabled: e.shadows?.enabled ?? !1, opacity: u(e.shadows?.opacity ?? 1, "shadow opacity", 0, 1) })
43
+ }, r = t.color.map((c) => c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
44
+ if (o === "directional") {
45
+ const c = e, _ = y(c.direction, !0);
46
+ if (_[2] >= -1e-5)
47
+ throw new RangeError("[Nova2D lighting] Directional light must point down towards the ground");
48
+ const p = u(c.angularRadius ?? 0, "angularRadius", 0, 0.5), m = u(c.shadowDistance ?? 1e4, "shadowDistance", 1);
49
+ return { kind: o, color: r, position: [0, 0, 0], direction: _, range: m, radius: p, inner: 1, outer: 0, falloff: 2, options: Object.freeze({ ...t, direction: _, angularRadius: p, shadowDistance: m }) };
50
+ }
51
+ const s = e, i = y(s.position), d = u(s.range, "range", 1e-3), n = u(s.sourceRadius ?? 0, "sourceRadius", 0, d), g = u(s.falloff ?? 2, "falloff", 0.1, 16), l = { ...t, position: i, range: d, sourceRadius: n, falloff: g };
52
+ let f = [0, 0, -1], h = 1, a = 0;
53
+ if (o === "spot") {
54
+ const c = e;
55
+ return f = y(c.direction, !0), u(c.outerConeAngle, "outerConeAngle", 1e-3, Math.PI / 2), u(c.innerConeAngle, "innerConeAngle", 0, c.outerConeAngle - 1e-5), h = Math.cos(c.innerConeAngle), a = Math.cos(c.outerConeAngle), { kind: o, color: r, position: i, direction: f, range: d, radius: n, inner: h, outer: a, falloff: g, options: Object.freeze({ ...l, direction: f, innerConeAngle: c.innerConeAngle, outerConeAngle: c.outerConeAngle }) };
56
+ }
57
+ return { kind: o, color: r, position: i, direction: f, range: d, radius: n, inner: h, outer: a, falloff: g, options: Object.freeze(l) };
58
+ }
59
+ function D(o, e) {
60
+ if (!o.polygon || o.polygon.length < 3 || o.polygon.length > 8)
61
+ throw new RangeError("[Nova2D lighting] Occluder needs 3..8 convex vertices");
62
+ const t = o.polygon.map(([n, g]) => [u(n, "polygon.x"), u(g, "polygon.y")]);
63
+ let r = 0, s = 0;
64
+ for (let n = 0; n < t.length; n++) {
65
+ const g = t[n], l = t[(n + 1) % t.length], f = t[(n + 2) % t.length], h = (l[0] - g[0]) * (f[1] - l[1]) - (l[1] - g[1]) * (f[0] - l[0]);
66
+ if (Math.abs(h) < 1e-5 || s && Math.sign(h) !== s)
67
+ throw new RangeError("[Nova2D lighting] Footprint must be strictly convex without duplicate vertices");
68
+ s = Math.sign(h), r += g[0] * l[1] - l[0] * g[1];
69
+ }
70
+ for (let n = 0; n < t.length; n++) {
71
+ const g = t[n], l = t[(n + 1) % t.length];
72
+ if (t.some((f) => ((l[0] - g[0]) * (f[1] - g[1]) - (l[1] - g[1]) * (f[0] - g[0])) * s < -1e-5))
73
+ throw new RangeError("[Nova2D lighting] Footprint edges must enclose a convex polygon");
74
+ }
75
+ r < 0 && t.reverse();
76
+ const i = u(o.baseHeight ?? 0, "baseHeight", 0, e), d = u(o.height, "height", 1e-3, e - i);
77
+ return Object.freeze({ ...o, polygon: Object.freeze(t.map((n) => Object.freeze(n))), baseHeight: i, height: d, layers: E(o.layers), enabled: o.enabled ?? !0 });
78
+ }
79
+ function S(o, e) {
80
+ if (!o.image)
81
+ throw new TypeError("[Nova2D lighting] Receiver needs a borrowed alpha image");
82
+ const t = u(o.baseHeight ?? 0, "baseHeight", 0, e);
83
+ return Object.freeze({ ...o, bounds: C(o.bounds), baseHeight: t, height: u(o.height, "height", 0, e - t), layers: E(o.layers), enabled: o.enabled ?? !0, imageRevision: u(o.imageRevision ?? 0, "imageRevision", 0), order: o.order === void 0 ? void 0 : u(o.order, "receiver order"), unlit: o.unlit ?? !1 });
84
+ }
85
+ const z = `#version 300 es
86
+ precision highp float;
87
+ out vec2 uv;
88
+ void main(){
89
+ vec2 p=vec2(float((gl_VertexID<<1)&2),float(gl_VertexID&2));
90
+ uv=vec2(p.x,1.-p.y);
91
+ gl_Position=vec4(p*2.-1.,0.,1.);
92
+ }`, N = `#version 300 es
93
+ precision highp float;
94
+ precision highp int;
95
+ in vec2 uv;
96
+ out vec4 outColor;
97
+ uniform sampler2D heights;
98
+ uniform highp sampler2D geometry;
99
+ uniform vec4 bounds;
100
+ uniform vec3 ambient;
101
+ uniform float groundScale, maxHeight;
102
+ uniform int lightCount, casterCount;
103
+ uniform vec4 positions[8], colors[8], directions[8], cones[8], shadows[8];
104
+ float cross2(vec2 a,vec2 b){return a.x*b.y-a.y*b.x;}
105
+ bool blocked(vec3 p,vec3 end,int layers){
106
+ vec3 d=end-p;
107
+ for(int c=0;c<64;c++){
108
+ if(c>=casterCount)break;
109
+ vec4 h=texelFetch(geometry,ivec2(0,c),0);
110
+ if((int(h.z)&layers)==0)continue;
111
+ vec4 bb=texelFetch(geometry,ivec2(9,c),0);
112
+ if(any(lessThan(max(p.xy,end.xy),bb.xy))||any(greaterThan(min(p.xy,end.xy),bb.zw)))continue;
113
+ float lo=.001, hi=.999;
114
+ if(abs(d.z)<.00001){if(p.z<h.y||p.z>h.y+h.x)continue;}
115
+ else{
116
+ float a=(h.y-p.z)/d.z,b=(h.y+h.x-p.z)/d.z;
117
+ lo=max(lo,min(a,b));hi=min(hi,max(a,b));
118
+ }
119
+ int n=int(h.w);
120
+ for(int i=0;i<8;i++){
121
+ if(i>=n||lo>hi)break;
122
+ vec2 a=texelFetch(geometry,ivec2(i+1,c),0).xy;
123
+ vec2 b=texelFetch(geometry,ivec2((i+1)%n+1,c),0).xy;
124
+ float f=cross2(b-a,p.xy-a),g=cross2(b-a,d.xy);
125
+ if(abs(g)<.00001){if(f<0.){hi=-1.;break;}}
126
+ else if(g>0.)lo=max(lo,-f/g);
127
+ else hi=min(hi,-f/g);
128
+ }
129
+ if(lo<hi)return true;
130
+ }
131
+ return false;
132
+ }
133
+ void main(){
134
+ vec2 screen=bounds.xy+uv*bounds.zw;
135
+ vec4 field=texture(heights,uv);
136
+ if(field.b>.5){outColor=vec4(vec3(64./255.),1.);return;}
137
+ float z=field.r*maxHeight;
138
+ int receiverLayers=int(round(field.g*255.));
139
+ vec3 p=vec3(screen.x,(screen.y+z)/groundScale,z);
140
+ vec3 light=ambient;
141
+ for(int i=0;i<8;i++){
142
+ if(i>=lightCount)break;
143
+ int layers=int(cones[i].z);
144
+ if((layers&receiverLayers)==0)continue;
145
+ bool directional=positions[i].w<.5;
146
+ vec3 end=directional?p-directions[i].xyz*shadows[i].w:positions[i].xyz;
147
+ float amount=colors[i].w;
148
+ if(!directional){
149
+ vec3 delta=p-end;
150
+ float dist=length(delta);
151
+ if(dist>=directions[i].w)continue;
152
+ amount*=pow(max(0.,1.-dist/directions[i].w),cones[i].w);
153
+ if(positions[i].w>1.5)amount*=smoothstep(cones[i].y,cones[i].x,dot(delta/max(dist,.00001),directions[i].xyz));
154
+ }
155
+ if(amount<.00001)continue;
156
+ if(shadows[i].x>0.){
157
+ float visibility=0.;
158
+ float radius=shadows[i].y*(directional?shadows[i].w:1.);
159
+ int samples=radius>0.?8:1;
160
+ for(int s=0;s<8;s++){
161
+ if(s>=samples)break;
162
+ float angle=float(s)*2.39996323;
163
+ vec2 disk=vec2(cos(angle),sin(angle))*sqrt((float(s)+.5)/8.);
164
+ vec3 target=end+vec3(disk*radius,0.);
165
+ visibility+=blocked(p,target,layers)?0.:1./float(samples);
166
+ }
167
+ amount*=mix(1.,visibility,shadows[i].x);
168
+ }
169
+ light+=colors[i].rgb*amount;
170
+ }
171
+ // 1 maps EXACTLY to byte 64: the neutral baseline does not introduce a seam.
172
+ outColor=vec4(clamp(light*(64./255.),0.,1.),1.);
173
+ }`, L = `#version 300 es
174
+ precision highp float;
175
+ in vec2 uv;
176
+ out vec4 outColor;
177
+ uniform sampler2D albedo, illumination;
178
+ vec3 linearRGB(vec3 c){return mix(c/12.92,pow((c+.055)/1.055,vec3(2.4)),step(vec3(.04045),c));}
179
+ vec3 srgb(vec3 c){return mix(c*12.92,1.055*pow(max(c,vec3(0.)),vec3(1./2.4))-.055,step(vec3(.0031308),c));}
180
+ void main(){
181
+ vec4 art=texture(albedo,uv);
182
+ vec3 irradiance=texture(illumination,vec2(uv.x,1.-uv.y)).rgb*(255./64.);
183
+ outColor=vec4(srgb(clamp(linearRGB(art.rgb)*irradiance,0.,1.)),art.a);
184
+ }`;
185
+ function b(o = 1, e = 1) {
186
+ const t = document.createElement("canvas");
187
+ return t.width = o, t.height = e, t;
188
+ }
189
+ class F {
190
+ constructor(e) {
191
+ this._options = e;
192
+ const t = this.canvas.getContext("webgl2", { alpha: !0, premultipliedAlpha: !1, antialias: !1, depth: !1, stencil: !1 });
193
+ if (!t)
194
+ throw new Error("[Nova2D lighting] WebGL2 is required");
195
+ this._gl = t, this.canvas.addEventListener("webglcontextlost", (r) => {
196
+ r.preventDefault(), this._lost = !0;
197
+ }, { signal: this._lifetime.signal }), this.canvas.addEventListener("webglcontextrestored", () => {
198
+ if (!this._disposed) {
199
+ this._lost = !0;
200
+ try {
201
+ this._initialize(), this._lost = !1;
202
+ } catch {
203
+ this._releaseGPU();
204
+ }
205
+ }
206
+ }, { signal: this._lifetime.signal });
207
+ try {
208
+ this._initialize();
209
+ } catch (r) {
210
+ throw this.dispose(), r;
211
+ }
212
+ }
213
+ canvas = b();
214
+ _field = b();
215
+ _source = b();
216
+ _fieldContext = this._field.getContext("2d");
217
+ _sourceContext = this._source.getContext("2d");
218
+ _receiverMasks = /* @__PURE__ */ new Map();
219
+ _lifetime = new AbortController();
220
+ _gl;
221
+ _textures = [];
222
+ _programs = [];
223
+ _shaders = [];
224
+ _framebuffer;
225
+ _uniforms = /* @__PURE__ */ new Map();
226
+ _fieldKey = "";
227
+ _lost = !1;
228
+ _disposed = !1;
229
+ _renders = 0;
230
+ _generation = 0;
231
+ _lightWidth = 0;
232
+ _lightHeight = 0;
233
+ _geometryValid = !1;
234
+ _lastOccluders = [];
235
+ _initialize() {
236
+ const e = this._gl;
237
+ this._textures = [], this._programs = [], this._shaders = [], this._uniforms.clear();
238
+ const t = e.createShader(e.VERTEX_SHADER);
239
+ if (this._shaders.push(t), e.shaderSource(t, z), e.compileShader(t), !e.getShaderParameter(t, e.COMPILE_STATUS))
240
+ throw new Error(e.getShaderInfoLog(t) ?? "[Nova2D lighting] Vertex compile failed");
241
+ for (const r of [N, L]) {
242
+ const s = e.createShader(e.FRAGMENT_SHADER), i = e.createProgram();
243
+ if (this._shaders.push(s), this._programs.push(i), e.shaderSource(s, r), e.compileShader(s), !e.getShaderParameter(s, e.COMPILE_STATUS))
244
+ throw new Error(e.getShaderInfoLog(s) ?? "[Nova2D lighting] Fragment compile failed");
245
+ if (e.attachShader(i, t), e.attachShader(i, s), e.linkProgram(i), !e.getProgramParameter(i, e.LINK_STATUS))
246
+ throw new Error(e.getProgramInfoLog(i) ?? "[Nova2D lighting] Program link failed");
247
+ this._uniforms.set(i, /* @__PURE__ */ new Map());
248
+ }
249
+ for (let r = 0; r < 4; r++) {
250
+ const s = e.createTexture();
251
+ this._textures.push(s), e.activeTexture(e.TEXTURE0 + r), e.bindTexture(e.TEXTURE_2D, s), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, r === 2 ? e.NEAREST : e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, r === 2 ? e.NEAREST : e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
252
+ }
253
+ this._framebuffer = e.createFramebuffer(), e.disable(e.DEPTH_TEST), e.disable(e.BLEND), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1), e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL, e.NONE), this._fieldKey = "", this._lightWidth = this._lightHeight = 0, this._geometryValid = !1, this._lastOccluders = [], this._generation++;
254
+ }
255
+ _uniform(e, t) {
256
+ const r = this._uniforms.get(e);
257
+ return r.has(t) || r.set(t, this._gl.getUniformLocation(e, t)), r.get(t);
258
+ }
259
+ _bind(e) {
260
+ this._gl.activeTexture(this._gl.TEXTURE0 + e), this._gl.bindTexture(this._gl.TEXTURE_2D, this._textures[e]);
261
+ }
262
+ _uploadField(e, t, r) {
263
+ const s = `${t},${r},${e.receiverRevision},${Object.values(e.bounds).join(",")}`;
264
+ if (s === this._fieldKey)
265
+ return;
266
+ const { bounds: i, receivers: d } = e;
267
+ this._field.width = t, this._field.height = r;
268
+ const n = this._fieldContext;
269
+ n.fillStyle = "#00ff00", n.fillRect(0, 0, t, r);
270
+ const g = (h) => h.bounds.x + h.bounds.width >= i.x && h.bounds.y + h.bounds.height >= i.y && h.bounds.x <= i.x + i.width && h.bounds.y <= i.y + i.height, l = new Set(d.filter(g));
271
+ for (const [h, a] of this._receiverMasks)
272
+ l.has(h) || (a.width = a.height = 0, this._receiverMasks.delete(h));
273
+ n.save(), n.scale(t / i.width, r / i.height), n.translate(-i.x, -i.y);
274
+ for (const h of d) {
275
+ const a = h.bounds;
276
+ if (!h.enabled || !g(h))
277
+ continue;
278
+ let c = this._receiverMasks.get(h);
279
+ if (!c) {
280
+ const _ = this._options.maxTextureSize, p = Math.min(1, _ / Math.max(a.width, a.height));
281
+ if ([...this._receiverMasks.values()].reduce((w, T) => w + T.width * T.height, 0) + Math.ceil(a.width * p) * Math.ceil(a.height * p) > 4194304)
282
+ throw new RangeError("[Nova2D lighting] Visible receiver masks exceed the 16MiB budget; reduce their bounds or render a smaller region");
283
+ c = b(Math.max(1, Math.ceil(a.width * p)), Math.max(1, Math.ceil(a.height * p)));
284
+ const v = c.getContext("2d"), x = v.createLinearGradient(0, 0, 0, c.height), R = (w) => `rgb(${Math.round(w / this._options.maxHeight * 255)},${h.layers},${h.unlit ? 255 : 0})`;
285
+ x.addColorStop(0, R(h.baseHeight + h.height)), x.addColorStop(1, R(h.baseHeight)), v.fillStyle = x, v.fillRect(0, 0, c.width, c.height), v.globalCompositeOperation = "destination-in", v.drawImage(h.image, 0, 0, c.width, c.height), this._receiverMasks.set(h, c);
286
+ }
287
+ n.drawImage(c, a.x, a.y, a.width, a.height);
288
+ }
289
+ n.restore(), this._bind(1);
290
+ const f = this._gl;
291
+ f.texImage2D(f.TEXTURE_2D, 0, f.RGBA, f.RGBA, f.UNSIGNED_BYTE, this._field), this._fieldKey = s;
292
+ }
293
+ render(e, t, r, s) {
294
+ if (this._disposed)
295
+ throw new Error("[Nova2D lighting] Renderer is disposed");
296
+ if (!this.available)
297
+ return;
298
+ const i = this._gl;
299
+ (this.canvas.width !== t || this.canvas.height !== r) && (this.canvas.width = t, this.canvas.height = r);
300
+ const d = Math.max(1, Math.min(this._options.maxTextureSize, Math.ceil(s.bounds.width * this._options.resolution))), n = Math.max(1, Math.min(this._options.maxTextureSize, Math.ceil(s.bounds.height * this._options.resolution)));
301
+ if (this._uploadField(s, d, n), this._bind(0), e !== this._source && ((this._source.width !== t || this._source.height !== r) && (this._source.width = t, this._source.height = r), this._sourceContext.clearRect(0, 0, t, r), this._sourceContext.drawImage(e, 0, 0, t, r)), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, i.RGBA, i.UNSIGNED_BYTE, this._source), !this._geometryValid || s.occluders.length !== this._lastOccluders.length || s.occluders.some((a, c) => a !== this._lastOccluders[c])) {
302
+ const a = new Float32Array(2560);
303
+ for (const [c, _] of s.occluders.entries()) {
304
+ const p = c * 40;
305
+ a.set([_.height, _.baseHeight, _.layers, _.polygon.length], p);
306
+ for (const [m, v] of _.polygon.entries())
307
+ a.set(v, p + (m + 1) * 4);
308
+ a.set([Math.min(..._.polygon.map((m) => m[0])), Math.min(..._.polygon.map((m) => m[1])), Math.max(..._.polygon.map((m) => m[0])), Math.max(..._.polygon.map((m) => m[1]))], p + 36);
309
+ }
310
+ this._bind(2), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA32F, 10, 64, 0, i.RGBA, i.FLOAT, a), this._lastOccluders = s.occluders, this._geometryValid = !0;
311
+ }
312
+ if (this._bind(3), (d !== this._lightWidth || n !== this._lightHeight) && (i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, d, n, 0, i.RGBA, i.UNSIGNED_BYTE, null), this._lightWidth = d, this._lightHeight = n), i.bindFramebuffer(i.FRAMEBUFFER, this._framebuffer), i.framebufferTexture2D(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, this._textures[3], 0), i.checkFramebufferStatus(i.FRAMEBUFFER) !== i.FRAMEBUFFER_COMPLETE)
313
+ throw new Error("[Nova2D lighting] Incomplete light buffer");
314
+ const l = this._programs[0];
315
+ i.useProgram(l), i.uniform1i(this._uniform(l, "heights"), 1), i.uniform1i(this._uniform(l, "geometry"), 2), i.uniform4f(this._uniform(l, "bounds"), s.bounds.x, s.bounds.y, s.bounds.width, s.bounds.height), i.uniform3fv(this._uniform(l, "ambient"), s.ambient), i.uniform1f(this._uniform(l, "groundScale"), this._options.groundScale), i.uniform1f(this._uniform(l, "maxHeight"), this._options.maxHeight), i.uniform1i(this._uniform(l, "lightCount"), s.lights.length), i.uniform1i(this._uniform(l, "casterCount"), s.occluders.length);
316
+ const f = Array.from({ length: 5 }, () => new Float32Array(32));
317
+ s.lights.forEach((a, c) => {
318
+ const _ = c * 4;
319
+ f[0].set([...a.position, a.kind === "directional" ? 0 : a.kind === "point" ? 1 : 2], _), f[1].set([...a.color, a.options.intensity], _), f[2].set([...a.direction, a.range], _), f[3].set([a.inner, a.outer, a.options.layers, a.falloff], _), f[4].set([a.options.shadows.enabled ? a.options.shadows.opacity : 0, a.radius, 0, a.range], _);
320
+ });
321
+ for (const [a, c] of ["positions", "colors", "directions", "cones", "shadows"].entries())
322
+ i.uniform4fv(this._uniform(l, `${c}[0]`), f[a]);
323
+ i.viewport(0, 0, d, n), i.drawArrays(i.TRIANGLES, 0, 3), i.framebufferTexture2D(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, null, 0), i.bindFramebuffer(i.FRAMEBUFFER, null);
324
+ const h = this._programs[1];
325
+ return i.useProgram(h), i.uniform1i(this._uniform(h, "albedo"), 0), i.uniform1i(this._uniform(h, "illumination"), 3), i.viewport(0, 0, t, r), i.drawArrays(i.TRIANGLES, 0, 3), this._renders++, this.canvas;
326
+ }
327
+ apply(e, t) {
328
+ if (!this.available)
329
+ return !1;
330
+ const r = e.getTransform();
331
+ if (Math.abs(r.b) > 1e-5 || Math.abs(r.c) > 1e-5 || r.a <= 0 || r.d <= 0)
332
+ throw new Error("[Nova2D lighting] apply requires positive axis-aligned camera scale; use render for rotated cameras");
333
+ const s = t.bounds, i = Math.floor(s.x * r.a + r.e), d = Math.floor(s.y * r.d + r.f), n = Math.max(1, Math.ceil((s.x + s.width) * r.a + r.e) - i), g = Math.max(1, Math.ceil((s.y + s.height) * r.d + r.f) - d), l = { x: (i - r.e) / r.a, y: (d - r.f) / r.d, width: n / r.a, height: g / r.d };
334
+ if (n > this._options.maxTextureSize || g > this._options.maxTextureSize)
335
+ throw new RangeError("[Nova2D lighting] Source exceeds maxTextureSize; use a smaller lighting region");
336
+ (this._source.width !== n || this._source.height !== g) && (this._source.width = n, this._source.height = g), this._sourceContext.clearRect(0, 0, n, g), this._sourceContext.drawImage(e.canvas, i, d, n, g, 0, 0, n, g);
337
+ const f = this.render(this._source, n, g, { ...t, bounds: l });
338
+ return f ? (e.save(), e.globalAlpha = 1, e.globalCompositeOperation = "source-over", e.filter = "none", e.shadowColor = "transparent", e.beginPath(), e.rect(l.x, l.y, l.width, l.height), e.clip(), e.clearRect(l.x, l.y, l.width, l.height), e.drawImage(f, l.x, l.y, l.width, l.height), e.restore(), !0) : !1;
339
+ }
340
+ _releaseGPU() {
341
+ const e = this._gl;
342
+ for (const t of this._textures)
343
+ e.deleteTexture(t);
344
+ for (const t of this._programs)
345
+ e.deleteProgram(t);
346
+ for (const t of this._shaders)
347
+ e.deleteShader(t);
348
+ this._framebuffer && e.deleteFramebuffer(this._framebuffer), this._textures = [], this._programs = [], this._shaders = [], this._framebuffer = void 0, this._uniforms.clear();
349
+ }
350
+ get available() {
351
+ return !this._disposed && !this._lost && !this._gl.isContextLost();
352
+ }
353
+ get state() {
354
+ return { available: this.available, generation: this._generation, renders: this._renders, textures: this._textures.length, programs: this._programs.length, shaders: this._shaders.length, framebuffers: this._framebuffer ? 1 : 0, receiverMasks: this._receiverMasks.size, ownedCanvases: this._disposed ? 0 : 3 + this._receiverMasks.size };
355
+ }
356
+ dispose() {
357
+ if (!this._disposed) {
358
+ this._disposed = !0, this._lifetime.abort(), this._releaseGPU();
359
+ for (const e of this._receiverMasks.values())
360
+ e.width = e.height = 0;
361
+ this._receiverMasks.clear(), this._lastOccluders = [];
362
+ for (const e of [this.canvas, this._field, this._source])
363
+ e.width = e.height = 0;
364
+ this._gl.getExtension("WEBGL_lose_context")?.loseContext();
365
+ }
366
+ }
367
+ }
368
+ class O {
369
+ _lights = /* @__PURE__ */ new Set();
370
+ _occluders = /* @__PURE__ */ new Set();
371
+ _receivers = /* @__PURE__ */ new Set();
372
+ _renderer;
373
+ _options;
374
+ _receiverRevision = 0;
375
+ _revision = 0;
376
+ _disposed = !1;
377
+ _ambient;
378
+ constructor(e = {}) {
379
+ this._options = {
380
+ groundScale: u(e.groundScale ?? 1, "groundScale", 0.01, 10),
381
+ maxHeight: u(e.maxHeight ?? 1024, "maxHeight", 1),
382
+ resolution: u(e.resolution ?? 0.5, "resolution", 0.01, 1),
383
+ maxTextureSize: u(e.maxTextureSize ?? 768, "maxTextureSize", 64, 2048),
384
+ ambient: this._ambientValue(e.ambient ?? [1, 1, 1])
385
+ }, this._ambient = this._options.ambient, this._renderer = new F(this._options);
386
+ }
387
+ _alive() {
388
+ if (this._disposed)
389
+ throw new Error("[Nova2D lighting] Scene is disposed");
390
+ }
391
+ _ambientValue(e) {
392
+ if (e.length !== 3)
393
+ throw new TypeError("[Nova2D lighting] Ambient needs three linear RGB channels");
394
+ return Object.freeze(e.map((t) => u(t, "ambient", 0, 4)));
395
+ }
396
+ setAmbient(e) {
397
+ this._alive(), this._ambient = this._ambientValue(e), this._revision++;
398
+ }
399
+ _handle(e, t, r, s, i = !1) {
400
+ this._alive();
401
+ const d = { value: t };
402
+ e.add(d);
403
+ const n = () => {
404
+ this._revision++, i && this._receiverRevision++;
405
+ };
406
+ n();
407
+ const g = () => {
408
+ if (this._alive(), !e.has(d))
409
+ throw new Error("[Nova2D lighting] Handle is disposed");
410
+ };
411
+ return Object.freeze({
412
+ set: (l) => {
413
+ g(), d.value = r(d.value, l), n();
414
+ },
415
+ getOptions: () => (g(), s(d.value)),
416
+ dispose: () => {
417
+ e.delete(d) && n();
418
+ }
419
+ });
420
+ }
421
+ _light(e, t) {
422
+ if (this._alive(), this._lights.size >= 8)
423
+ throw new RangeError("[Nova2D lighting] Limit is 8 retained lights per lighting scene");
424
+ return this._handle(this._lights, M(e, t), (r, s) => M(e, {
425
+ ...r.options,
426
+ ...s,
427
+ shadows: { ...r.options.shadows, ...s.shadows }
428
+ }), (r) => r.options);
429
+ }
430
+ createDirectionalLight(e) {
431
+ return this._light("directional", e);
432
+ }
433
+ createPointLight(e) {
434
+ return this._light("point", e);
435
+ }
436
+ createSpotLight(e) {
437
+ return this._light("spot", e);
438
+ }
439
+ createOccluder(e) {
440
+ if (this._alive(), this._occluders.size >= 4096)
441
+ throw new RangeError("[Nova2D lighting] Limit is 4096 retained occluders per lighting scene");
442
+ return this._handle(this._occluders, D(e, this._options.maxHeight), (t, r) => D({ ...t, ...r }, this._options.maxHeight), (t) => t);
443
+ }
444
+ createReceiver(e) {
445
+ if (this._alive(), this._receivers.size >= 4096)
446
+ throw new RangeError("[Nova2D lighting] Limit is 4096 retained receivers per lighting scene");
447
+ return this._handle(this._receivers, S(e, this._options.maxHeight), (t, r) => S({ ...t, ...r }, this._options.maxHeight), (t) => t, !0);
448
+ }
449
+ _frame(e) {
450
+ this._alive();
451
+ const t = [...this._lights].map((s) => s.value).filter((s) => s.options.enabled && s.options.intensity > 0), r = [...this._occluders].map((s) => s.value).filter((s) => {
452
+ if (!s.enabled)
453
+ return !1;
454
+ const i = s.polygon.map((h) => h[0]), d = s.polygon.map((h) => h[1]), n = Math.min(...i), g = Math.max(...i), l = Math.min(...d), f = Math.max(...d);
455
+ return t.some((h) => {
456
+ if (!h.options.shadows.enabled || !(h.options.layers & s.layers))
457
+ return !1;
458
+ if (h.kind === "directional")
459
+ return !0;
460
+ const [a, c, _] = h.position, p = Math.max(n - a, 0, a - g), m = Math.max(l - c, 0, c - f), v = Math.max(s.baseHeight - _, 0, _ - s.baseHeight - s.height);
461
+ return p * p + m * m + v * v <= (h.range + h.radius) ** 2;
462
+ });
463
+ });
464
+ if (r.length > 64)
465
+ throw new RangeError("[Nova2D lighting] More than 64 occluders intersect the active shadow lights; split the lighting region");
466
+ return {
467
+ bounds: C(e.bounds),
468
+ ambient: this._ambient,
469
+ receiverRevision: this._receiverRevision,
470
+ lights: t,
471
+ occluders: r,
472
+ receivers: [...this._receivers].map((s) => s.value).filter((s) => s.enabled).sort((s, i) => (s.order ?? s.bounds.y + s.bounds.height) - (i.order ?? i.bounds.y + i.bounds.height))
473
+ };
474
+ }
475
+ render(e, t) {
476
+ const r = this._frame(t), s = e, i = u(s.naturalWidth || s.videoWidth || (typeof s.width == "number" ? s.width : r.bounds.width), "source width", 1, this._options.maxTextureSize), d = u(s.naturalHeight || s.videoHeight || (typeof s.height == "number" ? s.height : r.bounds.height), "source height", 1, this._options.maxTextureSize);
477
+ return this._renderer.render(e, i, d, r);
478
+ }
479
+ apply(e, t) {
480
+ return this._renderer.apply(e, this._frame(t));
481
+ }
482
+ get state() {
483
+ return { disposed: this._disposed, revision: this._revision, lights: this._lights.size, occluders: this._occluders.size, receivers: this._receivers.size, ambient: this._ambient, ...this._renderer.state };
484
+ }
485
+ dispose() {
486
+ this._disposed || (this._disposed = !0, this._lights.clear(), this._occluders.clear(), this._receivers.clear(), this._renderer.dispose());
487
+ }
488
+ }
489
+ function U(o = {}) {
490
+ return new O(o);
491
+ }
492
+ export {
493
+ O as NovaLighting2D,
494
+ U as createLighting2D
495
+ };
@@ -0,0 +1,3 @@
1
+ export { NovaLottiePreparationError } from '../model/lottie/lottie.types.js';
2
+ export type { NovaLottieDefinition, NovaLottieOptions, NovaLottieProps } from '../model/lottie/lottie.types.js';
3
+ export { prepareLottie } from '../model/lottie/prepare-lottie.js';