@nova-lab/core 1.0.0-dev.19 → 1.1.0-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.
- package/README.md +1035 -10
- package/THIRD_PARTY_NOTICES.md +26 -0
- package/dist/2d/accessibility.d.ts +2 -0
- package/dist/2d/accessibility.js +171 -0
- package/dist/2d/commands.d.ts +2 -0
- package/dist/2d/commands.js +80 -0
- package/dist/2d/effects.d.ts +10 -0
- package/dist/2d/effects.js +566 -0
- package/dist/2d/ktx2.d.ts +5 -0
- package/dist/2d/ktx2.js +542 -0
- package/dist/2d/lighting.d.ts +3 -0
- package/dist/2d/lighting.js +495 -0
- package/dist/2d/lottie.d.ts +3 -0
- package/dist/2d/lottie.js +254 -0
- package/dist/2d/meshes.d.ts +4 -0
- package/dist/2d/meshes.js +451 -0
- package/dist/2d/primitives.d.ts +3 -0
- package/dist/2d/primitives.js +85 -0
- package/dist/2d/render-textures.d.ts +3 -0
- package/dist/2d/render-textures.js +539 -0
- package/dist/2d/svg/documents.d.ts +5 -0
- package/dist/2d/svg/documents.js +7 -0
- package/dist/2d/svg/renderer.d.ts +3 -0
- package/dist/2d/svg/renderer.js +222 -0
- package/dist/2d/svg.d.ts +3 -0
- package/dist/2d/svg.js +4 -0
- package/dist/2d/tools.d.ts +2 -0
- package/dist/2d/tools.js +100 -0
- package/dist/2d/video.d.ts +5 -0
- package/dist/2d/video.js +90 -0
- package/dist/2d.d.ts +2 -0
- package/dist/2d.js +220 -0
- package/dist/3d/animation.d.ts +8 -0
- package/dist/3d/animation.js +1396 -0
- package/dist/3d/area-lights.d.ts +2 -0
- package/dist/3d/area-lights.js +19 -0
- package/dist/3d/audio.d.ts +4 -0
- package/dist/3d/audio.js +500 -0
- package/dist/3d/character.d.ts +2 -0
- package/dist/3d/character.js +136 -0
- package/dist/3d/collision.d.ts +3 -0
- package/dist/3d/collision.js +387 -0
- package/dist/3d/commands.d.ts +2 -0
- package/dist/3d/commands.js +108 -0
- package/dist/3d/controls.d.ts +8 -0
- package/dist/3d/controls.js +1041 -0
- package/dist/3d/documents.d.ts +5 -0
- package/dist/3d/documents.js +227 -0
- package/dist/3d/effects.d.ts +5 -0
- package/dist/3d/effects.js +1986 -0
- package/dist/3d/export.d.ts +4 -0
- package/dist/3d/export.js +347 -0
- package/dist/3d/fbx.d.ts +2 -0
- package/dist/3d/fbx.js +784 -0
- package/dist/3d/gltf.d.ts +2 -0
- package/dist/3d/gltf.js +5 -0
- package/dist/3d/helpers.d.ts +5 -0
- package/dist/3d/helpers.js +191 -0
- package/dist/3d/ik.d.ts +9 -0
- package/dist/3d/ik.js +777 -0
- package/dist/3d/loaders.d.ts +17 -0
- package/dist/3d/loaders.js +1406 -0
- package/dist/3d/nodes.d.ts +8 -0
- package/dist/3d/nodes.js +49 -0
- package/dist/3d/particles.d.ts +5 -0
- package/dist/3d/particles.js +1574 -0
- package/dist/3d/physics/backend.d.ts +7 -0
- package/dist/3d/physics/backend.js +1 -0
- package/dist/3d/physics/rapier.d.ts +3 -0
- package/dist/3d/physics/rapier.js +765 -0
- package/dist/3d/physics.d.ts +5 -0
- package/dist/3d/physics.js +3346 -0
- package/dist/3d/splats.d.ts +7 -0
- package/dist/3d/splats.js +862 -0
- package/dist/3d/text.d.ts +5 -0
- package/dist/3d/text.js +1043 -0
- package/dist/3d/tiles.d.ts +24 -0
- package/dist/3d/tiles.js +1705 -0
- package/dist/3d/tools.d.ts +12 -0
- package/dist/3d/tools.js +338 -0
- package/dist/3d/usdz.d.ts +2 -0
- package/dist/3d/usdz.js +634 -0
- package/dist/3d/xr.d.ts +2 -0
- package/dist/3d/xr.js +202 -0
- package/dist/3d-B4jWF8Qb.js +5591 -0
- package/dist/3d.d.ts +40 -0
- package/dist/3d.js +44 -0
- package/dist/Capsule-BFVpZfvc.js +44 -0
- package/dist/Clip-CAN7t03k.js +204 -0
- package/dist/Color-vuv9UnoY.js +34 -0
- package/dist/DeformedMesh-CPi0P_vc.js +280 -0
- package/dist/Document-DCVEZSvM.js +415 -0
- package/dist/Errors-B2ekO9bZ.js +30 -0
- package/dist/Features-BsjmePtc.js +557 -0
- package/dist/GLTFResourceIO-CYJyCUTt.js +124 -0
- package/dist/GPUParticleState-CQlNpoDa.js +545 -0
- package/dist/Geometry-DytO490z.js +227 -0
- package/dist/Inflate-DWw0V-Up.js +42 -0
- package/dist/InstancedMesh-DPrgrw5z.js +527 -0
- package/dist/Limits-Bw5XQdFr.js +20 -0
- package/dist/LineHelper-Ad0z9uDi.js +131 -0
- package/dist/LoaderIO-BwrM84OM.js +114 -0
- package/dist/Material-BpfLPmK9.js +777 -0
- package/dist/Mesh-BaRxAAJq.js +209 -0
- package/dist/Node-QfgAE2_v.js +877 -0
- package/dist/NovaAssetRegistry-p2QlCwvT.js +1168 -0
- package/dist/NovaNode-CBZ-Ol-W.js +2016 -0
- package/dist/NovaRenderCommandWriter-CWQRa42y.js +1949 -0
- package/dist/NovaTextSelectionService-CipuujCT.js +18526 -0
- package/dist/NovaWebGLProgram-BO250QNF.js +97 -0
- package/dist/Options-CajE7LLJ.js +15 -0
- package/dist/PolygonMesh-D4PnnfIo.js +657 -0
- package/dist/Ready-BzyhRtjD.js +21 -0
- package/dist/Scene-CDfNgf9I.js +911 -0
- package/dist/Shader-b6_HDndT.js +48 -0
- package/dist/SplatShader-wJ6GJ3vo.js +130 -0
- package/dist/Texture-dTKMlTpK.js +267 -0
- package/dist/TextureLoader-CfDzdy2m.js +411 -0
- package/dist/Textures-CGL4Kf-8.js +651 -0
- package/dist/ToneMapping-D9IWvN0u.js +46 -0
- package/dist/WebGPURenderer-DjD0IxVC.js +4921 -0
- package/dist/ZipReader-C-MSEsSr.js +84 -0
- package/dist/core.js +218 -24024
- package/dist/domain/types/base.types.d.ts +18 -9
- package/dist/domain/types/component.types.d.ts +5 -5
- package/dist/domain/types/cursor.types.d.ts +1 -1
- package/dist/domain/types/diagnostics.types.d.ts +2 -0
- package/dist/domain/types/export.types.d.ts +2 -2
- package/dist/domain/types/hit-test.types.d.ts +1 -1
- package/dist/domain/types/motion.types.d.ts +2 -2
- package/dist/domain/types/renderer.types.d.ts +88 -4
- package/dist/domain/types/rendering/index.d.ts +29 -4
- package/dist/domain/types/sound.types.d.ts +1 -1
- package/dist/domain/types/theme.types.d.ts +1 -1
- package/dist/domain/utils/bounds.d.ts +1 -1
- package/dist/domain/utils/nova-text.d.ts +9 -0
- package/dist/domain/utils/schemaBounds.d.ts +2 -2
- package/dist/export-svg-document-ChaNXMaG.js +668 -0
- package/dist/features/3d/Errors.d.ts +57 -0
- package/dist/features/3d/Nova3DApp.d.ts +429 -0
- package/dist/features/3d/animation/Animator.d.ts +260 -0
- package/dist/features/3d/animation/Clip.d.ts +74 -0
- package/dist/features/3d/animation/Graph.d.ts +158 -0
- package/dist/features/3d/animation/Mask.d.ts +40 -0
- package/dist/features/3d/audio/Audio.d.ts +114 -0
- package/dist/features/3d/audio/Sound.d.ts +133 -0
- package/dist/features/3d/character/CharacterController.d.ts +61 -0
- package/dist/features/3d/collision/Capsule.d.ts +25 -0
- package/dist/features/3d/collision/Octree.d.ts +94 -0
- package/dist/features/3d/controls/CameraMotionControls.d.ts +154 -0
- package/dist/features/3d/controls/CameraOrientation.d.ts +47 -0
- package/dist/features/3d/controls/OrbitControls.d.ts +73 -0
- package/dist/features/3d/controls/PointerGesture.d.ts +25 -0
- package/dist/features/3d/controls/PointerLock.d.ts +36 -0
- package/dist/features/3d/controls/Snapping.d.ts +32 -0
- package/dist/features/3d/controls/TransformGizmo.d.ts +79 -0
- package/dist/features/3d/deformation/DeformationGPU.d.ts +52 -0
- package/dist/features/3d/deformation/DeformationShader.d.ts +2 -0
- package/dist/features/3d/deformation/DeformedMesh.d.ts +36 -0
- package/dist/features/3d/deformation/GeometryDeformation.d.ts +25 -0
- package/dist/features/3d/documents/Document.d.ts +59 -0
- package/dist/features/3d/documents/DocumentCommands.d.ts +45 -0
- package/dist/features/3d/documents/DocumentSchema.d.ts +18 -0
- package/dist/features/3d/documents/DocumentTransform.d.ts +4 -0
- package/dist/features/3d/documents/DocumentTypes.d.ts +182 -0
- package/dist/features/3d/documents/DocumentValidation.d.ts +18 -0
- package/dist/features/3d/documents/Projection.d.ts +65 -0
- package/dist/features/3d/effects/CubeLUT.d.ts +24 -0
- package/dist/features/3d/effects/Effects.d.ts +32 -0
- package/dist/features/3d/effects/EffectsGPU.d.ts +80 -0
- package/dist/features/3d/effects/EffectsPlan.d.ts +268 -0
- package/dist/features/3d/effects/EffectsShaders.d.ts +35 -0
- package/dist/features/3d/export/GLTFExporter.d.ts +49 -0
- package/dist/features/3d/export/ThreeMFExporter.d.ts +19 -0
- package/dist/features/3d/export/ZipWriter.d.ts +9 -0
- package/dist/features/3d/fbx/FBXLoader.d.ts +26 -0
- package/dist/features/3d/fbx/FBXParser.d.ts +35 -0
- package/dist/features/3d/fbx/FBXScene.d.ts +20 -0
- package/dist/features/3d/gltf/GLTFLoader.d.ts +16 -0
- package/dist/features/3d/gltf/GLTFTypes.d.ts +64 -0
- package/dist/features/3d/gltf/services/GLTFBinary.d.ts +21 -0
- package/dist/features/3d/gltf/services/GLTFGeometry.d.ts +14 -0
- package/dist/features/3d/gltf/services/GLTFResourceIO.d.ts +64 -0
- package/dist/features/3d/helpers/LineHelper.d.ts +51 -0
- package/dist/features/3d/helpers/StaticHelpers.d.ts +47 -0
- package/dist/features/3d/helpers/TrackedHelpers.d.ts +84 -0
- package/dist/features/3d/ik/ChainIK.d.ts +44 -0
- package/dist/features/3d/ik/IKChain.d.ts +92 -0
- package/dist/features/3d/ik/IKMath.d.ts +49 -0
- package/dist/features/3d/ik/IKSolver.d.ts +97 -0
- package/dist/features/3d/ik/LookAtIK.d.ts +58 -0
- package/dist/features/3d/ik/TwoBoneIK.d.ts +57 -0
- package/dist/features/3d/import/ImportAnimation.d.ts +20 -0
- package/dist/features/3d/import/ImportMath.d.ts +42 -0
- package/dist/features/3d/import/ImportedModel.d.ts +135 -0
- package/dist/features/3d/import/Inflate.d.ts +5 -0
- package/dist/features/3d/import/ModelAsset.d.ts +149 -0
- package/dist/features/3d/import/PolygonMesh.d.ts +54 -0
- package/dist/features/3d/lights/AreaLightTables.d.ts +8 -0
- package/dist/features/3d/lights/AreaLights.d.ts +11 -0
- package/dist/features/3d/loaders/EXRCompression.d.ts +13 -0
- package/dist/features/3d/loaders/EXRLoader.d.ts +39 -0
- package/dist/features/3d/loaders/HDRLoader.d.ts +26 -0
- package/dist/features/3d/loaders/Limits.d.ts +70 -0
- package/dist/features/3d/loaders/LoaderBuffers.d.ts +42 -0
- package/dist/features/3d/loaders/LoaderIO.d.ts +81 -0
- package/dist/features/3d/loaders/LoaderModel.d.ts +80 -0
- package/dist/features/3d/loaders/LoaderText.d.ts +27 -0
- package/dist/features/3d/loaders/MTLLoader.d.ts +105 -0
- package/dist/features/3d/loaders/OBJLoader.d.ts +70 -0
- package/dist/features/3d/loaders/PLYLoader.d.ts +47 -0
- package/dist/features/3d/loaders/STLLoader.d.ts +27 -0
- package/dist/features/3d/model/Camera.d.ts +33 -0
- package/dist/features/3d/model/Environment.d.ts +31 -0
- package/dist/features/3d/model/Geometry.d.ts +59 -0
- package/dist/features/3d/model/InstancedMesh.d.ts +134 -0
- package/dist/features/3d/model/LOD.d.ts +31 -0
- package/dist/features/3d/model/Light.d.ts +200 -0
- package/dist/features/3d/model/Material.d.ts +308 -0
- package/dist/features/3d/model/MaterialExtensions.d.ts +200 -0
- package/dist/features/3d/model/Mesh.d.ts +92 -0
- package/dist/features/3d/model/Node.d.ts +87 -0
- package/dist/features/3d/model/ReflectionProbe.d.ts +45 -0
- package/dist/features/3d/model/RenderTarget.d.ts +41 -0
- package/dist/features/3d/model/Scene.d.ts +173 -0
- package/dist/features/3d/model/Texture.d.ts +143 -0
- package/dist/features/3d/nodes/Nodes.d.ts +8 -0
- package/dist/features/3d/nodes/ShaderNode.d.ts +240 -0
- package/dist/features/3d/particles/GPUParticleSchedule.d.ts +67 -0
- package/dist/features/3d/particles/GPUParticleShaders.d.ts +19 -0
- package/dist/features/3d/particles/GPUParticleState.d.ts +106 -0
- package/dist/features/3d/particles/GPUParticleSystem.d.ts +192 -0
- package/dist/features/3d/particles/ParticleCurves.d.ts +34 -0
- package/dist/features/3d/particles/ParticleOptions.d.ts +78 -0
- package/dist/features/3d/particles/ParticleSystem.d.ts +368 -0
- package/dist/features/3d/physics/PhysicsBackend.d.ts +352 -0
- package/dist/features/3d/physics/PhysicsDebug.d.ts +24 -0
- package/dist/features/3d/physics/PhysicsWorld.d.ts +352 -0
- package/dist/features/3d/physics/basic/BasicCollision.d.ts +75 -0
- package/dist/features/3d/physics/basic/BasicPhysics.d.ts +24 -0
- package/dist/features/3d/physics/basic/BasicShapes.d.ts +103 -0
- package/dist/features/3d/physics/rapier/ContactBuffer.d.ts +32 -0
- package/dist/features/3d/physics/rapier/RapierBackend.d.ts +17 -0
- package/dist/features/3d/physics/rapier/RapierShapes.d.ts +4 -0
- package/dist/features/3d/physics/rapier/RapierWorld.d.ts +198 -0
- package/dist/features/3d/physics/rapier/Validation.d.ts +8 -0
- package/dist/features/3d/services/Background.d.ts +22 -0
- package/dist/features/3d/services/BasicShader.d.ts +55 -0
- package/dist/features/3d/services/ClusteredLights.d.ts +69 -0
- package/dist/features/3d/services/DrawOrder.d.ts +37 -0
- package/dist/features/3d/services/EffectsProcessor.d.ts +38 -0
- package/dist/features/3d/services/EnvironmentBRDF.d.ts +35 -0
- package/dist/features/3d/services/EnvironmentMaps.d.ts +55 -0
- package/dist/features/3d/services/FogShader.d.ts +6 -0
- package/dist/features/3d/services/Frustum.d.ts +7 -0
- package/dist/features/3d/services/GLState.d.ts +86 -0
- package/dist/features/3d/services/GPUPicker.d.ts +31 -0
- package/dist/features/3d/services/InstanceShader.d.ts +3 -0
- package/dist/features/3d/services/LineProgram.d.ts +32 -0
- package/dist/features/3d/services/PBRProgram.d.ts +115 -0
- package/dist/features/3d/services/Renderer.d.ts +50 -0
- package/dist/features/3d/services/Shader.d.ts +22 -0
- package/dist/features/3d/services/ShaderProgram.d.ts +38 -0
- package/dist/features/3d/services/ShadowMaps.d.ts +97 -0
- package/dist/features/3d/services/SpatialIndex.d.ts +16 -0
- package/dist/features/3d/services/TextureLoader.d.ts +40 -0
- package/dist/features/3d/services/TextureMipmaps.d.ts +42 -0
- package/dist/features/3d/services/ToneMapping.d.ts +12 -0
- package/dist/features/3d/services/WebGLRenderer.d.ts +261 -0
- package/dist/features/3d/splats/SplatData.d.ts +136 -0
- package/dist/features/3d/splats/SplatLoaders.d.ts +64 -0
- package/dist/features/3d/splats/SplatShader.d.ts +14 -0
- package/dist/features/3d/splats/SplatSort.d.ts +69 -0
- package/dist/features/3d/splats/Splats.d.ts +116 -0
- package/dist/features/3d/text/FontAtlas.d.ts +246 -0
- package/dist/features/3d/text/SDF.d.ts +28 -0
- package/dist/features/3d/text/Text.d.ts +179 -0
- package/dist/features/3d/text/TextLayout.d.ts +73 -0
- package/dist/features/3d/text/TextShader.d.ts +12 -0
- package/dist/features/3d/tiles/BoundingVolume.d.ts +43 -0
- package/dist/features/3d/tiles/Geodesy.d.ts +106 -0
- package/dist/features/3d/tiles/GlobeControls.d.ts +147 -0
- package/dist/features/3d/tiles/TileContent.d.ts +35 -0
- package/dist/features/3d/tiles/TileFormats.d.ts +77 -0
- package/dist/features/3d/tiles/Tiles3D.d.ts +236 -0
- package/dist/features/3d/tiles/Tileset.d.ts +81 -0
- package/dist/features/3d/tools/BatchedMesh.d.ts +74 -0
- package/dist/features/3d/tools/CanvasSurface.d.ts +81 -0
- package/dist/features/3d/tools/Color.d.ts +11 -0
- package/dist/features/3d/tools/MergeGeometries.d.ts +22 -0
- package/dist/features/3d/tools/Options.d.ts +15 -0
- package/dist/features/3d/tools/Polyhedra.d.ts +30 -0
- package/dist/features/3d/tools/PrimitiveBuffers.d.ts +42 -0
- package/dist/features/3d/tools/Primitives.d.ts +164 -0
- package/dist/features/3d/tools/Ready.d.ts +12 -0
- package/dist/features/3d/tools/SpatialMath.d.ts +57 -0
- package/dist/features/3d/tools/SphericalHarmonics.d.ts +9 -0
- package/dist/features/3d/tools/math/mat3.d.ts +7 -0
- package/dist/features/3d/tools/math/mat4.d.ts +19 -0
- package/dist/features/3d/tools/math/quat.d.ts +6 -0
- package/dist/features/3d/tools/math/vec3.d.ts +16 -0
- package/dist/features/3d/tools/math/vec4.d.ts +5 -0
- package/dist/features/3d/types.d.ts +359 -0
- package/dist/features/3d/usdz/USDAParser.d.ts +50 -0
- package/dist/features/3d/usdz/USDScene.d.ts +20 -0
- package/dist/features/3d/usdz/USDZLoader.d.ts +27 -0
- package/dist/features/3d/usdz/ZipReader.d.ts +16 -0
- package/dist/features/3d/webgpu/Backend.d.ts +40 -0
- package/dist/features/3d/webgpu/BasicShader.d.ts +10 -0
- package/dist/features/3d/webgpu/Constants.d.ts +32 -0
- package/dist/features/3d/webgpu/Deformation.d.ts +71 -0
- package/dist/features/3d/webgpu/Environment.d.ts +66 -0
- package/dist/features/3d/webgpu/Features.d.ts +68 -0
- package/dist/features/3d/webgpu/Layouts.d.ts +27 -0
- package/dist/features/3d/webgpu/Lines.d.ts +40 -0
- package/dist/features/3d/webgpu/LitExtras.d.ts +46 -0
- package/dist/features/3d/webgpu/LitFeatures.d.ts +41 -0
- package/dist/features/3d/webgpu/LitScene.d.ts +60 -0
- package/dist/features/3d/webgpu/LitShader.d.ts +68 -0
- package/dist/features/3d/webgpu/Particles.d.ts +114 -0
- package/dist/features/3d/webgpu/Picking.d.ts +59 -0
- package/dist/features/3d/webgpu/PipelineKey.d.ts +33 -0
- package/dist/features/3d/webgpu/Points.d.ts +41 -0
- package/dist/features/3d/webgpu/Probes.d.ts +45 -0
- package/dist/features/3d/webgpu/ShaderChunks.d.ts +18 -0
- package/dist/features/3d/webgpu/ShaderMaterial.d.ts +57 -0
- package/dist/features/3d/webgpu/ShaderMaterialSource.d.ts +5 -0
- package/dist/features/3d/webgpu/Shadows.d.ts +49 -0
- package/dist/features/3d/webgpu/Splats.d.ts +47 -0
- package/dist/features/3d/webgpu/Textures.d.ts +52 -0
- package/dist/features/3d/webgpu/Transmission.d.ts +30 -0
- package/dist/features/3d/webgpu/UniformLayout.d.ts +30 -0
- package/dist/features/3d/webgpu/UtilityShaders.d.ts +38 -0
- package/dist/features/3d/webgpu/WebGPURenderer.d.ts +327 -0
- package/dist/features/3d/webgpu/effects/EffectsShaders.d.ts +74 -0
- package/dist/features/3d/webgpu/effects/WebGPUEffects.d.ts +140 -0
- package/dist/features/3d/xr/XR.d.ts +100 -0
- package/dist/gltf-By-n0qEg.js +960 -0
- package/dist/index.d.ts +86 -81
- package/dist/model/document-actions/document-commands.d.ts +18 -0
- package/dist/model/documents/svg/create-svg-document-renderer.d.ts +32 -0
- package/dist/model/documents/svg/export-svg-document.d.ts +5 -0
- package/dist/model/documents/svg/import-svg-document.d.ts +6 -0
- package/dist/model/documents/svg/svg-document.types.d.ts +111 -0
- package/dist/model/documents/svg/svg-values.d.ts +16 -0
- package/dist/model/documents/svg/svg-xml.d.ts +18 -0
- package/dist/model/input/NovaInputProxy_Adapter.d.ts +2 -1
- package/dist/model/input/NovaInputValidationController.d.ts +1 -1
- package/dist/model/input/NovaTextInputController.d.ts +1 -1
- package/dist/model/input/NovaTextLayoutEngine.d.ts +2 -6
- package/dist/model/input/index.d.ts +7 -7
- package/dist/model/input/nova-input.types.d.ts +1 -1
- package/dist/model/lighting/LightingRenderer2D.d.ts +58 -0
- package/dist/model/lighting/NovaLighting2D.d.ts +56 -0
- package/dist/model/lighting/lighting-shaders.d.ts +3 -0
- package/dist/model/lighting/lighting-state.d.ts +27 -0
- package/dist/model/lighting/lighting.types.d.ts +107 -0
- package/dist/model/lottie/LottieNode.d.ts +4 -0
- package/dist/model/lottie/lottie.types.d.ts +83 -0
- package/dist/model/lottie/prepare-lottie.d.ts +3 -0
- package/dist/model/lottie/sample-position.d.ts +9 -0
- package/dist/model/motion/NovaMotionEngine.d.ts +3 -3
- package/dist/model/motion/nova-motion-easing.d.ts +1 -1
- package/dist/model/motion/nova-motion-interpolation.d.ts +1 -1
- package/dist/model/motion/nova-motion-presets.d.ts +2 -2
- package/dist/model/motion/nova-motion-timeline.d.ts +1 -1
- package/dist/model/platform/NovaCanvas.d.ts +7 -6
- package/dist/model/primitives/NovaPrimitiveUnsupportedError.d.ts +13 -0
- package/dist/model/primitives/definePrimitive.d.ts +5 -0
- package/dist/model/primitives/primitive.types.d.ts +28 -0
- package/dist/model/render/backends/canvas2d/NovaCanvas2DTargetManager.d.ts +3 -3
- package/dist/model/render/backends/canvas2d/NovaRenderer2D.d.ts +61 -15
- package/dist/model/render/backends/canvas2d/nova-canvas-blend.d.ts +5 -0
- package/dist/model/render/backends/nova-render-backend-factory.d.ts +6 -6
- package/dist/model/render/backends/nova-render-backend.d.ts +8 -2
- package/dist/model/render/backends/webgl/NovaRendererWebGL.d.ts +32 -11
- package/dist/model/render/backends/webgl/NovaStreamCacheIdleLedger.d.ts +12 -1
- package/dist/model/render/backends/webgl/NovaWebGLBatcher.d.ts +1 -1
- package/dist/model/render/backends/webgl/NovaWebGLCircleImagePass.d.ts +23 -0
- package/dist/model/render/backends/webgl/NovaWebGLCompositionPass.d.ts +9 -0
- package/dist/model/render/backends/webgl/NovaWebGLDevice.d.ts +3 -1
- package/dist/model/render/backends/webgl/NovaWebGLDiagnostics.d.ts +1 -1
- package/dist/model/render/backends/webgl/NovaWebGLFrameRenderer.d.ts +162 -53
- package/dist/model/render/backends/webgl/NovaWebGLPathClipPass.d.ts +13 -0
- package/dist/model/render/backends/webgl/NovaWebGLPathUnion.d.ts +23 -0
- package/dist/model/render/compiler/NovaRenderBuilder.d.ts +24 -10
- package/dist/model/render/compiler/NovaRenderCommandWriter.d.ts +10 -5
- package/dist/model/render/compiler/NovaRenderCompiler.d.ts +7 -6
- package/dist/model/render/compiler/NovaRenderFrameBuilder.d.ts +4 -3
- package/dist/model/render/effects/blur.d.ts +8 -0
- package/dist/model/render/effects/color-matrix.d.ts +8 -0
- package/dist/model/render/effects/drop-shadow.d.ts +18 -0
- package/dist/model/render/effects/nova-effect-registry.d.ts +66 -0
- package/dist/model/render/effects/nova-gaussian-kernel.d.ts +7 -0
- package/dist/model/render/effects/nova-gaussian-textures.d.ts +11 -0
- package/dist/model/render/effects/shader-effect.d.ts +64 -0
- package/dist/model/render/geometry/nova-alpha-mask.d.ts +5 -0
- package/dist/model/render/geometry/nova-composition.d.ts +9 -0
- package/dist/model/render/geometry/nova-node-clip.d.ts +17 -0
- package/dist/model/render/geometry/nova-path-geometry.d.ts +24 -0
- package/dist/model/render/geometry/nova-path-tessellation.d.ts +7 -0
- package/dist/model/render/geometry/nova-polygon-triangulation.d.ts +1 -1
- package/dist/model/render/graph/NovaRectBatchBuffer.d.ts +58 -0
- package/dist/model/render/graph/NovaRenderGraph.d.ts +40 -6
- package/dist/model/render/graph/NovaRenderHitIndex.d.ts +1 -1
- package/dist/model/render/graph/nova-auto-rect.d.ts +1 -1
- package/dist/model/render/graph/nova-linear-rect-repack.d.ts +4 -4
- package/dist/model/render/graph/nova-linear-rect-transition.d.ts +2 -2
- package/dist/model/render/graph/nova-render-culling.d.ts +2 -2
- package/dist/model/render/graph/nova-render-dirty-items.d.ts +1 -1
- package/dist/model/render/graph/nova-render-group.d.ts +1 -1
- package/dist/model/render/graph/nova-render-item.d.ts +2 -2
- package/dist/model/render/graph/nova-render-layer.d.ts +1 -1
- package/dist/model/render/graph/nova-render-payload-snapshot.d.ts +3 -1
- package/dist/model/render/graph/nova-render-program.d.ts +5 -3
- package/dist/model/render/graph/nova-render-sequence.d.ts +1 -1
- package/dist/model/render/graph/nova-render-stream.d.ts +2 -2
- package/dist/model/render/ktx2/BasisSession.d.ts +45 -0
- package/dist/model/render/ktx2/KTX2Container.d.ts +26 -0
- package/dist/model/render/ktx2/KTX2Loader.d.ts +55 -0
- package/dist/model/render/meshes/MeshNode.d.ts +13 -0
- package/dist/model/render/meshes/NovaMeshWebGLDevice.d.ts +27 -0
- package/dist/model/render/meshes/geometry.d.ts +7 -0
- package/dist/model/render/meshes/mesh.d.ts +3 -0
- package/dist/model/render/meshes/mesh.types.d.ts +116 -0
- package/dist/model/render/meshes/nova-mesh-registry.d.ts +55 -0
- package/dist/model/render/orchestration/NovaRenderOrchestrator.d.ts +25 -3
- package/dist/model/render/policy/nova-render-policy.d.ts +1 -1
- package/dist/model/render/resources/NovaGlyphAtlasManager.d.ts +2 -2
- package/dist/model/render/resources/NovaTextAtlasManager.d.ts +3 -3
- package/dist/model/render/resources/NovaTextLayoutEngine.d.ts +1 -1
- package/dist/model/render/resources/nova-bitmap-upload.d.ts +10 -0
- package/dist/model/render/schema/NovaRenderContext.d.ts +6 -4
- package/dist/model/render/schema/nova-style-compiler.d.ts +5 -2
- package/dist/model/render/targets/NovaNodeRenderTextureSource.d.ts +29 -0
- package/dist/model/render/targets/NovaRenderTargetManager.d.ts +1 -1
- package/dist/model/render/targets/NovaRenderTexture.d.ts +57 -0
- package/dist/model/render/targets/nova-render-target-refs.d.ts +5 -0
- package/dist/model/render/targets/nova-render-target-resource.d.ts +1 -1
- package/dist/model/render/targets/nova-render-texture-runtime.d.ts +71 -0
- package/dist/model/render/textures/nova-compressed-image.d.ts +20 -0
- package/dist/model/render/utils/nova-icon-rendering.d.ts +3 -1
- package/dist/model/render/utils/nova-image-geometry.d.ts +11 -0
- package/dist/model/render/utils/nova-markdown-layout.d.ts +19 -0
- package/dist/model/render/utils/nova-text-paint.d.ts +26 -0
- package/dist/model/render/utils/nova-wrapped-text-layout.d.ts +19 -0
- package/dist/model/runtime/app/Nova.d.ts +35 -35
- package/dist/model/runtime/app/NovaApp.d.ts +58 -30
- package/dist/model/runtime/app/NovaRaphRuntime.d.ts +2 -2
- package/dist/model/runtime/app/createNovaRaphRuntime.d.ts +3 -3
- package/dist/model/runtime/assets/NovaAssetRegistry.d.ts +89 -2
- package/dist/model/runtime/assets/NovaVideoTexture.d.ts +38 -0
- package/dist/model/runtime/assets/nova-render-texture-image-identity.d.ts +4 -0
- package/dist/model/runtime/commands/NovaCommandBus.d.ts +1 -1
- package/dist/model/runtime/components/NovaComponentNode.d.ts +6 -6
- package/dist/model/runtime/components/NovaComponentRegistry.d.ts +1 -1
- package/dist/model/runtime/components/NovaSchemaRegistry.d.ts +7 -6
- package/dist/model/runtime/components/nova-component-metadata.d.ts +1 -1
- package/dist/model/runtime/components/nova-component.decorator.d.ts +2 -2
- package/dist/model/runtime/components/nova-defined-component.d.ts +3 -3
- package/dist/model/runtime/context/nova-context.d.ts +1 -1
- package/dist/model/runtime/cursor/NovaCursorManager.d.ts +3 -3
- package/dist/model/runtime/diagnostics/NovaDiagnostics_Module.d.ts +3 -3
- package/dist/model/runtime/interaction/NovaEvents.d.ts +16 -6
- package/dist/model/runtime/interaction/NovaHitIndex.d.ts +1 -1
- package/dist/model/runtime/interaction/NovaSpatialIndex.d.ts +2 -2
- package/dist/model/runtime/scene/NovaScene.d.ts +3 -3
- package/dist/model/runtime/scene/nova-scene-components.d.ts +6 -6
- package/dist/model/runtime/state/nova-store-decorators.d.ts +1 -1
- package/dist/model/runtime/state/nova-store-runtime.d.ts +1 -1
- package/dist/model/runtime/state/nova-store-tracking.d.ts +7 -3
- package/dist/model/runtime/sync/NovaSyncScope.d.ts +11 -2
- package/dist/model/runtime/sync/nova-sync-context.d.ts +2 -2
- package/dist/model/runtime/sync/nova-sync-ports.d.ts +2 -2
- package/dist/model/runtime/sync/nova-sync.types.d.ts +15 -3
- package/dist/model/runtime/template/NovaTemplateRuntime.d.ts +6 -6
- package/dist/model/runtime/tree/NovaContainer.d.ts +4 -4
- package/dist/model/runtime/tree/NovaNode.d.ts +58 -18
- package/dist/model/runtime/tree/NovaRaphNode.d.ts +8 -2
- package/dist/model/runtime/tree/NovaSurface.d.ts +32 -10
- package/dist/model/runtime/tree/nova-node-capture-invalidation.d.ts +11 -0
- package/dist/model/semantic/NovaSemanticService.d.ts +1 -1
- package/dist/model/semantic/browser/createAccessibilityBridge.d.ts +29 -0
- package/dist/model/sound/NovaSoundEngine.d.ts +3 -2
- package/dist/model/text-selection/NovaTextSelectionService.d.ts +2 -2
- package/dist/model/text-selection/index.d.ts +2 -2
- package/dist/model/text-selection/nova-text-selection.types.d.ts +1 -1
- package/dist/model/theme/NovaGlobalThemeRegistry.d.ts +2 -2
- package/dist/model/theme/NovaThemeService.d.ts +5 -3
- package/dist/model/theme/createTokenTheme.d.ts +15 -0
- package/dist/model/tools/transform-tools.d.ts +43 -0
- package/dist/nodes--Ds4IS2h.js +621 -0
- package/dist/nova-color-parser-BCN_rFRN.js +250 -0
- package/dist/nova-compressed-image-CE2Ya9Xa.js +46 -0
- package/dist/nova-mesh-registry-B7Xz5mhU.js +24 -0
- package/dist/nova-render-texture-image-identity-DQ09XFKs.js +15 -0
- package/dist/nova-text-paint-CcntsRjI.js +48 -0
- package/dist/tokens.d.ts +2 -0
- package/dist/tokens.js +50 -0
- package/dist/vec4-BTNv1fUp.js +20 -0
- package/package.json +223 -4
|
@@ -0,0 +1,2016 @@
|
|
|
1
|
+
import { mat3 as G } from "gl-matrix";
|
|
2
|
+
import { d as W, s as F, e as O, u as le, p as $, E as L, h as de, g as fe, i as pe, a as T, j as ye, t as V, k as me, c as _e, l as ve } from "./nova-color-parser-BCN_rFRN.js";
|
|
3
|
+
import { getPathBounds as X, isPath as U, definePath as ge, containsPathPoint as xe, containsStrokeContoursPoint as Re, flattenPath as ne, getStrokeContours as Se, getContourBounds as be, getStrokeOutline as ke, createFlattenCache as we } from "@typedworks/geometry";
|
|
4
|
+
import { RaphNode as Me } from "@raphy-js/raph/runtime";
|
|
5
|
+
const z = {
|
|
6
|
+
Before: "before",
|
|
7
|
+
PreUpdate: "preupdate",
|
|
8
|
+
Update: "update",
|
|
9
|
+
Matrix: "matrix",
|
|
10
|
+
Render: "render",
|
|
11
|
+
Flush: "flush",
|
|
12
|
+
After: "after"
|
|
13
|
+
};
|
|
14
|
+
function Ce(r, e) {
|
|
15
|
+
let t = O(), s = !1;
|
|
16
|
+
for (const i of r) {
|
|
17
|
+
if (i.active === !1)
|
|
18
|
+
continue;
|
|
19
|
+
const n = ae(i, e);
|
|
20
|
+
n && (t = s ? le(t, n) : W(t, n), s = !0);
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
}
|
|
24
|
+
function ae(r, e) {
|
|
25
|
+
switch (r.type) {
|
|
26
|
+
case "rect":
|
|
27
|
+
case "border":
|
|
28
|
+
case "text":
|
|
29
|
+
case "icon":
|
|
30
|
+
case "nine-slice-image":
|
|
31
|
+
case "pattern-rect":
|
|
32
|
+
return F(O(), r.x, r.y, r.width, r.height);
|
|
33
|
+
case "circle":
|
|
34
|
+
return F(O(), r.x - r.radius, r.y - r.radius, r.radius * 2, r.radius * 2);
|
|
35
|
+
case "arc": {
|
|
36
|
+
const t = r.styles?.width ?? 1, s = r.radius * 2 + t;
|
|
37
|
+
return F(O(), r.x - r.radius - t / 2, r.y - r.radius - t / 2, s, s);
|
|
38
|
+
}
|
|
39
|
+
case "line":
|
|
40
|
+
return Be(r.x1, r.y1, r.x2, r.y2, r.styles?.width ?? 1);
|
|
41
|
+
case "path":
|
|
42
|
+
return Oe(r);
|
|
43
|
+
case "polygon":
|
|
44
|
+
return De(r.points, r.styles?.lineWidth ?? 0);
|
|
45
|
+
default:
|
|
46
|
+
return e?.resolve(r.type)?.measureBounds?.({ registry: e, depth: 0 }, r) ?? null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function Be(r, e, t, s, i) {
|
|
50
|
+
const n = i / 2, a = Math.min(r, t) - n, o = Math.min(e, s) - n, c = Math.max(r, t) + n, h = Math.max(e, s) + n;
|
|
51
|
+
return F(O(), a, o, c - a, h - o);
|
|
52
|
+
}
|
|
53
|
+
function De(r, e) {
|
|
54
|
+
if (r.length === 0)
|
|
55
|
+
return null;
|
|
56
|
+
let t = r[0].x, s = r[0].y, i = r[0].x, n = r[0].y;
|
|
57
|
+
for (let o = 1; o < r.length; o++) {
|
|
58
|
+
const c = r[o];
|
|
59
|
+
t = Math.min(t, c.x), s = Math.min(s, c.y), i = Math.max(i, c.x), n = Math.max(n, c.y);
|
|
60
|
+
}
|
|
61
|
+
const a = e / 2;
|
|
62
|
+
return F(O(), t - a, s - a, i - t + a * 2, n - s + a * 2);
|
|
63
|
+
}
|
|
64
|
+
function Oe(r) {
|
|
65
|
+
const e = X(r.path), t = r.styles?.stroke, s = t?.width ?? 1, i = t ? s / 2 * (t.lineJoin === "miter" || t.lineJoin === void 0 ? t.miterLimit ?? 10 : Math.SQRT2) : 0;
|
|
66
|
+
return { x: e.x - i, y: e.y - i, width: e.width + 2 * i, height: e.height + 2 * i };
|
|
67
|
+
}
|
|
68
|
+
function Pe(r) {
|
|
69
|
+
if ("path" in r) {
|
|
70
|
+
if (!U(r.path) || r.fillRule !== void 0 && r.fillRule !== "nonzero" && r.fillRule !== "evenodd")
|
|
71
|
+
throw new TypeError("[Nova] Clip requires an immutable Path and a supported fill rule");
|
|
72
|
+
return Object.freeze({ path: r.path, fillRule: r.fillRule ?? "nonzero" });
|
|
73
|
+
}
|
|
74
|
+
if (![r.x, r.y, r.width, r.height].every(Number.isFinite) || r.width < 0 || r.height < 0)
|
|
75
|
+
throw new RangeError("[Nova] Clip bounds must be finite and nonnegative");
|
|
76
|
+
return Object.freeze({ x: r.x, y: r.y, width: r.width, height: r.height });
|
|
77
|
+
}
|
|
78
|
+
function rt(r) {
|
|
79
|
+
return X(r.path) ?? { x: 0, y: 0, width: 0, height: 0 };
|
|
80
|
+
}
|
|
81
|
+
function st(r) {
|
|
82
|
+
return [`nova:path-clip:${r}:color`, `nova:path-clip:${r}:mask`, `nova:path-clip:${r}:backdrop`];
|
|
83
|
+
}
|
|
84
|
+
const K = /* @__PURE__ */ new WeakMap();
|
|
85
|
+
function Ee(r) {
|
|
86
|
+
let e = K.get(r);
|
|
87
|
+
return e || (e = ge((t) => t.moveTo(r.x, r.y).lineTo(r.x + r.width, r.y).lineTo(r.x + r.width, r.y + r.height).lineTo(r.x, r.y + r.height).closePath()), K.set(r, e)), e;
|
|
88
|
+
}
|
|
89
|
+
function J(r, e) {
|
|
90
|
+
const t = [], s = /* @__PURE__ */ new Set();
|
|
91
|
+
for (const d of r) {
|
|
92
|
+
const u = d.points;
|
|
93
|
+
for (let y = 0; y < u.length; y++) {
|
|
94
|
+
const f = u[y], x = u[(y + 1) % u.length];
|
|
95
|
+
f.y !== x.y && (t.push({ a: f, b: x, minimum: Math.min(f.y, x.y), maximum: Math.max(f.y, x.y), winding: x.y > f.y ? 1 : -1 }), s.add(f.y), s.add(x.y));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
t.sort((d, u) => d.minimum - u.minimum);
|
|
99
|
+
let i = 0;
|
|
100
|
+
for (let d = 0; d < t.length; d++) {
|
|
101
|
+
const u = t[d];
|
|
102
|
+
for (let y = d + 1; y < t.length && t[y].minimum < u.maximum; y++) {
|
|
103
|
+
if (++i > 2e6)
|
|
104
|
+
throw new RangeError("[Nova] Path intersection budget exceeded");
|
|
105
|
+
const f = t[y];
|
|
106
|
+
if (Math.max(u.a.x, u.b.x) < Math.min(f.a.x, f.b.x) || Math.max(f.a.x, f.b.x) < Math.min(u.a.x, u.b.x))
|
|
107
|
+
continue;
|
|
108
|
+
const x = u.b.x - u.a.x, R = u.b.y - u.a.y, k = f.b.x - f.a.x, S = f.b.y - f.a.y, g = x * S - R * k;
|
|
109
|
+
if (g === 0)
|
|
110
|
+
continue;
|
|
111
|
+
const b = f.a.x - u.a.x, P = f.a.y - u.a.y, D = (b * S - P * k) / g, M = (b * R - P * x) / g;
|
|
112
|
+
D > 0 && D < 1 && M > 0 && M < 1 && s.add(u.a.y + D * R);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const n = [...s].sort((d, u) => d - u), a = [];
|
|
116
|
+
let o = [], c = 0, h = /* @__PURE__ */ new Map();
|
|
117
|
+
const l = (d, u) => {
|
|
118
|
+
const y = d.a.y < d.b.y ? d.a : d.b, f = d.a.y < d.b.y ? d.b : d.a;
|
|
119
|
+
return u === y.y ? y.x : u === f.y ? f.x : y.x + (f.x - y.x) * ((u - y.y) / (f.y - y.y));
|
|
120
|
+
};
|
|
121
|
+
for (let d = 1; d < n.length; d++) {
|
|
122
|
+
const u = n[d - 1], y = n[d], f = u + (y - u) / 2;
|
|
123
|
+
for (; c < t.length && t[c].minimum <= u; )
|
|
124
|
+
o.push(t[c++]);
|
|
125
|
+
o = o.filter((S) => S.maximum > u), o.sort((S, g) => l(S, f) - l(g, f));
|
|
126
|
+
const x = /* @__PURE__ */ new Map();
|
|
127
|
+
let R = 0, k;
|
|
128
|
+
for (let S = 0; S < o.length; S++) {
|
|
129
|
+
const g = o[S], b = l(g, f), P = e === "evenodd" ? Math.abs(R) % 2 !== 0 : R !== 0;
|
|
130
|
+
for (R += g.winding; S + 1 < o.length && l(o[S + 1], f) === b; )
|
|
131
|
+
R += o[++S].winding;
|
|
132
|
+
const D = e === "evenodd" ? Math.abs(R) % 2 !== 0 : R !== 0;
|
|
133
|
+
if (P === D)
|
|
134
|
+
continue;
|
|
135
|
+
if (D) {
|
|
136
|
+
k = g;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (!k || l(g, f) <= l(k, f))
|
|
140
|
+
continue;
|
|
141
|
+
let M = h.get(k);
|
|
142
|
+
if (M?.right === g && M.bottom === u)
|
|
143
|
+
M.bottom = y;
|
|
144
|
+
else if (M = { left: k, right: g, top: u, bottom: y }, a.push(M), a.length * 6 > 3e6)
|
|
145
|
+
throw new RangeError("[Nova] Path triangle budget exceeded");
|
|
146
|
+
x.set(k, M);
|
|
147
|
+
}
|
|
148
|
+
h = x;
|
|
149
|
+
}
|
|
150
|
+
const m = /* @__PURE__ */ new Map();
|
|
151
|
+
for (const d of a)
|
|
152
|
+
for (const u of [d.top, d.bottom]) {
|
|
153
|
+
let y = m.get(u);
|
|
154
|
+
y || (y = /* @__PURE__ */ new Set(), m.set(u, y)), y.add(l(d.left, u)), y.add(l(d.right, u));
|
|
155
|
+
}
|
|
156
|
+
const _ = new Map([...m].map(([d, u]) => [d, [...u].sort((y, f) => y - f)])), v = [], w = (d, u, y, f, x, R) => {
|
|
157
|
+
if (v.push(d, u, y, f, x, R), v.length > 3e6)
|
|
158
|
+
throw new RangeError("[Nova] Path triangle budget exceeded");
|
|
159
|
+
};
|
|
160
|
+
for (const { left: d, right: u, top: y, bottom: f } of a) {
|
|
161
|
+
const x = l(d, y), R = l(d, f), k = l(u, y), S = l(u, f), g = _.get(y), b = _.get(f), P = j(g, x, !1), D = j(g, k, !0) - 1, M = j(b, R, !1), ue = j(b, S, !0) - 1;
|
|
162
|
+
for (let B = P; B < D; B++)
|
|
163
|
+
w(g[B], y, g[B + 1], y, R, f);
|
|
164
|
+
for (let B = M; B < ue; B++)
|
|
165
|
+
w(k, y, b[B + 1], f, b[B], f);
|
|
166
|
+
}
|
|
167
|
+
return Object.freeze(v);
|
|
168
|
+
}
|
|
169
|
+
function j(r, e, t) {
|
|
170
|
+
let s = 0, i = r.length;
|
|
171
|
+
for (; s < i; ) {
|
|
172
|
+
const n = s + Math.floor((i - s) / 2);
|
|
173
|
+
r[n] < e || t && r[n] === e ? s = n + 1 : i = n;
|
|
174
|
+
}
|
|
175
|
+
return s;
|
|
176
|
+
}
|
|
177
|
+
const Fe = /* @__PURE__ */ new WeakMap();
|
|
178
|
+
function it() {
|
|
179
|
+
return { prepared: /* @__PURE__ */ new WeakMap(), flatten: we() };
|
|
180
|
+
}
|
|
181
|
+
const Ie = [1, 0, 0, 1, 0, 0];
|
|
182
|
+
function oe(r) {
|
|
183
|
+
return r ? [r[0], r[1], r[3], r[4], r[6], r[7]] : Ie;
|
|
184
|
+
}
|
|
185
|
+
function Ae(r, e, t, s, i) {
|
|
186
|
+
const n = ke(r, e, { tolerance: t, transform: s, cache: i });
|
|
187
|
+
return ne(n, { tolerance: t, cache: i });
|
|
188
|
+
}
|
|
189
|
+
function Ve(r, e, t = 1, s) {
|
|
190
|
+
const i = oe(e);
|
|
191
|
+
if (!Number.isFinite(t) || t <= 0 || i.some((b) => !Number.isFinite(b)))
|
|
192
|
+
throw new RangeError("[Nova] Path transform and DPR must be finite");
|
|
193
|
+
if (r.fillRule !== void 0 && !["nonzero", "evenodd"].includes(r.fillRule))
|
|
194
|
+
throw new RangeError("[Nova] Invalid path fill rule");
|
|
195
|
+
const n = Math.hypot(i[0], i[1], i[2], i[3]), a = 2 ** Math.floor(Math.log2(0.25 / Math.max(n * t, 1e-12))), o = r.styles?.stroke, c = o?.widthUnits === "screen", h = c ? [i[0], i[1], i[2], i[3], 0, 0] : void 0, l = [a, r.fillRule ?? "nonzero", !!r.styles?.fill, o?.width ?? 1, o?.lineCap ?? "butt", o?.lineJoin ?? "miter", o?.miterLimit ?? 10, o?.dashOffset ?? 0, o?.dashPattern?.join(","), !!o, h?.join(","), c ? t : ""].join("|"), m = s?.prepared ?? Fe, _ = s?.flatten, v = U(r.path) ? m.get(r.path) : void 0, w = v?.get(l);
|
|
196
|
+
if (w)
|
|
197
|
+
return w;
|
|
198
|
+
const d = r.styles?.fill ? ne(r.path, { tolerance: a, cache: _ }) : [], u = c ? 0.25 / t : a, y = o ? Ae(r.path, o, u, h, _) : [], f = r.fillRule ?? "nonzero";
|
|
199
|
+
let x, R, k, S;
|
|
200
|
+
const g = Object.freeze({
|
|
201
|
+
fillContours: d,
|
|
202
|
+
strokeOutlineContours: y,
|
|
203
|
+
get fillBounds() {
|
|
204
|
+
return k ??= X(r.path);
|
|
205
|
+
},
|
|
206
|
+
get strokeBounds() {
|
|
207
|
+
return o ? S ??= be(y) : void 0;
|
|
208
|
+
},
|
|
209
|
+
get fill() {
|
|
210
|
+
return x ??= J(d, f);
|
|
211
|
+
},
|
|
212
|
+
get stroke() {
|
|
213
|
+
return R ??= J(y, "nonzero");
|
|
214
|
+
},
|
|
215
|
+
strokeContours: o ? Se(r.path, o, { tolerance: u, transform: h, cache: _ }) : [],
|
|
216
|
+
strokeInScreenSpace: !!c,
|
|
217
|
+
tolerance: a
|
|
218
|
+
});
|
|
219
|
+
if (U(r.path)) {
|
|
220
|
+
const b = v ?? /* @__PURE__ */ new Map();
|
|
221
|
+
b.size >= 8 && b.delete(b.keys().next().value), b.set(l, g), m.set(r.path, b);
|
|
222
|
+
}
|
|
223
|
+
return g;
|
|
224
|
+
}
|
|
225
|
+
function je(r, e, t, s = 1) {
|
|
226
|
+
if (r.active === !1 || (r.styles?.opacity ?? 1) <= 0)
|
|
227
|
+
return !1;
|
|
228
|
+
const [i, n, a, o, c, h] = oe(t), l = i * o - n * a, m = l === 0 ? void 0 : { x: (o * (e.x - c) - a * (e.y - h)) / l, y: (i * (e.y - h) - n * (e.x - c)) / l };
|
|
229
|
+
if (r.clip && r.clip !== !0 && (!m || m.x < r.clip.x || m.y < r.clip.y || m.x > r.clip.x + r.clip.width || m.y > r.clip.y + r.clip.height))
|
|
230
|
+
return !1;
|
|
231
|
+
const _ = Ve(r, t, s);
|
|
232
|
+
if (m && r.styles?.fill && $(r.styles.fill).a > 0 && xe(r.path, m, r.fillRule ?? "nonzero", { tolerance: _.tolerance }))
|
|
233
|
+
return !0;
|
|
234
|
+
const v = r.styles?.stroke, w = _.strokeInScreenSpace ? { x: e.x - c, y: e.y - h } : m;
|
|
235
|
+
return !!v && !!w && $(v.color).a > 0 && Re(_.strokeContours, w, v);
|
|
236
|
+
}
|
|
237
|
+
const Ne = Object.freeze({
|
|
238
|
+
group: "auto",
|
|
239
|
+
cache: "auto",
|
|
240
|
+
textQuality: "auto",
|
|
241
|
+
updateMode: "dynamic",
|
|
242
|
+
topologyInvariant: !1,
|
|
243
|
+
layer: "auto"
|
|
244
|
+
}), Q = Object.freeze({
|
|
245
|
+
batching: Object.freeze({
|
|
246
|
+
maxBatchSize: 8192,
|
|
247
|
+
semanticScopes: "safe",
|
|
248
|
+
maxDrawCallsWarning: 1e3,
|
|
249
|
+
plainRectStream: !0,
|
|
250
|
+
roundedRectStream: !0,
|
|
251
|
+
fullUploadDirtyRatio: 0.6
|
|
252
|
+
}),
|
|
253
|
+
text: Object.freeze({
|
|
254
|
+
quality: "balanced",
|
|
255
|
+
mode: "auto",
|
|
256
|
+
modes: Object.freeze({
|
|
257
|
+
timeScale: "run-atlas",
|
|
258
|
+
taskLabels: "run-atlas",
|
|
259
|
+
uiLabels: "run-atlas"
|
|
260
|
+
}),
|
|
261
|
+
interaction: Object.freeze({
|
|
262
|
+
mode: "balanced",
|
|
263
|
+
idleMs: 120,
|
|
264
|
+
rasterBudgetMs: 2,
|
|
265
|
+
maxRasterScale: 3,
|
|
266
|
+
freezeBuckets: !0,
|
|
267
|
+
prewarm: !1
|
|
268
|
+
}),
|
|
269
|
+
lod: Object.freeze({
|
|
270
|
+
enabled: !0,
|
|
271
|
+
minScreenWidthPx: 8,
|
|
272
|
+
minScreenHeightPx: 8,
|
|
273
|
+
maxVisibleRuns: 1e4,
|
|
274
|
+
hysteresisPx: 4
|
|
275
|
+
}),
|
|
276
|
+
glyphs: Object.freeze({
|
|
277
|
+
retainedBatches: !0,
|
|
278
|
+
shapeCacheEntries: 2e4,
|
|
279
|
+
runCacheEntries: 1e4
|
|
280
|
+
}),
|
|
281
|
+
sdf: Object.freeze({
|
|
282
|
+
enabled: !0,
|
|
283
|
+
pxRange: 8,
|
|
284
|
+
source: "runtime-sdf",
|
|
285
|
+
minPaddingPx: 2,
|
|
286
|
+
edgeSoftness: 1
|
|
287
|
+
}),
|
|
288
|
+
maxAtlasMemoryMB: 128,
|
|
289
|
+
maxGlyphAtlasMemoryMB: 64,
|
|
290
|
+
zoomBuckets: Object.freeze([0.5, 0.75, 1, 1.5, 2, 3, 4]),
|
|
291
|
+
dynamicBuckets: !0,
|
|
292
|
+
prewarmAdjacentBuckets: !0,
|
|
293
|
+
rasterBudgetMs: 4,
|
|
294
|
+
bucketThrottleMs: 80,
|
|
295
|
+
visibleOnlyRaster: !0,
|
|
296
|
+
fallbackPreviousScale: !0,
|
|
297
|
+
tightRunAtlas: !0,
|
|
298
|
+
minRasterScale: 1,
|
|
299
|
+
maxRasterScale: 8
|
|
300
|
+
}),
|
|
301
|
+
cache: Object.freeze({
|
|
302
|
+
maxRenderTextureBackingBytes: 64 * 1024 * 1024,
|
|
303
|
+
maxTextureMemoryMB: 256,
|
|
304
|
+
maxTextAtlasMemoryMB: 128,
|
|
305
|
+
maxGlyphAtlasMemoryMB: 64,
|
|
306
|
+
groupCache: "auto",
|
|
307
|
+
geometryWarmIdleMs: 0,
|
|
308
|
+
maxGeometryWarmMemoryMB: 128,
|
|
309
|
+
maxPathGeometryMemoryMB: 16
|
|
310
|
+
}),
|
|
311
|
+
diagnostics: Object.freeze({
|
|
312
|
+
showBatches: !1,
|
|
313
|
+
showDirtyRegions: !1,
|
|
314
|
+
showAtlas: !1
|
|
315
|
+
})
|
|
316
|
+
});
|
|
317
|
+
function Z(r = {}) {
|
|
318
|
+
return {
|
|
319
|
+
...Ne,
|
|
320
|
+
...r
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function nt(r = {}, e = Q) {
|
|
324
|
+
const t = r.cache?.maxRenderTextureBackingBytes ?? e.cache.maxRenderTextureBackingBytes ?? 67108864;
|
|
325
|
+
if (!Number.isSafeInteger(t) || t < 0)
|
|
326
|
+
throw new RangeError("[Nova] Invalid cache.maxRenderTextureBackingBytes");
|
|
327
|
+
for (const a of ["geometryWarmIdleMs", "maxGeometryWarmMemoryMB", "maxPathGeometryMemoryMB", "maxTextureMemoryMB", "maxTextAtlasMemoryMB", "maxGlyphAtlasMemoryMB"]) {
|
|
328
|
+
const o = r.cache?.[a];
|
|
329
|
+
if (o !== void 0 && (!Number.isFinite(o) || o < 0))
|
|
330
|
+
throw new RangeError(`[Nova] Invalid cache.${a}`);
|
|
331
|
+
}
|
|
332
|
+
for (const a of ["maxAtlasMemoryMB", "maxGlyphAtlasMemoryMB", "rasterBudgetMs"]) {
|
|
333
|
+
const o = r.text?.[a];
|
|
334
|
+
if (o !== void 0 && (!Number.isFinite(o) || o < 0))
|
|
335
|
+
throw new RangeError(`[Nova] Invalid text.${a}`);
|
|
336
|
+
}
|
|
337
|
+
if (r.batching?.maxBatchSize !== void 0 && (!Number.isFinite(r.batching.maxBatchSize) || r.batching.maxBatchSize < 1))
|
|
338
|
+
throw new RangeError("[Nova] Invalid batching.maxBatchSize");
|
|
339
|
+
const s = r.text?.maxAtlasMemoryMB ?? r.cache?.maxTextAtlasMemoryMB ?? e.text.maxAtlasMemoryMB, i = r.text?.maxGlyphAtlasMemoryMB ?? r.cache?.maxGlyphAtlasMemoryMB ?? e.text.maxGlyphAtlasMemoryMB, n = {
|
|
340
|
+
batching: {
|
|
341
|
+
...e.batching,
|
|
342
|
+
...r.batching
|
|
343
|
+
},
|
|
344
|
+
text: {
|
|
345
|
+
...e.text,
|
|
346
|
+
...r.text,
|
|
347
|
+
maxAtlasMemoryMB: s,
|
|
348
|
+
maxGlyphAtlasMemoryMB: i,
|
|
349
|
+
modes: {
|
|
350
|
+
...e.text.modes,
|
|
351
|
+
...r.text?.modes
|
|
352
|
+
},
|
|
353
|
+
interaction: {
|
|
354
|
+
...e.text.interaction,
|
|
355
|
+
...r.text?.interaction
|
|
356
|
+
},
|
|
357
|
+
lod: {
|
|
358
|
+
...e.text.lod,
|
|
359
|
+
...r.text?.lod
|
|
360
|
+
},
|
|
361
|
+
glyphs: {
|
|
362
|
+
...e.text.glyphs,
|
|
363
|
+
...r.text?.glyphs
|
|
364
|
+
},
|
|
365
|
+
sdf: {
|
|
366
|
+
...e.text.sdf,
|
|
367
|
+
...r.text?.sdf
|
|
368
|
+
},
|
|
369
|
+
zoomBuckets: [...r.text?.zoomBuckets ?? e.text.zoomBuckets]
|
|
370
|
+
},
|
|
371
|
+
cache: {
|
|
372
|
+
...e.cache,
|
|
373
|
+
...r.cache,
|
|
374
|
+
maxRenderTextureBackingBytes: t,
|
|
375
|
+
maxTextAtlasMemoryMB: s,
|
|
376
|
+
maxGlyphAtlasMemoryMB: i
|
|
377
|
+
},
|
|
378
|
+
diagnostics: {
|
|
379
|
+
...e.diagnostics,
|
|
380
|
+
...r.diagnostics
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
return e !== Q && Y(n, e) ? e : n;
|
|
384
|
+
}
|
|
385
|
+
function Le(r, e) {
|
|
386
|
+
const t = Te(r.zoomBuckets);
|
|
387
|
+
if (r.quality === "performance" || !r.dynamicBuckets)
|
|
388
|
+
return t.includes(1) ? 1 : t[0];
|
|
389
|
+
const s = Math.max(0.01, Number.isFinite(e) ? e : 1);
|
|
390
|
+
let i = t[0], n = Math.abs(s - i);
|
|
391
|
+
for (const a of t) {
|
|
392
|
+
const o = Math.abs(s - a);
|
|
393
|
+
o < n && (i = a, n = o);
|
|
394
|
+
}
|
|
395
|
+
return i;
|
|
396
|
+
}
|
|
397
|
+
function at(r, e, t) {
|
|
398
|
+
const i = Math.max(0.1, Number.isFinite(t) ? t : 1) * Le(r, e), n = Math.max(0.1, Number.isFinite(r.minRasterScale) ? r.minRasterScale : 1), a = Math.max(0.1, Number.isFinite(r.maxRasterScale) ? r.maxRasterScale : i);
|
|
399
|
+
return Math.min(a, Math.max(n, i));
|
|
400
|
+
}
|
|
401
|
+
function Te(r) {
|
|
402
|
+
const e = r.filter((t) => Number.isFinite(t) && t > 0).sort((t, s) => t - s);
|
|
403
|
+
return e.length > 0 ? e : [1];
|
|
404
|
+
}
|
|
405
|
+
function ee() {
|
|
406
|
+
return {
|
|
407
|
+
transform: !1,
|
|
408
|
+
layout: !1,
|
|
409
|
+
paint: !1,
|
|
410
|
+
children: !1,
|
|
411
|
+
resource: !1,
|
|
412
|
+
cache: !1,
|
|
413
|
+
visibility: !1
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
function ot() {
|
|
417
|
+
return {
|
|
418
|
+
transform: !0,
|
|
419
|
+
layout: !0,
|
|
420
|
+
paint: !0,
|
|
421
|
+
children: !0,
|
|
422
|
+
resource: !0,
|
|
423
|
+
cache: !0,
|
|
424
|
+
visibility: !0
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function ze(r = 0) {
|
|
428
|
+
return {
|
|
429
|
+
transform: r,
|
|
430
|
+
layout: r,
|
|
431
|
+
paint: r,
|
|
432
|
+
children: r,
|
|
433
|
+
resource: r,
|
|
434
|
+
cache: r,
|
|
435
|
+
visibility: r
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
function He(r, e) {
|
|
439
|
+
for (const t of Object.keys(e))
|
|
440
|
+
r[t] = r[t] || e[t] === !0;
|
|
441
|
+
return r;
|
|
442
|
+
}
|
|
443
|
+
function Ge(r, e) {
|
|
444
|
+
for (const t of Object.keys(e))
|
|
445
|
+
e[t] && (r[t] += 1);
|
|
446
|
+
return r;
|
|
447
|
+
}
|
|
448
|
+
function Y(r, e) {
|
|
449
|
+
if (Object.is(r, e))
|
|
450
|
+
return !0;
|
|
451
|
+
if (!r || !e || typeof r != "object" || typeof e != "object")
|
|
452
|
+
return !1;
|
|
453
|
+
if (Array.isArray(r) || Array.isArray(e))
|
|
454
|
+
return Array.isArray(r) && Array.isArray(e) && r.length === e.length && r.every((s, i) => Y(s, e[i]));
|
|
455
|
+
if (Object.getPrototypeOf(r) !== Object.prototype || Object.getPrototypeOf(e) !== Object.prototype)
|
|
456
|
+
return !1;
|
|
457
|
+
const t = Object.keys(r);
|
|
458
|
+
return t.length === Object.keys(e).length && t.every((s) => Object.hasOwn(e, s) && Y(r[s], e[s]));
|
|
459
|
+
}
|
|
460
|
+
const q = Symbol("nova.store.metadata");
|
|
461
|
+
function ht(r = {}) {
|
|
462
|
+
return (e) => (ce(e, (t) => ({
|
|
463
|
+
...t,
|
|
464
|
+
options: r
|
|
465
|
+
})), e);
|
|
466
|
+
}
|
|
467
|
+
function ct(r = {}) {
|
|
468
|
+
return (...e) => {
|
|
469
|
+
if (We(e)) {
|
|
470
|
+
const [i, n] = e;
|
|
471
|
+
return n.addInitializer?.(function() {
|
|
472
|
+
te(re(this), n.name, r);
|
|
473
|
+
}), i;
|
|
474
|
+
}
|
|
475
|
+
const [t, s] = e;
|
|
476
|
+
return te(re(t), s, r), e[2];
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
function he(r) {
|
|
480
|
+
return r[q];
|
|
481
|
+
}
|
|
482
|
+
function ut(r) {
|
|
483
|
+
return !r || typeof r != "object" ? !1 : !!he(r.constructor)?.reactiveFields.length;
|
|
484
|
+
}
|
|
485
|
+
function lt(r) {
|
|
486
|
+
return r[q]?.options ?? {};
|
|
487
|
+
}
|
|
488
|
+
function te(r, e, t) {
|
|
489
|
+
ce(r, (s) => {
|
|
490
|
+
const i = s.reactiveFields.filter((n) => n.key !== e);
|
|
491
|
+
return i.push({ key: e, options: t }), { ...s, reactiveFields: i };
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function ce(r, e) {
|
|
495
|
+
const t = he(r) ?? { reactiveFields: [] };
|
|
496
|
+
r[q] = e(t);
|
|
497
|
+
}
|
|
498
|
+
function re(r) {
|
|
499
|
+
return r.constructor;
|
|
500
|
+
}
|
|
501
|
+
function We(r) {
|
|
502
|
+
return r.length === 2 && r[1] && typeof r[1] == "object" && "kind" in r[1] && r[1].kind === "accessor";
|
|
503
|
+
}
|
|
504
|
+
function Ue(r, e) {
|
|
505
|
+
const t = r ?? e ?? "update";
|
|
506
|
+
return (Array.isArray(t) ? t : [t]).filter((i) => i === "update" || i === "matrix" || i === "render");
|
|
507
|
+
}
|
|
508
|
+
const A = [];
|
|
509
|
+
function dt(r) {
|
|
510
|
+
return A.at(-1)?.node.nova === r;
|
|
511
|
+
}
|
|
512
|
+
function se(r, e, t) {
|
|
513
|
+
A.push({
|
|
514
|
+
node: r,
|
|
515
|
+
defaultPhase: e,
|
|
516
|
+
sink: t,
|
|
517
|
+
reads: /* @__PURE__ */ new Map(),
|
|
518
|
+
touchedPhases: /* @__PURE__ */ new Set([e])
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function ie() {
|
|
522
|
+
const r = A.pop();
|
|
523
|
+
r && (Ye(r.reads), r.sink ? r.sink(r.node, r.reads) : r.node.syncReactiveStoreReads(r.reads, r.touchedPhases));
|
|
524
|
+
}
|
|
525
|
+
function ft(r, e) {
|
|
526
|
+
const t = A[A.length - 1];
|
|
527
|
+
if (!t)
|
|
528
|
+
return;
|
|
529
|
+
const s = Ue(e, t.defaultPhase);
|
|
530
|
+
for (const i of s) {
|
|
531
|
+
t.touchedPhases.add(i);
|
|
532
|
+
let n = t.reads.get(i);
|
|
533
|
+
n || (n = /* @__PURE__ */ new Set(), t.reads.set(i, n)), n.add(String(r));
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
function Ye(r) {
|
|
537
|
+
for (const e of r.values())
|
|
538
|
+
for (const t of [...e]) {
|
|
539
|
+
if (!t.endsWith(".*"))
|
|
540
|
+
continue;
|
|
541
|
+
const s = t.slice(0, -1);
|
|
542
|
+
[...e].some((n) => n !== t && n.startsWith(s)) && e.delete(t);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
const I = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap();
|
|
546
|
+
function pt(r, e, t) {
|
|
547
|
+
let s = I.get(r);
|
|
548
|
+
s || (s = { own: /* @__PURE__ */ new Set(), subtree: /* @__PURE__ */ new Set(), bounds: /* @__PURE__ */ new Set() }, I.set(r, s));
|
|
549
|
+
const i = e === "bounds" ? s.bounds : e ? s.subtree : s.own;
|
|
550
|
+
i.add(t);
|
|
551
|
+
const n = r.nova;
|
|
552
|
+
E.set(n, (E.get(n) ?? 0) + 1);
|
|
553
|
+
let a = !0;
|
|
554
|
+
return () => {
|
|
555
|
+
if (!a)
|
|
556
|
+
return;
|
|
557
|
+
a = !1, i.delete(t);
|
|
558
|
+
const o = E.get(n) - 1;
|
|
559
|
+
o ? E.set(n, o) : E.delete(n), !s.own.size && !s.subtree.size && !s.bounds.size && I.delete(r);
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function C(r, e = !1, t) {
|
|
563
|
+
if (!E.has(r.nova))
|
|
564
|
+
return;
|
|
565
|
+
let s = H(I.get(r)?.own), i = r;
|
|
566
|
+
for (; i; ) {
|
|
567
|
+
const n = I.get(i);
|
|
568
|
+
s = H(n?.subtree, s), e && i !== r && (s = H(n?.bounds, s)), i = i === r && t ? t : i.parent;
|
|
569
|
+
}
|
|
570
|
+
if (s?.length)
|
|
571
|
+
throw new AggregateError(s, "[Nova] Node capture invalidation failed");
|
|
572
|
+
}
|
|
573
|
+
function H(r, e) {
|
|
574
|
+
if (r?.size)
|
|
575
|
+
for (const t of [...r])
|
|
576
|
+
try {
|
|
577
|
+
t();
|
|
578
|
+
} catch (s) {
|
|
579
|
+
(e ??= []).push(s);
|
|
580
|
+
}
|
|
581
|
+
return e;
|
|
582
|
+
}
|
|
583
|
+
let Xe = 0;
|
|
584
|
+
class N extends Me {
|
|
585
|
+
constructor(e, t = {}) {
|
|
586
|
+
super(t.parent ?? null, { id: t.id ?? `node-${Xe++}` }, e.core), this._raphRuntime = e;
|
|
587
|
+
}
|
|
588
|
+
_transformState = {
|
|
589
|
+
x: 0,
|
|
590
|
+
y: 0,
|
|
591
|
+
scaleX: 1,
|
|
592
|
+
scaleY: 1,
|
|
593
|
+
rotation: 0,
|
|
594
|
+
matrix: G.create()
|
|
595
|
+
};
|
|
596
|
+
// Эти effective values имеют того же владельца, что transform state.
|
|
597
|
+
// Биты отличают ленивый default от явно записанного undefined.
|
|
598
|
+
_hotValueMask = 0;
|
|
599
|
+
_effectiveActive;
|
|
600
|
+
_effectiveVisible;
|
|
601
|
+
_effectiveWidth;
|
|
602
|
+
_effectiveHeight;
|
|
603
|
+
_propertyValues = /* @__PURE__ */ new Map();
|
|
604
|
+
_propertySignals = /* @__PURE__ */ new Map();
|
|
605
|
+
_pendingPhaseWork = /* @__PURE__ */ new Map();
|
|
606
|
+
_phaseStates = [];
|
|
607
|
+
_runtimeResourcesBound = !1;
|
|
608
|
+
_sceneDepth = 0;
|
|
609
|
+
_renderWeight = 0;
|
|
610
|
+
// ---------------------------------------------
|
|
611
|
+
// PUBLIC API
|
|
612
|
+
// ---------------------------------------------
|
|
613
|
+
get(e) {
|
|
614
|
+
return this._raphRuntime.core._hasActiveReactiveContext() ? this._getPropertySignal(e).get() : this.getLocal(e);
|
|
615
|
+
}
|
|
616
|
+
set(e, t) {
|
|
617
|
+
if (Object.is(this.getLocal(e), t))
|
|
618
|
+
return;
|
|
619
|
+
this._setPropertyValue(e, t);
|
|
620
|
+
const s = this._raphRuntime.getLocalProperty(e);
|
|
621
|
+
s?.source && this._requestPhaseWork(s.phase, s.selfMask, s.downMask);
|
|
622
|
+
}
|
|
623
|
+
getLocal(e) {
|
|
624
|
+
return this._getPropertyValue(e);
|
|
625
|
+
}
|
|
626
|
+
setLocal(e, t) {
|
|
627
|
+
Object.is(this.getLocal(e), t) || this._setPropertyValue(e, t);
|
|
628
|
+
}
|
|
629
|
+
invalidate(e) {
|
|
630
|
+
this._raphRuntime.core.batch(() => {
|
|
631
|
+
e.preupdate && this._requestResolvedPhase("preupdate"), e.update && this._requestResolvedPhase("update"), e.matrix && this._requestResolvedPhase("matrix"), e.render && this._requestResolvedPhase("render"), e.flush && this._requestResolvedPhase("flush");
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
options(e) {
|
|
635
|
+
const t = e, s = e, i = s.weight ?? s.zIndex ?? t.priority;
|
|
636
|
+
return this._raphRuntime.core.batch(() => {
|
|
637
|
+
(i !== void 0 || t.meta !== void 0 || t.type !== void 0) && super.options({
|
|
638
|
+
...t.meta === void 0 ? {} : { meta: t.meta },
|
|
639
|
+
...i === void 0 ? {} : { priority: i },
|
|
640
|
+
...t.type === void 0 ? {} : { type: t.type }
|
|
641
|
+
}), i !== void 0 && (this._renderWeight = i);
|
|
642
|
+
for (const n of Object.keys(e)) {
|
|
643
|
+
if (n === "weight" || n === "zIndex" || n === "priority" || n === "meta" || n === "type")
|
|
644
|
+
continue;
|
|
645
|
+
const a = s[n];
|
|
646
|
+
a !== void 0 && this.set(n, a);
|
|
647
|
+
}
|
|
648
|
+
}), this;
|
|
649
|
+
}
|
|
650
|
+
addChild(e) {
|
|
651
|
+
return this._attachRaphChild(e, !0);
|
|
652
|
+
}
|
|
653
|
+
traverseAll(e) {
|
|
654
|
+
e(this);
|
|
655
|
+
for (const t of this.children)
|
|
656
|
+
t.traverseAll(e);
|
|
657
|
+
}
|
|
658
|
+
// ---------------------------------------------
|
|
659
|
+
// INTERNAL
|
|
660
|
+
// ---------------------------------------------
|
|
661
|
+
/**
|
|
662
|
+
* Присоединяет ноду с возможностью отложить начальную фазовую работу.
|
|
663
|
+
* @internal
|
|
664
|
+
*/
|
|
665
|
+
_attachRaphChild(e, t) {
|
|
666
|
+
if (e.parent === this)
|
|
667
|
+
return !0;
|
|
668
|
+
const s = e.parent !== null, i = super.addChild(e);
|
|
669
|
+
if (e instanceof N) {
|
|
670
|
+
const n = e;
|
|
671
|
+
n._updateSceneDepth(this._sceneDepth + 1), t && (s ? this._raphRuntime._requestReparentPhases(n) : this._raphRuntime._requestNodePhases(n));
|
|
672
|
+
}
|
|
673
|
+
return i;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Подключает aggregates и change-only phase bindings один раз.
|
|
677
|
+
* @internal
|
|
678
|
+
*/
|
|
679
|
+
_bindRuntimeResources() {
|
|
680
|
+
if (!(this._runtimeResourcesBound || !this._raphRuntime.activated) && !(this !== this._raphRuntime.root && this.parent === null)) {
|
|
681
|
+
this._runtimeResourcesBound = !0;
|
|
682
|
+
for (const e of this._pendingPhaseWork.keys())
|
|
683
|
+
this._raphRuntime._requestPhase(this, e);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Возвращает переиспользуемое состояние ноды для фазовой полосы.
|
|
688
|
+
* @internal
|
|
689
|
+
*/
|
|
690
|
+
_getPhaseState(e) {
|
|
691
|
+
let t = this._phaseStates[e];
|
|
692
|
+
return t || (t = {
|
|
693
|
+
selfMask: 0,
|
|
694
|
+
downMask: 0,
|
|
695
|
+
activeMask: 0,
|
|
696
|
+
queuedEpoch: 0,
|
|
697
|
+
bucketEpoch: 0,
|
|
698
|
+
directEpoch: 0,
|
|
699
|
+
processedEpoch: 0,
|
|
700
|
+
requestEpoch: 0
|
|
701
|
+
}, this._phaseStates[e] = t), t;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Объединяет точные маски structural или initial phase work.
|
|
705
|
+
* @internal
|
|
706
|
+
*/
|
|
707
|
+
_requestPhaseWork(e, t, s) {
|
|
708
|
+
if ((t | s) === 0)
|
|
709
|
+
return;
|
|
710
|
+
let i = this._pendingPhaseWork.get(e);
|
|
711
|
+
i || (i = { selfMask: 0, downMask: 0 }, this._pendingPhaseWork.set(e, i)), i.selfMask |= t, i.downMask |= s, this._runtimeResourcesBound && this._raphRuntime._requestPhase(this, e);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Забирает объединенную работу перед запуском phase task.
|
|
715
|
+
* @internal
|
|
716
|
+
*/
|
|
717
|
+
_consumePhaseWork(e) {
|
|
718
|
+
const t = this._pendingPhaseWork.get(e);
|
|
719
|
+
if (!t || (t.selfMask | t.downMask) === 0)
|
|
720
|
+
return;
|
|
721
|
+
const s = { selfMask: t.selfMask, downMask: t.downMask };
|
|
722
|
+
return t.selfMask = 0, t.downMask = 0, s;
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Вычисляет world matrix напрямую из принадлежащего ноде transform state.
|
|
726
|
+
* @internal
|
|
727
|
+
*/
|
|
728
|
+
_computeWorldMatrix() {
|
|
729
|
+
const e = this._transformState, t = e.matrix, s = e.rotation, i = s === 0 ? 1 : Math.cos(s), n = s === 0 ? 0 : Math.sin(s), a = i * e.scaleX, o = n * e.scaleX, c = -n * e.scaleY, h = i * e.scaleY, l = this.parent?._transformState.matrix;
|
|
730
|
+
if (l) {
|
|
731
|
+
const m = l[0], _ = l[1], v = l[3], w = l[4];
|
|
732
|
+
t[0] = a * m + o * v, t[1] = a * _ + o * w, t[3] = c * m + h * v, t[4] = c * _ + h * w, t[6] = e.x * m + e.y * v + l[6], t[7] = e.x * _ + e.y * w + l[7];
|
|
733
|
+
} else
|
|
734
|
+
t[0] = a, t[1] = o, t[3] = c, t[4] = h, t[6] = e.x, t[7] = e.y;
|
|
735
|
+
return t[2] = 0, t[5] = 0, t[8] = 1, t;
|
|
736
|
+
}
|
|
737
|
+
// ---------------------------------------------
|
|
738
|
+
// PRIVATE
|
|
739
|
+
// ---------------------------------------------
|
|
740
|
+
_getPropertySignal(e) {
|
|
741
|
+
let t = this._propertySignals.get(e);
|
|
742
|
+
if (t)
|
|
743
|
+
return t;
|
|
744
|
+
const s = this._getPropertyValue(e);
|
|
745
|
+
return t = this.signal(s), this._propertySignals.set(e, t), t;
|
|
746
|
+
}
|
|
747
|
+
_getPropertyValue(e) {
|
|
748
|
+
switch (e) {
|
|
749
|
+
case "x":
|
|
750
|
+
return this._transformState.x;
|
|
751
|
+
case "y":
|
|
752
|
+
return this._transformState.y;
|
|
753
|
+
case "scaleX":
|
|
754
|
+
return this._transformState.scaleX;
|
|
755
|
+
case "scaleY":
|
|
756
|
+
return this._transformState.scaleY;
|
|
757
|
+
case "rotation":
|
|
758
|
+
return this._transformState.rotation;
|
|
759
|
+
case "matrix":
|
|
760
|
+
return this._transformState.matrix;
|
|
761
|
+
case "width":
|
|
762
|
+
return (this._hotValueMask & 4) !== 0 ? this._effectiveWidth : this._createPropertyDefault(e);
|
|
763
|
+
case "height":
|
|
764
|
+
return (this._hotValueMask & 8) !== 0 ? this._effectiveHeight : this._createPropertyDefault(e);
|
|
765
|
+
case "active":
|
|
766
|
+
return (this._hotValueMask & 1) !== 0 ? this._effectiveActive : this._createPropertyDefault(e);
|
|
767
|
+
case "visible":
|
|
768
|
+
return (this._hotValueMask & 2) !== 0 ? this._effectiveVisible : this._createPropertyDefault(e);
|
|
769
|
+
}
|
|
770
|
+
const t = this._propertyValues.get(e);
|
|
771
|
+
return t !== void 0 || this._propertyValues.has(e) ? t : this._createPropertyDefault(e);
|
|
772
|
+
}
|
|
773
|
+
_createPropertyDefault(e) {
|
|
774
|
+
const t = this._raphRuntime.getLocalProperty(e), s = t?.createDefault ? t.createDefault() : t?.defaultValue;
|
|
775
|
+
switch (e) {
|
|
776
|
+
case "width":
|
|
777
|
+
this._effectiveWidth = s, this._hotValueMask |= 4;
|
|
778
|
+
break;
|
|
779
|
+
case "height":
|
|
780
|
+
this._effectiveHeight = s, this._hotValueMask |= 8;
|
|
781
|
+
break;
|
|
782
|
+
case "active":
|
|
783
|
+
this._effectiveActive = s, this._hotValueMask |= 1;
|
|
784
|
+
break;
|
|
785
|
+
case "visible":
|
|
786
|
+
this._effectiveVisible = s, this._hotValueMask |= 2;
|
|
787
|
+
break;
|
|
788
|
+
default:
|
|
789
|
+
this._propertyValues.set(e, s);
|
|
790
|
+
}
|
|
791
|
+
return s;
|
|
792
|
+
}
|
|
793
|
+
_setPropertyValue(e, t) {
|
|
794
|
+
switch (e) {
|
|
795
|
+
case "x":
|
|
796
|
+
this._transformState.x = t;
|
|
797
|
+
break;
|
|
798
|
+
case "y":
|
|
799
|
+
this._transformState.y = t;
|
|
800
|
+
break;
|
|
801
|
+
case "scaleX":
|
|
802
|
+
this._transformState.scaleX = t;
|
|
803
|
+
break;
|
|
804
|
+
case "scaleY":
|
|
805
|
+
this._transformState.scaleY = t;
|
|
806
|
+
break;
|
|
807
|
+
case "rotation":
|
|
808
|
+
this._transformState.rotation = t;
|
|
809
|
+
break;
|
|
810
|
+
case "matrix":
|
|
811
|
+
this._transformState.matrix = t;
|
|
812
|
+
break;
|
|
813
|
+
case "width":
|
|
814
|
+
this._effectiveWidth = t, this._hotValueMask |= 4;
|
|
815
|
+
break;
|
|
816
|
+
case "height":
|
|
817
|
+
this._effectiveHeight = t, this._hotValueMask |= 8;
|
|
818
|
+
break;
|
|
819
|
+
case "active":
|
|
820
|
+
this._effectiveActive = t, this._hotValueMask |= 1;
|
|
821
|
+
break;
|
|
822
|
+
case "visible":
|
|
823
|
+
this._effectiveVisible = t, this._hotValueMask |= 2;
|
|
824
|
+
break;
|
|
825
|
+
default:
|
|
826
|
+
this._propertyValues.set(e, t);
|
|
827
|
+
}
|
|
828
|
+
this._propertySignals.get(e)?.set(t);
|
|
829
|
+
}
|
|
830
|
+
_requestResolvedPhase(e) {
|
|
831
|
+
const t = this._raphRuntime._resolveInvalidation(this, e);
|
|
832
|
+
this._requestPhaseWork(e, t.selfMask, t.downMask);
|
|
833
|
+
}
|
|
834
|
+
_updateSceneDepth(e) {
|
|
835
|
+
this._sceneDepth = e;
|
|
836
|
+
for (const t of this.children)
|
|
837
|
+
t._updateSceneDepth(e + 1);
|
|
838
|
+
}
|
|
839
|
+
// ---------------------------------------------
|
|
840
|
+
// ACCESS
|
|
841
|
+
// ---------------------------------------------
|
|
842
|
+
get parent() {
|
|
843
|
+
const e = super.parent;
|
|
844
|
+
return e instanceof N ? e : null;
|
|
845
|
+
}
|
|
846
|
+
get children() {
|
|
847
|
+
return super.children;
|
|
848
|
+
}
|
|
849
|
+
get app() {
|
|
850
|
+
return this._raphRuntime;
|
|
851
|
+
}
|
|
852
|
+
get raph() {
|
|
853
|
+
return this._raphRuntime;
|
|
854
|
+
}
|
|
855
|
+
get weight() {
|
|
856
|
+
return this._renderWeight;
|
|
857
|
+
}
|
|
858
|
+
get computedWeight() {
|
|
859
|
+
return this._raphRuntime.priorityOf(this);
|
|
860
|
+
}
|
|
861
|
+
get sceneDepth() {
|
|
862
|
+
return this._sceneDepth;
|
|
863
|
+
}
|
|
864
|
+
get local() {
|
|
865
|
+
return { get: (e) => this.getLocal(e), set: (e, t) => this.setLocal(e, t) };
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
let qe = 0;
|
|
869
|
+
function $e(r) {
|
|
870
|
+
return r.x !== void 0 || r.y !== void 0 || r.width !== void 0 || r.height !== void 0 || r.scaleX !== void 0 || r.scaleY !== void 0 || r.rotation !== void 0 || r.active !== void 0 || r.visible !== void 0 || r.opacity !== void 0 || r.interactive !== void 0 || r.cursor !== void 0 || r.hitTest !== void 0 || r.zIndex !== void 0;
|
|
871
|
+
}
|
|
872
|
+
class p extends N {
|
|
873
|
+
//
|
|
874
|
+
// Внутреннее состояние graph runtime и lifecycle.
|
|
875
|
+
_effects = L;
|
|
876
|
+
_releaseEffectParameters;
|
|
877
|
+
_alphaMask = null;
|
|
878
|
+
_maskSourceRevision = 0;
|
|
879
|
+
_composition = null;
|
|
880
|
+
_renderClip = null;
|
|
881
|
+
_nova;
|
|
882
|
+
_surface;
|
|
883
|
+
eventHandlers = {};
|
|
884
|
+
captureEventHandlers = {};
|
|
885
|
+
__type;
|
|
886
|
+
_inverseMatrix = G.create();
|
|
887
|
+
_renderBoundaryGroupId = `main:group:${(++qe).toString(36)}`;
|
|
888
|
+
_inverseMatrixSource;
|
|
889
|
+
_renderOrder = /* @__PURE__ */ new WeakMap();
|
|
890
|
+
_orderedChildren = [];
|
|
891
|
+
_localRenderBounds = O();
|
|
892
|
+
_renderOrderCounter = 0;
|
|
893
|
+
_renderFrameDirty = !0;
|
|
894
|
+
_renderFrameRevision = 0;
|
|
895
|
+
_lifecycleState = "created";
|
|
896
|
+
_hasLocalRenderBounds = !1;
|
|
897
|
+
_renderPolicy = Z();
|
|
898
|
+
_renderDirtyFlags = ee();
|
|
899
|
+
_renderVersions = ze();
|
|
900
|
+
_layoutReady = !0;
|
|
901
|
+
_provides;
|
|
902
|
+
_injectCache;
|
|
903
|
+
_providerVersion = 0;
|
|
904
|
+
_reactiveStoreObservers;
|
|
905
|
+
_nodeContext;
|
|
906
|
+
_hasNodeContext = !1;
|
|
907
|
+
_semanticId;
|
|
908
|
+
_schemaSemanticSourceKey;
|
|
909
|
+
_disposers = [];
|
|
910
|
+
_soundHandles = /* @__PURE__ */ new Set();
|
|
911
|
+
_soundUserHandlers = /* @__PURE__ */ new Map();
|
|
912
|
+
_soundEventBindings;
|
|
913
|
+
//
|
|
914
|
+
// CTOR
|
|
915
|
+
//
|
|
916
|
+
constructor(e, t) {
|
|
917
|
+
super(e.raph), this._nova = e, this._surface = t, this.__type = this.constructor.name;
|
|
918
|
+
}
|
|
919
|
+
invalidate(e) {
|
|
920
|
+
if (!e.flush || !this._surface) {
|
|
921
|
+
super.invalidate(e);
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
this.runtime.batch(() => {
|
|
925
|
+
super.invalidate({
|
|
926
|
+
preupdate: e.preupdate,
|
|
927
|
+
update: e.update,
|
|
928
|
+
matrix: e.matrix,
|
|
929
|
+
render: e.render
|
|
930
|
+
}), this._surface.invalidate({ flush: !0 });
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
setEffects(e) {
|
|
934
|
+
if (this._releaseEffectParameters === null) {
|
|
935
|
+
if (e === null || e.length === 0)
|
|
936
|
+
return this._effects = L, this;
|
|
937
|
+
throw new Error("[Nova] Cannot set effects on a disposing or destroyed node");
|
|
938
|
+
}
|
|
939
|
+
const t = de(e);
|
|
940
|
+
if (t.length === this._effects.length && t.every((i, n) => i === this._effects[n]))
|
|
941
|
+
return this;
|
|
942
|
+
const s = fe(t, () => {
|
|
943
|
+
this._releaseEffectParameters !== null && this.nova._invalidateEffectReplay(this.surface);
|
|
944
|
+
});
|
|
945
|
+
return this._releaseEffectParameters?.(), this._releaseEffectParameters = s, this._effects = t, C(this, !0), this.invalidate({ render: !0, flush: !0 }), this;
|
|
946
|
+
}
|
|
947
|
+
getEffects() {
|
|
948
|
+
return this._effects;
|
|
949
|
+
}
|
|
950
|
+
setMask(e) {
|
|
951
|
+
const t = e === null ? null : pe(e), s = this._alphaMask;
|
|
952
|
+
return t === s || t && s && t.image === s.image && T(t, s) ? this : (this._alphaMask = t, this.invalidate({ render: !0, flush: !0 }), this);
|
|
953
|
+
}
|
|
954
|
+
getMask() {
|
|
955
|
+
return this._alphaMask;
|
|
956
|
+
}
|
|
957
|
+
invalidateMask() {
|
|
958
|
+
return this._alphaMask && (this._maskSourceRevision += 1, this.invalidate({ render: !0, flush: !0 })), this;
|
|
959
|
+
}
|
|
960
|
+
setComposition(e) {
|
|
961
|
+
const t = e === null ? null : ye(e), s = this._composition;
|
|
962
|
+
return s === t || s && t && s.opacity === t.opacity && s.blendMode === t.blendMode && (s.bounds === t.bounds || s.bounds && t.bounds && T(s.bounds, t.bounds)) ? this : (this._composition = t, this.invalidate({ render: !0, flush: !0 }), this);
|
|
963
|
+
}
|
|
964
|
+
getComposition() {
|
|
965
|
+
return this._composition;
|
|
966
|
+
}
|
|
967
|
+
_compositionBounds() {
|
|
968
|
+
if (this._composition?.bounds)
|
|
969
|
+
return V(this._composition.bounds, this.matrix);
|
|
970
|
+
let e;
|
|
971
|
+
const t = (s) => {
|
|
972
|
+
if (!s.visible || !s.layoutReady)
|
|
973
|
+
return;
|
|
974
|
+
let i = s.getRenderBounds();
|
|
975
|
+
if (s !== this && s._effects.length) {
|
|
976
|
+
const n = ve(s._effects, this.surface.captureContext?.dpr ?? this.nova.canvas.dpr);
|
|
977
|
+
n && (i = { x: i.x - n, y: i.y - n, width: i.width + n * 2, height: i.height + n * 2 });
|
|
978
|
+
}
|
|
979
|
+
if (i.width > 0 && i.height > 0)
|
|
980
|
+
if (!e)
|
|
981
|
+
e = i;
|
|
982
|
+
else {
|
|
983
|
+
const n = Math.max(e.x + e.width, i.x + i.width), a = Math.max(e.y + e.height, i.y + i.height);
|
|
984
|
+
e.x = Math.min(e.x, i.x), e.y = Math.min(e.y, i.y), e.width = n - e.x, e.height = a - e.y;
|
|
985
|
+
}
|
|
986
|
+
for (const n of s.children)
|
|
987
|
+
n instanceof p && t(n);
|
|
988
|
+
};
|
|
989
|
+
return t(this), e ?? { x: 0, y: 0, width: 0, height: 0 };
|
|
990
|
+
}
|
|
991
|
+
setClip(e) {
|
|
992
|
+
const t = e === null ? null : Pe(e), s = this._renderClip;
|
|
993
|
+
return s === t || s && t && ("path" in s && "path" in t ? s.path === t.path && s.fillRule === t.fillRule : !("path" in s) && !("path" in t) && s.x === t.x && s.y === t.y && s.width === t.width && s.height === t.height) ? this : (this._renderClip = t, this.invalidate({ render: !0, flush: !0 }), this);
|
|
994
|
+
}
|
|
995
|
+
getClip() {
|
|
996
|
+
return this._renderClip;
|
|
997
|
+
}
|
|
998
|
+
_containsPointInClips(e, t) {
|
|
999
|
+
return p._pointInClips(this, e, t);
|
|
1000
|
+
}
|
|
1001
|
+
static _pointInClips(e, t, s) {
|
|
1002
|
+
for (let i = e; i; i = i.parent instanceof p ? i.parent : void 0) {
|
|
1003
|
+
const n = i._renderClip, a = i._composition?.bounds, o = i._alphaMask;
|
|
1004
|
+
if (n || a || o) {
|
|
1005
|
+
const c = i._getInverseMatrix();
|
|
1006
|
+
if (!c)
|
|
1007
|
+
return !1;
|
|
1008
|
+
const h = { x: c[0] * t + c[3] * s + c[6], y: c[1] * t + c[4] * s + c[7] };
|
|
1009
|
+
if (o) {
|
|
1010
|
+
const l = i.nova.assets._resolveRenderTexture(o.image);
|
|
1011
|
+
if (!(l ? l.ready : me(i.nova.assets.resolveDrawable(o.image))) || h.x < o.x || h.y < o.y || h.x > o.x + o.width || h.y > o.y + o.height)
|
|
1012
|
+
return !1;
|
|
1013
|
+
}
|
|
1014
|
+
if (a && (h.x < a.x || h.y < a.y || h.x > a.x + a.width || h.y > a.y + a.height))
|
|
1015
|
+
return !1;
|
|
1016
|
+
if (n && "path" in n) {
|
|
1017
|
+
if (!je({ ...n, styles: { fill: "#fff" } }, { x: t, y: s }, i.matrix, i.nova.canvas.dpr))
|
|
1018
|
+
return !1;
|
|
1019
|
+
} else if (n && (h.x < n.x || h.y < n.y || h.x > n.x + n.width || h.y > n.y + n.height))
|
|
1020
|
+
return !1;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
return !0;
|
|
1024
|
+
}
|
|
1025
|
+
provide(e, t) {
|
|
1026
|
+
return this._provides || (this._provides = /* @__PURE__ */ new Map()), this._provides.set(e, t), this._providerVersion += 1, this.nova.bumpContextVersion(), this._injectCache?.delete(e), this;
|
|
1027
|
+
}
|
|
1028
|
+
inject(e) {
|
|
1029
|
+
const t = this._resolveInjectedValue(e);
|
|
1030
|
+
if (t.found)
|
|
1031
|
+
return t.value;
|
|
1032
|
+
throw new Error(`[NovaNode] Context provider not found for "${String(e.description ?? e.toString())}"`);
|
|
1033
|
+
}
|
|
1034
|
+
injectOptional(e, t) {
|
|
1035
|
+
const s = this._resolveInjectedValue(e);
|
|
1036
|
+
return s.found ? s.value : t;
|
|
1037
|
+
}
|
|
1038
|
+
hasProvider(e) {
|
|
1039
|
+
return this._provides?.has(e) ?? !1;
|
|
1040
|
+
}
|
|
1041
|
+
setContext(e) {
|
|
1042
|
+
return this._nodeContext = e, this._hasNodeContext = !0, this;
|
|
1043
|
+
}
|
|
1044
|
+
getContext() {
|
|
1045
|
+
if (!this._hasNodeContext)
|
|
1046
|
+
throw new Error(`[NovaNode] Node context is not set for "${this.id}"`);
|
|
1047
|
+
return this._nodeContext;
|
|
1048
|
+
}
|
|
1049
|
+
getContextOptional(e) {
|
|
1050
|
+
return this._hasNodeContext ? this._nodeContext : e;
|
|
1051
|
+
}
|
|
1052
|
+
addDisposer(e) {
|
|
1053
|
+
return this._disposers.push(e), e;
|
|
1054
|
+
}
|
|
1055
|
+
syncReactiveStoreReads(e, t) {
|
|
1056
|
+
this._reactiveStoreObservers || (this._reactiveStoreObservers = /* @__PURE__ */ new Map());
|
|
1057
|
+
for (const s of t) {
|
|
1058
|
+
const i = e.get(s) ?? /* @__PURE__ */ new Set();
|
|
1059
|
+
let n = this._reactiveStoreObservers.get(s);
|
|
1060
|
+
n || (n = /* @__PURE__ */ new Map(), this._reactiveStoreObservers.set(s, n));
|
|
1061
|
+
for (const [a, o] of [...n.entries()])
|
|
1062
|
+
i.has(a) || (o(), n.delete(a));
|
|
1063
|
+
for (const a of i)
|
|
1064
|
+
n.has(a) || n.set(a, this._createReactiveStoreObserver(a, s));
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
_createReactiveStoreObserver(e, t) {
|
|
1068
|
+
const s = e.endsWith(".*") ? e.slice(0, -2) : e, i = this.runtime.path(s), n = this.watch(i, t, () => {
|
|
1069
|
+
t === z.Update ? this.invalidate({ update: !0 }) : this.invalidate({ render: !0 });
|
|
1070
|
+
}, { initial: "none" });
|
|
1071
|
+
if (t !== z.Render)
|
|
1072
|
+
return n;
|
|
1073
|
+
const a = this.surface.watch(
|
|
1074
|
+
i,
|
|
1075
|
+
z.Flush,
|
|
1076
|
+
() => this.surface.invalidate({ flush: !0 }),
|
|
1077
|
+
{ initial: "none" }
|
|
1078
|
+
);
|
|
1079
|
+
return () => {
|
|
1080
|
+
n(), a();
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
//
|
|
1084
|
+
// СВОЙСТВА RAPH — ЯДРО
|
|
1085
|
+
//
|
|
1086
|
+
get active() {
|
|
1087
|
+
return this.get("active");
|
|
1088
|
+
}
|
|
1089
|
+
set active(e) {
|
|
1090
|
+
this.localActive !== e && (this.set("localActive", e), this.nova.events.markSpatialDirty(this, !0), this.nova.cursors.markSpatialDirty(this, !0));
|
|
1091
|
+
}
|
|
1092
|
+
get visible() {
|
|
1093
|
+
return this.get("visible");
|
|
1094
|
+
}
|
|
1095
|
+
set visible(e) {
|
|
1096
|
+
this.localVisible !== e && (this.set("localVisible", e), this.nova.events.markSpatialDirty(this, !0), this.nova.cursors.markSpatialDirty(this, !0));
|
|
1097
|
+
}
|
|
1098
|
+
get opacity() {
|
|
1099
|
+
return this.get("opacity");
|
|
1100
|
+
}
|
|
1101
|
+
set opacity(e) {
|
|
1102
|
+
this.set("opacity", e);
|
|
1103
|
+
}
|
|
1104
|
+
//
|
|
1105
|
+
// СВОЙСТВА RAPH — ГЕОМЕТРИЯ
|
|
1106
|
+
//
|
|
1107
|
+
get x() {
|
|
1108
|
+
return this.get("x");
|
|
1109
|
+
}
|
|
1110
|
+
set x(e) {
|
|
1111
|
+
this.set("x", e);
|
|
1112
|
+
}
|
|
1113
|
+
get y() {
|
|
1114
|
+
return this.get("y");
|
|
1115
|
+
}
|
|
1116
|
+
set y(e) {
|
|
1117
|
+
this.set("y", e);
|
|
1118
|
+
}
|
|
1119
|
+
get width() {
|
|
1120
|
+
return this.get("width");
|
|
1121
|
+
}
|
|
1122
|
+
set width(e) {
|
|
1123
|
+
this.set("width", e);
|
|
1124
|
+
}
|
|
1125
|
+
get height() {
|
|
1126
|
+
return this.get("height");
|
|
1127
|
+
}
|
|
1128
|
+
set height(e) {
|
|
1129
|
+
this.set("height", e);
|
|
1130
|
+
}
|
|
1131
|
+
get scaleX() {
|
|
1132
|
+
return this.get("scaleX");
|
|
1133
|
+
}
|
|
1134
|
+
set scaleX(e) {
|
|
1135
|
+
this.set("scaleX", e);
|
|
1136
|
+
}
|
|
1137
|
+
get scaleY() {
|
|
1138
|
+
return this.get("scaleY");
|
|
1139
|
+
}
|
|
1140
|
+
set scaleY(e) {
|
|
1141
|
+
this.set("scaleY", e);
|
|
1142
|
+
}
|
|
1143
|
+
get rotation() {
|
|
1144
|
+
return this.get("rotation");
|
|
1145
|
+
}
|
|
1146
|
+
set rotation(e) {
|
|
1147
|
+
this.set("rotation", e);
|
|
1148
|
+
}
|
|
1149
|
+
get matrix() {
|
|
1150
|
+
return this.get("matrix");
|
|
1151
|
+
}
|
|
1152
|
+
//
|
|
1153
|
+
// СВОЙСТВА RAPH — ИНТЕРАКТИВНОСТЬ
|
|
1154
|
+
//
|
|
1155
|
+
get interactive() {
|
|
1156
|
+
return this.get("interactive");
|
|
1157
|
+
}
|
|
1158
|
+
set interactive(e) {
|
|
1159
|
+
this.interactive !== e && (this.nova.events.markSpatialDirty(this), this.nova.cursors.markSpatialDirty(this), this.set("interactive", e));
|
|
1160
|
+
}
|
|
1161
|
+
get cursor() {
|
|
1162
|
+
return this.get("cursor");
|
|
1163
|
+
}
|
|
1164
|
+
set cursor(e) {
|
|
1165
|
+
this.getLocal("cursor") !== e && (this.set("cursor", e), this._syncCursorRegistration());
|
|
1166
|
+
}
|
|
1167
|
+
get cursorContext() {
|
|
1168
|
+
return this.get("cursorContext");
|
|
1169
|
+
}
|
|
1170
|
+
set cursorContext(e) {
|
|
1171
|
+
this.getLocal("cursorContext") !== e && (this.set("cursorContext", e), this.nova.cursors.markSpatialDirty(this));
|
|
1172
|
+
}
|
|
1173
|
+
get propagateUpdate() {
|
|
1174
|
+
return this.get("propagateUpdate");
|
|
1175
|
+
}
|
|
1176
|
+
set propagateUpdate(e) {
|
|
1177
|
+
this.set("propagateUpdate", e);
|
|
1178
|
+
}
|
|
1179
|
+
//
|
|
1180
|
+
// ОБРАБОТЧИКИ RAPH
|
|
1181
|
+
//
|
|
1182
|
+
doUpdate() {
|
|
1183
|
+
if (this.active) {
|
|
1184
|
+
this.debugger.startTimer("update"), se(this, "update");
|
|
1185
|
+
try {
|
|
1186
|
+
this.update();
|
|
1187
|
+
} finally {
|
|
1188
|
+
ie();
|
|
1189
|
+
}
|
|
1190
|
+
this.debugger.enabled && this.debugger.info(`${this.__type} завершил update`, "update");
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
doMatrix() {
|
|
1194
|
+
this._inverseMatrixSource = void 0, this.debugger.enabled && this.debugger.info(`${this.__type} завершил matrix`, "matrix");
|
|
1195
|
+
}
|
|
1196
|
+
doRender() {
|
|
1197
|
+
if (this.visible) {
|
|
1198
|
+
if (!this._layoutReady) {
|
|
1199
|
+
this.surface.markCaptureLayoutPending();
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
if (this._surface && this.surface.renderCullingMode === "bounds" && !this.surface.captureContext && (this.surface.markRenderNodeTestedForCulling(), !_e(this.getRenderBounds(), this.surface.getWorldBounds()))) {
|
|
1203
|
+
this.surface.markRenderNodeCulled();
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
this.debugger.startTimer("render"), this._withRenderScope() && (this.surface.captureContext || this.surface.markRenderNodeRebuilt(), this.debugger.enabled && this.debugger.info(`${this.__type} завершил render`, "render"));
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Ancestors contribute render state, never their own paint or siblings.
|
|
1211
|
+
* @internal
|
|
1212
|
+
*/
|
|
1213
|
+
_captureAncestorScope(e) {
|
|
1214
|
+
if (this.visible) {
|
|
1215
|
+
if (!this._layoutReady) {
|
|
1216
|
+
this.surface.markCaptureLayoutPending();
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
this._withRenderScope(e);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
_withRenderScope(e) {
|
|
1223
|
+
const t = this.surface.captureContext ? this.renderer : void 0, s = this.get("matrix"), i = this._resolveNodeAwareRenderer();
|
|
1224
|
+
if (i?.beginNode(this) === !1)
|
|
1225
|
+
return i.endNode(this), this.surface.captureContext || this.surface.markRenderNodeRetained(), !1;
|
|
1226
|
+
this.renderer.save();
|
|
1227
|
+
const n = this.renderer.markState();
|
|
1228
|
+
se(this, "render", this.surface.captureContext?.reads);
|
|
1229
|
+
let a = !1, o;
|
|
1230
|
+
try {
|
|
1231
|
+
this.renderer.setTransform(s);
|
|
1232
|
+
const c = this._renderClip;
|
|
1233
|
+
if (c)
|
|
1234
|
+
if ("path" in c) {
|
|
1235
|
+
if (!this.renderer.clipPath)
|
|
1236
|
+
throw new Error("[Nova] This renderer does not support path clipping");
|
|
1237
|
+
this.renderer.clipPath(c);
|
|
1238
|
+
} else (s[1] !== 0 || s[3] !== 0) && this.renderer.clipPath ? this.renderer.clipPath({ path: Ee(c) }) : this.renderer.clip(c.x, c.y, c.width, c.height);
|
|
1239
|
+
if (this._composition || this._alphaMask || this._effects.length) {
|
|
1240
|
+
if (!this.renderer.beginComposition || !this.renderer.endComposition)
|
|
1241
|
+
throw new Error("[Nova] This renderer does not support group composition");
|
|
1242
|
+
const h = this._alphaMask;
|
|
1243
|
+
h && !this.nova.assets._resolveRenderTexture(h.image, !1) && !this.nova.assets._trackManagedImageMetadata(h.image) && this.nova.assets.resolveDrawable(h.image), this.renderer.beginComposition({ opacity: 1, blendMode: "normal", ...this._composition, bounds: this._compositionBounds(), effects: this._effects.length ? this._effects : void 0, mask: h ? { ...h, transform: s, sourceKey: this._maskSourceRevision ? `mask:${this.renderNodeId}:${this._maskSourceRevision}` : "icon" } : void 0 }), a = !0, o = this.renderer.markState();
|
|
1244
|
+
}
|
|
1245
|
+
e ? e() : (this.render(), this.renderChildren());
|
|
1246
|
+
} finally {
|
|
1247
|
+
try {
|
|
1248
|
+
a && ((t ?? this.renderer).restoreState(o), (t ?? this.renderer).endComposition());
|
|
1249
|
+
} finally {
|
|
1250
|
+
ie(), (t ?? this.renderer).restoreState(n), (t ?? this.renderer).restore(), i?.endNode(this);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
return !0;
|
|
1254
|
+
}
|
|
1255
|
+
get layoutReady() {
|
|
1256
|
+
return this._layoutReady;
|
|
1257
|
+
}
|
|
1258
|
+
set layoutReady(e) {
|
|
1259
|
+
this._layoutReady !== e && (this._layoutReady = e, this.markRenderFrameDirty(!0), e && this.invalidate({ render: !0 }));
|
|
1260
|
+
}
|
|
1261
|
+
//
|
|
1262
|
+
// BEHAVIOR
|
|
1263
|
+
//
|
|
1264
|
+
options(e) {
|
|
1265
|
+
const { active: t, zIndex: s, hitTest: i, visible: n, ...a } = e, o = $e(e), c = Object.hasOwn(e, "cursor"), h = Object.hasOwn(e, "cursorContext"), l = Object.hasOwn(e, "hitTest"), m = s ?? e.weight ?? e.priority, _ = m !== void 0 && m !== this.weight;
|
|
1266
|
+
return this.runtime.batch(() => {
|
|
1267
|
+
t !== void 0 && (this.active = t), n !== void 0 && (this.visible = n), s === void 0 ? super.options(a) : super.options({
|
|
1268
|
+
...a,
|
|
1269
|
+
weight: s
|
|
1270
|
+
}), l && this.setHitTest(i ?? null), c && this._syncCursorRegistration(), h && this.nova.cursors.markSpatialDirty(this), o && this._markSpatialDirtyForOptions(e), _ && (this.markRenderDirtyFlags({ cache: !0 }), this.parent instanceof p && this.parent._markNearestRenderGroupChildrenDirty(), this.parent?.invalidate({ render: !0 }), this.invalidate({ render: !0 }));
|
|
1271
|
+
}), this;
|
|
1272
|
+
}
|
|
1273
|
+
invalidateRectBatch(e) {
|
|
1274
|
+
if (this._lifecycleState === "destroyed")
|
|
1275
|
+
return;
|
|
1276
|
+
if (this._lifecycleState !== "mounted") {
|
|
1277
|
+
this.invalidate({ render: !0, flush: !0 });
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
C(this);
|
|
1281
|
+
const t = this.surface.renderGraph.tryMarkOwnedRectBatchDirty(this.renderNodeId, e);
|
|
1282
|
+
if (t === "SCHEDULED" || t === "COALESCED") {
|
|
1283
|
+
this.surface.invalidate({ render: !0, flush: !0 });
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
this.invalidate({ render: !0, flush: !0 });
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Планирует exact retained schema paint patch либо безопасно откатывается к полной компиляции.
|
|
1290
|
+
* Versioned source должен сохранять identity и публиковать полный exact dirtyIndices до replay.
|
|
1291
|
+
* @internal
|
|
1292
|
+
*/
|
|
1293
|
+
dirtyRetainedRender() {
|
|
1294
|
+
C(this);
|
|
1295
|
+
const e = this.surface.renderGraph;
|
|
1296
|
+
if (e.tryMarkRetainedPaintDirty(this.renderNodeId)) {
|
|
1297
|
+
this.surface.invalidate({ render: !0, flush: !0 });
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
this.markRenderDirtyFlags({ paint: !0, resource: !0, cache: !0 }), e.handlesByNodeId.has(this.renderNodeId) ? (e.markPaintDirty(this.renderNodeId), e.markResourceDirty(this.renderNodeId)) : this.markRenderFrameDirty(!0), this.nova.events.markSpatialDirty(this), this.nova.cursors.markSpatialDirty(this), this.surface.invalidate({ render: !0, flush: !0 });
|
|
1301
|
+
}
|
|
1302
|
+
getLocalBounds() {
|
|
1303
|
+
return {
|
|
1304
|
+
x: 0,
|
|
1305
|
+
y: 0,
|
|
1306
|
+
width: this.width,
|
|
1307
|
+
height: this.height
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
getWorldBounds() {
|
|
1311
|
+
return V(this.getLocalBounds(), this.matrix);
|
|
1312
|
+
}
|
|
1313
|
+
getRenderBounds() {
|
|
1314
|
+
return V(this.getLocalRenderBounds(), this.matrix);
|
|
1315
|
+
}
|
|
1316
|
+
getLocalRenderBounds() {
|
|
1317
|
+
return this._hasLocalRenderBounds ? { ...this._localRenderBounds } : this.getLocalBounds();
|
|
1318
|
+
}
|
|
1319
|
+
setLocalRenderBounds(e) {
|
|
1320
|
+
return this._hasLocalRenderBounds && T(this._localRenderBounds, e) ? this : (W(this._localRenderBounds, e), this._hasLocalRenderBounds = !0, this.nova.events.markSpatialDirty(this), this.nova.cursors.markSpatialDirty(this), C(this, !0), this);
|
|
1321
|
+
}
|
|
1322
|
+
setRenderBoundsFromSchema(e) {
|
|
1323
|
+
return this.setLocalRenderBounds(Ce(e, this.nova.schema));
|
|
1324
|
+
}
|
|
1325
|
+
setSemantic(e) {
|
|
1326
|
+
const t = e.id ?? this.renderNodeId;
|
|
1327
|
+
return this._semanticId = t, this.nova.semantics.register({
|
|
1328
|
+
...e,
|
|
1329
|
+
id: t,
|
|
1330
|
+
bounds: e.bounds ?? this.getWorldBounds(),
|
|
1331
|
+
source: {
|
|
1332
|
+
...e.source,
|
|
1333
|
+
type: e.source?.type ?? "node",
|
|
1334
|
+
nodeId: this.renderNodeId
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
clearSemantic() {
|
|
1339
|
+
this._semanticId && (this.nova.semantics.remove(this._semanticId), this._semanticId = void 0);
|
|
1340
|
+
}
|
|
1341
|
+
getSemantic() {
|
|
1342
|
+
return this._semanticId ? this.nova.semantics.query({ id: this._semanticId, includeHidden: !0, includeDisabled: !0 })[0] : void 0;
|
|
1343
|
+
}
|
|
1344
|
+
clearLocalRenderBounds() {
|
|
1345
|
+
return this._hasLocalRenderBounds ? (this._hasLocalRenderBounds = !1, W(this._localRenderBounds, O()), this.nova.events.markSpatialDirty(this), this.nova.cursors.markSpatialDirty(this), this) : this;
|
|
1346
|
+
}
|
|
1347
|
+
containsPoint(e, t) {
|
|
1348
|
+
const s = this._getInverseMatrix();
|
|
1349
|
+
if (!s)
|
|
1350
|
+
return !1;
|
|
1351
|
+
const i = s[0] * e + s[3] * t + s[6], n = s[1] * e + s[4] * t + s[7], a = this.getLocalRenderBounds;
|
|
1352
|
+
let o = !1, c = !0, h = this._localRenderBounds;
|
|
1353
|
+
if (a === Je) {
|
|
1354
|
+
if (!this._hasLocalRenderBounds) {
|
|
1355
|
+
const u = this.getLocalBounds;
|
|
1356
|
+
u === Ke ? o = !0 : (h = Reflect.apply(u, this, []), c = !1);
|
|
1357
|
+
}
|
|
1358
|
+
} else
|
|
1359
|
+
h = Reflect.apply(a, this, []), c = !1;
|
|
1360
|
+
let l = 0, m = 0, _, v;
|
|
1361
|
+
if (o ? (_ = this.width, v = this.height) : (l = h.x, m = h.y, _ = h.width, v = h.height), !(i >= l && n >= m && i <= l + _ && n <= m + v) || !this._containsPointInClips(e, t))
|
|
1362
|
+
return !1;
|
|
1363
|
+
const d = this.get("hitTest");
|
|
1364
|
+
return d ? d({
|
|
1365
|
+
node: this,
|
|
1366
|
+
worldX: e,
|
|
1367
|
+
worldY: t,
|
|
1368
|
+
localX: i,
|
|
1369
|
+
localY: n,
|
|
1370
|
+
bounds: c ? { x: l, y: m, width: _, height: v } : h
|
|
1371
|
+
}) === !0 : !0;
|
|
1372
|
+
}
|
|
1373
|
+
setHitTest(e) {
|
|
1374
|
+
return this.getLocal("hitTest") === e ? this : (this.set("hitTest", e), this.nova.events.markSpatialDirty(this), this.nova.cursors.markSpatialDirty(this), this);
|
|
1375
|
+
}
|
|
1376
|
+
toLocal(e, t) {
|
|
1377
|
+
const s = this._getInverseMatrix();
|
|
1378
|
+
return s ? [
|
|
1379
|
+
s[0] * e + s[3] * t + s[6],
|
|
1380
|
+
s[1] * e + s[4] * t + s[7]
|
|
1381
|
+
] : [e, t];
|
|
1382
|
+
}
|
|
1383
|
+
//
|
|
1384
|
+
// EVENTS
|
|
1385
|
+
//
|
|
1386
|
+
on(e, t) {
|
|
1387
|
+
if (Array.isArray(e)) {
|
|
1388
|
+
e.forEach((s) => this.on(s, t));
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
this._installEventHandler(e, t), this.nova.registerInteractiveNode(this);
|
|
1392
|
+
}
|
|
1393
|
+
withSound(e) {
|
|
1394
|
+
this._soundEventBindings || (this._soundEventBindings = /* @__PURE__ */ new Map());
|
|
1395
|
+
for (const [t, s] of Object.entries(e)) {
|
|
1396
|
+
if (!s)
|
|
1397
|
+
continue;
|
|
1398
|
+
this._soundEventBindings.set(t, s);
|
|
1399
|
+
const i = this._soundUserHandlers.has(t) ? this._soundUserHandlers.get(t) : this.eventHandlers[t];
|
|
1400
|
+
this._installEventHandler(t, i), this.nova.registerInteractiveNode(this);
|
|
1401
|
+
}
|
|
1402
|
+
return this;
|
|
1403
|
+
}
|
|
1404
|
+
onCapture(e, t) {
|
|
1405
|
+
if (Array.isArray(e)) {
|
|
1406
|
+
e.forEach((s) => this.onCapture(s, t));
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
this.captureEventHandlers[e] = t, this.nova.registerInteractiveNode(this);
|
|
1410
|
+
}
|
|
1411
|
+
off(e) {
|
|
1412
|
+
delete this.eventHandlers[e], this._soundUserHandlers.delete(e), this._soundEventBindings?.delete(e), Object.keys(this.eventHandlers).length === 0 && Object.keys(this.captureEventHandlers).length === 0 ? this.nova.unregisterInteractiveNode(this) : this.nova.registerInteractiveNode(this);
|
|
1413
|
+
}
|
|
1414
|
+
offCapture(e) {
|
|
1415
|
+
delete this.captureEventHandlers[e], Object.keys(this.eventHandlers).length === 0 && Object.keys(this.captureEventHandlers).length === 0 ? this.nova.unregisterInteractiveNode(this) : this.nova.registerInteractiveNode(this);
|
|
1416
|
+
}
|
|
1417
|
+
offAll() {
|
|
1418
|
+
for (const e in this.eventHandlers)
|
|
1419
|
+
delete this.eventHandlers[e];
|
|
1420
|
+
for (const e in this.captureEventHandlers)
|
|
1421
|
+
delete this.captureEventHandlers[e];
|
|
1422
|
+
this._soundUserHandlers.clear(), this._soundEventBindings?.clear(), this.nova.unregisterInteractiveNode(this);
|
|
1423
|
+
}
|
|
1424
|
+
_installEventHandler(e, t) {
|
|
1425
|
+
const s = this._soundEventBindings?.get(e);
|
|
1426
|
+
if (!s) {
|
|
1427
|
+
t && (this.eventHandlers[e] = t), this._soundUserHandlers.delete(e);
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
this._soundUserHandlers.set(e, t), this.eventHandlers[e] = ((i, ...n) => {
|
|
1431
|
+
const a = this.nova.sound.playCue(s);
|
|
1432
|
+
a && this._trackSoundHandle(a);
|
|
1433
|
+
const o = this._soundUserHandlers.get(e);
|
|
1434
|
+
if (typeof o == "function")
|
|
1435
|
+
return o(i, ...n);
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
_trackSoundHandle(e) {
|
|
1439
|
+
this._soundHandles.add(e), e.ended.finally(() => this._soundHandles.delete(e));
|
|
1440
|
+
}
|
|
1441
|
+
_stopSoundHandles() {
|
|
1442
|
+
for (const e of [...this._soundHandles])
|
|
1443
|
+
e.stop();
|
|
1444
|
+
this._soundHandles.clear();
|
|
1445
|
+
}
|
|
1446
|
+
capturePointer(e) {
|
|
1447
|
+
this.nova.events.setPointerCapture(this, e);
|
|
1448
|
+
}
|
|
1449
|
+
releasePointerCapture(e) {
|
|
1450
|
+
this.nova.events.releasePointerCapture(this, e);
|
|
1451
|
+
}
|
|
1452
|
+
hasPointerCapture(e) {
|
|
1453
|
+
return this.nova.events.hasPointerCapture(this, e);
|
|
1454
|
+
}
|
|
1455
|
+
focus(e, t) {
|
|
1456
|
+
this.nova.events.focus(this, e, t);
|
|
1457
|
+
}
|
|
1458
|
+
blur(e, t) {
|
|
1459
|
+
this.nova.events.blur(this, e, t);
|
|
1460
|
+
}
|
|
1461
|
+
select(e, t) {
|
|
1462
|
+
this.nova.events.select(this, e, t);
|
|
1463
|
+
}
|
|
1464
|
+
deselect(e, t) {
|
|
1465
|
+
this.nova.events.deselect(this, e, t);
|
|
1466
|
+
}
|
|
1467
|
+
get focused() {
|
|
1468
|
+
return this.nova.events.focusedNode === this;
|
|
1469
|
+
}
|
|
1470
|
+
focusedIn(e) {
|
|
1471
|
+
return this.nova.events.isFocused(this, e);
|
|
1472
|
+
}
|
|
1473
|
+
get selected() {
|
|
1474
|
+
return this.nova.events.isSelected(this);
|
|
1475
|
+
}
|
|
1476
|
+
selectedIn(e) {
|
|
1477
|
+
return this.nova.events.isSelected(this, e);
|
|
1478
|
+
}
|
|
1479
|
+
//
|
|
1480
|
+
// STATE
|
|
1481
|
+
//
|
|
1482
|
+
get raph() {
|
|
1483
|
+
return super.raph;
|
|
1484
|
+
}
|
|
1485
|
+
get nova() {
|
|
1486
|
+
return this._nova;
|
|
1487
|
+
}
|
|
1488
|
+
get canvas() {
|
|
1489
|
+
return this.surface.canvas;
|
|
1490
|
+
}
|
|
1491
|
+
get surface() {
|
|
1492
|
+
return this._surface ?? this;
|
|
1493
|
+
}
|
|
1494
|
+
get renderer() {
|
|
1495
|
+
return this.surface.renderer;
|
|
1496
|
+
}
|
|
1497
|
+
get events() {
|
|
1498
|
+
return this.nova.events;
|
|
1499
|
+
}
|
|
1500
|
+
get debugger() {
|
|
1501
|
+
return this.nova.debugger;
|
|
1502
|
+
}
|
|
1503
|
+
get localActive() {
|
|
1504
|
+
return this.getLocal("localActive") ?? !0;
|
|
1505
|
+
}
|
|
1506
|
+
get localVisible() {
|
|
1507
|
+
return this.getLocal("localVisible") ?? !0;
|
|
1508
|
+
}
|
|
1509
|
+
get renderFrameDirty() {
|
|
1510
|
+
return this._renderFrameDirty;
|
|
1511
|
+
}
|
|
1512
|
+
get renderFrameRevision() {
|
|
1513
|
+
return this._renderFrameRevision;
|
|
1514
|
+
}
|
|
1515
|
+
get renderPolicy() {
|
|
1516
|
+
return this._renderPolicy;
|
|
1517
|
+
}
|
|
1518
|
+
set renderPolicy(e) {
|
|
1519
|
+
this._renderPolicy = Z(e), this.markRenderDirtyFlags({ cache: !0 }), this.markRenderFrameDirty(!0);
|
|
1520
|
+
}
|
|
1521
|
+
get renderDirtyFlags() {
|
|
1522
|
+
return { ...this._renderDirtyFlags };
|
|
1523
|
+
}
|
|
1524
|
+
get renderVersions() {
|
|
1525
|
+
return { ...this._renderVersions };
|
|
1526
|
+
}
|
|
1527
|
+
get renderNodeId() {
|
|
1528
|
+
return String(this.id ?? this.__type);
|
|
1529
|
+
}
|
|
1530
|
+
_getRenderBoundaryGroupId() {
|
|
1531
|
+
return this._renderBoundaryGroupId;
|
|
1532
|
+
}
|
|
1533
|
+
_resolveNearestRenderGroupId() {
|
|
1534
|
+
const e = this.surface;
|
|
1535
|
+
if (this._surface && this.renderPolicy.group === "always")
|
|
1536
|
+
return this._getRenderBoundaryGroupId();
|
|
1537
|
+
let t = this.parent instanceof p ? this.parent : null;
|
|
1538
|
+
for (; t && t !== e; ) {
|
|
1539
|
+
if (t.renderPolicy.group === "always")
|
|
1540
|
+
return t._getRenderBoundaryGroupId();
|
|
1541
|
+
t = t.parent instanceof p ? t.parent : null;
|
|
1542
|
+
}
|
|
1543
|
+
return e.renderLayer.rootGroup.id;
|
|
1544
|
+
}
|
|
1545
|
+
_isCoveredByRenderGroupRoots(e) {
|
|
1546
|
+
if (e.size === 0)
|
|
1547
|
+
return !1;
|
|
1548
|
+
const t = this.surface;
|
|
1549
|
+
if (this._surface && this.renderPolicy.group === "always" && e.has(this._getRenderBoundaryGroupId()))
|
|
1550
|
+
return !0;
|
|
1551
|
+
let s = this.parent instanceof p ? this.parent : null;
|
|
1552
|
+
for (; s && s !== t; ) {
|
|
1553
|
+
if (s.renderPolicy.group === "always" && e.has(s._getRenderBoundaryGroupId()))
|
|
1554
|
+
return !0;
|
|
1555
|
+
s = s.parent instanceof p ? s.parent : null;
|
|
1556
|
+
}
|
|
1557
|
+
return e.has(t.renderLayer.rootGroup.id);
|
|
1558
|
+
}
|
|
1559
|
+
_markNearestRenderGroupChildrenDirty(e = "other") {
|
|
1560
|
+
const t = this.surface;
|
|
1561
|
+
t.renderGraph.markChildrenDirty(this._resolveNearestRenderGroupId(), e), t.requestRenderGroupFrame();
|
|
1562
|
+
}
|
|
1563
|
+
get transformVersion() {
|
|
1564
|
+
return this._renderVersions.transform;
|
|
1565
|
+
}
|
|
1566
|
+
get layoutVersion() {
|
|
1567
|
+
return this._renderVersions.layout;
|
|
1568
|
+
}
|
|
1569
|
+
get paintVersion() {
|
|
1570
|
+
return this._renderVersions.paint;
|
|
1571
|
+
}
|
|
1572
|
+
get childrenVersion() {
|
|
1573
|
+
return this._renderVersions.children;
|
|
1574
|
+
}
|
|
1575
|
+
get resourceVersion() {
|
|
1576
|
+
return this._renderVersions.resource;
|
|
1577
|
+
}
|
|
1578
|
+
configureRenderPolicy(e) {
|
|
1579
|
+
return this.renderPolicy = e, this;
|
|
1580
|
+
}
|
|
1581
|
+
markRenderDirtyFlags(e) {
|
|
1582
|
+
He(this._renderDirtyFlags, e), Ge(this._renderVersions, e), (e.transform || e.layout || e.children || e.visibility) && this._markBoundsSpatialDirty(), C(this, !!(e.transform || e.layout || e.children || e.visibility));
|
|
1583
|
+
}
|
|
1584
|
+
markRenderTransformDirty() {
|
|
1585
|
+
this._renderDirtyFlags.transform = !0, this._renderVersions.transform += 1, this._markBoundsSpatialDirty(), C(this, !0);
|
|
1586
|
+
}
|
|
1587
|
+
_markBoundsSpatialDirty(e = this) {
|
|
1588
|
+
const t = this.nova.events, s = this.nova.cursors;
|
|
1589
|
+
if (!(t.interactiveNodes.size === 0 && s.cursorNodes.size === 0))
|
|
1590
|
+
for (let i = e; i; i = i.parent)
|
|
1591
|
+
i instanceof p && (t.interactiveNodes.has(i) && t.markSpatialDirty(i), s.cursorNodes.has(i) && s.markSpatialDirty(i));
|
|
1592
|
+
}
|
|
1593
|
+
clearRenderDirtyFlags() {
|
|
1594
|
+
const e = ee();
|
|
1595
|
+
Object.assign(this._renderDirtyFlags, e);
|
|
1596
|
+
}
|
|
1597
|
+
_captureRenderDirtyAcknowledgement(e) {
|
|
1598
|
+
return e ? (Object.assign(e.flags, this._renderDirtyFlags), Object.assign(e.versions, this._renderVersions), e.frameRevision = this._renderFrameRevision, e) : {
|
|
1599
|
+
flags: { ...this._renderDirtyFlags },
|
|
1600
|
+
versions: { ...this._renderVersions },
|
|
1601
|
+
frameRevision: this._renderFrameRevision
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1604
|
+
_hasRenderContentDirty() {
|
|
1605
|
+
return this._renderDirtyFlags.layout || this._renderDirtyFlags.paint || this._renderDirtyFlags.resource;
|
|
1606
|
+
}
|
|
1607
|
+
_hasRenderContentDirtyAncestor() {
|
|
1608
|
+
const e = this.surface;
|
|
1609
|
+
let t = this.parent instanceof p ? this.parent : null;
|
|
1610
|
+
for (; t && t !== e; ) {
|
|
1611
|
+
if (t._hasRenderContentDirty())
|
|
1612
|
+
return !0;
|
|
1613
|
+
t = t.parent instanceof p ? t.parent : null;
|
|
1614
|
+
}
|
|
1615
|
+
return !1;
|
|
1616
|
+
}
|
|
1617
|
+
_isRenderSubtreeClean() {
|
|
1618
|
+
const e = [this];
|
|
1619
|
+
for (; e.length > 0; ) {
|
|
1620
|
+
const t = e.pop(), s = t._renderDirtyFlags;
|
|
1621
|
+
if (t._renderFrameDirty || s.transform || s.layout || s.paint || s.children || s.resource || s.cache || s.visibility)
|
|
1622
|
+
return !1;
|
|
1623
|
+
for (const i of t.children)
|
|
1624
|
+
i instanceof p && e.push(i);
|
|
1625
|
+
}
|
|
1626
|
+
return !0;
|
|
1627
|
+
}
|
|
1628
|
+
_commitRenderDirtyAcknowledgement(e) {
|
|
1629
|
+
for (const t of Object.keys(e.flags))
|
|
1630
|
+
e.flags[t] && this._renderVersions[t] === e.versions[t] && (this._renderDirtyFlags[t] = !1);
|
|
1631
|
+
this._renderFrameRevision === e.frameRevision && (this._renderFrameDirty = !1);
|
|
1632
|
+
}
|
|
1633
|
+
get lifecycleState() {
|
|
1634
|
+
return this._lifecycleState;
|
|
1635
|
+
}
|
|
1636
|
+
markRenderFrameDirty(e = !1) {
|
|
1637
|
+
const t = this._surface, s = t?.renderGraph, i = t ? this._resolveNearestRenderGroupId() : void 0;
|
|
1638
|
+
let n = t !== void 0 && s !== void 0 && i !== void 0 && this._lifecycleState === "mounted" && t.renderCullingMode === "off" && t.captureContext === void 0 && i !== t.renderLayer.rootGroup.id && s.groupsById.has(i) && s.groupByNodeId.get(this.renderNodeId)?.id === i;
|
|
1639
|
+
const a = this._renderDirtyFlags;
|
|
1640
|
+
n &&= this._layoutReady && !a.layout && !a.visibility && !this._renderClip && !this._composition && !this._alphaMask && this._effects.length === 0 && this.renderPolicy.cache !== "texture";
|
|
1641
|
+
let o = a.paint;
|
|
1642
|
+
for (let h = this.parent instanceof p ? this.parent : null; n && h && h !== t; h = h.parent instanceof p ? h.parent : null) {
|
|
1643
|
+
const l = h._renderDirtyFlags;
|
|
1644
|
+
o ||= l.paint, (!h._layoutReady || l.layout || l.visibility || h._renderClip || h._composition || h._alphaMask || h._effects.length > 0 || h.renderPolicy.cache === "texture") && (n = !1);
|
|
1645
|
+
}
|
|
1646
|
+
n &&= o, this._requestRenderFrame(), n && t && t.requestRenderGroupFrame();
|
|
1647
|
+
let c = n && this._getRenderBoundaryGroupId() === i ? null : this.parent;
|
|
1648
|
+
for (; c instanceof p && (c._requestRenderFrame(), !(n && c._getRenderBoundaryGroupId() === i)); )
|
|
1649
|
+
c = c.parent;
|
|
1650
|
+
if (e)
|
|
1651
|
+
for (const h of this.children)
|
|
1652
|
+
h instanceof p && h.markRenderFrameDirty(!0);
|
|
1653
|
+
C(this, e);
|
|
1654
|
+
}
|
|
1655
|
+
markRenderFrameClean(e = !1) {
|
|
1656
|
+
if (this._renderFrameDirty = !1, this.clearRenderDirtyFlags(), !!e)
|
|
1657
|
+
for (const t of this.children)
|
|
1658
|
+
t instanceof p && t.markRenderFrameClean(!0);
|
|
1659
|
+
}
|
|
1660
|
+
_bumpRenderFrameRevision() {
|
|
1661
|
+
this._renderFrameRevision = this._renderFrameRevision === Number.MAX_SAFE_INTEGER ? 1 : this._renderFrameRevision + 1;
|
|
1662
|
+
}
|
|
1663
|
+
_requestRenderFrame() {
|
|
1664
|
+
this._renderFrameDirty = !0, this._bumpRenderFrameRevision();
|
|
1665
|
+
}
|
|
1666
|
+
setScale(e, t) {
|
|
1667
|
+
this.scaleX === e && this.scaleY === t || (this.scaleX = e, this.scaleY = t);
|
|
1668
|
+
}
|
|
1669
|
+
setRotation(e) {
|
|
1670
|
+
this.rotation !== e && (this.rotation = e);
|
|
1671
|
+
}
|
|
1672
|
+
_getInverseMatrix() {
|
|
1673
|
+
const e = this.matrix;
|
|
1674
|
+
if (this._inverseMatrixSource === e)
|
|
1675
|
+
return this._inverseMatrix;
|
|
1676
|
+
if (G.invert(this._inverseMatrix, e))
|
|
1677
|
+
return this._inverseMatrixSource = e, this._inverseMatrix;
|
|
1678
|
+
}
|
|
1679
|
+
setPosition(e, t) {
|
|
1680
|
+
this.x === e && this.y === t || (this.x = e, this.y = t);
|
|
1681
|
+
}
|
|
1682
|
+
setSize(e, t) {
|
|
1683
|
+
this.width === e && this.height === t || (this.width = e, this.height = t);
|
|
1684
|
+
}
|
|
1685
|
+
_resolveInjectedValue(e) {
|
|
1686
|
+
const t = this._injectCache?.get(e);
|
|
1687
|
+
if (t && t.scopeVersion === this.nova.contextVersion && t.provider._providerVersion === t.providerVersion)
|
|
1688
|
+
return {
|
|
1689
|
+
found: !0,
|
|
1690
|
+
value: t.value
|
|
1691
|
+
};
|
|
1692
|
+
let s = this.parent;
|
|
1693
|
+
for (; s; ) {
|
|
1694
|
+
if (s instanceof p && s._provides?.has(e)) {
|
|
1695
|
+
const i = s._provides.get(e);
|
|
1696
|
+
return this._cacheInjectedValue(e, {
|
|
1697
|
+
provider: s,
|
|
1698
|
+
providerVersion: s._providerVersion,
|
|
1699
|
+
scopeVersion: this.nova.contextVersion,
|
|
1700
|
+
value: i
|
|
1701
|
+
}), {
|
|
1702
|
+
found: !0,
|
|
1703
|
+
value: i
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
s = s.parent;
|
|
1707
|
+
}
|
|
1708
|
+
return this._injectCache?.delete(e), { found: !1 };
|
|
1709
|
+
}
|
|
1710
|
+
_cacheInjectedValue(e, t) {
|
|
1711
|
+
this._injectCache || (this._injectCache = /* @__PURE__ */ new Map()), this._injectCache.set(e, t);
|
|
1712
|
+
}
|
|
1713
|
+
_clearInjectCacheDeep() {
|
|
1714
|
+
const e = [this];
|
|
1715
|
+
for (; e.length > 0; ) {
|
|
1716
|
+
const t = e.pop();
|
|
1717
|
+
t._injectCache?.clear();
|
|
1718
|
+
for (const s of t.children)
|
|
1719
|
+
s instanceof p && e.push(s);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
_runDisposers() {
|
|
1723
|
+
if (this._disposers.length === 0)
|
|
1724
|
+
return;
|
|
1725
|
+
const e = this._disposers.splice(0);
|
|
1726
|
+
let t;
|
|
1727
|
+
for (const s of e)
|
|
1728
|
+
try {
|
|
1729
|
+
s();
|
|
1730
|
+
} catch (i) {
|
|
1731
|
+
(t ??= []).push(i);
|
|
1732
|
+
}
|
|
1733
|
+
if (t?.length === 1)
|
|
1734
|
+
throw t[0];
|
|
1735
|
+
if (t && t.length > 1)
|
|
1736
|
+
throw new AggregateError(t, "[Nova] Node disposers failed");
|
|
1737
|
+
}
|
|
1738
|
+
_disposeReactiveStoreObservers() {
|
|
1739
|
+
if (this._reactiveStoreObservers) {
|
|
1740
|
+
for (const e of this._reactiveStoreObservers.values()) {
|
|
1741
|
+
for (const t of e.values())
|
|
1742
|
+
t();
|
|
1743
|
+
e.clear();
|
|
1744
|
+
}
|
|
1745
|
+
this._reactiveStoreObservers.clear();
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
dispose() {
|
|
1749
|
+
if (this._lifecycleState === "destroyed")
|
|
1750
|
+
return;
|
|
1751
|
+
let e;
|
|
1752
|
+
const t = (o) => {
|
|
1753
|
+
try {
|
|
1754
|
+
o();
|
|
1755
|
+
} catch (c) {
|
|
1756
|
+
(e ??= []).push(c);
|
|
1757
|
+
}
|
|
1758
|
+
}, s = this._releaseEffectParameters;
|
|
1759
|
+
this._releaseEffectParameters = null, t(() => s?.());
|
|
1760
|
+
const i = this.parent, n = i instanceof p ? i : void 0;
|
|
1761
|
+
t(() => n?._markNearestRenderGroupChildrenDirty()), t(() => this.clearSemantic()), t(() => this._clearSchemaSemantics()), t(() => this.nova.motion.cancel(this)), t(() => this._stopSoundHandles()), t(() => this._unmountSubtree()), t(() => this._disposeReactiveStoreObservers()), t(() => this._runDisposers());
|
|
1762
|
+
const a = this.parent;
|
|
1763
|
+
if (t(() => super.dispose()), t(() => this._markBoundsSpatialDirty(i)), a !== i && t(() => this._markBoundsSpatialDirty(a)), t(() => this.offAll()), this._orderedChildren.length = 0, this._provides?.clear(), this._injectCache?.clear(), this._nodeContext = void 0, this._hasNodeContext = !1, this._inverseMatrixSource = void 0, this._renderFrameDirty = !0, this._lifecycleState = "destroyed", this._effects = L, this._alphaMask = null, this._composition = null, this._renderClip = null, t(() => this.nova.events.markSpatialDirty(this, !0)), t(() => this.nova.cursors.unregister(this)), t(() => C(this, !0, n)), e?.length === 1)
|
|
1764
|
+
throw e[0];
|
|
1765
|
+
if (e && e.length > 1)
|
|
1766
|
+
throw new AggregateError(e, "[Nova] Node disposal failed");
|
|
1767
|
+
}
|
|
1768
|
+
renderSchema(e) {
|
|
1769
|
+
this.surface.captureContext || (this.setRenderBoundsFromSchema(e), this._syncSchemaSemantics(e)), this.renderer.schema(e);
|
|
1770
|
+
}
|
|
1771
|
+
renderSchemaOrdered(e) {
|
|
1772
|
+
this.surface.captureContext || (this.setRenderBoundsFromSchema(e), this._syncSchemaSemantics(e)), this.renderer.schema(e);
|
|
1773
|
+
}
|
|
1774
|
+
_syncSchemaSemantics(e) {
|
|
1775
|
+
const t = `schema:${this.renderNodeId}`, s = [];
|
|
1776
|
+
if (e.forEach((i, n) => {
|
|
1777
|
+
if (i.active === !1 || i.semantic === !1 || !i.semantic)
|
|
1778
|
+
return;
|
|
1779
|
+
const a = i.semantic.bounds ?? ae(i, this.nova.schema);
|
|
1780
|
+
a && s.push({
|
|
1781
|
+
...i.semantic,
|
|
1782
|
+
id: i.semantic.id ?? `${t}:${n}`,
|
|
1783
|
+
bounds: V(a, this.matrix),
|
|
1784
|
+
source: {
|
|
1785
|
+
...i.semantic.source,
|
|
1786
|
+
type: i.semantic.source?.type ?? "schema",
|
|
1787
|
+
nodeId: this.renderNodeId
|
|
1788
|
+
}
|
|
1789
|
+
});
|
|
1790
|
+
}), s.length === 0) {
|
|
1791
|
+
this._clearSchemaSemantics();
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
this._schemaSemanticSourceKey = t, this.nova.semantics.syncSource(t, s);
|
|
1795
|
+
}
|
|
1796
|
+
_clearSchemaSemantics() {
|
|
1797
|
+
this._schemaSemanticSourceKey && (this.nova.semantics.clearSource(this._schemaSemanticSourceKey), this._schemaSemanticSourceKey = void 0);
|
|
1798
|
+
}
|
|
1799
|
+
_markSpatialDirtyForOptions(e) {
|
|
1800
|
+
const t = e.x !== void 0 || e.y !== void 0 || e.scaleX !== void 0 || e.scaleY !== void 0 || e.rotation !== void 0 || e.active !== void 0 || e.visible !== void 0;
|
|
1801
|
+
this.nova.events.markSpatialDirty(this, t), this.nova.cursors.markSpatialDirty(this, t);
|
|
1802
|
+
}
|
|
1803
|
+
_syncCursorRegistration() {
|
|
1804
|
+
if (this.getLocal("cursor")) {
|
|
1805
|
+
this.nova.cursors.register(this);
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
this.nova.cursors.unregister(this);
|
|
1809
|
+
}
|
|
1810
|
+
remove() {
|
|
1811
|
+
const e = this.parent;
|
|
1812
|
+
this.dispose(), e instanceof p && !e.runtime.disposed && e.invalidate({ render: !0 });
|
|
1813
|
+
}
|
|
1814
|
+
renderChildren() {
|
|
1815
|
+
this._orderedChildren.length = 0;
|
|
1816
|
+
for (const e of this.children)
|
|
1817
|
+
e instanceof p && this._orderedChildren.push(e);
|
|
1818
|
+
this._orderedChildren.sort((e, t) => {
|
|
1819
|
+
const s = e.weight - t.weight;
|
|
1820
|
+
return s !== 0 ? s : this._renderOrderOf(e) - this._renderOrderOf(t);
|
|
1821
|
+
});
|
|
1822
|
+
for (const e of this._orderedChildren)
|
|
1823
|
+
e.doRender();
|
|
1824
|
+
}
|
|
1825
|
+
_resolveNodeAwareRenderer() {
|
|
1826
|
+
const e = this.renderer;
|
|
1827
|
+
return typeof e.beginNode == "function" && typeof e.endNode == "function" ? e : null;
|
|
1828
|
+
}
|
|
1829
|
+
addChild(e, t = {}) {
|
|
1830
|
+
return this._attachNovaChild(e, t, !0);
|
|
1831
|
+
}
|
|
1832
|
+
reorderChildren(e) {
|
|
1833
|
+
const t = this.children;
|
|
1834
|
+
e.length === t.length && e.every((s, i) => s === t[i]) || this.runtime.batch(() => {
|
|
1835
|
+
super.reorderChildren(e);
|
|
1836
|
+
for (const s of e)
|
|
1837
|
+
s instanceof p && this._renderOrder.set(s, this._renderOrderCounter++);
|
|
1838
|
+
this.markRenderDirtyFlags({ children: !0, cache: !0 }), this._markNearestRenderGroupChildrenDirty(), this.invalidate({ render: !0 });
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
/**
|
|
1842
|
+
* Attaches a child for Nova-owned batch builders.
|
|
1843
|
+
* @internal
|
|
1844
|
+
*/
|
|
1845
|
+
_attachNovaChild(e, t = {}, s = !0) {
|
|
1846
|
+
if (e instanceof p && !e._surface && e.nova.surfaces.includes(e))
|
|
1847
|
+
throw new Error("[Nova] An app surface cannot become a scene child");
|
|
1848
|
+
return e instanceof p && e._surface && e.surface !== this.surface ? this.runtime.batch(() => this._attachNovaChildWithOwner(e, t, s)) : this._attachNovaChildWithOwner(e, t, s);
|
|
1849
|
+
}
|
|
1850
|
+
_attachNovaChildWithOwner(e, t, s) {
|
|
1851
|
+
const i = e.parent, n = i instanceof p ? i : void 0, a = e instanceof p ? e._surface : void 0, o = a !== void 0 && a !== this.surface, c = n !== void 0 && n !== this && e instanceof p && e.surface === this.surface, { context: h } = t, l = Object.hasOwn(t, "context");
|
|
1852
|
+
if (e instanceof p) {
|
|
1853
|
+
if (e.lifecycleState === "destroyed")
|
|
1854
|
+
throw new Error("Нельзя повторно добавить уничтоженную Nova-ноду");
|
|
1855
|
+
l && !o && e.setContext(h), o || e._clearInjectCacheDeep(), i !== this && this._renderOrder.set(e, this._renderOrderCounter++);
|
|
1856
|
+
}
|
|
1857
|
+
s && (i !== this || l) && (n && n !== this && (n.markRenderDirtyFlags({ children: !0, cache: !0 }), n._markNearestRenderGroupChildrenDirty(c ? "reparent" : "other")), this.markRenderDirtyFlags({ children: !0, cache: !0 }), this._markNearestRenderGroupChildrenDirty(c ? "reparent" : "other"));
|
|
1858
|
+
let m = !1, _;
|
|
1859
|
+
try {
|
|
1860
|
+
m = super._attachRaphChild(e, s);
|
|
1861
|
+
} catch (v) {
|
|
1862
|
+
(_ ??= []).push(v);
|
|
1863
|
+
} finally {
|
|
1864
|
+
if (o && e instanceof p && e.parent === this)
|
|
1865
|
+
try {
|
|
1866
|
+
l && e.setContext(h), e._clearInjectCacheDeep(), e._rebindSurfaceSubtree(this.surface, a);
|
|
1867
|
+
} catch (v) {
|
|
1868
|
+
(_ ??= []).push(v);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
if (_?.length)
|
|
1872
|
+
throw _.length === 1 ? _[0] : new AggregateError(_, "[Nova] Child attach and surface ownership refresh failed");
|
|
1873
|
+
return m && i !== this && (e instanceof p && C(e), i && (!s || !n) && this._markBoundsSpatialDirty(i), s || this._markBoundsSpatialDirty()), m && s && c && e instanceof p && n && this.surface.renderGraph.recordReparent(e, n, this), i instanceof p && i !== this && s && !c && i.invalidate({ render: !0 }), e instanceof p && ((this._lifecycleState === "mounted" || this._lifecycleState === "paused") && e.mountSubtree(), this._lifecycleState === "paused" && e.pause(), this.nova.events.markSpatialDirty(e, !0), this.nova.cursors.markSpatialDirty(e, !0)), m;
|
|
1874
|
+
}
|
|
1875
|
+
_rebindSurfaceSubtree(e, t) {
|
|
1876
|
+
const s = [], i = [this];
|
|
1877
|
+
let n;
|
|
1878
|
+
for (; i.length; ) {
|
|
1879
|
+
const a = i.pop();
|
|
1880
|
+
a instanceof p && (a._surface = e, a._injectCache?.clear(), s.push(a));
|
|
1881
|
+
for (const o of a.children)
|
|
1882
|
+
i.push(o);
|
|
1883
|
+
}
|
|
1884
|
+
for (const a of s) {
|
|
1885
|
+
const o = a._reactiveStoreObservers?.get("render");
|
|
1886
|
+
if (o)
|
|
1887
|
+
for (const [c, h] of o) {
|
|
1888
|
+
try {
|
|
1889
|
+
h();
|
|
1890
|
+
} catch (l) {
|
|
1891
|
+
(n ??= []).push(l);
|
|
1892
|
+
}
|
|
1893
|
+
try {
|
|
1894
|
+
o.set(c, a._createReactiveStoreObserver(c, "render"));
|
|
1895
|
+
} catch (l) {
|
|
1896
|
+
o.delete(c), (n ??= []).push(l);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
for (const a of [t, e]) {
|
|
1901
|
+
try {
|
|
1902
|
+
a.markRenderFrameDirty();
|
|
1903
|
+
} catch (o) {
|
|
1904
|
+
(n ??= []).push(o);
|
|
1905
|
+
}
|
|
1906
|
+
try {
|
|
1907
|
+
a.invalidate({ render: !0, flush: !0 });
|
|
1908
|
+
} catch (o) {
|
|
1909
|
+
(n ??= []).push(o);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
for (const a of s)
|
|
1913
|
+
try {
|
|
1914
|
+
C(a, !0);
|
|
1915
|
+
} catch (o) {
|
|
1916
|
+
(n ??= []).push(o);
|
|
1917
|
+
}
|
|
1918
|
+
if (n?.length)
|
|
1919
|
+
throw new AggregateError(n, "[Nova] Surface ownership refresh failed");
|
|
1920
|
+
}
|
|
1921
|
+
_ensureRenderOrder(e) {
|
|
1922
|
+
this._renderOrder.has(e) || this._renderOrder.set(e, this._renderOrderCounter++);
|
|
1923
|
+
}
|
|
1924
|
+
_renderOrderOf(e) {
|
|
1925
|
+
return this._ensureRenderOrder(e), this._renderOrder.get(e);
|
|
1926
|
+
}
|
|
1927
|
+
renderOrderIndexOf(e) {
|
|
1928
|
+
return this._renderOrderOf(e);
|
|
1929
|
+
}
|
|
1930
|
+
mountSubtree() {
|
|
1931
|
+
if (this._lifecycleState === "destroyed")
|
|
1932
|
+
throw new Error("Нельзя смонтировать уничтоженную Nova-ноду");
|
|
1933
|
+
if (!(this._lifecycleState === "mounted" || this._lifecycleState === "paused")) {
|
|
1934
|
+
this._lifecycleState = "mounted", this.onMount();
|
|
1935
|
+
for (const e of this.children)
|
|
1936
|
+
e instanceof p && e.mountSubtree();
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
pause() {
|
|
1940
|
+
if (this._lifecycleState !== "mounted")
|
|
1941
|
+
return this;
|
|
1942
|
+
this._lifecycleState = "paused", this.onPause();
|
|
1943
|
+
for (const e of this.children)
|
|
1944
|
+
e instanceof p && e.pause();
|
|
1945
|
+
return this;
|
|
1946
|
+
}
|
|
1947
|
+
resume() {
|
|
1948
|
+
if (this._lifecycleState !== "paused")
|
|
1949
|
+
return this;
|
|
1950
|
+
this._lifecycleState = "mounted", this.onResume();
|
|
1951
|
+
for (const e of this.children)
|
|
1952
|
+
e instanceof p && e.resume();
|
|
1953
|
+
return this.invalidate({ update: !0, matrix: !0, render: !0 }), this;
|
|
1954
|
+
}
|
|
1955
|
+
_unmountSubtree() {
|
|
1956
|
+
if (!(this._lifecycleState === "created" || this._lifecycleState === "destroyed")) {
|
|
1957
|
+
for (const e of this.children)
|
|
1958
|
+
e instanceof p && e._unmountSubtree();
|
|
1959
|
+
this.onUnmount(), this._lifecycleState = "created";
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
onMount() {
|
|
1963
|
+
}
|
|
1964
|
+
onUnmount() {
|
|
1965
|
+
}
|
|
1966
|
+
onPause() {
|
|
1967
|
+
}
|
|
1968
|
+
onResume() {
|
|
1969
|
+
}
|
|
1970
|
+
//
|
|
1971
|
+
// ЛОГИКА ДОЧЕРНИХ ЭЛЕМЕНТОВ
|
|
1972
|
+
//
|
|
1973
|
+
render() {
|
|
1974
|
+
}
|
|
1975
|
+
getRenderRetentionKey() {
|
|
1976
|
+
}
|
|
1977
|
+
update() {
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
const Ke = p.prototype.getLocalBounds, Je = p.prototype.getLocalRenderBounds;
|
|
1981
|
+
export {
|
|
1982
|
+
Ve as A,
|
|
1983
|
+
it as B,
|
|
1984
|
+
N as C,
|
|
1985
|
+
Q as D,
|
|
1986
|
+
C as E,
|
|
1987
|
+
p as N,
|
|
1988
|
+
ct as R,
|
|
1989
|
+
ht as S,
|
|
1990
|
+
Ne as a,
|
|
1991
|
+
z as b,
|
|
1992
|
+
se as c,
|
|
1993
|
+
Ge as d,
|
|
1994
|
+
ee as e,
|
|
1995
|
+
ot as f,
|
|
1996
|
+
ze as g,
|
|
1997
|
+
ie as h,
|
|
1998
|
+
dt as i,
|
|
1999
|
+
je as j,
|
|
2000
|
+
ut as k,
|
|
2001
|
+
lt as l,
|
|
2002
|
+
He as m,
|
|
2003
|
+
Ue as n,
|
|
2004
|
+
Z as o,
|
|
2005
|
+
nt as p,
|
|
2006
|
+
Le as q,
|
|
2007
|
+
he as r,
|
|
2008
|
+
at as s,
|
|
2009
|
+
Ce as t,
|
|
2010
|
+
ae as u,
|
|
2011
|
+
ft as v,
|
|
2012
|
+
pt as w,
|
|
2013
|
+
st as x,
|
|
2014
|
+
Pe as y,
|
|
2015
|
+
rt as z
|
|
2016
|
+
};
|