laymur 0.17.0 → 0.17.2
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 +5 -0
- package/{src/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.ts → dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +22 -0
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
- package/dist/core/constraints/UIConstraint.d.ts +12 -0
- package/dist/core/constraints/UIConstraint.js +11 -0
- package/dist/core/constraints/UICustomConstraint.d.ts +28 -0
- package/dist/core/constraints/UICustomConstraint.js +37 -0
- package/{src/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.ts → dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +20 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +11 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +36 -0
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +14 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +44 -0
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
- package/{src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.ts → dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +22 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
- package/{src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.ts → dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts} +8 -9
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +43 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +11 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +32 -0
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +14 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +44 -0
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
- package/{src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.ts → dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +22 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
- package/{src/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.ts → dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts} +2 -3
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +20 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +64 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +46 -0
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +13 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +29 -0
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +13 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +29 -0
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.d.ts +12 -0
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +32 -0
- package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +27 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +77 -0
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +30 -0
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
- package/dist/core/elements/UIDummy/UIDummy.d.ts +82 -0
- package/dist/core/elements/UIDummy/UIDummy.js +173 -0
- package/{src/core/elements/UIElement/UIElement.Internal.ts → dist/core/elements/UIElement/UIElement.Internal.d.ts} +5 -7
- package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
- package/dist/core/elements/UIElement/UIElement.d.ts +38 -0
- package/dist/core/elements/UIElement/UIElement.js +74 -0
- package/{src/core/elements/UIGraphics/UIGraphics.Internal.ts → dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts} +5 -7
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +51 -0
- package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
- package/{src/core/elements/UIImage/UIImage.Internal.ts → dist/core/elements/UIImage/UIImage.Internal.d.ts} +2 -3
- package/dist/core/elements/UIImage/UIImage.d.ts +32 -0
- package/dist/core/elements/UIImage/UIImage.js +85 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +23 -0
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +60 -0
- package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +14 -0
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
- package/dist/core/elements/UIProgress/UIProgress.d.ts +45 -0
- package/dist/core/elements/UIProgress/UIProgress.js +165 -0
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +43 -0
- package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
- package/dist/core/elements/UIScene/UIScene.d.ts +59 -0
- package/dist/core/elements/UIScene/UIScene.js +157 -0
- package/{src/core/elements/UIText/UIText.Interfaces.ts → dist/core/elements/UIText/UIText.Interfaces.d.ts} +16 -21
- package/dist/core/elements/UIText/UIText.Internal.d.ts +26 -0
- package/dist/core/elements/UIText/UIText.Internal.js +12 -0
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +50 -0
- package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +20 -0
- package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
- package/dist/core/elements/UIText/UIText.d.ts +71 -0
- package/dist/core/elements/UIText/UIText.js +265 -0
- package/{src/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.ts → dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts} +11 -14
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +63 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
- package/{src/core/layers/UILayer/UILayer.Internal.ts → dist/core/layers/UILayer/UILayer.Internal.d.ts} +11 -15
- package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
- package/dist/core/layers/UILayer/UILayer.d.ts +49 -0
- package/dist/core/layers/UILayer/UILayer.js +113 -0
- package/dist/core/miscellaneous/UIExpression.d.ts +69 -0
- package/dist/core/miscellaneous/UIExpression.js +128 -0
- package/dist/core/miscellaneous/UIMode.d.ts +23 -0
- package/dist/core/miscellaneous/UIMode.js +30 -0
- package/dist/core/miscellaneous/UIOrientation.d.ts +15 -0
- package/dist/core/miscellaneous/UIOrientation.js +20 -0
- package/dist/core/miscellaneous/UIPriority.d.ts +32 -0
- package/dist/core/miscellaneous/UIPriority.js +63 -0
- package/dist/core/miscellaneous/UIRelation.d.ts +23 -0
- package/dist/core/miscellaneous/UIRelation.js +40 -0
- package/dist/core/miscellaneous/UITransparencyMode.d.ts +9 -0
- package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
- package/dist/core/miscellaneous/area/UIArea.d.ts +3 -0
- package/dist/core/miscellaneous/area/UIArea.js +5 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +15 -0
- package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +12 -0
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +17 -0
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +21 -0
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
- package/dist/core/miscellaneous/asserts.d.ts +43 -0
- package/dist/core/miscellaneous/asserts.js +163 -0
- package/dist/core/miscellaneous/canvas.d.ts +31 -0
- package/dist/core/miscellaneous/canvas.js +37 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +7 -0
- package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
- package/dist/core/miscellaneous/color/UIColor.d.ts +234 -0
- package/dist/core/miscellaneous/color/UIColor.js +636 -0
- package/dist/core/miscellaneous/computeTransform.d.ts +18 -0
- package/dist/core/miscellaneous/computeTransform.js +82 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +19 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
- package/{src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.ts → dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts} +8 -10
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +38 -0
- package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.d.ts +11 -0
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +48 -0
- package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +9 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +21 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +16 -0
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
- package/dist/core/miscellaneous/math.d.ts +7 -0
- package/dist/core/miscellaneous/math.js +11 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.d.ts +31 -0
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +59 -0
- package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.d.ts +3 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +22 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +5 -0
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
- package/dist/core/miscellaneous/shared.d.ts +46 -0
- package/dist/core/miscellaneous/shared.js +37 -0
- package/{src/core/miscellaneous/text-span/UITextSpan.Internal.ts → dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts} +4 -5
- package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +14 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.d.ts +48 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +85 -0
- package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +49 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +67 -0
- package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
- package/dist/core/miscellaneous/webglCapabilities.d.ts +2 -0
- package/dist/core/miscellaneous/webglCapabilities.js +103 -0
- package/dist/core/shaders/UIImage.glsl.js +3 -0
- package/dist/core/shaders/UINineSlice.glsl.js +3 -0
- package/dist/core/shaders/UIProgress.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +17 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +13 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +13 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +20 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +49 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +215 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
- package/dist/index.js +51 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
- package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
- package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
- package/dist/particles/elements/UIEmitter.Internal.js +11 -0
- package/dist/particles/elements/UIEmitter.d.ts +68 -0
- package/dist/particles/elements/UIEmitter.js +203 -0
- package/dist/particles/index.js +18 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
- package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
- package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
- package/dist/particles/miscellaneous/miscellaneous.js +67 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
- package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
- package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
- package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
- package/dist/particles/spawnModules/UISpawnModule.js +9 -0
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
- package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
- package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
- package/package.json +8 -1
- package/.claude/settings.local.json +0 -9
- package/.editorconfig +0 -14
- package/CLAUDE.md +0 -181
- package/assets/logotype.png +0 -0
- package/eslint.config.js +0 -111
- package/rollup.config.js +0 -52
- package/src/core/constraints/UIAspectConstraint/UIAspectConstraint.ts +0 -60
- package/src/core/constraints/UIConstraint.ts +0 -20
- package/src/core/constraints/UICustomConstraint.ts +0 -62
- package/src/core/constraints/UIHeightConstraint/UIHeightConstraint.ts +0 -52
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.ts +0 -13
- package/src/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.ts +0 -139
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.ts +0 -16
- package/src/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.ts +0 -189
- package/src/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.ts +0 -68
- package/src/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.ts +0 -94
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.ts +0 -13
- package/src/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.ts +0 -135
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.ts +0 -16
- package/src/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.ts +0 -189
- package/src/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.ts +0 -68
- package/src/core/constraints/UIWidthConstraint/UIWidthConstraint.ts +0 -52
- package/src/core/constraints/builders/UIConstraint2DBuilder.Internal.ts +0 -84
- package/src/core/constraints/builders/UIConstraint2DBuilder.ts +0 -168
- package/src/core/constraints/builders/UICoverConstraintBuilder.Internal.ts +0 -15
- package/src/core/constraints/builders/UICoverConstraintBuilder.ts +0 -84
- package/src/core/constraints/builders/UIFitConstraintBuilder.Internal.ts +0 -15
- package/src/core/constraints/builders/UIFitConstraintBuilder.ts +0 -84
- package/src/core/elements/UIAnchor/UIAnchor.Internal.ts +0 -13
- package/src/core/elements/UIAnchor/UIAnchor.ts +0 -70
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.ts +0 -30
- package/src/core/elements/UIAnimatedImage/UIAnimatedImage.ts +0 -355
- package/src/core/elements/UIDummy/UIDummy.Internal.ts +0 -33
- package/src/core/elements/UIDummy/UIDummy.ts +0 -244
- package/src/core/elements/UIElement/UIElement.ts +0 -127
- package/src/core/elements/UIGraphics/UIGraphics.ts +0 -168
- package/src/core/elements/UIImage/UIImage.ts +0 -138
- package/src/core/elements/UINineSlice/UINineSlice.Internal.ts +0 -26
- package/src/core/elements/UINineSlice/UINineSlice.ts +0 -296
- package/src/core/elements/UIProgress/UIProgress.Internal.ts +0 -24
- package/src/core/elements/UIProgress/UIProgress.ts +0 -259
- package/src/core/elements/UIScene/UIScene.Internal.ts +0 -46
- package/src/core/elements/UIScene/UIScene.ts +0 -259
- package/src/core/elements/UIText/UIText.Internal.ts +0 -29
- package/src/core/elements/UIText/UIText.Measuring.ts +0 -183
- package/src/core/elements/UIText/UIText.Rendering.ts +0 -83
- package/src/core/elements/UIText/UIText.ts +0 -376
- package/src/core/layers/UIFullscreenLayer/UIFullscreenLayer.ts +0 -233
- package/src/core/layers/UILayer/UILayer.ts +0 -156
- package/src/core/miscellaneous/UIExpression.ts +0 -142
- package/src/core/miscellaneous/UIMode.ts +0 -29
- package/src/core/miscellaneous/UIOrientation.ts +0 -18
- package/src/core/miscellaneous/UIPriority.ts +0 -63
- package/src/core/miscellaneous/UIRelation.ts +0 -39
- package/src/core/miscellaneous/UITransparencyMode.ts +0 -9
- package/src/core/miscellaneous/area/UIArea.ts +0 -5
- package/src/core/miscellaneous/area/UIAreaCircle.ts +0 -32
- package/src/core/miscellaneous/area/UIAreaPolygon.ts +0 -50
- package/src/core/miscellaneous/area/UIAreaRectangle.ts +0 -38
- package/src/core/miscellaneous/area/UIAreaRoundedRectangle.ts +0 -78
- package/src/core/miscellaneous/asserts.ts +0 -187
- package/src/core/miscellaneous/canvas.ts +0 -73
- package/src/core/miscellaneous/color/UIColor.Internal.ts +0 -89
- package/src/core/miscellaneous/color/UIColor.ts +0 -844
- package/src/core/miscellaneous/computeTransform.ts +0 -127
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.ts +0 -235
- package/src/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.ts +0 -524
- package/src/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.ts +0 -448
- package/src/core/miscellaneous/generic-plane/shared.ts +0 -323
- package/src/core/miscellaneous/insets/UIInsets.Internal.ts +0 -9
- package/src/core/miscellaneous/insets/UIInsets.ts +0 -248
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunction.ts +0 -24
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.ts +0 -58
- package/src/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.ts +0 -52
- package/src/core/miscellaneous/math.ts +0 -16
- package/src/core/miscellaneous/micro/UIMicro.Internal.ts +0 -33
- package/src/core/miscellaneous/micro/UIMicro.ts +0 -222
- package/src/core/miscellaneous/resize-policy/UIResizePolicy.ts +0 -8
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCover.ts +0 -57
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCross.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFit.ts +0 -57
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.ts +0 -65
- package/src/core/miscellaneous/resize-policy/UIResizePolicyNone.ts +0 -11
- package/src/core/miscellaneous/shared.ts +0 -73
- package/src/core/miscellaneous/text-span/UITextSpan.ts +0 -43
- package/src/core/miscellaneous/text-style/UITextStyle.Internal.ts +0 -52
- package/src/core/miscellaneous/text-style/UITextStyle.ts +0 -479
- package/src/core/miscellaneous/texture/UITextureView.Internal.ts +0 -55
- package/src/core/miscellaneous/texture/UITextureView.ts +0 -308
- package/src/core/miscellaneous/webglCapabilities.ts +0 -129
- package/src/core/shaders/UIImage.glsl +0 -10
- package/src/core/shaders/UINineSlice.glsl +0 -53
- package/src/core/shaders/UIProgress.glsl +0 -15
- package/src/core/shaders/UIProgressMaskFunctionCircular.glsl +0 -13
- package/src/core/shaders/UIProgressMaskFunctionDirectional.glsl +0 -12
- package/src/core/shaders/glsl.d.ts +0 -27
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.ts +0 -23
- package/src/core/wrappers/UIInputWrapper/UIInputWrapper.ts +0 -124
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.ts +0 -22
- package/src/core/wrappers/UISceneWrapper/UISceneWrapper.ts +0 -101
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.ts +0 -58
- package/src/core/wrappers/UISolverWrapper/UISolverWrapper.ts +0 -605
- package/src/particles/behaviorModules/UIBehaviorDirectionalGravity.ts +0 -70
- package/src/particles/behaviorModules/UIBehaviorModule.ts +0 -20
- package/src/particles/behaviorModules/UIBehaviorPointGravity.ts +0 -173
- package/src/particles/behaviorModules/UIBehaviorScaleOverLife.ts +0 -104
- package/src/particles/behaviorModules/UIBehaviorTorqueDamping.ts +0 -75
- package/src/particles/behaviorModules/UIBehaviorTorqueNoise.ts +0 -115
- package/src/particles/behaviorModules/UIBehaviorVelocityDamping.ts +0 -77
- package/src/particles/behaviorModules/UIBehaviorVelocityNoise.ts +0 -118
- package/src/particles/elements/UIEmitter.Internal.ts +0 -22
- package/src/particles/elements/UIEmitter.ts +0 -313
- package/src/particles/instancedParticle/UIInstancedParticle.Internal.ts +0 -263
- package/src/particles/instancedParticle/UIInstancedParticle.ts +0 -138
- package/src/particles/miscellaneous/miscellaneous.ts +0 -115
- package/src/particles/renderingModules/UIRenderingColorOverLife.ts +0 -39
- package/src/particles/renderingModules/UIRenderingColorOverVelocity.ts +0 -49
- package/src/particles/renderingModules/UIRenderingModule.ts +0 -17
- package/src/particles/renderingModules/UIRenderingTexture.ts +0 -30
- package/src/particles/shaders/UIRenderingColorOverLife.glsl +0 -4
- package/src/particles/shaders/UIRenderingColorOverVelocity.glsl +0 -6
- package/src/particles/shaders/UIRenderingTexture.glsl +0 -4
- package/src/particles/spawnModules/UISpawnModule.ts +0 -22
- package/src/particles/spawnModules/UISpawnOffset.ts +0 -62
- package/src/particles/spawnModules/UISpawnRandomLifetime.ts +0 -68
- package/src/particles/spawnModules/UISpawnRandomRotation.ts +0 -60
- package/src/particles/spawnModules/UISpawnRandomScale.ts +0 -81
- package/src/particles/spawnModules/UISpawnRandomTorque.ts +0 -62
- package/src/particles/spawnModules/UISpawnRandomVelocity.ts +0 -92
- package/src/particles/spawnModules/UISpawnRectangle.ts +0 -81
- package/tsconfig.json +0 -29
- /package/{src/core/index.ts → dist/core/index.d.ts} +0 -0
- /package/{src/particles/index.ts → dist/particles/index.d.ts} +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { MathUtils, WebGLRenderTarget, UnsignedByteType, LinearFilter, RGBAFormat, Matrix3, Scene, PerspectiveCamera } from 'three';
|
|
2
|
+
import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
|
|
3
|
+
import { UIColor } from '../../miscellaneous/color/UIColor.js';
|
|
4
|
+
import source from '../../shaders/UIImage.glsl.js';
|
|
5
|
+
import { DUMMY_DEFAULT_WIDTH, DUMMY_DEFAULT_HEIGHT } from '../UIDummy/UIDummy.Internal.js';
|
|
6
|
+
import { UIElement } from '../UIElement/UIElement.js';
|
|
7
|
+
import { SCENE_DEFAULT_RESOLUTION_FACTOR, SCENE_MIN_RESOLUTION_FACTOR, SCENE_MAX_RESOLUTION_FACTOR, SCENE_DEFAULT_USE_DEPTH, SCENE_DEFAULT_CLEAR_COLOR, SCENE_DEFAULT_CAMERA_FOV, SCENE_DEFAULT_CAMERA_NEAR, SCENE_DEFAULT_CAMERA_FAR, SCENE_DEFAULT_UPDATE_MODE, UISceneUpdateMode } from './UIScene.Internal.js';
|
|
8
|
+
|
|
9
|
+
/** Renders Three.js scene to texture */
|
|
10
|
+
class UIScene extends UIElement {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new UIScene instance.
|
|
13
|
+
*
|
|
14
|
+
* @param layer - Layer containing this element
|
|
15
|
+
* @param options - Configuration options
|
|
16
|
+
* @throws If resolutionFactor outside range 0.1 to 2.0
|
|
17
|
+
*/
|
|
18
|
+
constructor(layer, options = {}) {
|
|
19
|
+
if (options.resolutionFactor !== undefined) {
|
|
20
|
+
assertValidPositiveNumber(options.resolutionFactor, "UIScene.constructor.resolutionFactor");
|
|
21
|
+
}
|
|
22
|
+
const resolutionFactor = MathUtils.clamp(options.resolutionFactor ?? SCENE_DEFAULT_RESOLUTION_FACTOR, SCENE_MIN_RESOLUTION_FACTOR, SCENE_MAX_RESOLUTION_FACTOR);
|
|
23
|
+
const w = options.width ?? DUMMY_DEFAULT_WIDTH;
|
|
24
|
+
const h = options.height ?? DUMMY_DEFAULT_HEIGHT;
|
|
25
|
+
const renderTarget = new WebGLRenderTarget(w * resolutionFactor, h * resolutionFactor, {
|
|
26
|
+
format: RGBAFormat,
|
|
27
|
+
minFilter: LinearFilter,
|
|
28
|
+
magFilter: LinearFilter,
|
|
29
|
+
type: UnsignedByteType,
|
|
30
|
+
depthBuffer: options.enableDepthBuffer ?? SCENE_DEFAULT_USE_DEPTH,
|
|
31
|
+
stencilBuffer: false,
|
|
32
|
+
});
|
|
33
|
+
const color = new UIColor(options.color);
|
|
34
|
+
super(layer, source, {
|
|
35
|
+
texture: renderTarget.texture,
|
|
36
|
+
textureTransform: new Matrix3(),
|
|
37
|
+
color,
|
|
38
|
+
}, options);
|
|
39
|
+
this._private_evenFrame = true;
|
|
40
|
+
this._private_updateRequired = false;
|
|
41
|
+
this._private_resolutionFactorDirty = false;
|
|
42
|
+
this._private_propertyDirty = false;
|
|
43
|
+
this._private_colorInternal = color;
|
|
44
|
+
this._private_clearColorInternal = new UIColor(options.clearColor ?? SCENE_DEFAULT_CLEAR_COLOR);
|
|
45
|
+
this._private_renderTarget = renderTarget;
|
|
46
|
+
this._private_sceneInternal = options.scene ?? new Scene();
|
|
47
|
+
this._private_cameraInternal =
|
|
48
|
+
options.camera ??
|
|
49
|
+
new PerspectiveCamera(SCENE_DEFAULT_CAMERA_FOV, w / h, SCENE_DEFAULT_CAMERA_NEAR, SCENE_DEFAULT_CAMERA_FAR);
|
|
50
|
+
this._private_resolutionFactorInternal = resolutionFactor;
|
|
51
|
+
this._private_updateModeInternal = options.updateMode ?? SCENE_DEFAULT_UPDATE_MODE;
|
|
52
|
+
this._private_propertyDirty = options.updateMode !== UISceneUpdateMode.MANUAL;
|
|
53
|
+
}
|
|
54
|
+
/** Camera used for rendering */
|
|
55
|
+
get camera() {
|
|
56
|
+
return this._private_cameraInternal;
|
|
57
|
+
}
|
|
58
|
+
/** Background color for render target */
|
|
59
|
+
get clearColor() {
|
|
60
|
+
return this._private_clearColorInternal;
|
|
61
|
+
}
|
|
62
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
63
|
+
get color() {
|
|
64
|
+
return this._private_colorInternal;
|
|
65
|
+
}
|
|
66
|
+
/** Render target resolution multiplier. Range 0.1 to 2.0. */
|
|
67
|
+
get resolutionFactor() {
|
|
68
|
+
return this._private_resolutionFactorInternal;
|
|
69
|
+
}
|
|
70
|
+
/** Three.js scene to render */
|
|
71
|
+
get scene() {
|
|
72
|
+
return this._private_sceneInternal;
|
|
73
|
+
}
|
|
74
|
+
/** Controls when scene re-renders */
|
|
75
|
+
get updateMode() {
|
|
76
|
+
return this._private_updateModeInternal;
|
|
77
|
+
}
|
|
78
|
+
/** Camera used for rendering */
|
|
79
|
+
set camera(value) {
|
|
80
|
+
if (this._private_cameraInternal !== value) {
|
|
81
|
+
this._private_cameraInternal = value;
|
|
82
|
+
this._private_propertyDirty = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Background color for render target */
|
|
86
|
+
set clearColor(value) {
|
|
87
|
+
this._private_clearColorInternal.set(value);
|
|
88
|
+
}
|
|
89
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
90
|
+
set color(value) {
|
|
91
|
+
this._private_colorInternal.set(value);
|
|
92
|
+
}
|
|
93
|
+
/** Render target resolution multiplier. Range 0.1 to 2.0. */
|
|
94
|
+
set resolutionFactor(value) {
|
|
95
|
+
assertValidPositiveNumber(value, "UIScene.resolutionFactor");
|
|
96
|
+
value = MathUtils.clamp(value, SCENE_MIN_RESOLUTION_FACTOR, SCENE_MAX_RESOLUTION_FACTOR);
|
|
97
|
+
if (this._private_resolutionFactorInternal !== value) {
|
|
98
|
+
this._private_resolutionFactorInternal = value;
|
|
99
|
+
this._private_resolutionFactorDirty = true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** Three.js scene to render */
|
|
103
|
+
set scene(value) {
|
|
104
|
+
if (this._private_sceneInternal !== value) {
|
|
105
|
+
this._private_sceneInternal = value;
|
|
106
|
+
this._private_propertyDirty = true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Controls when scene re-renders */
|
|
110
|
+
set updateMode(value) {
|
|
111
|
+
if (this._private_updateModeInternal !== value) {
|
|
112
|
+
this._private_updateModeInternal = value;
|
|
113
|
+
this._private_propertyDirty = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Removes element and frees resources */
|
|
117
|
+
destroy() {
|
|
118
|
+
this._private_renderTarget.dispose();
|
|
119
|
+
super.destroy();
|
|
120
|
+
}
|
|
121
|
+
/** Triggers re-render on next frame. Useful in MANUAL mode. */
|
|
122
|
+
requestUpdate() {
|
|
123
|
+
this._private_updateRequired = true;
|
|
124
|
+
}
|
|
125
|
+
onWillRender(renderer, deltaTime) {
|
|
126
|
+
this._private_evenFrame = !this._private_evenFrame;
|
|
127
|
+
const isFramebufferDirty = this._private_updateRequired ||
|
|
128
|
+
this._private_updateModeInternal === UISceneUpdateMode.EVERY_FRAME ||
|
|
129
|
+
(this._private_updateModeInternal === UISceneUpdateMode.EVERY_SECOND_FRAME && this._private_evenFrame) ||
|
|
130
|
+
(this._private_updateModeInternal === UISceneUpdateMode.ON_PROPERTIES_CHANGE && this._private_propertyDirty) ||
|
|
131
|
+
this._private_colorInternal.dirty ||
|
|
132
|
+
this._private_clearColorInternal.dirty ||
|
|
133
|
+
(this._private_updateModeInternal === UISceneUpdateMode.ON_DIMENSIONS_CHANGE &&
|
|
134
|
+
(this._private_resolutionFactorDirty || this.solverWrapper.dirty));
|
|
135
|
+
if (isFramebufferDirty) {
|
|
136
|
+
if (this._private_resolutionFactorDirty || this.solverWrapper.dirty) {
|
|
137
|
+
this._private_renderTarget.setSize(this.width * this._private_resolutionFactorInternal, this.height * this._private_resolutionFactorInternal);
|
|
138
|
+
this._private_resolutionFactorDirty = false;
|
|
139
|
+
}
|
|
140
|
+
if (this._private_colorInternal.dirty) {
|
|
141
|
+
this.sceneWrapper.setProperties(this.planeHandler, {
|
|
142
|
+
color: this._private_colorInternal,
|
|
143
|
+
});
|
|
144
|
+
this._private_colorInternal.setDirtyFalse();
|
|
145
|
+
}
|
|
146
|
+
renderer.setClearColor(this._private_clearColorInternal.getHexRGB(), this._private_clearColorInternal.a);
|
|
147
|
+
renderer.setRenderTarget(this._private_renderTarget);
|
|
148
|
+
renderer.clear(true, true, false);
|
|
149
|
+
renderer.render(this._private_sceneInternal, this._private_cameraInternal);
|
|
150
|
+
this._private_propertyDirty = false;
|
|
151
|
+
this._private_updateRequired = false;
|
|
152
|
+
}
|
|
153
|
+
super.onWillRender(renderer, deltaTime);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export { UIScene };
|
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
import type { UITextSpanConfig } from "../../miscellaneous/text-span/UITextSpan.Internal";
|
|
2
2
|
import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal";
|
|
3
|
-
|
|
4
3
|
/** Text content configuration */
|
|
5
4
|
export type UITextContent = (UITextSpanConfig | string)[] | UITextSpanConfig | string;
|
|
6
|
-
|
|
7
5
|
/** Text dimensions */
|
|
8
6
|
export interface UITextSize {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/** Width in pixels */
|
|
8
|
+
width: number;
|
|
9
|
+
/** Height in pixels */
|
|
10
|
+
height: number;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
/** Text chunk metrics */
|
|
16
13
|
export interface UIChunkMetrics extends UITextSize {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
/** Baseline offset from top in pixels */
|
|
15
|
+
baseline: number;
|
|
16
|
+
/** Line height in pixels */
|
|
17
|
+
lineHeight: number;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
/** Styled text chunk */
|
|
24
20
|
export interface UITextChunk {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
/** Text content */
|
|
22
|
+
text: string;
|
|
23
|
+
/** Resolved style */
|
|
24
|
+
style: UITextStyleConfig;
|
|
25
|
+
/** Chunk metrics */
|
|
26
|
+
metrics: UIChunkMetrics;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
/** Line of text chunks */
|
|
34
29
|
export interface UITextLine extends UIChunkMetrics {
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
/** Chunks in this line */
|
|
31
|
+
chunks: UITextChunk[];
|
|
37
32
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
|
|
2
|
+
import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal";
|
|
3
|
+
import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal";
|
|
4
|
+
import type { UIElementOptions } from "../UIElement/UIElement.Internal";
|
|
5
|
+
/** Controls how text adapts to element size */
|
|
6
|
+
export declare enum UITextResizeMode {
|
|
7
|
+
/** Break text into multiple lines when narrower than content*/
|
|
8
|
+
BREAK = 0,
|
|
9
|
+
/** Scale text to fit fixed element size */
|
|
10
|
+
SCALE = 1
|
|
11
|
+
}
|
|
12
|
+
/** Configuration options for UIText */
|
|
13
|
+
export interface UITextOptions extends UIElementOptions {
|
|
14
|
+
/** Multiplicative tint */
|
|
15
|
+
color: UIColorConfig;
|
|
16
|
+
/** Text padding in world units */
|
|
17
|
+
padding: UIInsetsConfig;
|
|
18
|
+
/** Default style applied to all spans */
|
|
19
|
+
commonStyle: Partial<UITextStyleConfig>;
|
|
20
|
+
/** How text adapts to size constraints */
|
|
21
|
+
resizeMode: UITextResizeMode;
|
|
22
|
+
/** Maximum line width before wrapping in pixels */
|
|
23
|
+
maxLineWidth: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const TEXT_DEFAULT_MAX_LINE_WIDTH = 1024;
|
|
26
|
+
export declare const TEXT_DEFAULT_RESIZE_MODE = UITextResizeMode.SCALE;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Controls how text adapts to element size */
|
|
2
|
+
var UITextResizeMode;
|
|
3
|
+
(function (UITextResizeMode) {
|
|
4
|
+
/** Break text into multiple lines when narrower than content*/
|
|
5
|
+
UITextResizeMode[UITextResizeMode["BREAK"] = 0] = "BREAK";
|
|
6
|
+
/** Scale text to fit fixed element size */
|
|
7
|
+
UITextResizeMode[UITextResizeMode["SCALE"] = 1] = "SCALE";
|
|
8
|
+
})(UITextResizeMode || (UITextResizeMode = {}));
|
|
9
|
+
const TEXT_DEFAULT_MAX_LINE_WIDTH = 1024;
|
|
10
|
+
const TEXT_DEFAULT_RESIZE_MODE = UITextResizeMode.SCALE;
|
|
11
|
+
|
|
12
|
+
export { TEXT_DEFAULT_MAX_LINE_WIDTH, TEXT_DEFAULT_RESIZE_MODE, UITextResizeMode };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { UICanvasRenderingContext2D } from "../../miscellaneous/canvas";
|
|
2
|
+
import type { UITextSpan } from "../../miscellaneous/text-span/UITextSpan";
|
|
3
|
+
import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle";
|
|
4
|
+
import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal";
|
|
5
|
+
import type { UIChunkMetrics, UITextChunk, UITextLine, UITextSize } from "./UIText.Interfaces";
|
|
6
|
+
/**
|
|
7
|
+
* Splits text into renderable chunks.
|
|
8
|
+
* @param text Text to split
|
|
9
|
+
* @returns Array of words, spaces, and newlines
|
|
10
|
+
*/
|
|
11
|
+
export declare function splitTextIntoChunks(text: string): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Measures single text chunk.
|
|
14
|
+
* @param context Canvas context for measurement
|
|
15
|
+
* @param text Chunk text
|
|
16
|
+
* @param textStyle Resolved text style
|
|
17
|
+
* @returns Chunk metrics
|
|
18
|
+
*/
|
|
19
|
+
export declare function measureTextChunk(context: UICanvasRenderingContext2D, text: string, textStyle: UITextStyleConfig): UIChunkMetrics;
|
|
20
|
+
/**
|
|
21
|
+
* Builds text lines with word wrapping.
|
|
22
|
+
* @param maxWidth Maximum line width in pixels
|
|
23
|
+
* @param textChunks Measured text chunks
|
|
24
|
+
* @returns Array of text lines
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildTextLines(maxWidth: number, textChunks: UITextChunk[]): UITextLine[];
|
|
27
|
+
/**
|
|
28
|
+
* Calculates total text size from lines.
|
|
29
|
+
* @param lines Text lines
|
|
30
|
+
* @returns Total width and height
|
|
31
|
+
*/
|
|
32
|
+
export declare function calculateTextSize(lines: UITextLine[]): UITextSize;
|
|
33
|
+
/**
|
|
34
|
+
* Builds measured text chunks from spans.
|
|
35
|
+
* @param context Canvas context for measurement
|
|
36
|
+
* @param textSpans Text spans with styles
|
|
37
|
+
* @param commonStyle Fallback style
|
|
38
|
+
* @returns Measured text chunks
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildTextChunks(context: UICanvasRenderingContext2D, textSpans: UITextSpan[], commonStyle: UITextStyle): UITextChunk[];
|
|
41
|
+
/**
|
|
42
|
+
* Calculates text layout parameters.
|
|
43
|
+
* @param textChunks Measured text chunks
|
|
44
|
+
* @param maxLineWidth Maximum line width in pixels
|
|
45
|
+
* @returns Lines and total size
|
|
46
|
+
*/
|
|
47
|
+
export declare function calculateTextContentParameters(textChunks: UITextChunk[], maxLineWidth: number): {
|
|
48
|
+
lines: UITextLine[];
|
|
49
|
+
size: UITextSize;
|
|
50
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { UITextStyle } from '../../miscellaneous/text-style/UITextStyle.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Splits text into renderable chunks.
|
|
5
|
+
* @param text Text to split
|
|
6
|
+
* @returns Array of words, spaces, and newlines
|
|
7
|
+
*/
|
|
8
|
+
function splitTextIntoChunks(text) {
|
|
9
|
+
return text.match(/\S+|\s|\n/g) ?? [];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Measures single text chunk.
|
|
13
|
+
* @param context Canvas context for measurement
|
|
14
|
+
* @param text Chunk text
|
|
15
|
+
* @param textStyle Resolved text style
|
|
16
|
+
* @returns Chunk metrics
|
|
17
|
+
*/
|
|
18
|
+
function measureTextChunk(context, text, textStyle) {
|
|
19
|
+
context.font = `${textStyle.fontStyle} ${textStyle.fontWeight} ${textStyle.fontSize}px "${textStyle.fontFamily}"`;
|
|
20
|
+
if (text === "\n") {
|
|
21
|
+
return {
|
|
22
|
+
width: Math.ceil(1),
|
|
23
|
+
height: textStyle.lineHeight,
|
|
24
|
+
baseline: 0,
|
|
25
|
+
lineHeight: textStyle.lineHeight,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const metrics = context.measureText(text);
|
|
29
|
+
const width = Math.ceil(metrics.width);
|
|
30
|
+
const height = Math.ceil(metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
|
|
31
|
+
return {
|
|
32
|
+
width,
|
|
33
|
+
height,
|
|
34
|
+
baseline: metrics.actualBoundingBoxDescent,
|
|
35
|
+
lineHeight: textStyle.lineHeight,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Builds text lines with word wrapping.
|
|
40
|
+
* @param maxWidth Maximum line width in pixels
|
|
41
|
+
* @param textChunks Measured text chunks
|
|
42
|
+
* @returns Array of text lines
|
|
43
|
+
*/
|
|
44
|
+
function buildTextLines(maxWidth, textChunks) {
|
|
45
|
+
const lines = [];
|
|
46
|
+
let currentLine = [];
|
|
47
|
+
let currentWidth = 0;
|
|
48
|
+
let currentHeight = 0;
|
|
49
|
+
let currentBaseline = 0;
|
|
50
|
+
let currentLineHeight = 0;
|
|
51
|
+
for (const textChunk of textChunks) {
|
|
52
|
+
if (textChunk.text === "\n") {
|
|
53
|
+
if (currentLine.length > 0) {
|
|
54
|
+
lines.push({
|
|
55
|
+
chunks: currentLine,
|
|
56
|
+
width: currentWidth,
|
|
57
|
+
height: currentHeight,
|
|
58
|
+
baseline: currentBaseline,
|
|
59
|
+
lineHeight: currentLineHeight,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
currentLine = [];
|
|
63
|
+
currentWidth = 0;
|
|
64
|
+
currentHeight = 0;
|
|
65
|
+
currentBaseline = 0;
|
|
66
|
+
currentLineHeight = 0;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (currentLine.length === 0 || currentWidth + textChunk.metrics.width <= maxWidth) {
|
|
70
|
+
currentLine.push(textChunk);
|
|
71
|
+
currentWidth += textChunk.metrics.width;
|
|
72
|
+
currentHeight = Math.max(currentHeight, textChunk.metrics.height);
|
|
73
|
+
currentBaseline = Math.max(currentBaseline, textChunk.metrics.baseline);
|
|
74
|
+
currentLineHeight = Math.max(currentLineHeight, textChunk.metrics.lineHeight);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
lines.push({
|
|
78
|
+
chunks: currentLine,
|
|
79
|
+
width: currentWidth,
|
|
80
|
+
height: currentHeight,
|
|
81
|
+
baseline: currentBaseline,
|
|
82
|
+
lineHeight: currentLineHeight,
|
|
83
|
+
});
|
|
84
|
+
currentLine = [textChunk];
|
|
85
|
+
currentWidth = textChunk.metrics.width;
|
|
86
|
+
currentHeight = textChunk.metrics.height;
|
|
87
|
+
currentBaseline = textChunk.metrics.baseline;
|
|
88
|
+
currentLineHeight = textChunk.metrics.lineHeight;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (currentLine.length > 0) {
|
|
92
|
+
lines.push({
|
|
93
|
+
chunks: currentLine,
|
|
94
|
+
width: currentWidth,
|
|
95
|
+
height: currentHeight,
|
|
96
|
+
baseline: currentBaseline,
|
|
97
|
+
lineHeight: currentLineHeight,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return lines;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Calculates total text size from lines.
|
|
104
|
+
* @param lines Text lines
|
|
105
|
+
* @returns Total width and height
|
|
106
|
+
*/
|
|
107
|
+
function calculateTextSize(lines) {
|
|
108
|
+
if (lines.length === 0) {
|
|
109
|
+
return { width: 0, height: 0 };
|
|
110
|
+
}
|
|
111
|
+
const maxLineWidth = Math.max(...lines.map((line) => line.width));
|
|
112
|
+
let totalHeight = 0;
|
|
113
|
+
for (let i = 0; i < lines.length; i++) {
|
|
114
|
+
const line = lines[i];
|
|
115
|
+
totalHeight += i === 0 ? line.height : line.lineHeight;
|
|
116
|
+
}
|
|
117
|
+
return { width: maxLineWidth, height: totalHeight };
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Builds measured text chunks from spans.
|
|
121
|
+
* @param context Canvas context for measurement
|
|
122
|
+
* @param textSpans Text spans with styles
|
|
123
|
+
* @param commonStyle Fallback style
|
|
124
|
+
* @returns Measured text chunks
|
|
125
|
+
*/
|
|
126
|
+
function buildTextChunks(context, textSpans, commonStyle) {
|
|
127
|
+
const textChunks = [];
|
|
128
|
+
for (const textSpan of textSpans) {
|
|
129
|
+
const textStyle = UITextStyle.resolve(textSpan.style, commonStyle);
|
|
130
|
+
for (const textChunk of splitTextIntoChunks(textSpan.text)) {
|
|
131
|
+
const textChunkMetrics = measureTextChunk(context, textChunk, textStyle);
|
|
132
|
+
textChunks.push({
|
|
133
|
+
text: textChunk,
|
|
134
|
+
style: textStyle,
|
|
135
|
+
metrics: textChunkMetrics,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return textChunks;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Calculates text layout parameters.
|
|
143
|
+
* @param textChunks Measured text chunks
|
|
144
|
+
* @param maxLineWidth Maximum line width in pixels
|
|
145
|
+
* @returns Lines and total size
|
|
146
|
+
*/
|
|
147
|
+
function calculateTextContentParameters(textChunks, maxLineWidth) {
|
|
148
|
+
const lines = buildTextLines(maxLineWidth, textChunks);
|
|
149
|
+
const size = calculateTextSize(lines);
|
|
150
|
+
return { lines, size };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { buildTextChunks, buildTextLines, calculateTextContentParameters, calculateTextSize, measureTextChunk, splitTextIntoChunks };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UICanvasRenderingContext2D } from "../../miscellaneous/canvas";
|
|
2
|
+
import type { UITextStyleConfig } from "../../miscellaneous/text-style/UITextStyle.Internal";
|
|
3
|
+
import type { UITextLine } from "./UIText.Interfaces";
|
|
4
|
+
/**
|
|
5
|
+
* Renders single text chunk.
|
|
6
|
+
* @param x X coordinate in pixels
|
|
7
|
+
* @param y Y coordinate in pixels
|
|
8
|
+
* @param text Chunk text
|
|
9
|
+
* @param style Resolved text style
|
|
10
|
+
* @param context Canvas rendering context
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderTextChunk(x: number, y: number, text: string, style: UITextStyleConfig, context: UICanvasRenderingContext2D): void;
|
|
13
|
+
/**
|
|
14
|
+
* Renders text lines to canvas.
|
|
15
|
+
* @param paddingTop Top padding in pixels
|
|
16
|
+
* @param paddingLeft Left padding in pixels
|
|
17
|
+
* @param lines Text lines to render
|
|
18
|
+
* @param context Canvas rendering context
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderTextLines(paddingTop: number, paddingLeft: number, lines: UITextLine[], context: UICanvasRenderingContext2D): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { TEXT_STYLE_DEFAULT_ALIGN } from '../../miscellaneous/text-style/UITextStyle.Internal.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Renders single text chunk.
|
|
5
|
+
* @param x X coordinate in pixels
|
|
6
|
+
* @param y Y coordinate in pixels
|
|
7
|
+
* @param text Chunk text
|
|
8
|
+
* @param style Resolved text style
|
|
9
|
+
* @param context Canvas rendering context
|
|
10
|
+
*/
|
|
11
|
+
function renderTextChunk(x, y, text, style, context) {
|
|
12
|
+
context.font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize}px "${style.fontFamily}"`;
|
|
13
|
+
if (style.enableShadow) {
|
|
14
|
+
context.shadowOffsetX = style.shadowOffsetX;
|
|
15
|
+
context.shadowOffsetY = style.shadowOffsetY;
|
|
16
|
+
context.shadowBlur = style.shadowBlur;
|
|
17
|
+
context.shadowColor = style.shadowColor;
|
|
18
|
+
}
|
|
19
|
+
if (style.enableStroke) {
|
|
20
|
+
context.strokeStyle = style.strokeColor;
|
|
21
|
+
context.lineWidth = style.strokeThickness;
|
|
22
|
+
context.strokeText(text, x, y);
|
|
23
|
+
}
|
|
24
|
+
context.fillStyle = style.color;
|
|
25
|
+
context.fillText(text, x, y);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Renders text lines to canvas.
|
|
29
|
+
* @param paddingTop Top padding in pixels
|
|
30
|
+
* @param paddingLeft Left padding in pixels
|
|
31
|
+
* @param lines Text lines to render
|
|
32
|
+
* @param context Canvas rendering context
|
|
33
|
+
*/
|
|
34
|
+
function renderTextLines(paddingTop, paddingLeft, lines, context) {
|
|
35
|
+
let currentY = paddingTop;
|
|
36
|
+
let textWidth = 0;
|
|
37
|
+
for (const line of lines) {
|
|
38
|
+
textWidth = Math.max(line.width, textWidth);
|
|
39
|
+
}
|
|
40
|
+
for (let i = 0; i < lines.length; i++) {
|
|
41
|
+
const line = lines[i];
|
|
42
|
+
const firstAlign = line.chunks[0]?.style.align ?? TEXT_STYLE_DEFAULT_ALIGN;
|
|
43
|
+
const isUniformAlign = line.chunks.every((c) => c.style.align === firstAlign);
|
|
44
|
+
const lineAlign = isUniformAlign ? firstAlign : TEXT_STYLE_DEFAULT_ALIGN;
|
|
45
|
+
let offsetX = 0;
|
|
46
|
+
if (lineAlign === "center") {
|
|
47
|
+
offsetX = (textWidth - line.width) / 2;
|
|
48
|
+
}
|
|
49
|
+
else if (lineAlign === "right") {
|
|
50
|
+
offsetX = textWidth - line.width;
|
|
51
|
+
}
|
|
52
|
+
let currentX = paddingLeft + offsetX;
|
|
53
|
+
currentY += i === 0 ? line.height : line.lineHeight;
|
|
54
|
+
for (const chunk of line.chunks) {
|
|
55
|
+
renderTextChunk(currentX, currentY, chunk.text, chunk.style, context);
|
|
56
|
+
currentX += chunk.metrics.width;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { renderTextChunk, renderTextLines };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { WebGLRenderer } from "three";
|
|
2
|
+
import type { UILayer } from "../../layers/UILayer/UILayer";
|
|
3
|
+
import { UIColor } from "../../miscellaneous/color/UIColor";
|
|
4
|
+
import type { UIColorConfig } from "../../miscellaneous/color/UIColor.Internal";
|
|
5
|
+
import { UIInsets } from "../../miscellaneous/insets/UIInsets";
|
|
6
|
+
import type { UIInsetsConfig } from "../../miscellaneous/insets/UIInsets.Internal";
|
|
7
|
+
import { UITextSpan } from "../../miscellaneous/text-span/UITextSpan";
|
|
8
|
+
import { UITextStyle } from "../../miscellaneous/text-style/UITextStyle";
|
|
9
|
+
import { UIElement } from "../UIElement/UIElement";
|
|
10
|
+
import type { UITextContent } from "./UIText.Interfaces";
|
|
11
|
+
import type { UITextOptions } from "./UIText.Internal";
|
|
12
|
+
import { UITextResizeMode } from "./UIText.Internal";
|
|
13
|
+
/** Canvas-based text rendering element */
|
|
14
|
+
export declare class UIText extends UIElement {
|
|
15
|
+
/** Default style applied to all text spans */
|
|
16
|
+
readonly commonStyle: UITextStyle;
|
|
17
|
+
private readonly colorInternal;
|
|
18
|
+
private readonly paddingInternal;
|
|
19
|
+
private readonly canvas;
|
|
20
|
+
private readonly context;
|
|
21
|
+
private texture;
|
|
22
|
+
private contentInternal;
|
|
23
|
+
private contentDirty;
|
|
24
|
+
private maxLineWidthInternal;
|
|
25
|
+
private maxLineWidthDirty;
|
|
26
|
+
private resizeModeInternal;
|
|
27
|
+
private resizeModeDirty;
|
|
28
|
+
private lastWidth;
|
|
29
|
+
private lastHeight;
|
|
30
|
+
private textChunks;
|
|
31
|
+
private textChunksDirty;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new UIText instance.
|
|
34
|
+
*
|
|
35
|
+
* @param layer - Layer containing this element
|
|
36
|
+
* @param content - Text content as string or styled spans
|
|
37
|
+
* @param options - Configuration options
|
|
38
|
+
*/
|
|
39
|
+
constructor(layer: UILayer, content: UITextContent, options?: Partial<UITextOptions>);
|
|
40
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
41
|
+
get color(): UIColor;
|
|
42
|
+
/** Text content as array of styled spans */
|
|
43
|
+
get content(): UITextSpan[];
|
|
44
|
+
/** Maximum line width before wrapping in pixels */
|
|
45
|
+
get maxLineWidth(): number;
|
|
46
|
+
/** Text padding in world units */
|
|
47
|
+
get padding(): UIInsets;
|
|
48
|
+
/** Controls how text adapts to element size */
|
|
49
|
+
get resizeMode(): UITextResizeMode;
|
|
50
|
+
/** Multiplicative tint. Alpha channel controls opacity. */
|
|
51
|
+
set color(value: UIColorConfig);
|
|
52
|
+
/** Text content as string, span config, or array */
|
|
53
|
+
set content(value: UITextContent);
|
|
54
|
+
/** Maximum line width before wrapping in pixels */
|
|
55
|
+
set maxLineWidth(value: number);
|
|
56
|
+
/** Text padding in world units */
|
|
57
|
+
set padding(value: UIInsetsConfig);
|
|
58
|
+
/** Controls how text adapts to size constraints */
|
|
59
|
+
set resizeMode(value: UITextResizeMode);
|
|
60
|
+
/** Removes element and frees resources */
|
|
61
|
+
destroy(): void;
|
|
62
|
+
protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
|
|
63
|
+
private tryToRenderTextScaleMode;
|
|
64
|
+
private tryToRenderTextBreakMode;
|
|
65
|
+
private updateProperties;
|
|
66
|
+
private buildTextChunks;
|
|
67
|
+
private checkDimensionsDirty;
|
|
68
|
+
private setDimensionsDirtyFalse;
|
|
69
|
+
private checkContentDirty;
|
|
70
|
+
private setContentDirtyFalse;
|
|
71
|
+
}
|