@solidtv/renderer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +7 -0
- package/README.md +137 -0
- package/dist/exports/canvas-shaders.d.ts +10 -0
- package/dist/exports/canvas-shaders.js +11 -0
- package/dist/exports/canvas-shaders.js.map +1 -0
- package/dist/exports/canvas.d.ts +26 -0
- package/dist/exports/canvas.js +27 -0
- package/dist/exports/canvas.js.map +1 -0
- package/dist/exports/index.d.ts +50 -0
- package/dist/exports/index.js +40 -0
- package/dist/exports/index.js.map +1 -0
- package/dist/exports/inspector.d.ts +4 -0
- package/dist/exports/inspector.js +5 -0
- package/dist/exports/inspector.js.map +1 -0
- package/dist/exports/utils.d.ts +27 -0
- package/dist/exports/utils.js +28 -0
- package/dist/exports/utils.js.map +1 -0
- package/dist/exports/webgl-shaders.d.ts +11 -0
- package/dist/exports/webgl-shaders.js +12 -0
- package/dist/exports/webgl-shaders.js.map +1 -0
- package/dist/exports/webgl.d.ts +28 -0
- package/dist/exports/webgl.js +29 -0
- package/dist/exports/webgl.js.map +1 -0
- package/dist/src/common/CommonTypes.d.ts +110 -0
- package/dist/src/common/CommonTypes.js +2 -0
- package/dist/src/common/CommonTypes.js.map +1 -0
- package/dist/src/common/EventEmitter.d.ts +12 -0
- package/dist/src/common/EventEmitter.js +48 -0
- package/dist/src/common/EventEmitter.js.map +1 -0
- package/dist/src/common/IAnimationController.d.ts +58 -0
- package/dist/src/common/IAnimationController.js +2 -0
- package/dist/src/common/IAnimationController.js.map +1 -0
- package/dist/src/common/IEventEmitter.d.ts +8 -0
- package/dist/src/common/IEventEmitter.js +2 -0
- package/dist/src/common/IEventEmitter.js.map +1 -0
- package/dist/src/core/Autosizer.d.ts +35 -0
- package/dist/src/core/Autosizer.js +178 -0
- package/dist/src/core/Autosizer.js.map +1 -0
- package/dist/src/core/CoreNode.d.ts +908 -0
- package/dist/src/core/CoreNode.js +1837 -0
- package/dist/src/core/CoreNode.js.map +1 -0
- package/dist/src/core/CoreShaderManager.d.ts +38 -0
- package/dist/src/core/CoreShaderManager.js +123 -0
- package/dist/src/core/CoreShaderManager.js.map +1 -0
- package/dist/src/core/CoreTextNode.d.ts +91 -0
- package/dist/src/core/CoreTextNode.js +440 -0
- package/dist/src/core/CoreTextNode.js.map +1 -0
- package/dist/src/core/CoreTextureManager.d.ts +264 -0
- package/dist/src/core/CoreTextureManager.js +318 -0
- package/dist/src/core/CoreTextureManager.js.map +1 -0
- package/dist/src/core/Stage.d.ts +238 -0
- package/dist/src/core/Stage.js +804 -0
- package/dist/src/core/Stage.js.map +1 -0
- package/dist/src/core/TextureError.d.ts +11 -0
- package/dist/src/core/TextureError.js +37 -0
- package/dist/src/core/TextureError.js.map +1 -0
- package/dist/src/core/TextureMemoryManager.d.ts +150 -0
- package/dist/src/core/TextureMemoryManager.js +239 -0
- package/dist/src/core/TextureMemoryManager.js.map +1 -0
- package/dist/src/core/animations/AnimationManager.d.ts +33 -0
- package/dist/src/core/animations/AnimationManager.js +137 -0
- package/dist/src/core/animations/AnimationManager.js.map +1 -0
- package/dist/src/core/animations/CoreAnimation.d.ts +12 -0
- package/dist/src/core/animations/CoreAnimation.js +107 -0
- package/dist/src/core/animations/CoreAnimation.js.map +1 -0
- package/dist/src/core/lib/ContextSpy.d.ts +12 -0
- package/dist/src/core/lib/ContextSpy.js +20 -0
- package/dist/src/core/lib/ContextSpy.js.map +1 -0
- package/dist/src/core/lib/ImageWorker.d.ts +16 -0
- package/dist/src/core/lib/ImageWorker.js +202 -0
- package/dist/src/core/lib/ImageWorker.js.map +1 -0
- package/dist/src/core/lib/Matrix3d.d.ts +74 -0
- package/dist/src/core/lib/Matrix3d.js +218 -0
- package/dist/src/core/lib/Matrix3d.js.map +1 -0
- package/dist/src/core/lib/RenderCoords.d.ts +12 -0
- package/dist/src/core/lib/RenderCoords.js +35 -0
- package/dist/src/core/lib/RenderCoords.js.map +1 -0
- package/dist/src/core/lib/WebGlContextWrapper.d.ts +782 -0
- package/dist/src/core/lib/WebGlContextWrapper.js +1143 -0
- package/dist/src/core/lib/WebGlContextWrapper.js.map +1 -0
- package/dist/src/core/lib/collectionUtils.d.ts +5 -0
- package/dist/src/core/lib/collectionUtils.js +82 -0
- package/dist/src/core/lib/collectionUtils.js.map +1 -0
- package/dist/src/core/lib/colorCache.d.ts +1 -0
- package/dist/src/core/lib/colorCache.js +19 -0
- package/dist/src/core/lib/colorCache.js.map +1 -0
- package/dist/src/core/lib/colorParser.d.ts +21 -0
- package/dist/src/core/lib/colorParser.js +54 -0
- package/dist/src/core/lib/colorParser.js.map +1 -0
- package/dist/src/core/lib/textureCompression.d.ts +28 -0
- package/dist/src/core/lib/textureCompression.js +363 -0
- package/dist/src/core/lib/textureCompression.js.map +1 -0
- package/dist/src/core/lib/textureSvg.d.ts +16 -0
- package/dist/src/core/lib/textureSvg.js +45 -0
- package/dist/src/core/lib/textureSvg.js.map +1 -0
- package/dist/src/core/lib/utils.d.ts +66 -0
- package/dist/src/core/lib/utils.js +268 -0
- package/dist/src/core/lib/utils.js.map +1 -0
- package/dist/src/core/lib/validateImageBitmap.d.ts +7 -0
- package/dist/src/core/lib/validateImageBitmap.js +68 -0
- package/dist/src/core/lib/validateImageBitmap.js.map +1 -0
- package/dist/src/core/platforms/Platform.d.ts +42 -0
- package/dist/src/core/platforms/Platform.js +4 -0
- package/dist/src/core/platforms/Platform.js.map +1 -0
- package/dist/src/core/platforms/web/WebPlatform.d.ts +10 -0
- package/dist/src/core/platforms/web/WebPlatform.js +90 -0
- package/dist/src/core/platforms/web/WebPlatform.js.map +1 -0
- package/dist/src/core/renderers/CoreContextTexture.d.ts +13 -0
- package/dist/src/core/renderers/CoreContextTexture.js +16 -0
- package/dist/src/core/renderers/CoreContextTexture.js.map +1 -0
- package/dist/src/core/renderers/CoreRenderOp.d.ts +3 -0
- package/dist/src/core/renderers/CoreRenderOp.js +3 -0
- package/dist/src/core/renderers/CoreRenderOp.js.map +1 -0
- package/dist/src/core/renderers/CoreRenderer.d.ts +81 -0
- package/dist/src/core/renderers/CoreRenderer.js +14 -0
- package/dist/src/core/renderers/CoreRenderer.js.map +1 -0
- package/dist/src/core/renderers/CoreShaderNode.d.ts +69 -0
- package/dist/src/core/renderers/CoreShaderNode.js +130 -0
- package/dist/src/core/renderers/CoreShaderNode.js.map +1 -0
- package/dist/src/core/renderers/CoreShaderProgram.d.ts +4 -0
- package/dist/src/core/renderers/CoreShaderProgram.js +2 -0
- package/dist/src/core/renderers/CoreShaderProgram.js.map +1 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +36 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.js +221 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -0
- package/dist/src/core/renderers/canvas/CanvasShaderNode.d.ts +21 -0
- package/dist/src/core/renderers/canvas/CanvasShaderNode.js +42 -0
- package/dist/src/core/renderers/canvas/CanvasShaderNode.js.map +1 -0
- package/dist/src/core/renderers/canvas/CanvasTexture.d.ts +17 -0
- package/dist/src/core/renderers/canvas/CanvasTexture.js +110 -0
- package/dist/src/core/renderers/canvas/CanvasTexture.js.map +1 -0
- package/dist/src/core/renderers/webgl/SdfRenderOp.d.ts +41 -0
- package/dist/src/core/renderers/webgl/SdfRenderOp.js +88 -0
- package/dist/src/core/renderers/webgl/SdfRenderOp.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.d.ts +14 -0
- package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js +45 -0
- package/dist/src/core/renderers/webgl/WebGlCtxRenderTexture.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.d.ts +22 -0
- package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js +49 -0
- package/dist/src/core/renderers/webgl/WebGlCtxSubTexture.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.d.ts +67 -0
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.js +259 -0
- package/dist/src/core/renderers/webgl/WebGlCtxTexture.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +221 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.js +1015 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlShaderNode.d.ts +213 -0
- package/dist/src/core/renderers/webgl/WebGlShaderNode.js +331 -0
- package/dist/src/core/renderers/webgl/WebGlShaderNode.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.d.ts +37 -0
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +240 -0
- package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +1 -0
- package/dist/src/core/renderers/webgl/internal/BufferCollection.d.ts +28 -0
- package/dist/src/core/renderers/webgl/internal/BufferCollection.js +39 -0
- package/dist/src/core/renderers/webgl/internal/BufferCollection.js.map +1 -0
- package/dist/src/core/renderers/webgl/internal/RendererUtils.d.ts +55 -0
- package/dist/src/core/renderers/webgl/internal/RendererUtils.js +88 -0
- package/dist/src/core/renderers/webgl/internal/RendererUtils.js.map +1 -0
- package/dist/src/core/renderers/webgl/internal/ShaderUtils.d.ts +74 -0
- package/dist/src/core/renderers/webgl/internal/ShaderUtils.js +83 -0
- package/dist/src/core/renderers/webgl/internal/ShaderUtils.js.map +1 -0
- package/dist/src/core/renderers/webgl/internal/WebGlUtils.d.ts +10 -0
- package/dist/src/core/renderers/webgl/internal/WebGlUtils.js +13 -0
- package/dist/src/core/renderers/webgl/internal/WebGlUtils.js.map +1 -0
- package/dist/src/core/shaders/canvas/Border.d.ts +15 -0
- package/dist/src/core/shaders/canvas/Border.js +83 -0
- package/dist/src/core/shaders/canvas/Border.js.map +1 -0
- package/dist/src/core/shaders/canvas/HolePunch.d.ts +7 -0
- package/dist/src/core/shaders/canvas/HolePunch.js +22 -0
- package/dist/src/core/shaders/canvas/HolePunch.js.map +1 -0
- package/dist/src/core/shaders/canvas/LinearGradient.d.ts +10 -0
- package/dist/src/core/shaders/canvas/LinearGradient.js +32 -0
- package/dist/src/core/shaders/canvas/LinearGradient.js.map +1 -0
- package/dist/src/core/shaders/canvas/RadialGradient.d.ts +11 -0
- package/dist/src/core/shaders/canvas/RadialGradient.js +54 -0
- package/dist/src/core/shaders/canvas/RadialGradient.js.map +1 -0
- package/dist/src/core/shaders/canvas/Rounded.d.ts +7 -0
- package/dist/src/core/shaders/canvas/Rounded.js +17 -0
- package/dist/src/core/shaders/canvas/Rounded.js.map +1 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorder.d.ts +10 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorder.js +57 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorder.js.map +1 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.d.ts +7 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js +61 -0
- package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js.map +1 -0
- package/dist/src/core/shaders/canvas/RoundedWithShadow.d.ts +7 -0
- package/dist/src/core/shaders/canvas/RoundedWithShadow.js +26 -0
- package/dist/src/core/shaders/canvas/RoundedWithShadow.js.map +1 -0
- package/dist/src/core/shaders/canvas/Shadow.d.ts +8 -0
- package/dist/src/core/shaders/canvas/Shadow.js +15 -0
- package/dist/src/core/shaders/canvas/Shadow.js.map +1 -0
- package/dist/src/core/shaders/canvas/utils/render.d.ts +5 -0
- package/dist/src/core/shaders/canvas/utils/render.js +81 -0
- package/dist/src/core/shaders/canvas/utils/render.js.map +1 -0
- package/dist/src/core/shaders/templates/BorderTemplate.d.ts +47 -0
- package/dist/src/core/shaders/templates/BorderTemplate.js +77 -0
- package/dist/src/core/shaders/templates/BorderTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/HolePunchTemplate.d.ts +46 -0
- package/dist/src/core/shaders/templates/HolePunchTemplate.js +19 -0
- package/dist/src/core/shaders/templates/HolePunchTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/LinearGradientTemplate.d.ts +23 -0
- package/dist/src/core/shaders/templates/LinearGradientTemplate.js +31 -0
- package/dist/src/core/shaders/templates/LinearGradientTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RadialGradientTemplate.d.ts +33 -0
- package/dist/src/core/shaders/templates/RadialGradientTemplate.js +33 -0
- package/dist/src/core/shaders/templates/RadialGradientTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RoundedTemplate.d.ts +29 -0
- package/dist/src/core/shaders/templates/RoundedTemplate.js +51 -0
- package/dist/src/core/shaders/templates/RoundedTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.d.ts +7 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js +8 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.d.ts +8 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js +9 -0
- package/dist/src/core/shaders/templates/RoundedWithBorderTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.d.ts +6 -0
- package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js +7 -0
- package/dist/src/core/shaders/templates/RoundedWithShadowTemplate.js.map +1 -0
- package/dist/src/core/shaders/templates/ShadowTemplate.d.ts +34 -0
- package/dist/src/core/shaders/templates/ShadowTemplate.js +50 -0
- package/dist/src/core/shaders/templates/ShadowTemplate.js.map +1 -0
- package/dist/src/core/shaders/utils.d.ts +5 -0
- package/dist/src/core/shaders/utils.js +25 -0
- package/dist/src/core/shaders/utils.js.map +1 -0
- package/dist/src/core/shaders/webgl/Border.d.ts +3 -0
- package/dist/src/core/shaders/webgl/Border.js +153 -0
- package/dist/src/core/shaders/webgl/Border.js.map +1 -0
- package/dist/src/core/shaders/webgl/Default.d.ts +2 -0
- package/dist/src/core/shaders/webgl/Default.js +51 -0
- package/dist/src/core/shaders/webgl/Default.js.map +1 -0
- package/dist/src/core/shaders/webgl/HolePunch.d.ts +3 -0
- package/dist/src/core/shaders/webgl/HolePunch.js +49 -0
- package/dist/src/core/shaders/webgl/HolePunch.js.map +1 -0
- package/dist/src/core/shaders/webgl/LinearGradient.d.ts +3 -0
- package/dist/src/core/shaders/webgl/LinearGradient.js +114 -0
- package/dist/src/core/shaders/webgl/LinearGradient.js.map +1 -0
- package/dist/src/core/shaders/webgl/RadialGradient.d.ts +3 -0
- package/dist/src/core/shaders/webgl/RadialGradient.js +81 -0
- package/dist/src/core/shaders/webgl/RadialGradient.js.map +1 -0
- package/dist/src/core/shaders/webgl/Rounded.d.ts +7 -0
- package/dist/src/core/shaders/webgl/Rounded.js +88 -0
- package/dist/src/core/shaders/webgl/Rounded.js.map +1 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorder.d.ts +3 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js +202 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorder.js.map +1 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.d.ts +3 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js +223 -0
- package/dist/src/core/shaders/webgl/RoundedWithBorderAndShadow.js.map +1 -0
- package/dist/src/core/shaders/webgl/RoundedWithShadow.d.ts +3 -0
- package/dist/src/core/shaders/webgl/RoundedWithShadow.js +123 -0
- package/dist/src/core/shaders/webgl/RoundedWithShadow.js.map +1 -0
- package/dist/src/core/shaders/webgl/SdfShader.d.ts +13 -0
- package/dist/src/core/shaders/webgl/SdfShader.js +72 -0
- package/dist/src/core/shaders/webgl/SdfShader.js.map +1 -0
- package/dist/src/core/shaders/webgl/Shadow.d.ts +3 -0
- package/dist/src/core/shaders/webgl/Shadow.js +115 -0
- package/dist/src/core/shaders/webgl/Shadow.js.map +1 -0
- package/dist/src/core/text-rendering/CanvasFontHandler.d.ts +59 -0
- package/dist/src/core/text-rendering/CanvasFontHandler.js +206 -0
- package/dist/src/core/text-rendering/CanvasFontHandler.js.map +1 -0
- package/dist/src/core/text-rendering/CanvasTextRenderer.d.ts +17 -0
- package/dist/src/core/text-rendering/CanvasTextRenderer.js +139 -0
- package/dist/src/core/text-rendering/CanvasTextRenderer.js.map +1 -0
- package/dist/src/core/text-rendering/SdfFontHandler.d.ts +167 -0
- package/dist/src/core/text-rendering/SdfFontHandler.js +371 -0
- package/dist/src/core/text-rendering/SdfFontHandler.js.map +1 -0
- package/dist/src/core/text-rendering/SdfTextRenderer.d.ts +17 -0
- package/dist/src/core/text-rendering/SdfTextRenderer.js +249 -0
- package/dist/src/core/text-rendering/SdfTextRenderer.js.map +1 -0
- package/dist/src/core/text-rendering/TextLayoutEngine.d.ts +18 -0
- package/dist/src/core/text-rendering/TextLayoutEngine.js +380 -0
- package/dist/src/core/text-rendering/TextLayoutEngine.js.map +1 -0
- package/dist/src/core/text-rendering/TextRenderer.d.ts +406 -0
- package/dist/src/core/text-rendering/TextRenderer.js +2 -0
- package/dist/src/core/text-rendering/TextRenderer.js.map +1 -0
- package/dist/src/core/text-rendering/Utils.d.ts +30 -0
- package/dist/src/core/text-rendering/Utils.js +66 -0
- package/dist/src/core/text-rendering/Utils.js.map +1 -0
- package/dist/src/core/textures/ColorTexture.d.ts +36 -0
- package/dist/src/core/textures/ColorTexture.js +57 -0
- package/dist/src/core/textures/ColorTexture.js.map +1 -0
- package/dist/src/core/textures/ImageTexture.d.ts +131 -0
- package/dist/src/core/textures/ImageTexture.js +211 -0
- package/dist/src/core/textures/ImageTexture.js.map +1 -0
- package/dist/src/core/textures/NoiseTexture.d.ts +43 -0
- package/dist/src/core/textures/NoiseTexture.js +50 -0
- package/dist/src/core/textures/NoiseTexture.js.map +1 -0
- package/dist/src/core/textures/RenderTexture.d.ts +29 -0
- package/dist/src/core/textures/RenderTexture.js +36 -0
- package/dist/src/core/textures/RenderTexture.js.map +1 -0
- package/dist/src/core/textures/SubTexture.d.ts +61 -0
- package/dist/src/core/textures/SubTexture.js +99 -0
- package/dist/src/core/textures/SubTexture.js.map +1 -0
- package/dist/src/core/textures/Texture.d.ts +275 -0
- package/dist/src/core/textures/Texture.js +326 -0
- package/dist/src/core/textures/Texture.js.map +1 -0
- package/dist/src/core/utils.d.ts +23 -0
- package/dist/src/core/utils.js +155 -0
- package/dist/src/core/utils.js.map +1 -0
- package/dist/src/main-api/INode.d.ts +65 -0
- package/dist/src/main-api/INode.js +2 -0
- package/dist/src/main-api/INode.js.map +1 -0
- package/dist/src/main-api/Inspector.d.ts +154 -0
- package/dist/src/main-api/Inspector.js +844 -0
- package/dist/src/main-api/Inspector.js.map +1 -0
- package/dist/src/main-api/Renderer.d.ts +629 -0
- package/dist/src/main-api/Renderer.js +471 -0
- package/dist/src/main-api/Renderer.js.map +1 -0
- package/dist/src/main-api/utils.d.ts +2 -0
- package/dist/src/main-api/utils.js +34 -0
- package/dist/src/main-api/utils.js.map +1 -0
- package/dist/src/utils.d.ts +123 -0
- package/dist/src/utils.js +234 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/tsconfig.dist.tsbuildinfo +1 -0
- package/exports/canvas-shaders.ts +11 -0
- package/exports/canvas.ts +27 -0
- package/exports/index.ts +69 -0
- package/exports/inspector.ts +5 -0
- package/exports/utils.ts +32 -0
- package/exports/webgl-shaders.ts +12 -0
- package/exports/webgl.ts +33 -0
- package/package.json +99 -0
- package/src/common/CommonTypes.ts +145 -0
- package/src/common/EventEmitter.ts +58 -0
- package/src/common/IAnimationController.ts +65 -0
- package/src/common/IEventEmitter.ts +11 -0
- package/src/core/Autosizer.ts +205 -0
- package/src/core/CoreNode.test.ts +535 -0
- package/src/core/CoreNode.ts +2883 -0
- package/src/core/CoreShaderManager.ts +170 -0
- package/src/core/CoreTextNode.ts +573 -0
- package/src/core/CoreTextureManager.ts +552 -0
- package/src/core/Stage.ts +1037 -0
- package/src/core/TextureError.ts +46 -0
- package/src/core/TextureMemoryManager.ts +378 -0
- package/src/core/animations/AnimationManager.ts +178 -0
- package/src/core/animations/CoreAnimation.ts +138 -0
- package/src/core/lib/ContextSpy.ts +22 -0
- package/src/core/lib/ImageWorker.ts +292 -0
- package/src/core/lib/Matrix3d.ts +231 -0
- package/src/core/lib/RenderCoords.ts +55 -0
- package/src/core/lib/WebGlContextWrapper.ts +1448 -0
- package/src/core/lib/collectionUtils.ts +99 -0
- package/src/core/lib/colorCache.ts +20 -0
- package/src/core/lib/colorParser.ts +66 -0
- package/src/core/lib/textureCompression.ts +492 -0
- package/src/core/lib/textureSvg.ts +59 -0
- package/src/core/lib/utils.ts +400 -0
- package/src/core/lib/validateImageBitmap.ts +87 -0
- package/src/core/platforms/Platform.ts +64 -0
- package/src/core/platforms/web/WebPlatform.ts +132 -0
- package/src/core/renderers/CoreContextTexture.ts +25 -0
- package/src/core/renderers/CoreRenderOp.ts +3 -0
- package/src/core/renderers/CoreRenderer.ts +101 -0
- package/src/core/renderers/CoreShaderNode.ts +202 -0
- package/src/core/renderers/CoreShaderProgram.ts +4 -0
- package/src/core/renderers/canvas/CanvasRenderer.ts +274 -0
- package/src/core/renderers/canvas/CanvasShaderNode.ts +79 -0
- package/src/core/renderers/canvas/CanvasTexture.ts +141 -0
- package/src/core/renderers/webgl/SdfRenderOp.ts +103 -0
- package/src/core/renderers/webgl/WebGlCtxRenderTexture.ts +70 -0
- package/src/core/renderers/webgl/WebGlCtxSubTexture.ts +76 -0
- package/src/core/renderers/webgl/WebGlCtxTexture.ts +332 -0
- package/src/core/renderers/webgl/WebGlRenderer.ts +1323 -0
- package/src/core/renderers/webgl/WebGlShaderNode.ts +423 -0
- package/src/core/renderers/webgl/WebGlShaderProgram.ts +346 -0
- package/src/core/renderers/webgl/internal/BufferCollection.ts +46 -0
- package/src/core/renderers/webgl/internal/RendererUtils.ts +136 -0
- package/src/core/renderers/webgl/internal/ShaderUtils.ts +262 -0
- package/src/core/renderers/webgl/internal/WebGlUtils.ts +16 -0
- package/src/core/shaders/canvas/Border.ts +119 -0
- package/src/core/shaders/canvas/HolePunch.ts +38 -0
- package/src/core/shaders/canvas/LinearGradient.ts +54 -0
- package/src/core/shaders/canvas/RadialGradient.ts +82 -0
- package/src/core/shaders/canvas/Rounded.ts +38 -0
- package/src/core/shaders/canvas/RoundedWithBorder.ts +105 -0
- package/src/core/shaders/canvas/RoundedWithBorderAndShadow.ts +118 -0
- package/src/core/shaders/canvas/RoundedWithShadow.ts +56 -0
- package/src/core/shaders/canvas/Shadow.ts +35 -0
- package/src/core/shaders/canvas/utils/render.ts +143 -0
- package/src/core/shaders/templates/BorderTemplate.ts +128 -0
- package/src/core/shaders/templates/HolePunchTemplate.ts +65 -0
- package/src/core/shaders/templates/LinearGradientTemplate.ts +54 -0
- package/src/core/shaders/templates/RadialGradientTemplate.ts +66 -0
- package/src/core/shaders/templates/RoundedTemplate.ts +81 -0
- package/src/core/shaders/templates/RoundedWithBorderAndShadowTemplate.ts +21 -0
- package/src/core/shaders/templates/RoundedWithBorderTemplate.ts +23 -0
- package/src/core/shaders/templates/RoundedWithShadowTemplate.ts +18 -0
- package/src/core/shaders/templates/ShadowTemplate.ts +89 -0
- package/src/core/shaders/utils.ts +30 -0
- package/src/core/shaders/webgl/Border.ts +158 -0
- package/src/core/shaders/webgl/Default.ts +52 -0
- package/src/core/shaders/webgl/HolePunch.ts +58 -0
- package/src/core/shaders/webgl/LinearGradient.ts +119 -0
- package/src/core/shaders/webgl/RadialGradient.ts +91 -0
- package/src/core/shaders/webgl/Rounded.ts +97 -0
- package/src/core/shaders/webgl/RoundedWithBorder.ts +212 -0
- package/src/core/shaders/webgl/RoundedWithBorderAndShadow.ts +235 -0
- package/src/core/shaders/webgl/RoundedWithShadow.ts +132 -0
- package/src/core/shaders/webgl/SdfShader.ts +73 -0
- package/src/core/shaders/webgl/Shadow.ts +119 -0
- package/src/core/text-rendering/CanvasFontHandler.ts +285 -0
- package/src/core/text-rendering/CanvasTextRenderer.ts +236 -0
- package/src/core/text-rendering/SdfFontHandler.ts +566 -0
- package/src/core/text-rendering/SdfTextRenderer.ts +352 -0
- package/src/core/text-rendering/TextLayoutEngine.ts +672 -0
- package/src/core/text-rendering/TextRenderer.ts +449 -0
- package/src/core/text-rendering/Utils.ts +80 -0
- package/src/core/text-rendering/tests/TextLayoutEngine.test.ts +434 -0
- package/src/core/textures/ColorTexture.ts +85 -0
- package/src/core/textures/ImageTexture.ts +394 -0
- package/src/core/textures/NoiseTexture.ts +87 -0
- package/src/core/textures/RenderTexture.ts +68 -0
- package/src/core/textures/SubTexture.ts +165 -0
- package/src/core/textures/Texture.ts +505 -0
- package/src/core/utils.ts +210 -0
- package/src/env.d.ts +7 -0
- package/src/main-api/INode.ts +92 -0
- package/src/main-api/Inspector.ts +1267 -0
- package/src/main-api/Renderer.ts +1011 -0
- package/src/main-api/utils.ts +45 -0
- package/src/utils.ts +302 -0
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
import { CoreNode, } from '../core/CoreNode.js';
|
|
2
|
+
import {} from './Renderer.js';
|
|
3
|
+
import { isProductionEnvironment } from '../utils.js';
|
|
4
|
+
import { CoreTextNode } from '../core/CoreTextNode.js';
|
|
5
|
+
import { TextureType } from '../core/textures/Texture.js';
|
|
6
|
+
const stylePropertyMap = {
|
|
7
|
+
alpha: (v) => {
|
|
8
|
+
if (v === 1) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return { prop: 'opacity', value: `${v}` };
|
|
12
|
+
},
|
|
13
|
+
x: (x) => {
|
|
14
|
+
return { prop: 'left', value: `${x}px` };
|
|
15
|
+
},
|
|
16
|
+
y: (y) => {
|
|
17
|
+
return { prop: 'top', value: `${y}px` };
|
|
18
|
+
},
|
|
19
|
+
w: (w) => {
|
|
20
|
+
if (w === 0) {
|
|
21
|
+
return { prop: 'width', value: 'auto' };
|
|
22
|
+
}
|
|
23
|
+
return { prop: 'width', value: `${w}px` };
|
|
24
|
+
},
|
|
25
|
+
h: (h) => {
|
|
26
|
+
if (h === 0) {
|
|
27
|
+
return { prop: 'height', value: 'auto' };
|
|
28
|
+
}
|
|
29
|
+
return { prop: 'height', value: `${h}px` };
|
|
30
|
+
},
|
|
31
|
+
fontSize: (fs) => {
|
|
32
|
+
if (fs === 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return { prop: 'font-size', value: `${fs}px` };
|
|
36
|
+
},
|
|
37
|
+
lineHeight: (lh) => {
|
|
38
|
+
if (lh === 0) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return { prop: 'line-height', value: `${lh}px` };
|
|
42
|
+
},
|
|
43
|
+
zIndex: () => 'z-index',
|
|
44
|
+
fontFamily: () => 'font-family',
|
|
45
|
+
fontStyle: () => 'font-style',
|
|
46
|
+
letterSpacing: () => 'letter-spacing',
|
|
47
|
+
textAlign: () => 'text-align',
|
|
48
|
+
overflowSuffix: () => 'overflow-suffix',
|
|
49
|
+
maxLines: () => 'max-lines',
|
|
50
|
+
contain: () => 'contain',
|
|
51
|
+
verticalAlign: () => 'vertical-align',
|
|
52
|
+
clipping: (v) => {
|
|
53
|
+
if (v === false) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return { prop: 'overflow', value: v ? 'hidden' : 'visible' };
|
|
57
|
+
},
|
|
58
|
+
rotation: (v) => {
|
|
59
|
+
if (v === 0) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return { prop: 'transform', value: `rotate(${v}rad)` };
|
|
63
|
+
},
|
|
64
|
+
scale: (v) => {
|
|
65
|
+
if (v === 1) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return { prop: 'transform', value: `scale(${v})` };
|
|
69
|
+
},
|
|
70
|
+
scaleX: (v) => {
|
|
71
|
+
if (v === 1) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return { prop: 'transform', value: `scaleX(${v})` };
|
|
75
|
+
},
|
|
76
|
+
scaleY: (v) => {
|
|
77
|
+
if (v === 1) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return { prop: 'transform', value: `scaleY(${v})` };
|
|
81
|
+
},
|
|
82
|
+
color: (v) => {
|
|
83
|
+
if (v === 0) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return { prop: 'color', value: convertColorToRgba(v) };
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
const convertColorToRgba = (color) => {
|
|
90
|
+
const a = (color & 0xff) / 255;
|
|
91
|
+
const b = (color >> 8) & 0xff;
|
|
92
|
+
const g = (color >> 16) & 0xff;
|
|
93
|
+
const r = (color >> 24) & 0xff;
|
|
94
|
+
return `rgba(${r},${g},${b},${a})`;
|
|
95
|
+
};
|
|
96
|
+
const domPropertyMap = {
|
|
97
|
+
id: 'test-id',
|
|
98
|
+
};
|
|
99
|
+
const gradientColorPropertyMap = [
|
|
100
|
+
'colorTop',
|
|
101
|
+
'colorBottom',
|
|
102
|
+
'colorLeft',
|
|
103
|
+
'colorRight',
|
|
104
|
+
'colorTl',
|
|
105
|
+
'colorTr',
|
|
106
|
+
'colorBl',
|
|
107
|
+
'colorBr',
|
|
108
|
+
];
|
|
109
|
+
const textureTypeNames = {
|
|
110
|
+
[TextureType.generic]: 'generic',
|
|
111
|
+
[TextureType.color]: 'color',
|
|
112
|
+
[TextureType.image]: 'image',
|
|
113
|
+
[TextureType.noise]: 'noise',
|
|
114
|
+
[TextureType.renderToTexture]: 'renderToTexture',
|
|
115
|
+
[TextureType.subTexture]: 'subTexture',
|
|
116
|
+
};
|
|
117
|
+
const knownProperties = new Set([
|
|
118
|
+
...Object.keys(stylePropertyMap),
|
|
119
|
+
...Object.keys(domPropertyMap),
|
|
120
|
+
// ...gradientColorPropertyMap,
|
|
121
|
+
'src',
|
|
122
|
+
'parent',
|
|
123
|
+
'data',
|
|
124
|
+
'text',
|
|
125
|
+
]);
|
|
126
|
+
export class Inspector {
|
|
127
|
+
root = null;
|
|
128
|
+
canvas = null;
|
|
129
|
+
mutationObserver = new MutationObserver(() => { });
|
|
130
|
+
resizeObserver = new ResizeObserver(() => { });
|
|
131
|
+
height = 1080;
|
|
132
|
+
width = 1920;
|
|
133
|
+
scaleX = 1;
|
|
134
|
+
scaleY = 1;
|
|
135
|
+
textureMetrics = new Map();
|
|
136
|
+
// Performance monitoring for frequent setter calls
|
|
137
|
+
static setterCallCount = new Map();
|
|
138
|
+
// Animation monitoring structures
|
|
139
|
+
static activeAnimations = new Map();
|
|
140
|
+
static animationHistory = [];
|
|
141
|
+
// Performance monitoring settings (configured via constructor)
|
|
142
|
+
performanceSettings = {
|
|
143
|
+
enablePerformanceMonitoring: false,
|
|
144
|
+
excessiveCallThreshold: 100,
|
|
145
|
+
resetInterval: 5000,
|
|
146
|
+
enableAnimationMonitoring: false,
|
|
147
|
+
maxAnimationHistory: 1000,
|
|
148
|
+
animationStatsInterval: 0,
|
|
149
|
+
};
|
|
150
|
+
// Animation stats printing timer
|
|
151
|
+
animationStatsTimer = null;
|
|
152
|
+
constructor(canvas, settings) {
|
|
153
|
+
if (isProductionEnvironment === true)
|
|
154
|
+
return;
|
|
155
|
+
if (!settings) {
|
|
156
|
+
throw new Error('settings is required');
|
|
157
|
+
}
|
|
158
|
+
// Initialize performance monitoring settings with defaults
|
|
159
|
+
this.performanceSettings = {
|
|
160
|
+
enablePerformanceMonitoring: settings.inspectorOptions?.enablePerformanceMonitoring ?? false,
|
|
161
|
+
excessiveCallThreshold: settings.inspectorOptions?.excessiveCallThreshold ?? 100,
|
|
162
|
+
resetInterval: settings.inspectorOptions?.resetInterval ?? 5000,
|
|
163
|
+
enableAnimationMonitoring: settings.inspectorOptions?.enableAnimationMonitoring ?? false,
|
|
164
|
+
maxAnimationHistory: settings.inspectorOptions?.maxAnimationHistory ?? 1000,
|
|
165
|
+
animationStatsInterval: settings.inspectorOptions?.animationStatsInterval ?? 0,
|
|
166
|
+
};
|
|
167
|
+
// calc dimensions based on the devicePixelRatio
|
|
168
|
+
this.height = Math.ceil(settings.appHeight ?? 1080 / (settings.deviceLogicalPixelRatio ?? 1));
|
|
169
|
+
this.width = Math.ceil(settings.appWidth ?? 1920 / (settings.deviceLogicalPixelRatio ?? 1));
|
|
170
|
+
this.scaleX = settings.deviceLogicalPixelRatio ?? 1;
|
|
171
|
+
this.scaleY = settings.deviceLogicalPixelRatio ?? 1;
|
|
172
|
+
this.canvas = canvas;
|
|
173
|
+
this.root = document.createElement('div');
|
|
174
|
+
this.setRootPosition();
|
|
175
|
+
document.body.appendChild(this.root);
|
|
176
|
+
//listen for changes on canvas
|
|
177
|
+
this.mutationObserver = new MutationObserver(this.setRootPosition.bind(this));
|
|
178
|
+
this.mutationObserver.observe(canvas, {
|
|
179
|
+
attributes: true,
|
|
180
|
+
childList: false,
|
|
181
|
+
subtree: false,
|
|
182
|
+
});
|
|
183
|
+
// Create a ResizeObserver to watch for changes in the element's size
|
|
184
|
+
this.resizeObserver = new ResizeObserver(this.setRootPosition.bind(this));
|
|
185
|
+
this.resizeObserver.observe(canvas);
|
|
186
|
+
//listen for changes on window
|
|
187
|
+
window.addEventListener('resize', this.setRootPosition.bind(this));
|
|
188
|
+
// Start animation stats timer if enabled
|
|
189
|
+
this.startAnimationStatsTimer();
|
|
190
|
+
console.warn('Inspector is enabled, this will impact performance');
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Track setter calls for performance monitoring
|
|
194
|
+
* Only active when Inspector is loaded
|
|
195
|
+
*/
|
|
196
|
+
trackSetterCall(nodeId, setterName) {
|
|
197
|
+
if (!this.performanceSettings.enablePerformanceMonitoring) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const key = `${nodeId}_${setterName}`;
|
|
201
|
+
const now = Date.now();
|
|
202
|
+
const existing = Inspector.setterCallCount.get(key);
|
|
203
|
+
if (!existing) {
|
|
204
|
+
Inspector.setterCallCount.set(key, { count: 1, lastReset: now, nodeId });
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
// Reset counter if enough time has passed
|
|
208
|
+
if (now - existing.lastReset > this.performanceSettings.resetInterval) {
|
|
209
|
+
existing.count = 1;
|
|
210
|
+
existing.lastReset = now;
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
existing.count++;
|
|
214
|
+
// Log if threshold exceeded
|
|
215
|
+
if (existing.count === this.performanceSettings.excessiveCallThreshold) {
|
|
216
|
+
console.warn(`🚨 Inspector Performance Warning: Setter '${setterName}' called ${existing.count} times in ${this.performanceSettings.resetInterval}ms on node ${nodeId}`);
|
|
217
|
+
}
|
|
218
|
+
else if (existing.count > this.performanceSettings.excessiveCallThreshold &&
|
|
219
|
+
existing.count % 50 === 0) {
|
|
220
|
+
console.warn(`🚨 Inspector Performance Warning: Setter '${setterName}' called ${existing.count} times in ${this.performanceSettings.resetInterval}ms on node ${nodeId} (continuing...)`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get current performance monitoring statistics
|
|
225
|
+
*/
|
|
226
|
+
static getPerformanceStats() {
|
|
227
|
+
const stats = [];
|
|
228
|
+
const now = Date.now();
|
|
229
|
+
Inspector.setterCallCount.forEach((data, key) => {
|
|
230
|
+
const parts = key.split('_');
|
|
231
|
+
const nodeIdStr = parts[0];
|
|
232
|
+
const setterName = parts[1];
|
|
233
|
+
if (nodeIdStr && setterName) {
|
|
234
|
+
const timeWindow = now - data.lastReset;
|
|
235
|
+
stats.push({
|
|
236
|
+
nodeId: parseInt(nodeIdStr, 10),
|
|
237
|
+
setterName,
|
|
238
|
+
count: data.count,
|
|
239
|
+
timeWindow,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
return stats.sort((a, b) => b.count - a.count);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Clear performance monitoring statistics
|
|
247
|
+
*/
|
|
248
|
+
static clearPerformanceStats() {
|
|
249
|
+
Inspector.setterCallCount.clear();
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Generate a unique animation ID
|
|
253
|
+
*/
|
|
254
|
+
static generateAnimationId() {
|
|
255
|
+
return `anim_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Wrap animation controller with monitoring capabilities
|
|
259
|
+
*/
|
|
260
|
+
wrapAnimationController(controller, nodeId, props, settings, div) {
|
|
261
|
+
if (!this.performanceSettings.enableAnimationMonitoring) {
|
|
262
|
+
// Just add the basic DOM animation without tracking
|
|
263
|
+
const originalStart = controller.start.bind(controller);
|
|
264
|
+
controller.start = () => {
|
|
265
|
+
this.animateNode(div, props, settings);
|
|
266
|
+
return originalStart();
|
|
267
|
+
};
|
|
268
|
+
return controller;
|
|
269
|
+
}
|
|
270
|
+
const animationId = Inspector.generateAnimationId();
|
|
271
|
+
// Create wrapper controller
|
|
272
|
+
const wrappedController = {
|
|
273
|
+
start: () => {
|
|
274
|
+
this.trackAnimationStart(animationId, nodeId, props, settings, controller);
|
|
275
|
+
this.animateNode(div, props, settings);
|
|
276
|
+
return controller.start();
|
|
277
|
+
},
|
|
278
|
+
stop: () => {
|
|
279
|
+
this.trackAnimationEnd(animationId, 'stopped');
|
|
280
|
+
return controller.stop();
|
|
281
|
+
},
|
|
282
|
+
pause: () => {
|
|
283
|
+
this.updateAnimationState(animationId, 'paused');
|
|
284
|
+
return controller.pause();
|
|
285
|
+
},
|
|
286
|
+
restore: () => {
|
|
287
|
+
this.trackAnimationEnd(animationId, 'cancelled');
|
|
288
|
+
return controller.restore();
|
|
289
|
+
},
|
|
290
|
+
waitUntilStopped: () => {
|
|
291
|
+
return controller.waitUntilStopped().then(() => {
|
|
292
|
+
this.trackAnimationEnd(animationId, 'finished');
|
|
293
|
+
});
|
|
294
|
+
},
|
|
295
|
+
get state() {
|
|
296
|
+
return controller.state;
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
controller.waitUntilStopped().then(() => {
|
|
300
|
+
this.trackAnimationEnd(animationId, 'finished');
|
|
301
|
+
});
|
|
302
|
+
return wrappedController;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Track animation start
|
|
306
|
+
*/
|
|
307
|
+
trackAnimationStart(animationId, nodeId, props, settings, controller) {
|
|
308
|
+
const startTime = Date.now();
|
|
309
|
+
Inspector.activeAnimations.set(animationId, {
|
|
310
|
+
nodeId,
|
|
311
|
+
animationId,
|
|
312
|
+
startTime,
|
|
313
|
+
props,
|
|
314
|
+
settings,
|
|
315
|
+
controller,
|
|
316
|
+
state: 'scheduled',
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Update animation state
|
|
321
|
+
*/
|
|
322
|
+
updateAnimationState(animationId, state) {
|
|
323
|
+
const animation = Inspector.activeAnimations.get(animationId);
|
|
324
|
+
if (animation) {
|
|
325
|
+
animation.state = state;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Track animation end
|
|
330
|
+
*/
|
|
331
|
+
trackAnimationEnd(animationId, completionType) {
|
|
332
|
+
const animation = Inspector.activeAnimations.get(animationId);
|
|
333
|
+
if (!animation)
|
|
334
|
+
return;
|
|
335
|
+
const endTime = Date.now();
|
|
336
|
+
const actualDuration = endTime - animation.startTime;
|
|
337
|
+
const expectedDuration = animation.settings.duration || 1000;
|
|
338
|
+
// Move to history
|
|
339
|
+
Inspector.animationHistory.unshift({
|
|
340
|
+
nodeId: animation.nodeId,
|
|
341
|
+
animationId: animation.animationId,
|
|
342
|
+
startTime: animation.startTime,
|
|
343
|
+
endTime,
|
|
344
|
+
duration: expectedDuration,
|
|
345
|
+
actualDuration,
|
|
346
|
+
props: animation.props,
|
|
347
|
+
settings: animation.settings,
|
|
348
|
+
completionType,
|
|
349
|
+
});
|
|
350
|
+
// Limit history size for performance
|
|
351
|
+
if (Inspector.animationHistory.length >
|
|
352
|
+
this.performanceSettings.maxAnimationHistory) {
|
|
353
|
+
Inspector.animationHistory.splice(this.performanceSettings.maxAnimationHistory);
|
|
354
|
+
}
|
|
355
|
+
// Remove from active animations
|
|
356
|
+
Inspector.activeAnimations.delete(animationId);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Get currently active animations
|
|
360
|
+
*/
|
|
361
|
+
static getActiveAnimations() {
|
|
362
|
+
const now = Date.now();
|
|
363
|
+
const activeAnimations = [];
|
|
364
|
+
Inspector.activeAnimations.forEach((animation) => {
|
|
365
|
+
activeAnimations.push({
|
|
366
|
+
nodeId: animation.nodeId,
|
|
367
|
+
animationId: animation.animationId,
|
|
368
|
+
startTime: animation.startTime,
|
|
369
|
+
duration: animation.settings.duration || 1000,
|
|
370
|
+
elapsedTime: now - animation.startTime,
|
|
371
|
+
props: animation.props,
|
|
372
|
+
settings: animation.settings,
|
|
373
|
+
state: animation.state,
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
return activeAnimations.sort((a, b) => b.startTime - a.startTime);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Get animation statistics
|
|
380
|
+
*/
|
|
381
|
+
static getAnimationStats() {
|
|
382
|
+
const totalAnimations = Inspector.animationHistory.length;
|
|
383
|
+
const activeCount = Inspector.activeAnimations.size;
|
|
384
|
+
// Calculate average duration from finished animations only
|
|
385
|
+
const finishedAnimations = Inspector.animationHistory.filter((anim) => anim.completionType === 'finished');
|
|
386
|
+
const averageDuration = finishedAnimations.length > 0
|
|
387
|
+
? finishedAnimations.reduce((sum, anim) => sum + anim.actualDuration, 0) / finishedAnimations.length
|
|
388
|
+
: 0;
|
|
389
|
+
return {
|
|
390
|
+
totalAnimations,
|
|
391
|
+
activeCount,
|
|
392
|
+
averageDuration,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Clear animation monitoring data
|
|
397
|
+
*/
|
|
398
|
+
static clearAnimationStats() {
|
|
399
|
+
Inspector.activeAnimations.clear();
|
|
400
|
+
Inspector.animationHistory.length = 0;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Start the animation stats timer if enabled
|
|
404
|
+
*/
|
|
405
|
+
startAnimationStatsTimer() {
|
|
406
|
+
console.log(`Starting animation stats timer with interval: ${this.performanceSettings.animationStatsInterval} seconds`);
|
|
407
|
+
if (this.performanceSettings.animationStatsInterval > 0) {
|
|
408
|
+
this.animationStatsTimer = setInterval(() => {
|
|
409
|
+
this.printAnimationStats();
|
|
410
|
+
}, this.performanceSettings.animationStatsInterval * 1000);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Stop the animation stats timer
|
|
415
|
+
*/
|
|
416
|
+
stopAnimationStatsTimer() {
|
|
417
|
+
if (this.animationStatsTimer) {
|
|
418
|
+
clearInterval(this.animationStatsTimer);
|
|
419
|
+
this.animationStatsTimer = null;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Print current animation statistics to console
|
|
424
|
+
*/
|
|
425
|
+
printAnimationStats() {
|
|
426
|
+
const stats = Inspector.getAnimationStats();
|
|
427
|
+
console.log(`🎬 Animation Stats: ${stats.activeCount} active, ${stats.totalAnimations} completed, ${Math.round(stats.averageDuration)}ms avg duration`);
|
|
428
|
+
}
|
|
429
|
+
setRootPosition() {
|
|
430
|
+
if (this.root === null || this.canvas === null) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
// get the world position of the canvas object, so we can match the inspector to it
|
|
434
|
+
const rect = this.canvas.getBoundingClientRect();
|
|
435
|
+
const top = document.documentElement.scrollTop + rect.top;
|
|
436
|
+
const left = document.documentElement.scrollLeft + rect.left;
|
|
437
|
+
this.root.id = 'root';
|
|
438
|
+
this.root.style.left = `${left}px`;
|
|
439
|
+
this.root.style.top = `${top}px`;
|
|
440
|
+
this.root.style.width = `${this.width}px`;
|
|
441
|
+
this.root.style.height = `${this.height}px`;
|
|
442
|
+
this.root.style.position = 'absolute';
|
|
443
|
+
this.root.style.transformOrigin = '0 0 0';
|
|
444
|
+
this.root.style.transform = `scale(${this.scaleX}, ${this.scaleY})`;
|
|
445
|
+
this.root.style.overflow = 'hidden';
|
|
446
|
+
this.root.style.zIndex = '65534';
|
|
447
|
+
}
|
|
448
|
+
createDiv(id, properties) {
|
|
449
|
+
const div = document.createElement('div');
|
|
450
|
+
div.style.position = 'absolute';
|
|
451
|
+
div.id = id.toString();
|
|
452
|
+
// set initial properties
|
|
453
|
+
for (const key in properties) {
|
|
454
|
+
this.updateNodeProperty(div,
|
|
455
|
+
// really typescript? really?
|
|
456
|
+
key, properties[key], properties);
|
|
457
|
+
}
|
|
458
|
+
return div;
|
|
459
|
+
}
|
|
460
|
+
createNodes(node) {
|
|
461
|
+
if (this.root === null) {
|
|
462
|
+
return false;
|
|
463
|
+
}
|
|
464
|
+
const div = this.root.querySelector(`[id="${node.id}"]`);
|
|
465
|
+
if (div === null && node instanceof CoreTextNode) {
|
|
466
|
+
this.createTextNode(node);
|
|
467
|
+
}
|
|
468
|
+
else if (div === null && node instanceof CoreNode) {
|
|
469
|
+
this.createNode(node);
|
|
470
|
+
}
|
|
471
|
+
for (const child of node.children) {
|
|
472
|
+
this.createNodes(child);
|
|
473
|
+
}
|
|
474
|
+
return true;
|
|
475
|
+
}
|
|
476
|
+
createNode(node) {
|
|
477
|
+
const div = this.createDiv(node.id, node.props);
|
|
478
|
+
div.node = node;
|
|
479
|
+
node.div = div;
|
|
480
|
+
node.on('inViewport', () => div.setAttribute('state', 'inViewport'));
|
|
481
|
+
node.on('inBounds', () => div.setAttribute('state', 'inBounds'));
|
|
482
|
+
node.on('outOfBounds', () => div.setAttribute('state', 'outOfBounds'));
|
|
483
|
+
// Monitor only relevant properties by trapping with selective assignment
|
|
484
|
+
return this.createProxy(node, div);
|
|
485
|
+
}
|
|
486
|
+
createTextNode(node) {
|
|
487
|
+
// eslint-disable-next-line
|
|
488
|
+
// @ts-ignore - textProps is a private property and keeping it that way
|
|
489
|
+
// but we need it from the inspector to set the initial properties on the div element
|
|
490
|
+
const div = this.createDiv(node.id, node.textProps);
|
|
491
|
+
div.node = node;
|
|
492
|
+
node.div = div;
|
|
493
|
+
return this.createProxy(node, div);
|
|
494
|
+
}
|
|
495
|
+
createProxy(node, div) {
|
|
496
|
+
// Store texture event listeners for cleanup
|
|
497
|
+
const textureListeners = new Map();
|
|
498
|
+
const coreNodeListeners = new Map();
|
|
499
|
+
const setupCoreNodeListeners = (coreNode) => {
|
|
500
|
+
const onLoaded = () => {
|
|
501
|
+
this.updateTextNodeDimensions(div, coreNode);
|
|
502
|
+
};
|
|
503
|
+
coreNode.on('loaded', onLoaded);
|
|
504
|
+
coreNodeListeners.set(coreNode, { onLoaded });
|
|
505
|
+
};
|
|
506
|
+
// Helper function to setup texture event listeners
|
|
507
|
+
const setupTextureListeners = (texture) => {
|
|
508
|
+
// Clean up existing listeners first
|
|
509
|
+
textureListeners.forEach((listeners, oldTexture) => {
|
|
510
|
+
oldTexture.off('loaded', listeners.onLoaded);
|
|
511
|
+
oldTexture.off('failed', listeners.onFailed);
|
|
512
|
+
oldTexture.off('freed', listeners.onFreed);
|
|
513
|
+
});
|
|
514
|
+
textureListeners.clear();
|
|
515
|
+
// Setup new listeners if texture exists
|
|
516
|
+
if (texture) {
|
|
517
|
+
// Initialize metrics if not exists
|
|
518
|
+
if (!this.textureMetrics.has(texture)) {
|
|
519
|
+
this.textureMetrics.set(texture, {
|
|
520
|
+
previousState: texture.state,
|
|
521
|
+
loadedCount: 0,
|
|
522
|
+
failedCount: 0,
|
|
523
|
+
freedCount: 0,
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
const onLoaded = () => {
|
|
527
|
+
const metrics = this.textureMetrics.get(texture);
|
|
528
|
+
if (metrics) {
|
|
529
|
+
metrics.previousState =
|
|
530
|
+
metrics.previousState !== texture.state
|
|
531
|
+
? metrics.previousState
|
|
532
|
+
: 'loading';
|
|
533
|
+
metrics.loadedCount++;
|
|
534
|
+
}
|
|
535
|
+
this.updateTextureAttributes(div, texture);
|
|
536
|
+
};
|
|
537
|
+
const onFailed = () => {
|
|
538
|
+
const metrics = this.textureMetrics.get(texture);
|
|
539
|
+
if (metrics) {
|
|
540
|
+
metrics.previousState =
|
|
541
|
+
metrics.previousState !== texture.state
|
|
542
|
+
? metrics.previousState
|
|
543
|
+
: 'loading';
|
|
544
|
+
metrics.failedCount++;
|
|
545
|
+
}
|
|
546
|
+
this.updateTextureAttributes(div, texture);
|
|
547
|
+
};
|
|
548
|
+
const onFreed = () => {
|
|
549
|
+
const metrics = this.textureMetrics.get(texture);
|
|
550
|
+
if (metrics) {
|
|
551
|
+
metrics.previousState =
|
|
552
|
+
metrics.previousState !== texture.state
|
|
553
|
+
? metrics.previousState
|
|
554
|
+
: texture.state;
|
|
555
|
+
metrics.freedCount++;
|
|
556
|
+
}
|
|
557
|
+
this.updateTextureAttributes(div, texture);
|
|
558
|
+
};
|
|
559
|
+
texture.on('loaded', onLoaded);
|
|
560
|
+
texture.on('failed', onFailed);
|
|
561
|
+
texture.on('freed', onFreed);
|
|
562
|
+
textureListeners.set(texture, { onLoaded, onFailed, onFreed });
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
// Define traps for each property in knownProperties
|
|
566
|
+
knownProperties.forEach((property) => {
|
|
567
|
+
let originalProp = Object.getOwnPropertyDescriptor(node, property);
|
|
568
|
+
if (originalProp === undefined) {
|
|
569
|
+
// Search the prototype chain for the property descriptor
|
|
570
|
+
const proto = Object.getPrototypeOf(node);
|
|
571
|
+
originalProp = Object.getOwnPropertyDescriptor(proto, property);
|
|
572
|
+
}
|
|
573
|
+
if (originalProp === undefined) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (property === 'text') {
|
|
577
|
+
setupCoreNodeListeners(node);
|
|
578
|
+
}
|
|
579
|
+
Object.defineProperty(node, property, {
|
|
580
|
+
get() {
|
|
581
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
582
|
+
return originalProp?.get?.call(node);
|
|
583
|
+
},
|
|
584
|
+
set: (value) => {
|
|
585
|
+
// Track setter call for performance monitoring
|
|
586
|
+
this.trackSetterCall(node.id, property);
|
|
587
|
+
originalProp?.set?.call(node, value);
|
|
588
|
+
this.updateNodeProperty(div, property, value, node.props);
|
|
589
|
+
// Setup texture event listeners if this is a texture property
|
|
590
|
+
if (property === 'texture') {
|
|
591
|
+
const textureValue = value && typeof value === 'object' && 'state' in value
|
|
592
|
+
? value
|
|
593
|
+
: null;
|
|
594
|
+
setupTextureListeners(textureValue);
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
configurable: true,
|
|
598
|
+
enumerable: true,
|
|
599
|
+
});
|
|
600
|
+
});
|
|
601
|
+
const originalDestroy = node.destroy;
|
|
602
|
+
Object.defineProperty(node, 'destroy', {
|
|
603
|
+
value: (isChild = false) => {
|
|
604
|
+
// Clean up texture event listeners and metrics
|
|
605
|
+
textureListeners.forEach((listeners, texture) => {
|
|
606
|
+
texture.off('loaded', listeners.onLoaded);
|
|
607
|
+
texture.off('failed', listeners.onFailed);
|
|
608
|
+
texture.off('freed', listeners.onFreed);
|
|
609
|
+
// Clean up metrics for this texture
|
|
610
|
+
this.textureMetrics.delete(texture);
|
|
611
|
+
});
|
|
612
|
+
textureListeners.clear();
|
|
613
|
+
coreNodeListeners.forEach((listeners, coreNode) => {
|
|
614
|
+
coreNode.off('loaded', listeners.onLoaded);
|
|
615
|
+
});
|
|
616
|
+
coreNodeListeners.clear();
|
|
617
|
+
this.destroyNode(node.id);
|
|
618
|
+
originalDestroy.call(node, isChild);
|
|
619
|
+
},
|
|
620
|
+
configurable: true,
|
|
621
|
+
});
|
|
622
|
+
const originalAnimate = node.animate;
|
|
623
|
+
Object.defineProperty(node, 'animate', {
|
|
624
|
+
value: (props, settings) => {
|
|
625
|
+
const animationController = originalAnimate.call(node, props, settings);
|
|
626
|
+
// Wrap animation controller with monitoring
|
|
627
|
+
return this.wrapAnimationController(animationController, node.id, props, settings, div);
|
|
628
|
+
},
|
|
629
|
+
configurable: true,
|
|
630
|
+
});
|
|
631
|
+
return node;
|
|
632
|
+
}
|
|
633
|
+
updateTextNodeDimensions(div, node) {
|
|
634
|
+
const textMetrics = node.renderInfo;
|
|
635
|
+
if (textMetrics) {
|
|
636
|
+
div.style.width = `${textMetrics.width}px`;
|
|
637
|
+
div.style.height = `${textMetrics.height}px`;
|
|
638
|
+
}
|
|
639
|
+
else {
|
|
640
|
+
div.style.removeProperty('width');
|
|
641
|
+
div.style.removeProperty('height');
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
updateTextureAttributes(div, texture) {
|
|
645
|
+
// Update texture state
|
|
646
|
+
div.setAttribute('data-texture-state', texture.state);
|
|
647
|
+
// Update texture type
|
|
648
|
+
div.setAttribute('data-texture-type', textureTypeNames[texture.type] || 'unknown');
|
|
649
|
+
// Update texture dimensions if available
|
|
650
|
+
if (texture.dimensions) {
|
|
651
|
+
div.setAttribute('data-texture-width', String(texture.dimensions.w));
|
|
652
|
+
div.setAttribute('data-texture-height', String(texture.dimensions.h));
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
div.removeAttribute('data-texture-width');
|
|
656
|
+
div.removeAttribute('data-texture-height');
|
|
657
|
+
}
|
|
658
|
+
// Update renderable owners count
|
|
659
|
+
div.setAttribute('data-texture-owners', String(texture.renderableOwners.length));
|
|
660
|
+
// Update retry count
|
|
661
|
+
div.setAttribute('data-texture-retry-count', String(texture.retryCount));
|
|
662
|
+
// Update max retry count if available
|
|
663
|
+
if (texture.maxRetryCount !== null) {
|
|
664
|
+
div.setAttribute('data-texture-max-retry-count', String(texture.maxRetryCount));
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
div.removeAttribute('data-texture-max-retry-count');
|
|
668
|
+
}
|
|
669
|
+
// Update metrics if available
|
|
670
|
+
const metrics = this.textureMetrics.get(texture);
|
|
671
|
+
if (metrics) {
|
|
672
|
+
div.setAttribute('data-texture-previous-state', metrics.previousState);
|
|
673
|
+
div.setAttribute('data-texture-loaded-count', String(metrics.loadedCount));
|
|
674
|
+
div.setAttribute('data-texture-failed-count', String(metrics.failedCount));
|
|
675
|
+
div.setAttribute('data-texture-freed-count', String(metrics.freedCount));
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
div.removeAttribute('data-texture-previous-state');
|
|
679
|
+
div.removeAttribute('data-texture-loaded-count');
|
|
680
|
+
div.removeAttribute('data-texture-failed-count');
|
|
681
|
+
div.removeAttribute('data-texture-freed-count');
|
|
682
|
+
}
|
|
683
|
+
// Update error information if present
|
|
684
|
+
if (texture.error) {
|
|
685
|
+
div.setAttribute('data-texture-error', texture.error.code || texture.error.message);
|
|
686
|
+
}
|
|
687
|
+
else {
|
|
688
|
+
div.removeAttribute('data-texture-error');
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
destroy() {
|
|
692
|
+
// Stop animation stats timer
|
|
693
|
+
this.stopAnimationStatsTimer();
|
|
694
|
+
// Remove DOM observers
|
|
695
|
+
this.mutationObserver.disconnect();
|
|
696
|
+
this.resizeObserver.disconnect();
|
|
697
|
+
// Remove resize listener
|
|
698
|
+
window.removeEventListener('resize', this.setRootPosition.bind(this));
|
|
699
|
+
if (this.root && this.root.parentNode) {
|
|
700
|
+
this.root.remove();
|
|
701
|
+
}
|
|
702
|
+
// Clean up animation monitoring data
|
|
703
|
+
Inspector.clearAnimationStats();
|
|
704
|
+
}
|
|
705
|
+
destroyNode(id) {
|
|
706
|
+
const div = document.getElementById(id.toString());
|
|
707
|
+
div?.remove();
|
|
708
|
+
}
|
|
709
|
+
updateNodeProperty(div, property,
|
|
710
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
711
|
+
value, props) {
|
|
712
|
+
if (this.root === null || value === undefined || value === null) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Special case for parent property
|
|
717
|
+
*/
|
|
718
|
+
if (property === 'parent') {
|
|
719
|
+
const parentId = value.id;
|
|
720
|
+
// only way to detect if the parent is the root node
|
|
721
|
+
// if you are reading this and have a better way, please let me know
|
|
722
|
+
if (parentId === 1) {
|
|
723
|
+
this.root.appendChild(div);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
const parent = document.getElementById(parentId.toString());
|
|
727
|
+
parent?.appendChild(div);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
// special case for text
|
|
731
|
+
if (property === 'text') {
|
|
732
|
+
div.innerHTML = String(value);
|
|
733
|
+
// Keep DOM text invisible without breaking visibility checks
|
|
734
|
+
// Use very low opacity (0.001) instead of 0 so Playwright still detects it
|
|
735
|
+
div.style.opacity = '0.001';
|
|
736
|
+
div.style.pointerEvents = 'none';
|
|
737
|
+
div.style.userSelect = 'none';
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
// special case for images
|
|
741
|
+
// we're not setting any CSS properties to avoid images getting loaded twice
|
|
742
|
+
// as the renderer will handle the loading of the image. Setting it to `data-src`
|
|
743
|
+
if (property === 'src' && value) {
|
|
744
|
+
div.setAttribute(`data-src`, String(value));
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
// special case for color gradients (normal colors are handled by the stylePropertyMap)
|
|
748
|
+
// FIXME the renderer seems to return the same number for all colors
|
|
749
|
+
// if (gradientColorPropertyMap.includes(property as string)) {
|
|
750
|
+
// const color = convertColorToRgba(value as number);
|
|
751
|
+
// div.setAttribute(`data-${property}`, color);
|
|
752
|
+
// return;
|
|
753
|
+
// }
|
|
754
|
+
if (property === 'rtt' && value) {
|
|
755
|
+
div.setAttribute('data-rtt', String(value));
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
// CSS mappable attribute
|
|
759
|
+
if (stylePropertyMap[property]) {
|
|
760
|
+
const mappedStyleResponse = stylePropertyMap[property]?.(value);
|
|
761
|
+
if (mappedStyleResponse === null) {
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
if (typeof mappedStyleResponse === 'string') {
|
|
765
|
+
div.style.setProperty(mappedStyleResponse, String(value));
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
if (typeof mappedStyleResponse === 'object') {
|
|
769
|
+
let value = mappedStyleResponse.value;
|
|
770
|
+
if (property === 'x') {
|
|
771
|
+
const mount = props.mountX;
|
|
772
|
+
const width = props.w;
|
|
773
|
+
if (mount) {
|
|
774
|
+
value = `${parseInt(value) - width * mount}px`;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
else if (property === 'y') {
|
|
778
|
+
const mount = props.mountY;
|
|
779
|
+
const height = props.h;
|
|
780
|
+
if (mount) {
|
|
781
|
+
value = `${parseInt(value) - height * mount}px`;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
div.style.setProperty(mappedStyleResponse.prop, value);
|
|
785
|
+
}
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
// DOM properties
|
|
789
|
+
if (domPropertyMap[property]) {
|
|
790
|
+
const domProperty = domPropertyMap[property];
|
|
791
|
+
if (!domProperty) {
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
div.setAttribute(String(domProperty), String(value));
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
// custom data properties
|
|
798
|
+
if (property === 'data') {
|
|
799
|
+
for (const key in value) {
|
|
800
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
801
|
+
const keyValue = value[key];
|
|
802
|
+
if (keyValue === undefined) {
|
|
803
|
+
div.removeAttribute(`data-${key}`);
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
div.setAttribute(`data-${key}`, String(keyValue));
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
updateViewport(width, height, deviceLogicalPixelRatio) {
|
|
813
|
+
this.scaleX = deviceLogicalPixelRatio ?? 1;
|
|
814
|
+
this.scaleY = deviceLogicalPixelRatio ?? 1;
|
|
815
|
+
this.width = width;
|
|
816
|
+
this.height = height;
|
|
817
|
+
this.setRootPosition();
|
|
818
|
+
}
|
|
819
|
+
// simple animation handler
|
|
820
|
+
animateNode(div, props, settings) {
|
|
821
|
+
const { duration = 1000, delay = 0,
|
|
822
|
+
// easing = 'linear',
|
|
823
|
+
// repeat = 0,
|
|
824
|
+
// loop = false,
|
|
825
|
+
// stopMethod = false,
|
|
826
|
+
} = settings;
|
|
827
|
+
const { x, y, w, h, alpha = 1, rotation = 0, scale = 1, color, mountX, mountY, } = props;
|
|
828
|
+
// ignoring loops and repeats for now, as that might be a bit too much for the inspector
|
|
829
|
+
function animate() {
|
|
830
|
+
setTimeout(() => {
|
|
831
|
+
div.style.top = `${y - h * mountY}px`;
|
|
832
|
+
div.style.left = `${x - w * mountX}px`;
|
|
833
|
+
div.style.width = `${w}px`;
|
|
834
|
+
div.style.height = `${h}px`;
|
|
835
|
+
div.style.opacity = `${alpha}`;
|
|
836
|
+
div.style.rotate = `${rotation}rad`;
|
|
837
|
+
div.style.scale = `${scale}`;
|
|
838
|
+
div.style.color = convertColorToRgba(color);
|
|
839
|
+
}, duration);
|
|
840
|
+
}
|
|
841
|
+
setTimeout(animate, delay);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
//# sourceMappingURL=Inspector.js.map
|